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

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

Lock launcher rotation during activity transition to allow

proper seamless transition at the end

Bug: 131360075
Change-Id: I2b76d4b3e0528e56b7b4709fd3708bc858bf1612
parent 07b985b5
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import static com.android.launcher3.LauncherState.OVERVIEW_PEEK;
import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_LAUNCHER_LOAD;
import static com.android.launcher3.logging.LoggerUtils.newContainerTarget;
import static com.android.launcher3.logging.LoggerUtils.newTarget;
import static com.android.launcher3.states.RotationHelper.REQUEST_NONE;
import static com.android.launcher3.util.RaceConditionTracker.ENTER;
import static com.android.launcher3.util.RaceConditionTracker.EXIT;

@@ -76,8 +77,6 @@ import android.view.accessibility.AccessibilityEvent;
import android.view.animation.OvershootInterpolator;
import android.widget.Toast;

import androidx.annotation.Nullable;

import com.android.launcher3.DropTarget.DragObject;
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
import com.android.launcher3.allapps.AllAppsContainerView;
@@ -154,6 +153,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.function.Predicate;

import androidx.annotation.Nullable;

/**
 * Default launcher application.
 */
@@ -406,6 +407,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
        super.onEnterAnimationComplete();
        UiFactory.onEnterAnimationComplete(this);
        mAllAppsController.highlightWorkTabIfNecessary();
        mRotationHelper.setCurrentTransitionRequest(REQUEST_NONE);
    }

    @Override
+14 −0
Original line number Diff line number Diff line
@@ -62,6 +62,10 @@ public class RotationHelper implements OnSharedPreferenceChangeListener {
     * Rotation request made by {@link InternalStateHandler}. This supersedes any other request.
     */
    private int mStateHandlerRequest = REQUEST_NONE;
    /**
     * Rotation request made by an app transition
     */
    private int mCurrentTransitionRequest = REQUEST_NONE;
    /**
     * Rotation request made by a Launcher State
     */
@@ -123,6 +127,13 @@ public class RotationHelper implements OnSharedPreferenceChangeListener {
        }
    }

    public void setCurrentTransitionRequest(int request) {
        if (mCurrentTransitionRequest != request) {
            mCurrentTransitionRequest = request;
            notifyChange();
        }
    }

    public void setCurrentStateRequest(int request) {
        if (mCurrentStateRequest != request) {
            mCurrentStateRequest = request;
@@ -163,6 +174,9 @@ public class RotationHelper implements OnSharedPreferenceChangeListener {
        if (mStateHandlerRequest != REQUEST_NONE) {
            activityFlags = mStateHandlerRequest == REQUEST_LOCK ?
                    SCREEN_ORIENTATION_LOCKED : SCREEN_ORIENTATION_UNSPECIFIED;
        } else if (mCurrentTransitionRequest != REQUEST_NONE) {
            activityFlags = mCurrentTransitionRequest == REQUEST_LOCK ?
                    SCREEN_ORIENTATION_LOCKED : SCREEN_ORIENTATION_UNSPECIFIED;
        } else if (mCurrentStateRequest == REQUEST_LOCK) {
            activityFlags = SCREEN_ORIENTATION_LOCKED;
        } else if (mIgnoreAutoRotateSettings || mCurrentStateRequest == REQUEST_ROTATE
+2 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static com.android.launcher3.Utilities.getBadge;
import static com.android.launcher3.Utilities.mapToRange;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.config.FeatureFlags.ADAPTIVE_ICON_WINDOW_ANIM;
import static com.android.launcher3.states.RotationHelper.REQUEST_LOCK;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -169,6 +170,7 @@ public class FloatingIconView extends View implements
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        getViewTreeObserver().addOnGlobalLayoutListener(this);
        mLauncher.getRotationHelper().setCurrentTransitionRequest(REQUEST_LOCK);
    }

    @Override