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

Commit ea423a17 authored by Mady Mellor's avatar Mady Mellor
Browse files

Add some protologs around switching between bubble UI modes

Also add a dump method on BubblePositioner to include info
from its state that is most relevant for debugging.

Removes unused rotation value.

Flag: EXEMPT - adding protologs
Test: treehugger
Bug: 427284677
Bug: 427611342
Change-Id: I97765f88f596e3a41484feafb57683a7e391189e
parent f3299957
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -710,6 +710,7 @@ public class BubbleController implements ConfigurationChangeListener,
    @VisibleForTesting
    public void setLauncherHasBubbleBar(boolean launcherHasBubbleBar) {
        if (launcherHasBubbleBar == mLauncherHasBubbleBar) return;
        ProtoLog.d(WM_SHELL_BUBBLES, "setLauncherHasBubbleBar=%b", launcherHasBubbleBar);
        mLauncherHasBubbleBar = launcherHasBubbleBar;
        if (mLauncherHasBubbleBar) {
            setUpBubbleViewsForMode();
@@ -2962,7 +2963,6 @@ public class BubbleController implements ConfigurationChangeListener,
        pw.print(prefix); pw.println("  bubbleStateListenerSet= " + (mBubbleStateListener != null));
        pw.print(prefix); pw.println("  stackViewSet= " + (mStackView != null));
        pw.print(prefix); pw.println("  layerViewSet= " + (mLayerView != null));
        pw.print(prefix); pw.println("  isImeVisible= " + mBubblePositioner.isImeVisible());
        pw.println();

        mBubbleData.dump(pw);
@@ -2974,9 +2974,11 @@ public class BubbleController implements ConfigurationChangeListener,
        pw.println();

        mImpl.mCachedState.dump(pw);

        pw.println();

        mBubbleTransitions.mTaskViewTransitions.dump(pw);

        mBubblePositioner.dump(pw);
    }

    /**
+22 −7
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import android.graphics.Insets;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.RectF;
import android.view.Surface;
import android.view.WindowManager;

import androidx.annotation.NonNull;
@@ -38,6 +37,8 @@ import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
import com.android.wm.shell.shared.bubbles.BubbleDropTargetBoundsProvider;
import com.android.wm.shell.shared.bubbles.DeviceConfig;

import java.io.PrintWriter;

/**
 * Keeps track of display size, configuration, and specific bubble sizes. One place for all
 * placement and positioning calculations to refer to.
@@ -68,7 +69,6 @@ public class BubblePositioner implements BubbleDropTargetBoundsProvider {
    private Context mContext;
    private DeviceConfig mDeviceConfig;
    private Rect mScreenRect;
    private @Surface.Rotation int mRotation = Surface.ROTATION_0;
    private Insets mInsets;
    private boolean mImeVisible;
    /**
@@ -132,12 +132,12 @@ public class BubblePositioner implements BubbleDropTargetBoundsProvider {
    public void update(DeviceConfig deviceConfig) {
        mDeviceConfig = deviceConfig;
        ProtoLog.d(WM_SHELL_BUBBLES, "update positioner: "
                        + "rotation=%d insets=%s largeScreen=%b "
                        + "insets=%s largeScreen=%b "
                        + "smallTablet=%b isBubbleBar=%b bounds=%s",
                mRotation, deviceConfig.getInsets(), deviceConfig.isLargeScreen(),
                deviceConfig.getInsets(), deviceConfig.isLargeScreen(),
                deviceConfig.isSmallTablet(), mShowingInBubbleBar,
                deviceConfig.getWindowBounds());
        updateInternal(mRotation, deviceConfig.getInsets(), deviceConfig.getWindowBounds());
        updateInternal(deviceConfig.getInsets(), deviceConfig.getWindowBounds());
    }

    /** Returns the device config being used. */
@@ -146,7 +146,7 @@ public class BubblePositioner implements BubbleDropTargetBoundsProvider {
    }

    @VisibleForTesting
    public void updateInternal(int rotation, Insets insets, Rect bounds) {
    public void updateInternal(Insets insets, Rect bounds) {
        BubbleStackView.RelativeStackPosition prevStackPosition = null;
        if (mRestingStackPosition != null && mScreenRect != null && !mScreenRect.equals(bounds)) {
            // Save the resting position as a relative position with the previous bounds, at the
@@ -154,7 +154,6 @@ public class BubblePositioner implements BubbleDropTargetBoundsProvider {
            prevStackPosition = new BubbleStackView.RelativeStackPosition(getRestingPosition(),
                    getAllowableStackPositionRegion(1));
        }
        mRotation = rotation;
        mInsets = insets;

        mScreenRect = new Rect(bounds);
@@ -1045,4 +1044,20 @@ public class BubblePositioner implements BubbleDropTargetBoundsProvider {
        }
        return bounds;
    }

    /** Description of current positioner state. */
    void dump(PrintWriter pw) {
        pw.println("BubblePositioner state:");
        pw.println("  mScreenRect= " + mScreenRect);
        pw.println("  mPositionRect= " + mPositionRect);
        pw.println("  mInsets= " + mInsets);
        pw.println("  mImeVisible= " + mImeVisible);
        pw.println("  mImeHeight= " + mImeHeight);
        pw.println("  mMaxBubbles= " + mMaxBubbles);
        pw.println("  mRestingStackPosition= " + mRestingStackPosition);
        pw.println("  mShowingInBubbleBar= " + mShowingInBubbleBar);
        pw.println("  mBubbleBarLocation= " + mBubbleBarLocation);
        pw.println("  mBubbleBarTopOnScreen= " + mBubbleBarTopOnScreen);
        pw.println();
    }
}
+1 −3
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.wm.shell.bubbles;

import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Insets;
import android.graphics.Rect;
import android.view.WindowManager;
@@ -31,8 +30,7 @@ public class TestableBubblePositioner extends BubblePositioner {
            WindowManager windowManager) {
        super(context, windowManager);

        updateInternal(Configuration.ORIENTATION_PORTRAIT,
                Insets.of(0, 0, 0, 0),
        updateInternal(Insets.of(0, 0, 0, 0),
                new Rect(0, 0, 500, 1000));
        mMaxBubbles = context.getResources().getInteger(R.integer.bubbles_max_rendered);
    }
+1 −3
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Insets;
import android.graphics.PointF;
@@ -67,8 +66,7 @@ public class ExpandedAnimationControllerTest extends PhysicsAnimationLayoutTestC

        mPositioner = new BubblePositioner(getContext(),
                getContext().getSystemService(WindowManager.class));
        mPositioner.updateInternal(Configuration.ORIENTATION_PORTRAIT,
                Insets.of(0, 0, 0, 0),
        mPositioner.updateInternal(Insets.of(0, 0, 0, 0),
                new Rect(0, 0, 500, 1000));

        BubbleStackView stackView = mock(BubbleStackView.class);
+1 −3
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.systemui.wmshell;

import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Insets;
import android.graphics.Rect;
import android.view.WindowManager;
@@ -33,8 +32,7 @@ public class TestableBubblePositioner extends BubblePositioner {
            WindowManager windowManager) {
        super(context, windowManager);

        updateInternal(Configuration.ORIENTATION_PORTRAIT,
                Insets.of(0, 0, 0, 0),
        updateInternal(Insets.of(0, 0, 0, 0),
                new Rect(0, 0, 500, 1000));
        mMaxBubbles = context.getResources().getInteger(R.integer.bubbles_max_rendered);
    }