Migrate SIM operation dialog from LPA to Settings

In Android R, when users enable, disable, delete, or rename a profile,
Settings calls SubscriptionManager APIs which telephony ends up to send
actions “TOGGLE_SUBSCRIPTION_PRIVILEGED”,
“DELETE_SUBSCRIPTION_PRIVILEGED”, and “RENAME_SUBSCRIPTION_PRIVILEGED”
to EuiccManager. After EuiccUiDispatcher dispatches the action, Google
LPA receives it and starts the corresponding operations and DSDS
dialogs. We can see there some back-and-forth that goes on between LPA
and telephony. In order to improve the current structure, we devided
to move the dialogs to Settings and make it call EuiccManager APIs
directly.

Bug: 160819390
Test: Manually tested eSIM profile disabling.
Design: https://docs.google.com/document/d/1wb5_hoBkZVbkXGNWHbx4Jf61swjfxsJzkytiTzJosYo/edit?usp=sharing
Change-Id: Ib933df42ca3606de2310edc4d64c3e11800a1096
This commit is contained in:
Jiashen Wang
2020-09-08 15:57:40 -07:00
parent 7a7af7e23d
commit d8bd3bb669
8 changed files with 905 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ import static android.telephony.UiccSlotInfo.CARD_STATE_INFO_PRESENT;
import static com.android.internal.util.CollectionUtils.emptyIfNull;
import android.annotation.Nullable;
import android.content.Context;
import android.os.ParcelUuid;
import android.telephony.SubscriptionInfo;
@@ -30,6 +31,8 @@ import android.telephony.UiccSlotInfo;
import androidx.annotation.VisibleForTesting;
import com.android.settings.network.telephony.ToggleSubscriptionDialogActivity;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -278,6 +281,33 @@ public class SubscriptionUtil {
}
}
/** Starts a dialog activity to handle SIM enabling/disabling. */
public static void startToggleSubscriptionDialogActivity(
Context context, int subId, boolean enable) {
context.startActivity(ToggleSubscriptionDialogActivity.getIntent(context, subId, enable));
}
/**
* Finds and returns a subscription with a specific subscription ID.
* @param subscriptionManager The ProxySubscriptionManager for accessing subscription
* information
* @param subId The id of subscription to be returned
* @return the {@code SubscriptionInfo} whose ID is {@code subId}. It returns null if the
* {@code subId} is {@code SubscriptionManager.INVALID_SUBSCRIPTION_ID} or no such
* {@code SubscriptionInfo} is found.
*/
@Nullable
public static SubscriptionInfo getSubById(SubscriptionManager subscriptionManager, int subId) {
if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
return null;
}
return subscriptionManager
.getAllSubscriptionInfoList()
.stream()
.filter(subInfo -> subInfo.getSubscriptionId() == subId)
.findFirst()
.get();
}
/**
* Whether a subscription is visible to API caller. If it's a bundled opportunistic