diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2021-09-24 02:29:18 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-09-24 02:29:18 +0000 |
| commit | 6ef0aae53bc842b51f8939e21db9abaf2c3fdca6 (patch) | |
| tree | 1a8735187b33f7c7068b72424462d7cfced54b5b | |
| parent | 6e60223a6388c6a513628c08d468015d2249484e (diff) | |
| parent | a381ebd20500bcb6d79e24bbaa9096e3464e7008 (diff) | |
Merge "Use longer timeout for reportShown call" into sc-qpr1-dev
| -rw-r--r-- | core/java/android/service/wallpaper/WallpaperService.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java index c198a492d4c9..c9a0121936dc 100644 --- a/core/java/android/service/wallpaper/WallpaperService.java +++ b/core/java/android/service/wallpaper/WallpaperService.java @@ -548,12 +548,16 @@ public abstract class WallpaperService extends Service { */ public void reportEngineShown(boolean waitForEngineShown) { if (mIWallpaperEngine.mShownReported) return; - Message message = mCaller.obtainMessage(MSG_REPORT_SHOWN); if (!waitForEngineShown) { + Message message = mCaller.obtainMessage(MSG_REPORT_SHOWN); mCaller.removeMessages(MSG_REPORT_SHOWN); mCaller.sendMessage(message); } else { - mCaller.sendMessageDelayed(message, TimeUnit.SECONDS.toMillis(1)); + // if we are already waiting, no need to reset the timeout. + if (!mCaller.hasMessages(MSG_REPORT_SHOWN)) { + Message message = mCaller.obtainMessage(MSG_REPORT_SHOWN); + mCaller.sendMessageDelayed(message, TimeUnit.SECONDS.toMillis(5)); + } } } @@ -2078,6 +2082,8 @@ public abstract class WallpaperService extends Service { mShownReported = true; try { mConnection.engineShown(this); + Log.d(TAG, "Wallpaper has updated the surface:" + + mWallpaperManager.getWallpaperInfo()); } catch (RemoteException e) { Log.w(TAG, "Wallpaper host disappeared", e); return; |
