From 7089c96209f8e78ff2c1d63d858a156fea6ed077 Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Sun, 27 Nov 2022 22:09:45 -0800 Subject: [PATCH 1/4] Migrated MultiSimSettingController Added subscription manager service support in MultiSimSettingController. Also added several APIs in SubscriptionManagerService. Test: atest SubscriptionManagerServiceTest MultiSimSettingControllerTest Bug: 239607619 Change-Id: Ibadbf98093a5444f9942ad51384d611c99de15a3 --- telephony/java/android/telephony/SubscriptionInfo.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java index db9dfbb6fe4cc..3b84b65891daa 100644 --- a/telephony/java/android/telephony/SubscriptionInfo.java +++ b/telephony/java/android/telephony/SubscriptionInfo.java @@ -648,6 +648,15 @@ public class SubscriptionInfo implements Parcelable { return mIsOpportunistic; } + /** + * @return {@code true} if the subscription is from the actively used SIM. + * + * @hide + */ + public boolean isActive() { + return mSimSlotIndex >= 0 || mType == SubscriptionManager.SUBSCRIPTION_TYPE_REMOTE_SIM; + } + /** * Used in scenarios where different subscriptions are bundled as a group. * It's typically a primary and an opportunistic subscription. (see {@link #isOpportunistic()}) From 85f02b264e17b2cb2a74e0508dd0b0a0d4ba6bcb Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Sat, 3 Dec 2022 01:24:28 -0800 Subject: [PATCH 2/4] Added getActiveSubInfoCount Added getActiveSubInfoCount and migrated more modules to use SubscrtipionManagerService. Test: atest FrameworksTelephonyTests Bug: 239607619 Change-Id: Ie5c929fa7efe24d85385b6939a204d90d76d6b34 --- .../android/telephony/SubscriptionManager.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index 794fe72428d7b..ea09155c1f697 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -1766,8 +1766,7 @@ public class SubscriptionManager { * *

Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} * or that the calling app has carrier privileges (see - * {@link TelephonyManager#hasCarrierPrivileges}). In the latter case, only records accessible - * to the calling app are returned. + * {@link TelephonyManager#hasCarrierPrivileges}). * * @return Sorted list of the currently {@link SubscriptionInfo} records available on the device. *

*/ - @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public List getActiveSubscriptionInfoList() { return getActiveSubscriptionInfoList(/* userVisibleonly */true); @@ -1989,17 +1987,12 @@ public class SubscriptionManager { } /** + * Get the active subscription count. * - * Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} - * or that the calling app has carrier privileges (see - * {@link TelephonyManager#hasCarrierPrivileges}). In the latter case, the count will include - * only those subscriptions accessible to the caller. + * @return The current number of active subscriptions. * - * @return the current number of active subscriptions. There is no guarantee the value - * returned by this method will be the same as the length of the list returned by - * {@link #getActiveSubscriptionInfoList}. + * @see #getActiveSubscriptionInfoList() */ - @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getActiveSubscriptionInfoCount() { int result = 0; From df8fdacfeacd64d20c330d79e3f27496a782a1bf Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Sat, 3 Dec 2022 18:42:24 -0800 Subject: [PATCH 3/4] Added sync update database support Added a config allowing updating subscription database synchronously or asynchronously. Test: atest FrameworksTelephonyTests Bug: 239607619 Change-Id: I639a73a2213eb4a3030ce1398c441a552ab654cf --- core/res/res/values/config_telephony.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/res/res/values/config_telephony.xml b/core/res/res/values/config_telephony.xml index f2a16d355ed7b..d40adf53abd15 100644 --- a/core/res/res/values/config_telephony.xml +++ b/core/res/res/values/config_telephony.xml @@ -118,6 +118,11 @@ false + + true + +