Hiding Always-on VPN and Trusted CA Certs if FEATURE_MANAGE_USERS is not supported.

Bug: 66244245
Change-Id: Iade6add9df604927dfa29f79e1aa7e00a538069d
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/EnterprisePrivacyTestListActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/EnterprisePrivacyTestListActivity.java
index a4adfda..71c4421 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/EnterprisePrivacyTestListActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/EnterprisePrivacyTestListActivity.java
@@ -209,20 +209,24 @@
                         new ButtonInfo(R.string.enterprise_privacy_finish,
                                 buildCommandIntent(
                                         CommandReceiverActivity.COMMAND_CLEAR_ALWAYS_ON_VPN))}));
-        adapter.add(createInteractiveTestItem(this, ENTERPRISE_PRIVACY_COMP_ALWAYS_ON_VPN,
-                R.string.enterprise_privacy_comp_always_on_vpn,
-                R.string.enterprise_privacy_comp_always_on_vpn_info,
-                new ButtonInfo[] {
-                        new ButtonInfo(R.string.enterprise_privacy_start,
-                                buildCommandIntent(
-                                        CommandReceiverActivity.COMMAND_CREATE_MANAGED_PROFILE)),
-                        new ButtonInfo(R.string.enterprise_privacy_open_settings,
-                                new Intent(Settings.ACTION_ENTERPRISE_PRIVACY_SETTINGS)),
-                        new ButtonInfo(R.string.enterprise_privacy_set_always_on_vpn,
-                                new Intent(CompHelperActivity.ACTION_SET_ALWAYS_ON_VPN)),
-                        new ButtonInfo(R.string.enterprise_privacy_finish,
-                                buildCommandIntent(
-                                        CommandReceiverActivity.COMMAND_REMOVE_MANAGED_PROFILE))}));
+        if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_MANAGED_USERS)) {
+            adapter.add(createInteractiveTestItem(this, ENTERPRISE_PRIVACY_COMP_ALWAYS_ON_VPN,
+                    R.string.enterprise_privacy_comp_always_on_vpn,
+                    R.string.enterprise_privacy_comp_always_on_vpn_info,
+                    new ButtonInfo[] {
+                            new ButtonInfo(R.string.enterprise_privacy_start,
+                                    buildCommandIntent(
+                                            CommandReceiverActivity.
+                                            COMMAND_CREATE_MANAGED_PROFILE)),
+                            new ButtonInfo(R.string.enterprise_privacy_open_settings,
+                                    new Intent(Settings.ACTION_ENTERPRISE_PRIVACY_SETTINGS)),
+                            new ButtonInfo(R.string.enterprise_privacy_set_always_on_vpn,
+                                    new Intent(CompHelperActivity.ACTION_SET_ALWAYS_ON_VPN)),
+                            new ButtonInfo(R.string.enterprise_privacy_finish,
+                                    buildCommandIntent(
+                                            CommandReceiverActivity.
+                                            COMMAND_REMOVE_MANAGED_PROFILE))}));
+        }
         adapter.add(createInteractiveTestItem(this, ENTERPRISE_PRIVACY_GLOBAL_HTTP_PROXY,
                 R.string.enterprise_privacy_global_http_proxy,
                 R.string.enterprise_privacy_global_http_proxy_info,
@@ -247,20 +251,24 @@
                         new ButtonInfo(R.string.enterprise_privacy_finish,
                                 buildCommandIntent(
                                         CommandReceiverActivity.COMMAND_CLEAR_CA_CERT))}));
-        adapter.add(createInteractiveTestItem(this, ENTERPRISE_PRIVACY_COMP_CA_CERTS,
-                R.string.enterprise_privacy_comp_ca_certs,
-                R.string.enterprise_privacy_comp_ca_certs_info,
-                new ButtonInfo[] {
-                        new ButtonInfo(R.string.enterprise_privacy_start,
-                                buildCommandIntent(
-                                        CommandReceiverActivity.COMMAND_CREATE_MANAGED_PROFILE)),
-                        new ButtonInfo(R.string.enterprise_privacy_settings,
-                                new Intent(Settings.ACTION_ENTERPRISE_PRIVACY_SETTINGS)),
-                        new ButtonInfo(R.string.enterprise_privacy_install_cert,
-                                new Intent(CompHelperActivity.ACTION_INSTALL_CA_CERT)),
-                        new ButtonInfo(R.string.enterprise_privacy_finish,
-                                buildCommandIntent(
-                                        CommandReceiverActivity.COMMAND_REMOVE_MANAGED_PROFILE))}));
+        if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_MANAGED_USERS)) {
+            adapter.add(createInteractiveTestItem(this, ENTERPRISE_PRIVACY_COMP_CA_CERTS,
+                    R.string.enterprise_privacy_comp_ca_certs,
+                    R.string.enterprise_privacy_comp_ca_certs_info,
+                    new ButtonInfo[] {
+                            new ButtonInfo(R.string.enterprise_privacy_start,
+                                    buildCommandIntent(
+                                            CommandReceiverActivity.
+                                            COMMAND_CREATE_MANAGED_PROFILE)),
+                            new ButtonInfo(R.string.enterprise_privacy_settings,
+                                    new Intent(Settings.ACTION_ENTERPRISE_PRIVACY_SETTINGS)),
+                            new ButtonInfo(R.string.enterprise_privacy_install_cert,
+                                    new Intent(CompHelperActivity.ACTION_INSTALL_CA_CERT)),
+                            new ButtonInfo(R.string.enterprise_privacy_finish,
+                                    buildCommandIntent(
+                                            CommandReceiverActivity.
+                                            COMMAND_REMOVE_MANAGED_PROFILE))}));
+        }
         // Disabled for API 26 due to b/63696536.
         // adapter.add(createInteractiveTestItem(this, ENTERPRISE_PRIVACY_FAILED_PASSWORD_WIPE,
         //         R.string.enterprise_privacy_failed_password_wipe,