Merge "More docs for LowPowerStandbyPolicy, rename FEATURE_WAKE_ON_LAN" into udc-dev am: b62d832a20
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21480465 Change-Id: I353c54d16689217d6573d35f7a2fb4d26a5473ca Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -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_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_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 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 @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_ALL_DISABLED_WHEN_SCREEN_OFF = 2; // 0x2
|
||||||
field public static final int LOCATION_MODE_FOREGROUND_ONLY = 3; // 0x3
|
field public static final int LOCATION_MODE_FOREGROUND_ONLY = 3; // 0x3
|
||||||
@@ -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_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_TEMP_POWER_SAVE_ALLOWLIST = 2; // 0x2
|
||||||
field public static final int LOW_POWER_STANDBY_ALLOWED_REASON_VOICE_INTERACTION = 1; // 0x1
|
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 ON_AFTER_RELEASE = 536870912; // 0x20000000
|
||||||
field public static final int PARTIAL_WAKE_LOCK = 1; // 0x1
|
field public static final int PARTIAL_WAKE_LOCK = 1; // 0x1
|
||||||
field public static final int PROXIMITY_SCREEN_OFF_WAKE_LOCK = 32; // 0x20
|
field public static final int PROXIMITY_SCREEN_OFF_WAKE_LOCK = 32; // 0x20
|
||||||
|
|||||||
@@ -3048,7 +3048,7 @@ public final class PowerManager {
|
|||||||
*
|
*
|
||||||
* @see #isAllowedInLowPowerStandby(String)
|
* @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";
|
"com.android.lowpowerstandby.WAKE_ON_LAN";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3130,10 +3130,25 @@ public final class PowerManager {
|
|||||||
@LowPowerStandbyAllowedReason
|
@LowPowerStandbyAllowedReason
|
||||||
private final int mAllowedReasons;
|
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
|
@NonNull
|
||||||
private final Set<String> mAllowedFeatures;
|
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,
|
public LowPowerStandbyPolicy(@NonNull String identifier,
|
||||||
@NonNull Set<String> exemptPackages,
|
@NonNull Set<String> exemptPackages,
|
||||||
@LowPowerStandbyAllowedReason int allowedReasons,
|
@LowPowerStandbyAllowedReason int allowedReasons,
|
||||||
|
|||||||
@@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
package com.android.server.power;
|
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_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_TEMP_POWER_SAVE_ALLOWLIST;
|
||||||
import static android.os.PowerManager.LOW_POWER_STANDBY_ALLOWED_REASON_VOICE_INTERACTION;
|
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.MATCH_PORT_LOCAL;
|
||||||
import static android.os.PowerManager.LowPowerStandbyPortDescription.PROTOCOL_TCP;
|
import static android.os.PowerManager.LowPowerStandbyPortDescription.PROTOCOL_TCP;
|
||||||
import static android.os.PowerManager.LowPowerStandbyPortDescription.PROTOCOL_UDP;
|
import static android.os.PowerManager.LowPowerStandbyPortDescription.PROTOCOL_UDP;
|
||||||
@@ -571,17 +571,17 @@ public class LowPowerStandbyControllerTest {
|
|||||||
mController.setEnabled(false);
|
mController.setEnabled(false);
|
||||||
mTestLooper.dispatchAll();
|
mTestLooper.dispatchAll();
|
||||||
|
|
||||||
assertTrue(mController.isAllowed(LOW_POWER_STANDBY_FEATURE_WAKE_ON_LAN));
|
assertTrue(mController.isAllowed(FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSetAllowedFeatures_isAllowedWhenEnabled() throws Exception {
|
public void testSetAllowedFeatures_isAllowedWhenEnabled() throws Exception {
|
||||||
mController.systemReady();
|
mController.systemReady();
|
||||||
mController.setEnabled(true);
|
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();
|
mTestLooper.dispatchAll();
|
||||||
|
|
||||||
assertTrue(mController.isAllowed(LOW_POWER_STANDBY_FEATURE_WAKE_ON_LAN));
|
assertTrue(mController.isAllowed(FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -590,7 +590,7 @@ public class LowPowerStandbyControllerTest {
|
|||||||
mController.setEnabled(true);
|
mController.setEnabled(true);
|
||||||
mTestLooper.dispatchAll();
|
mTestLooper.dispatchAll();
|
||||||
|
|
||||||
assertFalse(mController.isAllowed(LOW_POWER_STANDBY_FEATURE_WAKE_ON_LAN));
|
assertFalse(mController.isAllowed(FEATURE_WAKE_ON_LAN_IN_LOW_POWER_STANDBY));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user