Add checkbox to let user wipe eSIM data together with FDR

This CL add a check box for eSIM enabled devices to reset eSIM data
during factory reset of the phone.

Bug: 67500470
Test: make RunSettingsRoboTests
Change-Id: I5a81d43f23ae55f8549a5b807fdf41f36c9d3acd
This commit is contained in:
Qingxi Li
2018-01-11 11:35:07 -08:00
parent aaf307e71d
commit c8a2b040a1
8 changed files with 78 additions and 19 deletions

View File

@@ -33,6 +33,7 @@ import android.os.Bundle;
import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.ScrollView;
@@ -93,6 +94,32 @@ public class MasterClearTest {
when(mScrollView.getChildCount()).thenReturn(1);
}
@Test
public void testShowFinalConfirmation_eraseEsimChecked() {
ActivityForTest testActivity = new ActivityForTest();
when(mMasterClear.getActivity()).thenReturn(testActivity);
mMasterClear.mEsimStorage = mContentView.findViewById(R.id.erase_esim);
mMasterClear.mExternalStorage = mContentView.findViewById(R.id.erase_external);
mMasterClear.mEsimStorage.setChecked(true);
mMasterClear.showFinalConfirmation();
assertThat(testActivity.getArgs().getBoolean(MasterClear.ERASE_ESIMS_EXTRA, false))
.isTrue();
}
@Test
public void testShowFinalConfirmation_eraseEsimUnchecked() {
ActivityForTest testActivity = new ActivityForTest();
when(mMasterClear.getActivity()).thenReturn(testActivity);
mMasterClear.mEsimStorage = mContentView.findViewById(R.id.erase_esim);
mMasterClear.mExternalStorage = mContentView.findViewById(R.id.erase_external);
mMasterClear.mEsimStorage.setChecked(false);
mMasterClear.showFinalConfirmation();
assertThat(testActivity.getArgs().getBoolean(MasterClear.ERASE_ESIMS_EXTRA, true))
.isFalse();
}
@Test
public void testShowWipeEuicc_euiccDisabled() {
prepareEuiccState(

View File

@@ -66,7 +66,7 @@ public class ResetNetworkConfirmTest {
public void testResetNetworkData_resetEsim() {
mResetNetworkConfirm.mEraseEsim = true;
doReturn(true)
.when(mRecoverySystem).wipeEuiccData(any(Context.class), anyBoolean(), anyString());
.when(mRecoverySystem).wipeEuiccData(any(Context.class), anyString());
mResetNetworkConfirm.esimFactoryReset(mActivity, "" /* packageName */);
try {
@@ -77,7 +77,7 @@ public class ResetNetworkConfirmTest {
}
Assert.assertNotNull(mResetNetworkConfirm.mEraseEsimTask);
verify(mRecoverySystem).wipeEuiccData(any(Context.class), anyBoolean(), anyString());
verify(mRecoverySystem).wipeEuiccData(any(Context.class), anyString());
}
@Test
@@ -88,6 +88,6 @@ public class ResetNetworkConfirmTest {
Assert.assertNull(mResetNetworkConfirm.mEraseEsimTask);
verify(mRecoverySystem, never())
.wipeEuiccData(any(Context.class), anyBoolean(), anyString());
.wipeEuiccData(any(Context.class), anyString());
}
}