Remove SubscriptionManager#setMetered API. am: 9b932fa1a4
am: 8231d3b231
Change-Id: Ic00503fca6ef09ac2cda1cf0388d199d2190c1f3
This commit is contained in:
@@ -43007,7 +43007,6 @@ package android.telephony {
|
|||||||
method public void removeOnOpportunisticSubscriptionsChangedListener(@NonNull android.telephony.SubscriptionManager.OnOpportunisticSubscriptionsChangedListener);
|
method public void removeOnOpportunisticSubscriptionsChangedListener(@NonNull android.telephony.SubscriptionManager.OnOpportunisticSubscriptionsChangedListener);
|
||||||
method public void removeOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener);
|
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 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 @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 @Nullable @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String setSubscriptionGroup(@NonNull int[]);
|
||||||
method public void setSubscriptionOverrideCongested(int, boolean, long);
|
method public void setSubscriptionOverrideCongested(int, boolean, long);
|
||||||
|
|||||||
@@ -160,11 +160,6 @@ public class SubscriptionInfo implements Parcelable {
|
|||||||
@Nullable
|
@Nullable
|
||||||
private String mGroupUUID;
|
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.
|
* Whether group of the subscription is disabled.
|
||||||
* This is only useful if it's a grouped opportunistic subscription. In this case, if all
|
* This is only useful if it's a grouped opportunistic subscription. In this case, if all
|
||||||
@@ -197,7 +192,7 @@ public class SubscriptionInfo implements Parcelable {
|
|||||||
@Nullable UiccAccessRule[] accessRules, String cardString) {
|
@Nullable UiccAccessRule[] accessRules, String cardString) {
|
||||||
this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number,
|
this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number,
|
||||||
roaming, icon, mcc, mnc, countryIso, isEmbedded, accessRules, cardString,
|
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);
|
SubscriptionManager.PROFILE_CLASS_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,10 +203,10 @@ public class SubscriptionInfo implements Parcelable {
|
|||||||
CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
|
CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
|
||||||
Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded,
|
Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded,
|
||||||
@Nullable UiccAccessRule[] accessRules, String cardString, boolean isOpportunistic,
|
@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,
|
this(id, iccId, simSlotIndex, displayName, carrierName, nameSource, iconTint, number,
|
||||||
roaming, icon, mcc, mnc, countryIso, isEmbedded, accessRules, cardString, -1,
|
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);
|
SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +217,7 @@ public class SubscriptionInfo implements Parcelable {
|
|||||||
CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
|
CharSequence carrierName, int nameSource, int iconTint, String number, int roaming,
|
||||||
Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded,
|
Bitmap icon, String mcc, String mnc, String countryIso, boolean isEmbedded,
|
||||||
@Nullable UiccAccessRule[] accessRules, String cardString, int cardId,
|
@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) {
|
boolean isGroupDisabled, int carrierId, int profileClass, int subType) {
|
||||||
this.mId = id;
|
this.mId = id;
|
||||||
this.mIccId = iccId;
|
this.mIccId = iccId;
|
||||||
@@ -243,7 +238,6 @@ public class SubscriptionInfo implements Parcelable {
|
|||||||
this.mCardId = cardId;
|
this.mCardId = cardId;
|
||||||
this.mIsOpportunistic = isOpportunistic;
|
this.mIsOpportunistic = isOpportunistic;
|
||||||
this.mGroupUUID = groupUUID;
|
this.mGroupUUID = groupUUID;
|
||||||
this.mIsMetered = isMetered;
|
|
||||||
this.mIsGroupDisabled = isGroupDisabled;
|
this.mIsGroupDisabled = isGroupDisabled;
|
||||||
this.mCarrierId = carrierId;
|
this.mCarrierId = carrierId;
|
||||||
this.mProfileClass = profileClass;
|
this.mProfileClass = profileClass;
|
||||||
@@ -471,18 +465,6 @@ public class SubscriptionInfo implements Parcelable {
|
|||||||
return mGroupUUID;
|
return mGroupUUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
* @return the profile class of this subscription.
|
||||||
* @hide
|
* @hide
|
||||||
@@ -623,7 +605,6 @@ public class SubscriptionInfo implements Parcelable {
|
|||||||
int cardId = source.readInt();
|
int cardId = source.readInt();
|
||||||
boolean isOpportunistic = source.readBoolean();
|
boolean isOpportunistic = source.readBoolean();
|
||||||
String groupUUID = source.readString();
|
String groupUUID = source.readString();
|
||||||
boolean isMetered = source.readBoolean();
|
|
||||||
boolean isGroupDisabled = source.readBoolean();
|
boolean isGroupDisabled = source.readBoolean();
|
||||||
int carrierid = source.readInt();
|
int carrierid = source.readInt();
|
||||||
int profileClass = source.readInt();
|
int profileClass = source.readInt();
|
||||||
@@ -632,7 +613,7 @@ public class SubscriptionInfo implements Parcelable {
|
|||||||
return new SubscriptionInfo(id, iccId, simSlotIndex, displayName, carrierName,
|
return new SubscriptionInfo(id, iccId, simSlotIndex, displayName, carrierName,
|
||||||
nameSource, iconTint, number, dataRoaming, iconBitmap, mcc, mnc, countryIso,
|
nameSource, iconTint, number, dataRoaming, iconBitmap, mcc, mnc, countryIso,
|
||||||
isEmbedded, accessRules, cardString, cardId, isOpportunistic, groupUUID,
|
isEmbedded, accessRules, cardString, cardId, isOpportunistic, groupUUID,
|
||||||
isMetered, isGroupDisabled, carrierid, profileClass, subType);
|
isGroupDisabled, carrierid, profileClass, subType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -662,7 +643,6 @@ public class SubscriptionInfo implements Parcelable {
|
|||||||
dest.writeInt(mCardId);
|
dest.writeInt(mCardId);
|
||||||
dest.writeBoolean(mIsOpportunistic);
|
dest.writeBoolean(mIsOpportunistic);
|
||||||
dest.writeString(mGroupUUID);
|
dest.writeString(mGroupUUID);
|
||||||
dest.writeBoolean(mIsMetered);
|
|
||||||
dest.writeBoolean(mIsGroupDisabled);
|
dest.writeBoolean(mIsGroupDisabled);
|
||||||
dest.writeInt(mCarrierId);
|
dest.writeInt(mCarrierId);
|
||||||
dest.writeInt(mProfileClass);
|
dest.writeInt(mProfileClass);
|
||||||
@@ -702,7 +682,7 @@ public class SubscriptionInfo implements Parcelable {
|
|||||||
+ " accessRules " + Arrays.toString(mAccessRules)
|
+ " accessRules " + Arrays.toString(mAccessRules)
|
||||||
+ " cardString=" + cardStringToPrint + " cardId=" + mCardId
|
+ " cardString=" + cardStringToPrint + " cardId=" + mCardId
|
||||||
+ " isOpportunistic " + mIsOpportunistic + " mGroupUUID=" + mGroupUUID
|
+ " isOpportunistic " + mIsOpportunistic + " mGroupUUID=" + mGroupUUID
|
||||||
+ " isMetered=" + mIsMetered + " mIsGroupDisabled=" + mIsGroupDisabled
|
+ " mIsGroupDisabled=" + mIsGroupDisabled
|
||||||
+ " profileClass=" + mProfileClass
|
+ " profileClass=" + mProfileClass
|
||||||
+ " subscriptionType=" + mSubscriptionType + "}";
|
+ " subscriptionType=" + mSubscriptionType + "}";
|
||||||
}
|
}
|
||||||
@@ -710,7 +690,7 @@ public class SubscriptionInfo implements Parcelable {
|
|||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(mId, mSimSlotIndex, mNameSource, mIconTint, mDataRoaming, mIsEmbedded,
|
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,
|
mCountryIso, mCardString, mCardId, mDisplayName, mCarrierName, mAccessRules,
|
||||||
mIsGroupDisabled, mCarrierId, mProfileClass);
|
mIsGroupDisabled, mCarrierId, mProfileClass);
|
||||||
}
|
}
|
||||||
@@ -736,7 +716,6 @@ public class SubscriptionInfo implements Parcelable {
|
|||||||
&& mIsOpportunistic == toCompare.mIsOpportunistic
|
&& mIsOpportunistic == toCompare.mIsOpportunistic
|
||||||
&& mIsGroupDisabled == toCompare.mIsGroupDisabled
|
&& mIsGroupDisabled == toCompare.mIsGroupDisabled
|
||||||
&& mCarrierId == toCompare.mCarrierId
|
&& mCarrierId == toCompare.mCarrierId
|
||||||
&& mIsMetered == toCompare.mIsMetered
|
|
||||||
&& Objects.equals(mGroupUUID, toCompare.mGroupUUID)
|
&& Objects.equals(mGroupUUID, toCompare.mGroupUUID)
|
||||||
&& Objects.equals(mIccId, toCompare.mIccId)
|
&& Objects.equals(mIccId, toCompare.mIccId)
|
||||||
&& Objects.equals(mNumber, toCompare.mNumber)
|
&& Objects.equals(mNumber, toCompare.mNumber)
|
||||||
|
|||||||
@@ -2853,29 +2853,6 @@ public class SubscriptionManager {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
* 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.
|
* subscription, it should be hidden anywhere in Settings, dialer, status bar etc.
|
||||||
|
|||||||
@@ -204,15 +204,6 @@ interface ISub {
|
|||||||
*/
|
*/
|
||||||
String setSubscriptionGroup(in int[] subIdList, String callingPackage);
|
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
|
* Set which subscription is preferred for cellular data. It's
|
||||||
* designed to overwrite default data subscription temporarily.
|
* designed to overwrite default data subscription temporarily.
|
||||||
|
|||||||
Reference in New Issue
Block a user