Cleaner initial boot.

This does some cleanup of the initial boot, especially when
booting in "no core apps" mode for encryption/decryption.

Change-Id: Ifb3949f580e52f54559e603c4b0b104f6bac2f6c
BT is still on after enable flight mode, and reboot the DUT

bug 7275625
Change-Id: I4f8952a06152eb5f5775c1f616f6383e4f20e352

Conflicts:
	services/java/com/android/server/BluetoothManagerService.java

Signed-off-by: travp624 <travp624@gmail.com>
 BluetoothManagerService call should allow SYSTEM_UID

bug 7561429

Change-Id: I1483bfe1361f71c7ae3529ea496b33504b95413e
Add Dock USB Audio Support for Samsung Car / Desk Docks 1 of 2.

Ported from CM10, original patch: http://review.cyanogenmod.com/20586

Also includes patches:
DockAudio: Always route audio back to normal on undock.
http://review.cyanogenmod.org/24830

Bugfix: Dock events can have state greater than 1
http://review.cyanogenmod.org/24995

------------------------------------------------------

Samsung docks have a non-sensing USB adio port.
Samsung get around this by having a separate Setting to route the Audio
The Changes made will only add the extra Observer if the Kernel supports the endpoint

  /sys/class/switch/dock/state

A new BroadcastReciever (SettingsChangedReceiver) is used to watch out for users changing the
Preference

The choice is made in the GalaxyS2Settings.apk (see 2 of 2)

  device/samsung/i9100/DeviceSettings/src/com/cyanogenmod/settings/device/DockFragmentActivity.java

After OnBootComplete and when the checkbox is changed, an Intent is triggered to this class.

When a Dock Event is caught if it is one the Samsung endpoint "dock" then if the users preference is
checked,
then the event is allowed to go on and route the audio.  If it is not checked then it is ignored.

Change-Id: I8e8f5001d5c651b07bb6af496bbf806732be21fa
Fix HTC headset handling.

HTC's headset driver adds additional bits to the switch state, which
we're unable to deal with. Fix that by masking out those bits and
keeping only the valid ones.

Change-Id: I29f0de9520ebb56d61acbc9a6dfcfc73e1f297d8
Just a whole lot of cleanup merged from cm/cm-10.1 into jb-4.2

Signed-off-by: travp624 <travp624@gmail.com>