Merge "Add hidden API putPhoneIdAndMaybeSubIdExtra" into main
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 76b4e005..b208ee3 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -2783,17 +2783,17 @@
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 @@
}
/**
+ * 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,