SystemUI: Restore bounds when loading new gradient

This fixes an issue introduced with the reloading of the nav bar
transitions after a theme change in Change-Id: I256afc30fc018ea752769029c5246bc7310c23a6

Change-Id: I648039506b826583d554b2a0cf4f6ab9a9bb1de8
(cherry picked from commit 88b97e51c211de6a97b77162c1da895acd0dc78e)
Add global setting for all stats control

Change-Id: Iaf244d9fafbf2c47c318a90665f39d5efaea3b1b

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

(cherry picked from commit 06e8a082fc0a53dc4da8da8f84d1e08fc7ba22bf)
Themes: Find wp asset when APK has dir entries

Some APKs are compiled with folders included as zip entries in the APK. This was causing
lockscreen wp to not correctly be set.

Change-Id: I9eca7878b29e3cfcb43abc4a9dab084d9c200b83
(cherry picked from commit a6ae84dfa485f730f9debabd70ecd68c7595aa54)
[AssetAtlas]: Fix AssetAtlas not consider all size of texture.

Symptom: Atlas service get exception because the result is null.
Root Cause: The original logic will miss the largest width in each thread.
Take two processors as an example, first thread will miss 2048, second thread will miss 1984.
With some condition, only 2048*2048 or 1984*2048 can exceed the mThreshold.
In this case, the mResults is empty and cause crash when trying to use the first result.
Solution: Adjust the boundary and the condition so that it can consider all size of texture.

Change-Id: Id54de57cd1501ed7355f2237f05726d2965aed6d
(cherry picked from commit d77a9d6a04e9cb76187748168db26df035661033)
[HWUI]: fix residual line on FrameBuffer

Symptom: If app applies animation to enlarge a bitmap, there will be an residual
         line on the screen

Root Cause: On platform which has Tile Rendering implementation (ex. Qualcomm
            CPU), startTiling() call will restrict the framebuffer region which
            GPU can affect. So the expansion of clear region by 1 will not take
            effect if startTiling region is not expanded.

Solution: Expand the startTiling region by 1, too.

Reproduce steps: Apply animation to enlarge (and then shrink) a bitmap icon.

Change-Id: I7b4a59e180daa29dbe909d9e11f4093ae1d7396f
(cherry picked from commit bffab9f6fc71b2d5909470467f73997eab6bb4b5)
Add BlendComposite.java

The class is adapted from a demo tool for Blending Modes written by
Romain Guy (romainguy@android.com). The tool is available at
http://www.curious-creature.org/2006/09/20/new-blendings-modes-for-java2d/

Change-Id: I8f7c7ca08d3078106056764a4e2f1ce95d990137
(cherry picked from commit 3134b848c0648e93283696bac333647c122017b7)
Optimize Blend composites.

Removed redundant array allocations to improve performance for various
blending modes.

Change-Id: Iaba1d6ff3ad03eebdc859c599b610cc593370438
(cherry picked from commit 5ef3fb7a3bf9fe65671639cfd868278748f9b258)
Add an internal API to get all asset locales.

This will allow us to not copy paste this code verbatim into
bundled apps.

bug: 10090157
Change-Id: I008dc683ecbef2ad8b7a26968cb3cbda7e5a8388
(cherry picked from commit 574c0db598a987e49becf5ac58ed06300d5a05be)
[ActivityManager] Move top task to top in window manager

Symptom:
In certain situations, application starts activity while
it is in background. When an existing background activity
starts a new activity which results to be kept in the same
background task, the new activity won't be resumed.
In that case, the background task (sourceTask) should not be
moved to top in window manager.

Solution:
Move top task of the target stack to top in window manager

Change-Id: Id7a37ea67ce1f80e0c2b5399865c51fd7113deb8
(cherry picked from commit 302485a740e5f997008162f7c7f9076ab6ecd3fb)
[ActivityManager] Do not finish root activity when reset task

Symptom:
The root activity not always located at index 0 of the task.
For example, the index 1 activity will become the new root
when the original root activity (at index 0) finished.
The new root activity might be finished unexpectedly before
the original root activity actually destroyed.

Solution:
Check frontOfTask to avoid finishing the root activity unexpectedly

Change-Id: I623ab97e9c95c83b3cfe7c9dfc151a291a391ea4
(cherry picked from commit 52392d1cdcb5d851746a315019e1fcdb1bf6b68d)
[ActivityManager]: Update home process when home activity resumed

Symptom:
  When switch between two home activities, the home process might not be updated to the correct one. In that case, the home activity might be killed easily.

Root Cause:
  The home process is updated only when a home activity is newly created or being restarted. ActivityManager did not update the home process when simply resume a home activity.

Solution:
  Update home process when home activity resumed

Reproduce Steps:
  1. Install a launcher application, such as Apex Launcher
  2. Press home key to change to Apex Launcher by "Just once" option
  3. Press home key to switch back to original home activity by "Just once" option.
     (The home process is still the Apex Launcher's process because ActivityManager does not update the home process when resuming the original home activity.)

Change-Id: I046279ca7ba851a283ee67ea19202890f7b3f343
(cherry picked from commit 15061af8b33a2e9e6e47371bebe9d966245728ff)