Add APIs to remove sub from a group and get subs in the same gorup.
am: be9240bcf0
Change-Id: If82ec04193b9288ff56ac1850899beadaf392d48
This commit is contained in:
@@ -42902,12 +42902,14 @@ package android.telephony {
|
||||
method public static int getSlotIndex(int);
|
||||
method public int[] getSubscriptionIds(int);
|
||||
method public java.util.List<android.telephony.SubscriptionPlan> getSubscriptionPlans(int);
|
||||
method public java.util.List<android.telephony.SubscriptionInfo> getSubscriptionsInGroup(int);
|
||||
method public boolean isActiveSubscriptionId(int);
|
||||
method public boolean isNetworkRoaming(int);
|
||||
method public static boolean isUsableSubscriptionId(int);
|
||||
method public static boolean isValidSubscriptionId(int);
|
||||
method public void removeOnOpportunisticSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnOpportunisticSubscriptionsChangedListener);
|
||||
method public void removeOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener);
|
||||
method public boolean removeSubscriptionsFromGroup(int[]);
|
||||
method public java.lang.String setSubscriptionGroup(int[]);
|
||||
method public void setSubscriptionOverrideCongested(int, boolean, long);
|
||||
method public void setSubscriptionOverrideUnmetered(int, boolean, long);
|
||||
|
||||
@@ -19,6 +19,7 @@ package android.telephony;
|
||||
import static android.net.NetworkPolicyManager.OVERRIDE_CONGESTED;
|
||||
import static android.net.NetworkPolicyManager.OVERRIDE_UNMETERED;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.CallbackExecutor;
|
||||
import android.annotation.DurationMillisLong;
|
||||
import android.annotation.NonNull;
|
||||
@@ -2391,16 +2392,21 @@ public class SubscriptionManager {
|
||||
* together, some of them may be invisible to the users, etc.
|
||||
*
|
||||
* Caller will either have {@link android.Manifest.permission#MODIFY_PHONE_STATE}
|
||||
* permission or can manage all subscriptions in the list, according to their
|
||||
* acess rules.
|
||||
* permission or had carrier privilege permission on the subscriptions:
|
||||
* {@link TelephonyManager#hasCarrierPrivileges(int)} or
|
||||
* {@link #canManageSubscription(SubscriptionInfo)}
|
||||
*
|
||||
* @throws SecurityException if the caller doesn't meet the requirements
|
||||
* outlined above.
|
||||
*
|
||||
* @param subIdList list of subId that will be in the same group
|
||||
* @return groupUUID a UUID assigned to the subscription group. It returns
|
||||
* null if fails.
|
||||
*
|
||||
*/
|
||||
@SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
|
||||
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
||||
public String setSubscriptionGroup(int[] subIdList) {
|
||||
public @Nullable String setSubscriptionGroup(@NonNull int[] subIdList) {
|
||||
String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
|
||||
if (VDBG) {
|
||||
logd("[setSubscriptionGroup]+ subIdList:" + Arrays.toString(subIdList));
|
||||
@@ -2419,6 +2425,80 @@ public class SubscriptionManager {
|
||||
return groupUUID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a list of subscriptions from their subscription group.
|
||||
* See {@link #setSubscriptionGroup(int[])} for more details.
|
||||
*
|
||||
* Caller will either have {@link android.Manifest.permission#MODIFY_PHONE_STATE}
|
||||
* permission or had carrier privilege permission on the subscriptions:
|
||||
* {@link TelephonyManager#hasCarrierPrivileges(int)} or
|
||||
* {@link #canManageSubscription(SubscriptionInfo)}
|
||||
*
|
||||
* @throws SecurityException if the caller doesn't meet the requirements
|
||||
* outlined above.
|
||||
*
|
||||
* @param subIdList list of subId that need removing from their groups.
|
||||
* @return whether the operation succeeds.
|
||||
*
|
||||
*/
|
||||
@SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
|
||||
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
|
||||
public boolean removeSubscriptionsFromGroup(@NonNull int[] subIdList) {
|
||||
String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
|
||||
if (VDBG) {
|
||||
logd("[removeSubscriptionsFromGroup]+ subIdList:" + Arrays.toString(subIdList));
|
||||
}
|
||||
|
||||
try {
|
||||
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
|
||||
if (iSub != null) {
|
||||
return iSub.removeSubscriptionsFromGroup(subIdList, pkgForDebug);
|
||||
}
|
||||
} catch (RemoteException ex) {
|
||||
// ignore it
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get subscriptionInfo list of subscriptions that are in the same group of given subId.
|
||||
* See {@link #setSubscriptionGroup(int[])} for more details.
|
||||
*
|
||||
* Caller will either have {@link android.Manifest.permission#READ_PHONE_STATE}
|
||||
* permission or had carrier privilege permission on the subscription.
|
||||
* {@link TelephonyManager#hasCarrierPrivileges(int)}
|
||||
*
|
||||
* @throws SecurityException if the caller doesn't meet the requirements
|
||||
* outlined above.
|
||||
*
|
||||
* @param subId of which list of subInfo from the same group will be returned.
|
||||
* @return list of subscriptionInfo that belong to the same group, including the given
|
||||
* subscription itself. It will return null if the subscription doesn't exist or it
|
||||
* doesn't belong to any group.
|
||||
*
|
||||
*/
|
||||
@SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
|
||||
@RequiresPermission(Manifest.permission.READ_PHONE_STATE)
|
||||
public @Nullable List<SubscriptionInfo> getSubscriptionsInGroup(int subId) {
|
||||
String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
|
||||
if (VDBG) {
|
||||
logd("[getSubscriptionsInGroup]+ subId:" + subId);
|
||||
}
|
||||
|
||||
List<SubscriptionInfo> result = null;
|
||||
try {
|
||||
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
|
||||
if (iSub != null) {
|
||||
result = iSub.getSubscriptionsInGroup(subId, pkgForDebug);
|
||||
}
|
||||
} catch (RemoteException ex) {
|
||||
// ignore it
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set metered by simInfo index
|
||||
*
|
||||
|
||||
@@ -6645,7 +6645,7 @@ public class TelephonyManager {
|
||||
try {
|
||||
ITelephony telephony = getITelephony();
|
||||
if (telephony != null) {
|
||||
return telephony.getCarrierPrivilegeStatus(mSubId) ==
|
||||
return telephony.getCarrierPrivilegeStatus(subId) ==
|
||||
CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
|
||||
}
|
||||
} catch (RemoteException ex) {
|
||||
|
||||
@@ -210,6 +210,10 @@ interface ISub {
|
||||
*/
|
||||
List<SubscriptionInfo> getOpportunisticSubscriptions(String callingPackage);
|
||||
|
||||
boolean removeSubscriptionsFromGroup(in int[] subIdList, String callingPackage);
|
||||
|
||||
List<SubscriptionInfo> getSubscriptionsInGroup(int subId, String callingPackage);
|
||||
|
||||
int getSlotIndex(int subId);
|
||||
|
||||
int[] getSubId(int slotIndex);
|
||||
|
||||
Reference in New Issue
Block a user