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

Commit a6fb77f1 authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Move getRotationHelper() call to LauncherRecentsView

3P launchers were causing a ClassCastException so
moved it down to Launcher specific code.
3P as a whole will have to be handled better with the
new rotation paradigm so this will be addressed then.

Fixes: 146176182
Test: Set Nova Launcher as default home app
Swiped up to recents, nothing breaks.

Change-Id: I91a267f3a29bd5b9638bc9b69d864ac2de3f3d72
parent 38f68a14
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.model.PagedViewOrientedState;
import com.android.launcher3.states.RotationHelper;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.touch.PortraitPagedViewHandler;
import com.android.launcher3.util.VibratorWrapper;
import com.android.launcher3.views.FloatingIconView;
import com.android.quickstep.BaseActivityInterface.HomeAnimationFactory;
@@ -428,6 +429,9 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten
    }

    protected PagedOrientationHandler getOrientationHandler() {
        if (mOrientedState == null) {
            return new PortraitPagedViewHandler();
        }
        return mOrientedState.getOrientationHandler();
    }

+7 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import com.android.launcher3.R;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.appprediction.PredictionUiStateManager;
import com.android.launcher3.appprediction.PredictionUiStateManager.Client;
import com.android.launcher3.states.RotationHelper;
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
import com.android.launcher3.util.TraceHelper;
import com.android.launcher3.views.ScrimView;
@@ -86,6 +87,10 @@ public class LauncherRecentsView extends RecentsView<Launcher> implements StateL
        }
    };

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

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

    @Override
@@ -344,6 +350,7 @@ public class LauncherRecentsView extends RecentsView<Launcher> implements StateL
        super.onDetachedFromWindow();
        PluginManagerWrapper.INSTANCE.get(getContext()).removePluginListener(
                mRecentsExtraCardPluginListener);
        mActivity.getRotationHelper().removeForcedRotationCallback(mForcedRotationChangedListener);
    }

    @Override
+0 −7
Original line number Diff line number Diff line
@@ -280,9 +280,6 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
        }
    };

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

    private final PinnedStackAnimationListener mIPinnedStackAnimationListener =
            new PinnedStackAnimationListener();

@@ -482,8 +479,6 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
        mIPinnedStackAnimationListener.setActivity(mActivity);
        SystemUiProxy.INSTANCE.get(getContext()).setPinnedStackAnimationListener(
                mIPinnedStackAnimationListener);
        Launcher launcher = Launcher.getLauncher(getContext());
        launcher.getRotationHelper().addForcedRotationCallback(mForcedRotationChangedListener);
        addActionsView();
    }

@@ -499,8 +494,6 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
        mIdp.removeOnChangeListener(this);
        SystemUiProxy.INSTANCE.get(getContext()).setPinnedStackAnimationListener(null);
        mIPinnedStackAnimationListener.setActivity(null);
        Launcher launcher = Launcher.getLauncher(getContext());
        launcher.getRotationHelper().removeForcedRotationCallback(mForcedRotationChangedListener);
    }

    @Override