Fix b/318722891 (unwanted onSurfaceCreated event)

Inside updateSurface, use onVisibilityChanged directly instead of
doVisibilityChanged when a surface has been created. doVisibilityChanged
will trigger another call to updateSurface wich will check for
"mSurfaceCreated" to see if we need to create the surface. But at this
point the first call of updateSurface has created the surface but not
yet flipped the "mSurfaceCreated" boolean (it is done right after the
doVisibilityChanged call). Using onVisibilityChanged fixes the issue:
also we're guaranteed that the wallpaper is invisible when calling
onVisibilityChangedt(true) since there is a if (!mReportedVisible)
check.

Flag: ACONFIG com.android.window.flags.no_consecutive_visibility_events
STAGING
Bug: 318722891
Test: atest WallpaperManagerTest

Change-Id: Ia4b775454ea9f3a57f78b55c29d56879773f5e76
1 file changed