From 4984d3c4770b2cf50ea7b6b9faaec159829fbe68 Mon Sep 17 00:00:00 2001 From: Hyungjun Park Date: Thu, 10 Jan 2019 15:26:23 +0900 Subject: [PATCH] Add isApplicationOnUicc API Returns true if the specified type of application is present on the UICC card. Bug:127549503 Signed-off-by: Hyungjun Park Change-Id: I1513951515d7225e82b5a5997cd2a8f3520c2ca7 --- api/system-current.txt | 1 + .../android/telephony/TelephonyManager.java | 25 +++++++++++++++++++ .../internal/telephony/ITelephony.aidl | 7 ++++++ 3 files changed, 33 insertions(+) diff --git a/api/system-current.txt b/api/system-current.txt index 9200ce579affe..3655c22704f48 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -6348,6 +6348,7 @@ package android.telephony { method @Nullable @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public android.telephony.IccOpenLogicalChannelResponse iccOpenLogicalChannelBySlot(int, @Nullable String, int); method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String iccTransmitApduBasicChannelBySlot(int, int, int, int, int, int, @Nullable String); method @Nullable @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String iccTransmitApduLogicalChannelBySlot(int, int, int, int, int, int, int, @Nullable String); + method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isApplicationOnUicc(int); method public boolean isDataConnectivityPossible(); method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isIdle(); method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isOffhook(); diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index d72ca6bec1892..ff8d60859e4bd 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -3035,6 +3035,31 @@ public class TelephonyManager { } } + + /** + * Returns true if the specified type of application (e.g. {@link #APPTYPE_CSIM} is present + * on the UICC card. + * + * Requires that the calling app has READ_PRIVILEGED_PHONE_STATE permission + * + * @param appType the uicc app type like {@link APPTYPE_CSIM} + * @return true if the specified type of application in UICC CARD or false if no uicc or error. + * @hide + */ + @SystemApi + @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + public boolean isApplicationOnUicc(@UiccAppType int appType) { + try { + ITelephony service = getITelephony(); + if (service != null) { + return service.isApplicationOnUicc(getSubId(), appType); + } + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelephony#isApplicationOnUicc", e); + } + return false; + } + /** * Returns a constant indicating the state of the device SIM card in a slot. * diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index da80774e8ed0f..5f890f3a697da 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -1998,6 +1998,13 @@ interface ITelephony { */ int getRadioHalVersion(); + /** + * Returns true if the specified type of application (e.g. {@link #APPTYPE_CSIM} is present + * on the UICC card. + * @hide + */ + boolean isApplicationOnUicc(int subId, int appType); + boolean isModemEnabledForSlot(int slotIndex, String callingPackage); boolean isDataEnabledForApn(int apnType, int subId, String callingPackage);