Test for no MANAGED_USERS feature on low RAM devices
Bug:17396254
Change-Id: Ifd4773f58ea7c685e79a5f09909d5ba3106e8a6a
diff --git a/tests/tests/content/src/android/content/pm/cts/FeatureTest.java b/tests/tests/content/src/android/content/pm/cts/FeatureTest.java
new file mode 100644
index 0000000..19bf128
--- /dev/null
+++ b/tests/tests/content/src/android/content/pm/cts/FeatureTest.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+package android.content.pm.cts;
+
+import android.app.ActivityManager;
+import android.content.Context;
+import android.content.pm.FeatureGroupInfo;
+import android.content.pm.FeatureInfo;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.test.AndroidTestCase;
+import android.util.Log;
+
+import java.util.Arrays;
+import java.util.Comparator;
+
+public class FeatureTest extends AndroidTestCase {
+
+ private static final String TAG = "FeatureTest";
+
+ private PackageManager mPackageManager;
+ private ActivityManager mActivityManager;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mPackageManager = getContext().getPackageManager();
+ mActivityManager = (ActivityManager)getContext().getSystemService(Context.ACTIVITY_SERVICE);
+ }
+
+ public void testNoManagedUsersIfLowRamDevice() {
+ if (mPackageManager == null || mActivityManager == null) {
+ Log.w(TAG, "Skipping testNoManagedUsersIfLowRamDevice");
+ return;
+ }
+ if (mActivityManager.isLowRamDevice()) {
+ assertFalse(mPackageManager.hasSystemFeature(PackageManager.FEATURE_MANAGED_USERS));
+ }
+ }
+}