Support reset IMS stack in Reset Mobile Network flow
Reset the IMS stack for the specified subscription with the help of API TelephonyManager#resetIms. Bug: 271921464 Test: ResetNetworkOperationBuilderTest Change-Id: I61575f18bcc300f362000dc7f4257b9d794b6b69
This commit is contained in:
@@ -33,6 +33,7 @@ import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.settings.ResetNetworkRequest;
|
||||
import com.android.settings.network.apn.ApnSettings;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -212,6 +213,32 @@ public class ResetNetworkOperationBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a step of resetting IMS stack.
|
||||
*
|
||||
* @return this
|
||||
*/
|
||||
public ResetNetworkOperationBuilder resetIms(int subId) {
|
||||
attachSystemServiceWork(Context.TELEPHONY_SERVICE,
|
||||
(Consumer<TelephonyManager>) tm -> {
|
||||
if (subId == ResetNetworkRequest.INVALID_SUBSCRIPTION_ID) {
|
||||
// Do nothing
|
||||
return;
|
||||
}
|
||||
if (subId == ResetNetworkRequest.ALL_SUBSCRIPTION_ID) {
|
||||
// Reset IMS for all slots
|
||||
for (int slotIndex = 0; slotIndex < tm.getActiveModemCount(); slotIndex++) {
|
||||
tm.resetIms(slotIndex);
|
||||
}
|
||||
} else {
|
||||
// Reset IMS for the slot specified by the sucriptionId.
|
||||
final int slotIndex = SubscriptionManager.getSlotIndex(subId);
|
||||
tm.resetIms(slotIndex);
|
||||
}
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a Runnable containing all operations appended.
|
||||
* @return Runnable
|
||||
|
Reference in New Issue
Block a user