diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-11-18 16:20:32 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-11-18 16:20:32 -0800 |
commit | 03786b83bd02f8dd8e1049d333fbfdee395ac965 (patch) | |
tree | 3922a710fcfd9dcf9dab489235f8f57d733eb217 /core | |
parent | dfc066e769ec227b4dbf0e2e5097973c20c2b34f (diff) | |
parent | 0e39ea83c5578e0d55e120c91ff7cfeeb0c1cb2f (diff) | |
download | frameworks_base-03786b83bd02f8dd8e1049d333fbfdee395ac965.zip frameworks_base-03786b83bd02f8dd8e1049d333fbfdee395ac965.tar.gz frameworks_base-03786b83bd02f8dd8e1049d333fbfdee395ac965.tar.bz2 |
Merge change I813fdb7a into eclair
* changes:
Fixes for proximity sensor behavior:
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/os/IPowerManager.aidl | 2 | ||||
-rw-r--r-- | core/java/android/os/PowerManager.java | 29 |
2 files changed, 28 insertions, 3 deletions
diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl index bcf769d..b9dc860 100644 --- a/core/java/android/os/IPowerManager.aidl +++ b/core/java/android/os/IPowerManager.aidl @@ -22,7 +22,7 @@ interface IPowerManager { void acquireWakeLock(int flags, IBinder lock, String tag); void goToSleep(long time); - void releaseWakeLock(IBinder lock); + void releaseWakeLock(IBinder lock, int flags); void userActivity(long when, boolean noChangeLights); void userActivityWithForce(long when, boolean noChangeLights, boolean force); void setPokeLock(int pokey, IBinder lock, String tag); diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java index 2efc230..4b3b6f6 100644 --- a/core/java/android/os/PowerManager.java +++ b/core/java/android/os/PowerManager.java @@ -159,6 +159,15 @@ public class PowerManager public static final int PROXIMITY_SCREEN_OFF_WAKE_LOCK = WAKE_BIT_PROXIMITY_SCREEN_OFF; /** + * Flag for {@link WakeLock#release release(int)} to defer releasing a + * {@link #WAKE_BIT_PROXIMITY_SCREEN_OFF} wakelock until the proximity sensor returns + * a negative value. + * + * {@hide} + */ + public static final int WAIT_FOR_PROXIMITY_NEGATIVE = 1; + + /** * Normally wake locks don't actually wake the device, they just cause * it to remain on once it's already on. Think of the video player * app as the normal behavior. Notifications that pop up and want @@ -267,10 +276,26 @@ public class PowerManager */ public void release() { + release(0); + } + + /** + * Release your claim to the CPU or screen being on. + * @param flags Combination of flag values to modify the release behavior. + * Currently only {@link #WAIT_FOR_PROXIMITY_NEGATIVE} is supported. + * + * <p> + * It may turn off shortly after you release it, or it may not if there + * are other wake locks held. + * + * {@hide} + */ + public void release(int flags) + { synchronized (mToken) { if (!mRefCounted || --mCount == 0) { try { - mService.releaseWakeLock(mToken); + mService.releaseWakeLock(mToken, flags); } catch (RemoteException e) { } mHeld = false; @@ -302,7 +327,7 @@ public class PowerManager synchronized (mToken) { if (mHeld) { try { - mService.releaseWakeLock(mToken); + mService.releaseWakeLock(mToken, 0); } catch (RemoteException e) { } RuntimeInit.crash(TAG, new Exception( |