478 Commits

Author SHA1 Message Date
Dianne Hackborn
20e809870d 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
2012-09-04 10:39:21 -07:00
Jeff Brown
a492c3a7b2 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
2012-08-31 15:42:45 -07:00
Dianne Hackborn
5ac72a2959 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
2012-08-30 14:33:22 -07:00
Dianne Hackborn
7767eac323 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
installed.

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
GET_UNINSTALLED_PACKAGES flag.

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
2012-08-24 13:53:13 -07:00
Jeff Brown
98365d7663 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
2012-08-19 22:42:08 -07:00
Michael Jurka
d2ae85d41e Merge "Adding a thumbnail scale down animation" into jb-mr1-dev 2012-08-17 13:03:15 -07:00
Dianne Hackborn
79af1dd54c Switch public APIs to use new UserHandle class for identifying users.
Gets rid of "yet another integer" confusion.

Change-Id: Id07ea7307aea7c62f0087c6663a1f1c08e2e5dee
2012-08-17 10:36:08 -07:00
Michael Jurka
832cb229cd Adding a thumbnail scale down animation
Recents animation will temporarily look a bit
wrong, but a subsequent change will fix this.
2012-08-16 00:14:03 -07:00
Jeff Brown
9630704ed3 Power manager rewrite.
The major goal of this rewrite is to make it easier to implement
power management policies correctly.  According, the new
implementation primarily uses state-based rather than event-based
triggers for applying changes to the current power state.

For example, when an application requests that the proximity
sensor be used to manage the screen state (by way of a wake lock),
the power manager makes note of the fact that the set of
wake locks changed.  Then it executes a common update function
that recalculates the entire state, first looking at wake locks,
then considering user activity, and eventually determining whether
the screen should be turned on or off.  At this point it may
make a request to a component called the DisplayPowerController
to asynchronously update the display's powe state.  Likewise,
DisplayPowerController makes note of the updated power request
and schedules its own update function to figure out what needs
to be changed.

The big benefit of this approach is that it's easy to mutate
multiple properties of the power state simultaneously then
apply their joint effects together all at once.  Transitions
between states are detected and resolved by the update in
a consistent manner.

The new power manager service has is implemented as a set of
loosely coupled components.  For the most part, information
only flows one way through these components (by issuing a
request to that component) although some components support
sending a message back to indicate when the work has been
completed.  For example, the DisplayPowerController posts
a callback runnable asynchronously to tell the PowerManagerService
when the display is ready.  An important feature of this
approach is that each component neatly encapsulates its
state and maintains its own invariants.  Moreover, we do
not need to worry about deadlocks or awkward mutual exclusion
semantics because most of the requests are asynchronous.

The benefits of this design are especially apparent in
the implementation of the screen on / off and brightness
control animations which are able to take advantage of
framework features like properties, ObjectAnimator
and Choreographer.

The screen on / off animation is now the responsibility
of the power manager (instead of surface flinger).  This change
makes it much easier to ensure that the animation is properly
coordinated with other power state changes and eliminates
the cause of race conditions in the older implementation.

The because of the userActivity() function has been changed
so that it never wakes the device from sleep.  This change
removes ambiguity around forcing or disabling user activity
for various purposes.  To wake the device, use wakeUp().
To put it to sleep, use goToSleep().  Simple.

The power manager service interface and API has been significantly
simplified and consolidated.  Also fixed some inconsistencies
related to how the minimum and maximum screen brightness setting
was presented in brightness control widgets and enforced behind
the scenes.

At present the following features are implemented:

- Wake locks.
- User activity.
- Wake up / go to sleep.
- Power state broadcasts.
- Battery stats and event log notifications.
- Dreams.
- Proximity screen off.
- Animated screen on / off transitions.
- Auto-dimming.
- Auto-brightness control for the screen backlight with
  different timeouts for ramping up versus ramping down.
- Auto-on when plugged or unplugged.
- Stay on when plugged.
- Device administration maximum user activity timeout.
- Application controlled brightness via window manager.

The following features are not yet implemented:

- Reduced user activity timeout for the key guard.
- Reduced user activity timeout for the phone application.
- Coordinating screen on barriers with the window manager.
- Preventing auto-rotation during power state changes.
- Auto-brightness adjustment setting (feature was disabled
  in previous version of the power manager service pending
  an improved UI design so leaving it out for now).
- Interpolated brightness control (a proposed new scheme
  for more compactly specifying auto-brightness levels
  in config.xml).
- Button / keyboard backlight control.
- Change window manager to associated WorkSource with
  KEEP_SCREEN_ON_FLAG wake lock instead of talking
  directly to the battery stats service.
- Optionally support animating screen brightness when
  turning on/off instead of playing electron beam animation
  (config_animateScreenLights).

Change-Id: I1d7a52e98f0449f76d70bf421f6a7f245957d1d7
2012-08-15 03:06:24 -07:00
Dianne Hackborn
756220bd19 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
2012-08-14 16:51:38 -07:00
Dianne Hackborn
7d19e0242f 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
2012-08-07 19:19:22 -07:00
Svetoslav Ganov
758143ecfe Window position not reported if the window is not moved.
1.If a window is shown but never moved the window window
  is never notified for its current location. Therefore,
  accessibility nodes do not contain correct bounds in
  screen coordinates.

bug:6926295

Change-Id: I7df18b095d33ecafffced75aba9e4f4693b0c393
2012-08-06 23:49:38 -07:00
Craig Mautner
b49a065d99 Fix build with density methods.
Change-Id: I95c0a4f12db40f200a3a004394763beaef904232
2012-08-03 19:03:24 -07:00
Craig Mautner
437a0fbd57 Merge "Introduce multiple displays with DisplayContent." into jb-mr1-dev 2012-08-02 09:20:14 -07:00
Craig Mautner
59c009776d Introduce multiple displays with DisplayContent.
Fix a couple of bugs that turned up.
Remove touch/focus from display. Add iterators for access.
Respond to comments. Remove TODOs, and some deviceId parameters.

Change-Id: Idcdb4f1979aa7b14634d450fd0333d6eff26994d
2012-08-02 08:47:44 -07:00
Dianne Hackborn
908aecc3a6 Start moving away from DisplayMetrics.DENSITY_DEVICE.
This puts in most of the infrastructure needed to allow us to
switch between different densities at run time.  The main remaining
uses of the global are to initialize the Bitmap object (not sure
what to do about that since it doesn't have anything passed in
the constructor to get this information from), and being able to
load drawables if we need a different density than what was preloaded
by zygote.

Change-Id: Ifdbfd6b7a5c59e6aa22e63b95b78d96af3d96848
2012-08-01 10:54:39 -07:00
Craig Mautner
39df578acd Fix build.
Change-Id: I52bbebae38912a4fb71c96174b3d4d8eb6be10c1
2012-07-27 14:30:59 -07:00
Jeff Brown
aa871b0ff0 Fix build.
Change-Id: Ife2fd58447205407e41ce3d27e28a705b744bede
2012-07-25 20:06:22 -07:00
Jeff Brown
fa25bf5382 Add display manager skeleton.
The purpose of this change is to remove direct reliance on
SurfaceFlinger for describing the size and characteristics of
displays.

This patch also starts to make a distinction between logical displays
and physical display devices.  Currently, the window manager owns
the concept of a logical display whereas the new display
manager owns the concept of a physical display device.

Change-Id: I7e0761f83f033be6c06fd1041280c21500bcabc0
2012-07-25 18:56:16 -07:00
Svetoslav Ganov
c9c9a48e7b Removing a workaround for incorrect window position on window move.
1. The window manager was not notifying a window when the latter
   has been moved. This was causing incorrect coordinates of the
   nodes reported to accessibility services. To workaround that
   we have carried the correct window location when making a
   call from the accessibility layer into a window. Now the
   window manager notifies the window when it is moved and the
   workaround is no longer needed. This change takes it out.

2. The left and right in the attach info were not updated properly
   after a report that the window has moved.

3. The accessibility manager service was calling directly methods
   on the window manager service without going through the interface
   of the latter. This leads to unnecessary coupling and in the
   long rung increases system complexity and reduces maintability.

bug:6623031

Change-Id: Iacb734b1bf337a47fad02c827ece45bb2f53a79d
2012-07-16 08:46:11 -07:00
Craig Mautner
105b78bb31 Add missing interface method.
Fix broken build.

Change-Id: I6644df218e11a35330a985bdcb9ace33723330f5
2012-07-10 15:17:25 -07:00
Xavier Ducrohet
01b6c755db Replace LruCache implementation for layoutlib.
The android version depends on a custom version of LinkedHashMap
which is not present on desktop VMs. This new implementation is done
in a way that minimizes the difference between the two.

Also some minor fixes.

Change-Id: Ib27b0419f9d0e6ba4d4abb26b2ccd968af59eba8
2012-07-10 11:48:10 -07:00
Dianne Hackborn
a4b7f2f75e Use two fingers to work some magic...
Change-Id: Ibcb3dbd3d158c22da8277e544d81fb47eadccd49
2012-06-25 19:19:15 -07:00
Xavier Ducrohet
752e7b3bf6 am 58a8d8d2: am 0e302bc8: Merge "Disable debug output in SDK layoutlib." into jb-dev
* commit '58a8d8d2d4b15cd4abf010680181359823ebfda4':
  Disable debug output in SDK layoutlib.
2012-06-19 18:09:14 -07:00
Xavier Ducrohet
58a8d8d2d4 am 0e302bc8: Merge "Disable debug output in SDK layoutlib." into jb-dev
* commit '0e302bc884fa4b25eb391d625f2fb0eddc25d9b7':
  Disable debug output in SDK layoutlib.
2012-06-19 18:06:37 -07:00
Xavier Ducrohet
4d7f301f94 Disable debug output in SDK layoutlib.
Bug: 6697442

Change-Id: I9741761342ea220c158aa124089430b0db80bf7e
2012-06-19 18:02:21 -07:00
Raphael Moll
89e1ad05e7 am bce1011d: resolved conflicts for merge of 8cf489c1 to jb-dev-plus-aosp
* commit 'bce1011dd2a371c587d2e39ad8c3d446b63049d0':
  Layoutlib Create: Find dependencies.
2012-06-14 14:46:25 -07:00
Raphael Moll
bce1011dd2 resolved conflicts for merge of 8cf489c1 to jb-dev-plus-aosp
Change-Id: I06608e3c122b8f321429d457c51aa2213dd238b4
2012-06-14 14:14:45 -07:00
Raphael Moll
4306096a43 Layoutlib Create: Find dependencies.
Usage: layoutlib_create --list-deps /path/to/layoutlib.jar

Prints:
- all classes found in the Jar and the types they use (the dependencies).
- all the dependencies missing from the Jar and what uses them.

Change-Id: I8b2674df127e1494feed7a653282e88e4d2f5494
2012-06-13 15:44:54 -07:00
Dianne Hackborn
71ebf28304 am fcd73824: am dd251cab: Merge "Fix build." into jb-dev
* commit 'fcd738240a7d716e21721514202caa5bfb2dcb98':
  Fix build.
2012-06-04 11:13:27 -07:00
Dianne Hackborn
fcd738240a am dd251cab: Merge "Fix build." into jb-dev
* commit 'dd251cab5b6e5b590cc0aeae8be8f885a7794e72':
  Fix build.
2012-06-04 11:09:00 -07:00
Dianne Hackborn
bb47cf66ec Fix build.
Change-Id: I41415fed99d98406bc033289428bde59475c2917
2012-06-04 10:51:17 -07:00
Dianne Hackborn
ce783749b1 am f3b4c93e: am ae5811c7: Merge "Fix (mostly) issue #5109947: Race condition between retrieving a..." into jb-dev
* commit 'f3b4c93e0da9af2db9e16864faa734cf70fecfe3':
  Fix (mostly) issue #5109947: Race condition between retrieving a...
2012-05-29 15:57:52 -07:00
Dianne Hackborn
f3b4c93e0d am ae5811c7: Merge "Fix (mostly) issue #5109947: Race condition between retrieving a..." into jb-dev
* commit 'ae5811c71405878b09eace395ec2b28e54eeb427':
  Fix (mostly) issue #5109947: Race condition between retrieving a...
2012-05-29 15:53:38 -07:00
Dianne Hackborn
6ae8d18218 Fix (mostly) issue #5109947: Race condition between retrieving a...
...content provider and updating its oom adj

This introduces the concept of an "unstable" reference on a content
provider.  When holding such a reference (and no normal stable ref),
the content provider dying will not cause the client process to be
killed.

This is used in ContentResolver.query(), .openAssetFileDescriptor(),
and .openTypedAssetFileDescriptor() to first access the provider
with an unstable reference, and if at the point of calling into the
provider we find it is dead then acquiring a new stable reference
and doing the operation again.  Thus if the provider process dies
at any point until we get the result back, our own process will not
be killed and we can safely retry the operation.

Arguably there is still the potential for a race -- if somehow the
provider is killed way late by the OOM killer after the query or
open has returned -- but this should now be *extremely* unlikely.
We also continue to have the issue with the other calls, but these
are much less critical, and the same model can't be used there (we
wouldn't want to execute two insert operations for example).

The implementation of this required some significant changes to the
underlying plumbing of content providers, now keeping track of the
two different reference counts, and managing them appropriately.  To
facilitate this, the activity manager now has a formal connection
object for a client reference on a content provider, which hands to
the application when opening the provider.

These changes have allowed a lot of the code to be cleaned up and
subtle issues closed.  For example, when a process is crashing, we
now have a much better idea of the state of content provider clients
(olding a stable ref, unstable ref, or waiting for it to launch), so
that we can correctly handle each of these.

The client side code is also a fair amount cleaner, though in the
future there is more than should be done.  In particular, the two
ProviderClientRecord and ProviderRefCount classes should be combined
into one, part of which is exposed to the ContentResolver internal
API as a reference on a content provider with methods for updating
reference counts and such.  Some day we'll do that.

Change-Id: I87b10d1b67573ab899e09ca428f1b556fd669c8c
2012-05-29 13:33:09 -07:00
Jean-Baptiste Queru
38e34874a8 am 2a9b85d7: am c0f17383: Merge "Move kxml2 to prebuilts/misc"
* commit '2a9b85d7ccdd3b8e6be90454cdcb4be3b032cd64':
  Move kxml2 to prebuilts/misc
2012-05-18 16:33:10 -07:00
Dianne Hackborn
e4b1c08abf am 095c2d31: am 4286d6d1: Fix build.
* commit '095c2d315d3bdf4cdb61439d427413c0bd7796e1':
  Fix build.
2012-05-14 19:37:24 -07:00
Dianne Hackborn
6917b2a10d am 2da87ec3: am 2a7a6ca0: Merge "Implement new window cropping." into jb-dev
* commit '2da87ec32e72c2c25998e2444155c00074cfbd40':
  Implement new window cropping.
2012-05-14 19:37:21 -07:00
Dianne Hackborn
4286d6d115 Fix build.
Change-Id: I53263d509559c70100cd78ad49f225f0dafd8891
2012-05-13 16:03:39 -07:00
Dianne Hackborn
85afd1b6f8 Implement new window cropping.
The window manager now performs the crop internally, evaluating
it every animation from, to be able to update it along with
the surface position.

Change-Id: I960a2161b9defb6fba4840fa35aee4e411c39b32
2012-05-13 13:31:06 -07:00
Michael Jurka
e5c511a1cc am bf1b5fa9: am 421dceb0: Merge "Making transition out of recents look better" into jb-dev
* commit 'bf1b5fa944158044a595706924b935b5577ec0f0':
  Making transition out of recents look better
2012-05-10 11:57:33 -07:00
Dianne Hackborn
58d4f2e36f am e2e03913: am dd79ae6b: Merge "Add infrastructure for accessing "unstable" content providers." into jb-dev
* commit 'e2e0391389fce1a9fd9d5c5442ba1901b6d96211':
  Add infrastructure for accessing "unstable" content providers.
2012-05-10 11:38:52 -07:00
Michael Jurka
421dceb0a4 Merge "Making transition out of recents look better" into jb-dev 2012-05-10 10:35:19 -07:00
Michael Jurka
21385cd83d Making transition out of recents look better
- Fading out recents first, then scaling up app
thumbnail
- Fade Recents out over 130ms
- Delay the window animation for 200ms first,
then animate for 200ms (previously we didn't delay
and then animated for 300ms)

Bug: 6390075

Change-Id: Ia8c753bf7ee03d2acef6eb2772b28d88fe10a682
2012-05-09 20:25:28 -07:00
Dianne Hackborn
652b6d1e59 Add infrastructure for accessing "unstable" content providers.
We have an API and some stuff that purports to this, but no real
implementation yet.

Change-Id: I93555440014a50fdf79fa3f65318d90fb82265b4
2012-05-09 18:18:40 -07:00
Xavier Ducrohet
3060030659 am 50e657e6: am 024d3b23: Merge "Add missing native method to Canvas_Delegate." into jb-dev
* commit '50e657e66ce6663fdff929cd365a3daf87cef9ae':
  Add missing native method to Canvas_Delegate.
2012-05-09 10:10:48 -07:00
Jeff Brown
8fd851709f am a394efa3: am 947f1c8d: Merge "Move CancellationSignal to android.os package." into jb-dev
* commit 'a394efa33531ce36c432872ec56ad0c93a9999e7':
  Move CancellationSignal to android.os package.
2012-05-09 10:09:20 -07:00
Xavier Ducrohet
f18c68b83f Add missing native method to Canvas_Delegate.
Change-Id: I86288c942004e5489eacc43ba5e112cf56f94487
2012-05-08 17:14:18 -07:00
Xavier Ducrohet
05b50149ab Fix classpath of eclipse projects for layoutlib.
This is due to the prebuilts reorg.

Change-Id: I6afa82d7ac64286aa89b4b1cfb4af59e4c7000ce
2012-05-08 16:18:32 -07:00
Jeff Brown
a7771df369 Move CancellationSignal to android.os package.
Bug: 6427830
Change-Id: I39451bb1e1d4a8d976ed1c671234f0c8c61658dd
2012-05-07 20:06:46 -07:00