Merge tag 'android-5.0.1_r1' into HEAD

Android 5.0.1 release 1

Change-Id: Id44d5168fc8a77c4a30a86729c7fd7194e97bc1b
Signed-off-by: ayysir <ayysir@aospal.com>
SystemUI: add quick settings pull down with one finger

Logic is currently set to use 1/3 of right hand side of the statusbar to
trigger a quick settings quick pull down, quickly.

Change-Id: I3f536496f724f07d2419a5b2db5fa8f8261609e7
Signed-off-by: Roman Birg <roman@cyngn.com>

(cherry picked from commit f2ce6f5cc21aac4b1dd1c80b8c9b970d383264f4)
SystemUI: fix right hand side gestures on lockscreen

two finger quick pulldown was not accounting for being in the keyguard
adn was eating touch events when it shouldn't be.

Change-Id: I625d48a4002aaaf2d55d7efaed65d892ab7aa13c
Signed-off-by: Roman Birg <roman@cyngn.com>

(cherry picked from commit d302aff6b7011dea25a4a7f41828cb71752e1a85)
Screenshot: Add delete action through notification

* Forward port to lollipop.

Change-Id: I73d160766c232266f98badc1340b506e873c1ad5
Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>

(cherry picked from commit 4d111e8ed44bae54ef27e937af53bc6dddd11488)
SystemUI: Use material delete icon

Change-Id: I11df5713486672e4f5c4784e6f94a893cf36b4dd
Fix Presentation window is removed on stack change

If an activity show a Presentation window and this activity is moved
to bottom or top, thus this Presentation window will be removed from
its display window list, and no chance to be added back into window
container; It will cause the incorrect state that Presentation window
is lost from secondary display window list(displayContent.mWindows),
but still exist in app token's window list(appWindowToken.allAppWindows);
Moreover, once this activity resume again, Presentation window is not
shown because it's lost.

In this way, don't remove non-target display app windows due to only
target(or called default) display windows are removed temporarily and
re-sorted then added back into window list later.

Change-Id: I8960ce191f6c662455cba5a0a5e6a1ff9ef03ae1
Signed-off-by: tingna_sung <tingna_sung@htc.com>

(cherry picked from commit 95f8e177434bd1fe3c2d6908d4326c0e33a44ab6)

(cherry picked from commit 200e62948f783378d4466633357a8dec977baee1)
Sync focus stack frame and layer with focus app.

Update focus stack frame/layer when focus app is changed to avoid
focus stack/layer isn't updated synchronously with focus app, it's
due to performLayoutAndPlaceSurfacesLocked() is not necessarily
called on focus app change; it will cause sending mismatching
TAP_OUTSIDE_STACK message if there is effectual incoming pointer
event, hence may also result in focus stack is changed again,
therefore erroneous focus app is set by ActivityManager at final.

Change-Id: Ia0ec9a543be887b51a3b29b3e62fdd471c15edf2
Signed-off-by: tingna_sung <tingna_sung@htc.com>

(cherry picked from commit fd782d839e22e948baa630a4aa2527737668c2ef)

(cherry picked from commit fd9b658b141726e05e7e1faa5b3cd3d4c8ae1b64)
Not include fullscreen opaque window on screenshot

Extend the fullscreen meaning by adding opaque drawn check on
screenshot application; if there is a fullscreen window but not
opaque, we will continue finding behind windows; otherwise ending up
including behind windows. It's able to help avoiding capturing BLACK
screenshot bitmap.

Change-Id: I1c7e8f513c366688ea8001c3d0c799f3522f0ffd
Signed-off-by: tingna_sung <tingna_sung@htc.com>

(cherry picked from commit 9a2e6dbe296610f7113b70f49aac788b19197200)

(cherry picked from commit 87e397c1e50346ffa95d673f3ccde4d287232a4b)
Measure absolute value of pointer motion distance

If pointer is moving to the negative axis direction, pointer movement
distance will always less than pre-defined mMotionSlop, thus
TAP_OUTSIDE_STACK will have chance to be sent, will cause unnecessary
focus stack switch.

Change-Id: Ia4c066bebce250257c7361ef976907a0ca2c6461
Signed-off-by: tingna_sung <tingna_sung@htc.com>

(cherry picked from commit 8db56961feacefb92f1ec7fbb05f6067a53a7332)

(cherry picked from commit c93041b26d0afe2b2a49ff51567038dadf0087f4)
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)
core/res: resolve merge cruft

related to: https://github.com/AOSPA-legacy/android_frameworks_base/commit/359efbc589a3656866f4c2517a666428b7e6aa71

Change-Id: Ic992a9ef286d40ee26c6ae9db2428eb6c00d010f
SystemUI: make clock and time clickable in statusbar

Clicking clock opens alarms, clicking the date will open the calendar.

Change-Id: I622527c1f144a8867aa543348b70a4fefe3f6403
Signed-off-by: Roman Birg <roman@cyngn.com>

(cherry picked from commit c7a4aa7d96d236835b187c72a82d7e6bf1231c3a)
SystemUI: make alarm text selector less blocky

It now matches the rest of the selectable items in the expanded header.
None of them had these boundries and neither should this.

Change-Id: I92041ee685a0c16f80c003658abbfd0a6143c07c
Signed-off-by: Roman Birg <roman@cyngn.com>

(cherry picked from commit 7a9c11f4396c07e1d6fd5e5913f4b8e500a9555e)
tethering: update connectivity intent

use immediate intent in place of delayed in order to
react promptly for underlying network changes.

Change-Id: I387d5dff7dfca01094177518a5936c6e600081f6
CRs-Fixed: 752832

(cherry picked from commit 4f77a4140afd9fa9269874a73b3f760fa5cc393b)
Make sure emulated storage path index is 0

MediaProvider blindly assumes that path index 0 of the array returned by
StorageManager::getVolumePaths() is the emulated storage.
However, this is not true when you have multiple users.
This patch modifies StorageVolume::getVolumeList(). to make sure that
assumption is always true.

Change-Id: I4650478274a87adfed91fe53097c1e47fb2f10c7
Signed-off-by: Fernando Guzman Lugo <fernando.guzman.lugo@intel.com>
Signed-off-by: Mohamed Abbas <mohamed.abbas@intel.com>
Signed-off-by: Irina Patru <irina.patru@intel.com>
Signed-off-by: Yong Yao <yong.yao@intel.com>

(cherry picked from commit 30def9e7fac025f68c540492be9be8bdd2afda5a)
ExternalStorageProvider: SD card's name in Document UI is unreadable

The SD card's title used in Document UI is storage volume's user label.
some times, storage volume's user label may be null or something that
is not human readable, in this case, descripition will be much better
than user label.

If we could get a non-null description, use this description as title.
Otherwise, use storage volume's user label as title.

Change-Id: Ie1adc6ff39293642ebb72d45d8896a273c515205
CRs-fixed: 740100

(cherry picked from commit 5c25d5cc0aeed43bca506edc179fd2bb12a1766c)
Storage: Add secondary storage support for app installation

Add secondary external storage APIs for app installation. And
change the logic to allow app to be installed into external
storage.

Change-Id: If2f67af7508d020c1d041bb955e3d55136a34acc

(cherry picked from commit 99d3b9b80628f93a0b467a8c66c12012245b46d4)
Hide new methods instead of modifying the public API

Change-Id: I8a1b316f70a0dd76eb6c900d9c1a74e8e1765af3

(cherry picked from commit a852ea56574092a2de0714404aacf455300f5f02)