Extract methods to enter standby and standby mode

Also move initial standby from to threadLoop to avoid a race condition.

Change-Id: I65afca83c36fb41b983b3b1d3dab35d4029560e3
Clean up start() parameters

Document where int is used instead of AudioSystem::sync_event_t
  (probably because of a header file dependency).
TrackBase::start() and RecordTrack::start() don't need default parameters.

Change-Id: I82f4a4d078be900f3aa4bd926697e32f5ed68ec8
Swap the order of creating IAudioTrack and thread

Simplifies the error recovery in case IAudioTrack fails.

Change-Id: I6aee41a2ac747a5689fb4836b04174e6107bf32f
am b3192c5a: Reconcile with jb-release

* commit 'b3192c5abf7321cb3437a3aedacd632311634bff':
Merge "Removed a CHECK_EQ that is not needed."
Merge remote-tracking branch 'goog/jb-dev-mako' into jb-mr1-dev

Conflicts:
	services/audioflinger/AudioFlinger.cpp

Change-Id: If27e4ff35de1e182394cc149e1557a49f0f7c95b
am 9fbe9429: Merge remote-tracking branch \'goog/jb-dev-mako\' into jb-mr1-dev

* commit '9fbe94294ce2053d102ff5de89846a0c5015fb58':
  NuPlayer: Prevents creation of Video Decoder when we use Music Player
  Synchronize access to OMX class member variables
  Merge from jb-dev for "sample video corruption in MediaCodec mode." DO NOT MERGE
  libstagefright: dynamically load libstagefright_chromium_http
  Process EBD and FBD messages in ERROR state
  Add vendor specific output color format
merge in jb-mr1-release history after reset to jb-mr1-dev
Refactoring how the box table entries are stored in MPEG4Writer

o Helps drastically reduce the time writing all the box table entries for long duration video recording sessions.
  Experiments showed that the time is reduced from multiple seconds to less than one second for around 2.5 hours of video recording.

Change-Id: I6a696823e2938b76fcf2c73605f51bf5e5c2d749

related-to-bug: 6435176
Reconcile with jb-mr1-release

Change-Id: Ic0cdae375d796efb3dc07956e03fea062557b765
Should really compare the pos to the total number of values in get() and set() methods in ListTableEntries class

o related-to-bug: 6435176

Change-Id: Ib6f6e598304e7c9becfa6cb3fc925c55b2df2682
am c620cbd7: Refactoring how the box table entries are stored in MPEG4Writer

* commit 'c620cbd7f8dc75f6819e2b862d3c09970560bc63':
  Refactoring how the box table entries are stored in MPEG4Writer
merge in jb-mr1-release history after reset to jb-mr1-dev
Sync with jb-mr1-dev

Change-Id: I5bd4d44e0e33d28487c04a27652469697478ecd4
Allows MediaMetadataRetriever to retrieve video rotation angle

o related-to-bug: 6872687

Change-Id: I34e74b0756f8269edefdf3a25d8806c76fd1e2f8
Camera2: Improve threading safety

Merge mutex lock for accessing internal parameters with the parameter
structure, forcing a lock to be held before the parameters can be accessed.

Bug: 6243944
Change-Id: I86e44f395de0d80ff7c3ff3530f25b60015512d2
Camera2: Improve formatting of debugging dump

Bug: 6243944
Change-Id: Id8730357f3adcd96923132f9f702e296e0dfd357
Reconcile with jb-mr1-release - do not merge

Change-Id: I2c45a6566f7eff107fa320d407fce712616e6801
am 836b81f3: Camera2: Improve threading safety

* commit '836b81f3c5a5bacb800f698f90ded6bd6e6bc5ce':
  Camera2: Improve threading safety
am 428b77a2: Camera2: Improve formatting of debugging dump

* commit '428b77a2b94b74665a47375b3fdb893b98d71269':
  Camera2: Improve formatting of debugging dump