Merge "Force the app idle state again after whitelisting it." into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2008be86fd
@@ -89,14 +89,19 @@ abstract class AbstractAppIdleTestCase extends AbstractRestrictBackgroundNetwork
|
||||
assertAppIdle(false); // Sanity check - not idle anymore, since whitelisted
|
||||
assertBackgroundNetworkAccess(true);
|
||||
|
||||
setAppIdleNoAssert(true);
|
||||
assertAppIdle(false); // app is still whitelisted
|
||||
removePowerSaveModeWhitelist(TEST_APP2_PKG);
|
||||
assertAppIdle(true); // Sanity check - idle again, once whitelisted was removed
|
||||
assertBackgroundNetworkAccess(false);
|
||||
|
||||
setAppIdle(true);
|
||||
addPowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
|
||||
assertAppIdle(false); // Sanity check - not idle anymore, since whitelisted
|
||||
assertBackgroundNetworkAccess(true);
|
||||
|
||||
setAppIdleNoAssert(true);
|
||||
assertAppIdle(false); // app is still whitelisted
|
||||
removePowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
|
||||
assertAppIdle(true); // Sanity check - idle again, once whitelisted was removed
|
||||
assertBackgroundNetworkAccess(false);
|
||||
|
||||
@@ -662,6 +662,11 @@ public abstract class AbstractRestrictBackgroundNetworkTestCase {
|
||||
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 {
|
||||
try {
|
||||
assertDelayedShellCommand("am get-inactive " + TEST_APP2_PKG, 15, 2, "Idle=" + enabled);
|
||||
|
||||
Reference in New Issue
Block a user