10061 Commits

Author SHA1 Message Date
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
Jeff Brown
848c2dc93b Stub out display manager service implementation.
Reverting to the previous stub as the display adapter registration
and the logical to physical mapping is not at all what we are going
to need moving forward.

Fixed up the service initialization order so that the display manager
service has a context from the start.

Change-Id: I717f2f1099c7a77180ef207c371ec8329258850a
2012-08-19 21:21:37 -07:00
Amith Yamasani
ce777171fc Fixed static wallpaper for multi-user
Earlier assumption that systemui was running in the system process
does not hold true, so running static wallpaper in its own user
sandbox.

Bug: 7008230
Change-Id: I32a128e6bbd8efa7006286330e970bafcf37f05a
2012-08-18 22:13:07 -07:00
Amith Yamasani
fc6e0ca07e Fix build part 2
Change-Id: I3b4ed430f214468a22d3b3aaf3605e570cfd0ed1
2012-08-17 17:07:14 -07:00
Amith Yamasani
7fdaa3976d Merge "Save preferred activity info with user id." into jb-mr1-dev 2012-08-17 16:19:19 -07:00
Amith Yamasani
029675e5ad Merge "Fix launching activity from a pending intent" into jb-mr1-dev 2012-08-17 15:54:18 -07:00
Nick Pelly
2b7a0d0042 Fix addGeofence() and addProximityAlert().
Need to clear the callers identity before calling into geofence manager
because it in turn calls fused location API's.

Change-Id: I7993b0b8b2a947ff93c37a7c9d29ca0e7c95f9a8
2012-08-17 15:25:21 -07:00
Nick Pelly
4035f5a7c1 Port location blacklist code to MR1.
I had to re-do this change for MR1 because LocationManagerService changed
so much. Here is the original change description:

Add package-name-prefix blacklist for location updates.

The Settings.Secure value locationPackagePrefixBlacklist and
locationPackagePrefixWhitelist contains comma seperated package-name
prefixes.

Location & geo-fence updates are silently dropped if the receiving
package name has a prefix on the blacklist. Status updates are
not affected. All other API's work as before.

A content observer is used so run-time updates to the blacklist
apply immediately. There is both a blacklist and a whitelist.
The blacklist applies first, and then exemptions are allowed
from the whitelist. In other words, if your package name prefix
matches both the black AND white list, then it is allowed.

Bug: 6986553
Change-Id: I1e151e08bd7143e47db005bc3fe9795076398df7
2012-08-17 15:25:16 -07:00
Amith Yamasani
7300dbeba0 Fix launching activity from a pending intent
The creator of the pending intent is the user on which the activity
should be launched.

Change-Id: I733326ed8a5784985ac93a84ce91de4dda17c730
2012-08-17 14:19:57 -07:00
Amith Yamasani
81c304b99d Merge "Send USER_SWITCHED with the correct permission" into jb-mr1-dev 2012-08-17 13:58:17 -07:00
Amith Yamasani
1ab36c1d83 Send USER_SWITCHED with the correct permission
Forgot to change this from MANAGE_ACCOUNTS to MANAGE_USERS.

Change-Id: Ib07d2ac84c19cef278a0e564676b6200e0f97dd1
2012-08-17 13:55:02 -07:00
Amith Yamasani
a3f133afe8 Save preferred activity info with user id.
So each user can have their own set of intent resolution preferences.

ResolverActivity now launches the activity on the correct user, and
persists the preference for the correct user.

Bug: 6961905
Change-Id: I6d3a8a9af89bc649277d4fc8d0f367ee123f8392
2012-08-17 13:32:02 -07:00
Michael Jurka
d2ae85d41e Merge "Adding a thumbnail scale down animation" into jb-mr1-dev 2012-08-17 13:03:15 -07:00
Nick Pelly
aeca689804 Merge "Fix regression from location changes: GPS battery tracking." into jb-mr1-dev 2012-08-17 11:57:52 -07:00
Nick Pelly
f2033e473a Fix regression from location changes: GPS battery tracking.
The client UID list wasn't being saved, so we never removed
client UID's. As a result apps get blamed for GPS even when
they are no longer using it.

Bug: 7007314
Change-Id: Idff3b7c8c0ee87b99c9bdd7bd20d8391d0b1ac0f
2012-08-17 11:56:39 -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
Amith Yamasani
2a00329c6d UserHandle to UserSerialNo mapping
Use AtomicFile for usermanager files.

Added a MANAGE_USERS permission that apps (signature permission) can use
to create/query/modify/remove users.

Change-Id: I5cf232232d0539e7508df8ec9b216e29c2351cd9
2012-08-17 09:06:10 -07:00
Nick Pelly
1f3f128ad1 Merge "Add javadoc for new location API's." into jb-mr1-dev 2012-08-16 18:05:32 -07:00
Nick Pelly
4e31c4fffb Add javadoc for new location API's.
Change-Id: If15024ee88421c07ba3a174747774fc451fd002e
2012-08-16 17:59:34 -07:00
Kenny Root
9a994b5350 am 050c87f8: am a950daf5: Merge changes Ieb566a2a,I953057cd
* commit '050c87f87e2a48c7bc90f5b15fb6e4e37e667286':
  Use Libcore's stat instead of FileUtils#getFileStatus
  Use Libcore.os.stat instead of FileUtils
2012-08-16 16:43:20 -07:00
Kenny Root
050c87f87e am a950daf5: Merge changes Ieb566a2a,I953057cd
* commit 'a950daf5c14a0009c2c62e9c3e0e8d51eb0cf7d9':
  Use Libcore's stat instead of FileUtils#getFileStatus
  Use Libcore.os.stat instead of FileUtils
2012-08-16 16:33:40 -07:00
Jeff Brown
13c589b66c Animate brightness with electron beam.
Also added an internal flag to control whether the electron beam
on animation is used.  It's on for now but we might want to
turn if off if we can't get the HAL to provide the
necessary screen on synchronization on all devices.

Change-Id: Iaa3cfa0fd61de10174e68351e4db890eff2d2918
2012-08-16 16:26:54 -07:00
Kenny Root
520ee7bcad am a2e8365c: am 9b0da58e: Merge "Introduce a restorecon JNI binding."
* commit 'a2e8365cc883de0d3e56e9f4af350ecfe1b8fc4c':
  Introduce a restorecon JNI binding.
2012-08-16 15:32:52 -07:00
Kenny Root
a2e8365cc8 am 9b0da58e: Merge "Introduce a restorecon JNI binding."
* commit '9b0da58e3a30b760de37138cdd51d20f269c383e':
  Introduce a restorecon JNI binding.
2012-08-16 15:29:41 -07:00
Kenny Root
786cbcacd2 Use Libcore.os.stat instead of FileUtils
PackageManagerService just needed to know the owner for this file, so
just use stat instead so we can remove the old JNI code.

This is the last user of FileUtils#getPermissions so just remove the
FileUtils method as well.

Change-Id: I953057cd6b9de4410f33b6f22e4bddff02fe2988
2012-08-16 15:27:55 -07:00
Nick Pelly
60020e2fa3 Merge "Improve coarse locations." into jb-mr1-dev 2012-08-16 15:23:11 -07:00
Nick Pelly
74fa7eabda Improve coarse locations.
Fix a couple of bugs, and modify the behavior of the random offset.

The random offset now slowly changes over time, to mitigate against
applications averaging out the offset over time while at a
grid boundary.

Change-Id: Iecffff29145b8c2b30d1eca1662cf9d3e8cff756
2012-08-16 15:22:24 -07:00
Kenny Root
9b0da58e3a Merge "Introduce a restorecon JNI binding." 2012-08-16 14:38:30 -07:00
Jeff Sharkey
c584b65b20 Merge "Multi-user external storage support." into jb-mr1-dev 2012-08-16 14:32:39 -07:00
Iliyan Malchev
ee98610f1a Merge "Set the brightness to zero on screen-off" into jb-mr1-dev 2012-08-16 13:43:14 -07:00
Iliyan Malchev
122415f5c8 Set the brightness to zero on screen-off
Fixes b/6996990

Ideally, the HWC HAL should turn off the backlight when the display is turned
off.  This patch enforces this at the PowerManager, which can guard against
errant HWC implementations.

Change-Id: Ibb826a02871c983f8a68034d010e68abe9c5c1d5
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-08-16 12:48:28 -07:00
Dianne Hackborn
f02b60aa4f Rename UserId to UserHandle.
This is the start of turning this into a formal public API.

Change-Id: I5786d2c320f1de41a06ed5d0f65adb68967287a0
2012-08-16 12:46:38 -07:00
Jeff Brown
7c964e7899 Merge changes I39804ee6,I6a5a7ea2 into jb-mr1-dev
* changes:
  Use spline interpolation for auto-brightness.
  Add FloatMath.hypot.
2012-08-16 02:07:27 -07:00
Jeff Brown
e663975055 Merge "Improve auto-brightness debounce." into jb-mr1-dev 2012-08-16 02:06:18 -07:00
Jeff Brown
1a30b55036 Use spline interpolation for auto-brightness.
Strictly speaking, this is a change in behavior for all products.
Instead of using discrete zones, they will all now use spline
interpolation.  We could make this behavior configurable
but there seems to be little point to it.  The range of brightness
values used will be more or less the same as before, it's just
that what used to be the brightness value for all levels within
a particular zone now becomes the brightness value for the
highest level in that zone and lower values are used for lower
levels within the zone.

Change-Id: I39804ee630ba55f018e1e53c0576b28e7bd27931
2012-08-16 01:45:10 -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
06565b64de Improve auto-brightness debounce.
Change-Id: I045e2a14cb31ff987a22872733c442fc92ebadbf
2012-08-15 21:10:32 -07:00
Jeff Sharkey
5b1ada2562 Multi-user external storage support.
Emulated external storage always has multi-user support using paths
like "/data/media/<user_id>".  Creates and destroys these paths along
with user data.  Uses new ensure_dir() to create directories while
always ensuring permissions.

Add external storage mount mode to zygote, supporting both single-
and multi-user devices.  For example, devices with physical SD cards
are treated as single-user.  Begin migrating to mount mode instead
of relying on sdcard_r GID to enforce READ_EXTERNAL_STORAGE.

Bug: 6925012
Change-Id: I9b872ded992cd078e2c013567d59f9f0032ec02b
2012-08-15 19:45:53 -07:00
Dianne Hackborn
a1a1a1d6ca Merge "Fix issue #6955586: No navigation bar in landscape on tablets" into jb-mr1-dev 2012-08-15 18:53:34 -07:00
Dianne Hackborn
5a052a4d19 Fix issue #6955586: No navigation bar in landscape on tablets
The window manager was telling the activity manager to evaluate
the new configuration when first initializing the display, before
actually setting mDisplay, so it failed creating that first config.

Change-Id: I6e94fcf55b0587ccf15a5fd7ecbe2c9a0c201b96
2012-08-15 18:49:23 -07:00
Yuhao Zheng
f6307820c8 CTS test for WiFi watchdog - framework support.
The new WiFi watchdog requires kernel/driver to export some packet loss
counters. This CTS tests whether those counters are correctly exported.

Change-Id: I41999676f8488e86f35f1f8214ce668f1a2b5638
2012-08-15 15:22:37 -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
Jeff Brown
ff7e6ef4f1 Apply ValueAnimator scale factor immediately in WM.
Normally the ValueAnimator scale factor is applied the first
time a ViewRootImpl window session is created but that may
be too late for animators created by system services that
start early in the boot process.  So set the scale factor
immediately whenever the setting changes.

Also make ValueAnimator.getDurationScale() accessible (but @hide)
for custom animators that want to apply the same scale to
their animations.

Change-Id: I0f5a750ab5b014f63848445435d8dca86f2a7ada
2012-08-15 02:09:05 -07:00
Matthew Xie
58de1427c3 Merge "Implement enableNoAutoconnect()" into jb-mr1-dev 2012-08-14 00:37:01 -07:00
Ganesh Ganapathi Batta
fffa86ba83 Implement enableNoAutoconnect()
Adding enableNoAutoconnect() API support in Bluetooth service
 to let BT enable in quiet mode

Change-Id: I546f3ceb298082a9c9a698f406379470e3cc0d4f
2012-08-14 00:18:07 -07:00
Mike Lockwood
510cff9468 am f02354e2: am 9064a483: Merge "Added missing USB_DEVICE_ATTACHED broadcast to running Activity"
* commit 'f02354e208ec7b7e0dee68e12c0b5cde86a0f20a':
  Added missing USB_DEVICE_ATTACHED broadcast to running Activity
2012-08-13 20:45:04 -07:00
Mike Lockwood
f02354e208 am 9064a483: Merge "Added missing USB_DEVICE_ATTACHED broadcast to running Activity"
* commit '9064a48365c131ef5f64b26ab33dd40a7d1246a7':
  Added missing USB_DEVICE_ATTACHED broadcast to running Activity
2012-08-13 20:42:42 -07:00
Mike Lockwood
9064a48365 Merge "Added missing USB_DEVICE_ATTACHED broadcast to running Activity" 2012-08-13 19:59:38 -07:00
Christopher Tate
bf7d222011 Merge "Don't back up / restore non-primary users' data" into jb-mr1-dev 2012-08-13 17:58:40 -07:00
Christopher Tate
aac71ff465 Don't back up / restore non-primary users' data
For now only the device owner "user" gets cloud backups.  Also, only the
device owner account has access to local backup/restore.

Bug 6956438

Change-Id: I87d7ba5969e606c23f4214469f9bf2fd47a6c61b
2012-08-13 17:36:14 -07:00