PackageManager: Fix concurrent access to shared state

Stop multiple threads from all calling add on the same HashMap.

Cleanup the use of a boolean flag by removing concurrent writes
to it.

Change-Id: I8d61fe7294dcb67ee7d0d7de88d90d2051c310e6
Send Media button events as foreground Intent

Send foreground intent for Media Button events to Music Player
so that there is no delay in handling these Intents after the
device is rebooted.

Change-Id: I952a8af93586cb96c0a9f6dc910bfb49287f4b9a
CRs-fixed: 611219
Bluetooth:Settings:Handled ACTION_STATE_CHANGED intent at boot time

BluetoothAdapter.ACTION_STATE_CHANGED intent is added to foreground
activity to handle BT sync issue with  Power widget at the boot time

Change-Id: Ib26cb4630c711587da789dc920aa66ded97a9a3b
CRs-Fixed: 576879
Bluetooth: Adds check to verify Bluetooth adapter state

This checks whether bluetooth is turned ON or not in
BLE stop scan process. BLE scan apis are called from applications
so need to check if BT adapter state is ON to avoid Bluetooth
crash

Change-Id: Ifc472be9b3f8baf978d6cdca2e4743a75b951635
CRs-Fixed: 634617