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

Commit f81aae09 authored by Malcolm Chen's avatar Malcolm Chen Committed by Nazanin Bakhshi
Browse files

Adding subscription group owner.

Define owner of a subscription group. Such that when subscriptions are
being added into or removed from a group, as long as callingPackage is
the owner, it can skip carrier permission check on the subscriptions in
the group.

This is necessary when a subscription is being added into a
group that contains inactive subscription, which mean its carrier
privilege can't be verified.

Bug: 131854492
Test: cts, unittest, TelephonyManagerTestApp
Change-Id: If2f5b9c8d71469d9e60f1ca48cab36938cd72c48
parent 8958c9b3
Loading
Loading
Loading
Loading
+29 −9
Original line number Diff line number Diff line
@@ -172,6 +172,11 @@ public class SubscriptionInfo implements Parcelable {
    @Nullable
    private ParcelUuid mGroupUUID;

    /**
     * A package name that specifies who created the group. Null if mGroupUUID is null.
     */
    private String mGroupOwner;

    /**
     * Whether group of the subscription is disabled.
     * This is only useful if it's a grouped opportunistic subscription. In this case, if all
@@ -203,9 +208,10 @@ public class SubscriptionInfo implements Parcelable {
            Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded,
            @Nullable UiccAccessRule[] accessRules, String cardString) {
        this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number,
                roaming, icon, mcc, mnc, countryIso, isEmbedded, accessRules, cardString,
                false, null, TelephonyManager.UNKNOWN_CARRIER_ID,
                SubscriptionManager.PROFILE_CLASS_DEFAULT);
                roaming, icon, mcc, mnc, countryIso, isEmbedded, accessRules, cardString, -1,
                false, null, false, TelephonyManager.UNKNOWN_CARRIER_ID,
                SubscriptionManager.PROFILE_CLASS_DEFAULT,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM, null);
    }

    /**
@@ -219,7 +225,7 @@ public class SubscriptionInfo implements Parcelable {
        this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number,
                roaming, icon, mcc, mnc, countryIso, isEmbedded, accessRules, cardString, -1,
                isOpportunistic, groupUUID, false, carrierId, profileClass,
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM);
                SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM, null);
    }

    /**
@@ -229,8 +235,8 @@ public class SubscriptionInfo implements Parcelable {
            CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
            Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded,
            @Nullable UiccAccessRule[] accessRules, String cardString, int cardId,
            boolean isOpportunistic, @Nullable String groupUUID,
            boolean isGroupDisabled, int carrierId, int profileClass, int subType) {
            boolean isOpportunistic, @Nullable String groupUUID, boolean isGroupDisabled,
            int carrierId, int profileClass, int subType, @Nullable String groupOwner) {
        this.mId = id;
        this.mIccId = iccId;
        this.mSimSlotIndex = simSlotIndex;
@@ -254,6 +260,7 @@ public class SubscriptionInfo implements Parcelable {
        this.mCarrierId = carrierId;
        this.mProfileClass = profileClass;
        this.mSubscriptionType = subType;
        this.mGroupOwner = groupOwner;
    }

    /**
@@ -499,6 +506,15 @@ public class SubscriptionInfo implements Parcelable {
        return mHplmns == null ? Collections.emptyList() : Arrays.asList(mHplmns);
    }

    /**
     * Return owner package of group the subscription belongs to.
     *
     * @hide
     */
    public @Nullable String getGroupOwner() {
        return mGroupOwner;
    }

    /**
     * @return the profile class of this subscription.
     * @hide
@@ -646,11 +662,12 @@ public class SubscriptionInfo implements Parcelable {
            int subType = source.readInt();
            String[] ehplmns = source.readStringArray();
            String[] hplmns = source.readStringArray();
            String groupOwner = source.readString();

            SubscriptionInfo info = new SubscriptionInfo(id, iccId, simSlotIndex, displayName,
                    carrierName, nameSource, iconTint, number, dataRoaming, iconBitmap, mcc, mnc,
                    countryIso, isEmbedded, accessRules, cardString, cardId, isOpportunistic,
                    groupUUID, isGroupDisabled, carrierid, profileClass, subType);
                    groupUUID, isGroupDisabled, carrierid, profileClass, subType, groupOwner);
            info.setAssociatedPlmns(ehplmns, hplmns);
            return info;
        }
@@ -688,6 +705,7 @@ public class SubscriptionInfo implements Parcelable {
        dest.writeInt(mSubscriptionType);
        dest.writeStringArray(mEhplmns);
        dest.writeStringArray(mHplmns);
        dest.writeString(mGroupOwner);
    }

    @Override
@@ -727,7 +745,8 @@ public class SubscriptionInfo implements Parcelable {
                + " profileClass=" + mProfileClass
                + " ehplmns = " + Arrays.toString(mEhplmns)
                + " hplmns = " + Arrays.toString(mHplmns)
                + " subscriptionType=" + mSubscriptionType + "}";
                + " subscriptionType=" + mSubscriptionType
                + " mGroupOwner=" + mGroupOwner + "}";
    }

    @Override
@@ -735,7 +754,7 @@ public class SubscriptionInfo implements Parcelable {
        return Objects.hash(mId, mSimSlotIndex, mNameSource, mIconTint, mDataRoaming, mIsEmbedded,
                mIsOpportunistic, mGroupUUID, mIccId, mNumber, mMcc, mMnc,
                mCountryIso, mCardString, mCardId, mDisplayName, mCarrierName, mAccessRules,
                mIsGroupDisabled, mCarrierId, mProfileClass);
                mIsGroupDisabled, mCarrierId, mProfileClass, mGroupOwner);
    }

    @Override
@@ -767,6 +786,7 @@ public class SubscriptionInfo implements Parcelable {
                && Objects.equals(mCountryIso, toCompare.mCountryIso)
                && Objects.equals(mCardString, toCompare.mCardString)
                && Objects.equals(mCardId, toCompare.mCardId)
                && Objects.equals(mGroupOwner, toCompare.mGroupOwner)
                && TextUtils.equals(mDisplayName, toCompare.mDisplayName)
                && TextUtils.equals(mCarrierName, toCompare.mCarrierName)
                && Arrays.equals(mAccessRules, toCompare.mAccessRules)
+9 −0
Original line number Diff line number Diff line
@@ -686,6 +686,15 @@ public class SubscriptionManager {
     * @hide
     */
    public static final String GROUP_UUID = "group_uuid";

    /**
     * TelephonyProvider column name for group owner. It's the package name who created
     * the subscription group.
     *
     * @hide
     */
    public static final String GROUP_OWNER = "group_owner";

    /**
     * TelephonyProvider column name for whether a subscription is metered or not, that is, whether
     * the network it connects to charges for subscription or not. For example, paid CBRS or unpaid.