PowerWidget: Soundbutton bugfix

PowerWidget Soundbutton working correctly now.

Change-Id: Ic0d9714c82734e9afac843995bd16d09736f85cf
Fix restoring network mode preference on reboot.

When a user sets the option to use only 2G networks (for GSM networks) or its
equivalent for CDMA networks, each reboot erases that setting. That forces
the user to re-select the same option after each boot.
This (very simple) patch fixes it.

Change-Id: Ib9e4bba6da705c127ce1f3aa3c242b9262541cee
Improve scrolling cache

Scrolling cache helps make short scrolls/flings smooth but will
cause stutter when long flings are made. This patch disables
scrolling cache when long flings are made.

This patch also fixes a related bug where scrolling cache will
not be enabled properly when transitioning from flinging to scrolling.

Patch Set 2: Calculate threshold based on maximum velocity (Sang Tae Park)

Change-Id: I1fdbaad92263c9f983a32900e74eba1f0367902b
framework: fix notification icons not animating till ticker is updated
ActivityManager: Fix getCurrentUser() transaction

It was actually invoking switchUser()... :\

Change-Id: If9ab9effa4816c12d14d8f53df4ab131ac320d0c
SystemUI: Use config_screenBrightnessDim for min brightness

Replaces android.os.PowerManager.BRIGHTNESS_DIM (hardcoded to
20) to match slider values in brightness preferences and overlayed
configuration.

Change-Id: Ia586bd90eaadea8c47c7a850745891bc535d0081
AutoRotateButton : Minor cleanup

Use setRotationLock to avoid code duplication and staying consistent with framework.

Change-Id: I3268c049b723684fbd173911d098aa7b089c1d06
Return early when checking divider before child zero.

Previously the `getChildAt` method would be called with an index of -1 which
would lead to an exception being thrown and caught. This is unnecessary since
we know there will never be a divider before the first child. It also avoids
additional object creation since this method can be invoked quite frequently.

Change-Id: Iab44520d5d52f96a829a009cdd1201696edbf9a4
KeyguardViewMediator: fix NPE when DEBUG=true

Change-Id: Icc6f708ff11db3f67cbea6ce219d21cabc34cfdc
sensors: Add dummy light sensor
sensors: dummy ls: set unique handle

handles and types are usually the same, but it's not mandatory.
Sony DASH use custom handles, and the previous assumption broke
Proximity sensor on Sony devices.

Change-Id: I954e13765f42341e6b5393a12556f6a007c4e494
Fix automatic brightness

Broken in Iddcbee98f6588bba428c4059e786d946d7ce2298

- Brightness is now handled in handleLightSensorValue instead of
  onSensorChanged, but the previous patch copied the old handling
  code into onSensorChanged in addition to calling handleLightSensorValue.
  This patch integrates the brightness filter change from
  onSensorChanged into handleLightSensorValue.
- onSensorChanged called mHandler.removeCallbacks(mAutoBrightnessTask)
  every time a value is received from the sensor ensuring that the
  task never get ran! (We schedule it 2 seconds into the future
  but receives a value from the sensor every second.)
  This patch removes the call.

(Note: similar to http://review.cyanogenmod.com/11341)

Change-Id: Id3e4f0f02f91f27c7c12cb2e274e0c13213d4774
Revert:  Fix automatic brightness
Revert:  ActivityManager: Fix getCurrentUser() transaction
String for Settings:  Setting to turn off power optimizations