Reposition the stack to a similar position upon rotation.

Fixes: 128691406
Test: atest SystemUITests
Change-Id: I2d73c88f06d759c2b7b71dc77d008a1e026ee959
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index 0fcc950..af9fd1d 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -34,6 +34,7 @@
 import android.app.Notification;
 import android.content.Context;
 import android.content.pm.ParceledListSlice;
+import android.content.res.Configuration;
 import android.graphics.Rect;
 import android.os.RemoteException;
 import android.os.ServiceManager;
@@ -135,6 +136,9 @@
     // Used for determining view rect for touch interaction
     private Rect mTempRect = new Rect();
 
+    /** Last known orientation, used to detect orientation changes in {@link #onConfigChanged}. */
+    private int mOrientation = Configuration.ORIENTATION_UNDEFINED;
+
     /**
      * Listener to be notified when some states of the bubbles change.
      */
@@ -254,6 +258,14 @@
         }
     }
 
+    @Override
+    public void onConfigChanged(Configuration newConfig) {
+        if (mStackView != null && newConfig != null && newConfig.orientation != mOrientation) {
+            mStackView.onOrientationChanged();
+            mOrientation = newConfig.orientation;
+        }
+    }
+
     /**
      * Set a listener to be notified when some states of the bubbles change.
      */