Merge "Wrap subManager creation with createForAllProfiles" into main

This commit is contained in:
Ling Ma
2024-01-24 02:25:58 +00:00
committed by Android (Google) Code Review
4 changed files with 4 additions and 3 deletions

View File

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

View File

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

View File

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

View File

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