From 7d3e0820c797c197235849e84f23d6e3a380e328 Mon Sep 17 00:00:00 2001 From: Nick Chameyev Date: Thu, 16 Mar 2023 11:01:11 +0000 Subject: [PATCH] Use committed display state in WallpaperService Uses committed display state instead of display state, so the wallpaper receive more up-to-date information about visibility as display power state could take a considerable amount of time. Test: manual, perfetto traces Bug: 273204503 Change-Id: If747112d610822df116971b60b9a0b82a686a37a --- core/java/android/service/wallpaper/WallpaperService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java index 259012f5eb30e..8d95c02512035 100644 --- a/core/java/android/service/wallpaper/WallpaperService.java +++ b/core/java/android/service/wallpaper/WallpaperService.java @@ -1458,7 +1458,7 @@ public abstract class WallpaperService extends Service { com.android.internal.R.dimen.config_wallpaperDimAmount); mWallpaperDimAmount = mDefaultDimAmount; mPreviousWallpaperDimAmount = mWallpaperDimAmount; - mDisplayState = mDisplay.getState(); + mDisplayState = mDisplay.getCommittedState(); if (DEBUG) Log.v(TAG, "onCreate(): " + this); Trace.beginSection("WPMS.Engine.onCreate"); @@ -1548,7 +1548,8 @@ public abstract class WallpaperService extends Service { return; } if (!mDestroyed) { - mDisplayState = mDisplay == null ? Display.STATE_UNKNOWN : mDisplay.getState(); + mDisplayState = mDisplay == null ? Display.STATE_UNKNOWN : + mDisplay.getCommittedState(); boolean visible = mVisible && mDisplayState != Display.STATE_OFF; if (DEBUG) { Log.v(