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

Commit fea416b8 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge changes I63c90f71,I0f016aab into tm-qpr-dev

* changes:
  Minor cleanup
  Pipe user changed events to the Shell
parents 69dbf9ff c7d7122d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -821,7 +821,7 @@ public class Bubble implements BubbleViewProvider {
    /**
     * Description of current bubble state.
     */
    public void dump(@NonNull PrintWriter pw, @NonNull String[] args) {
    public void dump(@NonNull PrintWriter pw) {
        pw.print("key: "); pw.println(mKey);
        pw.print("  showInShade:   "); pw.println(showInShade());
        pw.print("  showDot:       "); pw.println(showDot());
@@ -831,7 +831,7 @@ public class Bubble implements BubbleViewProvider {
        pw.print("  suppressNotif: "); pw.println(shouldSuppressNotification());
        pw.print("  autoExpand:    "); pw.println(shouldAutoExpand());
        if (mExpandedView != null) {
            mExpandedView.dump(pw, args);
            mExpandedView.dump(pw);
        }
    }

+9 −48
Original line number Diff line number Diff line
@@ -72,7 +72,6 @@ import android.service.notification.NotificationListenerService;
import android.service.notification.NotificationListenerService.RankingMap;
import android.util.Log;
import android.util.Pair;
import android.util.Slog;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
@@ -100,6 +99,7 @@ import com.android.wm.shell.onehanded.OneHandedController;
import com.android.wm.shell.onehanded.OneHandedTransitionCallback;
import com.android.wm.shell.pip.PinnedStackListenerForwarder;
import com.android.wm.shell.sysui.ConfigurationChangeListener;
import com.android.wm.shell.sysui.ShellCommandHandler;
import com.android.wm.shell.sysui.ShellController;
import com.android.wm.shell.sysui.ShellInit;

@@ -159,6 +159,7 @@ public class BubbleController implements ConfigurationChangeListener {
    private final TaskViewTransitions mTaskViewTransitions;
    private final SyncTransactionQueue mSyncQueue;
    private final ShellController mShellController;
    private final ShellCommandHandler mShellCommandHandler;

    // Used to post to main UI thread
    private final ShellExecutor mMainExecutor;
@@ -229,6 +230,7 @@ public class BubbleController implements ConfigurationChangeListener {
  
    public BubbleController(Context context,
            ShellInit shellInit,
            ShellCommandHandler shellCommandHandler,
            ShellController shellController,
            BubbleData data,
            @Nullable BubbleStackView.SurfaceSynchronizer synchronizer,
@@ -252,6 +254,7 @@ public class BubbleController implements ConfigurationChangeListener {
            TaskViewTransitions taskViewTransitions,
            SyncTransactionQueue syncQueue) {
        mContext = context;
        mShellCommandHandler = shellCommandHandler;
        mShellController = shellController;
        mLauncherApps = launcherApps;
        mBarService = statusBarService == null
@@ -431,6 +434,7 @@ public class BubbleController implements ConfigurationChangeListener {
        mCurrentProfiles = userProfiles;

        mShellController.addConfigurationChangeListener(this);
        mShellCommandHandler.addDumpCallback(this::dump, this);
    }

    @VisibleForTesting
@@ -924,15 +928,6 @@ public class BubbleController implements ConfigurationChangeListener {
        return (isSummary && isSuppressedSummary) || isSuppressedBubble;
    }

    private void removeSuppressedSummaryIfNecessary(String groupKey, Consumer<String> callback) {
        if (mBubbleData.isSummarySuppressed(groupKey)) {
            mBubbleData.removeSuppressedSummary(groupKey);
            if (callback != null) {
                callback.accept(mBubbleData.getSummaryKey(groupKey));
            }
        }
    }

    /** Promote the provided bubble from the overflow view. */
    public void promoteBubbleFromOverflow(Bubble bubble) {
        mLogger.log(bubble, BubbleLogger.Event.BUBBLE_OVERFLOW_REMOVE_BACK_TO_STACK);
@@ -1518,14 +1513,15 @@ public class BubbleController implements ConfigurationChangeListener {
    /**
     * Description of current bubble state.
     */
    private void dump(PrintWriter pw, String[] args) {
    private void dump(PrintWriter pw, String prefix) {
        pw.println("BubbleController state:");
        mBubbleData.dump(pw, args);
        mBubbleData.dump(pw);
        pw.println();
        if (mStackView != null) {
            mStackView.dump(pw, args);
            mStackView.dump(pw);
        }
        pw.println();
        mImpl.mCachedState.dump(pw);
    }

    /**
@@ -1709,28 +1705,12 @@ public class BubbleController implements ConfigurationChangeListener {
            return mCachedState.isBubbleExpanded(key);
        }

        @Override
        public boolean isStackExpanded() {
            return mCachedState.isStackExpanded();
        }

        @Override
        @Nullable
        public Bubble getBubbleWithShortcutId(String shortcutId) {
            return mCachedState.getBubbleWithShortcutId(shortcutId);
        }

        @Override
        public void removeSuppressedSummaryIfNecessary(String groupKey, Consumer<String> callback,
                Executor callbackExecutor) {
            mMainExecutor.execute(() -> {
                Consumer<String> cb = callback != null
                        ? (key) -> callbackExecutor.execute(() -> callback.accept(key))
                        : null;
                BubbleController.this.removeSuppressedSummaryIfNecessary(groupKey, cb);
            });
        }

        @Override
        public void collapseStack() {
            mMainExecutor.execute(() -> {
@@ -1759,13 +1739,6 @@ public class BubbleController implements ConfigurationChangeListener {
            });
        }

        @Override
        public void openBubbleOverflow() {
            mMainExecutor.execute(() -> {
                BubbleController.this.openBubbleOverflow();
            });
        }

        @Override
        public boolean handleDismissalInterception(BubbleEntry entry,
                @Nullable List<BubbleEntry> children, IntConsumer removeCallback,
@@ -1881,18 +1854,6 @@ public class BubbleController implements ConfigurationChangeListener {
            mMainExecutor.execute(
                    () -> BubbleController.this.onNotificationPanelExpandedChanged(expanded));
        }

        @Override
        public void dump(PrintWriter pw, String[] args) {
            try {
                mMainExecutor.executeBlocking(() -> {
                    BubbleController.this.dump(pw, args);
                    mCachedState.dump(pw);
                });
            } catch (InterruptedException e) {
                Slog.e(TAG, "Failed to dump BubbleController in 2s");
            }
        }
    }

    /**
+3 −3
Original line number Diff line number Diff line
@@ -1136,7 +1136,7 @@ public class BubbleData {
    /**
     * Description of current bubble data state.
     */
    public void dump(PrintWriter pw, String[] args) {
    public void dump(PrintWriter pw) {
        pw.print("selected: ");
        pw.println(mSelectedBubble != null
                ? mSelectedBubble.getKey()
@@ -1147,13 +1147,13 @@ public class BubbleData {
        pw.print("stack bubble count:    ");
        pw.println(mBubbles.size());
        for (Bubble bubble : mBubbles) {
            bubble.dump(pw, args);
            bubble.dump(pw);
        }

        pw.print("overflow bubble count:    ");
        pw.println(mOverflowBubbles.size());
        for (Bubble bubble : mOverflowBubbles) {
            bubble.dump(pw, args);
            bubble.dump(pw);
        }

        pw.print("summaryKeys: ");
+1 −1
Original line number Diff line number Diff line
@@ -1044,7 +1044,7 @@ public class BubbleExpandedView extends LinearLayout {
    /**
     * Description of current expanded view state.
     */
    public void dump(@NonNull PrintWriter pw, @NonNull String[] args) {
    public void dump(@NonNull PrintWriter pw) {
        pw.print("BubbleExpandedView");
        pw.print("  taskId:               "); pw.println(mTaskId);
        pw.print("  stackView:            "); pw.println(mStackView);
+3 −3
Original line number Diff line number Diff line
@@ -299,7 +299,7 @@ public class BubbleStackView extends FrameLayout
    private BubblesNavBarGestureTracker mBubblesNavBarGestureTracker;

    /** Description of current animation controller state. */
    public void dump(PrintWriter pw, String[] args) {
    public void dump(PrintWriter pw) {
        pw.println("Stack view state:");

        String bubblesOnScreen = BubbleDebugConfig.formatBubblesString(
@@ -313,8 +313,8 @@ public class BubbleStackView extends FrameLayout
        pw.print("  expandedContainerMatrix: ");
        pw.println(mExpandedViewContainer.getAnimationMatrix());

        mStackAnimationController.dump(pw, args);
        mExpandedAnimationController.dump(pw, args);
        mStackAnimationController.dump(pw);
        mExpandedAnimationController.dump(pw);

        if (mExpandedBubble != null) {
            pw.println("Expanded bubble state:");
Loading