Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 5f2a7bd5 authored by Aurélien Pomini's avatar Aurélien Pomini
Browse files

Avoid sending two onSurfaceDestroyed() events

It has been observed that in some cases the onSurfaceDestroyed() event
could be sent twice, once from updateSurface and once from detach, while
onSurfaceCreated was only sent once. This is an issue since some
wallpapers (e.g. AndroidLiveWallpaperService subclasses) use
onSurfaceCreated and onSurfaceDestroyed to count the number of active
engines and pause or resume the wallpaper accordingly.

By creating a new flag mReportedSurfaceCreated, and setting it to true
right before onSurfaceCreated, and to false right before
onSurfaceDestroyed, and by checking its value before calling
onSurfaceDestroyed, we avoid calling onSurfaceDestroyed twice.

There is no need to add a check before calling onSurfaceCreated, the
mSurfaceCreated flag already avoids two consecutive onSurfaceCreated
calls.

Flag: com.android.window.flags.no_duplicate_surface_destroyed_events
Bug: 344461715
Test: treehugger, soak the flag and see if bug still exists
Change-Id: I0498d7689bd7636fb7c208f6fccdfba15df86440
parent 90e48229
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment