Loading core/api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -33461,6 +33461,7 @@ package android.os { field public static final String ACTION_LOW_POWER_STANDBY_ENABLED_CHANGED = "android.os.action.LOW_POWER_STANDBY_ENABLED_CHANGED"; field public static final String ACTION_LOW_POWER_STANDBY_POLICY_CHANGED = "android.os.action.LOW_POWER_STANDBY_POLICY_CHANGED"; field public static final String ACTION_POWER_SAVE_MODE_CHANGED = "android.os.action.POWER_SAVE_MODE_CHANGED"; field public static final String FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY = "com.android.lowpowerstandby.WAKE_ON_LAN"; field @Deprecated public static final int FULL_WAKE_LOCK = 26; // 0x1a field public static final int LOCATION_MODE_ALL_DISABLED_WHEN_SCREEN_OFF = 2; // 0x2 field public static final int LOCATION_MODE_FOREGROUND_ONLY = 3; // 0x3 Loading @@ -33470,7 +33471,6 @@ package android.os { field public static final int LOW_POWER_STANDBY_ALLOWED_REASON_ONGOING_CALL = 4; // 0x4 field public static final int LOW_POWER_STANDBY_ALLOWED_REASON_TEMP_POWER_SAVE_ALLOWLIST = 2; // 0x2 field public static final int LOW_POWER_STANDBY_ALLOWED_REASON_VOICE_INTERACTION = 1; // 0x1 field public static final String LOW_POWER_STANDBY_FEATURE_WAKE_ON_LAN = "com.android.lowpowerstandby.WAKE_ON_LAN"; field public static final int ON_AFTER_RELEASE = 536870912; // 0x20000000 field public static final int PARTIAL_WAKE_LOCK = 1; // 0x1 field public static final int PROXIMITY_SCREEN_OFF_WAKE_LOCK = 32; // 0x20 core/java/android/os/PowerManager.java +17 −2 Original line number Diff line number Diff line Loading @@ -3048,7 +3048,7 @@ public final class PowerManager { * * @see #isAllowedInLowPowerStandby(String) */ public static final String LOW_POWER_STANDBY_FEATURE_WAKE_ON_LAN = public static final String FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY = "com.android.lowpowerstandby.WAKE_ON_LAN"; /** Loading Loading @@ -3130,10 +3130,25 @@ public final class PowerManager { @LowPowerStandbyAllowedReason private final int mAllowedReasons; /** Features that are allowed to be used in Low Power Standby. */ /** * Features that are allowed to be used in Low Power Standby. * * @see #FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY */ @NonNull private final Set<String> mAllowedFeatures; /** * Create a policy that defines the restrictions enforced by Low Power Standby. * * @param identifier Name of the policy, used for debugging & metrics. * @param exemptPackages Packages that are exempt from Low Power Standby restrictions. * @param allowedReasons Reasons that this policy allows apps to be automatically exempted * from Low Power Standby restrictions for. * @param allowedFeatures Features that are allowed to be used in Low Power Standby. * Features are declared as strings, see * {@link #FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY} as an example. */ public LowPowerStandbyPolicy(@NonNull String identifier, @NonNull Set<String> exemptPackages, @LowPowerStandbyAllowedReason int allowedReasons, Loading services/tests/servicestests/src/com/android/server/power/LowPowerStandbyControllerTest.java +5 −5 Original line number Diff line number Diff line Loading @@ -16,10 +16,10 @@ package com.android.server.power; import static android.os.PowerManager.FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY; import static android.os.PowerManager.LOW_POWER_STANDBY_ALLOWED_REASON_ONGOING_CALL; import static android.os.PowerManager.LOW_POWER_STANDBY_ALLOWED_REASON_TEMP_POWER_SAVE_ALLOWLIST; import static android.os.PowerManager.LOW_POWER_STANDBY_ALLOWED_REASON_VOICE_INTERACTION; import static android.os.PowerManager.LOW_POWER_STANDBY_FEATURE_WAKE_ON_LAN; import static android.os.PowerManager.LowPowerStandbyPortDescription.MATCH_PORT_LOCAL; import static android.os.PowerManager.LowPowerStandbyPortDescription.PROTOCOL_TCP; import static android.os.PowerManager.LowPowerStandbyPortDescription.PROTOCOL_UDP; Loading Loading @@ -571,17 +571,17 @@ public class LowPowerStandbyControllerTest { mController.setEnabled(false); mTestLooper.dispatchAll(); assertTrue(mController.isAllowed(LOW_POWER_STANDBY_FEATURE_WAKE_ON_LAN)); assertTrue(mController.isAllowed(FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY)); } @Test public void testSetAllowedFeatures_isAllowedWhenEnabled() throws Exception { mController.systemReady(); mController.setEnabled(true); mController.setPolicy(policyWithAllowedFeatures(LOW_POWER_STANDBY_FEATURE_WAKE_ON_LAN)); mController.setPolicy(policyWithAllowedFeatures(FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY)); mTestLooper.dispatchAll(); assertTrue(mController.isAllowed(LOW_POWER_STANDBY_FEATURE_WAKE_ON_LAN)); assertTrue(mController.isAllowed(FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY)); } @Test Loading @@ -590,7 +590,7 @@ public class LowPowerStandbyControllerTest { mController.setEnabled(true); mTestLooper.dispatchAll(); assertFalse(mController.isAllowed(LOW_POWER_STANDBY_FEATURE_WAKE_ON_LAN)); assertFalse(mController.isAllowed(FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY)); } @Test Loading Loading
core/api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -33461,6 +33461,7 @@ package android.os { field public static final String ACTION_LOW_POWER_STANDBY_ENABLED_CHANGED = "android.os.action.LOW_POWER_STANDBY_ENABLED_CHANGED"; field public static final String ACTION_LOW_POWER_STANDBY_POLICY_CHANGED = "android.os.action.LOW_POWER_STANDBY_POLICY_CHANGED"; field public static final String ACTION_POWER_SAVE_MODE_CHANGED = "android.os.action.POWER_SAVE_MODE_CHANGED"; field public static final String FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY = "com.android.lowpowerstandby.WAKE_ON_LAN"; field @Deprecated public static final int FULL_WAKE_LOCK = 26; // 0x1a field public static final int LOCATION_MODE_ALL_DISABLED_WHEN_SCREEN_OFF = 2; // 0x2 field public static final int LOCATION_MODE_FOREGROUND_ONLY = 3; // 0x3 Loading @@ -33470,7 +33471,6 @@ package android.os { field public static final int LOW_POWER_STANDBY_ALLOWED_REASON_ONGOING_CALL = 4; // 0x4 field public static final int LOW_POWER_STANDBY_ALLOWED_REASON_TEMP_POWER_SAVE_ALLOWLIST = 2; // 0x2 field public static final int LOW_POWER_STANDBY_ALLOWED_REASON_VOICE_INTERACTION = 1; // 0x1 field public static final String LOW_POWER_STANDBY_FEATURE_WAKE_ON_LAN = "com.android.lowpowerstandby.WAKE_ON_LAN"; field public static final int ON_AFTER_RELEASE = 536870912; // 0x20000000 field public static final int PARTIAL_WAKE_LOCK = 1; // 0x1 field public static final int PROXIMITY_SCREEN_OFF_WAKE_LOCK = 32; // 0x20
core/java/android/os/PowerManager.java +17 −2 Original line number Diff line number Diff line Loading @@ -3048,7 +3048,7 @@ public final class PowerManager { * * @see #isAllowedInLowPowerStandby(String) */ public static final String LOW_POWER_STANDBY_FEATURE_WAKE_ON_LAN = public static final String FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY = "com.android.lowpowerstandby.WAKE_ON_LAN"; /** Loading Loading @@ -3130,10 +3130,25 @@ public final class PowerManager { @LowPowerStandbyAllowedReason private final int mAllowedReasons; /** Features that are allowed to be used in Low Power Standby. */ /** * Features that are allowed to be used in Low Power Standby. * * @see #FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY */ @NonNull private final Set<String> mAllowedFeatures; /** * Create a policy that defines the restrictions enforced by Low Power Standby. * * @param identifier Name of the policy, used for debugging & metrics. * @param exemptPackages Packages that are exempt from Low Power Standby restrictions. * @param allowedReasons Reasons that this policy allows apps to be automatically exempted * from Low Power Standby restrictions for. * @param allowedFeatures Features that are allowed to be used in Low Power Standby. * Features are declared as strings, see * {@link #FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY} as an example. */ public LowPowerStandbyPolicy(@NonNull String identifier, @NonNull Set<String> exemptPackages, @LowPowerStandbyAllowedReason int allowedReasons, Loading
services/tests/servicestests/src/com/android/server/power/LowPowerStandbyControllerTest.java +5 −5 Original line number Diff line number Diff line Loading @@ -16,10 +16,10 @@ package com.android.server.power; import static android.os.PowerManager.FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY; import static android.os.PowerManager.LOW_POWER_STANDBY_ALLOWED_REASON_ONGOING_CALL; import static android.os.PowerManager.LOW_POWER_STANDBY_ALLOWED_REASON_TEMP_POWER_SAVE_ALLOWLIST; import static android.os.PowerManager.LOW_POWER_STANDBY_ALLOWED_REASON_VOICE_INTERACTION; import static android.os.PowerManager.LOW_POWER_STANDBY_FEATURE_WAKE_ON_LAN; import static android.os.PowerManager.LowPowerStandbyPortDescription.MATCH_PORT_LOCAL; import static android.os.PowerManager.LowPowerStandbyPortDescription.PROTOCOL_TCP; import static android.os.PowerManager.LowPowerStandbyPortDescription.PROTOCOL_UDP; Loading Loading @@ -571,17 +571,17 @@ public class LowPowerStandbyControllerTest { mController.setEnabled(false); mTestLooper.dispatchAll(); assertTrue(mController.isAllowed(LOW_POWER_STANDBY_FEATURE_WAKE_ON_LAN)); assertTrue(mController.isAllowed(FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY)); } @Test public void testSetAllowedFeatures_isAllowedWhenEnabled() throws Exception { mController.systemReady(); mController.setEnabled(true); mController.setPolicy(policyWithAllowedFeatures(LOW_POWER_STANDBY_FEATURE_WAKE_ON_LAN)); mController.setPolicy(policyWithAllowedFeatures(FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY)); mTestLooper.dispatchAll(); assertTrue(mController.isAllowed(LOW_POWER_STANDBY_FEATURE_WAKE_ON_LAN)); assertTrue(mController.isAllowed(FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY)); } @Test Loading @@ -590,7 +590,7 @@ public class LowPowerStandbyControllerTest { mController.setEnabled(true); mTestLooper.dispatchAll(); assertFalse(mController.isAllowed(LOW_POWER_STANDBY_FEATURE_WAKE_ON_LAN)); assertFalse(mController.isAllowed(FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY)); } @Test Loading