diff options
| author | 2024-12-18 13:13:28 -0800 | |
|---|---|---|
| committer | 2024-12-18 13:13:28 -0800 | |
| commit | 52dcebf7a1e96a7e975e662c3806ed8848f28b0c (patch) | |
| tree | 1025ae56978895f5c7e6fa292f5300a515aca467 | |
| parent | 2298a41610ad32bb2bab32e7d4c2f751fa972e61 (diff) | |
Extend null check on surface control when creating BLASTSurface
Bug: b/379967338
Change-Id: I9aa362b91c991b4476ea7e8c0db5630ae842109a
Flag: NONE exempt trivial
Test: treehugger
| -rw-r--r-- | core/java/android/service/wallpaper/WallpaperService.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java index 2061abac248e..990b099d616e 100644 --- a/core/java/android/service/wallpaper/WallpaperService.java +++ b/core/java/android/service/wallpaper/WallpaperService.java @@ -2409,6 +2409,12 @@ public abstract class WallpaperService extends Service { }; private Surface getOrCreateBLASTSurface(int width, int height, int format) { + if (mBbqSurfaceControl == null || !mBbqSurfaceControl.isValid()) { + Log.w(TAG, "Skipping BlastBufferQueue update/create" + + " - invalid surface control"); + return null; + } + Surface ret = null; if (mBlastBufferQueue == null) { mBlastBufferQueue = new BLASTBufferQueue("Wallpaper", mBbqSurfaceControl, @@ -2418,11 +2424,7 @@ public abstract class WallpaperService extends Service { // it hasn't changed and there is no need to update. ret = mBlastBufferQueue.createSurface(); } else { - if (mBbqSurfaceControl != null && mBbqSurfaceControl.isValid()) { - mBlastBufferQueue.update(mBbqSurfaceControl, width, height, format); - } else { - Log.w(TAG, "Skipping BlastBufferQueue update - invalid surface control"); - } + mBlastBufferQueue.update(mBbqSurfaceControl, width, height, format); } return ret; |