Avoid a potential race condition on mDisplays

I've now run this on a HWC1 and HWC2 build. Both appear to be running
correctly.

Original Message:

The race could occur when transitioning in/out of VR flinger mode.
It is now avoided by ensuring that the primary |DisplayDevice| is always
created once |mStateLock| is released, and ensuring that all accesses
to the primary |DisplayDevice| are guarded by |mStateLock|.

Bug: 36194616
Bug: 37249613
Bug: 37288476

Test: Compiled, installed, and ran with both HWC1 and HWC2 variants.
  HWC1 was tested on Nexus 6P. Was able to boot, install apps, run apps,
  turn screen on/off, and reboot phone.
  HWC2 was tested on sailfish. Was able to boot, install apps, run apps,
  run VR apps using both N path, and O1 path, turn screen on/off, and
  reboot phone.

Change-Id: I0e80c2553f40cce2116b718bbb0d2566679f794a
7 files changed