Update threshold state used for deciding if the app is in foreground.

This is needed because fg service and bound fg service states are
swapped.

Bug: 70808931
Bug: 71758358
Bug: 71864947
Test: atest com.android.server.am.ActivityManagerServiceTest
Test: cts-tradefed run singleCommand cts-dev -m CtsHostsideNetworkTests -t \
      com.android.cts.net.HostsideRestrictBackgroundNetworkTests

Change-Id: I961b6c048d6d40580ca77603d05197d7294eca9d
This commit is contained in:
Sudheer Shanka
2018-01-11 12:05:08 -08:00
parent fc12cc51d3
commit 74aec8482a

View File

@@ -29,7 +29,6 @@ import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiInfo;
import android.os.RemoteException;
import android.os.UserHandle;
import android.telephony.SubscriptionPlan;
import android.util.DebugUtils;
import android.util.Pair;
@@ -329,7 +328,7 @@ public class NetworkPolicyManager {
* to access network when the device is idle or in battery saver mode. Otherwise, false.
*/
public static boolean isProcStateAllowedWhileIdleOrPowerSaveMode(int procState) {
return procState <= ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE;
return procState <= ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE;
}
/**
@@ -337,7 +336,7 @@ public class NetworkPolicyManager {
* to access network when the device is in data saver mode. Otherwise, false.
*/
public static boolean isProcStateAllowedWhileOnRestrictBackground(int procState) {
return procState <= ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE;
return procState <= ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE;
}
public static String resolveNetworkId(WifiConfiguration config) {