diff --git a/tests/cts/hostside/app/src/com/android/cts/net/hostside/AbstractDozeModeTestCase.java b/tests/cts/hostside/app/src/com/android/cts/net/hostside/AbstractDozeModeTestCase.java index c2dce38035..f20f1d1c4d 100644 --- a/tests/cts/hostside/app/src/com/android/cts/net/hostside/AbstractDozeModeTestCase.java +++ b/tests/cts/hostside/app/src/com/android/cts/net/hostside/AbstractDozeModeTestCase.java @@ -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 { 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 1c46396903..ce56d25440 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 @@ -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; @@ -476,6 +477,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 + "'");