Loading api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -23738,6 +23738,7 @@ package android.os { public final class PowerManager { method public boolean isInteractive(); method public boolean isPowerSaveMode(); method public boolean isScreenBrightnessBoosted(); method public deprecated boolean isScreenOn(); method public boolean isWakeLockLevelSupported(int); method public android.os.PowerManager.WakeLock newWakeLock(int, java.lang.String); Loading @@ -23745,6 +23746,7 @@ package android.os { method public void userActivity(long, int, int); field public static final int ACQUIRE_CAUSES_WAKEUP = 268435456; // 0x10000000 field public static final java.lang.String ACTION_POWER_SAVE_MODE_CHANGED = "android.os.action.POWER_SAVE_MODE_CHANGED"; field public static final java.lang.String ACTION_SCREEN_BRIGHTNESS_BOOST_CHANGED = "android.os.action.SCREEN_BRIGHTNESS_BOOST_CHANGED"; field public static final deprecated int FULL_WAKE_LOCK = 26; // 0x1a field public static final int ON_AFTER_RELEASE = 536870912; // 0x20000000 field public static final int PARTIAL_WAKE_LOCK = 1; // 0x1 core/java/android/os/IPowerManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ interface IPowerManager void setStayOnSetting(int val); void boostScreenBrightness(long time); boolean isScreenBrightnessBoosted(); // temporarily overrides the screen brightness settings to allow the user to // see the effect of a settings change without applying it immediately Loading core/java/android/os/PowerManager.java +26 −0 Original line number Diff line number Diff line Loading @@ -711,6 +711,22 @@ public final class PowerManager { } } /** * Returns whether the screen brightness is currently boosted to maximum, caused by a call * to {@link #boostScreenBrightness(long)}. * @return {@code True} if the screen brightness is currently boosted. {@code False} otherwise. * * @hide */ @SystemApi public boolean isScreenBrightnessBoosted() { try { return mService.isScreenBrightnessBoosted(); } catch (RemoteException e) { return false; } } /** * Sets the brightness of the backlights (screen, keyboard, button). * <p> Loading Loading @@ -891,6 +907,16 @@ public final class PowerManager { /** @hide */ public static final String EXTRA_POWER_SAVE_MODE = "mode"; /** * Intent that is broadcast when the state of {@link #isScreenBrightnessBoosted()} has changed. * This broadcast is only sent to registered receivers. * * @hide **/ @SystemApi public static final String ACTION_SCREEN_BRIGHTNESS_BOOST_CHANGED = "android.os.action.SCREEN_BRIGHTNESS_BOOST_CHANGED"; /** * A wake lock is a mechanism to indicate that your application needs * to have the device stay on. Loading core/res/AndroidManifest.xml +2 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,8 @@ <protected-broadcast android:name="android.os.action.POWER_SAVE_MODE_CHANGED" /> <protected-broadcast android:name="android.os.action.POWER_SAVE_MODE_CHANGING" /> <protected-broadcast android:name="android.os.action.SCREEN_BRIGHTNESS_BOOST_CHANGED" /> <protected-broadcast android:name="android.app.action.ENTER_CAR_MODE" /> <protected-broadcast android:name="android.app.action.EXIT_CAR_MODE" /> <protected-broadcast android:name="android.app.action.ENTER_DESK_MODE" /> Loading services/core/java/com/android/server/power/Notifier.java +38 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ final class Notifier { private static final int MSG_USER_ACTIVITY = 1; private static final int MSG_BROADCAST = 2; private static final int MSG_WIRELESS_CHARGING_STARTED = 3; private static final int MSG_SCREEN_BRIGHTNESS_BOOST_CHANGED = 4; private final Object mLock = new Object(); Loading @@ -92,6 +93,7 @@ final class Notifier { private final NotifierHandler mHandler; private final Intent mScreenOnIntent; private final Intent mScreenOffIntent; private final Intent mScreenBrightnessBoostIntent; // The current interactive state. private int mActualInteractiveState; Loading Loading @@ -128,6 +130,10 @@ final class Notifier { mScreenOffIntent = new Intent(Intent.ACTION_SCREEN_OFF); mScreenOffIntent.addFlags( Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND); mScreenBrightnessBoostIntent = new Intent(PowerManager.ACTION_SCREEN_BRIGHTNESS_BOOST_CHANGED); mScreenBrightnessBoostIntent.addFlags( Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND); // Initialize interactive state for battery stats. try { Loading Loading @@ -348,6 +354,19 @@ final class Notifier { } } /** * Called when screen brightness boost begins or ends. */ public void onScreenBrightnessBoostChanged() { if (DEBUG) { Slog.d(TAG, "onScreenBrightnessBoostChanged"); } mSuspendBlocker.acquire(); Message msg = mHandler.obtainMessage(MSG_SCREEN_BRIGHTNESS_BOOST_CHANGED); msg.setAsynchronous(true); mHandler.sendMessage(msg); } /** * Called when there has been user activity. */ Loading Loading @@ -457,6 +476,22 @@ final class Notifier { } } private void sendBrightnessBoostChangedBroadcast() { if (DEBUG) { Slog.d(TAG, "Sending brightness boost changed broadcast."); } mContext.sendOrderedBroadcastAsUser(mScreenBrightnessBoostIntent, UserHandle.ALL, null, mScreeBrightnessBoostChangedDone, mHandler, 0, null, null); } private final BroadcastReceiver mScreeBrightnessBoostChangedDone = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { mSuspendBlocker.release(); } }; private void sendWakeUpBroadcast() { if (DEBUG) { Slog.d(TAG, "Sending wake up broadcast."); Loading Loading @@ -539,6 +574,9 @@ final class Notifier { case MSG_WIRELESS_CHARGING_STARTED: playWirelessChargingStartedSound(); break; case MSG_SCREEN_BRIGHTNESS_BOOST_CHANGED: sendBrightnessBoostChangedBroadcast(); break; } } } Loading Loading
api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -23738,6 +23738,7 @@ package android.os { public final class PowerManager { method public boolean isInteractive(); method public boolean isPowerSaveMode(); method public boolean isScreenBrightnessBoosted(); method public deprecated boolean isScreenOn(); method public boolean isWakeLockLevelSupported(int); method public android.os.PowerManager.WakeLock newWakeLock(int, java.lang.String); Loading @@ -23745,6 +23746,7 @@ package android.os { method public void userActivity(long, int, int); field public static final int ACQUIRE_CAUSES_WAKEUP = 268435456; // 0x10000000 field public static final java.lang.String ACTION_POWER_SAVE_MODE_CHANGED = "android.os.action.POWER_SAVE_MODE_CHANGED"; field public static final java.lang.String ACTION_SCREEN_BRIGHTNESS_BOOST_CHANGED = "android.os.action.SCREEN_BRIGHTNESS_BOOST_CHANGED"; field public static final deprecated int FULL_WAKE_LOCK = 26; // 0x1a field public static final int ON_AFTER_RELEASE = 536870912; // 0x20000000 field public static final int PARTIAL_WAKE_LOCK = 1; // 0x1
core/java/android/os/IPowerManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ interface IPowerManager void setStayOnSetting(int val); void boostScreenBrightness(long time); boolean isScreenBrightnessBoosted(); // temporarily overrides the screen brightness settings to allow the user to // see the effect of a settings change without applying it immediately Loading
core/java/android/os/PowerManager.java +26 −0 Original line number Diff line number Diff line Loading @@ -711,6 +711,22 @@ public final class PowerManager { } } /** * Returns whether the screen brightness is currently boosted to maximum, caused by a call * to {@link #boostScreenBrightness(long)}. * @return {@code True} if the screen brightness is currently boosted. {@code False} otherwise. * * @hide */ @SystemApi public boolean isScreenBrightnessBoosted() { try { return mService.isScreenBrightnessBoosted(); } catch (RemoteException e) { return false; } } /** * Sets the brightness of the backlights (screen, keyboard, button). * <p> Loading Loading @@ -891,6 +907,16 @@ public final class PowerManager { /** @hide */ public static final String EXTRA_POWER_SAVE_MODE = "mode"; /** * Intent that is broadcast when the state of {@link #isScreenBrightnessBoosted()} has changed. * This broadcast is only sent to registered receivers. * * @hide **/ @SystemApi public static final String ACTION_SCREEN_BRIGHTNESS_BOOST_CHANGED = "android.os.action.SCREEN_BRIGHTNESS_BOOST_CHANGED"; /** * A wake lock is a mechanism to indicate that your application needs * to have the device stay on. Loading
core/res/AndroidManifest.xml +2 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,8 @@ <protected-broadcast android:name="android.os.action.POWER_SAVE_MODE_CHANGED" /> <protected-broadcast android:name="android.os.action.POWER_SAVE_MODE_CHANGING" /> <protected-broadcast android:name="android.os.action.SCREEN_BRIGHTNESS_BOOST_CHANGED" /> <protected-broadcast android:name="android.app.action.ENTER_CAR_MODE" /> <protected-broadcast android:name="android.app.action.EXIT_CAR_MODE" /> <protected-broadcast android:name="android.app.action.ENTER_DESK_MODE" /> Loading
services/core/java/com/android/server/power/Notifier.java +38 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ final class Notifier { private static final int MSG_USER_ACTIVITY = 1; private static final int MSG_BROADCAST = 2; private static final int MSG_WIRELESS_CHARGING_STARTED = 3; private static final int MSG_SCREEN_BRIGHTNESS_BOOST_CHANGED = 4; private final Object mLock = new Object(); Loading @@ -92,6 +93,7 @@ final class Notifier { private final NotifierHandler mHandler; private final Intent mScreenOnIntent; private final Intent mScreenOffIntent; private final Intent mScreenBrightnessBoostIntent; // The current interactive state. private int mActualInteractiveState; Loading Loading @@ -128,6 +130,10 @@ final class Notifier { mScreenOffIntent = new Intent(Intent.ACTION_SCREEN_OFF); mScreenOffIntent.addFlags( Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND); mScreenBrightnessBoostIntent = new Intent(PowerManager.ACTION_SCREEN_BRIGHTNESS_BOOST_CHANGED); mScreenBrightnessBoostIntent.addFlags( Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND); // Initialize interactive state for battery stats. try { Loading Loading @@ -348,6 +354,19 @@ final class Notifier { } } /** * Called when screen brightness boost begins or ends. */ public void onScreenBrightnessBoostChanged() { if (DEBUG) { Slog.d(TAG, "onScreenBrightnessBoostChanged"); } mSuspendBlocker.acquire(); Message msg = mHandler.obtainMessage(MSG_SCREEN_BRIGHTNESS_BOOST_CHANGED); msg.setAsynchronous(true); mHandler.sendMessage(msg); } /** * Called when there has been user activity. */ Loading Loading @@ -457,6 +476,22 @@ final class Notifier { } } private void sendBrightnessBoostChangedBroadcast() { if (DEBUG) { Slog.d(TAG, "Sending brightness boost changed broadcast."); } mContext.sendOrderedBroadcastAsUser(mScreenBrightnessBoostIntent, UserHandle.ALL, null, mScreeBrightnessBoostChangedDone, mHandler, 0, null, null); } private final BroadcastReceiver mScreeBrightnessBoostChangedDone = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { mSuspendBlocker.release(); } }; private void sendWakeUpBroadcast() { if (DEBUG) { Slog.d(TAG, "Sending wake up broadcast."); Loading Loading @@ -539,6 +574,9 @@ final class Notifier { case MSG_WIRELESS_CHARGING_STARTED: playWirelessChargingStartedSound(); break; case MSG_SCREEN_BRIGHTNESS_BOOST_CHANGED: sendBrightnessBoostChangedBroadcast(); break; } } } Loading