diff --git a/tests/cts/hostside/app/src/com/android/cts/net/hostside/AbstractRestrictBackgroundNetworkTestCase.java b/tests/cts/hostside/app/src/com/android/cts/net/hostside/AbstractRestrictBackgroundNetworkTestCase.java index ec5a877757..c6e80a22a8 100644 --- a/tests/cts/hostside/app/src/com/android/cts/net/hostside/AbstractRestrictBackgroundNetworkTestCase.java +++ b/tests/cts/hostside/app/src/com/android/cts/net/hostside/AbstractRestrictBackgroundNetworkTestCase.java @@ -92,7 +92,8 @@ abstract class AbstractRestrictBackgroundNetworkTestCase extends Instrumentation private static final String NETWORK_STATUS_SEPARATOR = "\\|"; private static final int SECOND_IN_MS = 1000; static final int NETWORK_TIMEOUT_MS = 15 * SECOND_IN_MS; - private static final int PROCESS_STATE_FOREGROUND_SERVICE = 3; + private static int PROCESS_STATE_FOREGROUND_SERVICE; + private static final int PROCESS_STATE_TOP = 2; private static final String KEY_NETWORK_STATE_OBSERVER = TEST_PKG + ".observer"; @@ -131,6 +132,8 @@ abstract class AbstractRestrictBackgroundNetworkTestCase extends Instrumentation protected void setUp() throws Exception { super.setUp(); + PROCESS_STATE_FOREGROUND_SERVICE = (Integer) ActivityManager.class + .getDeclaredField("PROCESS_STATE_FOREGROUND_SERVICE").get(null); mInstrumentation = getInstrumentation(); mContext = mInstrumentation.getContext(); mCm = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);