audio: Fixed dead lock in AudioService during volume change

- AudioService goes into dead lock when there is a volume
  change for source stream and the respective aliased stream
  simultaneously from multiple threads
- When setIndex is called for source stream, it also updates
  the index for the aliased streams. Meantime, setAllIndexes
  is called on aliased stream. Initially, it gets index of
  default device of source stream. It requires lock on the
  source stream. This is leading to a dead lock
- Fix is to avoid locking parent while updating child
  streams. Removing lock from method and synchronizing
  parent only when it is updating member variable.

Change-Id: Id38e539e2ec178ea25548312a1dd62d2de3043da
CRs-fixed: 635789
audio: Inform audio HAL if it is a voice call initiated by Telephony

setMode() API with IN_CALL mode can be called by any of the Apps.
In HAL, it is required to distinguish if it is a real voice call
or not. Inform to audio HAL if it is a voice call by checking
getPhonestate() updated by telephony.

CRs-Fixed: 662804
Change-Id: I20a661f49f6566bdd1e23d6de18b509e2728ef19
frameworks/base: Fix binder parcel leak with getMetadata() API

When VideoView calls getMetadata API of MediaPlayer, parcel object
is getting allocated by MediaPlayer and metadata is created over
parcel object. This metadata object is returned to the VideoView
which is being GC without calling recycle on parcel which was
creating leak in binder virtual memory.

CRs-fixed: 669303
Change-Id: I1e265909ee42d4fabd8b2552668b3d84af994294
Revert " Audio: SetForceUse config check in AudioService"

This reverts commit 0af88afe6dc16760b57afa74ca42e40fbe6ff9cf.

- During playback over BT using the Google Play Music app,
  if BT is disconnected through the app and playback is resumed,
  it continues over BT and not the speaker.
- The original commit forces playback to continue over BT
  although it is disconnected.
- Reverting the commit fixes this issue and the issue
  addressed by the commit is also not observed after reversion.

CRs-Fixed: 679301
Change-Id: Ic4d0f13615c696a12401f7a8a58651b88f31e99b
add framework torch service

Signed-off-by: Roman Birg <roman@cyngn.com>

Conflicts:

	core/java/android/content/Context.java

Change-Id: I0c7a055b33fdebe697f23d207b20408e06eb74a8
Fully fix interaction between torch and camera usage.

For doing this, two things are necessary:
- The torch shutdown needs to be synchronous, so that the torch app has
  a chance to release the camera before the camera app tries to use it.
- The torch service needs to track camera usage, so that it can notify
  the torch app if a camera is busy.

Change-Id: I521091d255ff4c251d97a0e8d65c9d2a80b9dae4