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

Commit 6cec3506 authored by Mady Mellor's avatar Mady Mellor
Browse files

Remove the isForeground check for auto expand / suppress since NoMan handles it now

- Just pass false to logger, we won't use the value

Test: atest BubbleControllerTest
Bug: 135488406
Change-Id: I72f242586fd590144bdf8299268224c63fb9247d
parent 17bdcefe
Loading
Loading
Loading
Loading
+1 −15
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.SOURCE;

import android.app.ActivityManager;
import android.app.ActivityManager.RunningTaskInfo;
import android.app.NotificationManager;
import android.app.PendingIntent;
@@ -684,8 +683,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi

    private void updateShowInShadeForSuppressNotification(NotificationEntry entry) {
        boolean suppressNotification = entry.getBubbleMetadata() != null
                && entry.getBubbleMetadata().isNotificationSuppressed()
                && isForegroundApp(mContext, entry.notification.getPackageName());
                && entry.getBubbleMetadata().isNotificationSuppressed();
        Bubble b = mBubbleData.getBubbleWithKey(entry.key);
        if (b != null && mBubbleData.getSelectedBubble() == b && mBubbleData.isExpanded()) {
            // If we're expanded & selected don't show in shade
@@ -711,18 +709,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
        return sb.toString();
    }

    /**
     * Return true if the applications with the package name is running in foreground.
     *
     * @param context application context.
     * @param pkgName application package name.
     */
    public static boolean isForegroundApp(Context context, String pkgName) {
        ActivityManager am = context.getSystemService(ActivityManager.class);
        List<RunningTaskInfo> tasks = am.getRunningTasks(1 /* maxNum */);
        return !tasks.isEmpty() && pkgName.equals(tasks.get(0).topActivity.getPackageName());
    }

    /**
     * This task stack listener is responsible for responding to tasks moved to the front
     * which are on the default (main) display. When this happens, expanded bubbles must be
+1 −2
Original line number Diff line number Diff line
@@ -591,7 +591,6 @@ public class BubbleData {

    boolean shouldAutoExpand(NotificationEntry entry) {
        Notification.BubbleMetadata metadata = entry.getBubbleMetadata();
        return metadata != null && metadata.getAutoExpandBubble()
                && BubbleController.isForegroundApp(mContext, entry.notification.getPackageName());
        return metadata != null && metadata.getAutoExpandBubble();
    }
}
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -533,7 +533,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
                mStackView.getNormalizedYPosition(),
                entry.showInShadeWhenBubble(),
                entry.isForegroundService(),
                BubbleController.isForegroundApp(mContext, notification.getPackageName()));
                false /* isAppForeground (unused) */);
    }

    private int getDimenForPackageUser(int resId, String pkg, int userId) {
+2 −2
Original line number Diff line number Diff line
@@ -1625,7 +1625,7 @@ public class BubbleStackView extends FrameLayout {
                    getNormalizedYPosition(),
                    false /* unread bubble */,
                    false /* on-going bubble */,
                    false /* foreground bubble */);
                    false /* isAppForeground (unused) */);
        } else {
            StatusBarNotification notification = bubble.entry.notification;
            StatsLog.write(StatsLog.BUBBLE_UI_CHANGED,
@@ -1639,7 +1639,7 @@ public class BubbleStackView extends FrameLayout {
                    getNormalizedYPosition(),
                    bubble.entry.showInShadeWhenBubble(),
                    bubble.entry.isForegroundService(),
                    BubbleController.isForegroundApp(mContext, notification.getPackageName()));
                    false /* isAppForeground (unused) */);
        }
    }