Merge "Fixed bubble badge position on stack move." into main
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BadgedImageView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BadgedImageView.java
index 0297901..f9a1d94 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BadgedImageView.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BadgedImageView.java
@@ -82,8 +82,8 @@
 
     private BubbleViewProvider mBubble;
     private BubblePositioner mPositioner;
-    private boolean mOnLeft;
-
+    private boolean mBadgeOnLeft;
+    private boolean mDotOnLeft;
     private DotRenderer mDotRenderer;
     private DotRenderer.DrawParams mDrawParams;
     private int mDotColor;
@@ -153,7 +153,8 @@
 
     public void hideDotAndBadge(boolean onLeft) {
         addDotSuppressionFlag(BadgedImageView.SuppressionFlag.BEHIND_STACK);
-        mOnLeft = onLeft;
+        mBadgeOnLeft = onLeft;
+        mDotOnLeft = onLeft;
         hideBadge();
     }
 
@@ -185,7 +186,7 @@
 
         mDrawParams.dotColor = mDotColor;
         mDrawParams.iconBounds = mTempBounds;
-        mDrawParams.leftAlign = mOnLeft;
+        mDrawParams.leftAlign = mDotOnLeft;
         mDrawParams.scale = mDotScale;
 
         mDotRenderer.draw(canvas, mDrawParams);
@@ -255,7 +256,7 @@
      * Whether decorations (badges or dots) are on the left.
      */
     boolean getDotOnLeft() {
-        return mOnLeft;
+        return mDotOnLeft;
     }
 
     /**
@@ -263,7 +264,7 @@
      */
     float[] getDotCenter() {
         float[] dotPosition;
-        if (mOnLeft) {
+        if (mDotOnLeft) {
             dotPosition = mDotRenderer.getLeftDotPosition();
         } else {
             dotPosition = mDotRenderer.getRightDotPosition();
@@ -291,22 +292,23 @@
         if (onLeft != getDotOnLeft()) {
             if (shouldDrawDot()) {
                 animateDotScale(0f /* showDot */, () -> {
-                    mOnLeft = onLeft;
+                    mDotOnLeft = onLeft;
                     invalidate();
                     animateDotScale(1.0f, null /* after */);
                 });
             } else {
-                mOnLeft = onLeft;
+                mDotOnLeft = onLeft;
             }
         }
+        mBadgeOnLeft = onLeft;
         // TODO animate badge
         showBadge();
-
     }
 
     /** Sets the position of the dot and badge. */
     void setDotBadgeOnLeft(boolean onLeft) {
-        mOnLeft = onLeft;
+        mBadgeOnLeft = onLeft;
+        mDotOnLeft = onLeft;
         invalidate();
         showBadge();
     }
@@ -361,7 +363,7 @@
         }
 
         int translationX;
-        if (mOnLeft) {
+        if (mBadgeOnLeft) {
             translationX = -(mBubble.getBubbleIcon().getWidth() - appBadgeBitmap.getWidth());
         } else {
             translationX = 0;