Loading core/java/android/provider/Settings.java +8 −0 Original line number Diff line number Diff line Loading @@ -5765,6 +5765,13 @@ public final class Settings { */ public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu"; /** * Whether to wake the display when plugging or unplugging the charger * * @hide */ public static final String WAKE_WHEN_PLUGGED_OR_UNPLUGGED = "wake_when_plugged_or_unplugged"; /** * Whether ADB is enabled. */ Loading Loading @@ -7131,6 +7138,7 @@ public final class Settings { public static final String[] SETTINGS_TO_BACKUP = { BUGREPORT_IN_POWER_MENU, STAY_ON_WHILE_PLUGGED_IN, WAKE_WHEN_PLUGGED_OR_UNPLUGGED, AUTO_TIME, AUTO_TIME_ZONE, POWER_SOUNDS_ENABLED, Loading services/core/java/com/android/server/power/PowerManagerService.java +10 −1 Original line number Diff line number Diff line Loading @@ -381,6 +381,9 @@ public final class PowerManagerService extends SystemService // A bitfield of battery conditions under which to make the screen stay on. private int mStayOnWhilePluggedInSetting; // True if the device should wake up when plugged or unplugged private int mWakeUpWhenPluggedOrUnpluggedSetting; // True if the device should stay on. private boolean mStayOn; Loading Loading @@ -635,6 +638,9 @@ public final class PowerManagerService extends SystemService resolver.registerContentObserver(Settings.System.getUriFor( Settings.System.BUTTON_BACKLIGHT_TIMEOUT), false, mSettingsObserver, UserHandle.USER_ALL); resolver.registerContentObserver(Settings.Global.getUriFor( Settings.Global.WAKE_WHEN_PLUGGED_OR_UNPLUGGED), false, mSettingsObserver, UserHandle.USER_ALL); // Go. readConfigurationLocked(); Loading Loading @@ -714,6 +720,9 @@ public final class PowerManagerService extends SystemService UserHandle.USER_CURRENT); mStayOnWhilePluggedInSetting = Settings.Global.getInt(resolver, Settings.Global.STAY_ON_WHILE_PLUGGED_IN, BatteryManager.BATTERY_PLUGGED_AC); mWakeUpWhenPluggedOrUnpluggedSetting = Settings.Global.getInt(resolver, Settings.Global.WAKE_WHEN_PLUGGED_OR_UNPLUGGED, (mWakeUpWhenPluggedOrUnpluggedConfig ? 1 : 0)); mProximityWakeEnabled = Settings.System.getInt(resolver, Settings.System.PROXIMITY_ON_WAKE, 0) == 1; Loading Loading @@ -1453,7 +1462,7 @@ public final class PowerManagerService extends SystemService private boolean shouldWakeUpWhenPluggedOrUnpluggedLocked( boolean wasPowered, int oldPlugType, boolean dockedOnWirelessCharger) { // Don't wake when powered unless configured to do so. if (!mWakeUpWhenPluggedOrUnpluggedConfig) { if (mWakeUpWhenPluggedOrUnpluggedSetting == 0) { return false; } Loading Loading
core/java/android/provider/Settings.java +8 −0 Original line number Diff line number Diff line Loading @@ -5765,6 +5765,13 @@ public final class Settings { */ public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu"; /** * Whether to wake the display when plugging or unplugging the charger * * @hide */ public static final String WAKE_WHEN_PLUGGED_OR_UNPLUGGED = "wake_when_plugged_or_unplugged"; /** * Whether ADB is enabled. */ Loading Loading @@ -7131,6 +7138,7 @@ public final class Settings { public static final String[] SETTINGS_TO_BACKUP = { BUGREPORT_IN_POWER_MENU, STAY_ON_WHILE_PLUGGED_IN, WAKE_WHEN_PLUGGED_OR_UNPLUGGED, AUTO_TIME, AUTO_TIME_ZONE, POWER_SOUNDS_ENABLED, Loading
services/core/java/com/android/server/power/PowerManagerService.java +10 −1 Original line number Diff line number Diff line Loading @@ -381,6 +381,9 @@ public final class PowerManagerService extends SystemService // A bitfield of battery conditions under which to make the screen stay on. private int mStayOnWhilePluggedInSetting; // True if the device should wake up when plugged or unplugged private int mWakeUpWhenPluggedOrUnpluggedSetting; // True if the device should stay on. private boolean mStayOn; Loading Loading @@ -635,6 +638,9 @@ public final class PowerManagerService extends SystemService resolver.registerContentObserver(Settings.System.getUriFor( Settings.System.BUTTON_BACKLIGHT_TIMEOUT), false, mSettingsObserver, UserHandle.USER_ALL); resolver.registerContentObserver(Settings.Global.getUriFor( Settings.Global.WAKE_WHEN_PLUGGED_OR_UNPLUGGED), false, mSettingsObserver, UserHandle.USER_ALL); // Go. readConfigurationLocked(); Loading Loading @@ -714,6 +720,9 @@ public final class PowerManagerService extends SystemService UserHandle.USER_CURRENT); mStayOnWhilePluggedInSetting = Settings.Global.getInt(resolver, Settings.Global.STAY_ON_WHILE_PLUGGED_IN, BatteryManager.BATTERY_PLUGGED_AC); mWakeUpWhenPluggedOrUnpluggedSetting = Settings.Global.getInt(resolver, Settings.Global.WAKE_WHEN_PLUGGED_OR_UNPLUGGED, (mWakeUpWhenPluggedOrUnpluggedConfig ? 1 : 0)); mProximityWakeEnabled = Settings.System.getInt(resolver, Settings.System.PROXIMITY_ON_WAKE, 0) == 1; Loading Loading @@ -1453,7 +1462,7 @@ public final class PowerManagerService extends SystemService private boolean shouldWakeUpWhenPluggedOrUnpluggedLocked( boolean wasPowered, int oldPlugType, boolean dockedOnWirelessCharger) { // Don't wake when powered unless configured to do so. if (!mWakeUpWhenPluggedOrUnpluggedConfig) { if (mWakeUpWhenPluggedOrUnpluggedSetting == 0) { return false; } Loading