Wrap subManager creation with createForAllProfiles
Since U, a sub can be associated to a particular profile, and thus in V we enforce filtering on 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 its association, e.g. sysUI. Therefore, a param isForAllProfile is added to indicate whether the caller intends to see all subs.
Bug: 296076674
Test: m bluejay-trunk_staging-userdebug
Flag: ACONFIG com.android.internal.telephony.flags.work_profile_api_split DEVELOPMENT
Change-Id: I21a4f518acec1079a62badb5b99654220042fe00
diff --git a/src/com/android/server/telecom/Analytics.java b/src/com/android/server/telecom/Analytics.java
index bbcf858..45e3340 100644
--- a/src/com/android/server/telecom/Analytics.java
+++ b/src/com/android/server/telecom/Analytics.java
@@ -721,7 +721,7 @@
private static int getCarrierId(Context context) {
SubscriptionManager subscriptionManager =
- context.getSystemService(SubscriptionManager.class);
+ context.getSystemService(SubscriptionManager.class).createForAllUserProfiles();
List<SubscriptionInfo> subInfos = subscriptionManager.getActiveSubscriptionInfoList();
if (subInfos == null) {
return -1;
diff --git a/tests/src/com/android/server/telecom/tests/AnalyticsTests.java b/tests/src/com/android/server/telecom/tests/AnalyticsTests.java
index 148db51..9caf0b5 100644
--- a/tests/src/com/android/server/telecom/tests/AnalyticsTests.java
+++ b/tests/src/com/android/server/telecom/tests/AnalyticsTests.java
@@ -87,6 +87,7 @@
super.setUp();
// this is a mock
mSubscriptionManager = mContext.getSystemService(SubscriptionManager.class);
+ when(mSubscriptionManager.createForAllUserProfiles()).thenReturn(mSubscriptionManager);
when(mSubscriptionManager.getActiveSubscriptionInfoList())
.thenReturn(Collections.emptyList());
}