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

Commit 75706333 authored by Tony Huang's avatar Tony Huang Committed by Android (Google) Code Review
Browse files

Merge "Migrate Bubbles to wm-shell (4/n)"

parents 68de0a94 e23aad51
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ import com.android.settingslib.bluetooth.LocalBluetoothManager;
import com.android.systemui.appops.AppOpsController;
import com.android.systemui.assist.AssistManager;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.bubbles.Bubbles;
import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Background;
@@ -308,7 +307,6 @@ public class Dependency {
    @Inject Lazy<KeyguardDismissUtil> mKeyguardDismissUtil;
    @Inject Lazy<SmartReplyController> mSmartReplyController;
    @Inject Lazy<RemoteInputQuickSettingsDisabler> mRemoteInputQuickSettingsDisabler;
    @Inject Lazy<Bubbles> mBubbles;
    @Inject Lazy<NotificationEntryManager> mNotificationEntryManager;
    @Inject Lazy<SensorPrivacyManager> mSensorPrivacyManager;
    @Inject Lazy<AutoHideController> mAutoHideController;
@@ -506,7 +504,6 @@ public class Dependency {
        mProviders.put(SmartReplyController.class, mSmartReplyController::get);
        mProviders.put(RemoteInputQuickSettingsDisabler.class,
                mRemoteInputQuickSettingsDisabler::get);
        mProviders.put(Bubbles.class, mBubbles::get);
        mProviders.put(NotificationEntryManager.class, mNotificationEntryManager::get);
        mProviders.put(ForegroundServiceNotificationListener.class,
                mForegroundServiceNotificationListener::get);
+12 −6
Original line number Diff line number Diff line
@@ -53,7 +53,8 @@ import java.util.Objects;
/**
 * Encapsulates the data and UI elements of a bubble.
 */
class Bubble implements BubbleViewProvider {
@VisibleForTesting
public class Bubble implements BubbleViewProvider {
    private static final String TAG = "Bubble";

    private final String mKey;
@@ -62,7 +63,7 @@ class Bubble implements BubbleViewProvider {
    private long mLastAccessed;

    @Nullable
    private BubbleController.NotificationSuppressionChangedListener mSuppressionListener;
    private Bubbles.NotificationSuppressionChangedListener mSuppressionListener;

    /** Whether the bubble should show a dot for the notification indicating updated content. */
    private boolean mShowBubbleUpdateDot = true;
@@ -173,8 +174,8 @@ class Bubble implements BubbleViewProvider {

    @VisibleForTesting(visibility = PRIVATE)
    Bubble(@NonNull final BubbleEntry entry,
            @Nullable final BubbleController.NotificationSuppressionChangedListener listener,
            final BubbleController.PendingIntentCanceledListener intentCancelListener) {
            @Nullable final Bubbles.NotificationSuppressionChangedListener listener,
            final Bubbles.PendingIntentCanceledListener intentCancelListener) {
        mKey = entry.getKey();
        mSuppressionListener = listener;
        mIntentCancelListener = intent -> {
@@ -309,11 +310,13 @@ class Bubble implements BubbleViewProvider {
     *
     * @param callback the callback to notify one the bubble is ready to be displayed.
     * @param context the context for the bubble.
     * @param controller
     * @param stackView the stackView the bubble is eventually added to.
     * @param iconFactory the iconfactory use to create badged images for the bubble.
     */
    void inflate(BubbleViewInfoTask.Callback callback,
            Context context,
            BubbleController controller,
            BubbleStackView stackView,
            BubbleIconFactory iconFactory,
            boolean skipInflation) {
@@ -322,6 +325,7 @@ class Bubble implements BubbleViewProvider {
        }
        mInflationTask = new BubbleViewInfoTask(this,
                context,
                controller,
                stackView,
                iconFactory,
                skipInflation,
@@ -522,7 +526,8 @@ class Bubble implements BubbleViewProvider {
    /**
     * Sets whether this notification should be suppressed in the shade.
     */
    void setSuppressNotification(boolean suppressNotification) {
    @VisibleForTesting
    public void setSuppressNotification(boolean suppressNotification) {
        boolean prevShowInShade = showInShade();
        if (suppressNotification) {
            mFlags |= Notification.BubbleMetadata.FLAG_SUPPRESS_NOTIFICATION;
@@ -559,7 +564,8 @@ class Bubble implements BubbleViewProvider {
    /**
     * Whether the flyout for the bubble should be shown.
     */
    boolean showFlyout() {
    @VisibleForTesting
    public boolean showFlyout() {
        return !mSuppressFlyout && !mShouldSuppressPeek
                && !shouldSuppressNotification()
                && !mShouldSuppressNotificationList;
+202 −774

File changed.

Preview size limit exceeded, changes collapsed.

+22 −21
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ import androidx.annotation.Nullable;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.FrameworkStatsLog;
import com.android.systemui.R;
import com.android.systemui.bubbles.BubbleController.DismissReason;
import com.android.systemui.bubbles.Bubbles.DismissReason;

import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -137,8 +137,8 @@ public class BubbleData {
    private Listener mListener;

    @Nullable
    private BubbleController.NotificationSuppressionChangedListener mSuppressionListener;
    private BubbleController.PendingIntentCanceledListener mCancelledListener;
    private Bubbles.NotificationSuppressionChangedListener mSuppressionListener;
    private Bubbles.PendingIntentCanceledListener mCancelledListener;

    /**
     * We track groups with summaries that aren't visibly displayed but still kept around because
@@ -165,12 +165,12 @@ public class BubbleData {
    }

    public void setSuppressionChangedListener(
            BubbleController.NotificationSuppressionChangedListener listener) {
            Bubbles.NotificationSuppressionChangedListener listener) {
        mSuppressionListener = listener;
    }

    public void setPendingIntentCancelledListener(
            BubbleController.PendingIntentCanceledListener listener) {
            Bubbles.PendingIntentCanceledListener listener) {
        mCancelledListener = listener;
    }

@@ -344,7 +344,8 @@ public class BubbleData {
    /**
     * Whether the summary for the provided group key is suppressed.
     */
    boolean isSummarySuppressed(String groupKey) {
    @VisibleForTesting
    public boolean isSummarySuppressed(String groupKey) {
        return mSuppressedGroupKeys.containsKey(groupKey);
    }

@@ -415,7 +416,7 @@ public class BubbleData {
                    // skip the selected bubble
                    .filter((b) -> !b.equals(mSelectedBubble))
                    .findFirst()
                    .ifPresent((b) -> doRemove(b.getKey(), BubbleController.DISMISS_AGED));
                    .ifPresent((b) -> doRemove(b.getKey(), Bubbles.DISMISS_AGED));
        }
    }

@@ -459,12 +460,12 @@ public class BubbleData {
        int indexToRemove = indexForKey(key);
        if (indexToRemove == -1) {
            if (hasOverflowBubbleWithKey(key)
                && (reason == BubbleController.DISMISS_NOTIF_CANCEL
                    || reason == BubbleController.DISMISS_GROUP_CANCELLED
                    || reason == BubbleController.DISMISS_NO_LONGER_BUBBLE
                    || reason == BubbleController.DISMISS_BLOCKED
                    || reason == BubbleController.DISMISS_SHORTCUT_REMOVED
                    || reason == BubbleController.DISMISS_PACKAGE_REMOVED)) {
                    && (reason == Bubbles.DISMISS_NOTIF_CANCEL
                        || reason == Bubbles.DISMISS_GROUP_CANCELLED
                        || reason == Bubbles.DISMISS_NO_LONGER_BUBBLE
                        || reason == Bubbles.DISMISS_BLOCKED
                        || reason == Bubbles.DISMISS_SHORTCUT_REMOVED
                        || reason == Bubbles.DISMISS_PACKAGE_REMOVED)) {

                Bubble b = getOverflowBubbleWithKey(key);
                if (DEBUG_BUBBLE_DATA) {
@@ -512,8 +513,8 @@ public class BubbleData {

    void overflowBubble(@DismissReason int reason, Bubble bubble) {
        if (bubble.getPendingIntentCanceled()
                || !(reason == BubbleController.DISMISS_AGED
                || reason == BubbleController.DISMISS_USER_GESTURE)) {
                || !(reason == Bubbles.DISMISS_AGED
                || reason == Bubbles.DISMISS_USER_GESTURE)) {
            return;
        }
        if (DEBUG_BUBBLE_DATA) {
@@ -529,7 +530,7 @@ public class BubbleData {
            if (DEBUG_BUBBLE_DATA) {
                Log.d(TAG, "Overflow full. Remove: " + oldest);
            }
            mStateChange.bubbleRemoved(oldest, BubbleController.DISMISS_OVERFLOW_MAX_REACHED);
            mStateChange.bubbleRemoved(oldest, Bubbles.DISMISS_OVERFLOW_MAX_REACHED);
            mLogger.log(bubble, BubbleLogger.Event.BUBBLE_OVERFLOW_REMOVE_MAX_REACHED);
            mOverflowBubbles.remove(oldest);
            mStateChange.removedOverflowBubble = oldest;
@@ -694,7 +695,7 @@ public class BubbleData {
    }

    private void maybeSendDeleteIntent(@DismissReason int reason, @NonNull final Bubble bubble) {
        if (reason != BubbleController.DISMISS_USER_GESTURE) return;
        if (reason != Bubbles.DISMISS_USER_GESTURE) return;
        PendingIntent deleteIntent = bubble.getDeleteIntent();
        if (deleteIntent == null) return;
        try {
@@ -726,7 +727,7 @@ public class BubbleData {
     * The set of bubbles in overflow.
     */
    @VisibleForTesting(visibility = PRIVATE)
    List<Bubble> getOverflowBubbles() {
    public List<Bubble> getOverflowBubbles() {
        return Collections.unmodifiableList(mOverflowBubbles);
    }

@@ -742,7 +743,7 @@ public class BubbleData {

    @VisibleForTesting(visibility = PRIVATE)
    @Nullable
    Bubble getBubbleInStackWithKey(String key) {
    public Bubble getBubbleInStackWithKey(String key) {
        for (int i = 0; i < mBubbles.size(); i++) {
            Bubble bubble = mBubbles.get(i);
            if (bubble.getKey().equals(key)) {
@@ -764,7 +765,7 @@ public class BubbleData {
    }

    @VisibleForTesting(visibility = PRIVATE)
    Bubble getOverflowBubbleWithKey(String key) {
    public Bubble getOverflowBubbleWithKey(String key) {
        for (int i = 0; i < mOverflowBubbles.size(); i++) {
            Bubble bubble = mOverflowBubbles.get(i);
            if (bubble.getKey().equals(key)) {
@@ -788,7 +789,7 @@ public class BubbleData {
     * This method should only be used in tests, not in production.
     */
    @VisibleForTesting
    void setMaxOverflowBubbles(int maxOverflowBubbles) {
    public void setMaxOverflowBubbles(int maxOverflowBubbles) {
        mMaxOverflowBubbles = maxOverflowBubbles;
    }

+2 −2
Original line number Diff line number Diff line
@@ -33,10 +33,10 @@ public class BubbleDebugConfig {
    // to figure-out the origin of a log message while debugging the Bubbles a little painful. By
    // setting this constant to true, log messages from the Bubbles package will be tagged with
    // their class names instead fot the generic tag.
    static final boolean TAG_WITH_CLASS_NAME = false;
    public static final boolean TAG_WITH_CLASS_NAME = false;

    // Default log tag for the Bubbles package.
    static final String TAG_BUBBLES = "Bubbles";
    public static final String TAG_BUBBLES = "Bubbles";

    static final boolean DEBUG_BUBBLE_CONTROLLER = false;
    static final boolean DEBUG_BUBBLE_DATA = false;
Loading