CTS: PO tests for DISALLOW_CONFIG_VPN

Adding test case for DISALLOW_CONFIG_VPN on managed profiles

Bug: 18928269
Change-Id: I406a82628519a0ae063e8669df46c6367a68ef89
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index a93334e..43a469c 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -1382,6 +1382,10 @@
 
         <activity android:name=".managedprovisioning.VpnTestActivity"
                 android:label="@string/device_owner_vpn_test">
+            <intent-filter>
+                <action android:name="com.android.cts.verifier.managedprovisioning.VPN" />
+                <category android:name="android.intent.category.DEFAULT"></category>
+            </intent-filter>
         </activity>
 
         <service android:name=".managedprovisioning.VpnTestActivity$MyTestVpnService"
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 20fa197..e346bb8 100644
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -1294,6 +1294,7 @@
     <string name="provisioning_byod_auth_bound_key_set_up">Set up</string>
     <string name="provisioning_byod_lockscreen_bound_key">Lockscreen-bound key test</string>
     <string name="provisioning_byod_fingerprint_bound_key">Fingerprint-bound key test</string>
+    <string name="provisioning_byod_vpn">Vpn test</string>
     <!-- Strings for DeskClock -->
     <string name="deskclock_tests">Alarms and Timers Tests</string>
     <string name="deskclock_tests_info">
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodFlowTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodFlowTestActivity.java
index 2df6407..509408d 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodFlowTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodFlowTestActivity.java
@@ -84,6 +84,7 @@
     private TestListItem mAuthenticationBoundKeyTest;
     private DialogTestListItem mEnableLocationModeTest;
     private DialogTestListItem mDisableLocationModeTest;
+    private TestListItem mVpnTest;
 
     public ByodFlowTestActivity() {
         super(R.layout.provisioning_byod,
@@ -303,6 +304,12 @@
                 new Intent(AuthenticationBoundKeyTestActivity.ACTION_AUTH_BOUND_KEY_TEST),
                 null);
 
+        mVpnTest = TestListItem.newTest(this,
+                R.string.provisioning_byod_vpn,
+                VpnTestActivity.class.getName(),
+                new Intent(VpnTestActivity.ACTION_VPN),
+                null);
+
         // Test for checking if the required intent filters are set during managed provisioning.
         mIntentFiltersTest = new DialogTestListItem(this,
                 R.string.provisioning_byod_cross_profile_intent_filters,
@@ -348,6 +355,7 @@
         adapter.add(mPermissionLockdownTest);
         adapter.add(mKeyguardDisabledFeaturesTest);
         adapter.add(mAuthenticationBoundKeyTest);
+        adapter.add(mVpnTest);
 
         /* If there is an application that handles ACTION_IMAGE_CAPTURE, test that it handles it
          * well.
@@ -552,7 +560,8 @@
             WorkNotificationTestActivity.class.getName(),
             WorkStatusTestActivity.class.getName(),
             PermissionLockdownTestActivity.ACTIVITY_ALIAS,
-            AuthenticationBoundKeyTestActivity.class.getName()
+            AuthenticationBoundKeyTestActivity.class.getName(),
+            VpnTestActivity.class.getName()
         };
         for (String component : components) {
             getPackageManager().setComponentEnabledSetting(new ComponentName(this, component),
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceAdminTestReceiver.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceAdminTestReceiver.java
index db3c58c..05c9384 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceAdminTestReceiver.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceAdminTestReceiver.java
@@ -77,6 +77,7 @@
                     PermissionLockdownTestActivity.ACTION_MANAGED_PROFILE_CHECK_PERMISSION_LOCKDOWN);
             filter.addAction(AuthenticationBoundKeyTestActivity.ACTION_AUTH_BOUND_KEY_TEST);
             filter.addAction(ByodHelperActivity.ACTION_SET_LOCATION_AND_CHECK_UPDATES);
+            filter.addAction(VpnTestActivity.ACTION_VPN);
             dpm.addCrossProfileIntentFilter(getWho(context), filter,
                     DevicePolicyManager.FLAG_MANAGED_CAN_ACCESS_PARENT);
 
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/VpnTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/VpnTestActivity.java
index efe52e6..49c0c20 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/VpnTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/VpnTestActivity.java
@@ -42,6 +42,8 @@
  */
 public class VpnTestActivity extends PassFailButtons.Activity {
 
+    public static final String ACTION_VPN = "com.android.cts.verifier.managedprovisioning.VPN";
+
     public static class MyTestVpnService extends VpnService {
         /*
          * MyVpnTestService is just a stub. This class exists because the framework needs a class