Wrap subManager creation with createForAllProfiles

Since U, a sub can be associated with a particular profile, and thus in V we enforce filtering on the caller and only show the subs that are associated with the caller.
However, in some cases the caller indeed needs to see all subs regardless of its association, e.g. sysUI. Therefore, a param isForAllProfile is added to indicate whether the caller intends to see all subs.

Bug: 296076674
Test: voice call + data browsing
Flag: ACONFIG com.android.internal.telephony.flags.enforce_subscription_user_filter
 DEVELOPMENT
Change-Id: I88e29b445a11f36e1a3db80368bb9e46ef06eac3
This commit is contained in:
Ling Ma
2024-01-22 22:14:08 +00:00
parent 76144abc19
commit ae8b9b5fe2
4 changed files with 4 additions and 3 deletions

View File

@@ -195,7 +195,7 @@ public class EnableAutoDataSwitchDialogFragment extends SimDialogFragment implem
}
private SubscriptionManager getSubscriptionManager() {
return getContext().getSystemService(SubscriptionManager.class);
return getContext().getSystemService(SubscriptionManager.class).createForAllUserProfiles();
}
@VisibleForTesting

View File

@@ -194,7 +194,7 @@ public class SelectSpecificDataSimDialogFragment extends SimDialogFragment imple
@VisibleForTesting
protected SubscriptionManager getSubscriptionManager() {
return getContext().getSystemService(SubscriptionManager.class);
return getContext().getSystemService(SubscriptionManager.class).createForAllUserProfiles();
}
@Override

View File

@@ -125,7 +125,7 @@ public class SimListDialogFragment extends SimDialogFragment {
protected List<SubscriptionInfo> getCurrentSubscriptions() {
final SubscriptionManager manager = getContext().getSystemService(
SubscriptionManager.class);
SubscriptionManager.class).createForAllUserProfiles();
return manager.getActiveSubscriptionInfoList();
}

View File

@@ -68,6 +68,7 @@ public class EnableAutoDataSwitchDialogFragmentTest
doReturn(mContext).when(mFragment).getContext();
doReturn(mSubscriptionManager).when(mContext).getSystemService(SubscriptionManager.class);
doReturn(mSubscriptionManager).when(mSubscriptionManager).createForAllUserProfiles();
doReturn(mTelephonyManager).when(mContext).getSystemService(TelephonyManager.class);
doReturn(mTelephonyManager).when(mTelephonyManager).createForSubscriptionId(anyInt());
doReturn(mUserManager).when(mContext).getSystemService(UserManager.class);