From da14cf8b9febb39b42545d4fe3c3cbda0b9cc156 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 30 May 2019 10:31:09 -0700 Subject: [PATCH] Disabling seamless rotation in multiwindow mode Bug: 133765491 Change-Id: If68c709fa5b8216d63fc516f16f03bf2aa83172a --- src/com/android/launcher3/Launcher.java | 5 ++--- src/com/android/launcher3/states/RotationHelper.java | 11 ++++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 711cfd2885..ed0b90fcce 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -490,9 +490,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, 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 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, 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 b6c3c35b89..cd96d6ed84 100644 --- a/src/com/android/launcher3/states/RotationHelper.java +++ b/src/com/android/launcher3/states/RotationHelper.java @@ -94,16 +94,20 @@ public class RotationHelper implements OnSharedPreferenceChangeListener { 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 class RotationHelper implements OnSharedPreferenceChangeListener { public void setStateHandlerRequest(int request) { if (mStateHandlerRequest != request) { mStateHandlerRequest = request; + updateRotationAnimation(); notifyChange(); } }