Merge "Don't return hidden subscription in getActiveSubscriptionInfoList."
am: 8cbe957dba
Change-Id: I372f27a1ee10cd46c5f0633586709ee14cd6e070
This commit is contained in:
@@ -1243,7 +1243,7 @@ public class SubscriptionManager {
|
|||||||
@SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
|
@SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
|
||||||
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
|
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
|
||||||
public List<SubscriptionInfo> getActiveSubscriptionInfoList() {
|
public List<SubscriptionInfo> getActiveSubscriptionInfoList() {
|
||||||
return getActiveSubscriptionInfoList(false);
|
return getActiveSubscriptionInfoList(/* userVisibleonly */true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2866,15 +2866,24 @@ public class SubscriptionManager {
|
|||||||
/**
|
/**
|
||||||
* Whether system UI should hide a subscription. If it's a bundled opportunistic
|
* Whether system UI should hide a subscription. If it's a bundled opportunistic
|
||||||
* subscription, it shouldn't show up in anywhere in Settings app, dialer app,
|
* subscription, it shouldn't show up in anywhere in Settings app, dialer app,
|
||||||
* or status bar.
|
* or status bar. Exception is if caller is carrier app, in which case they will
|
||||||
|
* want to see their own hidden subscriptions.
|
||||||
*
|
*
|
||||||
* @param info the subscriptionInfo to check against.
|
* @param info the subscriptionInfo to check against.
|
||||||
* @return true if this subscription should be hidden.
|
* @return true if this subscription should be hidden.
|
||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static boolean shouldHideSubscription(SubscriptionInfo info) {
|
private boolean shouldHideSubscription(SubscriptionInfo info) {
|
||||||
return (info != null && !TextUtils.isEmpty(info.getGroupUuid()) && info.isOpportunistic());
|
if (info == null) return false;
|
||||||
|
|
||||||
|
// If hasCarrierPrivileges or canManageSubscription returns true, it means caller
|
||||||
|
// has carrier privilege.
|
||||||
|
boolean hasCarrierPrivilegePermission = (info.isEmbedded() && canManageSubscription(info))
|
||||||
|
|| TelephonyManager.from(mContext).hasCarrierPrivileges(info.getSubscriptionId());
|
||||||
|
|
||||||
|
return (!TextUtils.isEmpty(info.getGroupUuid()) && info.isOpportunistic()
|
||||||
|
&& !hasCarrierPrivilegePermission);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user