Merge "Foreground Service Location tests"

This commit is contained in:
Amith Yamasani
2019-01-29 20:07:13 +00:00
committed by Android (Google) Code Review

View File

@@ -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);