diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 24374ee64719a..a7468a9d268d1 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -8416,6 +8416,51 @@ public class TelephonyManager { return -1; } + /** + * Fetches the sim service table from the EFUST/EFIST based on the application type + * {@link #APPTYPE_USIM} or {@link #APPTYPE_ISIM}. The return value is hexaString format + * representing X bytes (x >= 1). Each bit of every byte indicates which optional services + * are available for the given application type. + * The USIM service table EF is described in as per Section 4.2.8 of 3GPP TS 31.102. + * The ISIM service table EF is described in as per Section 4.2.7 of 3GPP TS 31.103. + * The list of services mapped to the exact nth byte of response as mentioned in Section 4.2 + * .7 of 3GPP TS 31.103. Eg. Service n°1: Local Phone Book, Service n°2: Fixed Dialling + * Numbers (FDN) - Bit 1 and 2 of the 1st Byte represent service Local Phone Book and Fixed + * Dialling Numbers (FDN)respectively. The coding format for each service type should be + * interpreted as bit = 1: service available;bit = 0:service not available. + * + * @param appType of type int of either {@link #APPTYPE_USIM} or {@link #APPTYPE_ISIM}. + * @return HexString represents sim service table else null. + * @throws SecurityException if the caller does not have the required permission/privileges + * @hide + */ + + @Nullable + @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) + public String getSimServiceTable(int appType) { + try { + IPhoneSubInfo info = getSubscriberInfoService(); + if (info == null) { + Rlog.e(TAG, "getSimServiceTable(): IPhoneSubInfo is null"); + return null; + } + //Fetches the sim service table based on subId and appType + if (appType == APPTYPE_ISIM) { + return info.getIsimIst(getSubId()); + } else if ((appType == APPTYPE_USIM)) { + return info.getSimServiceTable(getSubId(), APPTYPE_USIM); + } else { + return null; + } + } catch (RemoteException ex) { + Rlog.e(TAG, "getSimServiceTable(): RemoteException=" + ex.getMessage()); + } catch (NullPointerException ex) { + Rlog.e(TAG, "getSimServiceTable(): NullPointerException=" + ex.getMessage()); + } + return null; + } + /** * Resets the {@link android.telephony.ims.ImsService} associated with the specified sim slot. * Used by diagnostic apps to force the IMS stack to be disabled and re-enabled in an effort to @@ -15920,6 +15965,17 @@ public class TelephonyManager { sITelephony = telephony; } + /** + * Setup sIPhoneSubInfo for testing. + * @hide + */ + @VisibleForTesting + public static void setupIPhoneSubInfoForTest(IPhoneSubInfo iPhoneSubInfo) { + synchronized (sCacheLock) { + sIPhoneSubInfo = iPhoneSubInfo; + } + } + /** * Whether device can connect to 5G network when two SIMs are active. * @hide diff --git a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl index 78335fd549175..4fa7f43ddde46 100644 --- a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl +++ b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl @@ -232,4 +232,26 @@ interface IPhoneSubInfo { */ @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)") String getSmscIdentity(int subId, int appType); + + /** + * Fetches the sim service table from the EFUST/EFIST based on the application type + * {@link #APPTYPE_USIM} or {@link #APPTYPE_ISIM}. The return value is hexaString format + * representing X bytes (x >= 1). Each bit of every byte indicates which optional services + * are available for the given application type. + * The USIM service table EF is described in as per Section 4.2.8 of 3GPP TS 31.102. + * The ISIM service table EF is described in as per Section 4.2.7 of 3GPP TS 31.103. + * The list of services mapped to the exact nth byte of response as mentioned in Section 4.2 + * .7 of 3GPP TS 31.103. Eg. Service n°1: Local Phone Book, Service n°2: Fixed Dialling + * Numbers (FDN) - Bit 1 and 2 of the 1st Byte represent service Local Phone Book and Fixed + * Dialling Numbers (FDN)respectively. The coding format for each service type should be + * interpreted as bit = 1: service available;bit = 0:service not available. + * + * @param appType of type int of either {@link #APPTYPE_USIM} or {@link #APPTYPE_ISIM}. + * @return HexString represents sim service table else null. + * @throws SecurityException if the caller does not have the required permission/privileges + * @hide + */ + + @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)") + String getSimServiceTable(int subId, int appType); }