We are developing an application that downloads and manage eSIM profiles. Since Android 13, we have an issue when compiling the app to API level 33. Reproduced on Pixel 7 and Samsung S20.
From Android 13, the switchToSubscription
method has a portIndex
parameter.
EuiccManager API reference.
Getting the port index and verifying that we have the entitlement to manage the eSIM works fine. The profile was downloaded using the same app, so it has carrier privileges.
It works from the system obviously. It works also fine when targeting API level 32 and using the previous switchToSubscription
interface.
With:
public void switchToSubscription (int subscriptionId, int portIndex, PendingIntent callbackIntent)
The error we are getting from API level 33 on Android 13:
FATAL EXCEPTION: main
[...], PID: 22231
java.lang.SecurityException: Must have carrier privileges to use switchToSubscription with portIndex
at android.telephony.evicc.EviccManager.switchToSubscription(EuiccManager.java:1297)
Strange fact:
- The
SubscriptionManager.canManageSubscription(subscriptionInfo)
answerstrue
. - The
TelephonyManager.hasCarrierPrivileges()
answersfalse
although from the Telephony manager doc:
hasCarrierPrivileges is a superset of the checks done in SubscriptionManager#canManageSubscription
Would anyone knows a way to make this work?
Thanks