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

Commit 326d93bd authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Re-enable home screen rotation

Launcher home screen rotation now works with fixed
transform. When using Quickstep while holding
the phone from an orientation different than
the orientation of the touch, the overview
shown will be that of the phone orientation,
not the touch orientation.
Easier to see this be quickswitching from
portrait to landscape app, turning phone, then
going to overview from the original region you
swiped.

Fixes: 150214193
Test: Created test apps and fixed them
to various rotations to test.

Change-Id: Ic6565cd0ed33c951f45ccb97278045c6070e438e
parent a976a221
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS;
import android.annotation.TargetApi;
import android.os.Build;
import android.util.FloatProperty;
import android.view.Surface;
import android.view.View;
import android.view.animation.Interpolator;

@@ -91,8 +92,9 @@ public final class RecentsViewStateController extends
                buttonAlpha, LINEAR);

        View actionsView = mLauncher.getActionsView();
        if (actionsView != null) {
            propertySetter.setFloat(actionsView, VIEW_ALPHA, buttonAlpha, actionInterpolator);
        int launcherRotation = mRecentsView.getPagedViewOrientedState().getLauncherRotation();
        if (actionsView != null && launcherRotation == Surface.ROTATION_0) {
            propertySetter.setViewAlpha(actionsView, buttonAlpha, actionInterpolator);
        }
    }

+0 −1
Original line number Diff line number Diff line
@@ -144,7 +144,6 @@ public class OverviewState extends LauncherState {

    @Override
    public void onStateTransitionEnd(Launcher launcher) {
        launcher.getRotationHelper().setCurrentStateRequest(REQUEST_ROTATE);
        DiscoveryBounce.showForOverviewIfNeeded(launcher);
        RecentsView recentsView = launcher.getOverviewPanel();
        AccessibilityManagerCompat.sendCustomAccessibilityEvent(
+3 −2
Original line number Diff line number Diff line
@@ -325,13 +325,14 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten
            mAppWindowAnimationHelper.updateHomeBounds(getStackBounds(dp));
        }
        int displayRotation = 0;
        if (mOrientedState != null) {
        if (mOrientedState != null && !mOrientedState.areMultipleLayoutOrientationsDisabled()) {
            // TODO(b/150300347): The first recents animation after launcher is started with the
            //  foreground app not in landscape will look funky until that bug is fixed
            displayRotation = mOrientedState.getDisplayRotation();

            RectF tempRectF = new RectF(TEMP_RECT);
            mOrientedState.mapRectFromNormalOrientation(tempRectF, dp.widthPx, dp.heightPx);
            mOrientedState.mapRectFromRotation(displayRotation,
                    tempRectF, dp.widthPx, dp.heightPx);
            tempRectF.roundOut(TEMP_RECT);
        }
        mAppWindowAnimationHelper.updateTargetRect(TEMP_RECT);
+5 −4
Original line number Diff line number Diff line
@@ -160,9 +160,9 @@ public class AppWindowAnimationHelper {
    }

    private float getSrcToTargetScale() {
        if (mOrientedState == null ||
            (mOrientedState.getDisplayRotation() == Surface.ROTATION_0
                || mOrientedState.getDisplayRotation() == Surface.ROTATION_180)) {
        if (mOrientedState == null
                || mOrientedState.isHomeRotationAllowed()
                || mOrientedState.isDisplayPhoneNatural()) {
            return mSourceRect.width() / mTargetRect.width();
        } else {
            return mSourceRect.height() / mTargetRect.height();
@@ -277,8 +277,9 @@ public class AppWindowAnimationHelper {
                mCurrentRect.offset(params.mOffset, 0);
            } else {
                int displayRotation = mOrientedState.getDisplayRotation();
                int launcherRotation = mOrientedState.getLauncherRotation();
                mOrientedState.getOrientationHandler().offsetTaskRect(mCurrentRect,
                    params.mOffset, displayRotation);
                    params.mOffset, displayRotation, launcherRotation);
            }
        }

+0 −6
Original line number Diff line number Diff line
@@ -88,10 +88,6 @@ public class LauncherRecentsView extends RecentsView<BaseQuickstepLauncher>
        }
    };

    private RotationHelper.ForcedRotationChangedListener mForcedRotationChangedListener =
            isForcedRotation -> LauncherRecentsView.this
                    .disableMultipleLayoutRotations(!isForcedRotation);

    public LauncherRecentsView(Context context) {
        this(context, null);
    }
@@ -344,7 +340,6 @@ public class LauncherRecentsView extends RecentsView<BaseQuickstepLauncher>
        super.onAttachedToWindow();
        PluginManagerWrapper.INSTANCE.get(getContext()).addPluginListener(
                mRecentsExtraCardPluginListener, RecentsExtraCard.class);
        mActivity.getRotationHelper().addForcedRotationCallback(mForcedRotationChangedListener);
    }

    @Override
@@ -352,7 +347,6 @@ public class LauncherRecentsView extends RecentsView<BaseQuickstepLauncher>
        super.onDetachedFromWindow();
        PluginManagerWrapper.INSTANCE.get(getContext()).removePluginListener(
                mRecentsExtraCardPluginListener);
        mActivity.getRotationHelper().removeForcedRotationCallback(mForcedRotationChangedListener);
    }

    @Override
Loading