Cleanup some plurals in Settings

Change <one> to <1> in string res file, and update related java files.
Test: Update, existing test still pass.
bug: 199230342

Change-Id: Idd0ba3c6adc060da21574d98f8ed765fae00cef8
This commit is contained in:
xinghailu
2022-12-21 20:57:43 +08:00
parent b603ff7b19
commit 897fd74731
31 changed files with 281 additions and 260 deletions

View File

@@ -36,10 +36,10 @@
<!-- String for removal of sensitive info on about, depending on tap --> <!-- String for removal of sensitive info on about, depending on tap -->
<string name="device_info_protected_single_press">Tap to show info</string> <string name="device_info_protected_single_press">Tap to show info</string>
<!-- [CHAR LIMIT=NONE] Device Info screen. Countdown for user taps to enable development settings --> <!-- [CHAR LIMIT=NONE] Device Info screen. Countdown for user taps to enable development settings -->
<plurals name="show_dev_countdown"> <string name="show_dev_countdown">{count, plural,
<item quantity="one">You are now <xliff:g id="step_count">%1$d</xliff:g> step away from being a developer.</item> =1 {You are now # step away from being a developer.}
<item quantity="other">You are now <xliff:g id="step_count">%1$d</xliff:g> steps away from being a developer.</item> other {You are now # steps away from being a developer.}
</plurals> }</string>
<!-- [CHAR LIMIT=NONE] Device Info screen. Confirmation that developer settings are enabled --> <!-- [CHAR LIMIT=NONE] Device Info screen. Confirmation that developer settings are enabled -->
<string name="show_dev_on">You are now a developer!</string> <string name="show_dev_on">You are now a developer!</string>
<!-- [CHAR LIMIT=NONE] Device Info screen. Okay we get it, stop pressing, you already have it on --> <!-- [CHAR LIMIT=NONE] Device Info screen. Okay we get it, stop pressing, you already have it on -->
@@ -355,10 +355,10 @@
<string name="desc_app_locale_selection_supported">Only apps that support language selection are shown here.</string> <string name="desc_app_locale_selection_supported">Only apps that support language selection are shown here.</string>
<!-- The title of the confirmation dialog shown when the user selects one / several languages and tries to remove them [CHAR LIMIT=60] --> <!-- The title of the confirmation dialog shown when the user selects one / several languages and tries to remove them [CHAR LIMIT=60] -->
<plurals name="dlg_remove_locales_title"> <string name="dlg_remove_locales_title">{count, plural,
<item quantity="one">Remove selected language?</item> =1 {Remove selected language?}
<item quantity="other">Remove selected languages?</item> other {Remove selected languages?}
</plurals> }</string>
<!-- The text of the confirmation dialog shown when the user selects several languages and tries to remove them [CHAR LIMIT=NONE] --> <!-- The text of the confirmation dialog shown when the user selects several languages and tries to remove them [CHAR LIMIT=NONE] -->
<string name="dlg_remove_locales_message">Text will be displayed in another language.</string> <string name="dlg_remove_locales_message">Text will be displayed in another language.</string>
@@ -1128,10 +1128,10 @@
<string name="lock_last_password_attempt_before_wipe_profile">If you enter an incorrect password on the next attempt, your work profile and its data will be deleted</string> <string name="lock_last_password_attempt_before_wipe_profile">If you enter an incorrect password on the next attempt, your work profile and its data will be deleted</string>
<!-- Hint shown in dialog screen when password is too short --> <!-- Hint shown in dialog screen when password is too short -->
<plurals name="lockpassword_password_too_short"> <string name="lockpassword_password_too_short">{count, plural,
<item quantity="one">Must contain at least <xliff:g id="count" example="1">%d</xliff:g> character</item> =1 {Must contain at least # character}
<item quantity="other">Must be at least <xliff:g id="count" example="3">%d</xliff:g> characters</item> other {Must be at least # characters}
</plurals> }</string>
<!-- Hint shown in dialog screen when password is too short and only using numbers. [CHAR LIMIT=NONE] --> <!-- Hint shown in dialog screen when password is too short and only using numbers. [CHAR LIMIT=NONE] -->
<string name="lockpassword_password_too_short_all_numeric"> <string name="lockpassword_password_too_short_all_numeric">
{count, plural, {count, plural,
@@ -1140,21 +1140,21 @@
} }
</string> </string>
<!-- Hint shown in dialog screen when PIN is too short --> <!-- Hint shown in dialog screen when PIN is too short -->
<plurals name="lockpassword_pin_too_short"> <string name="lockpassword_pin_too_short">{count, plural,
<item quantity="one">PIN must contain at least <xliff:g id="count" example="1">%d</xliff:g> digit</item> =1 {PIN must contain at least # digit}
<item quantity="other">PIN must be at least <xliff:g id="count" example="3">%d</xliff:g> digits</item> other {PIN must be at least # digits}
</plurals> }</string>
<!-- Error shown in popup when password is too long --> <!-- Error shown in popup when password is too long -->
<plurals name="lockpassword_password_too_long"> <string name="lockpassword_password_too_long">{count, plural,
<item quantity="one">Must be fewer than <xliff:g id="number" example="1">%d</xliff:g> character</item> =1 {Must be fewer than # character}
<item quantity="other">Must be fewer than <xliff:g id="number" example="17">%d</xliff:g> characters</item> other {Must be fewer than # characters}
</plurals> }</string>
<!-- Error shown in popup when PIN is too long --> <!-- Error shown in popup when PIN is too long -->
<plurals name="lockpassword_pin_too_long"> <string name="lockpassword_pin_too_long">{count, plural,
<item quantity="one">Must be fewer than <xliff:g id="number" example="1">%d</xliff:g> digit</item> =1 {Must be fewer than # digit}
<item quantity="other">Must be fewer than <xliff:g id="number" example="17">%d</xliff:g> digits</item> other {Must be fewer than # digits}
</plurals> }</string>
<!-- Error shown when in PIN mode and PIN has been used recently. Please keep this string short! --> <!-- Error shown when in PIN mode and PIN has been used recently. Please keep this string short! -->
<string name="lockpassword_pin_recently_used">Device admin doesn\'t allow using a recent PIN</string> <string name="lockpassword_pin_recently_used">Device admin doesn\'t allow using a recent PIN</string>
@@ -1163,46 +1163,46 @@
<string name="lockpassword_illegal_character">This can\'t include an invalid character</string> <string name="lockpassword_illegal_character">This can\'t include an invalid character</string>
<!-- Error shown when in PASSWORD mode and password doesn't contain the required number of letters --> <!-- Error shown when in PASSWORD mode and password doesn't contain the required number of letters -->
<plurals name="lockpassword_password_requires_letters"> <string name="lockpassword_password_requires_letters">{count, plural,
<item quantity="one">Must contain at least 1 letter</item> =1 {Must contain at least 1 letter}
<item quantity="other">Must contain at least <xliff:g id="count" example="3">%d</xliff:g> letters</item> other {Must contain at least # letters}
</plurals> }</string>
<!-- Error shown when in PASSWORD mode and password doesn't contain the required number of lowercase letters --> <!-- Error shown when in PASSWORD mode and password doesn't contain the required number of lowercase letters -->
<plurals name="lockpassword_password_requires_lowercase"> <string name="lockpassword_password_requires_lowercase">{count, plural,
<item quantity="one">Must contain at least 1 lowercase letter</item> =1 {Must contain at least 1 lowercase letter}
<item quantity="other">Must contain at least <xliff:g id="count" example="3">%d</xliff:g> lowercase letters</item> other {Must contain at least # lowercase letters}
</plurals> }</string>
<!-- Error shown when in PASSWORD mode and password doesn't contain the required number of uppercase letters --> <!-- Error shown when in PASSWORD mode and password doesn't contain the required number of uppercase letters -->
<plurals name="lockpassword_password_requires_uppercase"> <string name="lockpassword_password_requires_uppercase">{count, plural,
<item quantity="one">Must contain at least 1 uppercase letter</item> =1 {Must contain at least 1 uppercase letter}
<item quantity="other">Must contain at least <xliff:g id="count" example="3">%d</xliff:g> uppercase letters</item> other {Must contain at least # uppercase letters}
</plurals> }</string>
<!-- Error shown when in PASSWORD mode and password doesn't contain the required number of numerical digits --> <!-- Error shown when in PASSWORD mode and password doesn't contain the required number of numerical digits -->
<plurals name="lockpassword_password_requires_numeric"> <string name="lockpassword_password_requires_numeric">{count, plural,
<item quantity="one">Must contain at least 1 numerical digit</item> =1 {Must contain at least 1 numerical digit}
<item quantity="other">Must contain at least <xliff:g id="count" example="3">%d</xliff:g> numerical digits</item> other {Must contain at least # numerical digits}
</plurals> }</string>
<!-- Error shown when in PASSWORD mode and password doesn't contain the required number of special symbols --> <!-- Error shown when in PASSWORD mode and password doesn't contain the required number of special symbols -->
<plurals name="lockpassword_password_requires_symbols"> <string name="lockpassword_password_requires_symbols">{count, plural,
<item quantity="one">Must contain at least 1 special symbol</item> =1 {Must contain at least 1 special symbol}
<item quantity="other">Must contain at least <xliff:g id="count" example="3">%d</xliff:g> special symbols</item> other {Must contain at least # special symbols}
</plurals> }</string>
<!-- Error shown when in PASSWORD mode and password doesn't contain the required number of non-letter characters --> <!-- Error shown when in PASSWORD mode and password doesn't contain the required number of non-letter characters -->
<plurals name="lockpassword_password_requires_nonletter"> <string name="lockpassword_password_requires_nonletter">{count, plural,
<item quantity="one">Must contain at least 1 non-letter character</item> =1 {Must contain at least 1 non-letter character}
<item quantity="other">Must contain at least <xliff:g id="count" example="3">%d</xliff:g> non-letter characters</item> other {Must contain at least # non-letter characters}
</plurals> }</string>
<!-- Error shown when in PASSWORD mode and password doesn't contain the required number of non-numerical characters --> <!-- Error shown when in PASSWORD mode and password doesn't contain the required number of non-numerical characters -->
<plurals name="lockpassword_password_requires_nonnumerical"> <string name="lockpassword_password_requires_nonnumerical">{count, plural,
<item quantity="one">Must contain at least 1 non-numerical character</item> =1 {Must contain at least 1 non-numerical character}
<item quantity="other">Must contain at least <xliff:g id="count" example="3">%d</xliff:g> non-numerical characters</item> other {Must contain at least # non-numerical characters}
</plurals> }</string>
<!-- Error shown when in PASSWORD mode and password has been used recently. Please keep this string short! --> <!-- Error shown when in PASSWORD mode and password has been used recently. Please keep this string short! -->
<string name="lockpassword_password_recently_used">Device admin doesn\'t allow using a recent <string name="lockpassword_password_recently_used">Device admin doesn\'t allow using a recent
@@ -1234,10 +1234,10 @@
<string name="number_of_device_admins_none">No active apps</string> <string name="number_of_device_admins_none">No active apps</string>
<!-- Summary of preference to manage device admin apps, informing the user how many device admin apps are installed and active --> <!-- Summary of preference to manage device admin apps, informing the user how many device admin apps are installed and active -->
<plurals name="number_of_device_admins"> <string name="number_of_device_admins">{count, plural,
<item quantity="one"><xliff:g id="count">%d</xliff:g> active app</item> =1 {# active app}
<item quantity="other"><xliff:g id="count">%d</xliff:g> active apps</item> other {# active apps}
</plurals> }</string>
<!-- Title of preference to manage trust agents --> <!-- Title of preference to manage trust agents -->
<string name="manage_trust_agents">Trust agents</string> <string name="manage_trust_agents">Trust agents</string>
@@ -1249,10 +1249,10 @@
<string name="manage_trust_agents_summary">None</string> <string name="manage_trust_agents_summary">None</string>
<!-- Summary of preference to manage device policies when there is trust agent--> <!-- Summary of preference to manage device policies when there is trust agent-->
<plurals name="manage_trust_agents_summary_on"> <string name="manage_trust_agents_summary_on">{count, plural,
<item quantity="one">1 active trust agent</item> =1 {1 active trust agent}
<item quantity="other"><xliff:g id="count" example="3">%d</xliff:g> active trust agents</item> other {# active trust agents}
</plurals> }</string>
<!-- Bluetooth settings --> <!-- Bluetooth settings -->
<!--Used as title on second screen after selecting Bluetooth settings --> <!--Used as title on second screen after selecting Bluetooth settings -->
@@ -1751,20 +1751,20 @@
<!-- Wi-Fi Advanced Settings --> <skip /> <!-- Wi-Fi Advanced Settings --> <skip />
<!-- Wi-Fi settings screen, Saved networks summary. This shows below the "Saved networks" item and indicates the number of networks, not including passpoint network, a user has saved. [CHAR LIMIT=30] --> <!-- Wi-Fi settings screen, Saved networks summary. This shows below the "Saved networks" item and indicates the number of networks, not including passpoint network, a user has saved. [CHAR LIMIT=30] -->
<plurals name="wifi_saved_access_points_summary"> <string name="wifi_saved_access_points_summary">{count, plural,
<item quantity="one">1 network</item> =1 {1 network}
<item quantity="other">%d networks</item> other {# networks}
</plurals> }</string>
<!-- Wi-Fi settings screen, Saved networks summary. This shows below the "Saved networks" item and indicates the number of passpoint networks a user has saved. [CHAR LIMIT=30] --> <!-- Wi-Fi settings screen, Saved networks summary. This shows below the "Saved networks" item and indicates the number of passpoint networks a user has saved. [CHAR LIMIT=30] -->
<plurals name="wifi_saved_passpoint_access_points_summary"> <string name="wifi_saved_passpoint_access_points_summary">{count, plural,
<item quantity="one">1 subscription</item> =1 {1 subscription}
<item quantity="other">%d subscriptions</item> other {# subscriptions}
</plurals> }</string>
<!-- Wi-Fi settings screen, Saved networks summary. This shows below the "Saved networks" item and indicates number of whole kinds networks, if there are both normal saved networks and saved passpoint networks. The number will be at least 2, so the one case is only to prevent lint error. [CHAR LIMIT=60] --> <!-- Wi-Fi settings screen, Saved networks summary. This shows below the "Saved networks" item and indicates number of whole kinds networks, if there are both normal saved networks and saved passpoint networks. The number will be at least 2, so the one case is only to prevent lint error. [CHAR LIMIT=60] -->
<plurals name="wifi_saved_all_access_points_summary"> <string name="wifi_saved_all_access_points_summary">{count, plural,
<item quantity="one">1 network &amp; subscription</item> =1 {1 network &amp; subscription}
<item quantity="other">%d networks &amp; subscriptions</item> other {# networks &amp; subscriptions}
</plurals> }</string>
<!-- Wi-Fi settings screen, advanced, title of the item to show the Wi-Fi device's SSID. [CHAR LIMIT=20] --> <!-- Wi-Fi settings screen, advanced, title of the item to show the Wi-Fi device's SSID. [CHAR LIMIT=20] -->
<string name="wifi_advanced_ssid_title">SSID</string> <string name="wifi_advanced_ssid_title">SSID</string>
<!-- Wi-Fi settings screen, advanced, title of the item to show the device's Wi-Fi MAC address. [CHAR LIMIT=50] --> <!-- Wi-Fi settings screen, advanced, title of the item to show the device's Wi-Fi MAC address. [CHAR LIMIT=50] -->
@@ -2372,10 +2372,10 @@
Displayed in a dialog box. [CHAR LIMIT=100] --> Displayed in a dialog box. [CHAR LIMIT=100] -->
<string name="wrong_pin_code_pukked">Incorrect SIM PIN code you must now contact your carrier to unlock your device.</string> <string name="wrong_pin_code_pukked">Incorrect SIM PIN code you must now contact your carrier to unlock your device.</string>
<!-- Instructions telling the user that they entered the wrong SIM PIN while trying to unlock the keyguard. Displayed in a dialog box. [CHAR LIMIT=100] --> <!-- Instructions telling the user that they entered the wrong SIM PIN while trying to unlock the keyguard. Displayed in a dialog box. [CHAR LIMIT=100] -->
<plurals name="wrong_pin_code"> <string name="wrong_pin_code">{count, plural,
<item quantity="one">Incorrect SIM PIN code, you have <xliff:g id="number">%d</xliff:g> remaining attempt before you must contact your carrier to unlock your device.</item> =1 {Incorrect SIM PIN code, you have # remaining attempt before you must contact your carrier to unlock your device.}
<item quantity="other">Incorrect SIM PIN code, you have <xliff:g id="number">%d</xliff:g> remaining attempts.</item> other {Incorrect SIM PIN code, you have # remaining attempts.}
</plurals> }</string>
<!-- This is instruction text to inform the user that they have entered the wrong SIM PIN while trying to unlock the keyguard. <!-- This is instruction text to inform the user that they have entered the wrong SIM PIN while trying to unlock the keyguard.
The variable will be replaced with a number. [CHAR LIMIT=NONE] --> The variable will be replaced with a number. [CHAR LIMIT=NONE] -->
@@ -2951,18 +2951,10 @@
"total_location_app_count" is almost always greater than 1, so "apps" is always in plural form. "total_location_app_count" is almost always greater than 1, so "apps" is always in plural form.
[CHAR LIMIT=NONE]--> [CHAR LIMIT=NONE]-->
<plurals name="location_app_permission_summary_location_on"> <string name="location_app_permission_summary_location_on">{count, plural,
<item quantity="one"> =1 {# of {total} apps has access to location}
<xliff:g id="permitted_location_app_count">%1$d</xliff:g> other {# of {total} apps have access to location}
of }</string>
<xliff:g id="total_location_app_count">%2$d</xliff:g>
apps has access to location</item>
<item quantity="other">
<xliff:g id="permitted_location_app_count">%1$d</xliff:g>
of
<xliff:g id="total_location_app_count">%2$d</xliff:g>
apps have access to location</item>
</plurals>
<!-- [CHAR LIMIT=50] Location settings screen, sub category for recent location access --> <!-- [CHAR LIMIT=50] Location settings screen, sub category for recent location access -->
<string name="location_category_recent_location_access">Recent access</string> <string name="location_category_recent_location_access">Recent access</string>
<!-- Location settings screen, displayed when there're more than three recent location access apps [CHAR LIMIT=30] --> <!-- Location settings screen, displayed when there're more than three recent location access apps [CHAR LIMIT=30] -->
@@ -3319,10 +3311,10 @@
<!-- Category title listing recently used apps [CHAR_LIMIT=50]--> <!-- Category title listing recently used apps [CHAR_LIMIT=50]-->
<string name="recent_app_category_title">Recently opened apps</string> <string name="recent_app_category_title">Recently opened apps</string>
<!-- Preference title for showing all apps on device [CHAR_LIMIT=50]--> <!-- Preference title for showing all apps on device [CHAR_LIMIT=50]-->
<plurals name="see_all_apps_title"> <string name="see_all_apps_title">{count, plural,
<item quantity="one">See all apps</item> =1 {See all apps}
<item quantity="other">See all %1$d apps</item> other {See all # apps}
</plurals> }</string>
<!-- Title of the dialog that asks the user to contact the IT admin to reset password [CHAR LIMIT=40] --> <!-- Title of the dialog that asks the user to contact the IT admin to reset password [CHAR LIMIT=40] -->
<string name="forgot_password_title">Contact your IT admin</string> <string name="forgot_password_title">Contact your IT admin</string>
@@ -3352,10 +3344,10 @@
<!-- Manage applications, label that appears next to the cache size --> <!-- Manage applications, label that appears next to the cache size -->
<string name="cache_size_label">Cache</string> <string name="cache_size_label">Cache</string>
<!-- Manage applications, individual application info storage screen. Describes the number of URIs (directories or files) an app has been granted access (by another apps)--> <!-- Manage applications, individual application info storage screen. Describes the number of URIs (directories or files) an app has been granted access (by another apps)-->
<plurals name="uri_permissions_text"> <string name="uri_permissions_text">{count, plural,
<item quantity="one">1 item</item> =1 {1 item}
<item quantity="other">%d items</item> other {# items}
</plurals> }</string>
<!-- Manage applications, individual application info storage screen. Button below list of URIs. --> <!-- Manage applications, individual application info storage screen. Button below list of URIs. -->
<string name="clear_uri_btn_text">Clear access</string> <string name="clear_uri_btn_text">Clear access</string>
<!-- Manage applications, Header name used for other controls --> <!-- Manage applications, Header name used for other controls -->
@@ -9629,10 +9621,10 @@
<!-- Label explaining that the the number of apps is an estimation. [CHAR LIMIT=NONE] --> <!-- Label explaining that the the number of apps is an estimation. [CHAR LIMIT=NONE] -->
<string name="enterprise_privacy_apps_count_estimation_info">Number of apps is estimated. It may not include apps installed outside of the Play Store.</string> <string name="enterprise_privacy_apps_count_estimation_info">Number of apps is estimated. It may not include apps installed outside of the Play Store.</string>
<!-- Summary indicating the number of apps that a label (e.g. installed apps or apps granted a particular permission) refers to. The number shown is a minimum as there may be additional apps we do not know about. [CHAR LIMIT=NONE] --> <!-- Summary indicating the number of apps that a label (e.g. installed apps or apps granted a particular permission) refers to. The number shown is a minimum as there may be additional apps we do not know about. [CHAR LIMIT=NONE] -->
<plurals name="enterprise_privacy_number_packages_lower_bound"> <string name="enterprise_privacy_number_packages_lower_bound">{count, plural,
<item quantity="one">Minimum <xliff:g id="count">%d</xliff:g> app</item> =1 {Minimum # app}
<item quantity="other">Minimum <xliff:g id="count">%d</xliff:g> apps</item> other {Minimum # apps}
</plurals> }</string>
<!-- Label indicating that the admin granted one or more apps access to the device's location. [CHAR LIMIT=NONE] --> <!-- 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">Location permissions</string> <string name="enterprise_privacy_location_access">Location permissions</string>
<!-- Label indicating that the admin granted one or more apps access to the microphone. [CHAR LIMIT=NONE] --> <!-- Label indicating that the admin granted one or more apps access to the microphone. [CHAR LIMIT=NONE] -->
@@ -9642,10 +9634,10 @@
<!-- 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] --> <!-- 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</string> <string name="enterprise_privacy_enterprise_set_default_apps">Default apps</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] --> <!-- 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"> <string name="enterprise_privacy_number_packages">{count, plural,
<item quantity="one"><xliff:g id="count">%d</xliff:g> app</item> =1 {# app}
<item quantity="other"><xliff:g id="count">%d</xliff:g> apps</item> other {# apps}
</plurals> }</string>
<!-- Label explaining that the current input method was set by the admin. [CHAR LIMIT=NONE] --> <!-- Label explaining that the current input method was set by the admin. [CHAR LIMIT=NONE] -->
<string name="enterprise_privacy_input_method">Default keyboard</string> <string name="enterprise_privacy_input_method">Default keyboard</string>
<!-- Summary indicating the input method set by the admin. [CHAR LIMIT=NONE] --> <!-- Summary indicating the input method set by the admin. [CHAR LIMIT=NONE] -->
@@ -9665,10 +9657,10 @@
<!-- Label explaining that the admin installed trusted CA certificates in work profile. [CHAR LIMIT=NONE] --> <!-- Label explaining that the admin installed trusted CA certificates in work profile. [CHAR LIMIT=NONE] -->
<string name="enterprise_privacy_ca_certs_work">Trusted credentials in your work profile</string> <string name="enterprise_privacy_ca_certs_work">Trusted credentials in your work profile</string>
<!-- Summary indicating the number of trusted CA certificates installed by the admin. The number shown is a minimum as there may be additional CA certificates we do not know about. [CHAR LIMIT=NONE] --> <!-- Summary indicating the number of trusted CA certificates installed by the admin. The number shown is a minimum as there may be additional CA certificates we do not know about. [CHAR LIMIT=NONE] -->
<plurals name="enterprise_privacy_number_ca_certs"> <string name="enterprise_privacy_number_ca_certs">{count, plural,
<item quantity="one">Minimum <xliff:g id="count">%d</xliff:g> CA certificate</item> =1 {Minimum # CA certificate}
<item quantity="other">Minimum <xliff:g id="count">%d</xliff:g> CA certificates</item> other {Minimum # CA certificates}
</plurals> }</string>
<!-- Label explaining that the admin can lock the device and change the user's password. [CHAR LIMIT=NONE] --> <!-- 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 the 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] --> <!-- Label explaining that the admin can wipe the device remotely. [CHAR LIMIT=NONE] -->
@@ -9678,10 +9670,10 @@
<!-- Label explaining that the admin configured the work profile to wipe itself when the password is mistyped too many times. [CHAR LIMIT=NONE] --> <!-- 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> <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] --> <!-- 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"> <string name="enterprise_privacy_number_failed_password_wipe">{count, plural,
<item quantity="one"><xliff:g id="count">%d</xliff:g> attempt</item> =1 {# attempt}
<item quantity="other"><xliff:g id="count">%d</xliff:g> attempts</item> other {# attempts}
</plurals> }</string>
<!-- Message indicating that the device is enterprise-managed by a Device Owner [CHAR LIMIT=NONE] --> <!-- Message indicating that the device is enterprise-managed by a Device Owner [CHAR LIMIT=NONE] -->
<string name="do_disclosure_generic">This device is managed by your organization.</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] --> <!-- Message indicating that the device is enterprise-managed by a Device Owner [CHAR LIMIT=NONE] -->
@@ -9742,26 +9734,26 @@
<!-- Strings for displaying which applications were set as default for specific actions. --> <!-- Strings for displaying which applications were set as default for specific actions. -->
<!-- Title for the apps that have been set as default handlers of camera-related intents. [CHAR LIMIT=30] --> <!-- Title for the apps that have been set as default handlers of camera-related intents. [CHAR LIMIT=30] -->
<plurals name="default_camera_app_title"> <string name="default_camera_app_title">{count, plural,
<item quantity="one">Camera app</item> =1 {Camera app}
<item quantity="other">Camera apps</item> other {Camera apps}
</plurals> }</string>
<!-- Title for the app that has been set as default handler of calendar-related intents. [CHAR LIMIT=30] --> <!-- Title for the app that has been set as default handler of calendar-related intents. [CHAR LIMIT=30] -->
<string name="default_calendar_app_title">Calendar app</string> <string name="default_calendar_app_title">Calendar app</string>
<!-- Title for the app that has been set as default handler of contacts-related intents. [CHAR LIMIT=30] --> <!-- Title for the app that has been set as default handler of contacts-related intents. [CHAR LIMIT=30] -->
<string name="default_contacts_app_title">Contacts app</string> <string name="default_contacts_app_title">Contacts app</string>
<!-- Title for the apps that have been set as default handlers of new email intents. [CHAR LIMIT=30] --> <!-- Title for the apps that have been set as default handlers of new email intents. [CHAR LIMIT=30] -->
<plurals name="default_email_app_title"> <string name="default_email_app_title">{count, plural,
<item quantity="one">Email client app</item> =1 {Email client app}
<item quantity="other">Email client apps</item> other {Email client apps}
</plurals> }</string>
<!-- Title for the app that has been set as default handler of geo-related intents. [CHAR LIMIT=30] --> <!-- Title for the app that has been set as default handler of geo-related intents. [CHAR LIMIT=30] -->
<string name="default_map_app_title">Map app</string> <string name="default_map_app_title">Map app</string>
<!-- Title for the apps that have been set as default handlers of call-related intents. [CHAR LIMIT=30] --> <!-- Title for the apps that have been set as default handlers of call-related intents. [CHAR LIMIT=30] -->
<plurals name="default_phone_app_title"> <string name="default_phone_app_title">{count, plural,
<item quantity="one">Phone app</item> =1 {Phone app}
<item quantity="other">Phone apps</item> other {Phone apps}
</plurals> }</string>
<!-- Template for concatenating two app names --> <!-- Template for concatenating two app names -->
<string name="app_names_concatenation_template_2"><xliff:g id="first_app_name">%1$s</xliff:g>, <xliff:g id="second_app_name">%2$s</xliff:g></string> <string name="app_names_concatenation_template_2"><xliff:g id="first_app_name">%1$s</xliff:g>, <xliff:g id="second_app_name">%2$s</xliff:g></string>
<!-- Template for concatenating three app names --> <!-- Template for concatenating three app names -->
@@ -9844,10 +9836,10 @@
<string name="credman_credentials">Password and identity services</string> <string name="credman_credentials">Password and identity services</string>
<!-- Summary for passwords settings that shows how many passwords are saved for each autofill <!-- Summary for passwords settings that shows how many passwords are saved for each autofill
service. [CHAR LIMIT=NONE] --> service. [CHAR LIMIT=NONE] -->
<plurals name="autofill_passwords_count"> <string name="autofill_passwords_count">{count, plural,
<item quantity="one"><xliff:g id="count">%1$d</xliff:g> password</item> =1 {# password}
<item quantity="other"><xliff:g id="count">%1$d</xliff:g> passwords</item> other {# passwords}
</plurals> }</string>
<!-- DO NOT TRANSLATE Summary placeholder for when the passwords count is still loading or is <!-- DO NOT TRANSLATE Summary placeholder for when the passwords count is still loading or is
unavailable. --> unavailable. -->
<string name="autofill_passwords_count_placeholder" translatable="false">\u2014</string> <string name="autofill_passwords_count_placeholder" translatable="false">\u2014</string>
@@ -10625,10 +10617,10 @@
<string name="accessibility_usage_title">Accessibility usage</string> <string name="accessibility_usage_title">Accessibility usage</string>
<!-- Summary for the accessibility usage preference in the Privacy page. [CHAR LIMIT=NONE] --> <!-- Summary for the accessibility usage preference in the Privacy page. [CHAR LIMIT=NONE] -->
<plurals name="accessibility_usage_summary"> <string name="accessibility_usage_summary">{count, plural,
<item quantity="one">1 app has full access to your device</item> =1 {1 app has full access to your device}
<item quantity="other"><xliff:g id="service_count">%1$d</xliff:g> apps have full access to your device</item> other {# apps have full access to your device}
</plurals> }</string>
<!-- Label for the title on wfc disclaimer fragment. [CHAR LIMIT=40] --> <!-- Label for the title on wfc disclaimer fragment. [CHAR LIMIT=40] -->
<string name="wfc_disclaimer_title_text">Important information</string> <string name="wfc_disclaimer_title_text">Important information</string>

View File

@@ -57,6 +57,7 @@ import androidx.preference.SwitchPreference;
import com.android.settings.network.ProxySubscriptionManager; import com.android.settings.network.ProxySubscriptionManager;
import com.android.settings.network.SubscriptionUtil; import com.android.settings.network.SubscriptionUtil;
import com.android.settingslib.utils.StringUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -674,9 +675,8 @@ public class IccLockSettings extends SettingsPreferenceFragment
} else if (attemptsRemaining == 1) { } else if (attemptsRemaining == 1) {
displayMessage = mRes.getString(R.string.wrong_pin_code_one, attemptsRemaining); displayMessage = mRes.getString(R.string.wrong_pin_code_one, attemptsRemaining);
} else if (attemptsRemaining > 1) { } else if (attemptsRemaining > 1) {
displayMessage = mRes displayMessage = StringUtil.getIcuPluralsString(getPrefContext(), attemptsRemaining,
.getQuantityString(R.plurals.wrong_pin_code, attemptsRemaining, R.string.wrong_pin_code);
attemptsRemaining);
} else { } else {
displayMessage = mRes.getString(R.string.pin_failed); displayMessage = mRes.getString(R.string.pin_failed);
} }

View File

@@ -58,6 +58,7 @@ import com.android.settingslib.applications.AppUtils;
import com.android.settingslib.applications.ApplicationsState.Callbacks; import com.android.settingslib.applications.ApplicationsState.Callbacks;
import com.android.settingslib.applications.StorageStatsSource; import com.android.settingslib.applications.StorageStatsSource;
import com.android.settingslib.applications.StorageStatsSource.AppStorageStats; import com.android.settingslib.applications.StorageStatsSource.AppStorageStats;
import com.android.settingslib.utils.StringUtil;
import com.android.settingslib.widget.ActionButtonsPreference; import com.android.settingslib.widget.ActionButtonsPreference;
import com.android.settingslib.widget.LayoutPreference; import com.android.settingslib.widget.LayoutPreference;
@@ -438,9 +439,8 @@ public class AppStorageSettings extends AppInfoWithHeader
int numberResources = entry.getValue().value; int numberResources = entry.getValue().value;
Preference pref = new Preference(getPrefContext()); Preference pref = new Preference(getPrefContext());
pref.setTitle(entry.getKey()); pref.setTitle(entry.getKey());
pref.setSummary(getPrefContext().getResources() pref.setSummary(StringUtil.getIcuPluralsString(mUri.getContext(), numberResources,
.getQuantityString(R.plurals.uri_permissions_text, numberResources, R.string.uri_permissions_text));
numberResources));
pref.setSelectable(false); pref.setSelectable(false);
pref.setLayoutResource(R.layout.horizontal_preference); pref.setLayoutResource(R.layout.horizontal_preference);
pref.setOrder(order); pref.setOrder(order);

View File

@@ -142,9 +142,8 @@ public class AppsPreferenceController extends BasePreferenceController implement
@Override @Override
protected void onCountComplete(int num) { protected void onCountComplete(int num) {
if (!mRecentApps.isEmpty()) { if (!mRecentApps.isEmpty()) {
mSeeAllPref.setTitle( mSeeAllPref.setTitle(StringUtil.getIcuPluralsString(mContext, num,
mContext.getResources().getQuantityString(R.plurals.see_all_apps_title, R.string.see_all_apps_title));
num, num));
} else { } else {
mAllAppsInfoPref.setSummary(mContext.getString(R.string.apps_summary, num)); mAllAppsInfoPref.setSummary(mContext.getString(R.string.apps_summary, num));
} }

View File

@@ -55,6 +55,7 @@ import com.android.internal.os.IResultReceiver;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.Utils; import com.android.settings.Utils;
import com.android.settings.core.BasePreferenceController; import com.android.settings.core.BasePreferenceController;
import com.android.settingslib.utils.StringUtil;
import com.android.settingslib.widget.AppPreference; import com.android.settingslib.widget.AppPreference;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
@@ -153,9 +154,8 @@ public class PasswordsPreferenceController extends BasePreferenceController
passwordCount.observe( passwordCount.observe(
mLifecycleOwner, count -> { mLifecycleOwner, count -> {
// TODO(b/169455298): Validate the result. // TODO(b/169455298): Validate the result.
final CharSequence summary = final CharSequence summary = StringUtil.getIcuPluralsString(mContext, count,
mContext.getResources().getQuantityString( R.string.autofill_passwords_count);
R.plurals.autofill_passwords_count, count, count);
pref.setSummary(summary); pref.setSummary(summary);
}); });
// TODO(b/169455298): Limit the number of concurrent queries. // TODO(b/169455298): Limit the number of concurrent queries.

View File

@@ -47,6 +47,7 @@ import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart; import com.android.settingslib.core.lifecycle.events.OnStart;
import com.android.settingslib.development.DevelopmentSettingsEnabler; import com.android.settingslib.development.DevelopmentSettingsEnabler;
import com.android.settingslib.utils.StringUtil;
import com.google.android.setupcompat.util.WizardManagerHelper; import com.google.android.setupcompat.util.WizardManagerHelper;
public class BuildNumberPreferenceController extends BasePreferenceController implements public class BuildNumberPreferenceController extends BasePreferenceController implements
@@ -181,9 +182,8 @@ public class BuildNumberPreferenceController extends BasePreferenceController im
mDevHitToast.cancel(); mDevHitToast.cancel();
} }
mDevHitToast = Toast.makeText(mContext, mDevHitToast = Toast.makeText(mContext,
mContext.getResources().getQuantityString( StringUtil.getIcuPluralsString(mContext, mDevHitCountdown,
R.plurals.show_dev_countdown, mDevHitCountdown, R.string.show_dev_countdown),
mDevHitCountdown),
Toast.LENGTH_SHORT); Toast.LENGTH_SHORT);
mDevHitToast.show(); mDevHitToast.show();
} }

View File

@@ -24,6 +24,7 @@ import com.android.settings.applications.ApplicationFeatureProvider;
import com.android.settings.core.PreferenceControllerMixin; import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.overlay.FeatureFactory; import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.core.AbstractPreferenceController; import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.utils.StringUtil;
public abstract class AdminGrantedPermissionsPreferenceControllerBase public abstract class AdminGrantedPermissionsPreferenceControllerBase
extends AbstractPreferenceController implements PreferenceControllerMixin { extends AbstractPreferenceController implements PreferenceControllerMixin {
@@ -51,9 +52,8 @@ public abstract class AdminGrantedPermissionsPreferenceControllerBase
if (num == 0) { if (num == 0) {
mHasApps = false; mHasApps = false;
} else { } else {
preference.setSummary(mContext.getResources().getQuantityString( preference.setSummary(StringUtil.getIcuPluralsString(mContext, num,
R.plurals.enterprise_privacy_number_packages_lower_bound, R.string.enterprise_privacy_number_packages_lower_bound));
num, num));
mHasApps = true; mHasApps = true;
} }
preference.setVisible(mHasApps); preference.setVisible(mHasApps);

View File

@@ -22,6 +22,7 @@ import com.android.settings.R;
import com.android.settings.core.PreferenceControllerMixin; import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.overlay.FeatureFactory; import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.core.AbstractPreferenceController; import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.utils.StringUtil;
public abstract class CaCertsPreferenceControllerBase public abstract class CaCertsPreferenceControllerBase
extends AbstractPreferenceController implements PreferenceControllerMixin { extends AbstractPreferenceController implements PreferenceControllerMixin {
@@ -36,9 +37,8 @@ public abstract class CaCertsPreferenceControllerBase
@Override @Override
public void updateState(Preference preference) { public void updateState(Preference preference) {
final int certs = getNumberOfCaCerts(); preference.setSummary(StringUtil.getIcuPluralsString(mContext, getNumberOfCaCerts(),
preference.setSummary(mContext.getResources().getQuantityString( R.string.enterprise_privacy_number_ca_certs));
R.plurals.enterprise_privacy_number_ca_certs, certs, certs));
} }
@Override @Override

View File

@@ -22,6 +22,7 @@ import com.android.settings.applications.ApplicationFeatureProvider;
import com.android.settings.core.PreferenceControllerMixin; import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.overlay.FeatureFactory; import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.core.AbstractPreferenceController; import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.utils.StringUtil;
public class EnterpriseInstalledPackagesPreferenceController public class EnterpriseInstalledPackagesPreferenceController
extends AbstractPreferenceController implements PreferenceControllerMixin { extends AbstractPreferenceController implements PreferenceControllerMixin {
@@ -47,9 +48,8 @@ public class EnterpriseInstalledPackagesPreferenceController
available = false; available = false;
} else { } else {
available = true; available = true;
preference.setSummary(mContext.getResources().getQuantityString( preference.setSummary(StringUtil.getIcuPluralsString(mContext, num,
R.plurals.enterprise_privacy_number_packages_lower_bound, num, R.string.enterprise_privacy_number_packages_lower_bound));
num));
} }
preference.setVisible(available); preference.setVisible(available);

View File

@@ -40,6 +40,7 @@ import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.overlay.FeatureFactory; import com.android.settings.overlay.FeatureFactory;
import com.android.settings.users.UserFeatureProvider; import com.android.settings.users.UserFeatureProvider;
import com.android.settingslib.core.AbstractPreferenceController; import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.utils.StringUtil;
import com.android.settingslib.utils.ThreadUtils; import com.android.settingslib.utils.ThreadUtils;
import java.util.ArrayList; import java.util.ArrayList;
@@ -192,16 +193,16 @@ public class EnterpriseSetDefaultAppsListPreferenceController extends
case CONTACTS: case CONTACTS:
return context.getString(R.string.default_contacts_app_title); return context.getString(R.string.default_contacts_app_title);
case PHONE: case PHONE:
return context.getResources() return StringUtil.getIcuPluralsString(context, appCount,
.getQuantityString(R.plurals.default_phone_app_title, appCount); R.string.default_phone_app_title);
case MAP: case MAP:
return context.getString(R.string.default_map_app_title); return context.getString(R.string.default_map_app_title);
case EMAIL: case EMAIL:
return context.getResources() return StringUtil.getIcuPluralsString(context, appCount,
.getQuantityString(R.plurals.default_email_app_title, appCount); R.string.default_email_app_title);
case CAMERA: case CAMERA:
return context.getResources() return StringUtil.getIcuPluralsString(context, appCount,
.getQuantityString(R.plurals.default_camera_app_title, appCount); R.string.default_camera_app_title);
default: default:
throw new IllegalStateException("Unknown type of default " + typeOfDefault); throw new IllegalStateException("Unknown type of default " + typeOfDefault);
} }

View File

@@ -26,6 +26,7 @@ import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.overlay.FeatureFactory; import com.android.settings.overlay.FeatureFactory;
import com.android.settings.users.UserFeatureProvider; import com.android.settings.users.UserFeatureProvider;
import com.android.settingslib.core.AbstractPreferenceController; import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.utils.StringUtil;
public class EnterpriseSetDefaultAppsPreferenceController public class EnterpriseSetDefaultAppsPreferenceController
extends AbstractPreferenceController implements PreferenceControllerMixin { extends AbstractPreferenceController implements PreferenceControllerMixin {
@@ -44,8 +45,8 @@ public class EnterpriseSetDefaultAppsPreferenceController
@Override @Override
public void updateState(Preference preference) { public void updateState(Preference preference) {
final int num = getNumberOfEnterpriseSetDefaultApps(); final int num = getNumberOfEnterpriseSetDefaultApps();
preference.setSummary(mContext.getResources().getQuantityString( preference.setSummary(StringUtil.getIcuPluralsString(mContext, num,
R.plurals.enterprise_privacy_number_packages, num, num)); R.string.enterprise_privacy_number_packages));
} }
@Override @Override

View File

@@ -22,6 +22,7 @@ import com.android.settings.R;
import com.android.settings.core.PreferenceControllerMixin; import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.overlay.FeatureFactory; import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.core.AbstractPreferenceController; import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.utils.StringUtil;
public abstract class FailedPasswordWipePreferenceControllerBase public abstract class FailedPasswordWipePreferenceControllerBase
extends AbstractPreferenceController implements PreferenceControllerMixin { extends AbstractPreferenceController implements PreferenceControllerMixin {
@@ -39,9 +40,8 @@ public abstract class FailedPasswordWipePreferenceControllerBase
@Override @Override
public void updateState(Preference preference) { public void updateState(Preference preference) {
final int failedPasswordsBeforeWipe = getMaximumFailedPasswordsBeforeWipe(); final int failedPasswordsBeforeWipe = getMaximumFailedPasswordsBeforeWipe();
preference.setSummary(mContext.getResources().getQuantityString( preference.setSummary(StringUtil.getIcuPluralsString(mContext, failedPasswordsBeforeWipe,
R.plurals.enterprise_privacy_number_failed_password_wipe, R.string.enterprise_privacy_number_failed_password_wipe));
failedPasswordsBeforeWipe, failedPasswordsBeforeWipe));
} }
@Override @Override

View File

@@ -21,6 +21,7 @@ import android.content.Context;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.core.BasePreferenceController; import com.android.settings.core.BasePreferenceController;
import com.android.settings.overlay.FeatureFactory; import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.utils.StringUtil;
public class ManageDeviceAdminPreferenceController extends BasePreferenceController { public class ManageDeviceAdminPreferenceController extends BasePreferenceController {
@@ -47,8 +48,8 @@ public class ManageDeviceAdminPreferenceController extends BasePreferenceControl
} }
// TODO: override // TODO: override
return mContext.getResources().getQuantityString(R.plurals.number_of_device_admins, return StringUtil.getIcuPluralsString(mContext, activeAdmins,
activeAdmins, activeAdmins); R.string.number_of_device_admins);
} }
@Override @Override

View File

@@ -46,6 +46,7 @@ import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.search.SearchIndexable; import com.android.settingslib.search.SearchIndexable;
import com.android.settingslib.search.SearchIndexableRaw; import com.android.settingslib.search.SearchIndexableRaw;
import com.android.settingslib.utils.StringUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -218,8 +219,8 @@ public class LocaleListEditor extends RestrictedSettingsFragment {
return; return;
} }
final String title = getResources().getQuantityString(R.plurals.dlg_remove_locales_title, final String title = StringUtil.getIcuPluralsString(getContext(), checkedCount,
checkedCount); R.string.dlg_remove_locales_title);
mShowingRemoveDialog = true; mShowingRemoveDialog = true;
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

View File

@@ -16,9 +16,12 @@ import androidx.preference.Preference;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.Utils; import com.android.settings.Utils;
import com.android.settings.core.PreferenceControllerMixin; import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.utils.StringUtil;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
public class AppLocationPermissionPreferenceController extends public class AppLocationPermissionPreferenceController extends
@@ -56,9 +59,11 @@ public class AppLocationPermissionPreferenceController extends
if (mNumTotal == -1 || mNumHasLocation == -1) { if (mNumTotal == -1 || mNumHasLocation == -1) {
return mContext.getString(R.string.location_settings_loading_app_permission_stats); return mContext.getString(R.string.location_settings_loading_app_permission_stats);
} }
return mContext.getResources().getQuantityString( Map<String, Object> arguments = new HashMap<>();
R.plurals.location_app_permission_summary_location_on, mNumHasLocation, arguments.put("count", mNumHasLocation);
mNumHasLocation, mNumTotal); arguments.put("total", mNumTotal);
return StringUtil.getIcuPluralsString(mContext, arguments,
R.string.location_app_permission_summary_location_on);
} else { } else {
return mContext.getString(R.string.location_app_permission_summary_location_off); return mContext.getString(R.string.location_app_permission_summary_location_off);
} }

View File

@@ -85,6 +85,7 @@ import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedLockUtilsInternal; import com.android.settingslib.RestrictedLockUtilsInternal;
import com.android.settingslib.search.Indexable; import com.android.settingslib.search.Indexable;
import com.android.settingslib.search.SearchIndexable; import com.android.settingslib.search.SearchIndexable;
import com.android.settingslib.utils.StringUtil;
import com.android.settingslib.utils.ThreadUtils; import com.android.settingslib.utils.ThreadUtils;
import com.android.settingslib.widget.FooterPreference; import com.android.settingslib.widget.FooterPreference;
import com.android.settingslib.widget.LayoutPreference; import com.android.settingslib.widget.LayoutPreference;
@@ -1130,22 +1131,21 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
private String getSavedNetworkSettingsSummaryText( private String getSavedNetworkSettingsSummaryText(
int numSavedNetworks, int numSavedSubscriptions) { int numSavedNetworks, int numSavedSubscriptions) {
if (getResources() == null) { if (getContext() == null) {
Log.w(TAG, "getSavedNetworkSettingsSummaryText shouldn't run if resource is not ready"); Log.w(TAG, "getSavedNetworkSettingsSummaryText shouldn't run if resource is not ready");
return null; return null;
} }
if (numSavedSubscriptions == 0) { if (numSavedSubscriptions == 0) {
return getResources().getQuantityString(R.plurals.wifi_saved_access_points_summary, return StringUtil.getIcuPluralsString(getContext(), numSavedNetworks,
numSavedNetworks, numSavedNetworks); R.string.wifi_saved_access_points_summary);
} else if (numSavedNetworks == 0) { } else if (numSavedNetworks == 0) {
return getResources().getQuantityString( return StringUtil.getIcuPluralsString(getContext(), numSavedSubscriptions,
R.plurals.wifi_saved_passpoint_access_points_summary, R.string.wifi_saved_passpoint_access_points_summary);
numSavedSubscriptions, numSavedSubscriptions);
} else { } else {
final int numTotalEntries = numSavedNetworks + numSavedSubscriptions; final int numTotalEntries = numSavedNetworks + numSavedSubscriptions;
return getResources().getQuantityString(R.plurals.wifi_saved_all_access_points_summary, return StringUtil.getIcuPluralsString(getContext(), numTotalEntries,
numTotalEntries, numTotalEntries); R.string.wifi_saved_all_access_points_summary);
} }
} }

View File

@@ -780,46 +780,38 @@ public class ChooseLockPassword extends SettingsActivity {
messages.add(getString(R.string.lockpassword_illegal_character)); messages.add(getString(R.string.lockpassword_illegal_character));
break; break;
case NOT_ENOUGH_UPPER_CASE: case NOT_ENOUGH_UPPER_CASE:
messages.add(getResources().getQuantityString( messages.add(StringUtil.getIcuPluralsString(getContext(), error.requirement,
R.plurals.lockpassword_password_requires_uppercase, R.string.lockpassword_password_requires_uppercase));
error.requirement, error.requirement));
break; break;
case NOT_ENOUGH_LOWER_CASE: case NOT_ENOUGH_LOWER_CASE:
messages.add(getResources().getQuantityString( messages.add(StringUtil.getIcuPluralsString(getContext(), error.requirement,
R.plurals.lockpassword_password_requires_lowercase, R.string.lockpassword_password_requires_lowercase));
error.requirement, error.requirement));
break; break;
case NOT_ENOUGH_LETTERS: case NOT_ENOUGH_LETTERS:
messages.add(getResources().getQuantityString( messages.add(StringUtil.getIcuPluralsString(getContext(), error.requirement,
R.plurals.lockpassword_password_requires_letters, R.string.lockpassword_password_requires_letters));
error.requirement, error.requirement));
break; break;
case NOT_ENOUGH_DIGITS: case NOT_ENOUGH_DIGITS:
messages.add(getResources().getQuantityString( messages.add(StringUtil.getIcuPluralsString(getContext(), error.requirement,
R.plurals.lockpassword_password_requires_numeric, R.string.lockpassword_password_requires_numeric));
error.requirement, error.requirement));
break; break;
case NOT_ENOUGH_SYMBOLS: case NOT_ENOUGH_SYMBOLS:
messages.add(getResources().getQuantityString( messages.add(StringUtil.getIcuPluralsString(getContext(), error.requirement,
R.plurals.lockpassword_password_requires_symbols, R.string.lockpassword_password_requires_symbols));
error.requirement, error.requirement));
break; break;
case NOT_ENOUGH_NON_LETTER: case NOT_ENOUGH_NON_LETTER:
messages.add(getResources().getQuantityString( messages.add(StringUtil.getIcuPluralsString(getContext(), error.requirement,
R.plurals.lockpassword_password_requires_nonletter, R.string.lockpassword_password_requires_nonletter));
error.requirement, error.requirement));
break; break;
case NOT_ENOUGH_NON_DIGITS: case NOT_ENOUGH_NON_DIGITS:
messages.add(getResources().getQuantityString( messages.add(StringUtil.getIcuPluralsString(getContext(), error.requirement,
R.plurals.lockpassword_password_requires_nonnumerical, R.string.lockpassword_password_requires_nonnumerical));
error.requirement, error.requirement));
break; break;
case TOO_SHORT: case TOO_SHORT:
messages.add(getResources().getQuantityString( messages.add(StringUtil.getIcuPluralsString(getContext(), error.requirement,
mIsAlphaMode mIsAlphaMode
? R.plurals.lockpassword_password_too_short ? R.string.lockpassword_password_too_short
: R.plurals.lockpassword_pin_too_short, : R.string.lockpassword_pin_too_short));
error.requirement, error.requirement));
break; break;
case TOO_SHORT_WHEN_ALL_NUMERIC: case TOO_SHORT_WHEN_ALL_NUMERIC:
messages.add( messages.add(
@@ -827,11 +819,10 @@ public class ChooseLockPassword extends SettingsActivity {
R.string.lockpassword_password_too_short_all_numeric)); R.string.lockpassword_password_too_short_all_numeric));
break; break;
case TOO_LONG: case TOO_LONG:
messages.add(getResources().getQuantityString( messages.add(StringUtil.getIcuPluralsString(getContext(),
mIsAlphaMode error.requirement + 1, mIsAlphaMode
? R.plurals.lockpassword_password_too_long ? R.string.lockpassword_password_too_long
: R.plurals.lockpassword_pin_too_long, : R.string.lockpassword_pin_too_long));
error.requirement + 1, error.requirement + 1));
break; break;
case CONTAINS_SEQUENCE: case CONTAINS_SEQUENCE:
messages.add(getString(R.string.lockpassword_pin_no_sequential_digits)); messages.add(getString(R.string.lockpassword_pin_no_sequential_digits));

View File

@@ -25,6 +25,7 @@ import androidx.preference.Preference;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.core.BasePreferenceController; import com.android.settings.core.BasePreferenceController;
import com.android.settingslib.utils.StringUtil;
import java.util.List; import java.util.List;
@@ -60,7 +61,7 @@ public class AccessibilityUsagePreferenceController extends BasePreferenceContro
@Override @Override
public CharSequence getSummary() { public CharSequence getSummary() {
return mContext.getResources().getQuantityString(R.plurals.accessibility_usage_summary, return StringUtil.getIcuPluralsString(mContext, mEnabledServiceInfos.size(),
mEnabledServiceInfos.size(), mEnabledServiceInfos.size()); R.string.accessibility_usage_summary);
} }
} }

View File

@@ -26,6 +26,7 @@ import com.android.settings.R;
import com.android.settings.core.BasePreferenceController; import com.android.settings.core.BasePreferenceController;
import com.android.settings.overlay.FeatureFactory; import com.android.settings.overlay.FeatureFactory;
import com.android.settings.security.SecurityFeatureProvider; import com.android.settings.security.SecurityFeatureProvider;
import com.android.settingslib.utils.StringUtil;
public class ManageTrustAgentsPreferenceController extends BasePreferenceController { public class ManageTrustAgentsPreferenceController extends BasePreferenceController {
@@ -56,9 +57,8 @@ public class ManageTrustAgentsPreferenceController extends BasePreferenceControl
preference.setSummary(R.string.disabled_because_no_backup_security); preference.setSummary(R.string.disabled_because_no_backup_security);
} else if (numberOfTrustAgent > 0) { } else if (numberOfTrustAgent > 0) {
preference.setEnabled(true); preference.setEnabled(true);
preference.setSummary(mContext.getResources().getQuantityString( preference.setSummary(StringUtil.getIcuPluralsString(mContext, numberOfTrustAgent,
R.plurals.manage_trust_agents_summary_on, R.string.manage_trust_agents_summary_on));
numberOfTrustAgent, numberOfTrustAgent));
} else { } else {
preference.setEnabled(true); preference.setEnabled(true);
preference.setSummary(R.string.manage_trust_agents_summary); preference.setSummary(R.string.manage_trust_agents_summary);

View File

@@ -75,6 +75,7 @@ import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedLockUtilsInternal; import com.android.settingslib.RestrictedLockUtilsInternal;
import com.android.settingslib.search.Indexable; import com.android.settingslib.search.Indexable;
import com.android.settingslib.search.SearchIndexable; import com.android.settingslib.search.SearchIndexable;
import com.android.settingslib.utils.StringUtil;
import com.android.settingslib.wifi.WifiSavedConfigUtils; import com.android.settingslib.wifi.WifiSavedConfigUtils;
import com.android.wifitrackerlib.WifiEntry; import com.android.wifitrackerlib.WifiEntry;
import com.android.wifitrackerlib.WifiEntry.ConnectCallback; import com.android.wifitrackerlib.WifiEntry.ConnectCallback;
@@ -915,17 +916,19 @@ public class WifiSettings extends RestrictedSettingsFragment
private String getSavedNetworkSettingsSummaryText( private String getSavedNetworkSettingsSummaryText(
int numSavedNetworks, int numSavedSubscriptions) { int numSavedNetworks, int numSavedSubscriptions) {
if (getContext() == null) {
return "";
}
if (numSavedSubscriptions == 0) { if (numSavedSubscriptions == 0) {
return getResources().getQuantityString(R.plurals.wifi_saved_access_points_summary, return StringUtil.getIcuPluralsString(getContext(), numSavedNetworks,
numSavedNetworks, numSavedNetworks); R.string.wifi_saved_access_points_summary);
} else if (numSavedNetworks == 0) { } else if (numSavedNetworks == 0) {
return getResources().getQuantityString( return StringUtil.getIcuPluralsString(getContext(), numSavedSubscriptions,
R.plurals.wifi_saved_passpoint_access_points_summary, R.string.wifi_saved_passpoint_access_points_summary);
numSavedSubscriptions, numSavedSubscriptions);
} else { } else {
final int numTotalEntries = numSavedNetworks + numSavedSubscriptions; final int numTotalEntries = numSavedNetworks + numSavedSubscriptions;
return getResources().getQuantityString(R.plurals.wifi_saved_all_access_points_summary, return StringUtil.getIcuPluralsString(getContext(), numTotalEntries,
numTotalEntries, numTotalEntries); R.string.wifi_saved_all_access_points_summary);
} }
} }

View File

@@ -33,6 +33,7 @@ import androidx.preference.Preference;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.applications.ApplicationFeatureProvider; import com.android.settings.applications.ApplicationFeatureProvider;
import com.android.settings.testutils.FakeFeatureFactory; import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settingslib.utils.StringUtil;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -80,6 +81,8 @@ public abstract class AdminGrantedPermissionsPreferenceControllerTestBase {
}).when(mFeatureFactory.applicationFeatureProvider) }).when(mFeatureFactory.applicationFeatureProvider)
.calculateNumberOfAppsWithAdminGrantedPermissions(eq(mPermissions), .calculateNumberOfAppsWithAdminGrantedPermissions(eq(mPermissions),
eq(async), any()); eq(async), any());
when(mContext.getResources().getString(R.string.enterprise_privacy_number_packages_lower_bound))
.thenReturn("Minimum # apps");
} }
@Test @Test
@@ -92,8 +95,8 @@ public abstract class AdminGrantedPermissionsPreferenceControllerTestBase {
assertThat(preference.isVisible()).isFalse(); assertThat(preference.isVisible()).isFalse();
setNumberOfPackagesWithAdminGrantedPermissions(20, true /* async */); setNumberOfPackagesWithAdminGrantedPermissions(20, true /* async */);
when(mContext.getResources().getQuantityString( when(StringUtil.getIcuPluralsString(mContext, 20,
R.plurals.enterprise_privacy_number_packages_lower_bound, 20, 20)) R.string.enterprise_privacy_number_packages_lower_bound))
.thenReturn("minimum 20 apps"); .thenReturn("minimum 20 apps");
mController.updateState(preference); mController.updateState(preference);
assertThat(preference.getSummary()).isEqualTo("minimum 20 apps"); assertThat(preference.getSummary()).isEqualTo("minimum 20 apps");

View File

@@ -18,6 +18,8 @@ package com.android.settings.enterprise;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@@ -29,6 +31,7 @@ import androidx.preference.Preference;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.testutils.FakeFeatureFactory; import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settingslib.utils.StringUtil;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -59,8 +62,10 @@ public abstract class CaCertsPreferenceControllerTestBase {
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(mContext.getResources().getQuantityString(R.plurals.enterprise_privacy_number_ca_certs, when(mContext.getResources().getString(R.string.enterprise_privacy_number_ca_certs))
10, 10)).thenReturn("10 certs"); .thenReturn("# certs");
when(StringUtil.getIcuPluralsString(mContext, 10,
R.string.enterprise_privacy_number_ca_certs)).thenReturn("10 certs");
mockGetNumberOfCaCerts(10); mockGetNumberOfCaCerts(10);
mController.updateState(preference); mController.updateState(preference);
assertThat(preference.getSummary()).isEqualTo("10 certs"); assertThat(preference.getSummary()).isEqualTo("10 certs");

View File

@@ -33,6 +33,7 @@ import androidx.preference.Preference;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.applications.ApplicationFeatureProvider; import com.android.settings.applications.ApplicationFeatureProvider;
import com.android.settings.testutils.FakeFeatureFactory; import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settingslib.utils.StringUtil;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -75,6 +76,8 @@ public class EnterpriseInstalledPackagesPreferenceControllerTest {
} }
}).when(mFeatureFactory.applicationFeatureProvider) }).when(mFeatureFactory.applicationFeatureProvider)
.calculateNumberOfPolicyInstalledApps(eq(async), any()); .calculateNumberOfPolicyInstalledApps(eq(async), any());
when(mContext.getResources().getString(R.string.enterprise_privacy_number_packages_lower_bound))
.thenReturn("Minimum # apps");
} }
@Test @Test
@@ -87,8 +90,8 @@ public class EnterpriseInstalledPackagesPreferenceControllerTest {
assertThat(preference.isVisible()).isFalse(); assertThat(preference.isVisible()).isFalse();
setNumberOfEnterpriseInstalledPackages(20, true /* async */); setNumberOfEnterpriseInstalledPackages(20, true /* async */);
when(mContext.getResources().getQuantityString( when(StringUtil.getIcuPluralsString(mContext, 20,
R.plurals.enterprise_privacy_number_packages_lower_bound, 20, 20)) R.string.enterprise_privacy_number_packages_lower_bound))
.thenReturn("minimum 20 apps"); .thenReturn("minimum 20 apps");
mController.updateState(preference); mController.updateState(preference);
assertThat(preference.getSummary()).isEqualTo("minimum 20 apps"); assertThat(preference.getSummary()).isEqualTo("minimum 20 apps");

View File

@@ -93,7 +93,7 @@ public class EnterpriseSetDefaultAppsListPreferenceControllerTest {
when(mContext.getString(R.string.default_browser_title)).thenReturn(BROWSER_TITLE); when(mContext.getString(R.string.default_browser_title)).thenReturn(BROWSER_TITLE);
Resources resources = spy(mContext.getResources()); Resources resources = spy(mContext.getResources());
when(mContext.getResources()).thenReturn(resources); when(mContext.getResources()).thenReturn(resources);
when(resources.getQuantityString(R.plurals.default_phone_app_title, 2)) when(resources.getString(R.string.default_phone_app_title))
.thenReturn(PHONE_TITLE); .thenReturn(PHONE_TITLE);
when(mContext.getString(R.string.app_names_concatenation_template_2)) when(mContext.getString(R.string.app_names_concatenation_template_2))
.thenReturn("%1$s, %2$s"); .thenReturn("%1$s, %2$s");

View File

@@ -39,6 +39,7 @@ import com.android.settings.R;
import com.android.settings.applications.EnterpriseDefaultApps; import com.android.settings.applications.EnterpriseDefaultApps;
import com.android.settings.applications.UserAppInfo; import com.android.settings.applications.UserAppInfo;
import com.android.settings.testutils.FakeFeatureFactory; import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settingslib.utils.StringUtil;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -101,8 +102,10 @@ public final class EnterpriseSetDefaultAppsPreferenceControllerTest {
setEnterpriseSetDefaultApps(EnterpriseDefaultApps.CALENDAR.getIntents(), 16); setEnterpriseSetDefaultApps(EnterpriseDefaultApps.CALENDAR.getIntents(), 16);
setEnterpriseSetDefaultApps(EnterpriseDefaultApps.CONTACTS.getIntents(), 32); setEnterpriseSetDefaultApps(EnterpriseDefaultApps.CONTACTS.getIntents(), 32);
setEnterpriseSetDefaultApps(EnterpriseDefaultApps.PHONE.getIntents(), 64); setEnterpriseSetDefaultApps(EnterpriseDefaultApps.PHONE.getIntents(), 64);
when(mContext.getResources().getQuantityString(R.plurals.enterprise_privacy_number_packages, when(mContext.getResources().getString(R.string.enterprise_privacy_number_packages))
127, 127)).thenReturn("127 apps"); .thenReturn("# apps");
when(StringUtil.getIcuPluralsString(mContext, 127,
R.string.enterprise_privacy_number_packages)).thenReturn("127 apps");
// As setEnterpriseSetDefaultApps uses fake Users, we need to list them via UserManager. // As setEnterpriseSetDefaultApps uses fake Users, we need to list them via UserManager.
configureUsers(64); configureUsers(64);

View File

@@ -29,6 +29,7 @@ import androidx.preference.Preference;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.testutils.FakeFeatureFactory; import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settingslib.utils.StringUtil;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -68,8 +69,10 @@ public abstract class FailedPasswordWipePreferenceControllerTestBase {
final Preference preference = new Preference(mContext, null, 0, 0); final Preference preference = new Preference(mContext, null, 0, 0);
setMaximumFailedPasswordsBeforeWipe(10); setMaximumFailedPasswordsBeforeWipe(10);
when(mContext.getResources().getQuantityString( when(mContext.getResources().getString(
R.plurals.enterprise_privacy_number_failed_password_wipe, 10, 10)) R.string.enterprise_privacy_number_failed_password_wipe)).thenReturn("# attempts");
when(StringUtil.getIcuPluralsString(mContext, 10,
R.string.enterprise_privacy_number_failed_password_wipe))
.thenReturn("10 attempts"); .thenReturn("10 attempts");
mController.updateState(preference); mController.updateState(preference);
assertThat(preference.getSummary()).isEqualTo("10 attempts"); assertThat(preference.getSummary()).isEqualTo("10 attempts");

View File

@@ -28,6 +28,7 @@ import androidx.preference.Preference;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.testutils.FakeFeatureFactory; import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settingslib.utils.StringUtil;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -70,7 +71,8 @@ public class ManageDeviceAdminPreferenceControllerTest {
when(mFeatureFactory.enterprisePrivacyFeatureProvider when(mFeatureFactory.enterprisePrivacyFeatureProvider
.getNumberOfActiveDeviceAdminsForCurrentUserAndManagedProfile()).thenReturn(5); .getNumberOfActiveDeviceAdminsForCurrentUserAndManagedProfile()).thenReturn(5);
when(mResources.getQuantityString(R.plurals.number_of_device_admins, 5, 5)) when(mResources.getString(R.string.number_of_device_admins)).thenReturn("# active apps");
when(StringUtil.getIcuPluralsString(mContext, 5, R.string.number_of_device_admins))
.thenReturn("5 active apps"); .thenReturn("5 active apps");
mController.updateState(preference); mController.updateState(preference);
assertThat(preference.getSummary()).isEqualTo("5 active apps"); assertThat(preference.getSummary()).isEqualTo("5 active apps");

View File

@@ -13,6 +13,7 @@ import androidx.lifecycle.LifecycleOwner;
import com.android.settings.R; import com.android.settings.R;
import com.android.settingslib.core.lifecycle.Lifecycle; import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.utils.StringUtil;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -22,6 +23,9 @@ import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner; import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment; import org.robolectric.RuntimeEnvironment;
import java.util.HashMap;
import java.util.Map;
@RunWith(RobolectricTestRunner.class) @RunWith(RobolectricTestRunner.class)
public class AppLocationPermissionPreferenceControllerTest { public class AppLocationPermissionPreferenceControllerTest {
@@ -86,8 +90,11 @@ public class AppLocationPermissionPreferenceControllerTest {
mController.mNumHasLocation = 1; mController.mNumHasLocation = 1;
mController.mNumTotal = 1; mController.mNumTotal = 1;
assertThat(mController.getSummary()).isEqualTo(mContext.getResources().getQuantityString( Map<String, Object> arguments = new HashMap<>();
R.plurals.location_app_permission_summary_location_on, 1, 1, 1)); arguments.put("count", 1);
arguments.put("total", 1);
assertThat(mController.getSummary()).isEqualTo(StringUtil.getIcuPluralsString(mContext,
arguments, R.string.location_app_permission_summary_location_on));
} }
@Test @Test
@@ -96,7 +103,10 @@ public class AppLocationPermissionPreferenceControllerTest {
mController.mNumHasLocation = 5; mController.mNumHasLocation = 5;
mController.mNumTotal = 10; mController.mNumTotal = 10;
assertThat(mController.getSummary()).isEqualTo(mContext.getResources().getQuantityString( Map<String, Object> arguments = new HashMap<>();
R.plurals.location_app_permission_summary_location_on, 5, 5, 10)); arguments.put("count", 5);
arguments.put("total", 10);
assertThat(mController.getSummary()).isEqualTo(StringUtil.getIcuPluralsString(mContext,
arguments, R.string.location_app_permission_summary_location_on));
} }
} }

View File

@@ -75,6 +75,7 @@ import com.android.settings.wifi.ConnectedWifiEntryPreference;
import com.android.settings.wifi.LongPressWifiEntryPreference; import com.android.settings.wifi.LongPressWifiEntryPreference;
import com.android.settings.wifi.WifiConfigController2; import com.android.settings.wifi.WifiConfigController2;
import com.android.settings.wifi.WifiDialog2; import com.android.settings.wifi.WifiDialog2;
import com.android.settingslib.utils.StringUtil;
import com.android.settingslib.widget.FooterPreference; import com.android.settingslib.widget.FooterPreference;
import com.android.settingslib.widget.LayoutPreference; import com.android.settingslib.widget.LayoutPreference;
import com.android.wifitrackerlib.WifiEntry; import com.android.wifitrackerlib.WifiEntry;
@@ -206,9 +207,8 @@ public class NetworkProviderSettingsTest {
assertThat(mNetworkProviderSettings.mSavedNetworksPreference.isVisible()).isTrue(); assertThat(mNetworkProviderSettings.mSavedNetworksPreference.isVisible()).isTrue();
assertThat(mNetworkProviderSettings.mSavedNetworksPreference.getSummary()).isEqualTo( assertThat(mNetworkProviderSettings.mSavedNetworksPreference.getSummary()).isEqualTo(
mContext.getResources().getQuantityString( StringUtil.getIcuPluralsString(mContext, NUM_NETWORKS,
R.plurals.wifi_saved_access_points_summary, R.string.wifi_saved_access_points_summary));
NUM_NETWORKS, NUM_NETWORKS));
} }
@Test @Test
@@ -220,9 +220,8 @@ public class NetworkProviderSettingsTest {
assertThat(mNetworkProviderSettings.mSavedNetworksPreference.isVisible()).isTrue(); assertThat(mNetworkProviderSettings.mSavedNetworksPreference.isVisible()).isTrue();
assertThat(mNetworkProviderSettings.mSavedNetworksPreference.getSummary()).isEqualTo( assertThat(mNetworkProviderSettings.mSavedNetworksPreference.getSummary()).isEqualTo(
mContext.getResources().getQuantityString( StringUtil.getIcuPluralsString(mContext, NUM_NETWORKS,
R.plurals.wifi_saved_passpoint_access_points_summary, R.string.wifi_saved_passpoint_access_points_summary));
NUM_NETWORKS, NUM_NETWORKS));
} }
@Test @Test
@@ -234,9 +233,8 @@ public class NetworkProviderSettingsTest {
assertThat(mNetworkProviderSettings.mSavedNetworksPreference.isVisible()).isTrue(); assertThat(mNetworkProviderSettings.mSavedNetworksPreference.isVisible()).isTrue();
assertThat(mNetworkProviderSettings.mSavedNetworksPreference.getSummary()).isEqualTo( assertThat(mNetworkProviderSettings.mSavedNetworksPreference.getSummary()).isEqualTo(
mContext.getResources().getQuantityString( StringUtil.getIcuPluralsString(mContext, NUM_NETWORKS * 2,
R.plurals.wifi_saved_all_access_points_summary, R.string.wifi_saved_all_access_points_summary));
NUM_NETWORKS * 2, NUM_NETWORKS * 2));
} }
@Test @Test

View File

@@ -29,6 +29,7 @@ import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.security.trustagent.TrustAgentManager.TrustAgentComponentInfo; import com.android.settings.security.trustagent.TrustAgentManager.TrustAgentComponentInfo;
import com.android.settings.testutils.FakeFeatureFactory; import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settingslib.utils.StringUtil;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -114,8 +115,8 @@ public class ManageTrustAgentsPreferenceControllerTest {
assertThat(mPreference.isEnabled()).isTrue(); assertThat(mPreference.isEnabled()).isTrue();
assertThat(mPreference.getSummary()) assertThat(mPreference.getSummary())
.isEqualTo(mContext.getResources().getQuantityString( .isEqualTo(StringUtil.getIcuPluralsString(mContext, 1,
R.plurals.manage_trust_agents_summary_on, 1, 1)); R.string.manage_trust_agents_summary_on));
} }
@Test @Test

View File

@@ -56,6 +56,7 @@ import com.android.settings.R;
import com.android.settings.datausage.DataUsagePreference; import com.android.settings.datausage.DataUsagePreference;
import com.android.settings.testutils.shadow.ShadowDataUsageUtils; import com.android.settings.testutils.shadow.ShadowDataUsageUtils;
import com.android.settings.testutils.shadow.ShadowFragment; import com.android.settings.testutils.shadow.ShadowFragment;
import com.android.settingslib.utils.StringUtil;
import com.android.wifitrackerlib.WifiEntry; import com.android.wifitrackerlib.WifiEntry;
import com.android.wifitrackerlib.WifiPickerTracker; import com.android.wifitrackerlib.WifiPickerTracker;
@@ -130,9 +131,8 @@ public class WifiSettingsTest {
assertThat(mWifiSettings.mSavedNetworksPreference.isVisible()).isTrue(); assertThat(mWifiSettings.mSavedNetworksPreference.isVisible()).isTrue();
assertThat(mWifiSettings.mSavedNetworksPreference.getSummary()).isEqualTo( assertThat(mWifiSettings.mSavedNetworksPreference.getSummary()).isEqualTo(
mContext.getResources().getQuantityString( StringUtil.getIcuPluralsString(mContext, NUM_NETWORKS,
R.plurals.wifi_saved_access_points_summary, R.string.wifi_saved_access_points_summary));
NUM_NETWORKS, NUM_NETWORKS));
} }
@Test @Test
@@ -144,9 +144,8 @@ public class WifiSettingsTest {
assertThat(mWifiSettings.mSavedNetworksPreference.isVisible()).isTrue(); assertThat(mWifiSettings.mSavedNetworksPreference.isVisible()).isTrue();
assertThat(mWifiSettings.mSavedNetworksPreference.getSummary()).isEqualTo( assertThat(mWifiSettings.mSavedNetworksPreference.getSummary()).isEqualTo(
mContext.getResources().getQuantityString( StringUtil.getIcuPluralsString(mContext, NUM_NETWORKS,
R.plurals.wifi_saved_passpoint_access_points_summary, R.string.wifi_saved_passpoint_access_points_summary));
NUM_NETWORKS, NUM_NETWORKS));
} }
@Test @Test
@@ -158,9 +157,8 @@ public class WifiSettingsTest {
assertThat(mWifiSettings.mSavedNetworksPreference.isVisible()).isTrue(); assertThat(mWifiSettings.mSavedNetworksPreference.isVisible()).isTrue();
assertThat(mWifiSettings.mSavedNetworksPreference.getSummary()).isEqualTo( assertThat(mWifiSettings.mSavedNetworksPreference.getSummary()).isEqualTo(
mContext.getResources().getQuantityString( StringUtil.getIcuPluralsString(mContext, NUM_NETWORKS * 2,
R.plurals.wifi_saved_all_access_points_summary, R.string.wifi_saved_all_access_points_summary));
NUM_NETWORKS*2, NUM_NETWORKS*2));
} }
@Test @Test