diff options
| -rw-r--r-- | core/api/system-current.txt | 1 | ||||
| -rw-r--r-- | telephony/java/android/telephony/SmsManager.java | 38 | ||||
| -rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 31 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl | 16 |
4 files changed, 47 insertions, 39 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 85f88135510b..bcb4a3ab4294 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -13845,6 +13845,7 @@ package android.telephony { method @Deprecated public boolean disableCellBroadcastRange(int, int, int); method @Deprecated public boolean enableCellBroadcastRange(int, int, int); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getPremiumSmsConsent(@NonNull String); + method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.net.Uri getSmscIdentity(); method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_CELL_BROADCASTS) public void resetAllCellBroadcastRanges(); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void sendMultipartTextMessageWithoutPersisting(String, String, java.util.List<java.lang.String>, java.util.List<android.app.PendingIntent>, java.util.List<android.app.PendingIntent>); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setPremiumSmsConsent(@NonNull String, int); diff --git a/telephony/java/android/telephony/SmsManager.java b/telephony/java/android/telephony/SmsManager.java index a2a110d3f758..26b4bbc41b25 100644 --- a/telephony/java/android/telephony/SmsManager.java +++ b/telephony/java/android/telephony/SmsManager.java @@ -46,6 +46,7 @@ import android.util.Pair; import com.android.internal.annotations.GuardedBy; import com.android.internal.telephony.IIntegerConsumer; +import com.android.internal.telephony.IPhoneSubInfo; import com.android.internal.telephony.ISms; import com.android.internal.telephony.ITelephony; import com.android.internal.telephony.SmsRawData; @@ -3508,4 +3509,41 @@ public final class SmsManager { private static String formatCrossStackMessageId(long id) { return "{x-message-id:" + id + "}"; } + + /** + * Fetches the EF_PSISMSC value from the UICC that contains the Public Service Identity of + * the SM-SC (either a SIP URI or tel URI). The EF_PSISMSC of ISIM and USIM can be found in + * DF_TELECOM. + * The EF_PSISMSC value is used by the ME to submit SMS over IP as defined in 24.341 [55]. + * + * @return Uri : Public Service Identity of SM-SC from the ISIM or USIM if the ISIM is not + * available. + * @throws SecurityException if the caller does not have the required permission/privileges. + * @throws IllegalStateException in case of telephony service is not available. + * @hide + */ + @NonNull + @SystemApi + @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) + public Uri getSmscIdentity() { + Uri smscUri = Uri.EMPTY; + try { + IPhoneSubInfo info = TelephonyManager.getSubscriberInfoService(); + if (info == null) { + Rlog.e(TAG, "getSmscIdentity(): IPhoneSubInfo instance is NULL"); + throw new IllegalStateException("Telephony service is not available"); + } + /** Fetches the SIM EF_PSISMSC value based on subId and appType */ + smscUri = info.getSmscIdentity(getSubscriptionId(), TelephonyManager.APPTYPE_ISIM); + if (Uri.EMPTY.equals(smscUri)) { + /** Fallback in case where ISIM is not available */ + smscUri = info.getSmscIdentity(getSubscriptionId(), TelephonyManager.APPTYPE_USIM); + } + } catch (RemoteException ex) { + Rlog.e(TAG, "getSmscIdentity(): Exception : " + ex); + ex.rethrowAsRuntimeException(); + } + return smscUri; + } } diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 0ad5ba0eaa47..481280634685 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -17715,37 +17715,6 @@ public class TelephonyManager { } /** - * Fetches the EFPSISMSC value from the SIM that contains the Public Service Identity - * of the SM-SC (either a SIP URI or tel URI), the value is common for both appType - * {@link #APPTYPE_ISIM} and {@link #APPTYPE_SIM}. - * The EFPSISMSC value is used by the ME to submit SMS over IP as defined in 24.341 [55]. - * - * @param appType ICC Application type {@link #APPTYPE_ISIM} or {@link #APPTYPE_USIM} - * @return SIP URI or tel URI of the Public Service Identity of the SM-SC - * @throws SecurityException if the caller does not have the required permission/privileges - * @hide - */ - @NonNull - @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) - @RequiresFeature(PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION) - public String getSmscIdentity(int appType) { - try { - IPhoneSubInfo info = getSubscriberInfoService(); - if (info == null) { - Rlog.e(TAG, "getSmscIdentity(): IPhoneSubInfo instance is NULL"); - return null; - } - /** Fetches the SIM PSISMSC params based on subId and appType */ - return info.getSmscIdentity(getSubId(), appType); - } catch (RemoteException ex) { - Rlog.e(TAG, "getSmscIdentity(): RemoteException: " + ex.getMessage()); - } catch (NullPointerException ex) { - Rlog.e(TAG, "getSmscIdentity(): NullPointerException: " + ex.getMessage()); - } - return null; - } - - /** * Returns a constant indicating the state of sim for the slot index. * * @param slotIndex Logical SIM slot index. diff --git a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl index 4fa7f43ddde4..3dfc81eafb77 100644 --- a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl +++ b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl @@ -17,6 +17,7 @@ package com.android.internal.telephony; import android.telephony.ImsiEncryptionInfo; +import android.net.Uri; /** * Interface used to retrieve various phone-related subscriber information. @@ -220,18 +221,17 @@ interface IPhoneSubInfo { String callingPackage, String callingFeatureId); /** - * Fetches the EFPSISMSC value from the SIM that contains the Public Service Identity - * of the SM-SC (either a SIP URI or tel URI), the value is common for both appType - * {@link #APPTYPE_ISIM} and {@link #APPTYPE_SIM}. - * The EFPSISMSC value is used by the ME to submit SMS over IP as defined in 24.341 [55]. + * Fetches the EF_PSISMSC value from the UICC that contains the Public Service Identity of + * the SM-SC (either a SIP URI or tel URI). The EF_PSISMSC of ISIM and USIM can be found in + * DF_TELECOM. + * The EF_PSISMSC value is used by the ME to submit SMS over IP as defined in 24.341 [55]. * - * @param appType ICC Application type {@link #APPTYPE_ISIM} or {@link #APPTYPE_USIM} - * @return SIP URI or tel URI of the Public Service Identity of the SM-SC + * @return Uri : Public Service Identity of SM-SC * @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 getSmscIdentity(int subId, int appType); + Uri getSmscIdentity(int subId, int appType); /** * Fetches the sim service table from the EFUST/EFIST based on the application type @@ -249,9 +249,9 @@ interface IPhoneSubInfo { * @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 + * @throws IllegalStateException in case if phone or UiccApplication is not available. * @hide */ - @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)") String getSimServiceTable(int subId, int appType); } |