Loading core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -45159,6 +45159,7 @@ package android.telephony { method public void addOnSubscriptionsChangedListener(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.SubscriptionManager.OnSubscriptionsChangedListener); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void addSubscriptionsIntoGroup(@NonNull java.util.List<java.lang.Integer>, @NonNull android.os.ParcelUuid); method public boolean canManageSubscription(android.telephony.SubscriptionInfo); method @FlaggedApi("com.android.internal.telephony.flags.work_profile_api_split") @NonNull public android.telephony.SubscriptionManager createForAllUserProfiles(); method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public android.os.ParcelUuid createSubscriptionGroup(@NonNull java.util.List<java.lang.Integer>); method @Deprecated public static android.telephony.SubscriptionManager from(android.content.Context); method public java.util.List<android.telephony.SubscriptionInfo> getAccessibleSubscriptionInfoList(); telephony/java/android/telephony/SubscriptionManager.java +92 −7 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.Manifest; import android.annotation.CallbackExecutor; import android.annotation.ColorInt; import android.annotation.DurationMillisLong; import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; Loading Loading @@ -70,6 +71,7 @@ import android.util.Pair; import com.android.internal.telephony.ISetOpportunisticDataCallback; import com.android.internal.telephony.ISub; import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.flags.Flags; import com.android.internal.telephony.util.HandlerExecutor; import com.android.internal.util.FunctionalUtils; import com.android.internal.util.Preconditions; Loading @@ -95,7 +97,22 @@ import java.util.function.Consumer; import java.util.stream.Collectors; /** * Subscription manager provides the mobile subscription information. * Subscription manager provides the mobile subscription information that are associated with the * calling user profile {@link UserHandle} for Android SDK 35(V) and above, while Android SDK 34(U) * and below can see all subscriptions as it does today. * * <p>For example, if we have * <ul> * <li> Subscription 1 associated with personal profile. * <li> Subscription 2 associated with work profile. * </ul> * Then for SDK 35+, if the caller identity is personal profile, then * {@link #getActiveSubscriptionInfoList} will return subscription 1 only and vice versa. * * <p>If the caller needs to see all subscriptions across user profiles, * use {@link #createForAllUserProfiles} to convert the instance to see all. Additional permission * may be required as documented on the each API. * */ @SystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) Loading Loading @@ -1446,6 +1463,16 @@ public class SubscriptionManager { } } /** * {@code true} if the SubscriptionManager instance should see all subscriptions regardless its * association with particular user profile. * * <p> It only applies to Android SDK 35(V) and above. For Android SDK 34(U) and below, the * caller can see all subscription across user profiles as it does today today even if it's * {@code false}. */ private boolean mIsForAllUserProfiles = false; /** @hide */ @UnsupportedAppUsage public SubscriptionManager(Context context) { Loading Loading @@ -1776,8 +1803,23 @@ public class SubscriptionManager { } /** * Get the SubscriptionInfo(s) of the currently active SIM(s). The records will be sorted * by {@link SubscriptionInfo#getSimSlotIndex} then by {@link SubscriptionInfo#getSubscriptionId}. * Get the SubscriptionInfo(s) of the currently active SIM(s) associated with the current caller * user profile {@link UserHandle} for Android SDK 35(V) and above, while Android SDK 34(U) * and below can see all subscriptions as it does today. * * <p>For example, if we have * <ul> * <li> Subscription 1 associated with personal profile. * <li> Subscription 2 associated with work profile. * </ul> * Then for SDK 35+, if the caller identity is personal profile, then this will return * subscription 1 only and vice versa. * * <p>If the caller needs to see all subscriptions across user profiles, * use {@link #createForAllUserProfiles} to convert this instance to see all. * * <p> The records will be sorted by {@link SubscriptionInfo#getSimSlotIndex} then by * {@link SubscriptionInfo#getSubscriptionId}. * * <p>Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} * or that the calling app has carrier privileges (see Loading @@ -1800,8 +1842,25 @@ public class SubscriptionManager { * </ul> */ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) // @RequiresPermission(TODO(b/308809058)) public List<SubscriptionInfo> getActiveSubscriptionInfoList() { return getActiveSubscriptionInfoList(/* userVisibleonly */true); List<SubscriptionInfo> activeList = null; try { ISub iSub = TelephonyManager.getSubscriptionService(); if (iSub != null) { activeList = iSub.getActiveSubscriptionInfoList(mContext.getOpPackageName(), mContext.getAttributionTag(), mIsForAllUserProfiles); } } catch (RemoteException ex) { // ignore it } if (activeList != null) { activeList = activeList.stream().filter(subInfo -> isSubscriptionVisible(subInfo)) .collect(Collectors.toList()); } return activeList; } /** Loading Loading @@ -1834,6 +1893,26 @@ public class SubscriptionManager { return completeList; } /** * Convert this subscription manager instance into one that can see all subscriptions across * user profiles. * * @return a SubscriptionManager that can see all subscriptions regardless its user profile * association. * * @see #getActiveSubscriptionInfoList * @see #getActiveSubscriptionInfoCount * @see UserHandle */ @FlaggedApi(Flags.FLAG_WORK_PROFILE_API_SPLIT) // @RequiresPermission(TODO(b/308809058)) // The permission check for accessing all subscriptions will be enforced upon calling the // individual APIs linked above. @NonNull public SubscriptionManager createForAllUserProfiles() { mIsForAllUserProfiles = true; return this; } /** * This is similar to {@link #getActiveSubscriptionInfoList()}, but if userVisibleOnly * is true, it will filter out the hidden subscriptions. Loading @@ -1847,7 +1926,7 @@ public class SubscriptionManager { ISub iSub = TelephonyManager.getSubscriptionService(); if (iSub != null) { activeList = iSub.getActiveSubscriptionInfoList(mContext.getOpPackageName(), mContext.getAttributionTag()); mContext.getAttributionTag(), true /*isForAllUserProfiles*/); } } catch (RemoteException ex) { // ignore it Loading Loading @@ -2002,13 +2081,19 @@ public class SubscriptionManager { } /** * Get the active subscription count. * Get the active subscription count associated with the current caller user profile for * Android SDK 35(V) and above, while Android SDK 34(U) and below can see all subscriptions as * it does today. * * <p>If the caller needs to see all subscriptions across user profiles, * use {@link #createForAllUserProfiles} to convert this instance to see all. * * @return The current number of active subscriptions. * * @see #getActiveSubscriptionInfoList() */ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) // @RequiresPermission(TODO(b/308809058)) public int getActiveSubscriptionInfoCount() { int result = 0; Loading @@ -2016,7 +2101,7 @@ public class SubscriptionManager { ISub iSub = TelephonyManager.getSubscriptionService(); if (iSub != null) { result = iSub.getActiveSubInfoCount(mContext.getOpPackageName(), mContext.getAttributionTag()); mContext.getAttributionTag(), mIsForAllUserProfiles); } } catch (RemoteException ex) { // ignore it Loading telephony/java/com/android/internal/telephony/ISub.aidl +7 −2 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ interface ISub { * * @param callingPackage The package maing the call. * @param callingFeatureId The feature in the package * @param isForAllProfiles whether the caller intends to see all subscriptions regardless * association. * @return Sorted list of the currently {@link SubscriptionInfo} records available on the device. * <ul> * <li> Loading @@ -83,14 +85,17 @@ interface ISub { * </ul> */ List<SubscriptionInfo> getActiveSubscriptionInfoList(String callingPackage, String callingFeatureId); String callingFeatureId, boolean isForAllProfiles); /** * @param callingPackage The package making the call. * @param callingFeatureId The feature in the package. * @param isForAllProfile whether the caller intends to see all subscriptions regardless * association. * @return the number of active subscriptions */ int getActiveSubInfoCount(String callingPackage, String callingFeatureId); int getActiveSubInfoCount(String callingPackage, String callingFeatureId, boolean isForAllProfile); /** * @return the maximum number of subscriptions this device will support at any one time. Loading Loading
core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -45159,6 +45159,7 @@ package android.telephony { method public void addOnSubscriptionsChangedListener(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.SubscriptionManager.OnSubscriptionsChangedListener); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void addSubscriptionsIntoGroup(@NonNull java.util.List<java.lang.Integer>, @NonNull android.os.ParcelUuid); method public boolean canManageSubscription(android.telephony.SubscriptionInfo); method @FlaggedApi("com.android.internal.telephony.flags.work_profile_api_split") @NonNull public android.telephony.SubscriptionManager createForAllUserProfiles(); method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public android.os.ParcelUuid createSubscriptionGroup(@NonNull java.util.List<java.lang.Integer>); method @Deprecated public static android.telephony.SubscriptionManager from(android.content.Context); method public java.util.List<android.telephony.SubscriptionInfo> getAccessibleSubscriptionInfoList();
telephony/java/android/telephony/SubscriptionManager.java +92 −7 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.Manifest; import android.annotation.CallbackExecutor; import android.annotation.ColorInt; import android.annotation.DurationMillisLong; import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; Loading Loading @@ -70,6 +71,7 @@ import android.util.Pair; import com.android.internal.telephony.ISetOpportunisticDataCallback; import com.android.internal.telephony.ISub; import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.flags.Flags; import com.android.internal.telephony.util.HandlerExecutor; import com.android.internal.util.FunctionalUtils; import com.android.internal.util.Preconditions; Loading @@ -95,7 +97,22 @@ import java.util.function.Consumer; import java.util.stream.Collectors; /** * Subscription manager provides the mobile subscription information. * Subscription manager provides the mobile subscription information that are associated with the * calling user profile {@link UserHandle} for Android SDK 35(V) and above, while Android SDK 34(U) * and below can see all subscriptions as it does today. * * <p>For example, if we have * <ul> * <li> Subscription 1 associated with personal profile. * <li> Subscription 2 associated with work profile. * </ul> * Then for SDK 35+, if the caller identity is personal profile, then * {@link #getActiveSubscriptionInfoList} will return subscription 1 only and vice versa. * * <p>If the caller needs to see all subscriptions across user profiles, * use {@link #createForAllUserProfiles} to convert the instance to see all. Additional permission * may be required as documented on the each API. * */ @SystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) Loading Loading @@ -1446,6 +1463,16 @@ public class SubscriptionManager { } } /** * {@code true} if the SubscriptionManager instance should see all subscriptions regardless its * association with particular user profile. * * <p> It only applies to Android SDK 35(V) and above. For Android SDK 34(U) and below, the * caller can see all subscription across user profiles as it does today today even if it's * {@code false}. */ private boolean mIsForAllUserProfiles = false; /** @hide */ @UnsupportedAppUsage public SubscriptionManager(Context context) { Loading Loading @@ -1776,8 +1803,23 @@ public class SubscriptionManager { } /** * Get the SubscriptionInfo(s) of the currently active SIM(s). The records will be sorted * by {@link SubscriptionInfo#getSimSlotIndex} then by {@link SubscriptionInfo#getSubscriptionId}. * Get the SubscriptionInfo(s) of the currently active SIM(s) associated with the current caller * user profile {@link UserHandle} for Android SDK 35(V) and above, while Android SDK 34(U) * and below can see all subscriptions as it does today. * * <p>For example, if we have * <ul> * <li> Subscription 1 associated with personal profile. * <li> Subscription 2 associated with work profile. * </ul> * Then for SDK 35+, if the caller identity is personal profile, then this will return * subscription 1 only and vice versa. * * <p>If the caller needs to see all subscriptions across user profiles, * use {@link #createForAllUserProfiles} to convert this instance to see all. * * <p> The records will be sorted by {@link SubscriptionInfo#getSimSlotIndex} then by * {@link SubscriptionInfo#getSubscriptionId}. * * <p>Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} * or that the calling app has carrier privileges (see Loading @@ -1800,8 +1842,25 @@ public class SubscriptionManager { * </ul> */ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) // @RequiresPermission(TODO(b/308809058)) public List<SubscriptionInfo> getActiveSubscriptionInfoList() { return getActiveSubscriptionInfoList(/* userVisibleonly */true); List<SubscriptionInfo> activeList = null; try { ISub iSub = TelephonyManager.getSubscriptionService(); if (iSub != null) { activeList = iSub.getActiveSubscriptionInfoList(mContext.getOpPackageName(), mContext.getAttributionTag(), mIsForAllUserProfiles); } } catch (RemoteException ex) { // ignore it } if (activeList != null) { activeList = activeList.stream().filter(subInfo -> isSubscriptionVisible(subInfo)) .collect(Collectors.toList()); } return activeList; } /** Loading Loading @@ -1834,6 +1893,26 @@ public class SubscriptionManager { return completeList; } /** * Convert this subscription manager instance into one that can see all subscriptions across * user profiles. * * @return a SubscriptionManager that can see all subscriptions regardless its user profile * association. * * @see #getActiveSubscriptionInfoList * @see #getActiveSubscriptionInfoCount * @see UserHandle */ @FlaggedApi(Flags.FLAG_WORK_PROFILE_API_SPLIT) // @RequiresPermission(TODO(b/308809058)) // The permission check for accessing all subscriptions will be enforced upon calling the // individual APIs linked above. @NonNull public SubscriptionManager createForAllUserProfiles() { mIsForAllUserProfiles = true; return this; } /** * This is similar to {@link #getActiveSubscriptionInfoList()}, but if userVisibleOnly * is true, it will filter out the hidden subscriptions. Loading @@ -1847,7 +1926,7 @@ public class SubscriptionManager { ISub iSub = TelephonyManager.getSubscriptionService(); if (iSub != null) { activeList = iSub.getActiveSubscriptionInfoList(mContext.getOpPackageName(), mContext.getAttributionTag()); mContext.getAttributionTag(), true /*isForAllUserProfiles*/); } } catch (RemoteException ex) { // ignore it Loading Loading @@ -2002,13 +2081,19 @@ public class SubscriptionManager { } /** * Get the active subscription count. * Get the active subscription count associated with the current caller user profile for * Android SDK 35(V) and above, while Android SDK 34(U) and below can see all subscriptions as * it does today. * * <p>If the caller needs to see all subscriptions across user profiles, * use {@link #createForAllUserProfiles} to convert this instance to see all. * * @return The current number of active subscriptions. * * @see #getActiveSubscriptionInfoList() */ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) // @RequiresPermission(TODO(b/308809058)) public int getActiveSubscriptionInfoCount() { int result = 0; Loading @@ -2016,7 +2101,7 @@ public class SubscriptionManager { ISub iSub = TelephonyManager.getSubscriptionService(); if (iSub != null) { result = iSub.getActiveSubInfoCount(mContext.getOpPackageName(), mContext.getAttributionTag()); mContext.getAttributionTag(), mIsForAllUserProfiles); } } catch (RemoteException ex) { // ignore it Loading
telephony/java/com/android/internal/telephony/ISub.aidl +7 −2 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ interface ISub { * * @param callingPackage The package maing the call. * @param callingFeatureId The feature in the package * @param isForAllProfiles whether the caller intends to see all subscriptions regardless * association. * @return Sorted list of the currently {@link SubscriptionInfo} records available on the device. * <ul> * <li> Loading @@ -83,14 +85,17 @@ interface ISub { * </ul> */ List<SubscriptionInfo> getActiveSubscriptionInfoList(String callingPackage, String callingFeatureId); String callingFeatureId, boolean isForAllProfiles); /** * @param callingPackage The package making the call. * @param callingFeatureId The feature in the package. * @param isForAllProfile whether the caller intends to see all subscriptions regardless * association. * @return the number of active subscriptions */ int getActiveSubInfoCount(String callingPackage, String callingFeatureId); int getActiveSubInfoCount(String callingPackage, String callingFeatureId, boolean isForAllProfile); /** * @return the maximum number of subscriptions this device will support at any one time. Loading