Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac108786 authored by arunvoddu's avatar arunvoddu
Browse files

Moved SmscIdentity to SMSManager also made it SystemApi

Bug: 260577776
Test: atest cts/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java#testGetSmscIdentity
Change-Id: I1a6e206f0c7970a93e0def7012b4fe9ea8d6dcb8
parent 613dc260
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -13791,6 +13791,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);
+38 −0
Original line number Diff line number Diff line
@@ -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;
    }
}
+0 −31
Original line number Diff line number Diff line
@@ -17714,37 +17714,6 @@ public class TelephonyManager {
        return false;
    }
    /**
     * 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.
     *
+8 −8
Original line number Diff line number Diff line
@@ -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);
}