Merge "Check for nullness in WallpaperService onDestroy" into udc-dev

This commit is contained in:
Treehugger Robot
2023-04-20 14:58:47 +00:00
committed by Android (Google) Code Review

View File

@@ -2738,7 +2738,12 @@ public abstract class WallpaperService extends Service {
engineWrapper.destroy();
}
mActiveEngines.clear();
mBackgroundThread.quitSafely();
if (mBackgroundThread != null) {
// onDestroy might be called without a previous onCreate if WallpaperService was
// instantiated manually. While this is a misuse of the API, some things break
// if here we don't take into consideration this scenario.
mBackgroundThread.quitSafely();
}
Trace.endSection();
}