Merge "UI Tweak for eSIM related" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2a6b9ff315
@@ -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" />
|
||||
|
@@ -30,6 +30,7 @@
|
||||
android:paddingEnd="@dimen/reset_checkbox_padding_end"
|
||||
android:focusable="false"
|
||||
android:clickable="false"
|
||||
android:checked="true"
|
||||
android:duplicateParentState="true" />
|
||||
|
||||
<LinearLayout
|
||||
|
@@ -3224,7 +3224,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 -->
|
||||
@@ -3274,7 +3274,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] -->
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user