Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ce629ff8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Handling Launcher configuration change between touchDown and...

Merge "Handling Launcher configuration change between touchDown and Launcher.onStart" into ub-launcher3-rvc-dev
parents 6dac4932 6fe83da5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -275,8 +275,7 @@ public abstract class BaseSwipeUpHandlerV2<T extends StatefulActivity<?>, Q exte
        if (mActivity == activity) {
            return true;
        }
        mTaskViewSimulator.setLayoutRotation(mDeviceState.getCurrentActiveRotation(),
                mDeviceState.getDisplayRotation());

        if (mActivity != null) {
            // The launcher may have been recreated as a result of device rotation.
            int oldState = mStateCallback.getState() & ~LAUNCHER_UI_STATES;
@@ -329,6 +328,7 @@ public abstract class BaseSwipeUpHandlerV2<T extends StatefulActivity<?>, Q exte
        if (mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)) {
            return;
        }
        mTaskViewSimulator.setRecentsConfiguration(mActivity.getResources().getConfiguration());

        // If we've already ended the gesture and are going home, don't prepare recents UI,
        // as that will set the state as BACKGROUND_APP, overriding the animation to NORMAL.
+1 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
            }
        }
        RecentsOrientedState orientedState = taskView.getRecentsView().getPagedViewOrientedState();
        boolean canLauncherRotate = orientedState.canLauncherRotate();
        boolean canLauncherRotate = orientedState.canRecentsActivityRotate();
        boolean isInLandscape = orientedState.getTouchRotation() != ROTATION_0;

        // Add overview actions to the menu when in in-place rotate landscape mode.
+12 −2
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static com.android.systemui.shared.system.WindowManagerWrapper.WINDOWING_

import android.animation.TimeInterpolator;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Matrix;
import android.graphics.Point;
import android.graphics.PointF;
@@ -124,6 +125,14 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
        mLayoutValid = false;
    }

    /**
     * @see com.android.quickstep.views.RecentsView#onConfigurationChanged(Configuration)
     */
    public void setRecentsConfiguration(Configuration configuration) {
        mOrientationState.setActivityConfiguration(configuration);
        mLayoutValid = false;
    }

    /**
     * @see com.android.quickstep.views.RecentsView#FULLSCREEN_PROGRESS
     */
@@ -205,7 +214,8 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
    public void applyWindowToHomeRotation(Matrix matrix) {
        mMatrix.postTranslate(mDp.windowX, mDp.windowY);
        postDisplayRotation(deltaRotation(
                mOrientationState.getLauncherRotation(), mOrientationState.getDisplayRotation()),
                mOrientationState.getRecentsActivityRotation(),
                mOrientationState.getDisplayRotation()),
                mDp.widthPx, mDp.heightPx, matrix);
        matrix.postTranslate(-mRunningTargetWindowPosition.x, -mRunningTargetWindowPosition.y);
    }
@@ -226,7 +236,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
            mPositionHelper.updateThumbnailMatrix(
                    mThumbnailPosition, mThumbnailData,
                    mTaskRect.width(), mTaskRect.height(),
                    mDp, mOrientationState.getLauncherRotation());
                    mDp, mOrientationState.getRecentsActivityRotation());
            mPositionHelper.getMatrix().invert(mInversePositionMatrix);

            PagedOrientationHandler poh = mOrientationState.getOrientationHandler();
+34 −20
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Canvas;
import android.graphics.Point;
import android.graphics.PointF;
@@ -393,6 +394,7 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
        mActivity = BaseActivity.fromContext(context);
        mOrientationState = new RecentsOrientedState(
                context, mSizeStrategy, this::animateRecentsRotationInPlace);
        mOrientationState.setActivityConfiguration(context.getResources().getConfiguration());

        mFastFlingVelocity = getResources()
                .getDimensionPixelSize(R.dimen.recents_fast_fling_velocity);
@@ -1063,7 +1065,7 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
    }

    private void animateRecentsRotationInPlace(int newRotation) {
        if (mOrientationState.canLauncherRotate()) {
        if (mOrientationState.canRecentsActivityRotate()) {
            // Let system take care of the rotation
            return;
        }
@@ -1646,8 +1648,21 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
        }
    }

    @Override
    protected void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        if (mOrientationState.setActivityConfiguration(newConfig)) {
            updateOrientationHandler();
        }
    }

    public void setLayoutRotation(int touchRotation, int displayRotation) {
        if (mOrientationState.update(touchRotation, displayRotation)) {
            updateOrientationHandler();
        }
    }

    private void updateOrientationHandler() {
        mOrientationHandler = mOrientationState.getOrientationHandler();
        mIsRtl = mOrientationHandler.getRecentsRtlSetting(getResources());
        setLayoutDirection(mIsRtl
@@ -1659,15 +1674,14 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
        mClearAllButton.setRotation(mOrientationHandler.getDegreesRotated());
        mActivity.getDragLayer().recreateControllers();
        boolean isInLandscape = mOrientationState.getTouchRotation() != 0
                    || mOrientationState.getLauncherRotation() != ROTATION_0;
                || mOrientationState.getRecentsActivityRotation() != ROTATION_0;
        mActionsView.updateHiddenFlags(HIDDEN_NON_ZERO_ROTATION,
                    !mOrientationState.canLauncherRotate() && isInLandscape);
                !mOrientationState.canRecentsActivityRotate() && isInLandscape);
        resetPaddingFromTaskSize();
        requestLayout();
        // Reapply the current page to update page scrolls.
        setCurrentPage(mCurrentPage);
    }
    }

    public RecentsOrientedState getPagedViewOrientedState() {
        return mOrientationState;
@@ -2239,7 +2253,7 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
            getCurrentPageTaskView().setModalness(modalness);
        }
        // Only show actions view when it's modal for in-place landscape mode.
        boolean inPlaceLandscape = !mOrientationState.canLauncherRotate()
        boolean inPlaceLandscape = !mOrientationState.canRecentsActivityRotate()
                && mOrientationState.getTouchRotation() != ROTATION_0;
        mActionsView.updateHiddenFlags(HIDDEN_NON_ZERO_ROTATION, modalness < 1 && inPlaceLandscape);
    }
+0 −15
Original line number Diff line number Diff line
@@ -57,21 +57,6 @@ public class LayoutUtils {
        return shelfHeight + spaceBetweenShelfAndRecents;
    }

    /**
     * Gets the scale that should be applied to the TaskView so that it matches the target
     * TODO: Remove this method
     */
    public static float getTaskScale(RecentsOrientedState orientedState,
            float srcWidth, float srcHeight, float targetWidth, float targetHeight) {
        if (orientedState == null
                || orientedState.isHomeRotationAllowed()
                || orientedState.isDisplayPhoneNatural()) {
            return srcWidth / targetWidth;
        } else {
            return srcHeight / targetHeight;
        }
    }

    /**
     * Recursively sets view and all children enabled/disabled.
     * @param view Top most parent view to change.
Loading