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

Commit c4d32015 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Removing support for fake landscape

Bug: 111068105
Change-Id: If31d2f700ddee1d21541735de3a8006ee2a53c5c
parent 8492edb1
Loading
Loading
Loading
Loading
+0 −81
Original line number Diff line number Diff line
@@ -19,12 +19,9 @@ import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;

import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;

import androidx.annotation.Nullable;
@@ -38,7 +35,6 @@ import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.hybridhotseat.HotseatPredictionController;
import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.uioverrides.touchcontrollers.FlingAndHoldTouchController;
@@ -71,77 +67,6 @@ public class QuickstepLauncher extends BaseQuickstepLauncher {
     */
    public static final AsyncCommand SET_SHELF_HEIGHT = (context, arg1, arg2) ->
            SystemUiProxy.INSTANCE.get(context).setShelfHeight(arg1 != 0, arg2);
    public static final RotationMode ROTATION_LANDSCAPE = new RotationMode(-90) {
        @Override
        public void mapRect(int left, int top, int right, int bottom, Rect out) {
            out.left = top;
            out.top = right;
            out.right = bottom;
            out.bottom = left;
        }

        @Override
        public void mapInsets(Context context, Rect insets, Rect out) {
            // If there is a display cutout, the top insets in portrait would also include the
            // cutout, which we will get as the left inset in landscape. Using the max of left and
            // top allows us to cover both cases (with or without cutout).
            if (SysUINavigationMode.getMode(context) == NO_BUTTON) {
                out.top = Math.max(insets.top, insets.left);
                out.bottom = Math.max(insets.right, insets.bottom);
                out.left = out.right = 0;
            } else {
                out.top = Math.max(insets.top, insets.left);
                out.bottom = insets.right;
                out.left = insets.bottom;
                out.right = 0;
            }
        }
    };
    public static final RotationMode ROTATION_SEASCAPE = new RotationMode(90) {
        @Override
        public void mapRect(int left, int top, int right, int bottom, Rect out) {
            out.left = bottom;
            out.top = left;
            out.right = top;
            out.bottom = right;
        }

        @Override
        public void mapInsets(Context context, Rect insets, Rect out) {
            if (SysUINavigationMode.getMode(context) == NO_BUTTON) {
                out.top = Math.max(insets.top, insets.right);
                out.bottom = Math.max(insets.left, insets.bottom);
                out.left = out.right = 0;
            } else {
                out.top = Math.max(insets.top, insets.right);
                out.bottom = insets.left;
                out.right = insets.bottom;
                out.left = 0;
            }
        }

        @Override
        public int toNaturalGravity(int absoluteGravity) {
            int horizontalGravity = absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK;
            int verticalGravity = absoluteGravity & Gravity.VERTICAL_GRAVITY_MASK;

            if (horizontalGravity == Gravity.RIGHT) {
                horizontalGravity = Gravity.LEFT;
            } else if (horizontalGravity == Gravity.LEFT) {
                horizontalGravity = Gravity.RIGHT;
            }

            if (verticalGravity == Gravity.TOP) {
                verticalGravity = Gravity.BOTTOM;
            } else if (verticalGravity == Gravity.BOTTOM) {
                verticalGravity = Gravity.TOP;
            }

            return ((absoluteGravity & ~Gravity.HORIZONTAL_GRAVITY_MASK)
                    & ~Gravity.VERTICAL_GRAVITY_MASK)
                    | horizontalGravity | verticalGravity;
        }
    };
    private HotseatPredictionController mHotseatPredictionController;

    @Override
@@ -152,12 +77,6 @@ public class QuickstepLauncher extends BaseQuickstepLauncher {
        }
    }

    @Override
    protected RotationMode getFakeRotationMode(DeviceProfile dp) {
        return !dp.isVerticalBarLayout() ? RotationMode.NORMAL
                : (dp.isSeascape() ? ROTATION_SEASCAPE : ROTATION_LANDSCAPE);
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
+2 −3
Original line number Diff line number Diff line
@@ -46,7 +46,6 @@ import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.model.PagedViewOrientedState;
import com.android.launcher3.states.RotationHelper;
import com.android.launcher3.testing.TestProtocol;
@@ -149,8 +148,8 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten
        VibratorWrapper.INSTANCE.get(mContext).vibrate(OVERVIEW_HAPTIC);
    }

    public Consumer<MotionEvent> getRecentsViewDispatcher(RotationMode navBarRotationMode) {
        return mRecentsView != null ? mRecentsView.getEventDispatcher(navBarRotationMode) : null;
    public Consumer<MotionEvent> getRecentsViewDispatcher(float navbarRotation) {
        return mRecentsView != null ? mRecentsView.getEventDispatcher(navbarRotation) : null;
    }

    @UiThread
+1 −1
Original line number Diff line number Diff line
@@ -182,7 +182,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
        if (mPassedWindowMoveSlop && mInteractionHandler != null
                && !mRecentsViewDispatcher.hasConsumer()) {
            mRecentsViewDispatcher.setConsumer(mInteractionHandler
                .getRecentsViewDispatcher(mNavBarPosition.getRotationMode()));
                    .getRecentsViewDispatcher(mNavBarPosition.getRotation()));
        }
        int edgeFlags = ev.getEdgeFlags();
        ev.setEdgeFlags(edgeFlags | EDGE_NAV_BAR);
+4 −5
Original line number Diff line number Diff line
@@ -99,7 +99,6 @@ import com.android.launcher3.anim.PropertyListBuilder;
import com.android.launcher3.anim.SpringProperty;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.statehandlers.DepthController;
import com.android.launcher3.states.RotationHelper;
import com.android.launcher3.testing.TestProtocol;
@@ -1984,13 +1983,13 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
        return offsetX;
    }

    public Consumer<MotionEvent> getEventDispatcher(RotationMode navBarRotationMode) {
    public Consumer<MotionEvent> getEventDispatcher(float navbarRotation) {
        float degreesRotated;
        if (navBarRotationMode == RotationMode.NORMAL) {
        if (navbarRotation == 0) {
            degreesRotated = mOrientationState.areMultipleLayoutOrientationsDisabled() ? 0 :
                    RotationHelper.getDegreesFromRotation(mLayoutRotation);
        } else {
            degreesRotated = -navBarRotationMode.surfaceRotation;
            degreesRotated = -navbarRotation;
        }
        if (degreesRotated == 0) {
            return super::onTouchEvent;
@@ -2000,7 +1999,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
        // undo that transformation since PagedView also accommodates for the transformation via
        // PagedOrientationHandler
        return e -> {
            if (navBarRotationMode != RotationMode.NORMAL
            if (navbarRotation != 0
                    && !mOrientationState.areMultipleLayoutOrientationsDisabled()) {
                RotationHelper.transformEventForNavBar(e, true);
                super.onTouchEvent(e);
+1 −4
Original line number Diff line number Diff line
@@ -88,9 +88,7 @@ public abstract class BaseQuickstepLauncher extends Launcher
        super.onCreate(savedInstanceState);
        mSystemActions = new SystemActions(this);

        SysUINavigationMode.Mode mode = SysUINavigationMode.INSTANCE.get(this)
                .addModeChangeListener(this);
        getRotationHelper().setRotationHadDifferentUI(mode != Mode.NO_BUTTON);
        SysUINavigationMode.INSTANCE.get(this).addModeChangeListener(this);

        if (!getSharedPrefs().getBoolean(HOME_BOUNCE_SEEN, false)) {
            getStateManager().addStateListener(new LauncherStateManager.StateListener() {
@@ -141,7 +139,6 @@ public abstract class BaseQuickstepLauncher extends Launcher
    @Override
    public void onNavigationModeChanged(Mode newMode) {
        getDragLayer().recreateControllers();
        getRotationHelper().setRotationHadDifferentUI(newMode != Mode.NO_BUTTON);
    }

    @Override
Loading