am 85e51ae6: Merge "Cts tests for Settings intents" into lmp-mr1-dev

* commit '85e51ae6902a825a7875a4f1ae3077d3fa7f2db8':
  Cts tests for Settings intents
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/SettingsIntentsTest.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/SettingsIntentsTest.java
new file mode 100644
index 0000000..e68cb48
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/SettingsIntentsTest.java
@@ -0,0 +1,75 @@
+/*
+ * 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 com.android.cts.managedprofile;
+
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.test.ActivityInstrumentationTestCase2;
+import android.provider.Settings;
+
+
+/**
+ * Tests that make sure that some core application intents as described in Compatibility Definition
+ * Document are handled within a managed profile.
+ * Note that OEMs can replace the Settings apps, so we we can at most check if the intent resolves.
+ */
+public class SettingsIntentsTest extends ActivityInstrumentationTestCase2<TestActivity> {
+
+    private PackageManager mPackageManager;
+
+    public SettingsIntentsTest() {
+        super(TestActivity.class);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mPackageManager = getActivity().getPackageManager();
+    }
+
+    public void testSettings() {
+        assertNotNull(mPackageManager.resolveActivity(
+                new Intent(Settings.ACTION_SETTINGS), 0 /* flags */));
+    }
+
+    public void testAccounts() {
+        assertNotNull(mPackageManager.resolveActivity(
+                new Intent(Settings.ACTION_SYNC_SETTINGS), 0 /* flags */));
+    }
+
+    public void testApps() {
+        assertNotNull(mPackageManager.resolveActivity(
+                new Intent(Settings.ACTION_APPLICATION_SETTINGS), 0 /* flags */));
+    }
+
+    public void testSecurity() {
+        // This leads to device administrators, screenlock etc.
+        assertNotNull(mPackageManager.resolveActivity(
+                new Intent(Settings.ACTION_SECURITY_SETTINGS), 0 /* flags */));
+    }
+
+    public void testNfc() {
+        if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_NFC)) {
+            assertNotNull(mPackageManager.resolveActivity(
+                    new Intent(Settings.ACTION_NFC_SETTINGS), 0 /* flags */));
+        }
+    }
+
+    public void testLocation() {
+        assertNotNull(mPackageManager.resolveActivity(
+                new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS), 0 /* flags */));
+    }
+}
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
index 2e2dab8..d829314 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
@@ -110,7 +110,14 @@
               + getDevice().executeShellCommand(command));
         assertTrue(runDeviceTests(MANAGED_PROFILE_PKG, MANAGED_PROFILE_PKG + ".PrimaryUserTest"));
         // TODO: Test with startActivity
-        // TODO: Test with CtsVerifier for disambiguation cases
+    }
+
+    public void testSettingsIntents() throws Exception {
+        if (!mHasFeature) {
+            return;
+        }
+
+        assertTrue(runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".SettingsIntentsTest", mUserId));
     }
 
     public void testCrossProfileContent() throws Exception {