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

Commit 7a837f16 authored by Zongheng Wang's avatar Zongheng Wang Committed by Gerrit Code Review
Browse files

Merge "Create a new API to decode Sms PDU"

parents 6489e532 f12ed60e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -9135,6 +9135,7 @@ package android.telephony {
  }
  public class SmsMessage {
    method @Nullable public static android.telephony.SmsMessage createFromNativeSmsSubmitPdu(@NonNull byte[], boolean);
    method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public static byte[] getSubmitPduEncodedMessage(boolean, @NonNull String, @NonNull String, int, int, int, int, int, int);
  }
+28 −0
Original line number Diff line number Diff line
@@ -331,6 +331,34 @@ public class SmsMessage {
        return wrappedMessage != null ? new SmsMessage(wrappedMessage) : null;
    }

    /**
     * Create an SmsMessage from a native SMS-Submit PDU, specified by Bluetooth Message Access
     * Profile Specification v1.4.2 5.8.
     * This is used by Bluetooth MAP profile to decode message when sending non UTF-8 SMS messages.
     *
     * @param data Message data.
     * @param isCdma Indicates weather the type of the SMS is CDMA.
     * @return An SmsMessage representing the message.
     *
     * @hide
     */
    @SystemApi
    @Nullable
    public static SmsMessage createFromNativeSmsSubmitPdu(@NonNull byte[] data, boolean isCdma) {
        SmsMessageBase wrappedMessage;

        if (isCdma) {
            wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.createFromEfRecord(
                    0, data);
        } else {
            // Bluetooth uses its own method to decode GSM PDU so this part is not called.
            wrappedMessage = com.android.internal.telephony.gsm.SmsMessage.createFromEfRecord(
                    0, data);
        }

        return wrappedMessage != null ? new SmsMessage(wrappedMessage) : null;
    }

    /**
     * Get the TP-Layer-Length for the given SMS-SUBMIT PDU Basically, the
     * length in bytes (not hex chars) less the SMSC header