Merge "Check Carrier Privilege on Hidden Subs" into qt-r1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
09ef9e13a7
@@ -2121,24 +2121,27 @@ public class SubscriptionManager {
|
||||
* @hide
|
||||
*/
|
||||
@UnsupportedAppUsage
|
||||
public @NonNull int[] getActiveSubscriptionIdList() {
|
||||
int[] subId = null;
|
||||
public static @NonNull int[] getActiveSubscriptionIdList() {
|
||||
return getActiveSubscriptionIdList(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a non-null list of subId's that are active.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static @NonNull int[] getActiveSubscriptionIdList(boolean visibleOnly) {
|
||||
try {
|
||||
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
|
||||
if (iSub != null) {
|
||||
subId = iSub.getActiveSubIdList(/*visibleOnly*/true);
|
||||
int[] subId = iSub.getActiveSubIdList(visibleOnly);
|
||||
if (subId != null) return subId;
|
||||
}
|
||||
} catch (RemoteException ex) {
|
||||
// ignore it
|
||||
}
|
||||
|
||||
if (subId == null) {
|
||||
subId = new int[0];
|
||||
}
|
||||
|
||||
return subId;
|
||||
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -605,15 +605,11 @@ public final class TelephonyPermissions {
|
||||
*/
|
||||
private static boolean checkCarrierPrivilegeForAnySubId(Context context,
|
||||
Supplier<ITelephony> telephonySupplier, int uid) {
|
||||
SubscriptionManager sm = (SubscriptionManager) context.getSystemService(
|
||||
Context.TELEPHONY_SUBSCRIPTION_SERVICE);
|
||||
int[] activeSubIds = sm.getActiveSubscriptionIdList();
|
||||
if (activeSubIds != null) {
|
||||
for (int activeSubId : activeSubIds) {
|
||||
if (getCarrierPrivilegeStatus(telephonySupplier, activeSubId, uid)
|
||||
== TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {
|
||||
return true;
|
||||
}
|
||||
int[] activeSubIds = SubscriptionManager.getActiveSubscriptionIdList(/*visibleOnly*/ false);
|
||||
for (int activeSubId : activeSubIds) {
|
||||
if (getCarrierPrivilegeStatus(telephonySupplier, activeSubId, uid)
|
||||
== TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user