Don't show "Wipe eSIMs" checkbox for developers.
Per UX review feedback, it doesn't make sense to show this just because someone has developer options turned on. So only show it if the user has ever downloaded an eSIM profile. Change-Id: If474451dddcaa75bce1e57ce2f1751ef3adf45ee Test: TreeHugger Fixes: 63147904
This commit is contained in:
@@ -247,9 +247,8 @@ public class MasterClear extends OptionsMenuFragment
|
||||
/**
|
||||
* Whether to show the checkbox to wipe the eUICC.
|
||||
*
|
||||
* <p>We show the checkbox on any device which supports eUICC as long as either the eUICC was
|
||||
* ever provisioned (that is, at least one profile was ever downloaded onto it), or if the user
|
||||
* has enabled development mode.
|
||||
* <p>We show the checkbox on any device which supports eUICC as long as the eUICC was ever
|
||||
* provisioned (that is, at least one profile was ever downloaded onto it).
|
||||
*/
|
||||
@VisibleForTesting
|
||||
boolean showWipeEuicc() {
|
||||
@@ -258,8 +257,7 @@ public class MasterClear extends OptionsMenuFragment
|
||||
return false;
|
||||
}
|
||||
ContentResolver cr = context.getContentResolver();
|
||||
return Settings.Global.getInt(cr, Settings.Global.EUICC_PROVISIONED, 0) != 0
|
||||
|| Settings.Global.getInt(cr, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
|
||||
return Settings.Global.getInt(cr, Settings.Global.EUICC_PROVISIONED, 0) != 0;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
@@ -92,55 +92,32 @@ public class MasterClearTest {
|
||||
@Test
|
||||
public void testShowWipeEuicc_euiccDisabled() {
|
||||
prepareEuiccState(
|
||||
false /* isEuiccEnabled */, true /* isEuiccProvisioned */,
|
||||
true /* isDevelopmentSettingsEnabled */);
|
||||
false /* isEuiccEnabled */, true /* isEuiccProvisioned */);
|
||||
assertThat(mMasterClear.showWipeEuicc()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShowWipeEuicc_euiccEnabled_unprovisioned() {
|
||||
prepareEuiccState(
|
||||
true /* isEuiccEnabled */, false /* isEuiccProvisioned */,
|
||||
false /* isDevelopmentSettingsEnabled */);
|
||||
true /* isEuiccEnabled */, false /* isEuiccProvisioned */);
|
||||
assertThat(mMasterClear.showWipeEuicc()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShowWipeEuicc_euiccEnabled_provisioned() {
|
||||
prepareEuiccState(
|
||||
true /* isEuiccEnabled */, true /* isEuiccProvisioned */,
|
||||
false /* isDevelopmentSettingsEnabled */);
|
||||
assertThat(mMasterClear.showWipeEuicc()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShowWipeEuicc_euiccEnabled_developmentSettingsEnabled() {
|
||||
prepareEuiccState(
|
||||
true /* isEuiccEnabled */, false /* isEuiccProvisioned */,
|
||||
true /* isDevelopmentSettingsEnabled */);
|
||||
assertThat(mMasterClear.showWipeEuicc()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShowWipeEuicc_euiccEnabled_provisioned_developmentSettingsEnabled() {
|
||||
prepareEuiccState(
|
||||
true /* isEuiccEnabled */, true /* isEuiccProvisioned */,
|
||||
true /* isDevelopmentSettingsEnabled */);
|
||||
true /* isEuiccEnabled */, true /* isEuiccProvisioned */);
|
||||
assertThat(mMasterClear.showWipeEuicc()).isTrue();
|
||||
}
|
||||
|
||||
private void prepareEuiccState(
|
||||
boolean isEuiccEnabled,
|
||||
boolean isEuiccProvisioned,
|
||||
boolean isDevelopmentSettingsEnabled) {
|
||||
boolean isEuiccProvisioned) {
|
||||
doReturn(mActivity).when(mMasterClear).getContext();
|
||||
doReturn(isEuiccEnabled).when(mMasterClear).isEuiccEnabled(any());
|
||||
ContentResolver cr = mActivity.getContentResolver();
|
||||
Settings.Global.putInt(
|
||||
cr, android.provider.Settings.Global.EUICC_PROVISIONED, isEuiccProvisioned ? 1 : 0);
|
||||
Settings.Global.putInt(
|
||||
cr, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED,
|
||||
isDevelopmentSettingsEnabled ? 1 : 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user