UI Tweak for eSIM related
This CL update following UI of eSIM:
1. update title of eSIM reset checkbox under network reset and FDR screens.
2. update eSIM reset checkbox to default is checked.
3. Show eSIM reset checkbox in FDR when user is under developer mode.
Bug: 74083169
Bug: 74085673
Bug: 74771900
Bug: 74122440
Test: E2E & make RunSettingsRoboTests
Change-Id: Ia49fdae98d6ef541398b1dfb36c54beea1f2ba39
diff --git a/res/layout/master_clear.xml b/res/layout/master_clear.xml
index d328478..c1e224f 100644
--- a/res/layout/master_clear.xml
+++ b/res/layout/master_clear.xml
@@ -116,6 +116,7 @@
</LinearLayout>
</LinearLayout>
<include layout="@layout/reset_esim_checkbox"
+ android:layout_marginTop="40dp"
android:id="@+id/erase_esim_container"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
diff --git a/res/layout/reset_esim_checkbox.xml b/res/layout/reset_esim_checkbox.xml
index d830bf4..fb15fe6 100644
--- a/res/layout/reset_esim_checkbox.xml
+++ b/res/layout/reset_esim_checkbox.xml
@@ -30,6 +30,7 @@
android:paddingEnd="@dimen/reset_checkbox_padding_end"
android:focusable="false"
android:clickable="false"
+ android:checked="true"
android:duplicateParentState="true" />
<LinearLayout
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 45d6e9c..c6d690c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3217,7 +3217,7 @@
<!-- SD card & phone storage settings screen, message on screen after user selects Reset network settings [CHAR LIMIT=NONE] -->
<string name="reset_network_desc">This will reset all network settings, including:\n\n<li>Wi\u2011Fi</li>\n<li>Mobile data</li>\n<li>Bluetooth</li>"</string>
<!-- SD card & phone storage settings screen, title for the checkbox to let user decide whether erase eSIM data together [CHAR LIMIT=NONE] -->
- <string name="reset_esim_title">Also reset eSIMs</string>
+ <string name="reset_esim_title">Also reset eSIM</string>
<!-- SD card & phone storage settings screen, message for the checkbox to let user decide whether erase eSIM data together [CHAR LIMIT=NONE] -->
<string name="reset_esim_desc">Erase all eSIMs on the phone. You\u2019ll have to contact your carrier to redownload your eSIMs. This will not cancel your mobile service plan.</string>
<!-- SD card & phone storage settings screen, button on screen after user selects Reset network settings -->
@@ -3267,7 +3267,7 @@
<!-- 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>
<!-- SD card & phone storage settings screen, label for check box to erase all the carriers information on the embedded SIM card [CHAR LIMIT=30] -->
- <string name="erase_esim_storage">Erase eSIMs</string>
+ <string name="erase_esim_storage">Erase eSIM</string>
<!-- SD card & phone storage settings screen, description for check box to erase eSIMs for default devices [CHAR LIMIT=NONE] -->
<string name="erase_esim_storage_description" product="default">Erase all eSIMs on the phone. This will not cancel your mobile service plan.</string>
<!-- SD card & phone storage settings screen, description for check box to erase eSIMs for tablets [CHAR LIMIT=NONE] -->
diff --git a/src/com/android/settings/MasterClear.java b/src/com/android/settings/MasterClear.java
index 46e0d41..766c6ae 100644
--- a/src/com/android/settings/MasterClear.java
+++ b/src/com/android/settings/MasterClear.java
@@ -357,7 +357,9 @@
return false;
}
ContentResolver cr = context.getContentResolver();
- return Settings.Global.getInt(cr, Settings.Global.EUICC_PROVISIONED, 0) != 0;
+ return Settings.Global.getInt(cr, Settings.Global.EUICC_PROVISIONED, 0) != 0
+ || Settings.Global.getInt(
+ cr, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
}
@VisibleForTesting
diff --git a/tests/robotests/src/com/android/settings/MasterClearTest.java b/tests/robotests/src/com/android/settings/MasterClearTest.java
index dc956aa..64dab16 100644
--- a/tests/robotests/src/com/android/settings/MasterClearTest.java
+++ b/tests/robotests/src/com/android/settings/MasterClearTest.java
@@ -45,6 +45,7 @@
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.Button;
+import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.ScrollView;
@@ -142,27 +143,43 @@
@Test
public void testShowWipeEuicc_euiccDisabled() {
- prepareEuiccState(false /* isEuiccEnabled */, true /* isEuiccProvisioned */);
+ prepareEuiccState(
+ false /* isEuiccEnabled */,
+ true /* isEuiccProvisioned */,
+ false /* isDeveloper */);
assertThat(mMasterClear.showWipeEuicc()).isFalse();
}
@Test
public void testShowWipeEuicc_euiccEnabled_unprovisioned() {
- prepareEuiccState(true /* isEuiccEnabled */, false /* isEuiccProvisioned */);
+ prepareEuiccState(
+ true /* isEuiccEnabled */,
+ false /* isEuiccProvisioned */,
+ false /* isDeveloper */);
assertThat(mMasterClear.showWipeEuicc()).isFalse();
}
@Test
public void testShowWipeEuicc_euiccEnabled_provisioned() {
- prepareEuiccState(true /* isEuiccEnabled */, true /* isEuiccProvisioned */);
+ prepareEuiccState(
+ true /* isEuiccEnabled */,
+ true /* isEuiccProvisioned */,
+ false /* isDeveloper */);
assertThat(mMasterClear.showWipeEuicc()).isTrue();
}
- private void prepareEuiccState(boolean isEuiccEnabled, boolean isEuiccProvisioned) {
- doReturn(mActivity).when(mMasterClear).getContext();
- doReturn(isEuiccEnabled).when(mMasterClear).isEuiccEnabled(any());
- ContentResolver cr = mActivity.getContentResolver();
- Settings.Global.putInt(cr, Settings.Global.EUICC_PROVISIONED, isEuiccProvisioned ? 1 : 0);
+ @Test
+ public void testShowWipeEuicc_developerMode_unprovisioned() {
+ prepareEuiccState(
+ true /* isEuiccEnabled */,
+ false /* isEuiccProvisioned */,
+ true /* isDeveloper */);
+ assertThat(mMasterClear.showWipeEuicc()).isTrue();
+ }
+
+ @Test
+ public void testEsimRecheckBoxDefaultChecked() {
+ assertThat(((CheckBox) mContentView.findViewById(R.id.erase_esim)).isChecked()).isTrue();
}
@Test
@@ -373,6 +390,16 @@
verify(viewTreeObserver, never()).removeOnGlobalLayoutListener(mMasterClear);
}
+ private void prepareEuiccState(
+ boolean isEuiccEnabled, boolean isEuiccProvisioned, boolean isDeveloper) {
+ doReturn(mActivity).when(mMasterClear).getContext();
+ doReturn(isEuiccEnabled).when(mMasterClear).isEuiccEnabled(any());
+ ContentResolver cr = mActivity.getContentResolver();
+ Settings.Global.putInt(cr, Settings.Global.EUICC_PROVISIONED, isEuiccProvisioned ? 1 : 0);
+ Settings.Global.putInt(
+ cr, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, isDeveloper ? 1 : 0);
+ }
+
private void initScrollView(int height, int scrollY, int childBottom) {
when(mScrollView.getHeight()).thenReturn(height);
when(mScrollView.getScrollY()).thenReturn(scrollY);