Snap for 7814207 from c3496b686d to tm-release
Change-Id: Idf2df60a9e44af0805d81753daf2daedaf672224
This commit is contained in:
@@ -30,6 +30,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ITEM_DROPPED_ON_REMOVE;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ITEM_DROP_COMPLETED;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ITEM_DROP_FOLDER_CREATED;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ONRESUME;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_QUICKSWITCH_LEFT;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_QUICKSWITCH_RIGHT;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_SWIPE_DOWN;
|
||||
@@ -161,6 +162,11 @@ public class AppEventProducer implements StatsLogConsumer {
|
||||
if (isTrackedForHotseatPrediction(atomInfo)) {
|
||||
sendEvent(atomInfo, ACTION_PIN, CONTAINER_HOTSEAT_PREDICTION);
|
||||
}
|
||||
} else if (event == LAUNCHER_ONRESUME) {
|
||||
AppTarget target = new AppTarget.Builder(new AppTargetId("id:launcher"),
|
||||
mContext.getPackageName(), Process.myUserHandle())
|
||||
.build();
|
||||
sendEvent(target, atomInfo, ACTION_LAUNCH, CONTAINER_PREDICTION);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.launcher3.uioverrides;
|
||||
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT;
|
||||
import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE_IN_OUT;
|
||||
import static com.android.launcher3.anim.Interpolators.FINAL_FRAME;
|
||||
import static com.android.launcher3.anim.Interpolators.INSTANT;
|
||||
@@ -72,6 +73,8 @@ public abstract class BaseRecentsViewStateController<T extends RecentsView>
|
||||
getTaskModalnessProperty().set(mRecentsView, state.getOverviewModalness());
|
||||
RECENTS_GRID_PROGRESS.set(mRecentsView,
|
||||
state.displayOverviewTasksAsGrid(mLauncher.getDeviceProfile()) ? 1f : 0f);
|
||||
|
||||
applySplitScrollOffset(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -117,6 +120,16 @@ public abstract class BaseRecentsViewStateController<T extends RecentsView>
|
||||
boolean showAsGrid = toState.displayOverviewTasksAsGrid(mLauncher.getDeviceProfile());
|
||||
setter.setFloat(mRecentsView, RECENTS_GRID_PROGRESS, showAsGrid ? 1f : 0f,
|
||||
showAsGrid ? INSTANT : FINAL_FRAME);
|
||||
|
||||
applySplitScrollOffset(toState);
|
||||
}
|
||||
|
||||
private void applySplitScrollOffset(@NonNull final LauncherState state) {
|
||||
if (state == OVERVIEW_SPLIT_SELECT) {
|
||||
mRecentsView.applySplitPrimaryScrollOffset();
|
||||
} else {
|
||||
mRecentsView.resetSplitPrimaryScrollOffset();
|
||||
}
|
||||
}
|
||||
|
||||
abstract FloatProperty getTaskModalnessProperty();
|
||||
|
||||
@@ -271,7 +271,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||
mActivityInterface = gestureState.getActivityInterface();
|
||||
mActivityInitListener = mActivityInterface.createActivityInitListener(this::onActivityInit);
|
||||
mInputConsumerProxy =
|
||||
new InputConsumerProxy(inputConsumer, () -> {
|
||||
new InputConsumerProxy(context,
|
||||
() -> mRecentsView.getPagedViewOrientedState().getRecentsActivityRotation(),
|
||||
inputConsumer, () -> {
|
||||
endRunningWindowAnim(mGestureState.getEndTarget() == HOME /* cancel */);
|
||||
endLauncherTransitionController();
|
||||
}, new InputProxyHandlerFactory(mActivityInterface, mGestureState));
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.quickstep;
|
||||
|
||||
import static com.android.launcher3.states.RotationHelper.deltaRotation;
|
||||
import static com.android.quickstep.util.RecentsOrientedState.postDisplayRotation;
|
||||
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.RectF;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
public class OrientationRectF extends RectF {
|
||||
|
||||
private static final String TAG = "OrientationRectF";
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
private final int mRotation;
|
||||
private final float mHeight;
|
||||
private final float mWidth;
|
||||
|
||||
private final Matrix mTmpMatrix = new Matrix();
|
||||
private final float[] mTmpPoint = new float[2];
|
||||
|
||||
public OrientationRectF(float left, float top, float right, float bottom, int rotation) {
|
||||
super(left, top, right, bottom);
|
||||
mRotation = rotation;
|
||||
mHeight = bottom;
|
||||
mWidth = right;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String s = super.toString();
|
||||
s += " rotation: " + mRotation;
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(float x, float y) {
|
||||
// Mark bottom right as included in the Rect (copied from Rect src, added "=" in "<=")
|
||||
return left < right && top < bottom // check for empty first
|
||||
&& x >= left && x <= right && y >= top && y <= bottom;
|
||||
}
|
||||
|
||||
public boolean applyTransformFromRotation(MotionEvent event, int currentRotation,
|
||||
boolean forceTransform) {
|
||||
return applyTransform(event, deltaRotation(currentRotation, mRotation), forceTransform);
|
||||
}
|
||||
|
||||
public boolean applyTransformToRotation(MotionEvent event, int currentRotation,
|
||||
boolean forceTransform) {
|
||||
return applyTransform(event, deltaRotation(mRotation, currentRotation), forceTransform);
|
||||
}
|
||||
|
||||
private boolean applyTransform(MotionEvent event, int deltaRotation, boolean forceTransform) {
|
||||
mTmpMatrix.reset();
|
||||
postDisplayRotation(deltaRotation, mHeight, mWidth, mTmpMatrix);
|
||||
if (forceTransform) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "Transforming rotation due to forceTransform, "
|
||||
+ "deltaRotation: " + deltaRotation
|
||||
+ "mRotation: " + mRotation
|
||||
+ " this: " + this);
|
||||
}
|
||||
event.applyTransform(mTmpMatrix);
|
||||
return true;
|
||||
}
|
||||
mTmpPoint[0] = event.getX();
|
||||
mTmpPoint[1] = event.getY();
|
||||
mTmpMatrix.mapPoints(mTmpPoint);
|
||||
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "original: " + event.getX() + ", " + event.getY()
|
||||
+ " new: " + mTmpPoint[0] + ", " + mTmpPoint[1]
|
||||
+ " rect: " + this + " forceTransform: " + forceTransform
|
||||
+ " contains: " + contains(mTmpPoint[0], mTmpPoint[1])
|
||||
+ " this: " + this);
|
||||
}
|
||||
|
||||
if (contains(mTmpPoint[0], mTmpPoint[1])) {
|
||||
event.applyTransform(mTmpMatrix);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int getRotation() {
|
||||
return mRotation;
|
||||
}
|
||||
}
|
||||
@@ -22,11 +22,7 @@ import static android.view.MotionEvent.ACTION_MOVE;
|
||||
import static android.view.MotionEvent.ACTION_POINTER_DOWN;
|
||||
import static android.view.MotionEvent.ACTION_UP;
|
||||
|
||||
import static com.android.launcher3.states.RotationHelper.deltaRotation;
|
||||
import static com.android.quickstep.util.RecentsOrientedState.postDisplayRotation;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.RectF;
|
||||
import android.util.Log;
|
||||
@@ -44,8 +40,8 @@ import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Maintains state for supporting nav bars and tracking their gestures in multiple orientations.
|
||||
* See {@link OrientationRectF#applyTransform(MotionEvent, boolean)} for transformation of
|
||||
* MotionEvents from one orientation's coordinate space to another's.
|
||||
* See {@link OrientationRectF#applyTransformToRotation(MotionEvent, int, boolean)} for
|
||||
* transformation of MotionEvents from one orientation's coordinate space to another's.
|
||||
*
|
||||
* This class only supports single touch/pointer gesture tracking for touches started in a supported
|
||||
* nav bar region.
|
||||
@@ -95,9 +91,6 @@ class OrientationTouchTransformer {
|
||||
|
||||
private static final int QUICKSTEP_ROTATION_UNINITIALIZED = -1;
|
||||
|
||||
private final Matrix mTmpMatrix = new Matrix();
|
||||
private final float[] mTmpPoint = new float[2];
|
||||
|
||||
private final Map<CurrentDisplay, OrientationRectF> mSwipeTouchRegions =
|
||||
new HashMap<CurrentDisplay, OrientationRectF>();
|
||||
private final RectF mAssistantLeftRegion = new RectF();
|
||||
@@ -365,7 +358,7 @@ class OrientationTouchTransformer {
|
||||
if (mLastRectTouched == null) {
|
||||
return;
|
||||
}
|
||||
mLastRectTouched.applyTransform(event, true);
|
||||
mLastRectTouched.applyTransformFromRotation(event, mCurrentDisplay.rotation, true);
|
||||
break;
|
||||
}
|
||||
case ACTION_CANCEL:
|
||||
@@ -373,7 +366,7 @@ class OrientationTouchTransformer {
|
||||
if (mLastRectTouched == null) {
|
||||
return;
|
||||
}
|
||||
mLastRectTouched.applyTransform(event, true);
|
||||
mLastRectTouched.applyTransformFromRotation(event, mCurrentDisplay.rotation, true);
|
||||
mLastRectTouched = null;
|
||||
break;
|
||||
}
|
||||
@@ -387,14 +380,14 @@ class OrientationTouchTransformer {
|
||||
if (rect == null) {
|
||||
continue;
|
||||
}
|
||||
if (rect.applyTransform(event, false)) {
|
||||
if (rect.applyTransformFromRotation(event, mCurrentDisplay.rotation, false)) {
|
||||
mLastRectTouched = rect;
|
||||
mActiveTouchRotation = rect.mRotation;
|
||||
mActiveTouchRotation = rect.getRotation();
|
||||
if (mEnableMultipleRegions
|
||||
&& mCurrentDisplay.rotation == mActiveTouchRotation) {
|
||||
// TODO(b/154580671) might make this block unnecessary
|
||||
// Start a touch session for the default nav region for the display
|
||||
mQuickStepStartingRotation = mLastRectTouched.mRotation;
|
||||
mQuickStepStartingRotation = mLastRectTouched.getRotation();
|
||||
resetSwipeRegions();
|
||||
}
|
||||
if (DEBUG) {
|
||||
@@ -423,65 +416,4 @@ class OrientationTouchTransformer {
|
||||
pw.println(" mNavBarLargerGesturalHeight=" + mNavBarLargerGesturalHeight);
|
||||
pw.println(" mOneHandedModeRegion=" + mOneHandedModeRegion);
|
||||
}
|
||||
|
||||
private class OrientationRectF extends RectF {
|
||||
|
||||
private int mRotation;
|
||||
private float mHeight;
|
||||
private float mWidth;
|
||||
|
||||
OrientationRectF(float left, float top, float right, float bottom, int rotation) {
|
||||
super(left, top, right, bottom);
|
||||
this.mRotation = rotation;
|
||||
mHeight = bottom;
|
||||
mWidth = right;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String s = super.toString();
|
||||
s += " rotation: " + mRotation;
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(float x, float y) {
|
||||
// Mark bottom right as included in the Rect (copied from Rect src, added "=" in "<=")
|
||||
return left < right && top < bottom // check for empty first
|
||||
&& x >= left && x <= right && y >= top && y <= bottom;
|
||||
}
|
||||
|
||||
boolean applyTransform(MotionEvent event, boolean forceTransform) {
|
||||
mTmpMatrix.reset();
|
||||
postDisplayRotation(deltaRotation(mCurrentDisplay.rotation, mRotation),
|
||||
mHeight, mWidth, mTmpMatrix);
|
||||
if (forceTransform) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "Transforming rotation due to forceTransform, "
|
||||
+ "mCurrentRotation: " + mCurrentDisplay.rotation
|
||||
+ "mRotation: " + mRotation
|
||||
+ " this: " + this);
|
||||
}
|
||||
event.applyTransform(mTmpMatrix);
|
||||
return true;
|
||||
}
|
||||
mTmpPoint[0] = event.getX();
|
||||
mTmpPoint[1] = event.getY();
|
||||
mTmpMatrix.mapPoints(mTmpPoint);
|
||||
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "original: " + event.getX() + ", " + event.getY()
|
||||
+ " new: " + mTmpPoint[0] + ", " + mTmpPoint[1]
|
||||
+ " rect: " + this + " forceTransform: " + forceTransform
|
||||
+ " contains: " + contains(mTmpPoint[0], mTmpPoint[1])
|
||||
+ " this: " + this);
|
||||
}
|
||||
|
||||
if (contains(mTmpPoint[0], mTmpPoint[1])) {
|
||||
event.applyTransform(mTmpMatrix);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.quickstep;
|
||||
|
||||
import static com.android.launcher3.util.DisplayController.CHANGE_ACTIVE_SCREEN;
|
||||
import static com.android.launcher3.util.DisplayController.CHANGE_ALL;
|
||||
import static com.android.launcher3.util.DisplayController.CHANGE_ROTATION;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.MainThreadInitializedObject;
|
||||
|
||||
public class SimpleOrientationTouchTransformer implements
|
||||
DisplayController.DisplayInfoChangeListener {
|
||||
|
||||
public static final MainThreadInitializedObject<SimpleOrientationTouchTransformer> INSTANCE =
|
||||
new MainThreadInitializedObject<>(SimpleOrientationTouchTransformer::new);
|
||||
|
||||
private OrientationRectF mOrientationRectF;
|
||||
|
||||
public SimpleOrientationTouchTransformer(Context context) {
|
||||
DisplayController.INSTANCE.get(context).addChangeListener(this);
|
||||
onDisplayInfoChanged(context, DisplayController.INSTANCE.get(context).getInfo(),
|
||||
CHANGE_ALL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisplayInfoChanged(Context context, DisplayController.Info info, int flags) {
|
||||
if ((flags & (CHANGE_ROTATION | CHANGE_ACTIVE_SCREEN)) == 0) {
|
||||
return;
|
||||
}
|
||||
mOrientationRectF = new OrientationRectF(0, 0, info.currentSize.y, info.currentSize.x,
|
||||
info.rotation);
|
||||
}
|
||||
|
||||
public void transform(MotionEvent ev, int rotation) {
|
||||
mOrientationRectF.applyTransformToRotation(ev, rotation, true /* forceTransform */);
|
||||
}
|
||||
}
|
||||
@@ -19,12 +19,14 @@ import static android.view.MotionEvent.ACTION_CANCEL;
|
||||
import static android.view.MotionEvent.ACTION_DOWN;
|
||||
import static android.view.MotionEvent.ACTION_UP;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.InputEvent;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.android.quickstep.InputConsumer;
|
||||
import com.android.quickstep.SimpleOrientationTouchTransformer;
|
||||
import com.android.systemui.shared.system.InputConsumerController;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
@@ -37,6 +39,8 @@ public class InputConsumerProxy {
|
||||
|
||||
private static final String TAG = "InputConsumerProxy";
|
||||
|
||||
private final Context mContext;
|
||||
private final Supplier<Integer> mRotationSupplier;
|
||||
private final InputConsumerController mInputConsumerController;
|
||||
private Runnable mCallback;
|
||||
private Supplier<InputConsumer> mConsumerSupplier;
|
||||
@@ -48,8 +52,11 @@ public class InputConsumerProxy {
|
||||
private boolean mTouchInProgress = false;
|
||||
private boolean mDestroyPending = false;
|
||||
|
||||
public InputConsumerProxy(InputConsumerController inputConsumerController,
|
||||
public InputConsumerProxy(Context context, Supplier<Integer> rotationSupplier,
|
||||
InputConsumerController inputConsumerController,
|
||||
Runnable callback, Supplier<InputConsumer> consumerSupplier) {
|
||||
mContext = context;
|
||||
mRotationSupplier = rotationSupplier;
|
||||
mInputConsumerController = inputConsumerController;
|
||||
mCallback = callback;
|
||||
mConsumerSupplier = consumerSupplier;
|
||||
@@ -98,6 +105,8 @@ public class InputConsumerProxy {
|
||||
}
|
||||
}
|
||||
if (mInputConsumer != null) {
|
||||
SimpleOrientationTouchTransformer.INSTANCE.get(mContext).transform(ev,
|
||||
mRotationSupplier.get());
|
||||
mInputConsumer.onMotionEvent(ev);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ public class ClearAllButton extends Button {
|
||||
private float mGridTranslationPrimary;
|
||||
private float mGridScrollOffset;
|
||||
private float mScrollOffsetPrimary;
|
||||
private float mSplitSelectScrollOffsetPrimary;
|
||||
|
||||
private int mSidePadding;
|
||||
|
||||
@@ -167,6 +168,10 @@ public class ClearAllButton extends Button {
|
||||
mScrollOffsetPrimary = scrollOffsetPrimary;
|
||||
}
|
||||
|
||||
public void setSplitSelectScrollOffsetPrimary(float splitSelectScrollOffsetPrimary) {
|
||||
mSplitSelectScrollOffsetPrimary = splitSelectScrollOffsetPrimary;
|
||||
}
|
||||
|
||||
public float getScrollAdjustment(boolean fullscreenEnabled, boolean gridEnabled) {
|
||||
float scrollAdjustment = 0;
|
||||
if (fullscreenEnabled) {
|
||||
@@ -176,6 +181,7 @@ public class ClearAllButton extends Button {
|
||||
scrollAdjustment += mGridTranslationPrimary + mGridScrollOffset;
|
||||
}
|
||||
scrollAdjustment += mScrollOffsetPrimary;
|
||||
scrollAdjustment += mSplitSelectScrollOffsetPrimary;
|
||||
return scrollAdjustment;
|
||||
}
|
||||
|
||||
|
||||
@@ -189,6 +189,9 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
TaskThumbnailCache.HighResLoadingState.HighResLoadingStateChangedCallback,
|
||||
TaskVisualsChangeListener, SplitScreenBounds.OnChangeListener {
|
||||
|
||||
private static final String TAG = "RecentsView";
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
// TODO(b/184899234): We use this timeout to wait a fixed period after switching to the
|
||||
// screenshot when dismissing the current live task to ensure the app can try and get stopped.
|
||||
private static final int REMOVE_TASK_WAIT_FOR_APP_STOP_MS = 100;
|
||||
@@ -2643,8 +2646,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
* and then animates it into the split position that was desired
|
||||
*/
|
||||
private void createInitialSplitSelectAnimation(PendingAnimation anim) {
|
||||
float placeholderHeight = getResources().getDimension(R.dimen.split_placeholder_size);
|
||||
mOrientationHandler.getInitialSplitPlaceholderBounds((int) placeholderHeight,
|
||||
mOrientationHandler.getInitialSplitPlaceholderBounds(mSplitPlaceholderSize,
|
||||
mActivity.getDeviceProfile(),
|
||||
mSplitSelectStateController.getActiveSplitStagePosition(), mTempRect);
|
||||
|
||||
@@ -3238,14 +3240,13 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
}
|
||||
|
||||
Rect splitBounds = new Rect();
|
||||
float placeholderSize = getResources().getDimension(R.dimen.split_placeholder_size);
|
||||
// This acts as a best approximation on where the splitplaceholder view would be,
|
||||
// doesn't need to be exact necessarily. This also doesn't need to take translations
|
||||
// into account since placeholder view is not translated
|
||||
if (stagePosition == SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT) {
|
||||
splitBounds.set((int) (getWidth() - placeholderSize), 0, getWidth(), getHeight());
|
||||
splitBounds.set(getWidth() - mSplitPlaceholderSize, 0, getWidth(), getHeight());
|
||||
} else {
|
||||
splitBounds.set(0, 0, (int) (placeholderSize), getHeight());
|
||||
splitBounds.set(0, 0, mSplitPlaceholderSize, getHeight());
|
||||
}
|
||||
Rect taskBounds = new Rect();
|
||||
int taskCount = getTaskViewCount();
|
||||
@@ -3745,6 +3746,50 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply scroll offset to children of RecentsView when entering split select.
|
||||
*/
|
||||
public void applySplitPrimaryScrollOffset() {
|
||||
if (!mActivity.getDeviceProfile().isLandscape || !showAsGrid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@StagePosition int position = mSplitSelectStateController.getActiveSplitStagePosition();
|
||||
boolean shouldShiftThumbnailsForSplitSelect = shouldShiftThumbnailsForSplitSelect(
|
||||
position);
|
||||
boolean expandLeft = false;
|
||||
boolean expandRight = false;
|
||||
if (mIsRtl) {
|
||||
if (position == SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT
|
||||
&& shouldShiftThumbnailsForSplitSelect) {
|
||||
expandLeft = true;
|
||||
} else if (position == SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT) {
|
||||
if (shouldShiftThumbnailsForSplitSelect) {
|
||||
expandRight = true;
|
||||
} else {
|
||||
expandLeft = true;
|
||||
}
|
||||
}
|
||||
} // TODO(b/200537659): Handle system RTL.
|
||||
if (expandRight) {
|
||||
for (int i = 0; i < getTaskViewCount(); i++) {
|
||||
getTaskViewAt(i).setSplitScrollOffsetPrimary(mSplitPlaceholderSize);
|
||||
}
|
||||
} else if (expandLeft) {
|
||||
mClearAllButton.setSplitSelectScrollOffsetPrimary(-mSplitPlaceholderSize);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset scroll offset on children of RecentsView when exiting split select.
|
||||
*/
|
||||
public void resetSplitPrimaryScrollOffset() {
|
||||
for (int i = 0; i < getTaskViewCount(); i++) {
|
||||
getTaskViewAt(i).setSplitScrollOffsetPrimary(0);
|
||||
}
|
||||
mClearAllButton.setSplitSelectScrollOffsetPrimary(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the visuals when exit modal state.
|
||||
*/
|
||||
@@ -4354,30 +4399,28 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
updateMinAndMaxScrollX();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateMinAndMaxScrollX() {
|
||||
super.updateMinAndMaxScrollX();
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "updateMinAndMaxScrollX - mMinScroll: " + mMinScroll);
|
||||
Log.d(TAG, "updateMinAndMaxScrollX - mMaxScroll: " + mMaxScroll);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int computeMinScroll() {
|
||||
if (getTaskViewCount() > 0) {
|
||||
int minScroll;
|
||||
boolean isLandscapeGridSplit = mActivity.getDeviceProfile().isLandscape
|
||||
&& showAsGrid() && isSplitSelectionActive();
|
||||
if (mIsRtl) {
|
||||
// If we aren't showing the clear all button, use the rightmost task as the min
|
||||
// scroll.
|
||||
minScroll = getScrollForPage(mDisallowScrollToClearAll ? indexOfChild(
|
||||
return getScrollForPage(mDisallowScrollToClearAll ? indexOfChild(
|
||||
getTaskViewAt(getTaskViewCount() - 1)) : indexOfChild(mClearAllButton));
|
||||
if (isLandscapeGridSplit
|
||||
&& mSplitSelectStateController.getActiveSplitStagePosition()
|
||||
== SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT) {
|
||||
minScroll -= mSplitPlaceholderSize;
|
||||
}
|
||||
} else {
|
||||
TaskView focusedTaskView = mShowAsGridLastOnLayout ? getFocusedTaskView() : null;
|
||||
minScroll = getScrollForPage(focusedTaskView != null ? indexOfChild(focusedTaskView)
|
||||
return getScrollForPage(focusedTaskView != null ? indexOfChild(focusedTaskView)
|
||||
: 0);
|
||||
// TODO(b/200537659): Adjust according to mSplitPlaceholderSize when
|
||||
// isLandscapeGridSplit is true.
|
||||
}
|
||||
return minScroll;
|
||||
}
|
||||
return super.computeMinScroll();
|
||||
}
|
||||
@@ -4385,27 +4428,16 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
@Override
|
||||
protected int computeMaxScroll() {
|
||||
if (getTaskViewCount() > 0) {
|
||||
int maxScroll;
|
||||
boolean isLandscapeGridSplit = mActivity.getDeviceProfile().isLandscape
|
||||
&& showAsGrid() && isSplitSelectionActive();
|
||||
if (mIsRtl) {
|
||||
TaskView focusedTaskView = mShowAsGridLastOnLayout ? getFocusedTaskView() : null;
|
||||
maxScroll = getScrollForPage(focusedTaskView != null ? indexOfChild(focusedTaskView)
|
||||
return getScrollForPage(focusedTaskView != null ? indexOfChild(focusedTaskView)
|
||||
: 0);
|
||||
if (isLandscapeGridSplit
|
||||
&& mSplitSelectStateController.getActiveSplitStagePosition()
|
||||
== SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT) {
|
||||
maxScroll += mSplitPlaceholderSize;
|
||||
}
|
||||
} else {
|
||||
// If we aren't showing the clear all button, use the leftmost task as the min
|
||||
// scroll.
|
||||
maxScroll = getScrollForPage(mDisallowScrollToClearAll ? indexOfChild(
|
||||
return getScrollForPage(mDisallowScrollToClearAll ? indexOfChild(
|
||||
getTaskViewAt(getTaskViewCount() - 1)) : indexOfChild(mClearAllButton));
|
||||
// TODO(b/200537659): Adjust according to mSplitPlaceholderSize when
|
||||
// isLandscapeGridSplit is true.
|
||||
}
|
||||
return maxScroll;
|
||||
}
|
||||
return super.computeMaxScroll();
|
||||
}
|
||||
@@ -4460,6 +4492,12 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
pageScrollChanged = true;
|
||||
outPageScrolls[i] = pageScroll;
|
||||
}
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "getPageScrolls - outPageScrolls[" + i + "]: " + outPageScrolls[i]);
|
||||
}
|
||||
}
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "getPageScrolls - clearAllScroll: " + clearAllScroll);
|
||||
}
|
||||
return pageScrollChanged;
|
||||
}
|
||||
|
||||
@@ -389,6 +389,7 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
// Used when in SplitScreenSelectState
|
||||
private float mSplitSelectTranslationY;
|
||||
private float mSplitSelectTranslationX;
|
||||
private float mSplitSelectScrollOffsetPrimary;
|
||||
|
||||
private ObjectAnimator mIconAndDimAnimator;
|
||||
private float mIconScaleAnimStartProgress = 0;
|
||||
@@ -1031,6 +1032,11 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
mSplitSelectTranslationY = y;
|
||||
applyTranslationY();
|
||||
}
|
||||
|
||||
public void setSplitScrollOffsetPrimary(float splitSelectScrollOffsetPrimary) {
|
||||
mSplitSelectScrollOffsetPrimary = splitSelectScrollOffsetPrimary;
|
||||
}
|
||||
|
||||
private void setDismissTranslationX(float x) {
|
||||
mDismissTranslationX = x;
|
||||
applyTranslationX();
|
||||
@@ -1101,6 +1107,7 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
} else {
|
||||
scrollAdjustment += getPrimaryNonGridTranslationProperty().get(this);
|
||||
}
|
||||
scrollAdjustment += mSplitSelectScrollOffsetPrimary;
|
||||
return scrollAdjustment;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user