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

Commit 35f5abc5 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Use display of activity to get rotation for recents" into...

Merge "Use display of activity to get rotation for recents" into ub-launcher3-rvc-qpr-dev am: 7416a909

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/12193289

Change-Id: Iee78d82bba07a2a1159d40290ac7221cf8314c18
parents 23331ead 7416a909
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -333,7 +333,7 @@ public abstract class BaseSwipeUpHandlerV2<T extends StatefulActivity<?>, Q exte
        if (mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)) {
            return;
        }
        mTaskViewSimulator.setRecentsConfiguration(mActivity.getResources().getConfiguration());
        mTaskViewSimulator.setRecentsRotation(mActivity.getDisplay().getRotation());

        // If we've already ended the gesture and are going home, don't prepare recents UI,
        // as that will set the state as BACKGROUND_APP, overriding the animation to NORMAL.
+2 −2
Original line number Diff line number Diff line
@@ -129,8 +129,8 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
    /**
     * @see com.android.quickstep.views.RecentsView#onConfigurationChanged(Configuration)
     */
    public void setRecentsConfiguration(Configuration configuration) {
        mOrientationState.setActivityConfiguration(configuration);
    public void setRecentsRotation(int recentsRotation) {
        mOrientationState.setRecentsRotation(recentsRotation);
        mLayoutValid = false;
    }

+2 −2
Original line number Diff line number Diff line
@@ -393,7 +393,7 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
        mActivity = BaseActivity.fromContext(context);
        mOrientationState = new RecentsOrientedState(
                context, mSizeStrategy, this::animateRecentsRotationInPlace);
        mOrientationState.setActivityConfiguration(context.getResources().getConfiguration());
        mOrientationState.setRecentsRotation(mActivity.getDisplay().getRotation());

        mFastFlingVelocity = getResources()
                .getDimensionPixelSize(R.dimen.recents_fast_fling_velocity);
@@ -1657,7 +1657,7 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
    @Override
    protected void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        if (mOrientationState.setActivityConfiguration(newConfig)) {
        if (mOrientationState.setRecentsRotation(mActivity.getDisplay().getRotation())) {
            updateOrientationHandler();
        }
    }
+2 −3
Original line number Diff line number Diff line
@@ -59,7 +59,6 @@ import com.android.systemui.plugins.OverviewScreenshotActions;
import com.android.systemui.plugins.PluginListener;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.ConfigurationCompat;

/**
 * A task in the Recents view.
@@ -385,8 +384,8 @@ public class TaskThumbnailView extends View implements PluginListener<OverviewSc
        if (mBitmapShader != null && mThumbnailData != null) {
            mPreviewRect.set(0, 0, mThumbnailData.thumbnail.getWidth(),
                    mThumbnailData.thumbnail.getHeight());
            int currentRotation = ConfigurationCompat.getWindowConfigurationRotation(
                    mActivity.getResources().getConfiguration());
            int currentRotation = getTaskView().getRecentsView().getPagedViewOrientedState()
                    .getRecentsActivityRotation();
            mPreviewPositionHelper.updateThumbnailMatrix(mPreviewRect, mThumbnailData,
                    getMeasuredWidth(), getMeasuredHeight(), mActivity.getDeviceProfile(),
                    currentRotation);
+5 −11
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import static java.lang.annotation.RetentionPolicy.SOURCE;
import android.content.ContentResolver;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.graphics.Matrix;
@@ -48,7 +47,6 @@ import android.view.Surface;

import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.launcher3.DeviceProfile;
import com.android.launcher3.InvariantDeviceProfile;
@@ -58,7 +56,6 @@ import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.util.WindowBounds;
import com.android.quickstep.BaseActivityInterface;
import com.android.quickstep.SysUINavigationMode;
import com.android.systemui.shared.system.ConfigurationCompat;

import java.lang.annotation.Retention;
import java.util.function.IntConsumer;
@@ -91,6 +88,7 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
    private @SurfaceRotation int mTouchRotation = ROTATION_0;
    private @SurfaceRotation int mDisplayRotation = ROTATION_0;
    private @SurfaceRotation int mRecentsActivityRotation = ROTATION_0;
    private @SurfaceRotation int mRecentsRotation = ROTATION_0 - 1;

    // Launcher activity supports multiple orientation, but fallback activity does not
    private static final int FLAG_MULTIPLE_ORIENTATION_SUPPORTED_BY_ACTIVITY = 1 << 0;
@@ -133,8 +131,6 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
    private int mFlags;
    private int mPreviousRotation = ROTATION_0;

    @Nullable private Configuration mActivityConfiguration;

    /**
     * @param rotationChangeListener Callback for receiving rotation events when rotation watcher
     *                              is enabled
@@ -170,11 +166,11 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
    }

    /**
     * Sets the configuration for the recents activity, which could affect the activity's rotation
     * Sets the rotation for the recents activity, which could affect the appearance of task view.
     * @see #update(int, int)
     */
    public boolean setActivityConfiguration(Configuration activityConfiguration) {
        mActivityConfiguration = activityConfiguration;
    public boolean setRecentsRotation(@SurfaceRotation int recentsRotation) {
        mRecentsRotation = recentsRotation;
        return update(mTouchRotation, mDisplayRotation);
    }

@@ -231,9 +227,7 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
    @SurfaceRotation
    private int inferRecentsActivityRotation(@SurfaceRotation int displayRotation) {
        if (isRecentsActivityRotationAllowed()) {
            return mActivityConfiguration == null
                    ? displayRotation
                    : ConfigurationCompat.getWindowConfigurationRotation(mActivityConfiguration);
            return mRecentsRotation < ROTATION_0 ? displayRotation : mRecentsRotation;
        } else {
            return ROTATION_0;
        }