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

Commit 17ee527e authored by Stefan Andonian's avatar Stefan Andonian
Browse files

Don't show FloatingIconView during Back to Home Animation when animations are disabled.

Bug: 235915161
Test: Reproduced the issue locally, then verified that the fix worked as
desired without introducing unwanted side effects.

Change-Id: I3db3b2ddbd34a2ef19eae10282758df32c2d5b3f
parent e8f7dd5a
Loading
Loading
Loading
Loading
+29 −1
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ import static com.android.launcher3.config.FeatureFlags.KEYGUARD_ANIMATION;
import static com.android.launcher3.config.FeatureFlags.SEPARATE_RECENTS_ACTIVITY;
import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID;
import static com.android.launcher3.util.DisplayController.isTransientTaskbar;
import static com.android.launcher3.util.Executors.ORDERED_BG_EXECUTOR;
import static com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VALUE;
import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs;
import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION;
@@ -78,6 +79,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Point;
@@ -92,6 +94,7 @@ import android.os.Looper;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Settings.Global;
import android.util.Pair;
import android.util.Size;
import android.view.CrossWindowBlurListeners;
@@ -231,6 +234,16 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener

    private final StartingWindowListener mStartingWindowListener =
            new StartingWindowListener(this);
    private ContentObserver mAnimationRemovalObserver = new ContentObserver(
            ORDERED_BG_EXECUTOR.getHandler()) {
        @Override
        public void onChange(boolean selfChange) {
            mAreAnimationsEnabled = Global.getFloat(mLauncher.getContentResolver(),
                    Global.ANIMATOR_DURATION_SCALE, 1f) > 0
                    || Global.getFloat(mLauncher.getContentResolver(),
                    Global.TRANSITION_ANIMATION_SCALE, 1f) > 0;
        }
    };;

    private DeviceProfile mDeviceProfile;

@@ -260,6 +273,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
    // Pairs of window starting type and starting window background color for starting tasks
    // Will never be larger than MAX_NUM_TASKS
    private LinkedHashMap<Integer, Pair<Integer, Integer>> mTaskStartParams;
    private boolean mAreAnimationsEnabled = true;

    private final Interpolator mOpeningXInterpolator;
    private final Interpolator mOpeningInterpolator;
@@ -270,6 +284,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
        mHandler = new Handler(Looper.getMainLooper());
        mDeviceProfile = mLauncher.getDeviceProfile();
        mBackAnimationController = new LauncherBackAnimationController(mLauncher, this);
        checkAndMonitorIfAnimationsAreEnabled();

        Resources res = mLauncher.getResources();
        mClosingWindowTransY = res.getDimensionPixelSize(R.dimen.closing_window_trans_y);
@@ -1160,6 +1175,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
        unregisterRemoteAnimations();
        unregisterRemoteTransitions();
        SystemUiProxy.INSTANCE.get(mLauncher).setStartingWindowListener(null);
        ORDERED_BG_EXECUTOR.execute(() -> mLauncher.getContentResolver()
                .unregisterContentObserver(mAnimationRemovalObserver));
    }

    private void unregisterRemoteAnimations() {
@@ -1197,6 +1214,17 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
        }
    }

    private void checkAndMonitorIfAnimationsAreEnabled() {
        ORDERED_BG_EXECUTOR.execute(() -> {
            mAnimationRemovalObserver.onChange(true);
            mLauncher.getContentResolver().registerContentObserver(Global.getUriFor(
                    Global.ANIMATOR_DURATION_SCALE), false, mAnimationRemovalObserver);
            mLauncher.getContentResolver().registerContentObserver(Global.getUriFor(
                    Global.TRANSITION_ANIMATION_SCALE), false, mAnimationRemovalObserver);

        });
    }

    private boolean launcherIsATargetWithMode(RemoteAnimationTarget[] targets, int mode) {
        for (RemoteAnimationTarget target : targets) {
            if (target.mode == mode && target.taskInfo != null
@@ -1375,7 +1403,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
                    (LauncherAppWidgetHostView) launcherView, targetRect, windowSize,
                    mDeviceProfile.isMultiWindowMode ? 0 : getWindowCornerRadius(mLauncher),
                    isTransluscent, fallbackBackgroundColor);
        } else if (launcherView != null) {
        } else if (launcherView != null && mAreAnimationsEnabled) {
            floatingIconView = getFloatingIconView(mLauncher, launcherView, null,
                    mLauncher.getTaskbarUIController() == null
                            ? null
+6 −0
Original line number Diff line number Diff line
@@ -48,6 +48,12 @@ public class Executors {
    public static final ThreadPoolExecutor THREAD_POOL_EXECUTOR = new ThreadPoolExecutor(
            POOL_SIZE, POOL_SIZE, KEEP_ALIVE, TimeUnit.SECONDS, new LinkedBlockingQueue<>());

    /**
     * An {@link LooperExecutor} to be used with async task where order is important.
     */
    public static final LooperExecutor ORDERED_BG_EXECUTOR = new LooperExecutor(
            createAndStartNewLooper("BackgroundExecutor", THREAD_PRIORITY_BACKGROUND));

    /**
     * Returns the executor for running tasks on the main thread.
     */