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

Commit 7368fa43 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Skip state animation if animations are disabled

> Also update the animation disabled check to use new-API

Bug: 118678948
Change-Id: Ib709844e34bdb7e369b368a7c33f2e8ff120024b
parent bf81b2ca
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ import android.util.AttributeSet;
import android.util.Pair;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import androidx.annotation.IntDef;
@@ -120,7 +119,7 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
    }

    public final void close(boolean animate) {
        animate &= !Utilities.isPowerSaverPreventingAnimation(getContext());
        animate &= Utilities.areAnimationsEnabled(getContext());
        if (mIsOpen) {
            BaseActivity.fromContext(getContext()).getUserEventDispatcher()
                    .resetElapsedContainerMillis("container closed");
+1 −1
Original line number Diff line number Diff line
@@ -1983,7 +1983,7 @@ public class CellLayout extends ViewGroup {
            // Animations are disabled in power save mode, causing the repeated animation to jump
            // spastically between beginning and end states. Since this looks bad, we don't repeat
            // the animation in power save mode.
            if (!Utilities.isPowerSaverPreventingAnimation(getContext())) {
            if (Utilities.areAnimationsEnabled(getContext())) {
                va.setRepeatMode(ValueAnimator.REVERSE);
                va.setRepeatCount(ValueAnimator.INFINITE);
            }
+1 −0
Original line number Diff line number Diff line
@@ -222,6 +222,7 @@ public class LauncherStateManager {

    private void goToState(LauncherState state, boolean animated, long delay,
            final Runnable onCompleteRunnable) {
        animated &= Utilities.areAnimationsEnabled(mLauncher);
        if (mLauncher.isInState(state)) {
            if (mConfig.mCurrentAnimation == null) {
                // Run any queued runnable
+5 −6
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.launcher3;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT;

import android.animation.ValueAnimator;
import android.app.ActivityManager;
import android.app.WallpaperManager;
import android.content.BroadcastReceiver;
@@ -517,12 +518,10 @@ public final class Utilities {
                LauncherFiles.DEVICE_PREFERENCES_KEY, Context.MODE_PRIVATE);
    }

    public static boolean isPowerSaverPreventingAnimation(Context context) {
        if (ATLEAST_P) {
            // Battery saver mode no longer prevents animations.
            return false;
        }
        return context.getSystemService(PowerManager.class).isPowerSaveMode();
    public static boolean areAnimationsEnabled(Context context) {
        return ATLEAST_OREO
                ? ValueAnimator.areAnimatorsEnabled()
                : !context.getSystemService(PowerManager.class).isPowerSaveMode();
    }

    public static boolean isWallpaperAllowed(Context context) {