UI Tweak for eSIM related

This CL update following UI of eSIM:
    1. update title of eSIM reset checkbox under network reset and FDR screens.
    2. update eSIM reset checkbox to default is checked.
    3. Show eSIM reset checkbox in FDR when user is under developer mode.

Bug: 74083169
Bug: 74085673
Bug: 74771900
Bug: 74122440
Test: E2E & make RunSettingsRoboTests
Change-Id: Ia49fdae98d6ef541398b1dfb36c54beea1f2ba39
This commit is contained in:
Qingxi Li
2018-03-14 16:00:47 -07:00
parent 26b5b5b5db
commit e0681db921
5 changed files with 42 additions and 11 deletions

View File

@@ -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);