Refactor Reset options Settings

Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference

Bug: 161896447
Test: robotest & manual
Change-Id: I94969f6903d047b9bc41b1e8c14096c92c460b38
This commit is contained in:
Edgar Wang
2020-08-04 23:13:05 +08:00
parent 867e9db69d
commit 21f8cb3a44
21 changed files with 254 additions and 259 deletions

View File

@@ -77,7 +77,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="32dip" android:layout_margin="32dip"
android:text="@string/master_clear_button_text" android:text="@string/main_clear_button_text"
android:visibility="gone" android:visibility="gone"
/> />
</LinearLayout> </LinearLayout>

View File

@@ -100,7 +100,7 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_marginBottom="80dip" android:layout_marginBottom="80dip"
android:layout_marginEnd="16dip" android:layout_marginEnd="16dip"
android:text="@string/master_clear_button_text" android:text="@string/main_clear_button_text"
android:visibility="gone" android:visibility="gone"
/> />

View File

@@ -73,7 +73,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="32dip" android:layout_margin="32dip"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/master_clear_button_text" android:text="@string/main_clear_button_text"
android:visibility="gone" android:visibility="gone"
/> />

View File

@@ -23,17 +23,17 @@
android:orientation="vertical" android:orientation="vertical"
android:theme="@style/GlifV3Theme.Footer" android:theme="@style/GlifV3Theme.Footer"
android:icon="@drawable/ic_delete_accent" android:icon="@drawable/ic_delete_accent"
app:sucHeaderText="@string/master_clear_title"> app:sucHeaderText="@string/main_clear_title">
<ScrollView <ScrollView
android:id="@+id/master_clear_scrollview" android:id="@+id/main_clear_scrollview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginStart="@dimen/reset_master_clear_margin_start" android:layout_marginStart="@dimen/reset_main_clear_margin_start"
android:layout_marginEnd="@dimen/reset_master_clear_margin_end"> android:layout_marginEnd="@dimen/reset_main_clear_margin_end">
<LinearLayout <LinearLayout
android:id="@+id/master_clear_container" android:id="@+id/main_clear_container"
style="@style/SudContentFrame" style="@style/SudContentFrame"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -44,35 +44,35 @@
android:id="@+id/sud_layout_description" android:id="@+id/sud_layout_description"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/master_clear_desc"/> android:text="@string/main_clear_desc"/>
<TextView <TextView
android:id="@+id/also_erases_external" android:id="@+id/also_erases_external"
style="@style/TextAppearance.SudGlifItemSummary" style="@style/TextAppearance.SudGlifItemSummary"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" android:visibility="gone"
android:text="@string/master_clear_desc_also_erases_external"/> android:text="@string/main_clear_desc_also_erases_external"/>
<TextView <TextView
android:id="@+id/also_erases_esim" android:id="@+id/also_erases_esim"
style="@style/TextAppearance.SudGlifItemSummary" style="@style/TextAppearance.SudGlifItemSummary"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" android:visibility="gone"
android:text="@string/master_clear_desc_also_erases_esim"/> android:text="@string/main_clear_desc_also_erases_esim"/>
<TextView <TextView
android:id="@+id/accounts_label" android:id="@+id/accounts_label"
style="@style/TextAppearance.SudGlifItemSummary" style="@style/TextAppearance.SudGlifItemSummary"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" android:visibility="gone"
android:text="@string/master_clear_accounts"/> android:text="@string/main_clear_accounts"/>
<LinearLayout <LinearLayout
android:id="@+id/accounts" android:id="@+id/accounts"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone"> android:visibility="gone">
<!-- Do not add any children here as they will be removed in the MasterClear.java <!-- Do not add any children here as they will be removed in the MainClear.java
code. A list of accounts will be inserted programmatically. --> code. A list of accounts will be inserted programmatically. -->
</LinearLayout> </LinearLayout>
<TextView <TextView
@@ -81,20 +81,20 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" android:visibility="gone"
android:text="@string/master_clear_other_users_present"/> android:text="@string/main_clear_other_users_present"/>
<TextView <TextView
android:id="@+id/no_cancel_mobile_plan" android:id="@+id/no_cancel_mobile_plan"
style="@style/TextAppearance.SudGlifItemSummary" style="@style/TextAppearance.SudGlifItemSummary"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" android:visibility="gone"
android:text="@string/master_clear_desc_no_cancel_mobile_plan"/> android:text="@string/main_clear_desc_no_cancel_mobile_plan"/>
<TextView <TextView
android:id="@+id/erase_external_option_text" android:id="@+id/erase_external_option_text"
style="@style/TextAppearance.SudGlifItemSummary" style="@style/TextAppearance.SudGlifItemSummary"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/master_clear_desc_erase_external_storage"/> android:text="@string/main_clear_desc_erase_external_storage"/>
<LinearLayout <LinearLayout
android:id="@+id/erase_external_container" android:id="@+id/erase_external_container"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -22,7 +22,7 @@
android:theme="@style/SudThemeGlifV3.DayNight" android:theme="@style/SudThemeGlifV3.DayNight"
android:id="@+id/setup_wizard_layout" android:id="@+id/setup_wizard_layout"
android:icon="@drawable/ic_delete_accent" android:icon="@drawable/ic_delete_accent"
app:sucHeaderText="@string/master_clear_confirm_title"> app:sucHeaderText="@string/main_clear_confirm_title">
<LinearLayout <LinearLayout
style="@style/SudContentFrame" style="@style/SudContentFrame"
@@ -35,6 +35,6 @@
style="@style/SudItemTitle.GlifDescription" style="@style/SudItemTitle.GlifDescription"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/master_clear_final_desc"/> android:text="@string/main_clear_final_desc"/>
</LinearLayout> </LinearLayout>
</com.google.android.setupdesign.GlifLayout> </com.google.android.setupdesign.GlifLayout>

View File

@@ -34,6 +34,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center" android:gravity="center"
android:text="@string/master_clear_not_available" android:text="@string/main_clear_not_available"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="?android:attr/textAppearanceMedium" />
</FrameLayout> </FrameLayout>

View File

@@ -326,8 +326,8 @@
<!-- Margin for the reset screens --> <!-- Margin for the reset screens -->
<dimen name="reset_network_margin_start">72dp</dimen> <dimen name="reset_network_margin_start">72dp</dimen>
<dimen name="reset_network_margin_end">12dp</dimen> <dimen name="reset_network_margin_end">12dp</dimen>
<dimen name="reset_master_clear_margin_start">32dp</dimen> <dimen name="reset_main_clear_margin_start">32dp</dimen>
<dimen name="reset_master_clear_margin_end">12dp</dimen> <dimen name="reset_main_clear_margin_end">12dp</dimen>
<!-- Padding for the reset screens --> <!-- Padding for the reset screens -->
<dimen name="reset_checkbox_padding_end">8dp</dimen> <dimen name="reset_checkbox_padding_end">8dp</dimen>

View File

@@ -2341,7 +2341,7 @@
<!-- Label for Wifi hotspot name. --> <!-- Label for Wifi hotspot name. -->
<string name="wifi_hotspot_name_title">Hotspot name</string> <string name="wifi_hotspot_name_title">Hotspot name</string>
<!-- Summary for Wifi hotspot name when connection is in progress. --> <!-- Summary for Wifi hotspot name when connection is in progress. -->
<string name="wifi_hotspot_name_summary_connecting">Turning on <xliff:g id="wifi_hotspot_name">%1$s</xliff:g>...</string> <string name="wifi_hotspot_name_summary_connecting">Turning on <xliff:g id="wifi_hotspot_name">%1$s</xliff:g>\u2026</string>
<!-- Summary for Wifi hotspot name when connected. --> <!-- Summary for Wifi hotspot name when connected. -->
<string name="wifi_hotspot_name_summary_connected">Other devices can connect to <xliff:g id="wifi_hotspot_name">%1$s</xliff:g></string> <string name="wifi_hotspot_name_summary_connected">Other devices can connect to <xliff:g id="wifi_hotspot_name">%1$s</xliff:g></string>
<!-- Label for Wifi hotspot password. --> <!-- Label for Wifi hotspot password. -->
@@ -3715,29 +3715,29 @@
<!-- Message of the error message shown when error happens during erase eSIM data [CHAR LIMIT=NONE] --> <!-- Message of the error message shown when error happens during erase eSIM data [CHAR LIMIT=NONE] -->
<string name="reset_esim_error_msg">Downloaded SIMs can\u2019t be erased due to an error.\n\nRestart your device and try again.</string> <string name="reset_esim_error_msg">Downloaded SIMs can\u2019t be erased due to an error.\n\nRestart your device and try again.</string>
<!-- Master Clear --> <!-- Main Clear -->
<!-- Button title to factory data reset the entire device --> <!-- Button title to factory data reset the entire device [CHAR LIMIT=NONE] -->
<string name="master_clear_title">Erase all data (factory reset)</string> <string name="main_clear_title">Erase all data (factory reset)</string>
<!-- Button title to factory data reset the entire device. The "(factory reset)" part is optional for translation. [CHAR LIMIT=30 BACKUP_MESSAGE_ID=3531267871084279512]--> <!-- Button title to factory data reset the entire device. The "(factory reset)" part is optional for translation. [CHAR LIMIT=30 BACKUP_MESSAGE_ID=3531267871084279512]-->
<string name="master_clear_short_title">Erase all data (factory reset)</string> <string name="main_clear_short_title">Erase all data (factory reset)</string>
<!-- SD card & phone storage settings screen, message on screen after user selects Factory data reset [CHAR LIMIT=NONE] --> <!-- SD card & phone storage settings screen, message on screen after user selects Factory data reset [CHAR LIMIT=NONE] -->
<string name="master_clear_desc" product="tablet">"This will erase all data from your tablet\u2019s <b>internal storage</b>, including:\n\n<li>Your Google Account</li>\n<li>System and app data and settings</li>\n<li>Downloaded apps</li>"</string> <string name="main_clear_desc" product="tablet">"This will erase all data from your tablet\u2019s <b>internal storage</b>, including:\n\n<li>Your Google Account</li>\n<li>System and app data and settings</li>\n<li>Downloaded apps</li>"</string>
<!-- SD card & phone storage settings screen, message on screen after user selects Factory data reset [CHAR LIMIT=NONE] --> <!-- SD card & phone storage settings screen, message on screen after user selects Factory data reset [CHAR LIMIT=NONE] -->
<string name="master_clear_desc" product="default">"This will erase all data from your phone\u2019s <b>internal storage</b>, including:\n\n<li>Your Google Account</li>\n<li>System and app data and settings</li>\n<li>Downloaded apps</li>"</string> <string name="main_clear_desc" product="default">"This will erase all data from your phone\u2019s <b>internal storage</b>, including:\n\n<li>Your Google Account</li>\n<li>System and app data and settings</li>\n<li>Downloaded apps</li>"</string>
<!-- SD card & phone storage settings screen, instructions and list of current accounts. The list of accounts follows this text[CHAR LIMIT=NONE] --> <!-- SD card & phone storage settings screen, instructions and list of current accounts. The list of accounts follows this text[CHAR LIMIT=NONE] -->
<string name="master_clear_accounts" product="default">"\n\nYou are currently signed into the following accounts:\n"</string> <string name="main_clear_accounts" product="default">"\n\nYou are currently signed into the following accounts:\n"</string>
<!-- SD card & phone storage settings screen, notification if other users are present on the device [CHAR LIMIT=NONE] --> <!-- SD card & phone storage settings screen, notification if other users are present on the device [CHAR LIMIT=NONE] -->
<string name="master_clear_other_users_present" product="default">"\n\nThere are other users present on this device.\n"</string> <string name="main_clear_other_users_present" product="default">"\n\nThere are other users present on this device.\n"</string>
<!-- SD card & phone storage settings screen, list of items in user data storage (USB storage or SD card) that will be erased during this operation [CHAR LIMIT=NONE] --> <!-- SD card & phone storage settings screen, list of items in user data storage (USB storage or SD card) that will be erased during this operation [CHAR LIMIT=NONE] -->
<string name="master_clear_desc_also_erases_external">"<li>Music</li>\n<li>Photos</li>\n<li>Other user data</li>"</string> <string name="main_clear_desc_also_erases_external">"<li>Music</li>\n<li>Photos</li>\n<li>Other user data</li>"</string>
<!-- SD card & phone storage settings screen, list of items on an eSIM (embedded SIM) that will be erased during this operation [CHAR LIMIT=NONE] --> <!-- SD card & phone storage settings screen, list of items on an eSIM (embedded SIM) that will be erased during this operation [CHAR LIMIT=NONE] -->
<string name="master_clear_desc_also_erases_esim">"<li>eSIMs</li>"</string> <string name="main_clear_desc_also_erases_esim">"<li>eSIMs</li>"</string>
<!-- SD card & phone storage settings screen, notification if there are eSIM (embedded SIM) profiles present that the user's mobile service plan will not be canceled [CHAR LIMIT=NONE] --> <!-- SD card & phone storage settings screen, notification if there are eSIM (embedded SIM) profiles present that the user's mobile service plan will not be canceled [CHAR LIMIT=NONE] -->
<string name="master_clear_desc_no_cancel_mobile_plan">"\n\nThis will not cancel your mobile service plan.</string> <string name="main_clear_desc_no_cancel_mobile_plan">"\n\nThis will not cancel your mobile service plan.</string>
<!-- SD card & phone storage settings screen, instructions about whether to also erase the external storage (SD card) when erasing the internal storage [CHAR LIMIT=NONE] --> <!-- SD card & phone storage settings screen, instructions about whether to also erase the external storage (SD card) when erasing the internal storage [CHAR LIMIT=NONE] -->
<string name="master_clear_desc_erase_external_storage" product="nosdcard">"\n\nTo clear music, pictures, and other user data, the <b>USB storage</b> needs to be erased."</string> <string name="main_clear_desc_erase_external_storage" product="nosdcard">"\n\nTo clear music, pictures, and other user data, the <b>USB storage</b> needs to be erased."</string>
<!-- SD card & phone storage settings screen, instructions about whether to also erase the external storage (SD card) when erasing the internal storage [CHAR LIMIT=NONE] --> <!-- SD card & phone storage settings screen, instructions about whether to also erase the external storage (SD card) when erasing the internal storage [CHAR LIMIT=NONE] -->
<string name="master_clear_desc_erase_external_storage" product="default">"\n\nTo clear music, pictures, and other user data, the <b>SD card</b> needs to be erased."</string> <string name="main_clear_desc_erase_external_storage" product="default">"\n\nTo clear music, pictures, and other user data, the <b>SD card</b> needs to be erased."</string>
<!-- SD card & phone storage settings screen, label for check box to erase USB storage [CHAR LIMIT=30] --> <!-- SD card & phone storage settings screen, label for check box to erase USB storage [CHAR LIMIT=30] -->
<string name="erase_external_storage" product="nosdcard">Erase USB storage</string> <string name="erase_external_storage" product="nosdcard">Erase USB storage</string>
<!-- SD card & phone storage settings screen, label for check box to erase SD card [CHAR LIMIT=30] --> <!-- SD card & phone storage settings screen, label for check box to erase SD card [CHAR LIMIT=30] -->
@@ -3746,26 +3746,22 @@
<string name="erase_external_storage_description" product="nosdcard">Erase all the data on the internal USB storage, such as music or photos</string> <string name="erase_external_storage_description" product="nosdcard">Erase all the data on the internal USB storage, such as music or photos</string>
<!-- SD card & phone storage settings screen, description for check box to erase USB storage [CHAR LIMIT=NONE] --> <!-- SD card & phone storage settings screen, description for check box to erase USB storage [CHAR LIMIT=NONE] -->
<string name="erase_external_storage_description" product="default">Erase all the data on the SD card, such as music or photos</string> <string name="erase_external_storage_description" product="default">Erase all the data on the SD card, such as music or photos</string>
<!-- SD card & phone storage settings screen, button on screen after user selects Factory data reset --> <!-- SD card & phone storage settings screen, button on screen after user selects Factory data reset [CHAR LIMIT=NONE] -->
<string name="master_clear_button_text" product="tablet">Erase all data</string> <string name="main_clear_button_text" product="tablet">Erase all data</string>
<!-- SD card & phone storage settings screen, button on screen after user selects Factory data reset --> <!-- SD card & phone storage settings screen, button on screen after user selects Factory data reset [CHAR LIMIT=NONE] -->
<string name="master_clear_button_text" product="default">Erase all data</string> <string name="main_clear_button_text" product="default">Erase all data</string>
<!-- SD card & phone storage settings screen, message on screen after user selects Reset phone button -->
<string name="master_clear_final_desc">All of your personal information and downloaded apps will be deleted. You can\u2019t undo this action.</string>
<!-- SD card & phone storage settings screen, message on screen after user selects Reset phone button [CHAR LIMIT=NONE] --> <!-- SD card & phone storage settings screen, message on screen after user selects Reset phone button [CHAR LIMIT=NONE] -->
<string name="master_clear_final_desc_esim">All of your personal information, including downloaded apps &amp; SIMs, will be deleted. You can\u2019t undo this action.</string> <string name="main_clear_final_desc">All of your personal information and downloaded apps will be deleted. You can\u2019t undo this action.</string>
<!-- SD card & phone storage settings screen, button on screen after user selects Reset phone button --> <!-- SD card & phone storage settings screen, message on screen after user selects Reset phone button [CHAR LIMIT=NONE] -->
<string name="master_clear_final_button_text">Erase everything</string> <string name="main_clear_final_desc_esim">All of your personal information, including downloaded apps &amp; SIMs, will be deleted. You can\u2019t undo this action.</string>
<!-- Master clear failed message --> <!-- Main clear confirmation screen title [CHAR LIMIT=33] -->
<string name="master_clear_failed">No reset was performed because the System Clear service isn\u2019t available.</string> <string name="main_clear_confirm_title">Erase all data?</string>
<!-- Master clear confirmation screen title [CHAR LIMIT=33] -->
<string name="master_clear_confirm_title">Erase all data?</string>
<!-- Error message for users that aren't allowed to factory reset [CHAR LIMIT=none] --> <!-- Error message for users that aren't allowed to factory reset [CHAR LIMIT=none] -->
<string name="master_clear_not_available">Factory reset is not available for this user</string> <string name="main_clear_not_available">Factory reset is not available for this user</string>
<!-- Master clear progress screen title [CHAR LIMIT=30] --> <!-- Main clear progress screen title [CHAR LIMIT=30] -->
<string name="master_clear_progress_title" >Erasing</string> <string name="main_clear_progress_title" >Erasing</string>
<!-- Master clear progress screen text [CHAR LIMIT=75] --> <!-- Main clear progress screen text [CHAR LIMIT=75] -->
<string name="master_clear_progress_text">Please wait...</string> <string name="main_clear_progress_text">Please wait\u2026</string>
<!-- Main settings screen, Call settings title for item to go into the call settings --> <!-- Main settings screen, Call settings title for item to go into the call settings -->
<string name="call_settings_title">Call settings</string> <string name="call_settings_title">Call settings</string>
@@ -5124,8 +5120,8 @@
<string name="accessibility_ring_vibration_title">Ring vibration</string> <string name="accessibility_ring_vibration_title">Ring vibration</string>
<!-- Title for accessibility preference for configuring touch feedback vibrations. --> <!-- Title for accessibility preference for configuring touch feedback vibrations. -->
<string name="accessibility_touch_vibration_title">Touch feedback</string> <string name="accessibility_touch_vibration_title">Touch feedback</string>
<!-- Used in the accessibility service settings to control turning on/off the service entirely --> <!-- Used in the accessibility service settings to control turning on/off the service entirely [CHAR LIMIT=60] -->
<string name="accessibility_service_master_switch_title">Use <xliff:g id="accessibility_app_name" example="TalkBack">%1$s</xliff:g></string> <string name="accessibility_service_primary_switch_title">Use <xliff:g id="accessibility_app_name" example="TalkBack">%1$s</xliff:g></string>
<!-- Used in the accessibility service settings to open the activity. [CHAR LIMIT=NONE] --> <!-- Used in the accessibility service settings to open the activity. [CHAR LIMIT=NONE] -->
<string name="accessibility_service_master_open_title">Open <xliff:g id="accessibility_app_name" example="TalkBack">%1$s</xliff:g></string> <string name="accessibility_service_master_open_title">Open <xliff:g id="accessibility_app_name" example="TalkBack">%1$s</xliff:g></string>
<!-- Used in the Color correction settings screen to control turning on/off the feature entirely --> <!-- Used in the Color correction settings screen to control turning on/off the feature entirely -->
@@ -7058,7 +7054,7 @@
<!-- Button the users can click to indicate they understood and dismiss the screen --> <!-- Button the users can click to indicate they understood and dismiss the screen -->
<string name="nfc_how_it_works_got_it">Got it</string> <string name="nfc_how_it_works_got_it">Got it</string>
<!-- NFC More... title. [CHAR LIMIT=40] --> <!-- NFC More... title. [CHAR LIMIT=40] -->
<string name="nfc_more_title">More...</string> <string name="nfc_more_title">More\u2026</string>
<!-- Label for the dialog that is shown when the user is asked to set a <!-- Label for the dialog that is shown when the user is asked to set a
preferred payment application --> preferred payment application -->
<string name="nfc_payment_set_default_label">Set default payment app</string> <string name="nfc_payment_set_default_label">Set default payment app</string>
@@ -7418,7 +7414,7 @@
<!-- Message for selecting sim for SMS in settings. [CHAR LIMIT=40] --> <!-- Message for selecting sim for SMS in settings. [CHAR LIMIT=40] -->
<string name="select_sim_for_sms">Select a SIM for SMS</string> <string name="select_sim_for_sms">Select a SIM for SMS</string>
<!-- Message for switching data SIM; switching takes a while --> <!-- Message for switching data SIM; switching takes a while -->
<string name="data_switch_started">Switching data SIM, this may take up to a minute...</string> <string name="data_switch_started">Switching data SIM, this may take up to a minute\u2026</string>
<!-- Message for selecting sim for call in settings. [CHAR LIMIT=40] --> <!-- Message for selecting sim for call in settings. [CHAR LIMIT=40] -->
<string name="select_sim_for_calls">Call with</string> <string name="select_sim_for_calls">Call with</string>
<!-- Title for selecting a SIM card. [CHAR LIMIT=40] --> <!-- Title for selecting a SIM card. [CHAR LIMIT=40] -->
@@ -8781,7 +8777,7 @@
<string name="zen_access_empty_text">No installed apps have requested Do Not Disturb access</string> <string name="zen_access_empty_text">No installed apps have requested Do Not Disturb access</string>
<!-- [CHAR LIMIT=NONE] Text when loading app list in notification settings --> <!-- [CHAR LIMIT=NONE] Text when loading app list in notification settings -->
<string name="loading_notification_apps">Loading apps...</string> <string name="loading_notification_apps">Loading apps\u2026</string>
<!-- [CHAR LIMIT=NONE] Text appearing when app notifications are off --> <!-- [CHAR LIMIT=NONE] Text appearing when app notifications are off -->
<string name="app_notifications_off_desc">At your request, Android is blocking this app\'s notifications from appearing on this device</string> <string name="app_notifications_off_desc">At your request, Android is blocking this app\'s notifications from appearing on this device</string>
@@ -9846,7 +9842,7 @@
<string name="usb_control_device">This device</string> <string name="usb_control_device">This device</string>
<!-- The summary text that appears under a USB control option while it is in the process of <!-- The summary text that appears under a USB control option while it is in the process of
switching control or power. --> switching control or power. -->
<string name="usb_switching">Switching...</string> <string name="usb_switching">Switching\u2026</string>
<!-- The summary text that appears under a USB control option when switching control or power has <!-- The summary text that appears under a USB control option when switching control or power has
failed. --> failed. -->
<string name="usb_switching_failed">Couldn\'t switch</string> <string name="usb_switching_failed">Couldn\'t switch</string>
@@ -12067,7 +12063,7 @@
<!-- DSU Loader Description. Do not translate. --> <!-- DSU Loader Description. Do not translate. -->
<string name="dsu_loader_description" translatable="false">Load a Dynamic System Update Image</string> <string name="dsu_loader_description" translatable="false">Load a Dynamic System Update Image</string>
<!-- DSU Loader Loading. Do not translate. --> <!-- DSU Loader Loading. Do not translate. -->
<string name="dsu_loader_loading" translatable="false">Loading...</string> <string name="dsu_loader_loading" translatable="false">Loading\u2026</string>
<!-- DSU Loader. Do not translate. --> <!-- DSU Loader. Do not translate. -->
<string name="dsu_is_running" translatable="false">DSU is running</string> <string name="dsu_is_running" translatable="false">DSU is running</string>

View File

@@ -36,9 +36,9 @@
<!-- Factory reset --> <!-- Factory reset -->
<com.android.settingslib.RestrictedPreference <com.android.settingslib.RestrictedPreference
android:key="factory_reset" android:key="factory_reset"
android:title="@string/master_clear_title" android:title="@string/main_clear_title"
settings:keywords="@string/keywords_factory_data_reset" settings:keywords="@string/keywords_factory_data_reset"
settings:userRestriction="no_factory_reset" settings:userRestriction="no_factory_reset"
settings:useAdminDisabledSummary="true" settings:useAdminDisabledSummary="true"
android:fragment="com.android.settings.MasterClear" /> android:fragment="com.android.settings.MainClear" />
</PreferenceScreen> </PreferenceScreen>

View File

@@ -83,16 +83,16 @@ import java.util.List;
* *
* This is the initial screen. * This is the initial screen.
*/ */
public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutListener { public class MainClear extends InstrumentedFragment implements OnGlobalLayoutListener {
private static final String TAG = "MasterClear"; private static final String TAG = "MainClear";
@VisibleForTesting @VisibleForTesting
static final int KEYGUARD_REQUEST = 55; static final int KEYGUARD_REQUEST = 55;
@VisibleForTesting @VisibleForTesting
static final int CREDENTIAL_CONFIRM_REQUEST = 56; static final int CREDENTIAL_CONFIRM_REQUEST = 56;
private static final String KEY_SHOW_ESIM_RESET_CHECKBOX private static final String KEY_SHOW_ESIM_RESET_CHECKBOX =
= "masterclear.allow_retain_esim_profiles_after_fdr"; "masterclear.allow_retain_esim_profiles_after_fdr";
static final String ERASE_EXTERNAL_EXTRA = "erase_sd"; static final String ERASE_EXTERNAL_EXTRA = "erase_sd";
static final String ERASE_ESIMS_EXTRA = "erase_esim"; static final String ERASE_ESIMS_EXTRA = "erase_esim";
@@ -142,7 +142,7 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
final ChooseLockSettingsHelper.Builder builder = final ChooseLockSettingsHelper.Builder builder =
new ChooseLockSettingsHelper.Builder(getActivity(), this); new ChooseLockSettingsHelper.Builder(getActivity(), this);
return builder.setRequestCode(request) return builder.setRequestCode(request)
.setTitle(res.getText(R.string.master_clear_short_title)) .setTitle(res.getText(R.string.main_clear_short_title))
.show(); .show();
} }
@@ -188,9 +188,9 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
args.putBoolean(ERASE_EXTERNAL_EXTRA, mExternalStorage.isChecked()); args.putBoolean(ERASE_EXTERNAL_EXTRA, mExternalStorage.isChecked());
args.putBoolean(ERASE_ESIMS_EXTRA, mEsimStorage.isChecked()); args.putBoolean(ERASE_ESIMS_EXTRA, mEsimStorage.isChecked());
new SubSettingLauncher(getContext()) new SubSettingLauncher(getContext())
.setDestination(MasterClearConfirm.class.getName()) .setDestination(MainClearConfirm.class.getName())
.setArguments(args) .setArguments(args)
.setTitleRes(R.string.master_clear_confirm_title) .setTitleRes(R.string.main_clear_confirm_title)
.setSourceMetricsCategory(getMetricsCategory()) .setSourceMetricsCategory(getMetricsCategory())
.launch(); .launch();
} }
@@ -296,7 +296,7 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
if (mScrollView != null) { if (mScrollView != null) {
mScrollView.getViewTreeObserver().removeOnGlobalLayoutListener(this); mScrollView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
} }
mScrollView = mContentView.findViewById(R.id.master_clear_scrollview); mScrollView = mContentView.findViewById(R.id.main_clear_scrollview);
/* /*
* If the external storage is emulated, it will be erased with a factory * If the external storage is emulated, it will be erased with a factory
@@ -354,9 +354,9 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
final UserManager um = (UserManager) getActivity().getSystemService(Context.USER_SERVICE); final UserManager um = (UserManager) getActivity().getSystemService(Context.USER_SERVICE);
loadAccountList(um); loadAccountList(um);
final StringBuffer contentDescription = new StringBuffer(); final StringBuffer contentDescription = new StringBuffer();
final View masterClearContainer = mContentView.findViewById(R.id.master_clear_container); final View mainClearContainer = mContentView.findViewById(R.id.main_clear_container);
getContentDescription(masterClearContainer, contentDescription); getContentDescription(mainClearContainer, contentDescription);
masterClearContainer.setContentDescription(contentDescription); mainClearContainer.setContentDescription(contentDescription);
// Set the status of initiateButton based on scrollview // Set the status of initiateButton based on scrollview
mScrollView.setOnScrollChangeListener(new OnScrollChangeListener() { mScrollView.setOnScrollChangeListener(new OnScrollChangeListener() {
@@ -424,7 +424,7 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
final FooterBarMixin mixin = layout.getMixin(FooterBarMixin.class); final FooterBarMixin mixin = layout.getMixin(FooterBarMixin.class);
mixin.setPrimaryButton( mixin.setPrimaryButton(
new FooterButton.Builder(getActivity()) new FooterButton.Builder(getActivity())
.setText(R.string.master_clear_button_text) .setText(R.string.main_clear_button_text)
.setListener(mInitiateListener) .setListener(mInitiateListener)
.setButtonType(ButtonType.OTHER) .setButtonType(ButtonType.OTHER)
.setTheme(R.style.SudGlifButton_Primary) .setTheme(R.style.SudGlifButton_Primary)
@@ -475,15 +475,15 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
final int profileId = userInfo.id; final int profileId = userInfo.id;
final UserHandle userHandle = new UserHandle(profileId); final UserHandle userHandle = new UserHandle(profileId);
Account[] accounts = mgr.getAccountsAsUser(profileId); Account[] accounts = mgr.getAccountsAsUser(profileId);
final int N = accounts.length; final int accountLength = accounts.length;
if (N == 0) { if (accountLength == 0) {
continue; continue;
} }
accountsCount += N; accountsCount += accountLength;
AuthenticatorDescription[] descs = AccountManager.get(context) AuthenticatorDescription[] descs = AccountManager.get(context)
.getAuthenticatorTypesAsUser(profileId); .getAuthenticatorTypesAsUser(profileId);
final int M = descs.length; final int descLength = descs.length;
if (profilesSize > 1) { if (profilesSize > 1) {
View titleView = Utils.inflateCategoryHeader(inflater, contents); View titleView = Utils.inflateCategoryHeader(inflater, contents);
@@ -493,10 +493,10 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
contents.addView(titleView); contents.addView(titleView);
} }
for (int i = 0; i < N; i++) { for (int i = 0; i < accountLength; i++) {
Account account = accounts[i]; Account account = accounts[i];
AuthenticatorDescription desc = null; AuthenticatorDescription desc = null;
for (int j = 0; j < M; j++) { for (int j = 0; j < descLength; j++) {
if (account.type.equals(descs[j].type)) { if (account.type.equals(descs[j].type)) {
desc = descs[j]; desc = descs[j];
break; break;
@@ -524,7 +524,7 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
icon = context.getPackageManager().getDefaultActivityIcon(); icon = context.getPackageManager().getDefaultActivityIcon();
} }
View child = inflater.inflate(R.layout.master_clear_account, contents, false); View child = inflater.inflate(R.layout.main_clear_account, contents, false);
((ImageView) child.findViewById(android.R.id.icon)).setImageDrawable(icon); ((ImageView) child.findViewById(android.R.id.icon)).setImageDrawable(icon);
((TextView) child.findViewById(android.R.id.title)).setText(account.name); ((TextView) child.findViewById(android.R.id.title)).setText(account.name);
contents.addView(child); contents.addView(child);
@@ -552,7 +552,7 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
.hasBaseUserRestriction(context, UserManager.DISALLOW_FACTORY_RESET, .hasBaseUserRestriction(context, UserManager.DISALLOW_FACTORY_RESET,
UserHandle.myUserId()); UserHandle.myUserId());
if (disallow && !Utils.isDemoUser(context)) { if (disallow && !Utils.isDemoUser(context)) {
return inflater.inflate(R.layout.master_clear_disallowed_screen, null); return inflater.inflate(R.layout.main_clear_disallowed_screen, null);
} else if (admin != null) { } else if (admin != null) {
new ActionDisabledByAdminDialogHelper(getActivity()) new ActionDisabledByAdminDialogHelper(getActivity())
.prepareDialogBuilder(UserManager.DISALLOW_FACTORY_RESET, admin) .prepareDialogBuilder(UserManager.DISALLOW_FACTORY_RESET, admin)
@@ -561,7 +561,7 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
return new View(getContext()); return new View(getContext());
} }
mContentView = inflater.inflate(R.layout.master_clear, null); mContentView = inflater.inflate(R.layout.main_clear, null);
establishInitialState(); establishInitialState();
return mContentView; return mContentView;

View File

@@ -64,8 +64,8 @@ import com.google.android.setupdesign.GlifLayout;
* *
* This is the confirmation screen. * This is the confirmation screen.
*/ */
public class MasterClearConfirm extends InstrumentedFragment { public class MainClearConfirm extends InstrumentedFragment {
private final static String TAG = "MasterClearConfirm"; private static final String TAG = "MainClearConfirm";
@VisibleForTesting View mContentView; @VisibleForTesting View mContentView;
private boolean mEraseSdCard; private boolean mEraseSdCard;
@@ -103,7 +103,7 @@ public class MasterClearConfirm extends InstrumentedFragment {
mProgressDialog.hide(); mProgressDialog.hide();
if (getActivity() != null) { if (getActivity() != null) {
getActivity().setRequestedOrientation(mOldOrientation); getActivity().setRequestedOrientation(mOldOrientation);
doMasterClear(); doMainClear();
} }
} }
@@ -121,7 +121,7 @@ public class MasterClearConfirm extends InstrumentedFragment {
} }
}.execute(); }.execute();
} else { } else {
doMasterClear(); doMainClear();
} }
} }
@@ -130,9 +130,9 @@ public class MasterClearConfirm extends InstrumentedFragment {
progressDialog.setIndeterminate(true); progressDialog.setIndeterminate(true);
progressDialog.setCancelable(false); progressDialog.setCancelable(false);
progressDialog.setTitle( progressDialog.setTitle(
getActivity().getString(R.string.master_clear_progress_title)); getActivity().getString(R.string.main_clear_progress_title));
progressDialog.setMessage( progressDialog.setMessage(
getActivity().getString(R.string.master_clear_progress_text)); getActivity().getString(R.string.main_clear_progress_text));
return progressDialog; return progressDialog;
} }
}; };
@@ -180,11 +180,11 @@ public class MasterClearConfirm extends InstrumentedFragment {
return !WizardManagerHelper.isDeviceProvisioned(getActivity()); return !WizardManagerHelper.isDeviceProvisioned(getActivity());
} }
private void doMasterClear() { private void doMainClear() {
Intent intent = new Intent(Intent.ACTION_FACTORY_RESET); Intent intent = new Intent(Intent.ACTION_FACTORY_RESET);
intent.setPackage("android"); intent.setPackage("android");
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
intent.putExtra(Intent.EXTRA_REASON, "MasterClearConfirm"); intent.putExtra(Intent.EXTRA_REASON, "MainClearConfirm");
intent.putExtra(Intent.EXTRA_WIPE_EXTERNAL_STORAGE, mEraseSdCard); intent.putExtra(Intent.EXTRA_WIPE_EXTERNAL_STORAGE, mEraseSdCard);
intent.putExtra(Intent.EXTRA_WIPE_ESIMS, mEraseEsims); intent.putExtra(Intent.EXTRA_WIPE_ESIMS, mEraseEsims);
getActivity().sendBroadcast(intent); getActivity().sendBroadcast(intent);
@@ -200,7 +200,7 @@ public class MasterClearConfirm extends InstrumentedFragment {
final FooterBarMixin mixin = layout.getMixin(FooterBarMixin.class); final FooterBarMixin mixin = layout.getMixin(FooterBarMixin.class);
mixin.setPrimaryButton( mixin.setPrimaryButton(
new FooterButton.Builder(getActivity()) new FooterButton.Builder(getActivity())
.setText(R.string.master_clear_button_text) .setText(R.string.main_clear_button_text)
.setListener(mFinalClickListener) .setListener(mFinalClickListener)
.setButtonType(ButtonType.OTHER) .setButtonType(ButtonType.OTHER)
.setTheme(R.style.SudGlifButton_Primary) .setTheme(R.style.SudGlifButton_Primary)
@@ -230,7 +230,7 @@ public class MasterClearConfirm extends InstrumentedFragment {
getActivity(), UserManager.DISALLOW_FACTORY_RESET, UserHandle.myUserId()); getActivity(), UserManager.DISALLOW_FACTORY_RESET, UserHandle.myUserId());
if (RestrictedLockUtilsInternal.hasBaseUserRestriction(getActivity(), if (RestrictedLockUtilsInternal.hasBaseUserRestriction(getActivity(),
UserManager.DISALLOW_FACTORY_RESET, UserHandle.myUserId())) { UserManager.DISALLOW_FACTORY_RESET, UserHandle.myUserId())) {
return inflater.inflate(R.layout.master_clear_disallowed_screen, null); return inflater.inflate(R.layout.main_clear_disallowed_screen, null);
} else if (admin != null) { } else if (admin != null) {
new ActionDisabledByAdminDialogHelper(getActivity()) new ActionDisabledByAdminDialogHelper(getActivity())
.prepareDialogBuilder(UserManager.DISALLOW_FACTORY_RESET, admin) .prepareDialogBuilder(UserManager.DISALLOW_FACTORY_RESET, admin)
@@ -238,7 +238,7 @@ public class MasterClearConfirm extends InstrumentedFragment {
.show(); .show();
return new View(getActivity()); return new View(getActivity());
} }
mContentView = inflater.inflate(R.layout.master_clear_confirm, null); mContentView = inflater.inflate(R.layout.main_clear_confirm, null);
setUpActionBarAndTitle(); setUpActionBarAndTitle();
establishFinalConfirmationState(); establishFinalConfirmationState();
setAccessibilityTitle(); setAccessibilityTitle();
@@ -260,7 +260,7 @@ public class MasterClearConfirm extends InstrumentedFragment {
void setSubtitle() { void setSubtitle() {
if (mEraseEsims) { if (mEraseEsims) {
((TextView) mContentView.findViewById(R.id.sud_layout_description)) ((TextView) mContentView.findViewById(R.id.sud_layout_description))
.setText(R.string.master_clear_final_desc_esim); .setText(R.string.main_clear_final_desc_esim);
} }
} }
@@ -270,9 +270,9 @@ public class MasterClearConfirm extends InstrumentedFragment {
Bundle args = getArguments(); Bundle args = getArguments();
mEraseSdCard = args != null mEraseSdCard = args != null
&& args.getBoolean(MasterClear.ERASE_EXTERNAL_EXTRA); && args.getBoolean(MainClear.ERASE_EXTERNAL_EXTRA);
mEraseEsims = args != null mEraseEsims = args != null
&& args.getBoolean(MasterClear.ERASE_ESIMS_EXTRA); && args.getBoolean(MainClear.ERASE_ESIMS_EXTRA);
} }
@Override @Override

View File

@@ -125,7 +125,7 @@ public class ResetNetwork extends InstrumentedFragment {
args.putInt(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX, args.putInt(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX,
subscription.getSubscriptionId()); subscription.getSubscriptionId());
} }
args.putBoolean(MasterClear.ERASE_ESIMS_EXTRA, args.putBoolean(MainClear.ERASE_ESIMS_EXTRA,
mEsimContainer.getVisibility() == View.VISIBLE && mEsimCheckbox.isChecked()); mEsimContainer.getVisibility() == View.VISIBLE && mEsimCheckbox.isChecked());
new SubSettingLauncher(getContext()) new SubSettingLauncher(getContext())
.setDestination(ResetNetworkConfirm.class.getName()) .setDestination(ResetNetworkConfirm.class.getName())

View File

@@ -188,7 +188,7 @@ public class ResetNetworkConfirm extends InstrumentedFragment {
progressDialog.setIndeterminate(true); progressDialog.setIndeterminate(true);
progressDialog.setCancelable(false); progressDialog.setCancelable(false);
progressDialog.setMessage( progressDialog.setMessage(
context.getString(R.string.master_clear_progress_text)); context.getString(R.string.main_clear_progress_text));
return progressDialog; return progressDialog;
} }
@@ -251,7 +251,7 @@ public class ResetNetworkConfirm extends InstrumentedFragment {
if (args != null) { if (args != null) {
mSubId = args.getInt(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX, mSubId = args.getInt(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX,
SubscriptionManager.INVALID_SUBSCRIPTION_ID); SubscriptionManager.INVALID_SUBSCRIPTION_ID);
mEraseEsim = args.getBoolean(MasterClear.ERASE_ESIMS_EXTRA); mEraseEsim = args.getBoolean(MainClear.ERASE_ESIMS_EXTRA);
} }
mActivity = getActivity(); mActivity = getActivity();

View File

@@ -200,7 +200,7 @@ public class ToggleAccessibilityServicePreferenceFragment extends
protected void updateToggleServiceTitle(SwitchPreference switchPreference) { protected void updateToggleServiceTitle(SwitchPreference switchPreference) {
final AccessibilityServiceInfo info = getAccessibilityServiceInfo(); final AccessibilityServiceInfo info = getAccessibilityServiceInfo();
final String switchBarText = (info == null) ? "" : final String switchBarText = (info == null) ? "" :
getString(R.string.accessibility_service_master_switch_title, getString(R.string.accessibility_service_primary_switch_title,
info.getResolveInfo().loadLabel(getPackageManager())); info.getResolveInfo().loadLabel(getPackageManager()));
switchPreference.setTitle(switchBarText); switchPreference.setTitle(switchBarText);
} }

View File

@@ -365,7 +365,7 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
abstract int getUserShortcutTypes(); abstract int getUserShortcutTypes();
protected void updateToggleServiceTitle(SwitchPreference switchPreference) { protected void updateToggleServiceTitle(SwitchPreference switchPreference) {
switchPreference.setTitle(R.string.accessibility_service_master_switch_title); switchPreference.setTitle(R.string.accessibility_service_primary_switch_title);
} }
protected abstract void onPreferenceToggled(String preferenceKey, boolean enabled); protected abstract void onPreferenceToggled(String preferenceKey, boolean enabled);

View File

@@ -19,7 +19,7 @@ package com.android.settings.core.gateway;
import com.android.settings.AllInOneTetherSettings; import com.android.settings.AllInOneTetherSettings;
import com.android.settings.DisplaySettings; import com.android.settings.DisplaySettings;
import com.android.settings.IccLockSettings; import com.android.settings.IccLockSettings;
import com.android.settings.MasterClear; import com.android.settings.MainClear;
import com.android.settings.Settings; import com.android.settings.Settings;
import com.android.settings.TestingSettings; import com.android.settings.TestingSettings;
import com.android.settings.TetherSettings; import com.android.settings.TetherSettings;
@@ -273,7 +273,7 @@ public class SettingsGateway {
TestingSettings.class.getName(), TestingSettings.class.getName(),
WifiAPITest.class.getName(), WifiAPITest.class.getName(),
WifiInfo.class.getName(), WifiInfo.class.getName(),
MasterClear.class.getName(), MainClear.class.getName(),
ResetDashboardFragment.class.getName(), ResetDashboardFragment.class.getName(),
NightDisplaySettings.class.getName(), NightDisplaySettings.class.getName(),
ManageDomainUrls.class.getName(), ManageDomainUrls.class.getName(),

View File

@@ -42,7 +42,7 @@ import org.robolectric.RobolectricTestRunner;
import java.util.ArrayList; import java.util.ArrayList;
@RunWith(RobolectricTestRunner.class) @RunWith(RobolectricTestRunner.class)
public class MasterClearConfirmTest { public class MainClearConfirmTest {
private FragmentActivity mActivity; private FragmentActivity mActivity;
@@ -55,85 +55,85 @@ public class MasterClearConfirmTest {
@Mock @Mock
private PersistentDataBlockManager mPersistentDataBlockManager; private PersistentDataBlockManager mPersistentDataBlockManager;
private MasterClearConfirm mMasterClearConfirm; private MainClearConfirm mMainClearConfirm;
@Before @Before
public void setUp() { public void setUp() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
mActivity = Robolectric.setupActivity(FragmentActivity.class); mActivity = Robolectric.setupActivity(FragmentActivity.class);
mMasterClearConfirm = spy(new MasterClearConfirm()); mMainClearConfirm = spy(new MainClearConfirm());
} }
@Test @Test
public void setSubtitle_eraseEsim() { public void setSubtitle_eraseEsim() {
MasterClearConfirm masterClearConfirm = new MasterClearConfirm(); MainClearConfirm mainClearConfirm = new MainClearConfirm();
masterClearConfirm.mEraseEsims = true; mainClearConfirm.mEraseEsims = true;
masterClearConfirm.mContentView = mainClearConfirm.mContentView =
LayoutInflater.from(mActivity).inflate(R.layout.master_clear_confirm, null); LayoutInflater.from(mActivity).inflate(R.layout.main_clear_confirm, null);
masterClearConfirm.setSubtitle(); mainClearConfirm.setSubtitle();
assertThat(((TextView) masterClearConfirm.mContentView assertThat(((TextView) mainClearConfirm.mContentView
.findViewById(R.id.sud_layout_description)).getText()) .findViewById(R.id.sud_layout_description)).getText())
.isEqualTo(mActivity.getString(R.string.master_clear_final_desc_esim)); .isEqualTo(mActivity.getString(R.string.main_clear_final_desc_esim));
} }
@Test @Test
public void setSubtitle_notEraseEsim() { public void setSubtitle_notEraseEsim() {
MasterClearConfirm masterClearConfirm = new MasterClearConfirm(); MainClearConfirm mainClearConfirm = new MainClearConfirm();
masterClearConfirm.mEraseEsims = false; mainClearConfirm.mEraseEsims = false;
masterClearConfirm.mContentView = mainClearConfirm.mContentView =
LayoutInflater.from(mActivity).inflate(R.layout.master_clear_confirm, null); LayoutInflater.from(mActivity).inflate(R.layout.main_clear_confirm, null);
masterClearConfirm.setSubtitle(); mainClearConfirm.setSubtitle();
assertThat(((TextView) masterClearConfirm.mContentView assertThat(((TextView) mainClearConfirm.mContentView
.findViewById(R.id.sud_layout_description)).getText()) .findViewById(R.id.sud_layout_description)).getText())
.isEqualTo(mActivity.getString(R.string.master_clear_final_desc)); .isEqualTo(mActivity.getString(R.string.main_clear_final_desc));
} }
@Test @Test
public void shouldWipePersistentDataBlock_noPersistentDataBlockManager_shouldReturnFalse() { public void shouldWipePersistentDataBlock_noPersistentDataBlockManager_shouldReturnFalse() {
assertThat(mMasterClearConfirm.shouldWipePersistentDataBlock(null)).isFalse(); assertThat(mMainClearConfirm.shouldWipePersistentDataBlock(null)).isFalse();
} }
@Test @Test
public void shouldWipePersistentDataBlock_deviceIsStillBeingProvisioned_shouldReturnFalse() { public void shouldWipePersistentDataBlock_deviceIsStillBeingProvisioned_shouldReturnFalse() {
doReturn(true).when(mMasterClearConfirm).isDeviceStillBeingProvisioned(); doReturn(true).when(mMainClearConfirm).isDeviceStillBeingProvisioned();
assertThat(mMasterClearConfirm.shouldWipePersistentDataBlock( assertThat(mMainClearConfirm.shouldWipePersistentDataBlock(
mPersistentDataBlockManager)).isFalse(); mPersistentDataBlockManager)).isFalse();
} }
@Test @Test
public void shouldWipePersistentDataBlock_oemUnlockAllowed_shouldReturnFalse() { public void shouldWipePersistentDataBlock_oemUnlockAllowed_shouldReturnFalse() {
doReturn(false).when(mMasterClearConfirm).isDeviceStillBeingProvisioned(); doReturn(false).when(mMainClearConfirm).isDeviceStillBeingProvisioned();
doReturn(true).when(mMasterClearConfirm).isOemUnlockedAllowed(); doReturn(true).when(mMainClearConfirm).isOemUnlockedAllowed();
assertThat(mMasterClearConfirm.shouldWipePersistentDataBlock( assertThat(mMainClearConfirm.shouldWipePersistentDataBlock(
mPersistentDataBlockManager)).isFalse(); mPersistentDataBlockManager)).isFalse();
} }
@Test @Test
public void shouldWipePersistentDataBlock_frpPolicyNotSupported_shouldReturnFalse() { public void shouldWipePersistentDataBlock_frpPolicyNotSupported_shouldReturnFalse() {
when(mMasterClearConfirm.getActivity()).thenReturn(mMockActivity); when(mMainClearConfirm.getActivity()).thenReturn(mMockActivity);
doReturn(false).when(mMasterClearConfirm).isDeviceStillBeingProvisioned(); doReturn(false).when(mMainClearConfirm).isDeviceStillBeingProvisioned();
doReturn(false).when(mMasterClearConfirm).isOemUnlockedAllowed(); doReturn(false).when(mMainClearConfirm).isOemUnlockedAllowed();
when(mMockActivity.getSystemService(Context.DEVICE_POLICY_SERVICE)) when(mMockActivity.getSystemService(Context.DEVICE_POLICY_SERVICE))
.thenReturn(mDevicePolicyManager); .thenReturn(mDevicePolicyManager);
when(mDevicePolicyManager.isFactoryResetProtectionPolicySupported()).thenReturn(false); when(mDevicePolicyManager.isFactoryResetProtectionPolicySupported()).thenReturn(false);
assertThat(mMasterClearConfirm.shouldWipePersistentDataBlock( assertThat(mMainClearConfirm.shouldWipePersistentDataBlock(
mPersistentDataBlockManager)).isFalse(); mPersistentDataBlockManager)).isFalse();
} }
@Test @Test
public void shouldWipePersistentDataBlock_hasFactoryResetProtectionPolicy_shouldReturnFalse() { public void shouldWipePersistentDataBlock_hasFactoryResetProtectionPolicy_shouldReturnFalse() {
when(mMasterClearConfirm.getActivity()).thenReturn(mMockActivity); when(mMainClearConfirm.getActivity()).thenReturn(mMockActivity);
doReturn(false).when(mMasterClearConfirm).isDeviceStillBeingProvisioned(); doReturn(false).when(mMainClearConfirm).isDeviceStillBeingProvisioned();
doReturn(false).when(mMasterClearConfirm).isOemUnlockedAllowed(); doReturn(false).when(mMainClearConfirm).isOemUnlockedAllowed();
ArrayList<String> accounts = new ArrayList<>(); ArrayList<String> accounts = new ArrayList<>();
accounts.add("test"); accounts.add("test");
FactoryResetProtectionPolicy frp = new FactoryResetProtectionPolicy.Builder() FactoryResetProtectionPolicy frp = new FactoryResetProtectionPolicy.Builder()
@@ -146,16 +146,16 @@ public class MasterClearConfirmTest {
when(mDevicePolicyManager.getFactoryResetProtectionPolicy(null)).thenReturn(frp); when(mDevicePolicyManager.getFactoryResetProtectionPolicy(null)).thenReturn(frp);
when(mDevicePolicyManager.isOrganizationOwnedDeviceWithManagedProfile()).thenReturn(true); when(mDevicePolicyManager.isOrganizationOwnedDeviceWithManagedProfile()).thenReturn(true);
assertThat(mMasterClearConfirm.shouldWipePersistentDataBlock( assertThat(mMainClearConfirm.shouldWipePersistentDataBlock(
mPersistentDataBlockManager)).isFalse(); mPersistentDataBlockManager)).isFalse();
} }
@Test @Test
public void shouldWipePersistentDataBlock_isNotOrganizationOwnedDevice_shouldReturnTrue() { public void shouldWipePersistentDataBlock_isNotOrganizationOwnedDevice_shouldReturnTrue() {
when(mMasterClearConfirm.getActivity()).thenReturn(mMockActivity); when(mMainClearConfirm.getActivity()).thenReturn(mMockActivity);
doReturn(false).when(mMasterClearConfirm).isDeviceStillBeingProvisioned(); doReturn(false).when(mMainClearConfirm).isDeviceStillBeingProvisioned();
doReturn(false).when(mMasterClearConfirm).isOemUnlockedAllowed(); doReturn(false).when(mMainClearConfirm).isOemUnlockedAllowed();
when(mMockActivity.getSystemService(Context.DEVICE_POLICY_SERVICE)) when(mMockActivity.getSystemService(Context.DEVICE_POLICY_SERVICE))
.thenReturn(mDevicePolicyManager); .thenReturn(mDevicePolicyManager);
@@ -163,7 +163,7 @@ public class MasterClearConfirmTest {
when(mDevicePolicyManager.getFactoryResetProtectionPolicy(null)).thenReturn(null); when(mDevicePolicyManager.getFactoryResetProtectionPolicy(null)).thenReturn(null);
when(mDevicePolicyManager.isOrganizationOwnedDeviceWithManagedProfile()).thenReturn(false); when(mDevicePolicyManager.isOrganizationOwnedDeviceWithManagedProfile()).thenReturn(false);
assertThat(mMasterClearConfirm.shouldWipePersistentDataBlock( assertThat(mMainClearConfirm.shouldWipePersistentDataBlock(
mPersistentDataBlockManager)).isTrue(); mPersistentDataBlockManager)).isTrue();
} }
} }

View File

@@ -11,7 +11,7 @@
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License * limitations under the License.
*/ */
package com.android.settings; package com.android.settings;
@@ -69,7 +69,7 @@ import org.robolectric.shadows.ShadowUserManager;
@RunWith(RobolectricTestRunner.class) @RunWith(RobolectricTestRunner.class)
@Config(shadows = ShadowUtils.class) @Config(shadows = ShadowUtils.class)
public class MasterClearTest { public class MainClearTest {
private static final String TEST_ACCOUNT_TYPE = "android.test.account.type"; private static final String TEST_ACCOUNT_TYPE = "android.test.account.type";
private static final String TEST_CONFIRMATION_PACKAGE = "android.test.conf.pkg"; private static final String TEST_CONFIRMATION_PACKAGE = "android.test.conf.pkg";
@@ -93,7 +93,7 @@ public class MasterClearTest {
@Mock @Mock
private Intent mMockIntent; private Intent mMockIntent;
private MasterClear mMasterClear; private MainClear mMainClear;
private ShadowActivity mShadowActivity; private ShadowActivity mShadowActivity;
private FragmentActivity mActivity; private FragmentActivity mActivity;
private ShadowUserManager mShadowUserManager; private ShadowUserManager mShadowUserManager;
@@ -102,13 +102,13 @@ public class MasterClearTest {
@Before @Before
public void setUp() { public void setUp() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
mMasterClear = spy(new MasterClear()); mMainClear = spy(new MainClear());
mActivity = Robolectric.setupActivity(FragmentActivity.class); mActivity = Robolectric.setupActivity(FragmentActivity.class);
mShadowActivity = Shadows.shadowOf(mActivity); mShadowActivity = Shadows.shadowOf(mActivity);
UserManager userManager = mActivity.getSystemService(UserManager.class); UserManager userManager = mActivity.getSystemService(UserManager.class);
mShadowUserManager = Shadows.shadowOf(userManager); mShadowUserManager = Shadows.shadowOf(userManager);
mShadowUserManager.setIsAdminUser(true); mShadowUserManager.setIsAdminUser(true);
mContentView = LayoutInflater.from(mActivity).inflate(R.layout.master_clear, null); mContentView = LayoutInflater.from(mActivity).inflate(R.layout.main_clear, null);
// Make scrollView only have one child // Make scrollView only have one child
when(mScrollView.getChildAt(0)).thenReturn(mLinearLayout); when(mScrollView.getChildAt(0)).thenReturn(mLinearLayout);
@@ -123,78 +123,78 @@ public class MasterClearTest {
@Test @Test
public void testShowFinalConfirmation_eraseEsimVisible_eraseEsimChecked() { public void testShowFinalConfirmation_eraseEsimVisible_eraseEsimChecked() {
final Context context = mock(Context.class); final Context context = mock(Context.class);
when(mMasterClear.getContext()).thenReturn(context); when(mMainClear.getContext()).thenReturn(context);
mMasterClear.mEsimStorage = mContentView.findViewById(R.id.erase_esim); mMainClear.mEsimStorage = mContentView.findViewById(R.id.erase_esim);
mMasterClear.mExternalStorage = mContentView.findViewById(R.id.erase_external); mMainClear.mExternalStorage = mContentView.findViewById(R.id.erase_external);
mMasterClear.mEsimStorageContainer = mContentView.findViewById(R.id.erase_esim_container); mMainClear.mEsimStorageContainer = mContentView.findViewById(R.id.erase_esim_container);
mMasterClear.mEsimStorageContainer.setVisibility(View.VISIBLE); mMainClear.mEsimStorageContainer.setVisibility(View.VISIBLE);
mMasterClear.mEsimStorage.setChecked(true); mMainClear.mEsimStorage.setChecked(true);
mMasterClear.showFinalConfirmation(); mMainClear.showFinalConfirmation();
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class); final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
verify(context).startActivity(intent.capture()); verify(context).startActivity(intent.capture());
assertThat(intent.getValue().getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS) assertThat(intent.getValue().getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS)
.getBoolean(MasterClear.ERASE_ESIMS_EXTRA, false)) .getBoolean(MainClear.ERASE_ESIMS_EXTRA, false))
.isTrue(); .isTrue();
} }
@Test @Test
public void testShowFinalConfirmation_eraseEsimVisible_eraseEsimUnchecked() { public void testShowFinalConfirmation_eraseEsimVisible_eraseEsimUnchecked() {
final Context context = mock(Context.class); final Context context = mock(Context.class);
when(mMasterClear.getContext()).thenReturn(context); when(mMainClear.getContext()).thenReturn(context);
mMasterClear.mEsimStorage = mContentView.findViewById(R.id.erase_esim); mMainClear.mEsimStorage = mContentView.findViewById(R.id.erase_esim);
mMasterClear.mExternalStorage = mContentView.findViewById(R.id.erase_external); mMainClear.mExternalStorage = mContentView.findViewById(R.id.erase_external);
mMasterClear.mEsimStorageContainer = mContentView.findViewById(R.id.erase_esim_container); mMainClear.mEsimStorageContainer = mContentView.findViewById(R.id.erase_esim_container);
mMasterClear.mEsimStorageContainer.setVisibility(View.VISIBLE); mMainClear.mEsimStorageContainer.setVisibility(View.VISIBLE);
mMasterClear.mEsimStorage.setChecked(false); mMainClear.mEsimStorage.setChecked(false);
mMasterClear.showFinalConfirmation(); mMainClear.showFinalConfirmation();
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class); final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
verify(context).startActivity(intent.capture()); verify(context).startActivity(intent.capture());
assertThat(intent.getValue().getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS) assertThat(intent.getValue().getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS)
.getBoolean(MasterClear.ERASE_ESIMS_EXTRA, false)) .getBoolean(MainClear.ERASE_ESIMS_EXTRA, false))
.isFalse(); .isFalse();
} }
@Test @Test
public void testShowFinalConfirmation_eraseEsimGone_eraseEsimChecked() { public void testShowFinalConfirmation_eraseEsimGone_eraseEsimChecked() {
final Context context = mock(Context.class); final Context context = mock(Context.class);
when(mMasterClear.getContext()).thenReturn(context); when(mMainClear.getContext()).thenReturn(context);
mMasterClear.mEsimStorage = mContentView.findViewById(R.id.erase_esim); mMainClear.mEsimStorage = mContentView.findViewById(R.id.erase_esim);
mMasterClear.mExternalStorage = mContentView.findViewById(R.id.erase_external); mMainClear.mExternalStorage = mContentView.findViewById(R.id.erase_external);
mMasterClear.mEsimStorageContainer = mContentView.findViewById(R.id.erase_esim_container); mMainClear.mEsimStorageContainer = mContentView.findViewById(R.id.erase_esim_container);
mMasterClear.mEsimStorageContainer.setVisibility(View.GONE); mMainClear.mEsimStorageContainer.setVisibility(View.GONE);
mMasterClear.mEsimStorage.setChecked(true); mMainClear.mEsimStorage.setChecked(true);
mMasterClear.showFinalConfirmation(); mMainClear.showFinalConfirmation();
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class); final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
verify(context).startActivity(intent.capture()); verify(context).startActivity(intent.capture());
assertThat(intent.getValue().getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS) assertThat(intent.getValue().getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS)
.getBoolean(MasterClear.ERASE_ESIMS_EXTRA, false)) .getBoolean(MainClear.ERASE_ESIMS_EXTRA, false))
.isTrue(); .isTrue();
} }
@Test @Test
public void testShowFinalConfirmation_eraseEsimGone_eraseEsimUnchecked() { public void testShowFinalConfirmation_eraseEsimGone_eraseEsimUnchecked() {
final Context context = mock(Context.class); final Context context = mock(Context.class);
when(mMasterClear.getContext()).thenReturn(context); when(mMainClear.getContext()).thenReturn(context);
mMasterClear.mEsimStorage = mContentView.findViewById(R.id.erase_esim); mMainClear.mEsimStorage = mContentView.findViewById(R.id.erase_esim);
mMasterClear.mExternalStorage = mContentView.findViewById(R.id.erase_external); mMainClear.mExternalStorage = mContentView.findViewById(R.id.erase_external);
mMasterClear.mEsimStorageContainer = mContentView.findViewById(R.id.erase_esim_container); mMainClear.mEsimStorageContainer = mContentView.findViewById(R.id.erase_esim_container);
mMasterClear.mEsimStorageContainer.setVisibility(View.GONE); mMainClear.mEsimStorageContainer.setVisibility(View.GONE);
mMasterClear.mEsimStorage.setChecked(false); mMainClear.mEsimStorage.setChecked(false);
mMasterClear.showFinalConfirmation(); mMainClear.showFinalConfirmation();
final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class); final ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
verify(context).startActivity(intent.capture()); verify(context).startActivity(intent.capture());
assertThat(intent.getValue().getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS) assertThat(intent.getValue().getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS)
.getBoolean(MasterClear.ERASE_ESIMS_EXTRA, false)) .getBoolean(MainClear.ERASE_ESIMS_EXTRA, false))
.isFalse(); .isFalse();
} }
@@ -204,7 +204,7 @@ public class MasterClearTest {
false /* isEuiccEnabled */, false /* isEuiccEnabled */,
true /* isEuiccProvisioned */, true /* isEuiccProvisioned */,
false /* isDeveloper */); false /* isDeveloper */);
assertThat(mMasterClear.showWipeEuicc()).isFalse(); assertThat(mMainClear.showWipeEuicc()).isFalse();
} }
@Test @Test
@@ -213,7 +213,7 @@ public class MasterClearTest {
true /* isEuiccEnabled */, true /* isEuiccEnabled */,
false /* isEuiccProvisioned */, false /* isEuiccProvisioned */,
false /* isDeveloper */); false /* isDeveloper */);
assertThat(mMasterClear.showWipeEuicc()).isFalse(); assertThat(mMainClear.showWipeEuicc()).isFalse();
} }
@Test @Test
@@ -222,7 +222,7 @@ public class MasterClearTest {
true /* isEuiccEnabled */, true /* isEuiccEnabled */,
true /* isEuiccProvisioned */, true /* isEuiccProvisioned */,
false /* isDeveloper */); false /* isDeveloper */);
assertThat(mMasterClear.showWipeEuicc()).isTrue(); assertThat(mMainClear.showWipeEuicc()).isTrue();
} }
@Test @Test
@@ -231,7 +231,7 @@ public class MasterClearTest {
true /* isEuiccEnabled */, true /* isEuiccEnabled */,
false /* isEuiccProvisioned */, false /* isEuiccProvisioned */,
true /* isDeveloper */); true /* isDeveloper */);
assertThat(mMasterClear.showWipeEuicc()).isTrue(); assertThat(mMainClear.showWipeEuicc()).isTrue();
} }
@Test @Test
@@ -243,32 +243,32 @@ public class MasterClearTest {
public void testHasReachedBottom_NotScrollDown_returnFalse() { public void testHasReachedBottom_NotScrollDown_returnFalse() {
initScrollView(100, 0, 200); initScrollView(100, 0, 200);
assertThat(mMasterClear.hasReachedBottom(mScrollView)).isFalse(); assertThat(mMainClear.hasReachedBottom(mScrollView)).isFalse();
} }
@Test @Test
public void testHasReachedBottom_CanNotScroll_returnTrue() { public void testHasReachedBottom_CanNotScroll_returnTrue() {
initScrollView(100, 0, 80); initScrollView(100, 0, 80);
assertThat(mMasterClear.hasReachedBottom(mScrollView)).isTrue(); assertThat(mMainClear.hasReachedBottom(mScrollView)).isTrue();
} }
@Test @Test
public void testHasReachedBottom_ScrollToBottom_returnTrue() { public void testHasReachedBottom_ScrollToBottom_returnTrue() {
initScrollView(100, 100, 200); initScrollView(100, 100, 200);
assertThat(mMasterClear.hasReachedBottom(mScrollView)).isTrue(); assertThat(mMainClear.hasReachedBottom(mScrollView)).isTrue();
} }
@Test @Test
public void testInitiateMasterClear_inDemoMode_sendsIntent() { public void testInitiateMainClear_inDemoMode_sendsIntent() {
ShadowUtils.setIsDemoUser(true); ShadowUtils.setIsDemoUser(true);
final ComponentName componentName = final ComponentName componentName =
ComponentName.unflattenFromString("com.android.retaildemo/.DeviceAdminReceiver"); ComponentName.unflattenFromString("com.android.retaildemo/.DeviceAdminReceiver");
ShadowUtils.setDeviceOwnerComponent(componentName); ShadowUtils.setDeviceOwnerComponent(componentName);
mMasterClear.mInitiateListener.onClick(mContentView); mMainClear.mInitiateListener.onClick(mContentView);
final Intent intent = mShadowActivity.getNextStartedActivity(); final Intent intent = mShadowActivity.getNextStartedActivity();
assertThat(Intent.ACTION_FACTORY_RESET).isEqualTo(intent.getAction()); assertThat(Intent.ACTION_FACTORY_RESET).isEqualTo(intent.getAction());
assertThat(componentName).isNotNull(); assertThat(componentName).isNotNull();
@@ -278,87 +278,87 @@ public class MasterClearTest {
@Test @Test
public void testOnActivityResultInternal_invalideRequest() { public void testOnActivityResultInternal_invalideRequest() {
int invalidRequestCode = -1; int invalidRequestCode = -1;
doReturn(false).when(mMasterClear).isValidRequestCode(eq(invalidRequestCode)); doReturn(false).when(mMainClear).isValidRequestCode(eq(invalidRequestCode));
mMasterClear.onActivityResultInternal(invalidRequestCode, Activity.RESULT_OK, null); mMainClear.onActivityResultInternal(invalidRequestCode, Activity.RESULT_OK, null);
verify(mMasterClear, times(1)).isValidRequestCode(eq(invalidRequestCode)); verify(mMainClear, times(1)).isValidRequestCode(eq(invalidRequestCode));
verify(mMasterClear, times(0)).establishInitialState(); verify(mMainClear, times(0)).establishInitialState();
verify(mMasterClear, times(0)).getAccountConfirmationIntent(); verify(mMainClear, times(0)).getAccountConfirmationIntent();
verify(mMasterClear, times(0)).showFinalConfirmation(); verify(mMainClear, times(0)).showFinalConfirmation();
} }
@Test @Test
public void testOnActivityResultInternal_resultCanceled() { public void testOnActivityResultInternal_resultCanceled() {
doReturn(true).when(mMasterClear).isValidRequestCode(eq(MasterClear.KEYGUARD_REQUEST)); doReturn(true).when(mMainClear).isValidRequestCode(eq(MainClear.KEYGUARD_REQUEST));
doNothing().when(mMasterClear).establishInitialState(); doNothing().when(mMainClear).establishInitialState();
mMasterClear mMainClear
.onActivityResultInternal(MasterClear.KEYGUARD_REQUEST, Activity.RESULT_CANCELED, .onActivityResultInternal(MainClear.KEYGUARD_REQUEST, Activity.RESULT_CANCELED,
null); null);
verify(mMasterClear, times(1)).isValidRequestCode(eq(MasterClear.KEYGUARD_REQUEST)); verify(mMainClear, times(1)).isValidRequestCode(eq(MainClear.KEYGUARD_REQUEST));
verify(mMasterClear, times(1)).establishInitialState(); verify(mMainClear, times(1)).establishInitialState();
verify(mMasterClear, times(0)).getAccountConfirmationIntent(); verify(mMainClear, times(0)).getAccountConfirmationIntent();
verify(mMasterClear, times(0)).showFinalConfirmation(); verify(mMainClear, times(0)).showFinalConfirmation();
} }
@Test @Test
public void testOnActivityResultInternal_keyguardRequestTriggeringConfirmAccount() { public void testOnActivityResultInternal_keyguardRequestTriggeringConfirmAccount() {
doReturn(true).when(mMasterClear).isValidRequestCode(eq(MasterClear.KEYGUARD_REQUEST)); doReturn(true).when(mMainClear).isValidRequestCode(eq(MainClear.KEYGUARD_REQUEST));
doReturn(mMockIntent).when(mMasterClear).getAccountConfirmationIntent(); doReturn(mMockIntent).when(mMainClear).getAccountConfirmationIntent();
doNothing().when(mMasterClear).showAccountCredentialConfirmation(eq(mMockIntent)); doNothing().when(mMainClear).showAccountCredentialConfirmation(eq(mMockIntent));
mMasterClear mMainClear
.onActivityResultInternal(MasterClear.KEYGUARD_REQUEST, Activity.RESULT_OK, null); .onActivityResultInternal(MainClear.KEYGUARD_REQUEST, Activity.RESULT_OK, null);
verify(mMasterClear, times(1)).isValidRequestCode(eq(MasterClear.KEYGUARD_REQUEST)); verify(mMainClear, times(1)).isValidRequestCode(eq(MainClear.KEYGUARD_REQUEST));
verify(mMasterClear, times(0)).establishInitialState(); verify(mMainClear, times(0)).establishInitialState();
verify(mMasterClear, times(1)).getAccountConfirmationIntent(); verify(mMainClear, times(1)).getAccountConfirmationIntent();
verify(mMasterClear, times(1)).showAccountCredentialConfirmation(eq(mMockIntent)); verify(mMainClear, times(1)).showAccountCredentialConfirmation(eq(mMockIntent));
} }
@Test @Test
public void testOnActivityResultInternal_keyguardRequestTriggeringShowFinal() { public void testOnActivityResultInternal_keyguardRequestTriggeringShowFinal() {
doReturn(true).when(mMasterClear).isValidRequestCode(eq(MasterClear.KEYGUARD_REQUEST)); doReturn(true).when(mMainClear).isValidRequestCode(eq(MainClear.KEYGUARD_REQUEST));
doReturn(null).when(mMasterClear).getAccountConfirmationIntent(); doReturn(null).when(mMainClear).getAccountConfirmationIntent();
doNothing().when(mMasterClear).showFinalConfirmation(); doNothing().when(mMainClear).showFinalConfirmation();
mMasterClear mMainClear
.onActivityResultInternal(MasterClear.KEYGUARD_REQUEST, Activity.RESULT_OK, null); .onActivityResultInternal(MainClear.KEYGUARD_REQUEST, Activity.RESULT_OK, null);
verify(mMasterClear, times(1)).isValidRequestCode(eq(MasterClear.KEYGUARD_REQUEST)); verify(mMainClear, times(1)).isValidRequestCode(eq(MainClear.KEYGUARD_REQUEST));
verify(mMasterClear, times(0)).establishInitialState(); verify(mMainClear, times(0)).establishInitialState();
verify(mMasterClear, times(1)).getAccountConfirmationIntent(); verify(mMainClear, times(1)).getAccountConfirmationIntent();
verify(mMasterClear, times(1)).showFinalConfirmation(); verify(mMainClear, times(1)).showFinalConfirmation();
} }
@Test @Test
public void testOnActivityResultInternal_confirmRequestTriggeringShowFinal() { public void testOnActivityResultInternal_confirmRequestTriggeringShowFinal() {
doReturn(true).when(mMasterClear) doReturn(true).when(mMainClear)
.isValidRequestCode(eq(MasterClear.CREDENTIAL_CONFIRM_REQUEST)); .isValidRequestCode(eq(MainClear.CREDENTIAL_CONFIRM_REQUEST));
doNothing().when(mMasterClear).showFinalConfirmation(); doNothing().when(mMainClear).showFinalConfirmation();
mMasterClear.onActivityResultInternal( mMainClear.onActivityResultInternal(
MasterClear.CREDENTIAL_CONFIRM_REQUEST, Activity.RESULT_OK, null); MainClear.CREDENTIAL_CONFIRM_REQUEST, Activity.RESULT_OK, null);
verify(mMasterClear, times(1)) verify(mMainClear, times(1))
.isValidRequestCode(eq(MasterClear.CREDENTIAL_CONFIRM_REQUEST)); .isValidRequestCode(eq(MainClear.CREDENTIAL_CONFIRM_REQUEST));
verify(mMasterClear, times(0)).establishInitialState(); verify(mMainClear, times(0)).establishInitialState();
verify(mMasterClear, times(0)).getAccountConfirmationIntent(); verify(mMainClear, times(0)).getAccountConfirmationIntent();
verify(mMasterClear, times(1)).showFinalConfirmation(); verify(mMainClear, times(1)).showFinalConfirmation();
} }
@Test @Test
public void testGetAccountConfirmationIntent_unsupported() { public void testGetAccountConfirmationIntent_unsupported() {
when(mMasterClear.getActivity()).thenReturn(mActivity); when(mMainClear.getActivity()).thenReturn(mActivity);
/* Using the default resources, account confirmation shouldn't trigger */ /* Using the default resources, account confirmation shouldn't trigger */
assertThat(mMasterClear.getAccountConfirmationIntent()).isNull(); assertThat(mMainClear.getAccountConfirmationIntent()).isNull();
} }
@Test @Test
public void testGetAccountConfirmationIntent_no_relevant_accounts() { public void testGetAccountConfirmationIntent_no_relevant_accounts() {
when(mMasterClear.getActivity()).thenReturn(mMockActivity); when(mMainClear.getActivity()).thenReturn(mMockActivity);
when(mMockActivity.getString(R.string.account_type)).thenReturn(TEST_ACCOUNT_TYPE); when(mMockActivity.getString(R.string.account_type)).thenReturn(TEST_ACCOUNT_TYPE);
when(mMockActivity.getString(R.string.account_confirmation_package)) when(mMockActivity.getString(R.string.account_confirmation_package))
.thenReturn(TEST_CONFIRMATION_PACKAGE); .thenReturn(TEST_CONFIRMATION_PACKAGE);
@@ -368,12 +368,12 @@ public class MasterClearTest {
Account[] accounts = new Account[0]; Account[] accounts = new Account[0];
when(mMockActivity.getSystemService(Context.ACCOUNT_SERVICE)).thenReturn(mAccountManager); when(mMockActivity.getSystemService(Context.ACCOUNT_SERVICE)).thenReturn(mAccountManager);
when(mAccountManager.getAccountsByType(TEST_ACCOUNT_TYPE)).thenReturn(accounts); when(mAccountManager.getAccountsByType(TEST_ACCOUNT_TYPE)).thenReturn(accounts);
assertThat(mMasterClear.getAccountConfirmationIntent()).isNull(); assertThat(mMainClear.getAccountConfirmationIntent()).isNull();
} }
@Test @Test
public void testGetAccountConfirmationIntent_unresolved() { public void testGetAccountConfirmationIntent_unresolved() {
when(mMasterClear.getActivity()).thenReturn(mMockActivity); when(mMainClear.getActivity()).thenReturn(mMockActivity);
when(mMockActivity.getString(R.string.account_type)).thenReturn(TEST_ACCOUNT_TYPE); when(mMockActivity.getString(R.string.account_type)).thenReturn(TEST_ACCOUNT_TYPE);
when(mMockActivity.getString(R.string.account_confirmation_package)) when(mMockActivity.getString(R.string.account_confirmation_package))
.thenReturn(TEST_CONFIRMATION_PACKAGE); .thenReturn(TEST_CONFIRMATION_PACKAGE);
@@ -385,12 +385,12 @@ public class MasterClearTest {
// The package manager should not resolve the confirmation intent targeting the non-existent // The package manager should not resolve the confirmation intent targeting the non-existent
// confirmation package. // confirmation package.
when(mMockActivity.getPackageManager()).thenReturn(mPackageManager); when(mMockActivity.getPackageManager()).thenReturn(mPackageManager);
assertThat(mMasterClear.getAccountConfirmationIntent()).isNull(); assertThat(mMainClear.getAccountConfirmationIntent()).isNull();
} }
@Test @Test
public void testTryShowAccountConfirmation_ok() { public void testTryShowAccountConfirmation_ok() {
when(mMasterClear.getActivity()).thenReturn(mMockActivity); when(mMainClear.getActivity()).thenReturn(mMockActivity);
// Only try to show account confirmation if the appropriate resource overlays are available. // Only try to show account confirmation if the appropriate resource overlays are available.
when(mMockActivity.getString(R.string.account_type)).thenReturn(TEST_ACCOUNT_TYPE); when(mMockActivity.getString(R.string.account_type)).thenReturn(TEST_ACCOUNT_TYPE);
when(mMockActivity.getString(R.string.account_confirmation_package)) when(mMockActivity.getString(R.string.account_confirmation_package))
@@ -411,7 +411,7 @@ public class MasterClearTest {
resolveInfo.activityInfo = activityInfo; resolveInfo.activityInfo = activityInfo;
when(mPackageManager.resolveActivity(any(), eq(0))).thenReturn(resolveInfo); when(mPackageManager.resolveActivity(any(), eq(0))).thenReturn(resolveInfo);
Intent actualIntent = mMasterClear.getAccountConfirmationIntent(); Intent actualIntent = mMainClear.getAccountConfirmationIntent();
assertThat(TEST_CONFIRMATION_PACKAGE).isEqualTo( assertThat(TEST_CONFIRMATION_PACKAGE).isEqualTo(
actualIntent.getComponent().getPackageName()); actualIntent.getComponent().getPackageName());
assertThat(TEST_CONFIRMATION_CLASS).isEqualTo(actualIntent.getComponent().getClassName()); assertThat(TEST_CONFIRMATION_CLASS).isEqualTo(actualIntent.getComponent().getClassName());
@@ -420,40 +420,40 @@ public class MasterClearTest {
@Test @Test
public void testShowAccountCredentialConfirmation() { public void testShowAccountCredentialConfirmation() {
// Finally mock out the startActivityForResultCall // Finally mock out the startActivityForResultCall
doNothing().when(mMasterClear) doNothing().when(mMainClear)
.startActivityForResult(eq(mMockIntent), .startActivityForResult(eq(mMockIntent),
eq(MasterClear.CREDENTIAL_CONFIRM_REQUEST)); eq(MainClear.CREDENTIAL_CONFIRM_REQUEST));
mMasterClear.showAccountCredentialConfirmation(mMockIntent); mMainClear.showAccountCredentialConfirmation(mMockIntent);
verify(mMasterClear, times(1)) verify(mMainClear, times(1))
.startActivityForResult(eq(mMockIntent), .startActivityForResult(eq(mMockIntent),
eq(MasterClear.CREDENTIAL_CONFIRM_REQUEST)); eq(MainClear.CREDENTIAL_CONFIRM_REQUEST));
} }
@Test @Test
public void testIsValidRequestCode() { public void testIsValidRequestCode() {
assertThat(mMasterClear.isValidRequestCode(MasterClear.KEYGUARD_REQUEST)).isTrue(); assertThat(mMainClear.isValidRequestCode(MainClear.KEYGUARD_REQUEST)).isTrue();
assertThat(mMasterClear.isValidRequestCode(MasterClear.CREDENTIAL_CONFIRM_REQUEST)) assertThat(mMainClear.isValidRequestCode(MainClear.CREDENTIAL_CONFIRM_REQUEST))
.isTrue(); .isTrue();
assertThat(mMasterClear.isValidRequestCode(0)).isFalse(); assertThat(mMainClear.isValidRequestCode(0)).isFalse();
} }
@Test @Test
public void testOnGlobalLayout_shouldNotRemoveListener() { public void testOnGlobalLayout_shouldNotRemoveListener() {
final ViewTreeObserver viewTreeObserver = mock(ViewTreeObserver.class); final ViewTreeObserver viewTreeObserver = mock(ViewTreeObserver.class);
mMasterClear.mScrollView = mScrollView; mMainClear.mScrollView = mScrollView;
doNothing().when(mMasterClear).onGlobalLayout(); doNothing().when(mMainClear).onGlobalLayout();
doReturn(true).when(mMasterClear).hasReachedBottom(any()); doReturn(true).when(mMainClear).hasReachedBottom(any());
when(mScrollView.getViewTreeObserver()).thenReturn(viewTreeObserver); when(mScrollView.getViewTreeObserver()).thenReturn(viewTreeObserver);
mMasterClear.onGlobalLayout(); mMainClear.onGlobalLayout();
verify(viewTreeObserver, never()).removeOnGlobalLayoutListener(mMasterClear); verify(viewTreeObserver, never()).removeOnGlobalLayoutListener(mMainClear);
} }
private void prepareEuiccState( private void prepareEuiccState(
boolean isEuiccEnabled, boolean isEuiccProvisioned, boolean isDeveloper) { boolean isEuiccEnabled, boolean isEuiccProvisioned, boolean isDeveloper) {
doReturn(mActivity).when(mMasterClear).getContext(); doReturn(mActivity).when(mMainClear).getContext();
doReturn(isEuiccEnabled).when(mMasterClear).isEuiccEnabled(any()); doReturn(isEuiccEnabled).when(mMainClear).isEuiccEnabled(any());
ContentResolver cr = mActivity.getContentResolver(); ContentResolver cr = mActivity.getContentResolver();
Settings.Global.putInt(cr, Settings.Global.EUICC_PROVISIONED, isEuiccProvisioned ? 1 : 0); Settings.Global.putInt(cr, Settings.Global.EUICC_PROVISIONED, isEuiccProvisioned ? 1 : 0);
DevelopmentSettingsEnabler.setDevelopmentSettingsEnabled(mActivity, isDeveloper); DevelopmentSettingsEnabler.setDevelopmentSettingsEnabled(mActivity, isDeveloper);

View File

@@ -18,10 +18,9 @@ package com.android.settings;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static org.robolectric.Shadows.shadowOf;
import static org.mockito.Mockito.spy; import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import static org.robolectric.Shadows.shadowOf;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
@@ -57,7 +56,7 @@ public class ResetNetworkTest {
Intent intent = shadowOf(mActivity).getNextStartedActivity(); Intent intent = shadowOf(mActivity).getNextStartedActivity();
assertThat(intent.getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS) assertThat(intent.getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS)
.getBoolean(MasterClear.ERASE_ESIMS_EXTRA, false)).isTrue(); .getBoolean(MainClear.ERASE_ESIMS_EXTRA, false)).isTrue();
} }
@Test @Test
@@ -69,7 +68,7 @@ public class ResetNetworkTest {
Intent intent = shadowOf(mActivity).getNextStartedActivity(); Intent intent = shadowOf(mActivity).getNextStartedActivity();
assertThat(intent.getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS) assertThat(intent.getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS)
.getBoolean(MasterClear.ERASE_ESIMS_EXTRA, false)).isFalse(); .getBoolean(MainClear.ERASE_ESIMS_EXTRA, false)).isFalse();
} }
@Test @Test
@@ -81,7 +80,7 @@ public class ResetNetworkTest {
Intent intent = shadowOf(mActivity).getNextStartedActivity(); Intent intent = shadowOf(mActivity).getNextStartedActivity();
assertThat(intent.getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS) assertThat(intent.getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS)
.getBoolean(MasterClear.ERASE_ESIMS_EXTRA, false)).isFalse(); .getBoolean(MainClear.ERASE_ESIMS_EXTRA, false)).isFalse();
} }
@Test @Test
@@ -93,6 +92,6 @@ public class ResetNetworkTest {
Intent intent = shadowOf(mActivity).getNextStartedActivity(); Intent intent = shadowOf(mActivity).getNextStartedActivity();
assertThat(intent.getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS) assertThat(intent.getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS)
.getBoolean(MasterClear.ERASE_ESIMS_EXTRA, false)).isFalse(); .getBoolean(MainClear.ERASE_ESIMS_EXTRA, false)).isFalse();
} }
} }

View File

@@ -70,7 +70,7 @@ public class SwitchBarTest {
@Test @Test
public void cycleChecked_customLabel_shouldUpdateTextAndBackground() { public void cycleChecked_customLabel_shouldUpdateTextAndBackground() {
final int onText = R.string.master_clear_progress_text; final int onText = R.string.main_clear_progress_text;
final int offText = R.string.manage_space_text; final int offText = R.string.manage_space_text;
mBar.setSwitchBarText(onText, offText); mBar.setSwitchBarText(onText, offText);
@@ -87,9 +87,9 @@ public class SwitchBarTest {
@Test @Test
public void setCheck_customLabelWithStringType_shouldUpdateTextAndBackground() { public void setCheck_customLabelWithStringType_shouldUpdateTextAndBackground() {
final String onText = mContext.getString( final String onText = mContext.getString(
R.string.accessibility_service_master_switch_title); R.string.accessibility_service_primary_switch_title);
final String offText = mContext.getString( final String offText = mContext.getString(
R.string.accessibility_service_master_switch_title); R.string.accessibility_service_primary_switch_title);
final TextView switchBarTextView = ((TextView) mBar.findViewById(R.id.switch_text)); final TextView switchBarTextView = ((TextView) mBar.findViewById(R.id.switch_text));
mBar.setSwitchBarText(onText, offText); mBar.setSwitchBarText(onText, offText);