Merge "Use longer timeout for reportShown call" into sc-qpr1-dev am: 6ef0aae53b am: a793d7a0e3

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15834211

Change-Id: I14b2896020bb214a70077b040d29de28e85cc3cc
This commit is contained in:
TreeHugger Robot
2021-09-24 02:56:42 +00:00
committed by Automerger Merge Worker

View File

@@ -561,12 +561,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));
}
}
}
@@ -2256,6 +2260,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;