diff options
| -rw-r--r-- | telephony/java/android/telephony/SubscriptionManager.java | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index 76b4e0052792..b208ee3043ab 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -2783,17 +2783,17 @@ public class SubscriptionManager { return phoneId >= 0 && phoneId < TelephonyManager.getDefault().getActiveModemCount(); } - /** @hide */ + /** + * Puts phone ID and subscription ID into the {@code intent}. + * + * <p>If the subscription ID is not valid, only puts phone ID into the {@code intent}. + * + * @hide + */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public static void putPhoneIdAndSubIdExtra(Intent intent, int phoneId) { int subId = SubscriptionManager.getSubscriptionId(phoneId); - if (isValidSubscriptionId(subId)) { - putPhoneIdAndSubIdExtra(intent, phoneId, subId); - } else { - logd("putPhoneIdAndSubIdExtra: no valid subs"); - intent.putExtra(PhoneConstants.PHONE_KEY, phoneId); - intent.putExtra(EXTRA_SLOT_INDEX, phoneId); - } + putPhoneIdAndMaybeSubIdExtra(intent, phoneId, subId); } /** @hide */ @@ -2806,6 +2806,23 @@ public class SubscriptionManager { } /** + * Puts phone ID and subscription ID into the {@code intent}. + * + * <p>If the subscription ID is not valid, only puts phone ID into the {@code intent}. + * + * @hide + */ + public static void putPhoneIdAndMaybeSubIdExtra(Intent intent, int phoneId, int subId) { + if (isValidSubscriptionId(subId)) { + putPhoneIdAndSubIdExtra(intent, phoneId, subId); + } else { + if (VDBG) logd("putPhoneIdAndMaybeSubIdExtra: invalid subId"); + intent.putExtra(PhoneConstants.PHONE_KEY, phoneId); + intent.putExtra(EXTRA_SLOT_INDEX, phoneId); + } + } + + /** * Get visible subscription Id(s) of the currently active SIM(s). * * @return the list of subId's that are active, |