From e40c5ebd9cb2c86f161fe88e0fc14b8a13832892 Mon Sep 17 00:00:00 2001 From: Ling Ma Date: Wed, 6 Dec 2023 15:16:35 -0800 Subject: 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: voice call + data browsing Flag: ACONFIG com.android.internal.telephony.flags.work_profile_api_split DEVELOPMENT Change-Id: Ifa5fd5061ee48de2153d22eec43f3df71d589b6f --- .../src/com/android/service/ims/presence/PresenceSetting.java | 4 ++++ rcs/rcsservice/src/com/android/service/ims/RcsSettingUtils.java | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/rcs/presencepolling/src/com/android/service/ims/presence/PresenceSetting.java b/rcs/presencepolling/src/com/android/service/ims/presence/PresenceSetting.java index 10988c7..4be5f15 100644 --- a/rcs/presencepolling/src/com/android/service/ims/presence/PresenceSetting.java +++ b/rcs/presencepolling/src/com/android/service/ims/presence/PresenceSetting.java @@ -34,6 +34,7 @@ import android.telephony.SubscriptionManager; import android.telephony.ims.ProvisioningManager; import com.android.ims.internal.Logger; +import com.android.internal.telephony.flags.Flags; import java.util.List; @@ -245,6 +246,9 @@ public class PresenceSetting { public static int getDefaultSubscriptionId() { SubscriptionManager sm = sContext.getSystemService(SubscriptionManager.class); if (sm == null) return SubscriptionManager.INVALID_SUBSCRIPTION_ID; + if (Flags.workProfileApiSplit()) { + sm = sm.createForAllUserProfiles(); + } List infos = sm.getActiveSubscriptionInfoList(); if (infos == null || infos.isEmpty()) { // There are no active subscriptions right now. diff --git a/rcs/rcsservice/src/com/android/service/ims/RcsSettingUtils.java b/rcs/rcsservice/src/com/android/service/ims/RcsSettingUtils.java index da4cbd6..839e60f 100644 --- a/rcs/rcsservice/src/com/android/service/ims/RcsSettingUtils.java +++ b/rcs/rcsservice/src/com/android/service/ims/RcsSettingUtils.java @@ -43,6 +43,7 @@ import android.telephony.ims.feature.MmTelFeature; import android.telephony.ims.stub.ImsRegistrationImplBase; import com.android.ims.internal.Logger; +import com.android.internal.telephony.flags.Flags; import java.util.List; import java.util.concurrent.LinkedBlockingQueue; @@ -360,7 +361,10 @@ public class RcsSettingUtils { public static int getDefaultSubscriptionId(Context context) { SubscriptionManager sm = context.getSystemService(SubscriptionManager.class); if (sm == null) return SubscriptionManager.INVALID_SUBSCRIPTION_ID; - List infos = sm.getActiveSubscriptionInfoList(); + if (Flags.workProfileApiSplit()) { + sm = sm.createForAllUserProfiles(); + } + List infos = sm.getActiveSubscriptionInfoList(); if (infos == null || infos.isEmpty()) { // There are no active subscriptions right now. return SubscriptionManager.INVALID_SUBSCRIPTION_ID; -- cgit v1.2.3