Loading cmds/bootanimation/bootanimation_main.cpp +4 −1 Original line number Original line Diff line number Diff line Loading @@ -37,6 +37,10 @@ int main() char value[PROPERTY_VALUE_MAX]; char value[PROPERTY_VALUE_MAX]; property_get("debug.sf.nobootanimation", value, "0"); property_get("debug.sf.nobootanimation", value, "0"); int noBootAnimation = atoi(value); int noBootAnimation = atoi(value); if (!noBootAnimation) { property_get("ro.boot.quiescent", value, "0"); noBootAnimation = atoi(value); } ALOGI_IF(noBootAnimation, "boot animation disabled"); ALOGI_IF(noBootAnimation, "boot animation disabled"); if (!noBootAnimation) { if (!noBootAnimation) { Loading @@ -47,7 +51,6 @@ int main() sp<BootAnimation> boot = new BootAnimation(); sp<BootAnimation> boot = new BootAnimation(); IPCThreadState::self()->joinThreadPool(); IPCThreadState::self()->joinThreadPool(); } } return 0; return 0; } } core/java/android/os/PowerManager.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -420,6 +420,12 @@ public final class PowerManager { */ */ public static final String REBOOT_SAFE_MODE = "safemode"; public static final String REBOOT_SAFE_MODE = "safemode"; /** * The 'reason' value used when rebooting the device without turning on the screen. * @hide */ public static final String REBOOT_QUIESCENT = "quiescent"; /** /** * The value to pass as the 'reason' argument to android_reboot(). * The value to pass as the 'reason' argument to android_reboot(). * @hide * @hide Loading services/core/java/com/android/server/power/PowerManagerService.java +42 −7 Original line number Original line Diff line number Diff line Loading @@ -134,6 +134,8 @@ public final class PowerManagerService extends SystemService private static final int DIRTY_DOCK_STATE = 1 << 10; private static final int DIRTY_DOCK_STATE = 1 << 10; // Dirty bit: brightness boost changed // Dirty bit: brightness boost changed private static final int DIRTY_SCREEN_BRIGHTNESS_BOOST = 1 << 11; private static final int DIRTY_SCREEN_BRIGHTNESS_BOOST = 1 << 11; // Dirty bit: sQuiescent changed private static final int DIRTY_QUIESCENT = 1 << 12; // Summarizes the state of all active wakelocks. // Summarizes the state of all active wakelocks. private static final int WAKE_LOCK_CPU = 1 << 0; private static final int WAKE_LOCK_CPU = 1 << 0; Loading Loading @@ -169,6 +171,9 @@ public final class PowerManagerService extends SystemService // Default setting for double tap to wake. // Default setting for double tap to wake. private static final int DEFAULT_DOUBLE_TAP_TO_WAKE = 0; private static final int DEFAULT_DOUBLE_TAP_TO_WAKE = 0; // System property indicating that the screen should remain off until an explicit user action private static final String SYSTEM_PROPERTY_QUIESCENT = "ro.boot.quiescent"; /** Constants for {@link #shutdownOrRebootInternal} */ /** Constants for {@link #shutdownOrRebootInternal} */ @Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE) @IntDef({HALT_MODE_SHUTDOWN, HALT_MODE_REBOOT, HALT_MODE_REBOOT_SAFE_MODE}) @IntDef({HALT_MODE_SHUTDOWN, HALT_MODE_REBOOT, HALT_MODE_REBOOT_SAFE_MODE}) Loading Loading @@ -398,6 +403,9 @@ public final class PowerManagerService extends SystemService // True if the device should stay on. // True if the device should stay on. private boolean mStayOn; private boolean mStayOn; // True if the lights should stay off until an explicit user action. private static boolean sQuiescent; // True if the proximity sensor reads a positive result. // True if the proximity sensor reads a positive result. private boolean mProximityPositive; private boolean mProximityPositive; Loading Loading @@ -530,6 +538,8 @@ public final class PowerManagerService extends SystemService mWakefulness = WAKEFULNESS_AWAKE; mWakefulness = WAKEFULNESS_AWAKE; sQuiescent = SystemProperties.get(SYSTEM_PROPERTY_QUIESCENT, "0").equals("1"); nativeInit(); nativeInit(); nativeSetAutoSuspend(false); nativeSetAutoSuspend(false); nativeSetInteractive(true); nativeSetInteractive(true); Loading Loading @@ -1190,12 +1200,19 @@ public final class PowerManagerService extends SystemService && eventTime > mLastUserActivityTime) { && eventTime > mLastUserActivityTime) { mLastUserActivityTimeNoChangeLights = eventTime; mLastUserActivityTimeNoChangeLights = eventTime; mDirty |= DIRTY_USER_ACTIVITY; mDirty |= DIRTY_USER_ACTIVITY; if (event == PowerManager.USER_ACTIVITY_EVENT_BUTTON) { mDirty |= DIRTY_QUIESCENT; } return true; return true; } } } else { } else { if (eventTime > mLastUserActivityTime) { if (eventTime > mLastUserActivityTime) { mLastUserActivityTime = eventTime; mLastUserActivityTime = eventTime; mDirty |= DIRTY_USER_ACTIVITY; mDirty |= DIRTY_USER_ACTIVITY; if (event == PowerManager.USER_ACTIVITY_EVENT_BUTTON) { mDirty |= DIRTY_QUIESCENT; } return true; return true; } } } } Loading Loading @@ -2096,7 +2113,7 @@ public final class PowerManagerService extends SystemService final boolean oldDisplayReady = mDisplayReady; final boolean oldDisplayReady = mDisplayReady; if ((dirty & (DIRTY_WAKE_LOCKS | DIRTY_USER_ACTIVITY | DIRTY_WAKEFULNESS if ((dirty & (DIRTY_WAKE_LOCKS | DIRTY_USER_ACTIVITY | DIRTY_WAKEFULNESS | DIRTY_ACTUAL_DISPLAY_POWER_STATE_UPDATED | DIRTY_BOOT_COMPLETED | DIRTY_ACTUAL_DISPLAY_POWER_STATE_UPDATED | DIRTY_BOOT_COMPLETED | DIRTY_SETTINGS | DIRTY_SCREEN_BRIGHTNESS_BOOST)) != 0) { | DIRTY_SETTINGS | DIRTY_SCREEN_BRIGHTNESS_BOOST | DIRTY_QUIESCENT)) != 0) { mDisplayPowerRequest.policy = getDesiredScreenPolicyLocked(); mDisplayPowerRequest.policy = getDesiredScreenPolicyLocked(); // Determine appropriate screen brightness and auto-brightness adjustments. // Determine appropriate screen brightness and auto-brightness adjustments. Loading Loading @@ -2163,6 +2180,9 @@ public final class PowerManagerService extends SystemService mRequestWaitForNegativeProximity); mRequestWaitForNegativeProximity); mRequestWaitForNegativeProximity = false; mRequestWaitForNegativeProximity = false; if ((dirty & DIRTY_QUIESCENT) != 0) { sQuiescent = false; } if (DEBUG_SPEW) { if (DEBUG_SPEW) { Slog.d(TAG, "updateDisplayPowerStateLocked: mDisplayReady=" + mDisplayReady Slog.d(TAG, "updateDisplayPowerStateLocked: mDisplayReady=" + mDisplayReady + ", policy=" + mDisplayPowerRequest.policy + ", policy=" + mDisplayPowerRequest.policy Loading @@ -2170,8 +2190,8 @@ public final class PowerManagerService extends SystemService + ", mWakeLockSummary=0x" + Integer.toHexString(mWakeLockSummary) + ", mWakeLockSummary=0x" + Integer.toHexString(mWakeLockSummary) + ", mUserActivitySummary=0x" + Integer.toHexString(mUserActivitySummary) + ", mUserActivitySummary=0x" + Integer.toHexString(mUserActivitySummary) + ", mBootCompleted=" + mBootCompleted + ", mBootCompleted=" + mBootCompleted + ", mScreenBrightnessBoostInProgress=" + ", mScreenBrightnessBoostInProgress=" + mScreenBrightnessBoostInProgress + mScreenBrightnessBoostInProgress); + ", sQuiescent=" + sQuiescent); } } } } return mDisplayReady && !oldDisplayReady; return mDisplayReady && !oldDisplayReady; Loading Loading @@ -2210,7 +2230,7 @@ public final class PowerManagerService extends SystemService } } private int getDesiredScreenPolicyLocked() { private int getDesiredScreenPolicyLocked() { if (mWakefulness == WAKEFULNESS_ASLEEP) { if (mWakefulness == WAKEFULNESS_ASLEEP || sQuiescent) { return DisplayPowerRequest.POLICY_OFF; return DisplayPowerRequest.POLICY_OFF; } } Loading Loading @@ -2899,10 +2919,25 @@ public final class PowerManagerService extends SystemService } } if (reason.equals(PowerManager.REBOOT_RECOVERY) if (reason.equals(PowerManager.REBOOT_RECOVERY) || reason.equals(PowerManager.REBOOT_RECOVERY_UPDATE)) { || reason.equals(PowerManager.REBOOT_RECOVERY_UPDATE)) { SystemProperties.set("sys.powerctl", "reboot,recovery"); reason = "recovery"; } else { } SystemProperties.set("sys.powerctl", "reboot," + reason); // If the reason is "quiescent", it means that the boot process should proceed // without turning on the screen/lights. // The "quiescent" property is sticky, meaning that any number // of subsequent reboots should honor the property until it is reset. if (reason.equals(PowerManager.REBOOT_QUIESCENT)) { sQuiescent = true; reason = ""; } } if (sQuiescent) { // Pass the optional "quiescent" argument to the bootloader to let it know // that it should not turn the screen/lights on. reason = reason + ",quiescent"; } SystemProperties.set("sys.powerctl", "reboot," + reason); try { try { Thread.sleep(20 * 1000L); Thread.sleep(20 * 1000L); } catch (InterruptedException e) { } catch (InterruptedException e) { Loading Loading
cmds/bootanimation/bootanimation_main.cpp +4 −1 Original line number Original line Diff line number Diff line Loading @@ -37,6 +37,10 @@ int main() char value[PROPERTY_VALUE_MAX]; char value[PROPERTY_VALUE_MAX]; property_get("debug.sf.nobootanimation", value, "0"); property_get("debug.sf.nobootanimation", value, "0"); int noBootAnimation = atoi(value); int noBootAnimation = atoi(value); if (!noBootAnimation) { property_get("ro.boot.quiescent", value, "0"); noBootAnimation = atoi(value); } ALOGI_IF(noBootAnimation, "boot animation disabled"); ALOGI_IF(noBootAnimation, "boot animation disabled"); if (!noBootAnimation) { if (!noBootAnimation) { Loading @@ -47,7 +51,6 @@ int main() sp<BootAnimation> boot = new BootAnimation(); sp<BootAnimation> boot = new BootAnimation(); IPCThreadState::self()->joinThreadPool(); IPCThreadState::self()->joinThreadPool(); } } return 0; return 0; } }
core/java/android/os/PowerManager.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -420,6 +420,12 @@ public final class PowerManager { */ */ public static final String REBOOT_SAFE_MODE = "safemode"; public static final String REBOOT_SAFE_MODE = "safemode"; /** * The 'reason' value used when rebooting the device without turning on the screen. * @hide */ public static final String REBOOT_QUIESCENT = "quiescent"; /** /** * The value to pass as the 'reason' argument to android_reboot(). * The value to pass as the 'reason' argument to android_reboot(). * @hide * @hide Loading
services/core/java/com/android/server/power/PowerManagerService.java +42 −7 Original line number Original line Diff line number Diff line Loading @@ -134,6 +134,8 @@ public final class PowerManagerService extends SystemService private static final int DIRTY_DOCK_STATE = 1 << 10; private static final int DIRTY_DOCK_STATE = 1 << 10; // Dirty bit: brightness boost changed // Dirty bit: brightness boost changed private static final int DIRTY_SCREEN_BRIGHTNESS_BOOST = 1 << 11; private static final int DIRTY_SCREEN_BRIGHTNESS_BOOST = 1 << 11; // Dirty bit: sQuiescent changed private static final int DIRTY_QUIESCENT = 1 << 12; // Summarizes the state of all active wakelocks. // Summarizes the state of all active wakelocks. private static final int WAKE_LOCK_CPU = 1 << 0; private static final int WAKE_LOCK_CPU = 1 << 0; Loading Loading @@ -169,6 +171,9 @@ public final class PowerManagerService extends SystemService // Default setting for double tap to wake. // Default setting for double tap to wake. private static final int DEFAULT_DOUBLE_TAP_TO_WAKE = 0; private static final int DEFAULT_DOUBLE_TAP_TO_WAKE = 0; // System property indicating that the screen should remain off until an explicit user action private static final String SYSTEM_PROPERTY_QUIESCENT = "ro.boot.quiescent"; /** Constants for {@link #shutdownOrRebootInternal} */ /** Constants for {@link #shutdownOrRebootInternal} */ @Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE) @IntDef({HALT_MODE_SHUTDOWN, HALT_MODE_REBOOT, HALT_MODE_REBOOT_SAFE_MODE}) @IntDef({HALT_MODE_SHUTDOWN, HALT_MODE_REBOOT, HALT_MODE_REBOOT_SAFE_MODE}) Loading Loading @@ -398,6 +403,9 @@ public final class PowerManagerService extends SystemService // True if the device should stay on. // True if the device should stay on. private boolean mStayOn; private boolean mStayOn; // True if the lights should stay off until an explicit user action. private static boolean sQuiescent; // True if the proximity sensor reads a positive result. // True if the proximity sensor reads a positive result. private boolean mProximityPositive; private boolean mProximityPositive; Loading Loading @@ -530,6 +538,8 @@ public final class PowerManagerService extends SystemService mWakefulness = WAKEFULNESS_AWAKE; mWakefulness = WAKEFULNESS_AWAKE; sQuiescent = SystemProperties.get(SYSTEM_PROPERTY_QUIESCENT, "0").equals("1"); nativeInit(); nativeInit(); nativeSetAutoSuspend(false); nativeSetAutoSuspend(false); nativeSetInteractive(true); nativeSetInteractive(true); Loading Loading @@ -1190,12 +1200,19 @@ public final class PowerManagerService extends SystemService && eventTime > mLastUserActivityTime) { && eventTime > mLastUserActivityTime) { mLastUserActivityTimeNoChangeLights = eventTime; mLastUserActivityTimeNoChangeLights = eventTime; mDirty |= DIRTY_USER_ACTIVITY; mDirty |= DIRTY_USER_ACTIVITY; if (event == PowerManager.USER_ACTIVITY_EVENT_BUTTON) { mDirty |= DIRTY_QUIESCENT; } return true; return true; } } } else { } else { if (eventTime > mLastUserActivityTime) { if (eventTime > mLastUserActivityTime) { mLastUserActivityTime = eventTime; mLastUserActivityTime = eventTime; mDirty |= DIRTY_USER_ACTIVITY; mDirty |= DIRTY_USER_ACTIVITY; if (event == PowerManager.USER_ACTIVITY_EVENT_BUTTON) { mDirty |= DIRTY_QUIESCENT; } return true; return true; } } } } Loading Loading @@ -2096,7 +2113,7 @@ public final class PowerManagerService extends SystemService final boolean oldDisplayReady = mDisplayReady; final boolean oldDisplayReady = mDisplayReady; if ((dirty & (DIRTY_WAKE_LOCKS | DIRTY_USER_ACTIVITY | DIRTY_WAKEFULNESS if ((dirty & (DIRTY_WAKE_LOCKS | DIRTY_USER_ACTIVITY | DIRTY_WAKEFULNESS | DIRTY_ACTUAL_DISPLAY_POWER_STATE_UPDATED | DIRTY_BOOT_COMPLETED | DIRTY_ACTUAL_DISPLAY_POWER_STATE_UPDATED | DIRTY_BOOT_COMPLETED | DIRTY_SETTINGS | DIRTY_SCREEN_BRIGHTNESS_BOOST)) != 0) { | DIRTY_SETTINGS | DIRTY_SCREEN_BRIGHTNESS_BOOST | DIRTY_QUIESCENT)) != 0) { mDisplayPowerRequest.policy = getDesiredScreenPolicyLocked(); mDisplayPowerRequest.policy = getDesiredScreenPolicyLocked(); // Determine appropriate screen brightness and auto-brightness adjustments. // Determine appropriate screen brightness and auto-brightness adjustments. Loading Loading @@ -2163,6 +2180,9 @@ public final class PowerManagerService extends SystemService mRequestWaitForNegativeProximity); mRequestWaitForNegativeProximity); mRequestWaitForNegativeProximity = false; mRequestWaitForNegativeProximity = false; if ((dirty & DIRTY_QUIESCENT) != 0) { sQuiescent = false; } if (DEBUG_SPEW) { if (DEBUG_SPEW) { Slog.d(TAG, "updateDisplayPowerStateLocked: mDisplayReady=" + mDisplayReady Slog.d(TAG, "updateDisplayPowerStateLocked: mDisplayReady=" + mDisplayReady + ", policy=" + mDisplayPowerRequest.policy + ", policy=" + mDisplayPowerRequest.policy Loading @@ -2170,8 +2190,8 @@ public final class PowerManagerService extends SystemService + ", mWakeLockSummary=0x" + Integer.toHexString(mWakeLockSummary) + ", mWakeLockSummary=0x" + Integer.toHexString(mWakeLockSummary) + ", mUserActivitySummary=0x" + Integer.toHexString(mUserActivitySummary) + ", mUserActivitySummary=0x" + Integer.toHexString(mUserActivitySummary) + ", mBootCompleted=" + mBootCompleted + ", mBootCompleted=" + mBootCompleted + ", mScreenBrightnessBoostInProgress=" + ", mScreenBrightnessBoostInProgress=" + mScreenBrightnessBoostInProgress + mScreenBrightnessBoostInProgress); + ", sQuiescent=" + sQuiescent); } } } } return mDisplayReady && !oldDisplayReady; return mDisplayReady && !oldDisplayReady; Loading Loading @@ -2210,7 +2230,7 @@ public final class PowerManagerService extends SystemService } } private int getDesiredScreenPolicyLocked() { private int getDesiredScreenPolicyLocked() { if (mWakefulness == WAKEFULNESS_ASLEEP) { if (mWakefulness == WAKEFULNESS_ASLEEP || sQuiescent) { return DisplayPowerRequest.POLICY_OFF; return DisplayPowerRequest.POLICY_OFF; } } Loading Loading @@ -2899,10 +2919,25 @@ public final class PowerManagerService extends SystemService } } if (reason.equals(PowerManager.REBOOT_RECOVERY) if (reason.equals(PowerManager.REBOOT_RECOVERY) || reason.equals(PowerManager.REBOOT_RECOVERY_UPDATE)) { || reason.equals(PowerManager.REBOOT_RECOVERY_UPDATE)) { SystemProperties.set("sys.powerctl", "reboot,recovery"); reason = "recovery"; } else { } SystemProperties.set("sys.powerctl", "reboot," + reason); // If the reason is "quiescent", it means that the boot process should proceed // without turning on the screen/lights. // The "quiescent" property is sticky, meaning that any number // of subsequent reboots should honor the property until it is reset. if (reason.equals(PowerManager.REBOOT_QUIESCENT)) { sQuiescent = true; reason = ""; } } if (sQuiescent) { // Pass the optional "quiescent" argument to the bootloader to let it know // that it should not turn the screen/lights on. reason = reason + ",quiescent"; } SystemProperties.set("sys.powerctl", "reboot," + reason); try { try { Thread.sleep(20 * 1000L); Thread.sleep(20 * 1000L); } catch (InterruptedException e) { } catch (InterruptedException e) { Loading