From c78b316c02fffe56bc8f3f26f59a4cafda74b938 Mon Sep 17 00:00:00 2001 From: Muralidhar Reddy Date: Wed, 11 May 2022 14:55:04 +0000 Subject: [PATCH] [MEP] set removable eSIM as default eUICC to pass GCF/PTCRB To support removable esim to pass GCT/PTCRB test in DSDS mode, we should make sure all the download/activation requests are by default route to the removable esim slot. In order to satisfy this use case, we should return removable esim cardId as default. 1. Add switch UI in RadioInfo hidden activity to set removable esim as default eUICC. 2. When switch is checked/unchecked, corresponding flag is set in UiccController and intent is broadcasted to LPA. 3. TelephonyManager#getCardIdForDefaultEuicc API returns removable esim cardId if switch is checked. Bug: 228640832 Test: Manual verification (Verified intent broadcast is received at LPA and flag is set in the UiccController) Change-Id: I1c3a77a8c76d53f1d88ac4bbd77c8dbadc8d7a74 --- .../android/telephony/TelephonyManager.java | 37 +++++++++++++++++++ .../internal/telephony/ITelephony.aidl | 14 +++++++ 2 files changed, 51 insertions(+) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 71ffd6e2ec9fd..71886ce5c1498 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -16985,4 +16985,41 @@ public class TelephonyManager { } mTelephonyRegistryMgr.removeCarrierPrivilegesCallback(callback); } + + /** + * set removable eSIM as default eUICC. + * + * @hide + */ + @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_EUICC) + public void setRemovableEsimAsDefaultEuicc(boolean isDefault) { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + telephony.setRemovableEsimAsDefaultEuicc(isDefault, getOpPackageName()); + } + } catch (RemoteException e) { + Log.e(TAG, "Error in setRemovableEsimAsDefault: " + e); + } + } + + /** + * Returns whether the removable eSIM is default eUICC or not. + * + * @hide + */ + @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_EUICC) + public boolean isRemovableEsimDefaultEuicc() { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.isRemovableEsimDefaultEuicc(getOpPackageName()); + } + } catch (RemoteException e) { + Log.e(TAG, "Error in isRemovableEsimDefaultEuicc: " + e); + } + return false; + } } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 7d116f9d5063f..0ce6b14ce3b06 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -2553,4 +2553,18 @@ interface ITelephony { * for the slot, or {@code null} if none is resolved */ String getCarrierServicePackageNameForLogicalSlot(int logicalSlotIndex); + + /** + * set removable eSIM as default eUICC. + * + * @hide + */ + void setRemovableEsimAsDefaultEuicc(boolean isDefault, String callingPackage); + + /** + * Returns whether the removable eSIM is default eUICC or not. + * + * @hide + */ + boolean isRemovableEsimDefaultEuicc(String callingPackage); }