diff options
author | Ling Ma <linggm@google.com> | 2023-12-06 17:59:14 -0800 |
---|---|---|
committer | Ling Ma <linggm@google.com> | 2023-12-06 17:59:14 -0800 |
commit | a625fb2c83cee267a0bcfb58547d0e6febc9428b (patch) | |
tree | af5988624ed93389b325bfef5f5b027ceef7e811 | |
parent | adf2c3521dc674991c061135c5dfaa1954748349 (diff) | |
download | AlternativeNetworkAccess-a625fb2c83cee267a0bcfb58547d0e6febc9428b.tar.gz |
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: Iacfad126ff3ffac0427a6ba90b5ca0bd5617ef38
-rw-r--r-- | src/com/android/ons/ONSProfileActivator.java | 7 | ||||
-rw-r--r-- | src/com/android/ons/OpportunisticNetworkService.java | 4 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/com/android/ons/ONSProfileActivator.java b/src/com/android/ons/ONSProfileActivator.java index 05228b8..d869975 100644 --- a/src/com/android/ons/ONSProfileActivator.java +++ b/src/com/android/ons/ONSProfileActivator.java @@ -35,6 +35,7 @@ import android.telephony.euicc.EuiccManager; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.telephony.flags.Flags; import com.android.ons.ONSProfileDownloader.DownloadRetryResultCode; import java.util.ArrayList; @@ -67,7 +68,11 @@ public class ONSProfileActivator implements ONSProfileConfigurator.ONSProfConfig public ONSProfileActivator(Context context, ONSStats onsStats) { mContext = context; - mSubManager = mContext.getSystemService(SubscriptionManager.class); + SubscriptionManager sm = mContext.getSystemService(SubscriptionManager.class); + if (Flags.workProfileApiSplit()) { + sm = sm.createForAllUserProfiles(); + } + mSubManager = sm; mTelephonyManager = mContext.getSystemService(TelephonyManager.class); mCarrierConfigMgr = mContext.getSystemService(CarrierConfigManager.class); mEuiccManager = mContext.getSystemService(EuiccManager.class); diff --git a/src/com/android/ons/OpportunisticNetworkService.java b/src/com/android/ons/OpportunisticNetworkService.java index 3080943..a77c18e 100644 --- a/src/com/android/ons/OpportunisticNetworkService.java +++ b/src/com/android/ons/OpportunisticNetworkService.java @@ -48,6 +48,7 @@ import com.android.internal.telephony.ISetOpportunisticDataCallback; import com.android.internal.telephony.IUpdateAvailableNetworksCallback; import com.android.internal.telephony.TelephonyIntents; import com.android.internal.telephony.TelephonyPermissions; +import com.android.internal.telephony.flags.Flags; import com.android.telephony.Rlog; import java.util.ArrayList; @@ -469,6 +470,9 @@ public class OpportunisticNetworkService extends Service { PREF_NAME, Context.MODE_PRIVATE); mSubscriptionManager = (SubscriptionManager) mContext.getSystemService( Context.TELEPHONY_SUBSCRIPTION_SERVICE); + if (Flags.workProfileApiSplit()) { + mSubscriptionManager = mSubscriptionManager.createForAllUserProfiles(); + } mONSConfigInputHashMap = new HashMap<String, ONSConfigInput>(); mONSStats = new ONSStats(mContext, mSubscriptionManager); mContext.registerReceiver(mBroadcastReceiver, |