Add android.cts.device.lowram for libcore tests.
Some tests for libcore need to be disabled on low-ram devices. They
don't have access to ActivityManager or Android system properties, so
this forwards the result of ActivityManager.isLowRamDevice() into
System.setProperties.
Bug: 32004484
Change-Id: I598b7d6f456ccfb7639bbdef22f2dfbbe394165a
diff --git a/tests/core/runner/src/com/android/cts/runner/CtsTestRunListener.java b/tests/core/runner/src/com/android/cts/runner/CtsTestRunListener.java
index 57dc7c6..1f9a939 100644
--- a/tests/core/runner/src/com/android/cts/runner/CtsTestRunListener.java
+++ b/tests/core/runner/src/com/android/cts/runner/CtsTestRunListener.java
@@ -16,6 +16,7 @@
package com.android.cts.runner;
+import android.app.ActivityManager;
import android.app.Instrumentation;
import android.app.KeyguardManager;
import android.content.Context;
@@ -219,6 +220,13 @@
mProperties.setProperty("android.cts.device.multicast",
Boolean.toString(pm.hasSystemFeature(PackageManager.FEATURE_WIFI)));
mDefaultIs24Hour = getDateFormatIs24Hour();
+
+ // There are tests in libcore that should be disabled for low ram devices. They can't
+ // access ActivityManager to call isLowRamDevice, but can read system properties.
+ ActivityManager activityManager =
+ (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+ mProperties.setProperty("android.cts.device.lowram",
+ Boolean.toString(activityManager.isLowRamDevice()));
}
void reset() {