diff options
| author | 2023-07-27 18:31:55 +0000 | |
|---|---|---|
| committer | 2023-07-27 18:31:55 +0000 | |
| commit | 3f46be81fd368828a4008c76e689eea020348e8c (patch) | |
| tree | cae4cc4d2afa39b4fc974616f1b2e09fef8af3c9 | |
| parent | 4c7d041b4212adb9414022251456d2ee27c82e3c (diff) | |
| parent | e502678bd1723847d623d757259847742db48e60 (diff) | |
Merge "Cleaned up the usage of SubscriptionManger.getSubId" into main am: e502678bd1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2678044
Change-Id: I3d0e9bbe7f759c83d7be7e726b16172fd46f44ac
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | telephony/java/android/telephony/SubscriptionManager.java | 44 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/ISub.aidl | 2 |
2 files changed, 22 insertions, 24 deletions
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index 81eb8365d7e0..59a5b7ea7847 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -2218,46 +2218,46 @@ public class SubscriptionManager { } /** - * Get an array of subscription ids for specified logical SIM slot Index. + * Get an array of subscription ids for the specified logical SIM slot Index. The maximum size + * of the array is 1. This API was mistakenly designed to return multiple subscription ids, + * which is not possible in the current Android telephony architecture. * * @param slotIndex The logical SIM slot index. * - * @return subscription Ids or {@code null} if the given slot index is not valid or there are - * no active subscription in the slot. In the implementation today, there will be no more - * than one subscriptions per logical SIM slot. + * @return Subscription id of the active subscription on the specified logical SIM slot index. + * If SIM is absent on the slot, a single element array of {@link #INVALID_SUBSCRIPTION_ID} will + * be returned. {@code null} if the provided {@code slotIndex} is not valid. * * @deprecated Use {@link #getSubscriptionId(int)} instead. */ @Deprecated @Nullable public int[] getSubscriptionIds(int slotIndex) { - int subId = getSubscriptionId(slotIndex); - if (!isValidSubscriptionId(subId)) { + if (!isValidSlotIndex(slotIndex)) { return null; } return new int[]{getSubscriptionId(slotIndex)}; } - /** @hide */ - @UnsupportedAppUsage + /** + * Get an array of subscription ids for the specified logical SIM slot Index. The maximum size + * of the array is 1. This API was mistakenly designed to return multiple subscription ids, + * which is not possible in the current Android telephony architecture. + * + * @param slotIndex The logical SIM slot index. + * + * @return Subscription id of the active subscription on the specified logical SIM slot index. + * If SIM is absent on the slot, a single element array of {@link #INVALID_SUBSCRIPTION_ID} will + * be returned. {@code null} if the provided {@code slotIndex} is not valid. + * + * @deprecated Use {@link #getSubscriptionId(int)} instead. + * @hide + */ public static int[] getSubId(int slotIndex) { if (!isValidSlotIndex(slotIndex)) { - logd("[getSubId]- fail"); return null; } - - int[] subId = null; - - try { - ISub iSub = TelephonyManager.getSubscriptionService(); - if (iSub != null) { - subId = iSub.getSubIds(slotIndex); - } - } catch (RemoteException ex) { - // ignore it - } - - return subId; + return new int[]{getSubscriptionId(slotIndex)}; } /** diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl index af4edc443151..632a6874b5f5 100644 --- a/telephony/java/com/android/internal/telephony/ISub.aidl +++ b/telephony/java/com/android/internal/telephony/ISub.aidl @@ -236,8 +236,6 @@ interface ISub { int getSlotIndex(int subId); - int[] getSubIds(int slotIndex); - int getSubId(int slotIndex); int getDefaultSubId(); |