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)

Credits: Pawit Pornkitprasan

Change-Id: I1fdbaad92263c9f983a32900e74eba1f0367902b
Signed-off-by: Arham Jamal <arhamjamal@gmail.com>
Squashed commit of the theme engine support.

Updated 4.2 support for the old T-Mobile theme engine, as usual
needs the provider and switcher apps installed as well.

I'm finally dropping the 400+ commit history on this, since everybody
else keeps picking it up from CM as a single patch anyway... But
for the record, nothing of this would be possible without Josh, Ed,
and the rest of the TMo guys who wrote and maintained it until 2.2:

amit chabra <amit.chabra@t-mobile.com>
Amit Kohli <amit.kohli@t-mobile.com>
Chris Cogar <chriscogar@t-mobile.com>
Dirk Sigurdson <dirk.sigurdson@t-mobile.com>
Ed Carrigan <edward.carrigan@t-mobile.com>
Gaurav Sharma <gaurav.sharma3@t-mobile.com>
Hui Feng <hui.feng@t-mobile.com>
John Ritz <john.ritz1@t-mobile.com>
Josh Guilfoyle <josh.guilfoyle@t-mobile.com>
Mark Roberts <mark.roberts48@t-mobile.com>
Pankaj Kumar <Pankaj.kumar6@t-mobile.com>
Samuel Cheung <samuel.cheung@t-mobile.com>
Sergey Ten <sergey.ten6@t-mobile.com>

Signed-off-by: iceandfire <arhamjamal@gmail.com>
Signed-off-by: Arnav Gosain <nolinuxnoparty@gmail.com>

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
	policy/src/com/android/internal/policy/impl/GlobalActions.java
	services/java/com/android/server/NotificationManagerService.java
	services/java/com/android/server/wm/WindowManagerService.java

Change-Id: I1d536b45185c466d4b556f4db4c7324101579a7f
Fix after theme chooser

Change-Id: I5e7ad444435d586fd9a5c711084424208b0edeea
Signed-off-by: iceandfire <arhamjamal@gmail.com>
Signed-off-by: Arnav Gosain <nolinuxnoparty@gmail.com>
@hide API change from themes

Signed-off-by: Arnav Gosain <nolinuxnoparty@gmail.com>

Conflicts:
	core/java/android/content/res/Resources.java

Change-Id: I87769257a4a7d13b1ec2401f88d80e44131b0afb
ThemeUtils: Retain the original package name in themed UI context

In order for themes to reflect on system elements, we're changing
their context, including the package name.

This breaks anything that tries to identify system elements,
most notably any users of the uiautomator. Trying to do
'UiSelector().packageName("android")' to find, for example,
a force-close dialog will fail.

Fixes com.android.cts.uiautomatortest.CtsUiAutomatorTest#testUiWatcher

Change-Id: Ic05c3024b20ac3772ed5597846fbfa4a184ebb0d
platform: Fix the gid for the theme manager service

It was mismatched with fs_config, resulting in attribution of the
"-1" gid

Change-Id: Ia6d55af0b39f659da2965f9bc0bda0df5c775ba4
PackageManager: Let com.tmobile.thememanager access privileged permissions

Needed for CHANGE_CONFIGURATION

Change-Id: If50b0926d77e15e18ef5e88d7efac1b7f209d6e4
ResourcesManager: Fix theme insertion at boot

This was lost during the 4.4 ActivityThread reshuffle, put it back

Change-Id: I96eadf691973e9a2daa099b55816fc103d129be7
SystemUI: Reinflate on theme change

Reflect the updated assets immediately once the config_changed
notification happens

Change-Id: I480a719fbdd45875277871af39ce65849918ec0a
Add BAMF theme engine

Thanks to travp624 @ TeamBaked for originally porting this

Change-Id: I9dd9347ac62e3b1fb49a4562d84eb7b295cdc2b2