Skip to content
Commit d8e4fb78 authored by Robert Carr's avatar Robert Carr
Browse files

AppWindowToken: Guard against null SurfaceControl in prepareSurfaces

It seems this code was written with the assumption that if prepareSurfaces
is called, then we must be attached to the hiearchy and we must have
a valid surface. As always though, the story runs deeper. We can actually
call AppWindowToken#prepareSurfaces within the scope of AppWindowToken#removeImmediately.
This transpires via these steps:
     1. AppWindowToken removes children.
     2. Child windowstate calls WMS#postWindowRemoveCleanupLocked
     3. WMS immediately performs surface placement.
     4. Surface placement leads to AppWindowToken#prepareSurfaces.

This means that prepareSurfaces can be called after we have set mSurfaceControl
to null but before the parent has removed us from its list, and that the assumption
that the control must be non-null in prepareSurfaces was false.

Bug: 123606376
Test: Makes one of them crash less
Change-Id: Ic2985cb6f2a31613de5942926b036fd24a91e68a
parent ffa0d6c9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment