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

Commit e660694c authored by John Spurlock's avatar John Spurlock Committed by Android (Google) Code Review
Browse files

Merge "Display intercepted notifications if configured."

parents 304bbd28 014ad591
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.Context;
import android.os.Binder;
import android.os.IBinder;
import android.os.Process;
import android.provider.Settings;
import android.service.notification.StatusBarNotification;
import android.util.ArrayMap;
import android.view.View;
@@ -59,6 +60,7 @@ public class InterceptedNotifications {

    public boolean tryIntercept(IBinder key, StatusBarNotification notification) {
        if (!notification.getNotification().extras.getBoolean(EXTRA_INTERCEPT)) return false;
        if (shouldDisplayIntercepted()) return false;
        mIntercepted.put(key, notification);
        updateSyntheticNotification();
        return true;
@@ -80,6 +82,11 @@ public class InterceptedNotifications {
        }
    }

    private boolean shouldDisplayIntercepted() {
        return Settings.Secure.getInt(mContext.getContentResolver(),
                Settings.Secure.DISPLAY_INTERCEPTED_NOTIFICATIONS, 0) != 0;
    }

    private void updateSyntheticNotification() {
        if (mIntercepted.isEmpty()) {
            if (mSynKey != null) {