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

Commit de705fdb authored by Ji Yang's avatar Ji Yang
Browse files

Revert "Remove the system new message notification automatically."

This reverts commit d5059539.

Change-Id: I5fb1e9e000bc3cf59d6eb8c3a14c5c1fd908284f
parent d5059539
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -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;
@@ -865,7 +864,6 @@ public abstract class InboundSmsHandler extends StateMachine {
        Notification.Builder mBuilder = new Notification.Builder(mContext)
                .setSmallIcon(com.android.internal.R.drawable.sym_action_chat)
                .setAutoCancel(true)
                .setVisibility(Notification.VISIBILITY_PUBLIC)
                .setDefaults(Notification.DEFAULT_ALL)
                .setContentTitle(mContext.getString(R.string.new_sms_notification_title))
                .setContentText(mContext.getString(R.string.new_sms_notification_content))
@@ -876,13 +874,6 @@ public abstract class InboundSmsHandler extends StateMachine {
                NOTIFICATION_TAG, NOTIFICATION_ID_NEW_MESSAGE, mBuilder.build());
    }

    static void cancelNewMessageNotification(Context context) {
        NotificationManager mNotificationManager =
            (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        mNotificationManager.cancel(InboundSmsHandler.NOTIFICATION_TAG,
            InboundSmsHandler.NOTIFICATION_ID_NEW_MESSAGE);
    }

    /**
     * Filters the SMS with carrier or system app.
     * @return true if the carrier or system app is invoked, false otherwise.
+5 −10
Original line number Diff line number Diff line
@@ -23,8 +23,10 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.database.Cursor;
import android.database.SQLException;
import android.net.Uri;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Telephony;
import android.telephony.Rlog;

import com.android.internal.telephony.cdma.CdmaInboundSmsHandler;
@@ -79,25 +81,18 @@ public class SmsBroadcastUndelivered {
     */
    private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(final Context context, Intent intent) {
        public void onReceive(Context context, Intent intent) {
            Rlog.d(TAG, "Received broadcast " + intent.getAction());
            if (Intent.ACTION_USER_UNLOCKED.equals(intent.getAction())) {
                new ScanRawTableThread(context).start();
                new ScanRawTableThread().start();
            }
        }
    };

    private class ScanRawTableThread extends Thread {
        private final Context context;

        private ScanRawTableThread(Context context) {
            this.context = context;
        }

        @Override
        public void run() {
            scanRawTable();
            InboundSmsHandler.cancelNewMessageNotification(context);
        }
    }

@@ -128,7 +123,7 @@ public class SmsBroadcastUndelivered {
        UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE);

        if (userManager.isUserUnlocked()) {
            new ScanRawTableThread(context).start();
            new ScanRawTableThread().start();
        } else {
            IntentFilter userFilter = new IntentFilter();
            userFilter.addAction(Intent.ACTION_USER_UNLOCKED);