Merge "Skip unsupported tests on low ram devices." into stage-aosp-oc-mr1-cts-dev am: e352866bee am: dfc9fb0901

am: 87c8dbbc39

Change-Id: Ie190f774998de77843b8af9ef25bbfef615c66bb
This commit is contained in:
Sudheer Shanka
2018-01-03 20:42:05 +00:00
committed by android-build-merger
2 changed files with 8 additions and 1 deletions

View File

@@ -129,7 +129,7 @@ abstract class AbstractDozeModeTestCase extends AbstractRestrictBackgroundNetwor
public void testBackgroundNetworkAccess_enabledButWhitelistedOnNotificationAction()
throws Exception {
if (!isSupported()) return;
if (!isSupported() || isLowRamDevice()) return;
setPendingIntentWhitelistDuration(NETWORK_TIMEOUT_MS);
try {

View File

@@ -26,6 +26,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import android.app.ActivityManager;
import android.app.Instrumentation;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
@@ -479,6 +480,12 @@ abstract class AbstractRestrictBackgroundNetworkTestCase extends Instrumentation
return errors.toString();
}
protected boolean isLowRamDevice() {
final ActivityManager am = (ActivityManager) mContext.getSystemService(
Context.ACTIVITY_SERVICE);
return am.isLowRamDevice();
}
protected String executeShellCommand(String command) throws Exception {
final String result = runShellCommand(mInstrumentation, command).trim();
if (DEBUG) Log.d(TAG, "Command '" + command + "' returned '" + result + "'");