summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/DockObserver.java
Commit message (Collapse)AuthorAgeFilesLines
* Make DreamManagerService more robust.Jeff Brown2012-09-261-69/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clearly isolated the DreamManagerService and DreamController responsibilities. DreamManagerService contains just enough logic to manage the global synchronous behaviors. All of the asynchronous behaviors are in DreamController. Added a new PowerManager function called nap() to request the device to start napping. If it is a good time to nap, then the PowerManagerService will call startDream() on the DreamManagerService to start dreaming. Fixed a possible multi-user issue by explicitly tracking for which user a dream service is being started and stopping dreams when the current user changes. The user id is also passed to bindService() to ensure that the dream has the right environment. Fix interactions with docks and the UI mode manager. It is important that we always send the ACTION_DOCK_EVENT broadcast to the system so that it can configure audio routing and the like. When docked, the UI mode manager starts a dock app if there is one, otherwise it starts a dream. This change resolves issues with dreams started for reasons other than a user activity timeout. Bug: 7204211 Change-Id: I3193cc8190982c0836319176fa2e9c4dcad9c01f
* Update references to migrated global settings.Jeff Brown2012-09-251-9/+9
| | | | | | | | | | Fixed one setting that was migrated but not marked deprecated. Removed a hidden setting that is no longer used by the new power manager service. Bug: 7231172 Change-Id: I332f020f876a18d519a1a20598a172f1c98036f7
* Improve multi-user broadcasts.Dianne Hackborn2012-08-301-1/+2
| | | | | | | | | | | | | | | | | | | 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
* Make it easier to create asynchronous Handlers.Jeff Brown2012-08-251-1/+1
| | | | | | | | | | | There are potentially very many Handlers owned by services that should not be blocked by barriers introduced by UI traversals occurring on the same thread (if that ever happens). Add some convenience constructors to make it easy to switch these Handlers over to being async. Bug: 7057752 Change-Id: I64d9bffe81e7c52ada4cfad4e89d4340153f4688
* Add framework support for multiple dreams.John Spurlock2012-08-221-3/+10
| | | | | Bug:7028665 Change-Id: I4fba6b8e39dc07af4490c621ac3bc7b3867371b2
* Encapsulate locks in UEventObservers.Jeff Brown2012-08-201-112/+121
| | | | | | | | Synchronized methods make me cry so fixing this first before I introduce any new functionality that could result in a deadlock. Bug: 6548391 Change-Id: I9c006dc491ce205bfd86acf828dcebda2a63b2ca
* Power manager rewrite.Jeff Brown2012-08-151-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Check the ACTIVATE_ON_DOCK setting in DockObserver.John Spurlock2012-08-081-4/+15
| | | | | | Otherwise docking the device will always launch a Dream. Change-Id: I2e74ca62f80d7e386d11c00920a75a5a6e78926c
* Re-enable dreams: frameworks/baseJohn Spurlock2012-08-031-1/+26
| | | | | | | | | | | | | Enable feature in config. Expose Dream in public api for unbundled apps. Unhide package. Add isDreaming() method to service. Re-arrange the Dream api a bit. (use onStart as hook for subclasses). Coordinate properly with power manager. Replace old dock mode (don't fire old intent). Change-Id: I1318d20cc1613e5d862f2913f2fcdc9719302cf7 Bug: 6921930
* Dock: Temporary removal of function to get BT addressJaikumar Ganesh2012-07-131-2/+2
| | | | Change-Id: I0d1033654e2708f864649f2b2568be7c9da014ed
* Move power manager to a new package.Jeff Brown2012-06-181-0/+2
| | | | Change-Id: I5f5a6435e64354b7d6535e8e9a63934ba7a3f448
* Handle EXTRA_DOCK_STATE_LE_DESK and HE_DESK.Jeff Brown2011-11-081-1/+3
| | | | | | Bug: 5569662 Change-Id: Ib8cb9fb68a1a2d3520f34f7fbf6f002dfb91809d
* Integrate StrictMode with CloseGuardBrian Carlstrom2010-11-041-0/+1
| | | | | | | | In additional to adding the StringMode API for controling CloseGuard, this checkin fixes several CloseGuard issues found booting a device. Bug: 3041575 Change-Id: I4dffd184f49438d6d477ed81a1c2a2a5b56cc76b
* Added support for dock headset observerPraveen Bharathi2010-11-011-3/+6
| | | | | Change-Id: I06b2e65e3bfa10735e6c7fd3349afa9ae7d45292 Signed-off-by: Praveen Bharathi <pbharathi@motorola.com>
* Refactor car mode.Dianne Hackborn2010-03-051-517/+2
| | | | | | | | | | | | | | | | | | Extract all UI behavior from dock observer and ACTION_DOCK_EVENT. Also introduce a desk type to go along with the car type all through the resource system, since we now need to have corresponding high-level broadcasts for desk dock mode. As part of that I also reworked some of the logic for switching modes to all funnel through a single update() call that looks all of the current state to decide what to do next, and fixed various locking issues. In addition I found there were bugs in the configuration change handling causing us to only switch into the car mode config and then never get out of it. Unfortunately now that we are actually changing the configuration for each mode change, the transitions between them are really crummy as we restart all kinds of activities. :(
* fix NullPointerException if location is not set.Bernd Holzhey2010-03-051-2/+11
| | | | Bug: http://b/issue?id=2490154
* Fixing automatic switching of night mode if network location is not enabled.Bernd Holzhey2010-03-041-55/+52
| | | | | | | | | The current implementation does not take care of location changes in the case the network location is not enabled. The fix will use the passive location provider to receive any location updates (gps and network) and using the network location provider to trigger the passive provider. Change-Id: I851bb1ff90e9103712a0e741528a6dfa5d4353c8
* DockObserver: Watch for exceptions in LocationManger.isProviderEnabled().Mike Lockwood2010-03-021-2/+12
| | | | | Change-Id: Ieb9f6b0c20a6ce2223cb4b4956580b8543094c2f Signed-off-by: Mike Lockwood <lockwood@android.com>
* Switch the services library to using the new SlogJoe Onorato2010-03-011-11/+12
|
* Init car mode when phone is booted in a dock.Tobias Haamel2010-02-251-0/+8
| | | | | | | When the device is booted in a car dock the car mode needs to be set as well, so that the status bar notification shows up and the system is initialized the same way as if the phone is placed into a car dock when it's booted already.
* Fix calculation of the next twilight update for locations where the day or ↵Bernd Holzhey2010-02-231-18/+27
| | | | night never ends.
* Move new sound effects to the system stream.Daniel Sandler2010-02-221-1/+5
| | | | Change-Id: I11cfa6495abeb0193b1a3929ec54f0386cfe9ed2
* Show car mode notification in status bar.Tobias Haamel2010-02-181-17/+57
| | | | The notification is an ongoing event and can be used to get out of car mode.
* Fix permission exception thrown on exit car mode.Tobias Haamel2010-02-171-1/+3
| | | | | | | Changing the status bar behavior requires special permission. Since disableCarMode is called out of a context that might not have this permission, the calling identity is cleared before changing the status bar behavior.
* Add the automatic handling of night/notnight UI modes.Bernd Holzhey2010-02-161-79/+349
| | | | | | | | | | | | | | | | | The automatic switching between night/notnight is based on the calulcation of the civil twilight of the current location. The location is mainly retrieved from the NetworkLocationProvider. Automatic switching will only be available, when 1) the device is in UI_MODE_TYPE_CAR 2) the setting for the UI mode are set to 'automatic' If mode is set to automatic, the next twilight is caluclated and an alarm is set that timestamp. The alarm will trigger a new calculation of the twilight and sets the UI_MODE_NIGHT to the appropriate value. modified: services/java/com/android/server/DockObserver.java new file: services/java/com/android/server/TwilightCalculator.java
* New user interface sound effects:Daniel Sandler2010-02-121-5/+47
| | | | | | | | | | | | | | | | - Low battery. (http://b/2320026) - Dock/undock events. - Keyguard lock/unlock events. New system settings have been created to turn these on/off and to specify the relevant sound files. [Production notes: The provided low battery sound and dock sounds were synthesized; the lock screen sounds are processed samples of a ballpoint pen click mechanism.] Bug: 2320026 Change-Id: I374285b0f94f59c7555bb8816580f5a8c802e90d
* Disable distracting status bar ticker text in car mode.Daniel Sandler2010-02-121-0/+18
| | | | | | Bug: 2420702 Change-Id: I17ade6355b60da5e77d17f3556c86a4aaf40d173
* Introduce special UI modes for night and car usage.Tobias Haamel2010-02-111-11/+109
| | | | | | | | | | | | | | | | | | The device mode is now called ui mode. Furthermore is the order of precedence for the resources now in such a way that the ui mode needs to be specified after the orientation and before the density. The ui mode can be set, like it is done for the locale, as follows: IActivityManager am = ActivityManagerNative.getDefault(); Configuration config = am.getConfiguration(); config.uiMode = Configuration.UI_MODE_TYPE_CAR | Configuration.UI_MODE_NIGHT_ANY; am.updateConfiguration(config); To allow users to disable the car mode and set the night mode the IUiModeManager interface is used. The automatic night mode switching will be added in a separate change.
* Fix 2385283: Add DevicePolicyManager calls to LockScreen.Jim Miller2010-01-201-1/+1
|
* Implement API to have new broadcasts replace existing broadcasts.Dianne Hackborn2009-12-141-0/+1
| | | | | | Use this in various places where it should serve no purpose to deliver both broadcasts. This is intended to reduce somewhat the flurry of broadcasts that we churn through during boot.
* Add support for Car Dock.Jaikumar Ganesh2009-12-031-3/+12
| | | | | Dr No: Eastham Bug: 2133530
* Do not force screen on when undocking from the desk dock.Mike Lockwood2009-11-111-1/+9
| | | | | | | | | The fact that the phone is losing power will do this anyway, and this fixes (or works around) bug b/2250075 (Desk dock clock app sometimes doesn't exit when removing a sleeping droid from the dock) Change-Id: I7b8b6cfb44ca16d2d9eb67589cb9d9a108a8de82 Signed-off-by: Mike Lockwood <lockwood@android.com>
* Fix issue #2161726: Car dock app bypasses setup wizardDianne Hackborn2009-10-021-16/+7
| | | | | | | We now just don't send out dock broadcasts/launches when the device is not provisioned. Good enough for our purposes. Change-Id: Iee6384121675e0e9854745ec1168245e8a23a241
* Disable keyguard while docked when the lock screen is insecure.Mike Lockwood2009-09-281-1/+28
| | | | | Change-Id: If6e11bb49a2cbbe904517e6037d1e8b99fe2717c Signed-off-by: Mike Lockwood <lockwood@android.com>
* Various fixes and improvements to window, activity.Dianne Hackborn2009-09-221-1/+2
| | | | | | | | | | | | | | | | | | | - New meta-data you can add to a dock activity to have it launched by the home key when the device is in that dock. - Fix a deadlock involving ActivityThread's internal content provider lock. - New window flag to have a non-secure keyguard entirely dismissed when a window is displayed. - New WindowManagerPolicy APIs to allow the policy to tell the system when a change it makes during layout may cause the wall paper or overall configuration to change. - Fix a bug where an application token removed while one of its windows is animating could cause the animating window to get stuck on screen. Change-Id: I6d33fd39edd796bb9bdfd9dd7e077b84ca62ea08
* Change the broadcast intent for dock state changes from a sticky broadcast toMike LeBeau2009-09-191-25/+48
| | | | | a sticky ordered broadcast. This is so individual apps can override the default behavior and stop the related dock app from launching.
* Add support for launching activities when attaching to a car or desk dock.Mike Lockwood2009-09-161-0/+25
| | | | | | | | | Categories CATEGORY_CAR_DOCK and CATEGORY_DESK_DOCK can be assigned to activities to make them launchable on docked events. This is a better mechanism than listening for ACTION_DOCK_EVENT with a broadcast receiver. Change-Id: Ic5f3ab3555ce02ca922bc31ebba41978cefe8bda Signed-off-by: Mike Lockwood <lockwood@android.com>
* DockObserver wakes the display when broadcasting a changeKen Schultz2009-09-151-1/+6
| | | | | | - normal display timeout applies after wake Signed-off-by: Ken Schultz <kschultz@motorola.com>
* Do not send dock state changed broadcasts until the system has finished booting.Mike Lockwood2009-08-281-30/+32
| | | | Signed-off-by: Mike Lockwood <lockwood@android.com>
* DockObserver: minor cleanup.Mike Lockwood2009-08-241-8/+3
| | | | Signed-off-by: Mike Lockwood <lockwood@android.com>
* Dock changes:Docking station intentsDan Murphy2009-08-171-0/+115
Docking station intents for dock switch driver. Add DockObserver and updated Intent.java and systemserver.jave Signed-off-by: Dan Murphy <D.Murphy@motorola.com> modified: core/java/android/content/Intent.java new file: services/java/com/android/server/DockObserver.java modified: services/java/com/android/server/SystemServer.java Docking station updates Add constants for the dock Signed-off-by: Dan Murphy <D.Murphy@motorola.com> Signed-off-by: Mike Lockwood <lockwood@android.com>