Disabling seamless rotation in multiwindow mode

Bug: 133765491
Change-Id: If68c709fa5b8216d63fc516f16f03bf2aa83172a
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 711cfd2..ed0b90f 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -490,9 +490,7 @@
             mDeviceProfile = mDeviceProfile.getMultiWindowProfile(this, mwSize);
         }
 
-        if (supportsFakeLandscapeUI()
-                && mDeviceProfile.isVerticalBarLayout()
-                && !mDeviceProfile.isMultiWindowMode) {
+        if (supportsFakeLandscapeUI() && mDeviceProfile.isVerticalBarLayout()) {
             mStableDeviceProfile = mDeviceProfile.inv.portraitProfile;
             mRotationMode = UiFactory.getRotationMode(mDeviceProfile);
         } else {
@@ -500,6 +498,7 @@
             mRotationMode = RotationMode.NORMAL;
         }
 
+        mRotationHelper.updateRotationAnimation();
         onDeviceProfileInitiated();
         mModelWriter = mModel.getWriter(getWallpaperDeviceProfile().isVerticalBarLayout(), true);
     }
diff --git a/src/com/android/launcher3/states/RotationHelper.java b/src/com/android/launcher3/states/RotationHelper.java
index b6c3c35..cd96d6e 100644
--- a/src/com/android/launcher3/states/RotationHelper.java
+++ b/src/com/android/launcher3/states/RotationHelper.java
@@ -94,16 +94,20 @@
 
     public boolean homeScreenCanRotate() {
         return mIgnoreAutoRotateSettings || mAutoRotateEnabled
-                || mStateHandlerRequest != REQUEST_NONE;
+                || mStateHandlerRequest != REQUEST_NONE
+                || mLauncher.getDeviceProfile().isMultiWindowMode;
     }
 
-    private void updateRotationAnimation() {
+    public void updateRotationAnimation() {
         if (FeatureFlags.FAKE_LANDSCAPE_UI.get()) {
             WindowManager.LayoutParams lp = mLauncher.getWindow().getAttributes();
+            int oldAnim = lp.rotationAnimation;
             lp.rotationAnimation = homeScreenCanRotate()
                     ? WindowManager.LayoutParams.ROTATION_ANIMATION_ROTATE
                     : WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS;
-            mLauncher.getWindow().setAttributes(lp);
+            if (oldAnim != lp.rotationAnimation) {
+                mLauncher.getWindow().setAttributes(lp);
+            }
         }
     }
 
@@ -123,6 +127,7 @@
     public void setStateHandlerRequest(int request) {
         if (mStateHandlerRequest != request) {
             mStateHandlerRequest = request;
+            updateRotationAnimation();
             notifyChange();
         }
     }