From f5ee7b5d8509c08a8d12ab1f5a427510833f56ba Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Wed, 22 Feb 2023 11:28:09 -0800 Subject: [PATCH] Cleaned up the deprecated APIs Bug: 270094276 Test: Basic phone funcationality tests Change-Id: Idac6ef8a5a2d70274dd3c73093e1356eaf742fd0 --- .../telephony/CellBroadcastIntents.java | 20 +------------------ .../telephony/ims/feature/ImsFeature.java | 4 ++-- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/core/java/android/telephony/CellBroadcastIntents.java b/core/java/android/telephony/CellBroadcastIntents.java index c3ca2866c71c8..b9ad7734b24c4 100644 --- a/core/java/android/telephony/CellBroadcastIntents.java +++ b/core/java/android/telephony/CellBroadcastIntents.java @@ -104,7 +104,7 @@ public class CellBroadcastIntents { * Put the phone ID and sub ID into an intent as extras. */ private static void putPhoneIdAndSubIdExtra(Context context, Intent intent, int phoneId) { - int subId = getSubIdForPhone(context, phoneId); + int subId = SubscriptionManager.getSubscriptionId(phoneId); if (subId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) { intent.putExtra("subscription", subId); intent.putExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX, subId); @@ -112,22 +112,4 @@ public class CellBroadcastIntents { intent.putExtra("phone", phoneId); intent.putExtra(SubscriptionManager.EXTRA_SLOT_INDEX, phoneId); } - - /** - * Get the subscription ID for a phone ID, or INVALID_SUBSCRIPTION_ID if the phone does not - * have an active sub - * @param phoneId the phoneId to use - * @return the associated sub id - */ - private static int getSubIdForPhone(Context context, int phoneId) { - SubscriptionManager subMan = - (SubscriptionManager) context.getSystemService( - Context.TELEPHONY_SUBSCRIPTION_SERVICE); - int[] subIds = subMan.getSubscriptionIds(phoneId); - if (subIds != null) { - return subIds[0]; - } else { - return SubscriptionManager.INVALID_SUBSCRIPTION_ID; - } - } } diff --git a/telephony/java/android/telephony/ims/feature/ImsFeature.java b/telephony/java/android/telephony/ims/feature/ImsFeature.java index 174675fcde4ca..a8fb36b591fa0 100644 --- a/telephony/java/android/telephony/ims/feature/ImsFeature.java +++ b/telephony/java/android/telephony/ims/feature/ImsFeature.java @@ -342,8 +342,8 @@ public abstract class ImsFeature { /** * @return The SIM slot index associated with this ImsFeature. * - * @see SubscriptionManager#getSubscriptionIds(int) for more information on getting the - * subscription IDs associated with this slot. + * @see SubscriptionManager#getSubscriptionId(int) for more information on getting the + * subscription ID associated with this slot. * @hide */ @SystemApi