diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2020-07-08 05:11:49 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-07-08 05:11:49 +0000 |
commit | 109825547f1ceb83aa3257b5116c70dc883bbc03 (patch) | |
tree | 395ebb30d230eea38c52d05f2a2337c5e2d26dbd | |
parent | 3797bf8db64c2fb71465b577e838160bf82697a2 (diff) | |
parent | 52f2392405266b2038de520331dc7bddeacf0d52 (diff) | |
download | Launcher3-109825547f1ceb83aa3257b5116c70dc883bbc03.tar.gz |
Fixing recents orientation (when home rotation is allowed) during swipe-up am: 52f2392405
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12102312
Change-Id: Ib57a41296b92d13eaa9b43f03db9eb37b11d17ad
3 files changed, 19 insertions, 18 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java index 46013d3f2b..c9ed498af1 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java @@ -103,6 +103,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { mSizeStrategy = sizeStrategy; mOrientationState = new RecentsOrientedState(context, sizeStrategy, i -> { }); + mOrientationState.setGestureActive(true); mCurrentFullscreenParams = new FullscreenDrawParams(context); mPageSpacing = context.getResources().getDimensionPixelSize(R.dimen.recents_page_spacing); 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 68b89758ef..7b24b03f2b 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 @@ -1003,7 +1003,9 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView mDwbToastShown = false; mActivity.getSystemUiController().updateUiState(UI_STATE_OVERVIEW, 0); LayoutUtils.setViewEnabled(mActionsView, true); - mOrientationState.setGestureActive(false); + if (mOrientationState.setGestureActive(false)) { + updateOrientationHandler(); + } } public @Nullable TaskView getRunningTaskView() { @@ -1041,7 +1043,10 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView */ public void onGestureAnimationStart(int runningTaskId) { // This needs to be called before the other states are set since it can create the task view - mOrientationState.setGestureActive(true); + if (mOrientationState.setGestureActive(true)) { + updateOrientationHandler(); + } + showCurrentTask(runningTaskId); setEnableFreeScroll(false); setEnableDrawingLiveTile(false); @@ -1104,7 +1109,9 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView * Called when a gesture from an app has finished. */ public void onGestureAnimationEnd() { - mOrientationState.setGestureActive(false); + if (mOrientationState.setGestureActive(false)) { + updateOrientationHandler(); + } setOnScrollChangeListener(null); setEnableFreeScroll(true); diff --git a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java index b359f0f4e1..d822b6c291 100644 --- a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java +++ b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java @@ -188,8 +188,9 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre /** * Sets if the swipe up gesture is currently running or not */ - public void setGestureActive(boolean isGestureActive) { + public boolean setGestureActive(boolean isGestureActive) { setFlag(FLAG_SWIPE_UP_NOT_RUNNING, !isGestureActive); + return update(mTouchRotation, mDisplayRotation); } /** @@ -202,27 +203,19 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre */ public boolean update( @SurfaceRotation int touchRotation, @SurfaceRotation int displayRotation) { - int recentsActivityRotation = inferRecentsActivityRotation(displayRotation); - if (mDisplayRotation == displayRotation - && mTouchRotation == touchRotation - && mRecentsActivityRotation == recentsActivityRotation) { - return false; - } - - mRecentsActivityRotation = recentsActivityRotation; + mRecentsActivityRotation = inferRecentsActivityRotation(displayRotation); mDisplayRotation = displayRotation; mTouchRotation = touchRotation; mPreviousRotation = touchRotation; - if (mRecentsActivityRotation == mTouchRotation || canRecentsActivityRotate()) { + PagedOrientationHandler oldHandler = mOrientationHandler; + if (mRecentsActivityRotation == mTouchRotation + || (canRecentsActivityRotate() && (mFlags & FLAG_SWIPE_UP_NOT_RUNNING) != 0)) { mOrientationHandler = PagedOrientationHandler.PORTRAIT; if (DEBUG) { Log.d(TAG, "current RecentsOrientedState: " + this); } - return true; - } - - if (mTouchRotation == ROTATION_90) { + } else if (mTouchRotation == ROTATION_90) { mOrientationHandler = PagedOrientationHandler.LANDSCAPE; } else if (mTouchRotation == ROTATION_270) { mOrientationHandler = PagedOrientationHandler.SEASCAPE; @@ -232,7 +225,7 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre if (DEBUG) { Log.d(TAG, "current RecentsOrientedState: " + this); } - return true; + return oldHandler != mOrientationHandler; } @SurfaceRotation |