From d67bd616e0ff1d59a49278a820c50a88582c2d6f Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Wed, 3 Apr 2019 15:26:05 -0700 Subject: [PATCH] Add @hide API to get the phone account handle for a subId. This is used in SubscriptionManager to figure out which phone account is being updated when the default voice sub changes. It seemed like a good spot to put it since we should really have an api for this in the future. Test: Manual, manual, manual Bug: 128916238 Change-Id: If5137c0e7f01a14810e0ee94e5d857d69f368a87 --- .../android/telephony/TelephonyManager.java | 21 +++++++++++++++++++ .../internal/telephony/ITelephony.aidl | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index bdd01e2f69fba..66429c97a549e 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -8938,6 +8938,27 @@ public class TelephonyManager { return retval; } + /** + * Determines the {@link PhoneAccountHandle} associated with a subscription Id. + * + * @param subscriptionId The subscription Id to check. + * @return The {@link PhoneAccountHandle} associated with a subscription Id, or {@code null} if + * there is no associated {@link PhoneAccountHandle}. + * @hide + */ + public @Nullable PhoneAccountHandle getPhoneAccountHandleForSubscriptionId(int subscriptionId) { + PhoneAccountHandle returnValue = null; + try { + ITelephony service = getITelephony(); + if (service != null) { + returnValue = service.getPhoneAccountHandleForSubscriptionId(subscriptionId); + } + } catch (RemoteException e) { + } + + return returnValue; + } + private int getSubIdForPhoneAccountHandle(PhoneAccountHandle phoneAccountHandle) { int retval = SubscriptionManager.INVALID_SUBSCRIPTION_ID; try { diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index c8cd2495bdd9b..ecbbd6a6c7862 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -1265,6 +1265,11 @@ interface ITelephony { */ int getSubIdForPhoneAccount(in PhoneAccount phoneAccount); + /** + * Returns the PhoneAccountHandle associated with a subscription ID. + */ + PhoneAccountHandle getPhoneAccountHandleForSubscriptionId(int subscriptionId); + void factoryReset(int subId); /**