Merge "Force the app idle state again after whitelisting it." into rvc-dev am: 2008be86fd am: 886928a5b8 am: 18c0716ca5 am: 949242b819
Original change: https://googleplex-android-review.googlesource.com/c/platform/cts/+/12171299 Change-Id: I7edf8524c8c788f2561129ead0817c6597f0a8e9
This commit is contained in:
@@ -89,14 +89,19 @@ abstract class AbstractAppIdleTestCase extends AbstractRestrictBackgroundNetwork
|
|||||||
assertAppIdle(false); // Sanity check - not idle anymore, since whitelisted
|
assertAppIdle(false); // Sanity check - not idle anymore, since whitelisted
|
||||||
assertBackgroundNetworkAccess(true);
|
assertBackgroundNetworkAccess(true);
|
||||||
|
|
||||||
|
setAppIdleNoAssert(true);
|
||||||
|
assertAppIdle(false); // app is still whitelisted
|
||||||
removePowerSaveModeWhitelist(TEST_APP2_PKG);
|
removePowerSaveModeWhitelist(TEST_APP2_PKG);
|
||||||
assertAppIdle(true); // Sanity check - idle again, once whitelisted was removed
|
assertAppIdle(true); // Sanity check - idle again, once whitelisted was removed
|
||||||
assertBackgroundNetworkAccess(false);
|
assertBackgroundNetworkAccess(false);
|
||||||
|
|
||||||
|
setAppIdle(true);
|
||||||
addPowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
|
addPowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
|
||||||
assertAppIdle(false); // Sanity check - not idle anymore, since whitelisted
|
assertAppIdle(false); // Sanity check - not idle anymore, since whitelisted
|
||||||
assertBackgroundNetworkAccess(true);
|
assertBackgroundNetworkAccess(true);
|
||||||
|
|
||||||
|
setAppIdleNoAssert(true);
|
||||||
|
assertAppIdle(false); // app is still whitelisted
|
||||||
removePowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
|
removePowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
|
||||||
assertAppIdle(true); // Sanity check - idle again, once whitelisted was removed
|
assertAppIdle(true); // Sanity check - idle again, once whitelisted was removed
|
||||||
assertBackgroundNetworkAccess(false);
|
assertBackgroundNetworkAccess(false);
|
||||||
|
|||||||
@@ -662,6 +662,11 @@ public abstract class AbstractRestrictBackgroundNetworkTestCase {
|
|||||||
assertAppIdle(enabled); // Sanity check
|
assertAppIdle(enabled); // Sanity check
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void setAppIdleNoAssert(boolean enabled) throws Exception {
|
||||||
|
Log.i(TAG, "Setting app idle to " + enabled);
|
||||||
|
executeSilentShellCommand("am set-inactive " + TEST_APP2_PKG + " " + enabled );
|
||||||
|
}
|
||||||
|
|
||||||
protected void assertAppIdle(boolean enabled) throws Exception {
|
protected void assertAppIdle(boolean enabled) throws Exception {
|
||||||
try {
|
try {
|
||||||
assertDelayedShellCommand("am get-inactive " + TEST_APP2_PKG, 15, 2, "Idle=" + enabled);
|
assertDelayedShellCommand("am get-inactive " + TEST_APP2_PKG, 15, 2, "Idle=" + enabled);
|
||||||
|
|||||||
Reference in New Issue
Block a user