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

Commit cce4cc8e authored by Taesu Lee's avatar Taesu Lee Committed by android-build-merger
Browse files

Merge "Fix an MMS notification issue in a lock state" am: e07ccd2e

am: 4161e0fa

Change-Id: I598d6269640e85dc75fdf3c3fea5aacc98c28453
parents eef5b61f 4161e0fa
Loading
Loading
Loading
Loading
+20 −12
Original line number Diff line number Diff line
@@ -915,10 +915,12 @@ public abstract class InboundSmsHandler extends StateMachine {
            }
        }

        final boolean isWapPush = (destPort == SmsHeader.PORT_WAP_PUSH);

        // At this point, all parts of the SMS are received. Update metrics for incoming SMS.
        // WAP-PUSH messages are handled below to also keep track of the result of the processing.
        String format = (!tracker.is3gpp2() ? SmsConstants.FORMAT_3GPP : SmsConstants.FORMAT_3GPP2);
        if (destPort != SmsHeader.PORT_WAP_PUSH) {
        if (!isWapPush) {
            mMetrics.writeIncomingSmsSession(mPhone.getPhoneId(), mLastSmsWasInjected,
                    format, timestamps, block);
        }
@@ -933,30 +935,36 @@ public abstract class InboundSmsHandler extends StateMachine {
            return false;
        }

        SmsBroadcastReceiver resultReceiver = new SmsBroadcastReceiver(tracker);

        if (!mUserManager.isUserUnlocked()) {
            return processMessagePartWithUserLocked(tracker, pdus, destPort, resultReceiver);
        }

        if (destPort == SmsHeader.PORT_WAP_PUSH) {
            // Build up the data stream
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        if (isWapPush) {
            for (byte[] pdu : pdus) {
                // 3GPP needs to extract the User Data from the PDU; 3GPP2 has already done this
                if (!tracker.is3gpp2()) {
                if (format == SmsConstants.FORMAT_3GPP) {
                    SmsMessage msg = SmsMessage.createFromPdu(pdu, SmsConstants.FORMAT_3GPP);
                    if (msg != null) {
                        pdu = msg.getUserData();
                    } else {
                        loge("processMessagePart: SmsMessage.createFromPdu returned null");
                        mMetrics.writeIncomingWapPush(mPhone.getPhoneId(), mLastSmsWasInjected,
                                format, timestamps, false);
                                SmsConstants.FORMAT_3GPP, timestamps, false);
                        return false;
                    }
                }
                output.write(pdu, 0, pdu.length);
            }
        }

        SmsBroadcastReceiver resultReceiver = new SmsBroadcastReceiver(tracker);

        if (!mUserManager.isUserUnlocked()) {
            return processMessagePartWithUserLocked(
                    tracker,
                    (isWapPush ? new byte[][] {output.toByteArray()} : pdus),
                    destPort,
                    resultReceiver);
        }

        if (isWapPush) {
            int result = mWapPush.dispatchWapPdu(output.toByteArray(), resultReceiver,
                    this, address);
            if (DBG) log("dispatchWapPdu() returned " + result);