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

Commit 96e9002d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Calling as system when filtering VVM SMS in CarrierSmsFilterCallback" into nyc-mr1-dev

parents c4df62ab b9b14f0b
Loading
Loading
Loading
Loading
+33 −32
Original line number Diff line number Diff line
@@ -16,8 +16,8 @@

package com.android.internal.telephony;

import static android.telephony.TelephonyManager.PHONE_TYPE_CDMA;
import static android.service.carrier.CarrierMessagingService.RECEIVE_OPTIONS_SKIP_NOTIFY_WHEN_CREDENTIAL_PROTECTED_STORAGE_UNAVAILABLE;
import static android.telephony.TelephonyManager.PHONE_TYPE_CDMA;

import android.app.Activity;
import android.app.ActivityManagerNative;
@@ -58,7 +58,6 @@ import android.service.carrier.CarrierMessagingService;
import android.service.carrier.ICarrierMessagingCallback;
import android.service.carrier.ICarrierMessagingService;
import android.service.carrier.MessagePdu;
import android.service.notification.StatusBarNotification;
import android.telephony.CarrierMessagingServiceManager;
import android.telephony.Rlog;
import android.telephony.SmsManager;
@@ -1372,7 +1371,10 @@ public abstract class InboundSmsHandler extends StateMachine {
        @Override
        public void onFilterComplete(int result) {
            mSmsFilter.disposeConnection(mContext);

            // Calling identity was the CarrierMessagingService in this callback, change it back to
            // ours. This is required for dropSms() and VisualVoicemailSmsFilter.filter().
            long token = Binder.clearCallingIdentity();
            try {
                logv("onFilterComplete: result is " + result);
                if ((result & CarrierMessagingService.RECEIVE_OPTIONS_DROP) == 0) {
                    if (mFilterWithVvm) {
@@ -1400,6 +1402,10 @@ public abstract class InboundSmsHandler extends StateMachine {
                    // Drop this SMS.
                    dropSms(mSmsFilter.mSmsBroadcastReceiver);
                }
            } finally {
                // return back to the CarrierMessagingService, restore the calling identity.
                Binder.restoreCallingIdentity(token);
            }
        }

        @Override
@@ -1424,13 +1430,8 @@ public abstract class InboundSmsHandler extends StateMachine {
    }

    private void dropSms(SmsBroadcastReceiver receiver) {
        final long token = Binder.clearCallingIdentity();
        try {
        // Needs phone package permissions.
        deleteFromRawTable(receiver.mDeleteWhere, receiver.mDeleteWhereArgs, MARK_DELETED);
        } finally {
            Binder.restoreCallingIdentity(token);
        }
        sendMessage(EVENT_BROADCAST_COMPLETE);
    }