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:
Jeff Davidson
2017-06-30 18:02:13 -07:00
parent 32a8568230
commit 4ba7478fdf
2 changed files with 7 additions and 32 deletions

View File

@@ -247,9 +247,8 @@ public class MasterClear extends OptionsMenuFragment
/** /**
* Whether to show the checkbox to wipe the eUICC. * 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 * <p>We show the checkbox on any device which supports eUICC as long as the eUICC was ever
* ever provisioned (that is, at least one profile was ever downloaded onto it), or if the user * provisioned (that is, at least one profile was ever downloaded onto it).
* has enabled development mode.
*/ */
@VisibleForTesting @VisibleForTesting
boolean showWipeEuicc() { boolean showWipeEuicc() {
@@ -258,8 +257,7 @@ public class MasterClear extends OptionsMenuFragment
return false; return false;
} }
ContentResolver cr = context.getContentResolver(); 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 @VisibleForTesting

View File

@@ -92,55 +92,32 @@ public class MasterClearTest {
@Test @Test
public void testShowWipeEuicc_euiccDisabled() { public void testShowWipeEuicc_euiccDisabled() {
prepareEuiccState( prepareEuiccState(
false /* isEuiccEnabled */, true /* isEuiccProvisioned */, false /* isEuiccEnabled */, true /* isEuiccProvisioned */);
true /* isDevelopmentSettingsEnabled */);
assertThat(mMasterClear.showWipeEuicc()).isFalse(); assertThat(mMasterClear.showWipeEuicc()).isFalse();
} }
@Test @Test
public void testShowWipeEuicc_euiccEnabled_unprovisioned() { public void testShowWipeEuicc_euiccEnabled_unprovisioned() {
prepareEuiccState( prepareEuiccState(
true /* isEuiccEnabled */, false /* isEuiccProvisioned */, true /* isEuiccEnabled */, false /* isEuiccProvisioned */);
false /* isDevelopmentSettingsEnabled */);
assertThat(mMasterClear.showWipeEuicc()).isFalse(); assertThat(mMasterClear.showWipeEuicc()).isFalse();
} }
@Test @Test
public void testShowWipeEuicc_euiccEnabled_provisioned() { public void testShowWipeEuicc_euiccEnabled_provisioned() {
prepareEuiccState( prepareEuiccState(
true /* isEuiccEnabled */, true /* isEuiccProvisioned */, 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 */);
assertThat(mMasterClear.showWipeEuicc()).isTrue(); assertThat(mMasterClear.showWipeEuicc()).isTrue();
} }
private void prepareEuiccState( private void prepareEuiccState(
boolean isEuiccEnabled, boolean isEuiccEnabled,
boolean isEuiccProvisioned, boolean isEuiccProvisioned) {
boolean isDevelopmentSettingsEnabled) {
doReturn(mActivity).when(mMasterClear).getContext(); doReturn(mActivity).when(mMasterClear).getContext();
doReturn(isEuiccEnabled).when(mMasterClear).isEuiccEnabled(any()); doReturn(isEuiccEnabled).when(mMasterClear).isEuiccEnabled(any());
ContentResolver cr = mActivity.getContentResolver(); ContentResolver cr = mActivity.getContentResolver();
Settings.Global.putInt( Settings.Global.putInt(
cr, android.provider.Settings.Global.EUICC_PROVISIONED, isEuiccProvisioned ? 1 : 0); cr, android.provider.Settings.Global.EUICC_PROVISIONED, isEuiccProvisioned ? 1 : 0);
Settings.Global.putInt(
cr, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED,
isDevelopmentSettingsEnabled ? 1 : 0);
} }
@Test @Test