Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 74aec848 authored by Sudheer Shanka's avatar Sudheer Shanka
Browse files

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
parent fc12cc51
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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) {