Loading packages/SystemUI/aconfig/systemui.aconfig +0 −10 Original line number Diff line number Diff line Loading @@ -555,16 +555,6 @@ flag { bug: "335828150" } flag { name: "fix_image_wallpaper_crash_surface_already_released" namespace: "systemui" description: "Make sure ImageWallpaper doesn't return from OnSurfaceDestroyed until any drawing is finished" bug: "337287154" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "activity_transition_use_largest_window" namespace: "systemui" Loading packages/SystemUI/src/com/android/systemui/wallpapers/ImageWallpaper.java +10 −38 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.app.WallpaperManager.FLAG_LOCK; import static android.app.WallpaperManager.FLAG_SYSTEM; import static android.app.WallpaperManager.SetWallpaperFlags; import static com.android.systemui.Flags.fixImageWallpaperCrashSurfaceAlreadyReleased; import static com.android.window.flags.Flags.multiCrop; import static com.android.window.flags.Flags.offloadColorExtraction; Loading Loading @@ -240,19 +239,9 @@ public class ImageWallpaper extends WallpaperService { if (DEBUG) { Log.i(TAG, "onSurfaceDestroyed"); } if (fixImageWallpaperCrashSurfaceAlreadyReleased()) { synchronized (mSurfaceLock) { mSurfaceHolder = null; } return; } mLongExecutor.execute(this::onSurfaceDestroyedSynchronized); } private void onSurfaceDestroyedSynchronized() { synchronized (mLock) { mSurfaceHolder = null; } } @Override Loading Loading @@ -282,16 +271,10 @@ public class ImageWallpaper extends WallpaperService { } private void drawFrameInternal() { if (mSurfaceHolder == null && !fixImageWallpaperCrashSurfaceAlreadyReleased()) { Log.i(TAG, "attempt to draw a frame without a valid surface"); return; } // load the wallpaper if not already done if (!isBitmapLoaded()) { loadWallpaperAndDrawFrameInternal(); } else { if (fixImageWallpaperCrashSurfaceAlreadyReleased()) { synchronized (mSurfaceLock) { if (mSurfaceHolder == null) { Log.i(TAG, "Surface released before the image could be drawn"); Loading @@ -301,14 +284,8 @@ public class ImageWallpaper extends WallpaperService { drawFrameOnCanvas(mBitmap); reportEngineShown(false); unloadBitmapIfNotUsedInternal(); return; } } mBitmapUsages++; drawFrameOnCanvas(mBitmap); reportEngineShown(false); unloadBitmapIfNotUsedInternal(); } } @VisibleForTesting Loading Loading @@ -364,14 +341,9 @@ public class ImageWallpaper extends WallpaperService { mBitmap.recycle(); } mBitmap = null; if (fixImageWallpaperCrashSurfaceAlreadyReleased()) { synchronized (mSurfaceLock) { if (mSurfaceHolder != null) mSurfaceHolder.getSurface().hwuiDestroy(); } } else { final Surface surface = getSurfaceHolder().getSurface(); surface.hwuiDestroy(); } mWallpaperManager.forgetLoadedWallpaper(); Trace.endSection(); } Loading Loading
packages/SystemUI/aconfig/systemui.aconfig +0 −10 Original line number Diff line number Diff line Loading @@ -555,16 +555,6 @@ flag { bug: "335828150" } flag { name: "fix_image_wallpaper_crash_surface_already_released" namespace: "systemui" description: "Make sure ImageWallpaper doesn't return from OnSurfaceDestroyed until any drawing is finished" bug: "337287154" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "activity_transition_use_largest_window" namespace: "systemui" Loading
packages/SystemUI/src/com/android/systemui/wallpapers/ImageWallpaper.java +10 −38 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import static android.app.WallpaperManager.FLAG_LOCK; import static android.app.WallpaperManager.FLAG_SYSTEM; import static android.app.WallpaperManager.SetWallpaperFlags; import static com.android.systemui.Flags.fixImageWallpaperCrashSurfaceAlreadyReleased; import static com.android.window.flags.Flags.multiCrop; import static com.android.window.flags.Flags.offloadColorExtraction; Loading Loading @@ -240,19 +239,9 @@ public class ImageWallpaper extends WallpaperService { if (DEBUG) { Log.i(TAG, "onSurfaceDestroyed"); } if (fixImageWallpaperCrashSurfaceAlreadyReleased()) { synchronized (mSurfaceLock) { mSurfaceHolder = null; } return; } mLongExecutor.execute(this::onSurfaceDestroyedSynchronized); } private void onSurfaceDestroyedSynchronized() { synchronized (mLock) { mSurfaceHolder = null; } } @Override Loading Loading @@ -282,16 +271,10 @@ public class ImageWallpaper extends WallpaperService { } private void drawFrameInternal() { if (mSurfaceHolder == null && !fixImageWallpaperCrashSurfaceAlreadyReleased()) { Log.i(TAG, "attempt to draw a frame without a valid surface"); return; } // load the wallpaper if not already done if (!isBitmapLoaded()) { loadWallpaperAndDrawFrameInternal(); } else { if (fixImageWallpaperCrashSurfaceAlreadyReleased()) { synchronized (mSurfaceLock) { if (mSurfaceHolder == null) { Log.i(TAG, "Surface released before the image could be drawn"); Loading @@ -301,14 +284,8 @@ public class ImageWallpaper extends WallpaperService { drawFrameOnCanvas(mBitmap); reportEngineShown(false); unloadBitmapIfNotUsedInternal(); return; } } mBitmapUsages++; drawFrameOnCanvas(mBitmap); reportEngineShown(false); unloadBitmapIfNotUsedInternal(); } } @VisibleForTesting Loading Loading @@ -364,14 +341,9 @@ public class ImageWallpaper extends WallpaperService { mBitmap.recycle(); } mBitmap = null; if (fixImageWallpaperCrashSurfaceAlreadyReleased()) { synchronized (mSurfaceLock) { if (mSurfaceHolder != null) mSurfaceHolder.getSurface().hwuiDestroy(); } } else { final Surface surface = getSurfaceHolder().getSurface(); surface.hwuiDestroy(); } mWallpaperManager.forgetLoadedWallpaper(); Trace.endSection(); } Loading