frameworks/base: Fix to avoid crash when the tab is not set from app

As the current tab is not set from application, getChildTabViewAt
returns Null value. Added a condition which checks whether mSelectTab
is set to first Tab.

(cherry picked from commit 9be6755efb149b22c36aa3eb7cc4ffe7e765e08a)

Change-Id: I11c77ca96333e2663d28db1b5fdb46602bd9e745
CRs-Fixed: 321176
Add Torch Power Menu toggle (1/2)

Credit AOKP

Conflicts:
	core/java/android/provider/Settings.java
	core/res/res/values/symbols.xml
	policy/src/com/android/internal/policy/impl/GlobalActions.java

Conflicts:
	core/res/res/values/symbols.xml
Add a little liquid suprise
Improve resolver layout in case package name is shown.

Change-Id: Ib2bd0c19727194205b6e4114c34bf96663030d5f
ProcessStats: Handle changes in the scaling frequnency

Switching from MP to IKS mode results increase in number of operating points
and results in bug #1183781 . The patch makes sure that whenever the available
scaling frequency changes it resets the existing values and sets them as per the
new values.

Change-Id: Ic74cdc2015f3c4ddd61cb116d1f4b4ed1204a3bf
Signed-off-by: Vishal Bhoj <vishal.bhoj@linaro.org>

Conflicts:
	core/java/com/android/internal/os/ProcessStats.java
DeviceKeyHandle: The device should consume only known keys

When the device receive the key, only should consume it if the device
know about the key. Otherwise, the key must be handle by the active app.
Also make mDeviceKeyHandler private (is not useful outside this class)

Change-Id: I4b9ea57b802e8c8c88c8b93a63d510f5952b0700
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Fix in glowpad disapearing targets when longpressed

Change-Id: Ic6bf6e5715b24f29559b10fc3d62677b42658030
Add active display to ChameleonOS [1/2]

This is the ChameleonOS implementation of the active
display feature, similar to that found on the Moto X.

When enabled the screen will turn on and display the
incoming notification.  The user can then open the app
for the notification, dismiss the notification or unlock
their device normally.

Additional notifications, if any exist, will be displayed
below the ring notification and can be viewed by touching
the notification icon.  The user can simply slide their
finger across these other notification to quickly view
them.  The last one touched will remain in the ring and
the user can then perform any of the actions listed above.

PS2-PS12:
All the changes that brought us to this current implementation.

Change-Id: I51c17cec33b65dc60111a10c5ca2c449596ebe63

Conflicts:
	core/java/android/provider/Settings.java
	core/res/res/values/dimens.xml
	core/res/res/values/symbols.xml
	packages/SystemUI/AndroidManifest.xml
	packages/SystemUI/res/values/dimens.xml
	packages/SystemUI/res/values/styles.xml
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Conflicts:
	core/java/android/provider/Settings.java
	core/res/res/values/dimens.xml
	core/res/res/values/symbols.xml
	packages/SystemUI/AndroidManifest.xml
	packages/SystemUI/res/values/dimens.xml
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
	packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
Correct active display settings naming

Change-Id: Ibfa2d41eed01d8987df52f013b111a0ce4e70739

Conflicts:
	core/java/android/provider/Settings.java

Conflicts:
	core/java/android/provider/Settings.java
Active display: Add options for date and am/pm [1/2]

Change-Id: Idc09772829cc6aa9bcfb064459fb3557c7b37f6b

Conflicts:
	packages/SystemUI/res/values/dimens.xml
	packages/SystemUI/res/values/donottranslate.xml

Conflicts:
	core/java/android/provider/Settings.java
	packages/SystemUI/res/values/dimens.xml
	packages/SystemUI/res/values/donottranslate.xml
Active display: Add sunlight mode. [1/2]

Change-Id: I541e74c5a1a7e6ce5028ab00cf998bba1d4fe0f9
Delay hiding systemui by 100ms
When disabling the keyguard, the systemui visibility is
changed and can occur after we hide it so delaying this
a bit resolves that issue.

Change-Id: Iad432f75195983837d643fa38495e6beb54f3e22
Active display: turn off display if device gets pocketed again

Change-Id: Icb4c002add915b75de7607f71c0d400e323feb5b
Active display: prevent force close
[log]

Change-Id: I0f96a964fbc55419f86a3707d9d6929f872e5bd8
Active display: make sure mNotificaiton is set correctly

Change-Id: I4111ca843e340cca4d6dac4b2c2922ce3039e487

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/policy/activedisplay/ActiveDisplayView.java
Active display: register/unregister recievers and listeners when enabled/disabled

Change-Id: Ic73e63da2c9634bc864ab1a1387eb9145eb0b5b0

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/policy/activedisplay/ActiveDisplayView.java

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/policy/activedisplay/ActiveDisplayView.java
Active display: Catch Resources.NotFoundException

This caused the SystemUI to FC when the device was powered and a notification was fired.
Display stayed off and the SystemUI kept restarting until the device was unlocked manually.

Change-Id: Ibfd82242e82aa9ee5c0898f5f0714e490eac0ea9
Active display: Ability to turn off the screen, when a not clearable notification is present
[log]

Change-Id: If90127ceeaf40eefee8a5afa712344f71bda96b9
Active display: Unify (un)registering callbacks and add proper checks.

Change-Id: Ie4c4660a54d2c60831f7a3bcc66b3a9ca1d035f2
Active display: Fix "turn off display if device gets pocketed again"

Change-Id: Ifc2e148fca44c1ff143e93283c4c75319cf79bf9