diff options
-rwxr-xr-x | api/current.txt | 3 | ||||
-rw-r--r-- | telephony/java/android/telephony/SubscriptionInfo.java | 35 | ||||
-rw-r--r-- | telephony/java/android/telephony/SubscriptionManager.java | 27 | ||||
-rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 6 | ||||
-rwxr-xr-x | telephony/java/com/android/internal/telephony/ISub.aidl | 9 |
5 files changed, 14 insertions, 66 deletions
diff --git a/api/current.txt b/api/current.txt index 766b6b3609c4..1add9c32e71d 100755 --- a/api/current.txt +++ b/api/current.txt @@ -43009,7 +43009,6 @@ package android.telephony { method public void removeOnOpportunisticSubscriptionsChangedListener(@NonNull android.telephony.SubscriptionManager.OnOpportunisticSubscriptionsChangedListener); method public void removeOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean removeSubscriptionsFromGroup(@NonNull int[]); - method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setMetered(boolean, int); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setOpportunistic(boolean, int); method @Nullable @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String setSubscriptionGroup(@NonNull int[]); method public void setSubscriptionOverrideCongested(int, boolean, long); @@ -43249,7 +43248,7 @@ package android.telephony { field public static final int PHONE_TYPE_GSM = 1; // 0x1 field public static final int PHONE_TYPE_NONE = 0; // 0x0 field public static final int PHONE_TYPE_SIP = 3; // 0x3 - field public static final int SET_OPPORTUNISTIC_SUB_INVALID_PARAMETER = 2; // 0x2 + field public static final int SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION = 2; // 0x2 field public static final int SET_OPPORTUNISTIC_SUB_SUCCESS = 0; // 0x0 field public static final int SET_OPPORTUNISTIC_SUB_VALIDATION_FAILED = 1; // 0x1 field public static final int SIM_STATE_ABSENT = 1; // 0x1 diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java index b781b109bdcc..a404ad8d3dae 100644 --- a/telephony/java/android/telephony/SubscriptionInfo.java +++ b/telephony/java/android/telephony/SubscriptionInfo.java @@ -161,11 +161,6 @@ public class SubscriptionInfo implements Parcelable { private String mGroupUUID; /** - * A property in opportunistic subscription to indicate whether it is metered or not. - */ - private boolean mIsMetered; - - /** * Whether group of the subscription is disabled. * This is only useful if it's a grouped opportunistic subscription. In this case, if all * primary (non-opportunistic) subscriptions in the group are deactivated (unplugged pSIM @@ -197,7 +192,7 @@ public class SubscriptionInfo implements Parcelable { @Nullable UiccAccessRule[] accessRules, String cardString) { this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number, roaming, icon, mcc, mnc, countryIso, isEmbedded, accessRules, cardString, - false, null, true, TelephonyManager.UNKNOWN_CARRIER_ID, + false, null, TelephonyManager.UNKNOWN_CARRIER_ID, SubscriptionManager.PROFILE_CLASS_DEFAULT); } @@ -208,10 +203,10 @@ 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, boolean isOpportunistic, - @Nullable String groupUUID, boolean isMetered, int carrierId, int profileClass) { + @Nullable String groupUUID, int carrierId, int profileClass) { this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number, roaming, icon, mcc, mnc, countryIso, isEmbedded, accessRules, cardString, -1, - isOpportunistic, groupUUID, isMetered, false, carrierId, profileClass, + isOpportunistic, groupUUID, false, carrierId, profileClass, SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM); } @@ -222,7 +217,7 @@ 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 isMetered, + boolean isOpportunistic, @Nullable String groupUUID, boolean isGroupDisabled, int carrierId, int profileClass, int subType) { this.mId = id; this.mIccId = iccId; @@ -243,7 +238,6 @@ public class SubscriptionInfo implements Parcelable { this.mCardId = cardId; this.mIsOpportunistic = isOpportunistic; this.mGroupUUID = groupUUID; - this.mIsMetered = isMetered; this.mIsGroupDisabled = isGroupDisabled; this.mCarrierId = carrierId; this.mProfileClass = profileClass; @@ -472,18 +466,6 @@ public class SubscriptionInfo implements Parcelable { } /** - * Used in opportunistic subscription ({@link #isOpportunistic()}) to indicate whether it's - * metered or not.This is one of the factors when deciding to switch to the subscription. - * (a non-metered subscription, for example, would likely be preferred over a metered one). - * - * @return whether subscription is metered. - * @hide - */ - public boolean isMetered() { - return mIsMetered; - } - - /** * @return the profile class of this subscription. * @hide */ @@ -623,7 +605,6 @@ public class SubscriptionInfo implements Parcelable { int cardId = source.readInt(); boolean isOpportunistic = source.readBoolean(); String groupUUID = source.readString(); - boolean isMetered = source.readBoolean(); boolean isGroupDisabled = source.readBoolean(); int carrierid = source.readInt(); int profileClass = source.readInt(); @@ -632,7 +613,7 @@ public class SubscriptionInfo implements Parcelable { return new SubscriptionInfo(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number, dataRoaming, iconBitmap, mcc, mnc, countryIso, isEmbedded, accessRules, cardString, cardId, isOpportunistic, groupUUID, - isMetered, isGroupDisabled, carrierid, profileClass, subType); + isGroupDisabled, carrierid, profileClass, subType); } @Override @@ -662,7 +643,6 @@ public class SubscriptionInfo implements Parcelable { dest.writeInt(mCardId); dest.writeBoolean(mIsOpportunistic); dest.writeString(mGroupUUID); - dest.writeBoolean(mIsMetered); dest.writeBoolean(mIsGroupDisabled); dest.writeInt(mCarrierId); dest.writeInt(mProfileClass); @@ -702,7 +682,7 @@ public class SubscriptionInfo implements Parcelable { + " accessRules " + Arrays.toString(mAccessRules) + " cardString=" + cardStringToPrint + " cardId=" + mCardId + " isOpportunistic " + mIsOpportunistic + " mGroupUUID=" + mGroupUUID - + " isMetered=" + mIsMetered + " mIsGroupDisabled=" + mIsGroupDisabled + + " mIsGroupDisabled=" + mIsGroupDisabled + " profileClass=" + mProfileClass + " subscriptionType=" + mSubscriptionType + "}"; } @@ -710,7 +690,7 @@ public class SubscriptionInfo implements Parcelable { @Override public int hashCode() { return Objects.hash(mId, mSimSlotIndex, mNameSource, mIconTint, mDataRoaming, mIsEmbedded, - mIsOpportunistic, mGroupUUID, mIsMetered, mIccId, mNumber, mMcc, mMnc, + mIsOpportunistic, mGroupUUID, mIccId, mNumber, mMcc, mMnc, mCountryIso, mCardString, mCardId, mDisplayName, mCarrierName, mAccessRules, mIsGroupDisabled, mCarrierId, mProfileClass); } @@ -736,7 +716,6 @@ public class SubscriptionInfo implements Parcelable { && mIsOpportunistic == toCompare.mIsOpportunistic && mIsGroupDisabled == toCompare.mIsGroupDisabled && mCarrierId == toCompare.mCarrierId - && mIsMetered == toCompare.mIsMetered && Objects.equals(mGroupUUID, toCompare.mGroupUUID) && Objects.equals(mIccId, toCompare.mIccId) && Objects.equals(mNumber, toCompare.mNumber) diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index d5862280b3b1..9982b9bb7068 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -2596,7 +2596,9 @@ public class SubscriptionManager { * {@link SubscriptionManager#DEFAULT_SUBSCRIPTION_ID}, it means * it's unset and {@link SubscriptionManager#getDefaultDataSubscriptionId()} * is used to determine which modem is preferred. - * @param needValidation whether validation is needed before switch happens. + * @param needValidation whether Telephony will wait until the network is validated by + * connectivity service before switching data to it. More details see + * {@link NetworkCapabilities#NET_CAPABILITY_VALIDATED}. * @param executor The executor of where the callback will execute. * @param callback Callback will be triggered once it succeeds or failed. * See {@link TelephonyManager.SetOpportunisticSubscriptionResult} @@ -2854,29 +2856,6 @@ public class SubscriptionManager { } /** - * Set if a subscription is metered or not. Similar to Wi-Fi, metered means - * user may be charged more if more data is used. - * - * By default all Cellular networks are considered metered. System or carrier privileged apps - * can set a subscription un-metered which will be considered when system switches data between - * primary subscription and opportunistic subscription. - * - * Caller will either have {@link android.Manifest.permission#MODIFY_PHONE_STATE} or carrier - * privilege permission of the subscription. - * - * @param isMetered whether it’s a metered subscription. - * @param subId the unique SubscriptionInfo index in database - * @return {@code true} if the operation is succeed, {@code false} otherwise. - */ - @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges - @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) - public boolean setMetered(boolean isMetered, int subId) { - if (VDBG) logd("[setIsMetered]+ isMetered:" + isMetered + " subId:" + subId); - return setSubscriptionPropertyHelper(subId, "setIsMetered", - (iSub)-> iSub.setMetered(isMetered, subId, mContext.getOpPackageName())) == 1; - } - - /** * Whether a subscription is visible to API caller. If it's a bundled opportunistic * subscription, it should be hidden anywhere in Settings, dialer, status bar etc. * Exception is if caller owns carrier privilege, in which case they will diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 4ea613cbfe62..41d7eb11ce11 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -10334,7 +10334,7 @@ public class TelephonyManager { @IntDef(prefix = {"SET_OPPORTUNISTIC_SUB"}, value = { SET_OPPORTUNISTIC_SUB_SUCCESS, SET_OPPORTUNISTIC_SUB_VALIDATION_FAILED, - SET_OPPORTUNISTIC_SUB_INVALID_PARAMETER}) + SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION}) public @interface SetOpportunisticSubscriptionResult {} /** @@ -10348,9 +10348,9 @@ public class TelephonyManager { public static final int SET_OPPORTUNISTIC_SUB_VALIDATION_FAILED = 1; /** - * The parameter passed in is invalid. + * The subscription is not valid. It must be an active opportunistic subscription. */ - public static final int SET_OPPORTUNISTIC_SUB_INVALID_PARAMETER = 2; + public static final int SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION = 2; /** @hide */ @Retention(RetentionPolicy.SOURCE) diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl index c08da44c1ba6..6eb6fd8695e3 100755 --- a/telephony/java/com/android/internal/telephony/ISub.aidl +++ b/telephony/java/com/android/internal/telephony/ISub.aidl @@ -205,15 +205,6 @@ interface ISub { String setSubscriptionGroup(in int[] subIdList, String callingPackage); /** - * Set whether a subscription is metered - * - * @param isMetered whether it’s a metered subscription. - * @param subId the unique SubscriptionInfo index in database - * @return the number of records updated - */ - int setMetered(boolean isMetered, int subId, String callingPackage); - - /** * Set which subscription is preferred for cellular data. It's * designed to overwrite default data subscription temporarily. * |