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

Commit 24653c3b authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Make systemui obey new visual effect flags

Test: runtest systemui
Bug: 74075050
Change-Id: I46a3e762ecdab132edcb81880ef3e4f7f2e55aac
parent ccc6ae64
Loading
Loading
Loading
Loading
+50 −4
Original line number Diff line number Diff line
@@ -16,6 +16,13 @@

package com.android.systemui.statusbar;

import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_AMBIENT;
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_FULL_SCREEN_INTENT;
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_LIGHTS;
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST;
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK;
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_STATUS_BAR;

import android.app.AppGlobals;
import android.app.AppOpsManager;
import android.app.Notification;
@@ -445,20 +452,47 @@ public class NotificationData {
        return Ranking.VISIBILITY_NO_OVERRIDE;
    }

    public boolean shouldSuppressScreenOff(String key) {
    public boolean shouldSuppressFullScreenIntent(String key) {
        if (mRankingMap != null) {
            getRanking(key, mTmpRanking);
            return (mTmpRanking.getSuppressedVisualEffects()
                    & SUPPRESSED_EFFECT_FULL_SCREEN_INTENT) != 0;
        }
        return false;
    }

    public boolean shouldSuppressPeek(String key) {
        if (mRankingMap != null) {
            getRanking(key, mTmpRanking);
            return (mTmpRanking.getSuppressedVisualEffects()
                    & SUPPRESSED_EFFECT_PEEK) != 0;
        }
        return false;
    }

    public boolean shouldSuppressStatusBar(String key) {
        if (mRankingMap != null) {
            getRanking(key, mTmpRanking);
            return (mTmpRanking.getSuppressedVisualEffects()
                    & NotificationListenerService.SUPPRESSED_EFFECT_SCREEN_OFF) != 0;
                    & SUPPRESSED_EFFECT_STATUS_BAR) != 0;
        }
        return false;
    }

    public boolean shouldSuppressScreenOn(String key) {
    public boolean shouldSuppressAmbient(String key) {
        if (mRankingMap != null) {
            getRanking(key, mTmpRanking);
            return (mTmpRanking.getSuppressedVisualEffects()
                    & NotificationListenerService.SUPPRESSED_EFFECT_SCREEN_ON) != 0;
                    & SUPPRESSED_EFFECT_AMBIENT) != 0;
        }
        return false;
    }

    public boolean shouldSuppressNotificationList(String key) {
        if (mRankingMap != null) {
            getRanking(key, mTmpRanking);
            return (mTmpRanking.getSuppressedVisualEffects()
                    & SUPPRESSED_EFFECT_NOTIFICATION_LIST) != 0;
        }
        return false;
    }
@@ -576,6 +610,14 @@ public class NotificationData {
            return true;
        }

        if (mEnvironment.isDozing() && shouldSuppressAmbient(sbn.getKey())) {
            return true;
        }

        if (!mEnvironment.isDozing() && shouldSuppressNotificationList(sbn.getKey())) {
            return true;
        }

        if (!StatusBar.ENABLE_CHILD_NOTIFICATIONS
                && mGroupManager.isChildInGroupWithSummary(sbn)) {
            return true;
@@ -670,5 +712,9 @@ public class NotificationData {
        public boolean isNotificationForCurrentProfiles(StatusBarNotification sbn);
        public String getCurrentMediaNotificationKey();
        public NotificationGroupManager getGroupManager();
        /**
         * @return true iff the device is dozing
         */
        boolean isDozing();
    }
}
+4 −7
Original line number Diff line number Diff line
@@ -304,11 +304,7 @@ public class NotificationEntryManager implements Dumpable, NotificationInflater.
            return true;
        }

        if (mPowerManager.isInteractive()) {
            return mNotificationData.shouldSuppressScreenOn(key);
        } else {
            return mNotificationData.shouldSuppressScreenOff(key);
        }
        return mNotificationData.shouldSuppressFullScreenIntent(key);
    }

    private void inflateViews(NotificationData.Entry entry, ViewGroup parent) {
@@ -849,12 +845,13 @@ public class NotificationEntryManager implements Dumpable, NotificationInflater.
            return false;
        }

        if (!mPresenter.isDozing() && mNotificationData.shouldSuppressScreenOn(sbn.getKey())) {
        if (!mPresenter.isDozing() && mNotificationData.shouldSuppressPeek(sbn.getKey())) {
            if (DEBUG) Log.d(TAG, "No peeking: suppressed by DND: " + sbn.getKey());
            return false;
        }

        if (mPresenter.isDozing() && mNotificationData.shouldSuppressScreenOff(sbn.getKey())) {
        // Peeking triggers an ambient display pulse, so disable peek is ambient is active
        if (mPresenter.isDozing() && mNotificationData.shouldSuppressAmbient(sbn.getKey())) {
            if (DEBUG) Log.d(TAG, "No peeking: suppressed by DND: " + sbn.getKey());
            return false;
        }
+0 −5
Original line number Diff line number Diff line
@@ -100,11 +100,6 @@ public interface NotificationPresenter extends NotificationData.Environment,
     */
    void updateNotificationViews();

    /**
     * @return true iff the device is dozing
     */
    boolean isDozing();

    /**
     * Returns the maximum number of notifications to show while locked.
     *
+1 −1
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ public class NotificationIconAreaController implements DarkReceiver {
        }

        // showAmbient == show in shade but not shelf
        if (!showAmbient && notificationData.shouldSuppressScreenOn(entry.key)) {
        if (!showAmbient && notificationData.shouldSuppressStatusBar(entry.key)) {
            return false;
        }

+1 −0
Original line number Diff line number Diff line
@@ -4603,6 +4603,7 @@ public class StatusBar extends SystemUI implements DemoMode,
        if (mAmbientIndicationContainer instanceof DozeReceiver) {
            ((DozeReceiver) mAmbientIndicationContainer).setDozing(mDozing);
        }
        mEntryManager.updateNotifications();
        updateDozingState();
        updateReportRejectedTouchVisibility();
        Trace.endSection();
Loading