Merge "Finalize strings for enterprise privacy"

This commit is contained in:
TreeHugger Robot
2017-03-20 19:36:43 +00:00
committed by Android (Google) Code Review
3 changed files with 19 additions and 7 deletions

View File

@@ -1306,6 +1306,9 @@
<!-- Title of preference to manage device admins --> <!-- Title of preference to manage device admins -->
<string name="manage_device_admin">Device admin apps</string> <string name="manage_device_admin">Device admin apps</string>
<!-- Summary of preference to manage device administrators, informing the user that currently no device administrator apps are installed and active -->
<string name="number_of_device_admins_none">No active apps</string>
<!-- Summary of preference to manage device administrators, informing the user how many device administrator apps are installed and active --> <!-- Summary of preference to manage device administrators, informing the user how many device administrator apps are installed and active -->
<plurals name="number_of_device_admins"> <plurals name="number_of_device_admins">
<item quantity="one"><xliff:g id="count">%d</xliff:g> active app</item> <item quantity="one"><xliff:g id="count">%d</xliff:g> active app</item>
@@ -8170,7 +8173,7 @@
<!-- Enterprise Privacy --> <skip /> <!-- Enterprise Privacy --> <skip />
<!-- 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. Note: "Device" is singular and refers to the device (e.g. phone or tablet) that the user is holding in their hand. --> <!-- 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. Note: "Device" is singular and refers to the device (e.g. phone or tablet) that the user is holding in their hand. -->
<string name="enterprise_privacy_settings">Managed device details</string> <string name="enterprise_privacy_settings">Managed device info</string>
<!-- Summary for Enterprise Privacy settings, explaining what the user can expect to find under it [CHAR LIMIT=NONE]--> <!-- Summary for Enterprise Privacy settings, explaining what the user can expect to find under it [CHAR LIMIT=NONE]-->
<string name="enterprise_privacy_settings_summary_generic">Changes &amp; settings managed by your organization</string> <string name="enterprise_privacy_settings_summary_generic">Changes &amp; settings managed by your organization</string>
<!-- Summary for Enterprise Privacy settings, explaining what the user can expect to find under it [CHAR LIMIT=NONE]--> <!-- Summary for Enterprise Privacy settings, explaining what the user can expect to find under it [CHAR LIMIT=NONE]-->
@@ -8231,13 +8234,13 @@
<string name="enterprise_privacy_global_http_proxy">Global HTTP proxy set</string> <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] --> <!-- Label explaining that the admin installed trusted CA certificates for the current user. [CHAR LIMIT=NONE] -->
<plurals name="enterprise_privacy_ca_certs_user"> <plurals name="enterprise_privacy_ca_certs_user">
<item quantity="one">Trusted CA Certificate installed</item> <item quantity="one">Trusted CA certificate installed</item>
<item quantity="other">Trusted CA Certificates installed</item> <item quantity="other">Trusted CA certificates installed</item>
</plurals> </plurals>
<!-- Label explaining that the admin installed trusted CA certificates for the personal profile. [CHAR LIMIT=NONE] --> <!-- Label explaining that the admin installed trusted CA certificates for the personal profile. [CHAR LIMIT=NONE] -->
<plurals name="enterprise_privacy_ca_certs_personal"> <plurals name="enterprise_privacy_ca_certs_personal">
<item quantity="one">Trusted CA Certificate installed in your personal profile</item> <item quantity="one">Trusted CA certificate installed in your personal profile</item>
<item quantity="other">Trusted CA Certificates installed in your personal profile</item> <item quantity="other">Trusted CA certificates installed in your personal profile</item>
</plurals> </plurals>
<!-- Summary indicating the number of trusted CA certificates installed by the admin. [CHAR LIMIT=NONE] --> <!-- Summary indicating the number of trusted CA certificates installed by the admin. [CHAR LIMIT=NONE] -->
<plurals name="enterprise_privacy_number_ca_certs"> <plurals name="enterprise_privacy_number_ca_certs">

View File

@@ -36,8 +36,10 @@ public class ManageDeviceAdminPreferenceController extends PreferenceController
public void updateState(Preference preference) { public void updateState(Preference preference) {
final int activeAdmins final int activeAdmins
= mFeatureProvider.getNumberOfActiveDeviceAdminsForCurrentUserAndManagedProfile(); = mFeatureProvider.getNumberOfActiveDeviceAdminsForCurrentUserAndManagedProfile();
preference.setSummary(mContext.getResources().getQuantityString( preference.setSummary(activeAdmins == 0
R.plurals.number_of_device_admins, activeAdmins, activeAdmins)); ? mContext.getResources().getString(R.string.number_of_device_admins_none)
: mContext.getResources().getQuantityString(R.plurals.number_of_device_admins,
activeAdmins, activeAdmins));
} }
@Override @Override

View File

@@ -61,6 +61,13 @@ public final class ManageDeviceAdminPreferenceControllerTest {
public void testUpdateState() { public void testUpdateState() {
final Preference preference = new Preference(mContext, null, 0, 0); final Preference preference = new Preference(mContext, null, 0, 0);
when(mFeatureFactory.enterprisePrivacyFeatureProvider
.getNumberOfActiveDeviceAdminsForCurrentUserAndManagedProfile()).thenReturn(0);
when(mContext.getResources().getString(R.string.number_of_device_admins_none))
.thenReturn("no apps");
mController.updateState(preference);
assertThat(preference.getSummary()).isEqualTo("no apps");
when(mFeatureFactory.enterprisePrivacyFeatureProvider when(mFeatureFactory.enterprisePrivacyFeatureProvider
.getNumberOfActiveDeviceAdminsForCurrentUserAndManagedProfile()).thenReturn(5); .getNumberOfActiveDeviceAdminsForCurrentUserAndManagedProfile()).thenReturn(5);
when(mContext.getResources().getQuantityString(R.plurals.number_of_device_admins, 5, 5)) when(mContext.getResources().getQuantityString(R.plurals.number_of_device_admins, 5, 5))