[SIM Dialog Migration] Enable SIM operation dialog in Settings

Change Settings to not call SubscriptionManager#setSubscriptionEnabled.
Instead, make Settings call EuiccManager APIs directly.
Design: https://docs.google.com/document/d/1wb5_hoBkZVbkXGNWHbx4Jf61swjfxsJzkytiTzJosYo/edit?usp=sharing
Bug: 160819390
Test: Manually tested eSIM profile enabling.

Change-Id: I56bbcbb9ccb886b0f9249e67c5a6a6444bb7dd45
This commit is contained in:
Jiashen Wang
2020-11-18 17:19:36 -08:00
parent 0d31082631
commit 8271561a76
6 changed files with 54 additions and 10 deletions

View File

@@ -28,6 +28,7 @@ import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.UiccSlotInfo;
import android.util.Log;
import androidx.annotation.VisibleForTesting;
@@ -284,14 +285,31 @@ public class SubscriptionUtil {
}
}
/** Starts a dialog activity to handle SIM enabling/disabling. */
/**
* Starts a dialog activity to handle SIM enabling/disabling.
* @param context {@code Context}
* @param subId The id of subscription need to be enabled or disabled.
* @param enable Whether the subscription with {@code subId} should be enabled or disabled.
*/
public static void startToggleSubscriptionDialogActivity(
Context context, int subId, boolean enable) {
if (!SubscriptionManager.isUsableSubscriptionId(subId)) {
Log.i(TAG, "Unable to toggle subscription due to invalid subscription ID.");
return;
}
context.startActivity(ToggleSubscriptionDialogActivity.getIntent(context, subId, enable));
}
/** Starts a dialog activity to handle eSIM deletion. */
/**
* Starts a dialog activity to handle eSIM deletion.
* @param context {@code Context}
* @param subId The id of subscription need to be deleted.
*/
public static void startDeleteEuiccSubscriptionDialogActivity(Context context, int subId) {
if (!SubscriptionManager.isUsableSubscriptionId(subId)) {
Log.i(TAG, "Unable to delete subscription due to invalid subscription ID.");
return;
}
context.startActivity(DeleteEuiccSubscriptionDialogActivity.getIntent(context, subId));
}