Merge "Make sure app_idle_constants is set during setup." into qt-dev

This commit is contained in:
Hui Yu
2019-05-02 22:51:17 +00:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 2 deletions

View File

@@ -153,7 +153,14 @@ abstract class AbstractRestrictBackgroundNetworkTestCase extends Instrumentation
Log.i(TAG, "Apps status on " + getName() + ":\n" Log.i(TAG, "Apps status on " + getName() + ":\n"
+ "\ttest app: uid=" + mMyUid + ", state=" + getProcessStateByUid(mMyUid) + "\n" + "\ttest app: uid=" + mMyUid + ", state=" + getProcessStateByUid(mMyUid) + "\n"
+ "\tapp2: uid=" + mUid + ", state=" + getProcessStateByUid(mUid)); + "\tapp2: uid=" + mUid + ", state=" + getProcessStateByUid(mUid));
executeShellCommand("settings get global app_idle_constants");
// app_idle_constants set in NetPolicyTestsPreparer.setUp() is not always sucessful (suspect
// timing issue), here we set it again to make sure.
final String appIdleConstants = "parole_duration=0,stable_charging_threshold=0";
executeShellCommand("settings put global app_idle_constants " + appIdleConstants);
final String currentConstants =
executeShellCommand("settings get global app_idle_constants");
assertEquals(appIdleConstants, currentConstants);
} }
@Override @Override

View File

@@ -48,7 +48,7 @@ public class NetPolicyTestsPreparer implements ITargetPreparer, ITargetCleaner {
} }
private void setAppIdleConstants(String appIdleConstants) throws DeviceNotAvailableException { private void setAppIdleConstants(String appIdleConstants) throws DeviceNotAvailableException {
executeCmd("settings put global app_idle_constants " + appIdleConstants); executeCmd("settings put global app_idle_constants \"" + appIdleConstants + "\"");
} }
private String getAppIdleConstants() throws DeviceNotAvailableException { private String getAppIdleConstants() throws DeviceNotAvailableException {