Merge "[Telephony Mainline] Expose getActiveSubscriptionIdList"
This commit is contained in:
@@ -9244,6 +9244,8 @@ package android.telephony {
|
|||||||
public class SubscriptionManager {
|
public class SubscriptionManager {
|
||||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean canDisablePhysicalSubscription();
|
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean canDisablePhysicalSubscription();
|
||||||
method public boolean canManageSubscription(@Nullable android.telephony.SubscriptionInfo, @Nullable String);
|
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 @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 public java.util.List<android.telephony.SubscriptionInfo> getAvailableSubscriptionInfoList();
|
||||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getEnabledSubscriptionId(int);
|
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getEnabledSubscriptionId(int);
|
||||||
|
|||||||
@@ -1357,7 +1357,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
public void notifyCarrierNetworkChange(boolean active) {
|
public void notifyCarrierNetworkChange(boolean active) {
|
||||||
// only CarrierService with carrier privilege rule should have the permission
|
// only CarrierService with carrier privilege rule should have the permission
|
||||||
int[] subIds = Arrays.stream(SubscriptionManager.from(mContext)
|
int[] subIds = Arrays.stream(SubscriptionManager.from(mContext)
|
||||||
.getActiveSubscriptionIdList(false))
|
.getActiveAndHiddenSubscriptionIdList())
|
||||||
.filter(i -> TelephonyPermissions.checkCarrierPrivilegeForSubId(mContext,
|
.filter(i -> TelephonyPermissions.checkCarrierPrivilegeForSubId(mContext,
|
||||||
i)).toArray();
|
i)).toArray();
|
||||||
if (ArrayUtils.isEmpty(subIds)) {
|
if (ArrayUtils.isEmpty(subIds)) {
|
||||||
|
|||||||
@@ -1296,6 +1296,11 @@ public class SubscriptionManager {
|
|||||||
* The records will be sorted by {@link SubscriptionInfo#getSimSlotIndex}
|
* The records will be sorted by {@link SubscriptionInfo#getSimSlotIndex}
|
||||||
* then by {@link SubscriptionInfo#getSubscriptionId}.
|
* 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}
|
* <p>Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
|
||||||
* or that the calling app has carrier privileges (see
|
* or that the calling app has carrier privileges (see
|
||||||
* {@link TelephonyManager#hasCarrierPrivileges}). In the latter case, only records accessible
|
* {@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,
|
* @return the list of subId's that are active,
|
||||||
* is never null but the length maybe 0.
|
* is never null but the length may be 0.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@UnsupportedAppUsage
|
@SystemApi
|
||||||
public @NonNull int[] getActiveSubscriptionIdList() {
|
public @NonNull int[] getActiveSubscriptionIdList() {
|
||||||
return getActiveSubscriptionIdList(/* visibleOnly */ true);
|
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.
|
* @return a non-null list of subId's that are active.
|
||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
|
|||||||
Reference in New Issue
Block a user