Loading core/java/android/provider/Settings.java +8 −0 Original line number Diff line number Diff line Loading @@ -5518,6 +5518,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 @@ -6611,6 +6618,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, MODE_RINGER, AUTO_TIME, AUTO_TIME_ZONE, Loading services/java/com/android/server/power/PowerManagerService.java +13 −3 Original line number Diff line number Diff line Loading @@ -290,7 +290,7 @@ public final class PowerManagerService extends IPowerManager.Stub // The current dock state. private int mDockState = Intent.EXTRA_DOCK_STATE_UNDOCKED; // True if the device should wake up when plugged or unplugged. // True if the device should wake up when plugged or unplugged (default from config.xml) private boolean mWakeUpWhenPluggedOrUnpluggedConfig; // True if dreams are supported on this device. Loading Loading @@ -325,6 +325,9 @@ public final class PowerManagerService extends IPowerManager.Stub // 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 @@ -517,6 +520,9 @@ public final class PowerManagerService extends IPowerManager.Stub resolver.registerContentObserver(Settings.Global.getUriFor( Settings.Global.STAY_ON_WHILE_PLUGGED_IN), false, mSettingsObserver, UserHandle.USER_ALL); resolver.registerContentObserver(Settings.Global.getUriFor( Settings.Global.WAKE_WHEN_PLUGGED_OR_UNPLUGGED), false, mSettingsObserver, UserHandle.USER_ALL); resolver.registerContentObserver(Settings.System.getUriFor( Settings.System.SCREEN_BRIGHTNESS), false, mSettingsObserver, UserHandle.USER_ALL); Loading Loading @@ -570,6 +576,9 @@ public final class PowerManagerService extends IPowerManager.Stub 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)); final int oldScreenBrightnessSetting = mScreenBrightnessSetting; mScreenBrightnessSetting = Settings.System.getIntForUser(resolver, Loading Loading @@ -1271,8 +1280,9 @@ public final class PowerManagerService extends IPowerManager.Stub private boolean shouldWakeUpWhenPluggedOrUnpluggedLocked( boolean wasPowered, int oldPlugType, boolean dockedOnWirelessCharger) { // Don't wake when powered unless configured to do so. if (!mWakeUpWhenPluggedOrUnpluggedConfig) { // Don't wake when powered if disabled in settings. if (mWakeUpWhenPluggedOrUnpluggedSetting == 0) { return false; } Loading Loading
core/java/android/provider/Settings.java +8 −0 Original line number Diff line number Diff line Loading @@ -5518,6 +5518,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 @@ -6611,6 +6618,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, MODE_RINGER, AUTO_TIME, AUTO_TIME_ZONE, Loading
services/java/com/android/server/power/PowerManagerService.java +13 −3 Original line number Diff line number Diff line Loading @@ -290,7 +290,7 @@ public final class PowerManagerService extends IPowerManager.Stub // The current dock state. private int mDockState = Intent.EXTRA_DOCK_STATE_UNDOCKED; // True if the device should wake up when plugged or unplugged. // True if the device should wake up when plugged or unplugged (default from config.xml) private boolean mWakeUpWhenPluggedOrUnpluggedConfig; // True if dreams are supported on this device. Loading Loading @@ -325,6 +325,9 @@ public final class PowerManagerService extends IPowerManager.Stub // 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 @@ -517,6 +520,9 @@ public final class PowerManagerService extends IPowerManager.Stub resolver.registerContentObserver(Settings.Global.getUriFor( Settings.Global.STAY_ON_WHILE_PLUGGED_IN), false, mSettingsObserver, UserHandle.USER_ALL); resolver.registerContentObserver(Settings.Global.getUriFor( Settings.Global.WAKE_WHEN_PLUGGED_OR_UNPLUGGED), false, mSettingsObserver, UserHandle.USER_ALL); resolver.registerContentObserver(Settings.System.getUriFor( Settings.System.SCREEN_BRIGHTNESS), false, mSettingsObserver, UserHandle.USER_ALL); Loading Loading @@ -570,6 +576,9 @@ public final class PowerManagerService extends IPowerManager.Stub 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)); final int oldScreenBrightnessSetting = mScreenBrightnessSetting; mScreenBrightnessSetting = Settings.System.getIntForUser(resolver, Loading Loading @@ -1271,8 +1280,9 @@ public final class PowerManagerService extends IPowerManager.Stub private boolean shouldWakeUpWhenPluggedOrUnpluggedLocked( boolean wasPowered, int oldPlugType, boolean dockedOnWirelessCharger) { // Don't wake when powered unless configured to do so. if (!mWakeUpWhenPluggedOrUnpluggedConfig) { // Don't wake when powered if disabled in settings. if (mWakeUpWhenPluggedOrUnpluggedSetting == 0) { return false; } Loading