eSIM profile is not erased during Reset mobile network settings flow
The CL fixes the bug that eSIM profile is not erased even if user choose to erase eSIM during Reset Mobile Network Settings flow. The issue was introduced when adding background operations to restart Phone process and RILD. Restart Phone process performed earlier. It may interrup the previous reset operations (e.g. eSIM erasing). The fix here is to arrange reset Phone and RILD in the end of the flow, only performed after all other reset operations. Bug: 345854350 Test: atest ResetNetworkOperationBuilderTest Test: Manual regression test Change-Id: If2bd492d417a07a7056bf9fd0d051f8811ba6369
This commit is contained in:
@@ -270,6 +270,7 @@ public class ResetNetworkRequest {
|
|||||||
if ((mResetOptions & RESET_IMS_STACK) != 0) {
|
if ((mResetOptions & RESET_IMS_STACK) != 0) {
|
||||||
builder.resetIms(mSubscriptionIdToResetIms);
|
builder.resetIms(mSubscriptionIdToResetIms);
|
||||||
}
|
}
|
||||||
|
// Reset phone process and RILD may impact above components, keep them at the end
|
||||||
if ((mResetOptions & RESET_PHONE_PROCESS) != 0) {
|
if ((mResetOptions & RESET_PHONE_PROCESS) != 0) {
|
||||||
builder.restartPhoneProcess();
|
builder.restartPhoneProcess();
|
||||||
}
|
}
|
||||||
|
@@ -256,16 +256,19 @@ public class ResetNetworkOperationBuilder {
|
|||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
public ResetNetworkOperationBuilder restartPhoneProcess() {
|
public ResetNetworkOperationBuilder restartPhoneProcess() {
|
||||||
try {
|
Runnable runnable = () -> {
|
||||||
mContext.getContentResolver().call(
|
try {
|
||||||
getResetTelephonyContentProviderAuthority(),
|
mContext.getContentResolver().call(
|
||||||
METHOD_RESTART_PHONE_PROCESS,
|
getResetTelephonyContentProviderAuthority(),
|
||||||
/* arg= */ null,
|
METHOD_RESTART_PHONE_PROCESS,
|
||||||
/* extras= */ null);
|
/* arg= */ null,
|
||||||
Log.i(TAG, "Phone process was restarted.");
|
/* extras= */ null);
|
||||||
} catch (IllegalArgumentException iae) {
|
Log.i(TAG, "Phone process was restarted.");
|
||||||
Log.w(TAG, "Fail to restart phone process: " + iae);
|
} catch (IllegalArgumentException iae) {
|
||||||
}
|
Log.w(TAG, "Fail to restart phone process: " + iae);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
mResetSequence.add(runnable);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,16 +278,19 @@ public class ResetNetworkOperationBuilder {
|
|||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
public ResetNetworkOperationBuilder restartRild() {
|
public ResetNetworkOperationBuilder restartRild() {
|
||||||
try {
|
Runnable runnable = () -> {
|
||||||
mContext.getContentResolver().call(
|
try {
|
||||||
getResetTelephonyContentProviderAuthority(),
|
mContext.getContentResolver().call(
|
||||||
METHOD_RESTART_RILD,
|
getResetTelephonyContentProviderAuthority(),
|
||||||
/* arg= */ null,
|
METHOD_RESTART_RILD,
|
||||||
/* extras= */ null);
|
/* arg= */ null,
|
||||||
Log.i(TAG, "RILD was restarted.");
|
/* extras= */ null);
|
||||||
} catch (IllegalArgumentException iae) {
|
Log.i(TAG, "RILD was restarted.");
|
||||||
Log.w(TAG, "Fail to restart RILD: " + iae);
|
} catch (IllegalArgumentException iae) {
|
||||||
}
|
Log.w(TAG, "Fail to restart RILD: " + iae);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
mResetSequence.add(runnable);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -188,7 +188,7 @@ public class ResetNetworkOperationBuilderTest {
|
|||||||
doThrow(new IllegalArgumentException()).when(mContentProvider).call(
|
doThrow(new IllegalArgumentException()).when(mContentProvider).call(
|
||||||
anyString(), anyString(), anyString(), any());
|
anyString(), anyString(), anyString(), any());
|
||||||
|
|
||||||
mBuilder.restartPhoneProcess();
|
mBuilder.restartPhoneProcess().build().run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -196,12 +196,12 @@ public class ResetNetworkOperationBuilderTest {
|
|||||||
doThrow(new IllegalArgumentException()).when(mContentProvider).call(
|
doThrow(new IllegalArgumentException()).when(mContentProvider).call(
|
||||||
anyString(), anyString(), anyString(), any());
|
anyString(), anyString(), anyString(), any());
|
||||||
|
|
||||||
mBuilder.restartRild();
|
mBuilder.restartRild().build().run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void restartPhoneProcess_withTelephonyContentProvider_shouldCallRestartPhoneProcess() {
|
public void restartPhoneProcess_withTelephonyContentProvider_shouldCallRestartPhoneProcess() {
|
||||||
mBuilder.restartPhoneProcess();
|
mBuilder.restartPhoneProcess().build().run();
|
||||||
|
|
||||||
verify(mContentProvider).call(
|
verify(mContentProvider).call(
|
||||||
eq(mBuilder.getResetTelephonyContentProviderAuthority()),
|
eq(mBuilder.getResetTelephonyContentProviderAuthority()),
|
||||||
@@ -212,7 +212,7 @@ public class ResetNetworkOperationBuilderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void restartRild_withTelephonyContentProvider_shouldCallRestartRild() {
|
public void restartRild_withTelephonyContentProvider_shouldCallRestartRild() {
|
||||||
mBuilder.restartRild();
|
mBuilder.restartRild().build().run();
|
||||||
|
|
||||||
verify(mContentProvider).call(
|
verify(mContentProvider).call(
|
||||||
eq(mBuilder.getResetTelephonyContentProviderAuthority()),
|
eq(mBuilder.getResetTelephonyContentProviderAuthority()),
|
||||||
|
Reference in New Issue
Block a user