Update layout and strings for DO Disclosures
This CL updates the DO Disclosures page (aka "Enterprise Privacy") to incorporate UI layout and string changes proposed since implementation began. There are no logic changes. Test: make RunSettingsRoboTests Bug: 32692748 Change-Id: I6ae972e77bd90eb9c61d6a516046a6eb09981ad3
This commit is contained in:
@@ -1506,19 +1506,13 @@
|
||||
</activity>
|
||||
|
||||
<activity android:name="Settings$EnterprisePrivacySettingsActivity"
|
||||
android:label="@string/enterprise_privacy_settings_title"
|
||||
android:icon="@drawable/ic_settings_about"
|
||||
android:taskAffinity="com.android.settings"
|
||||
android:parentActivityName="Settings">
|
||||
android:label="@string/enterprise_privacy_settings_title"
|
||||
android:taskAffinity="com.android.settings"
|
||||
android:parentActivityName="Settings$SecuritySettingsActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.settings.ENTERPRISE_PRIVACY_SETTINGS" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter android:priority="-1">
|
||||
<action android:name="com.android.settings.action.SETTINGS" />
|
||||
</intent-filter>
|
||||
<meta-data android:name="com.android.settings.category"
|
||||
android:value="com.android.settings.category.ia.system" />
|
||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||
android:value="com.android.settings.enterprise.EnterprisePrivacySettings" />
|
||||
</activity>
|
||||
|
@@ -8114,64 +8114,58 @@
|
||||
|
||||
<!-- Enterprise Privacy --> <skip />
|
||||
|
||||
<!-- Title of setting on main settings screen. This will take the user to a screen with information about his/her privacy on a managed device. Shown on enterprise-managed devices only. -->
|
||||
<string name="enterprise_privacy_settings">Privacy</string>
|
||||
<!-- Title of setting on security settings screen. This will take the user to a screen with information about admin powers and their impact on the user's privacy on a managed device. Shown on enterprise-managed devices only. -->
|
||||
<string name="enterprise_privacy_settings">Device management</string>
|
||||
<!-- Summary for Enterprise Privacy settings, explaining what the user can expect to find under it [CHAR LIMIT=NONE]-->
|
||||
<string name="enterprise_privacy_settings_summary">View all settings applied by your admin</string>
|
||||
<!-- Enterprise Privacy settings activity title -->
|
||||
<string name="enterprise_privacy_settings_title">Privacy</string>
|
||||
<!-- Enterprise Privacy settings activity header, summarizing the powers that the admin has. [CHAR LIMIT=NONE] -->
|
||||
<string name="enterprise_privacy_header">To provide access to your work data, your organization may change settings and install software on your device, which could cause some of your personal content to be visible to your admin. Contact your organization\'s admin for more details.</string>
|
||||
<!-- Title for the 'What types of information can your organization see?' preference category. [CHAR LIMIT=60] -->
|
||||
<string name="enterprise_privacy_exposure_category">What types of information can your organization see?</string>
|
||||
<!-- Title for the 'What changes affect what your organization can see?' preference category. [CHAR LIMIT=60] -->
|
||||
<string name="enterprise_privacy_exposure_changes_category">What changes affect what your organization can see?</string>
|
||||
<!-- Title for the 'What actions may impact your access to this device?' preference category. [CHAR LIMIT=60] -->
|
||||
<string name="enterprise_privacy_device_access_category">What actions may impact your access to this device?</string>
|
||||
<string name="enterprise_privacy_settings_title">Device management</string>
|
||||
<!-- Enterprise Privacy settings activity footer, summarizing the powers that the admin has. [CHAR LIMIT=NONE] -->
|
||||
<string name="enterprise_privacy_footer">To provide access to your work data, your organization may change settings and install software on your device. \n\nFor more details, contact your organization\'s admin.</string>
|
||||
<!-- Title for the 'Types of information your organization can see' preference category. [CHAR LIMIT=60] -->
|
||||
<string name="enterprise_privacy_exposure_category">Types of information your organization can see</string>
|
||||
<!-- Title for the 'Changes made by your organization’s admin' preference category. [CHAR LIMIT=60] -->
|
||||
<string name="enterprise_privacy_exposure_changes_category">Changes made by your organization\'s admin</string>
|
||||
<!-- Title for the 'Your access to this device' preference category. [CHAR LIMIT=60] -->
|
||||
<string name="enterprise_privacy_device_access_category">Your access to this device</string>
|
||||
<!-- Label explaining that the admin can see data associated with his/her work account. [CHAR LIMIT=NONE] -->
|
||||
<string name="enterprise_privacy_enterprise_data">Data associated with your work account, such as email and calendar</string>
|
||||
<!-- Label explaining that the admin can see all apps installed on the device. [CHAR LIMIT=NONE] -->
|
||||
<string name="enterprise_privacy_number_installed_packages_default">List of all apps on your device</string>
|
||||
<!-- Label explaining that the admin can see all apps installed on the device. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="enterprise_privacy_number_installed_packages">
|
||||
<item quantity="one">List of all <xliff:g id="count">%d</xliff:g> app on your device</item>
|
||||
<item quantity="other">List of all <xliff:g id="count">%d</xliff:g> apps on your device</item>
|
||||
<!-- Label explaining that the admin can see apps installed on the device. [CHAR LIMIT=NONE] -->
|
||||
<string name="enterprise_privacy_installed_packages">List of apps on your device</string>
|
||||
<!-- Summary indicating the number of apps that a label (e.g. installed apps or apps granted a particular permission) refers to. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="enterprise_privacy_number_packages">
|
||||
<item quantity="one"><xliff:g id="count">%d</xliff:g> app</item>
|
||||
<item quantity="other"><xliff:g id="count">%d</xliff:g> apps</item>
|
||||
</plurals>
|
||||
<!-- Summary indicating the number of apps that a label (e.g. installed apps or apps granted a particular permission) refers to. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="enterprise_privacy_number_packages_actionable">
|
||||
<item quantity="one"><xliff:g id="count">%d</xliff:g> app. Tap to view.</item>
|
||||
<item quantity="other"><xliff:g id="count">%d</xliff:g> apps. Tap to view.</item>
|
||||
</plurals>
|
||||
<!-- Label explaining that the admin can see app usage statistics. [CHAR LIMIT=NONE] -->
|
||||
<string name="enterprise_privacy_usage_stats">Usage (time spent and amount of data used) of each app on your device</string>
|
||||
<string name="enterprise_privacy_usage_stats">Time and data spent in each app on your device</string>
|
||||
<!-- Label explaining that the admin can retrieve network logs on the device. [CHAR LIMIT=NONE] -->
|
||||
<string name="enterprise_privacy_network_logs">Traffic logs on your device</string>
|
||||
<string name="enterprise_privacy_network_logs">Network traffic logs on your device</string>
|
||||
<!-- Label explaining that the admin can request bug reports on the device. [CHAR LIMIT=NONE] -->
|
||||
<string name="enterprise_privacy_bug_reports">Your most recent bug report</string>
|
||||
<string name="enterprise_privacy_bug_reports">Most recent bug report</string>
|
||||
<!-- Label explaining that the admin can retrieve security on from the device. [CHAR LIMIT=NONE] -->
|
||||
<string name="enterprise_privacy_security_logs">Your most recent security log</string>
|
||||
<!-- Label indicating that the date at which the admin last took a particular action was "never" (i.e. the admin never took the action so far). -->
|
||||
<string name="enterprise_privacy_never">Never</string>
|
||||
<!-- Label indicating how many apps were installed on the device by the admin. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="enterprise_privacy_number_enterprise_installed_packages">
|
||||
<item quantity="one"><xliff:g id="count">%d</xliff:g> app installed by your admin</item>
|
||||
<item quantity="other"><xliff:g id="count">%d</xliff:g> apps installed by your admin</item>
|
||||
</plurals>
|
||||
<!-- Label indicating how many apps were granted permission to access the device's location by the admin. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="enterprise_privacy_number_location_access_packages">
|
||||
<item quantity="one"><xliff:g id="count">%d</xliff:g> app allowed access to your location by your admin</item>
|
||||
<item quantity="other"><xliff:g id="count">%d</xliff:g> apps allowed access to your location by your admin</item>
|
||||
</plurals>
|
||||
<!-- Label indicating how many apps were granted permission to access the microphone by the admin. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="enterprise_privacy_number_microphone_access_packages">
|
||||
<item quantity="one"><xliff:g id="count">%d</xliff:g> app allowed access to your microphone by your admin</item>
|
||||
<item quantity="other"><xliff:g id="count">%d</xliff:g> apps allowed access to your microphone by your admin</item>
|
||||
</plurals>
|
||||
<!-- Label indicating how many apps were granted permission to access the camera by the admin. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="enterprise_privacy_number_camera_access_packages">
|
||||
<item quantity="one"><xliff:g id="count">%d</xliff:g> app allowed access to your camera by your admin</item>
|
||||
<item quantity="other"><xliff:g id="count">%d</xliff:g> apps allowed access to your camera by your admin</item>
|
||||
</plurals>
|
||||
<!-- Label indicating how many apps were set as default defaults for common actions (e.g. open browser, send e-mail) by the admin. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="enterprise_privacy_number_enterprise_set_default_apps">
|
||||
<item quantity="one"><xliff:g id="count">%d</xliff:g> default app set by your admin</item>
|
||||
<item quantity="other"><xliff:g id="count">%d</xliff:g> default apps set by your admin</item>
|
||||
</plurals>
|
||||
<string name="enterprise_privacy_security_logs">Most recent security log</string>
|
||||
<!-- Label indicating that the the admin never took a given action so far (e.g. did not retrieve security logs or request bug reports). -->
|
||||
<string name="enterprise_privacy_none">None</string>
|
||||
<!-- Label indicating that the admin installed one or more apps on the device. -->
|
||||
<string name="enterprise_privacy_enterprise_installed_packages">Apps installed</string>
|
||||
<!-- Label indicating that the admin granted one or more apps access to the device's location. [CHAR LIMIT=NONE] -->
|
||||
<string name="enterprise_privacy_location_access">Apps allowed to access your location</string>
|
||||
<!-- Label indicating that the admin granted one or more apps access to the microphone. [CHAR LIMIT=NONE] -->
|
||||
<string name="enterprise_privacy_microphone_access">Apps allowed to access your microphone</string>
|
||||
<!-- Label indicating that the admin granted one or more apps access to the camera. [CHAR LIMIT=NONE] -->
|
||||
<string name="enterprise_privacy_camera_access">Apps allowed to access your camera</string>
|
||||
<!-- Label indicating that the admin set one or more apps as defaults for common actions (e.g. open browser, send e-mail). [CHAR LIMIT=NONE] -->
|
||||
<string name="enterprise_privacy_enterprise_set_default_apps">Default apps set</string>
|
||||
<!-- Label explaining that the current input method was set by the admin. [CHAR LIMIT=NONE] -->
|
||||
<string name="enterprise_privacy_input_method">Default keyboard set to <xliff:g id="app_label" example="Example Keyboard">%s</xliff:g> by your admin</string>
|
||||
<string name="enterprise_privacy_input_method">Default keyboard</string>
|
||||
<!-- Summary indicating the input method set by the admin. [CHAR LIMIT=NONE] -->
|
||||
<string name="enterprise_privacy_input_method_name">Set to <xliff:g id="app_label" example="Example Keyboard">%s</xliff:g></string>
|
||||
<!-- Label explaining that an always-on VPN was set by the admin for the entire device. [CHAR LIMIT=NONE] -->
|
||||
<string name="enterprise_privacy_always_on_vpn_device">Always-on VPN turned on</string>
|
||||
<!-- Label explaining that an always-on VPN was set by the admin in the personal profile. [CHAR LIMIT=NONE] -->
|
||||
@@ -8182,35 +8176,44 @@
|
||||
<string name="enterprise_privacy_global_http_proxy">Global HTTP proxy set</string>
|
||||
<!-- Label explaining that the admin installed trusted CA certificates for the current user. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="enterprise_privacy_ca_certs_user">
|
||||
<item quantity="one"><xliff:g id="count">%d</xliff:g> trusted CA certificate installed</item>
|
||||
<item quantity="other"><xliff:g id="count">%d</xliff:g> trusted CA certificates installed</item>
|
||||
<item quantity="one">Trusted CA Certificate installed</item>
|
||||
<item quantity="other">Trusted CA Certificates installed</item>
|
||||
</plurals>
|
||||
<!-- Label explaining that the admin installed trusted CA certificates for the personal profile. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="enterprise_privacy_ca_certs_personal">
|
||||
<item quantity="one"><xliff:g id="count">%d</xliff:g> trusted CA certificate installed in the personal profile</item>
|
||||
<item quantity="other"><xliff:g id="count">%d</xliff:g> trusted CA certificates installed in the personal profile</item>
|
||||
<item quantity="one">Trusted CA Certificate installed in the personal profile</item>
|
||||
<item quantity="other">Trusted CA Certificates installed in the personal profile</item>
|
||||
</plurals>
|
||||
<!-- Summary indicating the number of trusted CA certificates installed by the admin. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="enterprise_privacy_number_ca_certs">
|
||||
<item quantity="one"><xliff:g id="count">%d</xliff:g> certificate</item>
|
||||
<item quantity="other"><xliff:g id="count">%d</xliff:g> certificates</item>
|
||||
</plurals>
|
||||
<!-- Summary indicating the number of trusted CA certificates installed by the admin. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="enterprise_privacy_number_ca_certs_actionable">
|
||||
<item quantity="one"><xliff:g id="count">%d</xliff:g> certificate. Tap to view.</item>
|
||||
<item quantity="other"><xliff:g id="count">%d</xliff:g> certificates. Tap to view.</item>
|
||||
</plurals>
|
||||
<!-- Label explaining that the admin installed trusted CA certificates for the work profile. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="enterprise_privacy_ca_certs_work">
|
||||
<item quantity="one"><xliff:g id="count">%d</xliff:g> trusted CA certificate installed in the work profile</item>
|
||||
<item quantity="other"><xliff:g id="count">%d</xliff:g> trusted CA certificates installed in the work profile</item>
|
||||
<item quantity="one">Trusted CA Certificate installed in the work profile</item>
|
||||
<item quantity="other">Trusted CA Certificates installed in the work profile</item>
|
||||
</plurals>
|
||||
<!-- Label explaining that the admin can lock the device and change the user's password. [CHAR LIMIT=NONE] -->
|
||||
<string name="enterprise_privacy_lock_device">Admin can lock device and reset password</string>
|
||||
<string name="enterprise_privacy_lock_device">Admin can lock the device and reset password</string>
|
||||
<!-- Label explaining that the admin can wipe the device remotely. [CHAR LIMIT=NONE] -->
|
||||
<string name="enterprise_privacy_wipe_device">Admin can delete all device data</string>
|
||||
<!-- Label explaining that the admin configured the device to wipe itself when the password is mistyped this many times. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="enterprise_privacy_failed_password_wipe_device">
|
||||
<item quantity="one">Admin set maximum password attempts to <xliff:g id="count">%d</xliff:g> before deleting all device data</item>
|
||||
<item quantity="other">Admin set maximum password attempts to <xliff:g id="count">%d</xliff:g> before deleting all device data</item>
|
||||
</plurals>
|
||||
<!-- Label explaining that the admin configured the work profile to wipe itself when the password is mistyped this many times. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="enterprise_privacy_failed_password_wipe_work">
|
||||
<item quantity="one">Admin set maximum password attempts to <xliff:g id="count">%d</xliff:g> before deleting work profile data</item>
|
||||
<item quantity="other">Admin set maximum password attempts to <xliff:g id="count">%d</xliff:g> before deleting work profile data</item>
|
||||
<!-- Label explaining that the admin configured the device to wipe itself when the password is mistyped too many times. [CHAR LIMIT=NONE] -->
|
||||
<string name="enterprise_privacy_failed_password_wipe_device">Failed password attempts before deleting all device data</string>
|
||||
<!-- Label explaining that the admin configured the work profile to wipe itself when the password is mistyped too many times. [CHAR LIMIT=NONE] -->
|
||||
<string name="enterprise_privacy_failed_password_wipe_work">Failed password attempts before deleting work profile data</string>
|
||||
<!-- Summary indicating the number of mistyped passwords after which the device or work profile wipes itself. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="enterprise_privacy_number_failed_password_wipe">
|
||||
<item quantity="one"><xliff:g id="count">%d</xliff:g> attempt</item>
|
||||
<item quantity="other"><xliff:g id="count">%d</xliff:g> attempts</item>
|
||||
</plurals>
|
||||
<!-- Message indicating that the device is enterprise-managed by a Device Owner [CHAR LIMIT=NONE] -->
|
||||
<string name="do_disclosure_generic">This device is managed.</string>
|
||||
<string name="do_disclosure_generic">This device is managed by your organization.</string>
|
||||
<!-- Message indicating that the device is enterprise-managed by a Device Owner [CHAR LIMIT=NONE] -->
|
||||
<string name="do_disclosure_with_name">This device is managed by <xliff:g id="organization_name" example="Foo, Inc.">%s</xliff:g>.</string>
|
||||
<!-- Message indicating that the device is enterprise-managed: Space that separates the main text and the "learn more" link that follows it. [CHAR LIMIT=NONE] -->
|
||||
|
@@ -19,91 +19,75 @@
|
||||
android:key="enterprise_privacy_settings"
|
||||
android:title="@string/enterprise_privacy_settings_title">
|
||||
|
||||
<!-- Header -->
|
||||
<Preference android:key="enterprise_privacy_header"
|
||||
android:summary="@string/enterprise_privacy_header"
|
||||
android:selectable="false"/>
|
||||
|
||||
<PreferenceCategory android:title="@string/enterprise_privacy_exposure_category">
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="enterprise_data"
|
||||
android:layout_height="wrap_content"
|
||||
android:title="@string/enterprise_privacy_enterprise_data"
|
||||
settings:allowDividerBelow="true"
|
||||
settings:multiLine="true"/>
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="number_installed_packages"
|
||||
android:title="@string/enterprise_privacy_number_installed_packages_default"
|
||||
settings:allowDividerBelow="true"
|
||||
android:key="installed_packages"
|
||||
android:title="@string/enterprise_privacy_installed_packages"
|
||||
settings:multiLine="true"/>
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="usage_stats"
|
||||
android:title="@string/enterprise_privacy_usage_stats"
|
||||
settings:allowDividerBelow="true"
|
||||
settings:multiLine="true"/>
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="network_logs"
|
||||
android:title="@string/enterprise_privacy_network_logs"
|
||||
settings:allowDividerBelow="true"
|
||||
settings:multiLine="true"/>
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="bug_reports"
|
||||
android:title="@string/enterprise_privacy_bug_reports"
|
||||
settings:allowDividerBelow="true"
|
||||
settings:multiLine="true"/>
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="security_logs"
|
||||
android:title="@string/enterprise_privacy_security_logs"
|
||||
settings:allowDividerBelow="true"
|
||||
settings:multiLine="true"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="@string/enterprise_privacy_exposure_changes_category">
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="number_enterprise_installed_packages"
|
||||
settings:allowDividerBelow="true"
|
||||
android:title="@string/enterprise_privacy_enterprise_installed_packages"
|
||||
settings:multiLine="true"/>
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="enterprise_privacy_number_location_access_packages"
|
||||
settings:allowDividerBelow="true"
|
||||
android:title="@string/enterprise_privacy_location_access"
|
||||
settings:multiLine="true"/>
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="enterprise_privacy_number_microphone_access_packages"
|
||||
settings:allowDividerBelow="true"
|
||||
android:title="@string/enterprise_privacy_microphone_access"
|
||||
settings:multiLine="true"/>
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="enterprise_privacy_number_camera_access_packages"
|
||||
settings:allowDividerBelow="true"
|
||||
android:title="@string/enterprise_privacy_camera_access"
|
||||
settings:multiLine="true"/>
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="number_enterprise_set_default_apps"
|
||||
settings:allowDividerBelow="true"
|
||||
android:title="@string/enterprise_privacy_enterprise_set_default_apps"
|
||||
settings:multiLine="true"/>
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="always_on_vpn_primary_user"
|
||||
settings:allowDividerBelow="true"
|
||||
settings:multiLine="true"/>
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="always_on_vpn_managed_profile"
|
||||
android:title="@string/enterprise_privacy_always_on_vpn_work"
|
||||
settings:allowDividerBelow="true"
|
||||
settings:multiLine="true"/>
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="input_method"
|
||||
settings:allowDividerBelow="true"
|
||||
android:title="@string/enterprise_privacy_input_method"
|
||||
settings:multiLine="true"/>
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="global_http_proxy"
|
||||
android:title="@string/enterprise_privacy_global_http_proxy"
|
||||
settings:allowDividerBelow="true"
|
||||
settings:multiLine="true"/>
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="ca_certs_current_user"
|
||||
settings:allowDividerBelow="true"
|
||||
settings:multiLine="true"/>
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="ca_certs_managed_profile"
|
||||
settings:allowDividerBelow="true"
|
||||
settings:multiLine="true"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
@@ -111,20 +95,20 @@
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="lock_device"
|
||||
android:title="@string/enterprise_privacy_lock_device"
|
||||
settings:allowDividerBelow="true"
|
||||
settings:multiLine="true"/>
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="wipe_device"
|
||||
android:title="@string/enterprise_privacy_wipe_device"
|
||||
settings:allowDividerBelow="true"
|
||||
settings:multiLine="true"/>
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="failed_password_wipe_primary_user"
|
||||
settings:allowDividerBelow="true"
|
||||
settings:multiLine="true"/>
|
||||
<com.android.settings.DividerPreference
|
||||
android:key="failed_password_wipe_managed_profile"
|
||||
settings:allowDividerBelow="true"
|
||||
settings:multiLine="true"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
<com.android.settings.widget.FooterPreference
|
||||
android:title="@string/enterprise_privacy_footer"
|
||||
android:selectable="false"/>
|
||||
</PreferenceScreen>
|
||||
|
@@ -43,6 +43,12 @@
|
||||
android:persistent="false"
|
||||
android:fragment="com.android.settings.DeviceAdminSettings"/>
|
||||
|
||||
<Preference android:key="enterprise_privacy"
|
||||
android:title="@string/enterprise_privacy_settings"
|
||||
android:summary="@string/enterprise_privacy_settings_summary"
|
||||
android:persistent="false"
|
||||
android:fragment="com.android.settings.enterprise.EnterprisePrivacySettings"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<Preference android:key="sim_lock_settings"
|
||||
|
@@ -40,7 +40,7 @@ public abstract class AdminActionPreferenceControllerBase extends PreferenceCont
|
||||
public void updateState(Preference preference) {
|
||||
final Date timestamp = getAdminActionTimestamp();
|
||||
preference.setSummary(timestamp == null ?
|
||||
mContext.getString(R.string.enterprise_privacy_never) :
|
||||
mContext.getString(R.string.enterprise_privacy_none) :
|
||||
DateUtils.formatDateTime(mContext, timestamp.getTime(),
|
||||
DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE));
|
||||
}
|
||||
|
@@ -17,8 +17,6 @@ package com.android.settings.enterprise;
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
public class AdminGrantedCameraPermissionPreferenceController extends
|
||||
AdminGrantedPermissionsPreferenceControllerBase {
|
||||
|
||||
@@ -26,8 +24,7 @@ public class AdminGrantedCameraPermissionPreferenceController extends
|
||||
= "enterprise_privacy_number_camera_access_packages";
|
||||
|
||||
public AdminGrantedCameraPermissionPreferenceController(Context context) {
|
||||
super(context, new String[] {Manifest.permission.CAMERA},
|
||||
R.plurals.enterprise_privacy_number_camera_access_packages);
|
||||
super(context, new String[] {Manifest.permission.CAMERA});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -17,8 +17,6 @@ package com.android.settings.enterprise;
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
public class AdminGrantedLocationPermissionsPreferenceController extends
|
||||
AdminGrantedPermissionsPreferenceControllerBase {
|
||||
|
||||
@@ -27,8 +25,7 @@ public class AdminGrantedLocationPermissionsPreferenceController extends
|
||||
|
||||
public AdminGrantedLocationPermissionsPreferenceController(Context context) {
|
||||
super(context, new String[] {Manifest.permission.ACCESS_COARSE_LOCATION,
|
||||
Manifest.permission.ACCESS_FINE_LOCATION},
|
||||
R.plurals.enterprise_privacy_number_location_access_packages);
|
||||
Manifest.permission.ACCESS_FINE_LOCATION});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -17,8 +17,6 @@ package com.android.settings.enterprise;
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
public class AdminGrantedMicrophonePermissionPreferenceController extends
|
||||
AdminGrantedPermissionsPreferenceControllerBase {
|
||||
|
||||
@@ -26,8 +24,7 @@ public class AdminGrantedMicrophonePermissionPreferenceController extends
|
||||
= "enterprise_privacy_number_microphone_access_packages";
|
||||
|
||||
public AdminGrantedMicrophonePermissionPreferenceController(Context context) {
|
||||
super(context, new String[] {Manifest.permission.RECORD_AUDIO},
|
||||
R.plurals.enterprise_privacy_number_microphone_access_packages);
|
||||
super(context, new String[] {Manifest.permission.RECORD_AUDIO});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -18,6 +18,7 @@ import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.support.v7.preference.Preference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.applications.ApplicationFeatureProvider;
|
||||
import com.android.settings.core.PreferenceController;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
@@ -25,14 +26,11 @@ import com.android.settings.overlay.FeatureFactory;
|
||||
public abstract class AdminGrantedPermissionsPreferenceControllerBase extends PreferenceController {
|
||||
|
||||
private final String[] mPermissions;
|
||||
private final int mStringResourceId;
|
||||
private final ApplicationFeatureProvider mFeatureProvider;
|
||||
|
||||
public AdminGrantedPermissionsPreferenceControllerBase(Context context, String[] permissions,
|
||||
int stringResourceId) {
|
||||
public AdminGrantedPermissionsPreferenceControllerBase(Context context, String[] permissions) {
|
||||
super(context);
|
||||
mPermissions = permissions;
|
||||
mStringResourceId = stringResourceId;
|
||||
mFeatureProvider = FeatureFactory.getFactory(context)
|
||||
.getApplicationFeatureProvider(context);
|
||||
}
|
||||
@@ -45,8 +43,8 @@ public abstract class AdminGrantedPermissionsPreferenceControllerBase extends Pr
|
||||
preference.setVisible(false);
|
||||
} else {
|
||||
preference.setVisible(true);
|
||||
preference.setTitle(mContext.getResources().getQuantityString(
|
||||
mStringResourceId, num, num));
|
||||
preference.setSummary(mContext.getResources().getQuantityString(
|
||||
R.plurals.enterprise_privacy_number_packages, num, num));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -41,8 +41,10 @@ public class CaCertsCurrentUserPreferenceController extends PreferenceController
|
||||
return;
|
||||
}
|
||||
preference.setTitle(mContext.getResources().getQuantityString(
|
||||
mFeatureProvider.isInCompMode() ? R.plurals.enterprise_privacy_ca_certs_personal
|
||||
: R.plurals.enterprise_privacy_ca_certs_user, certs, certs));
|
||||
mFeatureProvider.isInCompMode() ? R.plurals.enterprise_privacy_ca_certs_personal :
|
||||
R.plurals.enterprise_privacy_ca_certs_user, certs));
|
||||
preference.setSummary(mContext.getResources().getQuantityString(
|
||||
R.plurals.enterprise_privacy_number_ca_certs, certs, certs));
|
||||
preference.setVisible(true);
|
||||
}
|
||||
|
||||
|
@@ -41,7 +41,9 @@ public class CaCertsManagedProfilePreferenceController extends PreferenceControl
|
||||
return;
|
||||
}
|
||||
preference.setTitle(mContext.getResources().getQuantityString(
|
||||
R.plurals.enterprise_privacy_ca_certs_work, certs, certs));
|
||||
R.plurals.enterprise_privacy_ca_certs_work, certs));
|
||||
preference.setSummary(mContext.getResources().getQuantityString(
|
||||
R.plurals.enterprise_privacy_number_ca_certs, certs, certs));
|
||||
preference.setVisible(true);
|
||||
}
|
||||
|
||||
|
@@ -44,9 +44,8 @@ public class EnterpriseInstalledPackagesPreferenceController extends PreferenceC
|
||||
preference.setVisible(false);
|
||||
} else {
|
||||
preference.setVisible(true);
|
||||
preference.setTitle(mContext.getResources().getQuantityString(
|
||||
R.plurals.enterprise_privacy_number_enterprise_installed_packages,
|
||||
num, num));
|
||||
preference.setSummary(mContext.getResources().getQuantityString(
|
||||
R.plurals.enterprise_privacy_number_packages, num, num));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -68,9 +68,8 @@ public class EnterpriseSetDefaultAppsPreferenceController extends PreferenceCont
|
||||
preference.setVisible(false);
|
||||
} else {
|
||||
preference.setVisible(true);
|
||||
preference.setTitle(mContext.getResources().getQuantityString(
|
||||
R.plurals.enterprise_privacy_number_enterprise_set_default_apps,
|
||||
num, num));
|
||||
preference.setSummary(mContext.getResources().getQuantityString(
|
||||
R.plurals.enterprise_privacy_number_packages, num, num));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -15,8 +15,6 @@ package com.android.settings.enterprise;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
public class FailedPasswordWipeManagedProfilePreferenceController
|
||||
extends FailedPasswordWipePreferenceControllerBase {
|
||||
|
||||
@@ -24,7 +22,7 @@ public class FailedPasswordWipeManagedProfilePreferenceController
|
||||
= "failed_password_wipe_managed_profile";
|
||||
|
||||
public FailedPasswordWipeManagedProfilePreferenceController(Context context) {
|
||||
super(context, R.plurals.enterprise_privacy_failed_password_wipe_work);
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -18,17 +18,16 @@ import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.support.v7.preference.Preference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.PreferenceController;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
|
||||
public abstract class FailedPasswordWipePreferenceControllerBase extends PreferenceController {
|
||||
|
||||
private final int mStringResourceId;
|
||||
protected final EnterprisePrivacyFeatureProvider mFeatureProvider;
|
||||
|
||||
public FailedPasswordWipePreferenceControllerBase(Context context, int stringResourceId) {
|
||||
public FailedPasswordWipePreferenceControllerBase(Context context) {
|
||||
super(context);
|
||||
mStringResourceId = stringResourceId;
|
||||
mFeatureProvider = FeatureFactory.getFactory(context)
|
||||
.getEnterprisePrivacyFeatureProvider(context);
|
||||
}
|
||||
@@ -42,8 +41,9 @@ public abstract class FailedPasswordWipePreferenceControllerBase extends Prefere
|
||||
preference.setVisible(false);
|
||||
} else {
|
||||
preference.setVisible(true);
|
||||
preference.setTitle(mContext.getResources().getQuantityString(
|
||||
mStringResourceId, failedPasswordsBeforeWipe, failedPasswordsBeforeWipe));
|
||||
preference.setSummary(mContext.getResources().getQuantityString(
|
||||
R.plurals.enterprise_privacy_number_failed_password_wipe,
|
||||
failedPasswordsBeforeWipe, failedPasswordsBeforeWipe));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -15,8 +15,6 @@ package com.android.settings.enterprise;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
public class FailedPasswordWipePrimaryUserPreferenceController
|
||||
extends FailedPasswordWipePreferenceControllerBase {
|
||||
|
||||
@@ -24,7 +22,7 @@ public class FailedPasswordWipePrimaryUserPreferenceController
|
||||
= "failed_password_wipe_primary_user";
|
||||
|
||||
public FailedPasswordWipePrimaryUserPreferenceController(Context context) {
|
||||
super(context, R.plurals.enterprise_privacy_failed_password_wipe_device);
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -40,8 +40,8 @@ public class ImePreferenceController extends PreferenceController {
|
||||
preference.setVisible(false);
|
||||
return;
|
||||
}
|
||||
preference.setTitle(mContext.getResources().getString(
|
||||
R.string.enterprise_privacy_input_method, ownerSetIme));
|
||||
preference.setSummary(mContext.getResources().getString(
|
||||
R.string.enterprise_privacy_input_method_name, ownerSetIme));
|
||||
preference.setVisible(true);
|
||||
}
|
||||
|
||||
|
@@ -24,7 +24,7 @@ import com.android.settings.overlay.FeatureFactory;
|
||||
|
||||
public class InstalledPackagesPreferenceController extends PreferenceController {
|
||||
|
||||
private static final String KEY_NUMBER_INSTALLED_PACKAGES = "number_installed_packages";
|
||||
private static final String KEY_INSTALLED_PACKAGES = "installed_packages";
|
||||
private final ApplicationFeatureProvider mFeatureProvider;
|
||||
|
||||
public InstalledPackagesPreferenceController(Context context) {
|
||||
@@ -38,8 +38,12 @@ public class InstalledPackagesPreferenceController extends PreferenceController
|
||||
mFeatureProvider.calculateNumberOfInstalledApps(
|
||||
ApplicationFeatureProvider.IGNORE_INSTALL_REASON,
|
||||
(num) -> {
|
||||
preference.setTitle(mContext.getResources().getQuantityString(
|
||||
R.plurals.enterprise_privacy_number_installed_packages, num, num));
|
||||
if (num == 0) {
|
||||
preference.setSummary("");
|
||||
} else {
|
||||
preference.setSummary(mContext.getResources().getQuantityString(
|
||||
R.plurals.enterprise_privacy_number_packages, num, num));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -50,6 +54,6 @@ public class InstalledPackagesPreferenceController extends PreferenceController
|
||||
|
||||
@Override
|
||||
public String getPreferenceKey() {
|
||||
return KEY_NUMBER_INSTALLED_PACKAGES;
|
||||
return KEY_INSTALLED_PACKAGES;
|
||||
}
|
||||
}
|
||||
|
@@ -59,12 +59,12 @@ public abstract class AdminActionPreferenceControllerTestBase {
|
||||
@Test
|
||||
public void testUpdateState() {
|
||||
final Preference preference = new Preference(mContext, null, 0, 0);
|
||||
when(mContext.getString(R.string.enterprise_privacy_never)).thenReturn("Never");
|
||||
when(mContext.getString(R.string.enterprise_privacy_none)).thenReturn("None");
|
||||
Settings.System.putString(mContext.getContentResolver(), Settings.System.TIME_12_24, "24");
|
||||
|
||||
setDate(null);
|
||||
mController.updateState(preference);
|
||||
assertThat(preference.getSummary()).isEqualTo("Never");
|
||||
assertThat(preference.getSummary()).isEqualTo("None");
|
||||
|
||||
final Date date = new GregorianCalendar(2011 /* year */, 10 /* month */, 9 /* dayOfMonth */,
|
||||
8 /* hourOfDay */, 7 /* minute */, 6 /* second */).getTime();
|
||||
|
@@ -18,7 +18,6 @@ package com.android.settings.enterprise;
|
||||
|
||||
import android.Manifest;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.TestConfig;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -34,8 +33,7 @@ public final class AdminGrantedCameraPermissionPreferenceControllerTest extends
|
||||
|
||||
public AdminGrantedCameraPermissionPreferenceControllerTest() {
|
||||
super("enterprise_privacy_number_camera_access_packages",
|
||||
new String[] {Manifest.permission.CAMERA},
|
||||
R.plurals.enterprise_privacy_number_camera_access_packages);
|
||||
new String[] {Manifest.permission.CAMERA});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -18,7 +18,6 @@ package com.android.settings.enterprise;
|
||||
|
||||
import android.Manifest;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.TestConfig;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -35,8 +34,7 @@ public final class AdminGrantedLocationPermissionsPreferenceControllerTest exten
|
||||
public AdminGrantedLocationPermissionsPreferenceControllerTest() {
|
||||
super("enterprise_privacy_number_location_access_packages",
|
||||
new String[] {Manifest.permission.ACCESS_COARSE_LOCATION,
|
||||
Manifest.permission.ACCESS_FINE_LOCATION},
|
||||
R.plurals.enterprise_privacy_number_location_access_packages);
|
||||
Manifest.permission.ACCESS_FINE_LOCATION});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -18,7 +18,6 @@ package com.android.settings.enterprise;
|
||||
|
||||
import android.Manifest;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.TestConfig;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -34,8 +33,7 @@ public final class AdminGrantedMicrophonePermissionPreferenceControllerTest exte
|
||||
|
||||
public AdminGrantedMicrophonePermissionPreferenceControllerTest() {
|
||||
super("enterprise_privacy_number_microphone_access_packages",
|
||||
new String[] {Manifest.permission.RECORD_AUDIO},
|
||||
R.plurals.enterprise_privacy_number_microphone_access_packages);
|
||||
new String[] {Manifest.permission.RECORD_AUDIO});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -30,7 +30,7 @@ public final class AdminGrantedPermissionsPreferenceControllerBaseTest extends
|
||||
AdminGrantedPermissionsPreferenceControllerTestBase {
|
||||
|
||||
public AdminGrantedPermissionsPreferenceControllerBaseTest() {
|
||||
super(null, new String[] {"some.permission"}, 123 /* resourceStringId */);
|
||||
super(null, new String[] {"some.permission"});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,8 +43,7 @@ public final class AdminGrantedPermissionsPreferenceControllerBaseTest extends
|
||||
AdminGrantedPermissionsPreferenceControllerBase {
|
||||
|
||||
AdminGrantedPermissionsPreferenceControllerBaseTestable() {
|
||||
super(AdminGrantedPermissionsPreferenceControllerBaseTest.this.mContext, mPermissions,
|
||||
mStringResourceId);
|
||||
super(AdminGrantedPermissionsPreferenceControllerBaseTest.this.mContext, mPermissions);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -20,6 +20,7 @@ import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.support.v7.preference.Preference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.applications.ApplicationFeatureProvider;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
|
||||
@@ -44,7 +45,6 @@ public abstract class AdminGrantedPermissionsPreferenceControllerTestBase {
|
||||
|
||||
protected final String mKey;
|
||||
protected final String[] mPermissions;
|
||||
protected final int mStringResourceId;
|
||||
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
protected Context mContext;
|
||||
@@ -52,11 +52,9 @@ public abstract class AdminGrantedPermissionsPreferenceControllerTestBase {
|
||||
|
||||
protected AdminGrantedPermissionsPreferenceControllerBase mController;
|
||||
|
||||
public AdminGrantedPermissionsPreferenceControllerTestBase(String key, String[] permissions,
|
||||
int stringResourceId) {
|
||||
public AdminGrantedPermissionsPreferenceControllerTestBase(String key, String[] permissions) {
|
||||
mKey = key;
|
||||
mPermissions = permissions;
|
||||
mStringResourceId = stringResourceId;
|
||||
}
|
||||
|
||||
@Before
|
||||
@@ -83,10 +81,10 @@ public abstract class AdminGrantedPermissionsPreferenceControllerTestBase {
|
||||
preference.setVisible(false);
|
||||
|
||||
setNumberOfPackagesWithAdminGrantedPermissions(20);
|
||||
when(mContext.getResources().getQuantityString(mStringResourceId, 20, 20))
|
||||
.thenReturn("20 packages");
|
||||
when(mContext.getResources().getQuantityString(R.plurals.enterprise_privacy_number_packages,
|
||||
20, 20)).thenReturn("20 packages");
|
||||
mController.updateState(preference);
|
||||
assertThat(preference.getTitle()).isEqualTo("20 packages");
|
||||
assertThat(preference.getSummary()).isEqualTo("20 packages");
|
||||
assertThat(preference.isVisible()).isTrue();
|
||||
|
||||
setNumberOfPackagesWithAdminGrantedPermissions(0);
|
||||
|
@@ -43,8 +43,12 @@ import static org.mockito.Mockito.when;
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
public final class CaCertsCurrentUserPreferenceControllerTest {
|
||||
|
||||
private final String INSTALLED_CERTS_USER = "10 certs installed";
|
||||
private final String INSTALLED_CERTS_PERSONAL = "10 certs installed in personal profile";
|
||||
private final String INSTALLED_CERTS_USER_1 = "cert installed";
|
||||
private final String INSTALLED_CERTS_USER_10 = "certs installed";
|
||||
private final String INSTALLED_CERTS_PERSONAL_1 = "cert installed in personal profile";
|
||||
private final String INSTALLED_CERTS_PERSONAL_10 = "certs installed in personal profile";
|
||||
private final String NUMBER_INSTALLED_CERTS_1 = "1 cert";
|
||||
private final String NUMBER_INSTALLED_CERTS_10 = "10 certs";
|
||||
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
private Context mContext;
|
||||
@@ -58,12 +62,21 @@ public final class CaCertsCurrentUserPreferenceControllerTest {
|
||||
FakeFeatureFactory.setupForTest(mContext);
|
||||
mFeatureFactory = (FakeFeatureFactory) FakeFeatureFactory.getFactory(mContext);
|
||||
mController = new CaCertsCurrentUserPreferenceController(mContext);
|
||||
|
||||
when(mContext.getResources().getQuantityString(R.plurals.enterprise_privacy_ca_certs_user,
|
||||
1)).thenReturn(INSTALLED_CERTS_USER_1);
|
||||
when(mContext.getResources().getQuantityString(R.plurals.enterprise_privacy_ca_certs_user,
|
||||
10)).thenReturn(INSTALLED_CERTS_USER_10);
|
||||
when(mContext.getResources().getQuantityString(
|
||||
R.plurals.enterprise_privacy_ca_certs_user, 10, 10))
|
||||
.thenReturn(INSTALLED_CERTS_USER);
|
||||
R.plurals.enterprise_privacy_ca_certs_personal, 1))
|
||||
.thenReturn(INSTALLED_CERTS_PERSONAL_1);
|
||||
when(mContext.getResources().getQuantityString(
|
||||
R.plurals.enterprise_privacy_ca_certs_personal, 10, 10))
|
||||
.thenReturn(INSTALLED_CERTS_PERSONAL);
|
||||
R.plurals.enterprise_privacy_ca_certs_personal, 10))
|
||||
.thenReturn(INSTALLED_CERTS_PERSONAL_10);
|
||||
when(mContext.getResources().getQuantityString(R.plurals.enterprise_privacy_number_ca_certs,
|
||||
1, 1)).thenReturn(NUMBER_INSTALLED_CERTS_1);
|
||||
when(mContext.getResources().getQuantityString(R.plurals.enterprise_privacy_number_ca_certs,
|
||||
10, 10)).thenReturn(NUMBER_INSTALLED_CERTS_10);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -78,11 +91,20 @@ public final class CaCertsCurrentUserPreferenceControllerTest {
|
||||
mController.updateState(preference);
|
||||
assertThat(preference.isVisible()).isFalse();
|
||||
|
||||
when(mFeatureFactory.enterprisePrivacyFeatureProvider
|
||||
.getNumberOfOwnerInstalledCaCertsInCurrentUser()).thenReturn(1);
|
||||
mController.updateState(preference);
|
||||
assertThat(preference.isVisible()).isTrue();
|
||||
assertThat(preference.getTitle()).isEqualTo(INSTALLED_CERTS_USER_1);
|
||||
assertThat(preference.getSummary()).isEqualTo(NUMBER_INSTALLED_CERTS_1);
|
||||
|
||||
preference.setVisible(false);
|
||||
when(mFeatureFactory.enterprisePrivacyFeatureProvider
|
||||
.getNumberOfOwnerInstalledCaCertsInCurrentUser()).thenReturn(10);
|
||||
mController.updateState(preference);
|
||||
assertThat(preference.isVisible()).isTrue();
|
||||
assertThat(preference.getTitle()).isEqualTo(INSTALLED_CERTS_USER);
|
||||
assertThat(preference.getTitle()).isEqualTo(INSTALLED_CERTS_USER_10);
|
||||
assertThat(preference.getSummary()).isEqualTo(NUMBER_INSTALLED_CERTS_10);
|
||||
|
||||
when(mFeatureFactory.enterprisePrivacyFeatureProvider.isInCompMode()).thenReturn(true);
|
||||
|
||||
@@ -91,11 +113,20 @@ public final class CaCertsCurrentUserPreferenceControllerTest {
|
||||
mController.updateState(preference);
|
||||
assertThat(preference.isVisible()).isFalse();
|
||||
|
||||
when(mFeatureFactory.enterprisePrivacyFeatureProvider
|
||||
.getNumberOfOwnerInstalledCaCertsInCurrentUser()).thenReturn(1);
|
||||
mController.updateState(preference);
|
||||
assertThat(preference.isVisible()).isTrue();
|
||||
assertThat(preference.getTitle()).isEqualTo(INSTALLED_CERTS_PERSONAL_1);
|
||||
assertThat(preference.getSummary()).isEqualTo(NUMBER_INSTALLED_CERTS_1);
|
||||
|
||||
preference.setVisible(false);
|
||||
when(mFeatureFactory.enterprisePrivacyFeatureProvider
|
||||
.getNumberOfOwnerInstalledCaCertsInCurrentUser()).thenReturn(10);
|
||||
mController.updateState(preference);
|
||||
assertThat(preference.isVisible()).isTrue();
|
||||
assertThat(preference.getTitle()).isEqualTo(INSTALLED_CERTS_PERSONAL);
|
||||
assertThat(preference.getTitle()).isEqualTo(INSTALLED_CERTS_PERSONAL_10);
|
||||
assertThat(preference.getSummary()).isEqualTo(NUMBER_INSTALLED_CERTS_10);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -43,7 +43,10 @@ import static org.mockito.Mockito.when;
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
public final class CaCertsManagedProfilePreferenceControllerTest {
|
||||
|
||||
private final String INSTALLED_CERTS = "10 certs installed";
|
||||
private final String INSTALLED_CERTS_1 = "cert installed";
|
||||
private final String INSTALLED_CERTS_10 = "certs installed";
|
||||
private final String NUMBER_INSTALLED_CERTS_1 = "1 cert";
|
||||
private final String NUMBER_INSTALLED_CERTS_10 = "10 certs";
|
||||
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
private Context mContext;
|
||||
@@ -57,8 +60,15 @@ public final class CaCertsManagedProfilePreferenceControllerTest {
|
||||
FakeFeatureFactory.setupForTest(mContext);
|
||||
mFeatureFactory = (FakeFeatureFactory) FakeFeatureFactory.getFactory(mContext);
|
||||
mController = new CaCertsManagedProfilePreferenceController(mContext);
|
||||
when(mContext.getResources().getQuantityString(
|
||||
R.plurals.enterprise_privacy_ca_certs_work, 10, 10)).thenReturn(INSTALLED_CERTS);
|
||||
|
||||
when(mContext.getResources().getQuantityString(R.plurals.enterprise_privacy_ca_certs_work,
|
||||
1)).thenReturn(INSTALLED_CERTS_1);
|
||||
when(mContext.getResources().getQuantityString(R.plurals.enterprise_privacy_ca_certs_work,
|
||||
10)).thenReturn(INSTALLED_CERTS_10);
|
||||
when(mContext.getResources().getQuantityString(R.plurals.enterprise_privacy_number_ca_certs,
|
||||
1, 1)).thenReturn(NUMBER_INSTALLED_CERTS_1);
|
||||
when(mContext.getResources().getQuantityString(R.plurals.enterprise_privacy_number_ca_certs,
|
||||
10, 10)).thenReturn(NUMBER_INSTALLED_CERTS_10);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -71,11 +81,20 @@ public final class CaCertsManagedProfilePreferenceControllerTest {
|
||||
mController.updateState(preference);
|
||||
assertThat(preference.isVisible()).isFalse();
|
||||
|
||||
when(mFeatureFactory.enterprisePrivacyFeatureProvider
|
||||
.getNumberOfOwnerInstalledCaCertsInManagedProfile()).thenReturn(1);
|
||||
mController.updateState(preference);
|
||||
assertThat(preference.isVisible()).isTrue();
|
||||
assertThat(preference.getTitle()).isEqualTo(INSTALLED_CERTS_1);
|
||||
assertThat(preference.getSummary()).isEqualTo(NUMBER_INSTALLED_CERTS_1);
|
||||
|
||||
preference.setVisible(false);
|
||||
when(mFeatureFactory.enterprisePrivacyFeatureProvider
|
||||
.getNumberOfOwnerInstalledCaCertsInManagedProfile()).thenReturn(10);
|
||||
mController.updateState(preference);
|
||||
assertThat(preference.isVisible()).isTrue();
|
||||
assertThat(preference.getTitle()).isEqualTo(INSTALLED_CERTS);
|
||||
assertThat(preference.getTitle()).isEqualTo(INSTALLED_CERTS_10);
|
||||
assertThat(preference.getSummary()).isEqualTo(NUMBER_INSTALLED_CERTS_10);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -86,11 +86,10 @@ public final class EnterpriseInstalledPackagesPreferenceControllerTest {
|
||||
assertThat(preference.isVisible()).isFalse();
|
||||
|
||||
setNumberOfEnterpriseInstalledPackages(20);
|
||||
when(mContext.getResources().getQuantityString(
|
||||
R.plurals.enterprise_privacy_number_enterprise_installed_packages, 20, 20))
|
||||
.thenReturn("20 packages");
|
||||
when(mContext.getResources().getQuantityString(R.plurals.enterprise_privacy_number_packages,
|
||||
20, 20)).thenReturn("20 packages");
|
||||
mController.updateState(preference);
|
||||
assertThat(preference.getTitle()).isEqualTo("20 packages");
|
||||
assertThat(preference.getSummary()).isEqualTo("20 packages");
|
||||
assertThat(preference.isVisible()).isTrue();
|
||||
}
|
||||
|
||||
|
@@ -118,11 +118,10 @@ public final class EnterpriseSetDefaultAppsPreferenceControllerTest {
|
||||
ContactsContract.Contacts.CONTENT_TYPE)}, 32);
|
||||
setEnterpriseSetDefaultApps(new Intent[] {new Intent(Intent.ACTION_DIAL),
|
||||
new Intent(Intent.ACTION_CALL)}, 64);
|
||||
when(mContext.getResources().getQuantityString(
|
||||
R.plurals.enterprise_privacy_number_enterprise_set_default_apps, 127, 127))
|
||||
.thenReturn("127 apps");
|
||||
when(mContext.getResources().getQuantityString(R.plurals.enterprise_privacy_number_packages,
|
||||
127, 127)).thenReturn("127 apps");
|
||||
mController.updateState(preference);
|
||||
assertThat(preference.getTitle()).isEqualTo("127 apps");
|
||||
assertThat(preference.getSummary()).isEqualTo("127 apps");
|
||||
assertThat(preference.isVisible()).isTrue();
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,6 @@ package com.android.settings.enterprise;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.TestConfig;
|
||||
|
||||
@@ -38,8 +37,7 @@ public final class FailedPasswordWipeManagedProfilePreferenceControllerTest exte
|
||||
private int mMaximumFailedPasswordsBeforeWipe = 0;
|
||||
|
||||
public FailedPasswordWipeManagedProfilePreferenceControllerTest() {
|
||||
super("failed_password_wipe_managed_profile",
|
||||
R.plurals.enterprise_privacy_failed_password_wipe_work);
|
||||
super("failed_password_wipe_managed_profile");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -33,7 +33,7 @@ public final class FailedPasswordWipePreferenceControllerBaseTest extends
|
||||
private int mMaximumFailedPasswordsBeforeWipe = 0;
|
||||
|
||||
public FailedPasswordWipePreferenceControllerBaseTest() {
|
||||
super(null, 123 /* stringResourceId */);
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -50,7 +50,7 @@ public final class FailedPasswordWipePreferenceControllerBaseTest extends
|
||||
private class FailedPasswordWipePreferenceControllerBaseTestable extends
|
||||
FailedPasswordWipePreferenceControllerBase {
|
||||
FailedPasswordWipePreferenceControllerBaseTestable() {
|
||||
super(FailedPasswordWipePreferenceControllerBaseTest.this.mContext, mStringResourceId);
|
||||
super(FailedPasswordWipePreferenceControllerBaseTest.this.mContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -20,6 +20,7 @@ import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.support.v7.preference.Preference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -37,7 +38,6 @@ import static org.mockito.Mockito.when;
|
||||
public abstract class FailedPasswordWipePreferenceControllerTestBase {
|
||||
|
||||
protected final String mKey;
|
||||
protected final int mStringResourceId;
|
||||
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
protected Context mContext;
|
||||
@@ -45,9 +45,8 @@ public abstract class FailedPasswordWipePreferenceControllerTestBase {
|
||||
|
||||
protected FailedPasswordWipePreferenceControllerBase mController;
|
||||
|
||||
public FailedPasswordWipePreferenceControllerTestBase(String key, int stringResourceId) {
|
||||
public FailedPasswordWipePreferenceControllerTestBase(String key) {
|
||||
mKey = key;
|
||||
mStringResourceId = stringResourceId;
|
||||
}
|
||||
|
||||
@Before
|
||||
@@ -65,11 +64,11 @@ public abstract class FailedPasswordWipePreferenceControllerTestBase {
|
||||
preference.setVisible(false);
|
||||
|
||||
setMaximumFailedPasswordsBeforeWipe(10);
|
||||
when(mContext.getResources().getQuantityString(mStringResourceId, 10, 10))
|
||||
when(mContext.getResources().getQuantityString(
|
||||
R.plurals.enterprise_privacy_number_failed_password_wipe, 10, 10))
|
||||
.thenReturn("10 attempts");
|
||||
mController.updateState(preference);
|
||||
assertThat(preference.getTitle()).isEqualTo("10 attempts");
|
||||
assertThat(preference.isVisible()).isTrue();
|
||||
assertThat(preference.getSummary()).isEqualTo("10 attempts");
|
||||
|
||||
setMaximumFailedPasswordsBeforeWipe(0);
|
||||
mController.updateState(preference);
|
||||
|
@@ -18,7 +18,6 @@ package com.android.settings.enterprise;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.TestConfig;
|
||||
|
||||
@@ -38,8 +37,7 @@ public final class FailedPasswordWipePrimaryUserPreferenceControllerTest extends
|
||||
private int mMaximumFailedPasswordsBeforeWipe = 0;
|
||||
|
||||
public FailedPasswordWipePrimaryUserPreferenceControllerTest() {
|
||||
super("failed_password_wipe_primary_user",
|
||||
R.plurals.enterprise_privacy_failed_password_wipe_device);
|
||||
super("failed_password_wipe_primary_user");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -44,7 +44,7 @@ import static org.mockito.Mockito.when;
|
||||
public final class ImePreferenceControllerTest {
|
||||
|
||||
private final String DEFAULT_IME_LABEL = "Test IME";
|
||||
private final String DEFAULT_IME_TEXT = "IME set to Test IME";
|
||||
private final String DEFAULT_IME_TEXT = "Set to Test IME";
|
||||
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
private Context mContext;
|
||||
@@ -58,7 +58,7 @@ public final class ImePreferenceControllerTest {
|
||||
FakeFeatureFactory.setupForTest(mContext);
|
||||
mFeatureFactory = (FakeFeatureFactory) FakeFeatureFactory.getFactory(mContext);
|
||||
mController = new ImePreferenceController(mContext);
|
||||
when(mContext.getResources().getString(R.string.enterprise_privacy_input_method,
|
||||
when(mContext.getResources().getString(R.string.enterprise_privacy_input_method_name,
|
||||
DEFAULT_IME_LABEL)).thenReturn(DEFAULT_IME_TEXT);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public final class ImePreferenceControllerTest {
|
||||
.thenReturn(DEFAULT_IME_LABEL);
|
||||
mController.updateState(preference);
|
||||
assertThat(preference.isVisible()).isTrue();
|
||||
assertThat(preference.getTitle()).isEqualTo(DEFAULT_IME_TEXT);
|
||||
assertThat(preference.getSummary()).isEqualTo(DEFAULT_IME_TEXT);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -64,22 +64,30 @@ public final class InstalledPackagesPreferenceControllerTest {
|
||||
mController = new InstalledPackagesPreferenceController(mContext);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateState() {
|
||||
final Preference preference = new Preference(mContext, null, 0, 0);
|
||||
private void setNumberOfInstalledPackages(int number) {
|
||||
doAnswer(new Answer() {
|
||||
public Object answer(InvocationOnMock invocation) {
|
||||
((ApplicationFeatureProvider.NumberOfAppsCallback)
|
||||
invocation.getArguments()[1]).onNumberOfAppsResult(20);
|
||||
invocation.getArguments()[1]).onNumberOfAppsResult(number);
|
||||
return null;
|
||||
}}).when(mFeatureFactory.applicationFeatureProvider)
|
||||
.calculateNumberOfInstalledApps(
|
||||
eq(ApplicationFeatureProvider.IGNORE_INSTALL_REASON), anyObject());
|
||||
when(mContext.getResources().getQuantityString(
|
||||
R.plurals.enterprise_privacy_number_installed_packages, 20, 20))
|
||||
.thenReturn("20 packages");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateState() {
|
||||
final Preference preference = new Preference(mContext, null, 0, 0);
|
||||
|
||||
setNumberOfInstalledPackages(0);
|
||||
mController.updateState(preference);
|
||||
assertThat(preference.getTitle()).isEqualTo("20 packages");
|
||||
assertThat(preference.getSummary()).isEqualTo("");
|
||||
|
||||
setNumberOfInstalledPackages(20);
|
||||
when(mContext.getResources().getQuantityString(R.plurals.enterprise_privacy_number_packages,
|
||||
20, 20)).thenReturn("20 packages");
|
||||
mController.updateState(preference);
|
||||
assertThat(preference.getSummary()).isEqualTo("20 packages");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -95,6 +103,6 @@ public final class InstalledPackagesPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void testGetPreferenceKey() {
|
||||
assertThat(mController.getPreferenceKey()).isEqualTo("number_installed_packages");
|
||||
assertThat(mController.getPreferenceKey()).isEqualTo("installed_packages");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user