Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e0681db9 authored by Qingxi Li's avatar Qingxi Li
Browse files

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
parent 26b5b5b5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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" />
+1 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
        android:paddingEnd="@dimen/reset_checkbox_padding_end"
        android:focusable="false"
        android:clickable="false"
        android:checked="true"
        android:duplicateParentState="true" />

    <LinearLayout
+2 −2
Original line number Diff line number Diff line
@@ -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] -->
+3 −1
Original line number Diff line number Diff line
@@ -357,7 +357,9 @@ public class MasterClear extends InstrumentedFragment implements OnGlobalLayoutL
            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
+35 −8
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import android.view.LayoutInflater;
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 @@ public class MasterClearTest {

    @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 @@ public class MasterClearTest {
        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);