summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vania Desmonda <vaniadesmonda@google.com> 2022-05-13 09:00:06 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-05-13 09:00:06 +0000
commit4864cabf0dfc9ca409a1bfa89cbaf8e1be25c43b (patch)
treefb0aa51b1baedca9246309c48a68792a8c6f9d78
parent1a79cffcb9b736161d15e2a295345c4d3066d2d2 (diff)
parenteb0f10153f430d52d0e90f4b2845309c9c645f1c (diff)
Merge "Prevent duplicate calls to updateSurface() and recursive call to updateSurfaceDimming()." into tm-dev am: eb0f10153f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18343949 Change-Id: I2a8db7cc5422b507438f52e998c60876bbe57a21 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--core/java/android/service/wallpaper/WallpaperService.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index 425dbb9cb204..d598017dacaa 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -888,7 +888,6 @@ public abstract class WallpaperService extends Service {
if (mShouldDimByDefault != mShouldDim && mWallpaperDimAmount == 0f) {
mShouldDim = mShouldDimByDefault;
updateSurfaceDimming();
- updateSurface(false, false, true);
}
}
@@ -898,13 +897,16 @@ public abstract class WallpaperService extends Service {
* @param dimAmount Float amount between [0.0, 1.0] to dim the wallpaper.
*/
private void updateWallpaperDimming(float dimAmount) {
+ if (dimAmount == mWallpaperDimAmount) {
+ return;
+ }
+
// Custom dim amount cannot be less than the default dim amount.
mWallpaperDimAmount = Math.max(mDefaultDimAmount, dimAmount);
// If dim amount is 0f (additional dimming is removed), then the wallpaper should dim
// based on its default wallpaper color hints.
mShouldDim = dimAmount != 0f || mShouldDimByDefault;
updateSurfaceDimming();
- updateSurface(false, false, true);
}
private void updateSurfaceDimming() {
@@ -941,6 +943,7 @@ public abstract class WallpaperService extends Service {
} else {
Log.v(TAG, "Setting wallpaper dimming: " + 0);
surfaceControlTransaction.setAlpha(mBbqSurfaceControl, 1.0f).apply();
+ updateSurface(false, false, true);
}
mPreviousWallpaperDimAmount = mWallpaperDimAmount;
@@ -1195,7 +1198,6 @@ public abstract class WallpaperService extends Service {
.setParent(mSurfaceControl)
.setCallsite("Wallpaper#relayout")
.build();
- updateSurfaceDimming();
}
// Propagate transform hint from WM, so we can use the right hint for the
// first frame.
@@ -1366,7 +1368,6 @@ public abstract class WallpaperService extends Service {
mSession.finishDrawing(mWindow, null /* postDrawTransaction */,
Integer.MAX_VALUE);
processLocalColors(mPendingXOffset, mPendingXOffsetStep);
- notifyColorsChanged();
}
reposition();
reportEngineShown(shouldWaitForEngineShown());