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: I7dfb324d7e08fc4c845c44cd93e6ddf7d0368c1f
This commit is contained in:
Ling Ma
2024-01-22 22:02:00 +00:00
parent 76144abc19
commit 63f74b8567
2 changed files with 4 additions and 2 deletions

View File

@@ -44,8 +44,9 @@ public class SimLockPreferenceController extends BasePreferenceController {
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE); mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
mCarrierConfigManager = (CarrierConfigManager) mCarrierConfigManager = (CarrierConfigManager)
mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE); mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
mSubscriptionManager = (SubscriptionManager) context mSubscriptionManager = ((SubscriptionManager) context
.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE); .getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE))
.createForAllUserProfiles();
mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
} }

View File

@@ -77,6 +77,7 @@ public class SimLockPreferenceControllerTest {
ShadowApplication shadowApplication = ShadowApplication.getInstance(); ShadowApplication shadowApplication = ShadowApplication.getInstance();
shadowApplication.setSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE, shadowApplication.setSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE,
mSubscriptionManager); mSubscriptionManager);
when(mSubscriptionManager.createForAllUserProfiles()).thenReturn(mSubscriptionManager);
shadowApplication.setSystemService(Context.CARRIER_CONFIG_SERVICE, mCarrierManager); shadowApplication.setSystemService(Context.CARRIER_CONFIG_SERVICE, mCarrierManager);
shadowApplication.setSystemService(Context.USER_SERVICE, mUserManager); shadowApplication.setSystemService(Context.USER_SERVICE, mUserManager);
shadowApplication.setSystemService(Context.TELEPHONY_SERVICE, mTelephonyManager); shadowApplication.setSystemService(Context.TELEPHONY_SERVICE, mTelephonyManager);