summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-04-22 19:36:44 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-04-22 19:36:44 +0000
commitf31848fe8dbb7b360a90cab7c6cbc40cfa99e590 (patch)
treedfc28f7ef50706c5e5d67e0c0757a1ae68a2bd4d /src
parent4c8d7a04019fbd4f97e0a83ae0ffe6e595815a5e (diff)
parent7368fa4369bbd003f862f75fe9b3ac8975d48cd0 (diff)
downloadandroid_packages_apps_Trebuchet-f31848fe8dbb7b360a90cab7c6cbc40cfa99e590.tar.gz
android_packages_apps_Trebuchet-f31848fe8dbb7b360a90cab7c6cbc40cfa99e590.tar.bz2
android_packages_apps_Trebuchet-f31848fe8dbb7b360a90cab7c6cbc40cfa99e590.zip
Merge "Skip state animation if animations are disabled" into ub-launcher3-qt-dev
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/AbstractFloatingView.java3
-rw-r--r--src/com/android/launcher3/CellLayout.java2
-rw-r--r--src/com/android/launcher3/LauncherStateManager.java1
-rw-r--r--src/com/android/launcher3/Utilities.java11
4 files changed, 8 insertions, 9 deletions
diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java
index 3cb6ba67f..d6f992f51 100644
--- a/src/com/android/launcher3/AbstractFloatingView.java
+++ b/src/com/android/launcher3/AbstractFloatingView.java
@@ -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");
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index a117cfd15..9d9a639d8 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -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);
}
diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java
index eff0619d0..209578d22 100644
--- a/src/com/android/launcher3/LauncherStateManager.java
+++ b/src/com/android/launcher3/LauncherStateManager.java
@@ -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
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index fd4b5086b..75984500b 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -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) {