Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7d92d65 authored by Peter Wang's avatar Peter Wang Committed by Gerrit Code Review
Browse files

Merge "[Telephony Mainline] Expose getActiveSubscriptionIdList"

parents fa871a36 01d128c3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -9244,6 +9244,8 @@ package android.telephony {
  public class SubscriptionManager {
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean canDisablePhysicalSubscription();
    method public boolean canManageSubscription(@Nullable android.telephony.SubscriptionInfo, @Nullable String);
    method @NonNull public int[] getActiveAndHiddenSubscriptionIdList();
    method @NonNull public int[] getActiveSubscriptionIdList();
    method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.SubscriptionInfo getActiveSubscriptionInfoForIcc(@NonNull String);
    method public java.util.List<android.telephony.SubscriptionInfo> getAvailableSubscriptionInfoList();
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getEnabledSubscriptionId(int);
+1 −1
Original line number Diff line number Diff line
@@ -1357,7 +1357,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
    public void notifyCarrierNetworkChange(boolean active) {
        // only CarrierService with carrier privilege rule should have the permission
        int[] subIds = Arrays.stream(SubscriptionManager.from(mContext)
                    .getActiveSubscriptionIdList(false))
                    .getActiveAndHiddenSubscriptionIdList())
                    .filter(i -> TelephonyPermissions.checkCarrierPrivilegeForSubId(mContext,
                            i)).toArray();
        if (ArrayUtils.isEmpty(subIds)) {
+24 −4
Original line number Diff line number Diff line
@@ -1296,6 +1296,11 @@ public class SubscriptionManager {
     * The records will be sorted by {@link SubscriptionInfo#getSimSlotIndex}
     * then by {@link SubscriptionInfo#getSubscriptionId}.
     *
     * Hidden subscriptions refer to those are not meant visible to the users.
     * For example, an opportunistic subscription that is grouped with other
     * subscriptions should remain invisible to users as they are only functionally
     * supplementary to primary ones.
     *
     * <p>Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
     * or that the calling app has carrier privileges (see
     * {@link TelephonyManager#hasCarrierPrivileges}). In the latter case, only records accessible
@@ -2146,20 +2151,35 @@ public class SubscriptionManager {
    }

    /**
     * TODO(b/137102918) Make this static, tests use this as an instance method currently.
     * Get visible subscription Id(s) of the currently active SIM(s).
     *
     * @return the list of subId's that are active,
     *         is never null but the length may be 0.
     * @hide
     */
    @UnsupportedAppUsage
    @SystemApi
    public @NonNull int[] getActiveSubscriptionIdList() {
        return getActiveSubscriptionIdList(/* visibleOnly */ true);
    }

    /**
     * TODO(b/137102918) Make this static, tests use this as an instance method currently.
     * Get both hidden and visible subscription Id(s) of the currently active SIM(s).
     *
     * Hidden subscriptions refer to those are not meant visible to the users.
     * For example, an opportunistic subscription that is grouped with other
     * subscriptions should remain invisible to users as they are only functionally
     * supplementary to primary ones.
     *
     * @return the list of subId's that are active,
     *         is never null but the length may be 0.
     * @hide
     */
    @SystemApi
    public @NonNull int[] getActiveAndHiddenSubscriptionIdList() {
        return getActiveSubscriptionIdList(/* visibleOnly */false);
    }

    /**
     * @return a non-null list of subId's that are active.
     *
     * @hide