History log of /frameworks/base/core/java/android/content/ContextWrapper.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ea7e91514ee1968d15713e82a5cca745e2c46a05 25-Sep-2012 Amith Yamasani <yamasani@google.com> AppInfo from Notifications for secondary users

Required wiring up startActivitiesAsUser()

Bug: 7224950

Also fix a bug in navigateUp in secondary user

Change-Id: I114ae2de0457362d62e899fdb94b12239a3eb778
6d51571835737c7502a2e111ee9dc2527ebad984 21-Sep-2012 Jeff Sharkey <jsharkey@android.com> Allow acquiring ContentProviders across users.

Otherwise services like SystemUI will always open content://-style
Uris as USER_OWNER. Surfaces through createPackageContextAsUser()
which points all ContentResolver operations towards a given user.

Start using in RemoteViews, so that Notifications correctly resolve
image Uris to the sending user. Also add user support for "content"
shell tool.

Bug: 7202982
Change-Id: I8cb7fb8a812e825bb0b5833799dba87055ff8699
20e809870d8ac1e5b848f2daf51b2272ef89bdfc 01-Sep-2012 Dianne Hackborn <hackbod@google.com> Add registering for explicit users.

New API to register as an explicit user, which allows you to
also select ALL to see broadcasts for all users.

New BroadcastReceiver API to find out which user the broadcast
was sent to.

Use this in app widget service to handle per-user package broadcasts
and boot completed broadcasts correctly.

Change-Id: Ibbe28993bd4aa93900c79e412026c27863019eb8
a492c3a7b2c18426fd0cb4d017eacbc368195dc5 24-Aug-2012 Jeff Brown <jeffbrown@google.com> Initial draft of high-level multi-display APIs.

This patch introduces the ability to create a Context that
is bound to a Display. The context gets its configuration and
metrics from that display and is able to provide a WindowManager
that is bound to the display.

To make it easier to use, we also add a new kind of Dialog
called a Presentation. Presentation takes care of setting
up the context as needed and watches for significant changes
in the display configuration. If the display is removed,
then the presentation simply dismisses itself.

Change-Id: Idc54b4ec84b1ff91505cfb78910cf8cd09696d7d
5ac72a29593ab9a20337a2225df52bdf4754be02 30-Aug-2012 Dianne Hackborn <hackbod@google.com> Improve multi-user broadcasts.

You can now use ALL and CURRENT when sending broadcasts, to specify
where the broadcast goes.

Sticky broadcasts are now correctly separated per user, and registered
receivers are filtered based on the requested target user.

New Context APIs for more kinds of sending broadcasts as users.

Updating a bunch of system code that sends broadcasts to explicitly
specify which user the broadcast goes to.

Made a single version of the code for interpreting the requested
target user ID that all entries to activity manager (start activity,
send broadcast, start service) use.

Change-Id: Ie29f02dd5242ef8c8fa56c54593a315cd2574e1c
7767eac3232ba2fb9828766813cdb481d6a97584 24-Aug-2012 Dianne Hackborn <hackbod@google.com> Keep track of whether an app is installed for each user.

This add a new per-user state for an app, indicating whether
it is installed for that user.

All system apps are always installed for all users (we still
use disable to "uninstall" them).

Now when you call into the package manager to install an app,
it will only install the app for that user unless you supply
a flag saying to install for all users. Only being installed
for the user is just the normal install state, but all other
users have marked in their state for that app that it is not

When you call the package manager APIs for information about
apps, uninstalled apps are treated as really being not visible
(somewhat more-so than disabled apps), unless you use the

If another user calls to install an app that is already installed,
just not for them, then the normal install process takes place
but in addition that user's installed state is toggled on.

The package manager will not send PACKAGE_ADDED, PACKAGE_REMOVED,
PACKAGE_REPLACED etc broadcasts to users who don't have a package
installed or not being involved in a change in the install state.
There are a few things that are not quite right with this -- for
example if you go through a full install (with a new apk) of an
app for one user who doesn't have it already installed, you will
still get the PACKAGED_REPLACED messages even though this is
technically the first install for your user. I'm not sure how
much of an issue this is.

When you call the existing API to uninstall an app, this toggles
the installed state of the app for that user to be off. Only if
that is the last user user that has the app uinstalled will it
actually be removed from the device. Again there is a new flag
you can pass in to force the app to be uninstalled for all users.

Also fixed issues with cleaning external storage of apps, which
was not dealing with multiple users. We now keep track of cleaning
each user for each package.

Change-Id: I00e66452b149defc08c5e0183fa673f532465ed5
98365d7663cbd82979a5700faf0050220b01084d 20-Aug-2012 Jeff Brown <jeffbrown@google.com> Refactor for multi-display support.

Split WindowManagerImpl into two parts, the WindowManager
interface implementation remains where it is but the global
communications with the window manager are now handled by
the WindowManagerGlobal class. This change greatly simplifies
the challenge of having separate WindowManager instances
for each Context.

Removed WindowManagerImpl.getDefault(). This represents the
bulk of this change. Most of the usages of this method were
either to perform global functions (now handled by WindowManagerGlobal)
or to obtain the default display (now handled by DisplayManager).

Explicitly associate each new window with a display and make
the Display object available to the View hierarchy.

Add stubs for some new display manager API features.

Start to split apart the concepts of display id and layer stack.
since they operate at different layers of abstraction.
While it's true that each logical display uniquely corresponds to a
surface flinger layer stack, it is not necessarily the case that
they must use the same ids. Added Display.getLayerStack()
and started using it in places where it was relatively easy to do.

Change-Id: I29ed909114dec86807c4d3a5059c3fa0358bea61
79af1dd54c16cde063152922b42c96d72ae9eca8 17-Aug-2012 Dianne Hackborn <hackbod@google.com> Switch public APIs to use new UserHandle class for identifying users.

Gets rid of "yet another integer" confusion.

Change-Id: Id07ea7307aea7c62f0087c6663a1f1c08e2e5dee
756220bd1912535840388a6743830d2e59ad4964 15-Aug-2012 Dianne Hackborn <hackbod@google.com> Add API to create new contexts with custom configurations.

This allows you to, say, make a Context whose configuration
is set to a different density than the actual density of the device.

The main API is Context.createConfigurationContext(). There is
also a new API on ContextThemeWrapper that allows you to apply
an override context before its resources are retrieved, which
addresses some feature requests from developers to be able to
customize the context their app is running in.

Change-Id: I88364986660088521e24b567e2fda22fb7042819
258848d2ae04f447ff1c18023fa76b139fcc0862 11-Aug-2012 Amith Yamasani <yamasani@google.com> User Manager service to manage users and query user details

Moved a bunch of methods from PackageManager to UserManager.

Fix launching of activities from recents to correct user.

Guest creation APIs

Change-Id: I0733405e6eb2829675665e225c759d6baa2b708f
8264408f5995534f8e3147b001664ea0df52aaa5 03-Aug-2012 Amith Yamasani <yamasani@google.com> Start the correct settings from the status bar.

Added a new method to Context: startActivityAsUser() requiring the

Show the correct Recents list, based on current user.
Added a getRecentTasksForUser() in ActivityManager. Hidden and requires

Change-Id: If5b56465efdd3ead36601a3b51ed4af157bbf35c
7d19e0242faac8017033dabb872cdf1542fa184c 08-Aug-2012 Dianne Hackborn <hackbod@google.com> More mult-user API work.

- You can now use android:singleUser with receivers and providers.
- New API to send ordered broadcasts as a user.
- New Process.myUserHandle() API.

For now I am trying out "user handle" as the name for the numbers
representing users.

Change-Id: I754c713ab172494bb4251bc7a37a17324a2e235e
b4163a6e12ee7100c758c6d3d062ade1f2843fce 03-Aug-2012 Dianne Hackborn <hackbod@google.com> Add APIs for interacting across users.

- Expose the existing Context.sendBroadcast() as
- Add new android:singleUser attribute for services.
- Add new INTERACT_ACROSS_USERS_FULL permission for full
system-level access to cross-user interface (allows
sendBroadcastAsUser() to send to any receiver).
- Add new INTERACT_ACROSS_USERS_FULL permission for
more restricted cross-user interaction: this is required
for android:singleUser, and allows you to use
sendBroadcastAsUser() but only to send to your own

Change-Id: I0de88f6718e9505f4de72e3f45d29c0f503b76e9
a4972e951bf2bdb7afdafee95b3ab0c15b8bacae 14-Mar-2012 Dianne Hackborn <hackbod@google.com> Add new "options" argument to all startActivity APIs.

This will be used to allow new features to be requested... such as,
say, a special kind of animation. Right now there are no options

Change-Id: I4eb6f27275cdd4bf186f6da316ab93a2372ad4b7
67cf7d314b5b94db1a9f1c57140b6615b0ea8291 16-Feb-2012 Amith Yamasani <yamasani@google.com> Fix Power Control widget

Some changes in AppWidgetService were interfering with widget permissions.

Added some hidden methods in Context to communicate the requesting user
information instead of using the calling uid.

Bug: 6019296
Change-Id: I5e519fd3fbbfa5b3fcc5c297b729c671dac8e7c7
37ce3a8af6faab675319d0803b288ab1dddc76be 06-Feb-2012 Amith Yamasani <yamasani@google.com> Multi-user - wallpaper service

- Allow each user to have their own wallpaper (live or static).
- Migrate old wallpaper on upgrade.
- Update SystemBackupAgent to backup/restore from primary user's
new wallpaper directory.

Reduce dependency on Binder.getOrigCallingUser() by passing the
userId for bindService.

Change-Id: I19c8c3296d3d2efa7f28f951d4b84407489e2166
805fd7ee0e5dc2939e85c84f78d9890a51982bc0 17-Jan-2011 Dianne Hackborn <hackbod@google.com> Add API to get path to OBBs.

Also hide the bitmap thumbnail stuff, we can't support it in its
current form.

And fix some bugs with propagating paths to native code. Yikes!

Change-Id: I13ab37ddbdba5c073489cba5eab035117d3c1574
247fe74c934cb3fba85aae7e051a8044f460fb11 09-Jan-2011 Dianne Hackborn <hackbod@google.com> Implement issue # 3255887 could CursorLoader offer...

...to throttle contentobserver-based requeries

Why yes, I guess it could.

This also reworks AsyncTaskLoader to not generate multiple
concurrent tasks if it is getting change notifications before
the last background task is complete.

And removes some of the old APIs that had been deprecated but
need to be gone for final release.

And fixes a few little problems with applying the wrong theme
in system code.

Change-Id: Ic7a665b666d0fb9d348e5f23595532191065884f
621e17de87f18003aba2dedb719a2941020a7902 23-Nov-2010 Dianne Hackborn <hackbod@google.com> Implement issue #3221502: New APIs to support new back stack / task navigation

What this adds:

- A new Intent activity flag to completely replace an existing task.
- A new Intent activity flag to bring the current home task up behind
a new task being started/brought to the foreground.
- New versions of startActivity() that take an array of Intents to be
started, allowing applications to start a task in a specific state.
- A public moveTaskToFront() method on ActivityManager, with a new flag
that allows the caller to have the task moved to the front with the
current home task immediately behind it.

Change-Id: Ie8028d09acffb5349d98043c67676daba09f75c8
74f170f9468d3cf6d7d0ef453320141a3e63571b 02-Jun-2010 Vasu Nori <vnori@google.com> new API in Context. on openDatabase, new param DatabaseErrorHandler

add new method openOrCreateDatabase in Context.java to allow
callers specify a DatabaseErrorHandler object to be used when
database corruption occurs.
add new constructor in SQLiteOpenHelper to accept DatabaseErrorHandler
as an additional param to be used when SQLiteDatabase instance is

Change-Id: I912a0202a74510f9ca0206dd8101c4abab9102ae
e83cefcef07f9ac025642c1ffec76b4c7ab39cf2 05-Feb-2010 Dianne Hackborn <hackbod@google.com> New external storage APIs.

This implements the spec for external storage organization, and
properly reflects how the media scanner organizes the files it finds.

Also includes package manager support for removing app private
files from external storage when the application is uninstalled.

For the new APIs and paths, the main place to look is Environment
and Context.
efa199f016985b0a9d0471e42c803ee9f7941f0e 19-Sep-2009 Dianne Hackborn <hackbod@google.com> Add API to send an ordered sticky broadcast.

Change-Id: Ida7081204e226db0cd07ff618c08e308a909ec0c
fa82f22f1d8c4c828bdf9b670006be4f4fec772e 18-Sep-2009 Dianne Hackborn <hackbod@google.com> Fix issue #2093608: Calendar widget takes a few seconds to launch

Avert your eyes!

The key change here is that RemoteViews can now call a Context API to
start its pending intent, which inside of the activity manager we can
use to determine to cancel the timeout delay for external entities
to disrupt the home screen.

Change-Id: If097cf7478cbed7a3c04a304050bd7fd5703d197
7f2054392e9957d3ba8579ef08c29cfb27df564e 28-Jul-2009 Dianne Hackborn <hackbod@google.com> Updates from API review.

* AccessibilityService -- document onBind() to not be implemented.
* GestureLibrary.getLearner() -- needs to be hidden.
* IntentSender -- remove protected constructors, document that it is retrieved from a PendingIntent.
* Hide permissions: SHUTDOWN, STOP_APP_SWITCHES.
* Context -- hide BACKUP_SERVICE.
* ContextWrapper -- hide getSharedPrefs bla h blah
* Intent.parseUri() -- fix docs.
* ApplicationInfo.FLAG_TEST_ONLY?!?
* Hide MockContext.getSharedPrefs blah blah
870e09fcd2dfdc12ac318962efd28b0420c562bb 07-Jul-2009 Romain Guy <romainguy@android.com> Fixes #1963229. Introduces Context#isRestricted().

A restricted Context is a special type of Context that prevents specific features
from being used. For instance, android:onClick, used by View, can be dangerous when
used from within apps widgets. By using a restricted Context to inflate apps widgets,
widgets providers are prevented from using android:onClick.
5c1e00b14d2ef10ec76abf3e951fa8003a67f558 19-Jun-2009 Dianne Hackborn <hackbod@google.com> Fix targetSdkVersion, make resize mode a flag, delayed dexopt, easy ApplicationInfo.

- Fix a bug where targetSdkVersion could not be set if minSdkVersion. Stupid, stupid.
Also make sure to fail if minSdkVersion is for a code name. Really stupid.

- Change the API for resize compatibility mode to be a bit in the flags field, instead
of a separate boolean.

- Implement delayed dexopting, to avoid the looong full dexopt during boot. This is
only enabled for "eng" builds. When in this mode, the activity manager will make
sure that a dexopt has been done before loading an .apk into a process, and will
try to avoid displaying ANRs if they are due to the dexopt causing some operation
to take longer than it normally would (though I make no guarantees about this
totally working).

- Add API to Context to get the ApplicationInfo for its package, for easy access to
things like targetSdkVersion.
23ecae3bbb60c5af940f3a22170d75eb6ac05b69 11-Jun-2009 Joe Onorato <joeo@android.com> Fix SharedPrefsBackupHelper so it doesn't hard code the paths to the files.

This took quite a bit of refactoring.
9189cabb0b6c6c28232fe6f412b7ba7a37352a6a 03-Jun-2009 Mitsuru Oshima <oshima@google.com> * Moved supports-density tag under manifest
* Refactored Compatibility code
* Added CompatibilityInfo class
* Removed getApplicationScale from Context
* Added Resources#getCompatibilityInfo so that RootView can get the compatibility info w/o going through Context
* Expandable support
* Added expandable tag under manifest
* Old application w/o expandable is given the default screen size ([320, 480] x density).
* The non-expandable window is centered.
8169daed2f7a8731d478b884b1f455c747b88478 29-Apr-2009 Mitsuru Oshima <> AI 147976: Compatibility mode support. Part 2.
* Introduced ApplicationScale (may not be good name. CompatibilityScale? CanvasScale? Pls let me know if you have better idea)
* Changes to RootView / SurfaceView
- Makes the app believe it's running in the supported density/resolution.
- Makes the window manager believe it's running at the right density/resolution.
* Added methods to Rect/Event for scaling up/down.
Known issues:
* certain kind of images (such as nine patch for buttons) seesm to be loaded not by app, thus does not take the scale into account,
which, in turn, is causing layout issue.
* ZoomButton in MapView is rendered in wrong place
* Transparent region on Surface is not correct
* Specifying different densities in one process is not working.

Automated import of CL 147976
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution