Loading src/com/android/settings/MasterClear.java +3 −5 Original line number Diff line number Diff line Loading @@ -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() { Loading @@ -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 Loading tests/robotests/src/com/android/settings/MasterClearTest.java +4 −27 Original line number Diff line number Diff line Loading @@ -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 Loading Loading
src/com/android/settings/MasterClear.java +3 −5 Original line number Diff line number Diff line Loading @@ -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() { Loading @@ -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 Loading
tests/robotests/src/com/android/settings/MasterClearTest.java +4 −27 Original line number Diff line number Diff line Loading @@ -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 Loading