OSDN Git Service

Add EnterprisePrivacySettings as injectable category
authorAlex Chau <alexchau@google.com>
Mon, 3 Dec 2018 16:21:03 +0000 (16:21 +0000)
committerAlex Chau <alexchau@google.com>
Mon, 3 Dec 2018 21:31:25 +0000 (21:31 +0000)
- Also add order for EnterprisePrivacySettings manifest

Bug: 120414731
Test: make RunSettingsRoboTests ROBOTEST_FILTER=DashboardFragmentRegistryTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=EnterprisePrivacySettingsTest
Change-Id: I30b555873aad66aa1432ae8ebb11417ddf237a07

res/xml/enterprise_privacy_settings.xml
src/com/android/settings/dashboard/DashboardFragmentRegistry.java
tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacySettingsTest.java

index 4fa50e7..e8b26b0 100644 (file)
 
     <!-- Header -->
     <Preference android:key="enterprise_privacy_header"
+                android:order="100"
                 android:icon="@drawable/ic_info_outline_24dp"
                 android:summary="@string/enterprise_privacy_header"
                 android:selectable="false"/>
 
     <PreferenceCategory android:key="exposure_category"
+                        android:order="200"
                         android:title="@string/enterprise_privacy_exposure_category"
                         android:contentDescription="@string/enterprise_privacy_exposure_category">
         <Preference android:key="enterprise_privacy_enterprise_data"
+                    android:order="210"
                     android:layout_height="wrap_content"
                     android:title="@string/enterprise_privacy_enterprise_data"
                     android:selectable="false"/>
         <Preference android:key="enterprise_privacy_installed_packages"
+                    android:order="220"
                     android:title="@string/enterprise_privacy_installed_packages"
                     android:selectable="false"/>
         <Preference android:key="enterprise_privacy_usage_stats"
+                    android:order="230"
                     android:title="@string/enterprise_privacy_usage_stats"
                     android:selectable="false"/>
         <Preference android:key="network_logs"
+                    android:order="240"
                     android:title="@string/enterprise_privacy_network_logs"
                     android:selectable="false"/>
         <Preference android:key="bug_reports"
+                    android:order="250"
                     android:title="@string/enterprise_privacy_bug_reports"
                     android:selectable="false"/>
         <Preference android:key="security_logs"
+                    android:order="260"
                     android:title="@string/enterprise_privacy_security_logs"
                     android:selectable="false"/>
     </PreferenceCategory>
 
     <PreferenceCategory android:title="@string/enterprise_privacy_exposure_changes_category"
+                        android:order="300"
                         android:key="exposure_changes_category">
         <Preference android:fragment="com.android.settings.enterprise.ApplicationListFragment$EnterpriseInstalledPackages"
+                    android:order="310"
                     android:key="number_enterprise_installed_packages"
                     android:title="@string/enterprise_privacy_enterprise_installed_packages"/>
         <Preference android:fragment="com.android.settings.enterprise.ApplicationListFragment$AdminGrantedPermissionLocation"
+                    android:order="320"
                     android:key="enterprise_privacy_number_location_access_packages"
                     android:title="@string/enterprise_privacy_location_access"/>
         <Preference android:fragment="com.android.settings.enterprise.ApplicationListFragment$AdminGrantedPermissionMicrophone"
+                    android:order="330"
                     android:key="enterprise_privacy_number_microphone_access_packages"
                     android:title="@string/enterprise_privacy_microphone_access"/>
         <Preference android:fragment="com.android.settings.enterprise.ApplicationListFragment$AdminGrantedPermissionCamera"
+                    android:order="340"
                     android:key="enterprise_privacy_number_camera_access_packages"
                     android:title="@string/enterprise_privacy_camera_access"/>
         <Preference android:fragment="com.android.settings.enterprise.EnterpriseSetDefaultAppsListFragment"
+                    android:order="350"
                     android:key="number_enterprise_set_default_apps"
                     android:title="@string/enterprise_privacy_enterprise_set_default_apps"/>
         <Preference android:key="always_on_vpn_primary_user"
+                    android:order="360"
                     android:selectable="false"/>
         <Preference android:key="always_on_vpn_managed_profile"
+                    android:order="370"
                     android:title="@string/enterprise_privacy_always_on_vpn_work"
                     android:selectable="false"/>
         <Preference android:key="input_method"
+                    android:order="380"
                     android:title="@string/enterprise_privacy_input_method"
                     android:selectable="false"/>
         <Preference android:key="global_http_proxy"
+                    android:order="390"
                     android:title="@string/enterprise_privacy_global_http_proxy"
                     android:selectable="false"/>
         <Preference android:key="ca_certs_current_user"
+                    android:order="400"
                     android:title="@string/enterprise_privacy_ca_certs_personal"
                     android:selectable="false"/>
         <Preference android:key="ca_certs_managed_profile"
+                    android:order="410"
                     android:title="@string/enterprise_privacy_ca_certs_work"
                     android:selectable="false"/>
     </PreferenceCategory>
 
     <PreferenceCategory android:key="device_access_category"
+                        android:order="500"
                         android:title="@string/enterprise_privacy_device_access_category">
         <Preference android:key="enterprise_privacy_lock_device"
+                    android:order="510"
                     android:title="@string/enterprise_privacy_lock_device"
                     android:selectable="false"/>
         <Preference android:key="enterprise_privacy_wipe_device"
+                    android:order="520"
                     android:title="@string/enterprise_privacy_wipe_device"
                     android:selectable="false"/>
         <Preference android:key="failed_password_wipe_current_user"
+                    android:order="530"
                     android:title="@string/enterprise_privacy_failed_password_wipe_device"
                     android:selectable="false"/>
         <Preference android:key="failed_password_wipe_managed_profile"
+                    android:order="540"
                     android:title="@string/enterprise_privacy_failed_password_wipe_work"
                     android:selectable="false"/>
     </PreferenceCategory>
index 8b5d521..2f447d4 100644 (file)
@@ -28,6 +28,7 @@ import com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment;
 import com.android.settings.development.DevelopmentSettingsDashboardFragment;
 import com.android.settings.deviceinfo.StorageDashboardFragment;
 import com.android.settings.display.NightDisplaySettings;
+import com.android.settings.enterprise.EnterprisePrivacySettings;
 import com.android.settings.fuelgauge.PowerUsageSummary;
 import com.android.settings.gestures.GestureSettings;
 import com.android.settings.homepage.TopLevelSettings;
@@ -107,6 +108,8 @@ public class DashboardFragmentRegistry {
                 CategoryKey.CATEGORY_NIGHT_DISPLAY);
         PARENT_TO_CATEGORY_KEY_MAP.put(PrivacyDashboardFragment.class.getName(),
                 CategoryKey.CATEGORY_PRIVACY);
+        PARENT_TO_CATEGORY_KEY_MAP.put(EnterprisePrivacySettings.class.getName(),
+                CategoryKey.CATEGORY_ENTERPRISE_PRIVACY);
 
         CATEGORY_KEY_TO_PARENT_MAP = new ArrayMap<>(PARENT_TO_CATEGORY_KEY_MAP.size());
 
index f1d03c7..f7a61c8 100644 (file)
@@ -28,6 +28,7 @@ import com.android.settings.testutils.FakeFeatureFactory;
 import com.android.settings.testutils.SettingsRobolectricTestRunner;
 import com.android.settings.widget.PreferenceCategoryController;
 import com.android.settingslib.core.AbstractPreferenceController;
+import com.android.settingslib.drawer.CategoryKey;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -59,7 +60,7 @@ public class EnterprisePrivacySettingsTest {
         assertThat(mSettings.getMetricsCategory())
                 .isEqualTo(MetricsEvent.ENTERPRISE_PRIVACY_SETTINGS);
         assertThat(mSettings.getLogTag()).isEqualTo("EnterprisePrivacySettings");
-        assertThat(mSettings.getCategoryKey()).isNull();
+        assertThat(mSettings.getCategoryKey()).isEqualTo(CategoryKey.CATEGORY_ENTERPRISE_PRIVACY);
         assertThat(mSettings.getPreferenceScreenResId())
                 .isEqualTo(R.xml.enterprise_privacy_settings);
     }