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

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

Merge "Includes foreground services in top notification section."

parents df2de643 b0c1a462
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -5937,8 +5937,9 @@ public class Notification implements Parcelable

    /**
     * @return whether this notification is a foreground service notification
     * @hide
     */
    private boolean isForegroundService() {
    public boolean isForegroundService() {
        return (flags & Notification.FLAG_FOREGROUND_SERVICE) != 0;
    }

+1 −4
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
 */
package com.android.systemui.statusbar;

import static android.app.NotificationManager.IMPORTANCE_DEFAULT;
import static android.app.admin.DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED;

import android.app.ActivityManager;
@@ -295,9 +294,7 @@ public class NotificationLockscreenUserManagerImpl implements
        }
        boolean exceedsPriorityThreshold;
        if (NotificationUtils.useNewInterruptionModel(mContext)) {
            exceedsPriorityThreshold =
                    getEntryManager().getNotificationData().getImportance(sbn.getKey())
                            >= IMPORTANCE_DEFAULT;
            exceedsPriorityThreshold = getEntryManager().getNotificationData().isHighPriority(sbn);
        } else {
            exceedsPriorityThreshold =
                    !getEntryManager().getNotificationData().isAmbient(sbn.getKey());
+14 −0
Original line number Diff line number Diff line
@@ -593,6 +593,20 @@ public class NotificationData {
        }
    }

    /**
     * Returns true if this notification should be displayed in the high-priority notifications
     * section (and on the lockscreen and status bar).
     */
    public boolean isHighPriority(StatusBarNotification statusBarNotification) {
        if (mRankingMap != null) {
            getRanking(statusBarNotification.getKey(), mTmpRanking);
            return mTmpRanking.getImportance() >= NotificationManager.IMPORTANCE_DEFAULT
                    || statusBarNotification.getNotification().isForegroundService()
                    || statusBarNotification.getNotification().hasMediaSession();
        }
        return false;
    }

    public boolean isAmbient(String key) {
        if (mRankingMap != null) {
            getRanking(key, mTmpRanking);
+8 −12
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.systemui.statusbar.notification.stack;

import static android.app.NotificationManager.IMPORTANCE_DEFAULT;

import static com.android.systemui.statusbar.notification.ActivityLaunchAnimator
        .ExpandAnimationParameters;
import static com.android.systemui.statusbar.phone.NotificationIconAreaController.LOW_PRIORITY;
@@ -28,7 +26,6 @@ import android.animation.TimeAnimator;
import android.animation.ValueAnimator;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.NotificationManager;
import android.app.WallpaperManager;
import android.content.Context;
import android.content.Intent;
@@ -2315,8 +2312,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
            View child = getChildAt(i);
            if (child.getVisibility() != View.GONE && child instanceof ExpandableNotificationRow) {
                ExpandableNotificationRow row = (ExpandableNotificationRow) child;
                if (mEntryManager.getNotificationData().getImportance(
                        row.getStatusBarNotification().getKey()) < IMPORTANCE_DEFAULT) {
                if (mEntryManager.getNotificationData().isHighPriority(
                        row.getStatusBarNotification())) {
                    break;
                } else {
                    lastChildBeforeGap = row;
@@ -2334,8 +2331,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
            View child = getChildAt(i);
            if (child.getVisibility() != View.GONE && child instanceof ExpandableNotificationRow) {
                ExpandableNotificationRow row = (ExpandableNotificationRow) child;
                if (mEntryManager.getNotificationData().getImportance(
                        row.getStatusBarNotification().getKey()) < IMPORTANCE_DEFAULT) {
                if (!mEntryManager.getNotificationData().isHighPriority(
                        row.getStatusBarNotification())) {
                    return row;
                }
            }
@@ -5218,9 +5215,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
                beforeSpeedBump = !mEntryManager.getNotificationData().isAmbient(
                        row.getStatusBarNotification().getKey());
            } else {
                beforeSpeedBump = mEntryManager.getNotificationData().getImportance(
                        row.getStatusBarNotification().getKey())
                        >= NotificationManager.IMPORTANCE_DEFAULT;
                beforeSpeedBump = mEntryManager.getNotificationData().isHighPriority(
                        row.getStatusBarNotification());
            }
            if (beforeSpeedBump) {
                speedBumpIndex = currentIndex;
@@ -5244,8 +5240,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
                    continue;
                }
                ExpandableNotificationRow row = (ExpandableNotificationRow) view;
                if (mEntryManager.getNotificationData().getImportance(
                        row.getStatusBarNotification().getKey()) < IMPORTANCE_DEFAULT) {
                if (!mEntryManager.getNotificationData().isHighPriority(
                        row.getStatusBarNotification())) {
                    if (currentIndex > 0) {
                        gapIndex = currentIndex;
                    }
+1 −3
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@ package com.android.systemui.statusbar.phone;

import static com.android.systemui.doze.util.BurnInHelperKt.getBurnInOffset;

import android.app.NotificationManager;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
@@ -190,8 +189,7 @@ public class NotificationIconAreaController implements DarkReceiver {
            return false;
        }
        if (!showLowPriority
                && mEntryManager.getNotificationData().getImportance(entry.key)
                < NotificationManager.IMPORTANCE_DEFAULT) {
                && !mEntryManager.getNotificationData().isHighPriority(entry.notification)) {
            return false;
        }
        if (!StatusBar.isTopLevelChild(entry)) {
Loading