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

Commit 5d835bcd authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Enable RotationWatcher when home rotation is on

Update the PagedOrientationHandler when launcher
is allowed to rotate to ensure the correct one
gets set.

Fixes: 157173248
Change-Id: Iffb9df479fcccfb0fe2bd462167242b592949f69
parent 2c75d088
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -1047,6 +1047,11 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
    }
    }


    private void animateRecentsRotationInPlace(int newRotation) {
    private void animateRecentsRotationInPlace(int newRotation) {
        if (mOrientationState.canLauncherRotate()) {
            // Update the rotation but let system take care of the rotation animation
            setLayoutRotation(newRotation, mOrientationState.getDisplayRotation());
            return;
        }
        AnimatorSet pa = setRecentsChangedOrientation(true);
        AnimatorSet pa = setRecentsChangedOrientation(true);
        pa.addListener(AnimationSuccessListener.forRunnable(() -> {
        pa.addListener(AnimationSuccessListener.forRunnable(() -> {
            setLayoutRotation(newRotation, mOrientationState.getDisplayRotation());
            setLayoutRotation(newRotation, mOrientationState.getDisplayRotation());
+3 −3
Original line number Original line Diff line number Diff line
@@ -203,7 +203,7 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
        mDisplayRotation = displayRotation;
        mDisplayRotation = displayRotation;
        mTouchRotation = touchRotation;
        mTouchRotation = touchRotation;


        if (mLauncherRotation == mTouchRotation) {
        if (mLauncherRotation == mTouchRotation || canLauncherRotate()) {
            mOrientationHandler = PagedOrientationHandler.HOME_ROTATED;
            mOrientationHandler = PagedOrientationHandler.HOME_ROTATED;
            if (DEBUG) {
            if (DEBUG) {
                Log.d(TAG, "current RecentsOrientedState: " + this);
                Log.d(TAG, "current RecentsOrientedState: " + this);
@@ -235,7 +235,7 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre


    private void setFlag(int mask, boolean enabled) {
    private void setFlag(int mask, boolean enabled) {
        boolean wasRotationEnabled = !TestProtocol.sDisableSensorRotation
        boolean wasRotationEnabled = !TestProtocol.sDisableSensorRotation
                && mFlags == VALUE_ROTATION_WATCHER_ENABLED;
                && (mFlags & VALUE_ROTATION_WATCHER_ENABLED) == VALUE_ROTATION_WATCHER_ENABLED;
        if (enabled) {
        if (enabled) {
            mFlags |= mask;
            mFlags |= mask;
        } else {
        } else {
@@ -243,7 +243,7 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
        }
        }


        boolean isRotationEnabled = !TestProtocol.sDisableSensorRotation
        boolean isRotationEnabled = !TestProtocol.sDisableSensorRotation
                && mFlags == VALUE_ROTATION_WATCHER_ENABLED;
                && (mFlags & VALUE_ROTATION_WATCHER_ENABLED) == VALUE_ROTATION_WATCHER_ENABLED;
        if (wasRotationEnabled != isRotationEnabled) {
        if (wasRotationEnabled != isRotationEnabled) {
            UI_HELPER_EXECUTOR.execute(() -> {
            UI_HELPER_EXECUTOR.execute(() -> {
                if (isRotationEnabled) {
                if (isRotationEnabled) {