From 746b82e831b0f47afd47eb0e07708e6fe921a21f Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Mon, 15 Jun 2020 15:45:56 -0700 Subject: [PATCH] Updated recents oriented state on split screen Launcher defaults to sensor rotation when in split screen instead of the fixed portrait orientation. We were setting the multi window flag but never updating RecentsOrientedState's internal state to reflect it. Fixes: 158537350 Change-Id: Ib0e1cf4c2e0674a5af41ac11c532a50db0a6f0fa --- .../quickstep/LauncherActivityInterface.java | 4 +--- .../android/quickstep/views/RecentsView.java | 21 ++++++++++++------- .../quickstep/util/RecentsOrientedState.java | 2 -- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java index 675172377c..edefbe1252 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java @@ -120,9 +120,7 @@ public final class LauncherActivityInterface extends @Override public AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState, boolean activityVisible, Consumer callback) { - ((RecentsView) getCreatedActivity().getOverviewPanel()) - .setLayoutRotation(deviceState.getCurrentActiveRotation(), - deviceState.getDisplayRotation()); + notifyRecentsOfOrientation(deviceState); DefaultAnimationFactory factory = new DefaultAnimationFactory(callback) { @Override public void setShelfState(ShelfAnimState shelfState, Interpolator interpolator, diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java index 873c672625..a1de1fe684 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java @@ -208,7 +208,7 @@ public abstract class RecentsView extends PagedView impl } }; - protected final RecentsOrientedState mOrientationState; + protected RecentsOrientedState mOrientationState; protected final BaseActivityInterface mSizeStrategy; protected RecentsAnimationController mRecentsAnimationController; protected RecentsAnimationTargets mRecentsAnimationTargets; @@ -371,11 +371,17 @@ public abstract class RecentsView extends PagedView impl private BaseActivity.MultiWindowModeChangedListener mMultiWindowModeChangedListener = (inMultiWindowMode) -> { - if (!inMultiWindowMode && mOverviewStateEnabled) { - // TODO: Re-enable layout transitions for addition of the unpinned task - reloadIfNeeded(); - } - }; + if (mOrientationState != null) { + mOrientationState.setMultiWindowMode(inMultiWindowMode); + setLayoutRotation(mOrientationState.getTouchRotation(), + mOrientationState.getDisplayRotation()); + rotateAllChildTasks(); + } + if (!inMultiWindowMode && mOverviewStateEnabled) { + // TODO: Re-enable layout transitions for addition of the unpinned task + reloadIfNeeded(); + } + }; public RecentsView(Context context, AttributeSet attrs, int defStyleAttr, BaseActivityInterface sizeStrategy) { @@ -840,7 +846,6 @@ public abstract class RecentsView extends PagedView impl private void resetPaddingFromTaskSize() { DeviceProfile dp = mActivity.getDeviceProfile(); - mOrientationState.setMultiWindowMode(dp.isMultiWindowMode); getTaskSize(mTempRect); mTaskWidth = mTempRect.width(); mTaskHeight = mTempRect.height(); @@ -1639,7 +1644,7 @@ public abstract class RecentsView extends PagedView impl : View.LAYOUT_DIRECTION_RTL); mClearAllButton.setRotation(mOrientationHandler.getDegreesRotated()); mActivity.getDragLayer().recreateControllers(); - boolean isInLandscape = touchRotation != 0 + boolean isInLandscape = mOrientationState.getTouchRotation() != 0 || mOrientationState.getLauncherRotation() != ROTATION_0; mActionsView.updateHiddenFlags(HIDDEN_NON_ZERO_ROTATION, !mOrientationState.canLauncherRotate() && isInLandscape); diff --git a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java index 8bd2281c46..7949ce9eca 100644 --- a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java +++ b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java @@ -123,7 +123,6 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre private final ContentResolver mContentResolver; private final SharedPreferences mSharedPrefs; private final OrientationEventListener mOrientationListener; - private final BaseActivityInterface mSizeStrategy; private final Matrix mTmpMatrix = new Matrix(); @@ -140,7 +139,6 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre mContext = context; mContentResolver = context.getContentResolver(); mSharedPrefs = Utilities.getPrefs(context); - mSizeStrategy = sizeStrategy; mOrientationListener = new OrientationEventListener(context) { @Override public void onOrientationChanged(int degrees) {