Don't update app idle rules on updateRulesForRestrictPowerUL().
updateRulesForRestrictPowerUL() should only affect the global rules (Doze and Battery Saver), while app idle is an app-specific rule. Such call was delaying setDeviceIdle() in O(100ms). BUG: 31281543 Test: cts-tradefed run commandAndExit cts -m CtsHostsideNetworkTests -t com.android.cts.net.HostsideRestrictBackgroundNetworkTests#testAppIdleNonMetered_enabled Test: cts-tradefed run commandAndExit cts -m CtsHostsideNetworkTests -t com.android.cts.net.HostsideRestrictBackgroundNetworkTests#testAppIdleNonMetered_whitelisted Test: cts-tradefed run commandAndExit cts -m CtsHostsideNetworkTests -t com.android.cts.net.HostsideRestrictBackgroundNetworkTests#testAppIdleNonMetered_blacklisted Test: cts-tradefed run commandAndExit cts -m CtsHostsideNetworkTests -t com.android.cts.net.HostsideRestrictBackgroundNetworkTests#testAppIdleMetered_enabled Test: cts-tradefed run commandAndExit cts -m CtsHostsideNetworkTests -t com.android.cts.net.HostsideRestrictBackgroundNetworkTests#testAppIdleMetered_whitelisted Test: cts-tradefed run commandAndExit cts -m CtsHostsideNetworkTests -t com.android.cts.net.HostsideRestrictBackgroundNetworkTests#testAppIdleMetered_disabled Change-Id: I32ad6853a6d88e2709538d00cd1e77b96d331b2d
This commit is contained in:
@@ -715,6 +715,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
|
||||
synchronized (mUidRulesFirstLock) {
|
||||
updatePowerSaveWhitelistUL();
|
||||
updateRulesForRestrictPowerUL();
|
||||
updateRulesForAppIdleUL();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -2731,6 +2732,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
|
||||
private void updateRulesForGlobalChangeAL(boolean restrictedNetworksChanged) {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_NETWORK, "updateRulesForGlobalChangeAL");
|
||||
try {
|
||||
updateRulesForAppIdleUL();
|
||||
updateRulesForRestrictPowerUL();
|
||||
updateRulesForRestrictBackgroundUL();
|
||||
|
||||
@@ -2744,11 +2746,11 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: rename / document to make it clear these are global (not app-specific) rules
|
||||
private void updateRulesForRestrictPowerUL() {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_NETWORK, "updateRulesForRestrictPowerUL");
|
||||
try {
|
||||
updateRulesForDeviceIdleUL();
|
||||
updateRulesForAppIdleUL();
|
||||
updateRulesForPowerSaveUL();
|
||||
updateRulesForAllAppsUL(TYPE_RESTRICT_POWER);
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user