Scale down the wallpaper image if it is larger than the surface frame

Let the wallpaper can fit the screen if the wallpaper is larger.

Change-Id: Ie4116dc0386c7b390a6a71608b09645cd08ffe78

(cherry picked from commit b5168e01b688431757b0c17a1fc9c712ad5f3cb1)
[ActivityManager] Improve task order of getRunningTasks.

Symptom:
During switching task in same stack, the first result
of getRunningTasks will be the behind stack's top task.
e.g.
 App Task X is starting task Y, the first entry may be home.

Root Cause:
TaskRecord's lastActiveTime is updated when pausing
or resuming. When X task launch a new task Y, Y is
on the top of task history, before X complete pause,
Y's lastActiveTime will be 0 because it is a new task.
Then when comparing the front task with other stack,
other stack will be regarded as the newer one.

Solution:
If the stack is focused stack, give the top task with the last time.

Change-Id: I0adc07608e03d333e0120a0dbc52a0fbbbb12f34

(cherry picked from commit c6a859126416f62d010c1d552086c167bd5c8d83)
Remove the window whose client process has died or become zombie

Window Manager Service would fail to report window-resized to the
process which has become zombie. This would cause the window to
freeze screen continuously. In this case, we assume the process has
died and remove its window to recycle resources and to prevent it from
freezing the screen.

Change-Id: Ic7384731bf9a1fa8b9602d4f1dbee7492db126c5

Conflicts:
	services/java/com/android/server/wm/WindowManagerService.java

(cherry picked from commit 19bab687f81e15be2b45e32d16d6dee282fbe8fb)