Smoother Lockscreen framework on Low End devices

Devices with less than 512 MB 'usable' RAM

Change-Id: I4d198c4d8ec5b779f5d302cc8207ff56c8dcd88b
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

Conflicts:

	services/java/com/android/server/WiredAccessoryManager.java
Custom carrier text (2/2)
same as the other commit

Change-Id: I34e8de1921dce740454101020a1f259cb89f02e2