diff options
author | Nancy Chen <nancychen@google.com> | 2014-10-08 18:47:40 -0700 |
---|---|---|
committer | Nancy Chen <nancychen@google.com> | 2014-10-13 14:01:49 -0700 |
commit | b0cad32c3cadd0387f6dcd82aade629e6f2f6bee (patch) | |
tree | a999b2b48b300d628c2c1f777e5d4a552f36f726 /telecomm/java/android/telecom/TelecomManager.java | |
parent | 1a6c41fbad9c1c6725d189fdcf7dae2fe3f00b4d (diff) | |
download | frameworks_base-b0cad32c3cadd0387f6dcd82aade629e6f2f6bee.zip frameworks_base-b0cad32c3cadd0387f6dcd82aade629e6f2f6bee.tar.gz frameworks_base-b0cad32c3cadd0387f6dcd82aade629e6f2f6bee.tar.bz2 |
Add API method to extract subscription ID from phone account (1/3)
Since Telephony uses subscription ids and Telecom uses Phone Accounts,
there should be an easy way to interface between the two. Since the
value of the subscription id and "id" of the phone account should be the
same in the case of a SIM phone account, we just need to check that the
phone account in question is a SIM phone account and convert the string
to a long.
This lays in groundwork for the following bugs:
Bug: 17925501
Bug: 17917937
Change-Id: I926e969b365d9e9878436302117e8786ec5513b8
Diffstat (limited to 'telecomm/java/android/telecom/TelecomManager.java')
-rw-r--r-- | telecomm/java/android/telecom/TelecomManager.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index b4d429a..da95af3 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -310,6 +310,50 @@ public class TelecomManager { } /** + * Return the corresponding PhoneAccount id of a given subscription id. + * + * @param subscriptionId The value of the subscription id the caller is trying to get a phone + * account id for. + * @return A string representing the phone account id or null. + * + * @hide + */ + @SystemApi + public String getPhoneAccountIdForSubscriptionId(long subscriptionId) { + try { + if (isServiceConnected()) { + return getTelecomService().getPhoneAccountIdForSubscriptionId(subscriptionId); + } + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelecomService#getSubscriptionIdForPhoneAccount", e); + } + return null; + } + + /** + * Return the subscription id of the PhoneAccount if it exists. This only applies to PSTN + * or SIM-based phone accounts. Return -1 otherwise. + * + * @param accountHandle The {@link PhoneAccountHandle} the caller is trying to get the + * subscription id for. + * @return The subscription id (a long) or -1 if the phone account is not a SIM or + * a subscription id does not exist. + * + * @hide + */ + @SystemApi + public long getSubscriptionIdForPhoneAccount(PhoneAccountHandle accountHandle) { + try { + if (isServiceConnected()) { + return getTelecomService().getSubscriptionIdForPhoneAccount(accountHandle); + } + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelecomService#getSubscriptionIdForPhoneAccount", e); + } + return -1; + } + + /** * Return the {@link PhoneAccount} which is the user-chosen default for making outgoing phone * calls with a specified URI scheme. * <p> |