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

Commit 70cba7bb authored by Mady Mellor's avatar Mady Mellor Committed by Joshua Tsuji
Browse files

Add dumpsys for bubble state

Test: adb shell dumpsys activity service com.android.systemui | grep -A 50 BubbleController
Change-Id: I33dfd315492870cd9a8d446d714be6a2e5fdf6be
parent 860e1c23
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.view.Display.INVALID_DISPLAY;

import static com.android.internal.annotations.VisibleForTesting.Visibility.PRIVATE;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.Notification;
import android.app.PendingIntent;
@@ -39,6 +40,8 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.R;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.List;
import java.util.Objects;

@@ -293,6 +296,16 @@ class Bubble {
        }
    }

    String getDesiredHeightString() {
        Notification.BubbleMetadata data = mEntry.getBubbleMetadata();
        boolean useRes = data.getDesiredHeightResId() != 0;
        if (useRes) {
            return String.valueOf(data.getDesiredHeightResId());
        } else {
            return String.valueOf(data.getDesiredHeight());
        }
    }

    @Nullable
    PendingIntent getBubbleIntent(Context context) {
        Notification notif = mEntry.notification.getNotification();
@@ -404,11 +417,30 @@ class Bubble {
                && mEntry.getBubbleMetadata().isNotificationSuppressed();
    }

    boolean shouldAutoExpand() {
        Notification.BubbleMetadata metadata = mEntry.getBubbleMetadata();
        return metadata != null && metadata.getAutoExpandBubble();
    }

    @Override
    public String toString() {
        return "Bubble{" + mKey + '}';
    }

    /**
     * Description of current bubble state.
     */
    public void dump(
            @NonNull FileDescriptor fd, @NonNull PrintWriter pw, @NonNull String[] args) {
        pw.print("key: "); pw.println(mKey);
        pw.print("  showInShade:   "); pw.println(showInShadeWhenBubble());
        pw.print("  showDot:       "); pw.println(showBubbleDot());
        pw.print("  showFlyout:    "); pw.println(showFlyoutForBubble());
        pw.print("  desiredHeight: "); pw.println(getDesiredHeightString());
        pw.print("  suppressNotif: "); pw.println(shouldSuppressNotification());
        pw.print("  autoExpand:    "); pw.println(shouldAutoExpand());
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
+11 −0
Original line number Diff line number Diff line
@@ -81,6 +81,8 @@ import com.android.systemui.statusbar.phone.StatusBarWindowController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.ZenModeController;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.util.List;
@@ -653,6 +655,15 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
        return mStackView;
    }

    /**
     * Description of current bubble state.
     */
    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.println("BubbleController state:");
        mBubbleData.dump(fd, pw, args);
        pw.println();
    }

    static String formatBubblesString(List<Bubble> bubbles, Bubble selected) {
        StringBuilder sb = new StringBuilder();
        for (Bubble bubble : bubbles) {
+15 −4
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.bubbles.BubbleController.DismissReason;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -179,7 +181,7 @@ public class BubbleData {
            bubble.updateEntry(entry);
            doUpdate(bubble);
        }
        if (shouldAutoExpand(entry)) {
        if (bubble.shouldAutoExpand()) {
            setSelectedBubbleInternal(bubble);
            if (!mExpanded) {
                setExpandedInternal(true);
@@ -591,8 +593,17 @@ public class BubbleData {
        mListener = listener;
    }

    boolean shouldAutoExpand(NotificationEntry entry) {
        Notification.BubbleMetadata metadata = entry.getBubbleMetadata();
        return metadata != null && metadata.getAutoExpandBubble();
    /**
     * Description of current bubble data state.
     */
    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.print("selected: "); pw.println(mSelectedBubble != null
                ? mSelectedBubble.getKey()
                : "null");
        pw.print("expanded: "); pw.println(mExpanded);
        pw.print("count:    "); pw.println(mBubbles.size());
        for (Bubble bubble : mBubbles) {
            bubble.dump(fd, pw, args);
        }
    }
}
 No newline at end of file
+4 −1
Original line number Diff line number Diff line
@@ -80,7 +80,6 @@ import android.metrics.LogMaker;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Debug;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
@@ -2386,6 +2385,10 @@ public class StatusBar extends SystemUI implements DemoMode,
            pw.println("  mGroupManager: null");
        }

        if (mBubbleController != null) {
            mBubbleController.dump(fd, pw, args);
        }

        if (mLightBarController != null) {
            mLightBarController.dump(fd, pw, args);
        }