Switch VOL UP/DOWN in landscape

Change-Id: I58997079685fd092ebf5464e04655f291ed0ef97
Add support for QC's time_daemon

Enabled by BOARD_USES_QC_TIME_SERVICES=true, it requires the device
to provide its own time_daemon executable and libtime_genoff.so
proprietaries. The library should be copied by the device's setup
config to $OUT/obj/lib for linkage (and pushed to the final build,
obviously)

Change-Id: Ie6964dbe2692dc33fc04093a5b89b6922d8443c8
bootanimation: Only try to shutdown the mediaplayer if it was prepared

The bootanimation tries to shutdown the mediaplayer gracefully by waiting
on an asynchronous shutdown event for 5 seconds.

If, however, there is no boot sound, that asynchronous shutdown event will
never happen and the animation will be stopped for 5 seconds before shutting
down.

Visibly, this fixes the issue where the bootanimation would simply stop near
the end for exactly 5 seconds.

Change-Id: I77f5631368c7d9b9fef7941a6278af9c36032044
Revert "Switch VOL UP/DOWN in landscape"

This reverts commit 8a704d3a6de24b7defd8ef2e0bc4e2b9ccaba0a5.
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)

Conflicts:
	packages/SystemUI/res/drawable-xhdpi/ic_menu_delete.png
	packages/SystemUI/src/com/android/systemui/screenshot/DeleteScreenshot.java
	packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
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)
already defined

Change-Id: I437d7e40dc077ba78c536cd7001832d9f195caef
Revert "AudioManager: make swap volume buttons RTL aware"

This reverts commit 2a83db67c85f84bf05069ae7ea3374ac08d47f95.
Revert "Forward Port: Swap volume buttons when the screen is rotated by 90 or 180 degrees"

This reverts commit 3286366a9cf9308e2f8dff5deb46cafc27110b70.
ExternalStorageProvider: String mismatch with system language

Text of phone storage does not change when locale changes.

Obtain the string each time by querying the database.

CRs-fixed: 739290

Change-Id: Ic6f5292f8eef9c9438e80fa876b8f276f21e26c8
UsbSettings: Add UMS mode support.

Add Usb Mass storage mode support for Android device;
Fix SD card can not be mounted to device when usb cable
is plugged in or unplugged fast and frequently.

Change-Id: Iff6de6b1b3e066f4a4ab610ae3fe10b22f5b0822
UsbSettings: Adjust UMS mode code logic.

Not to update UMS status in every iteration of client listener.

Change-Id: I5fbc0145c798c468f2ae943b251700f1a71e00d8
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)

(cherry picked from commit f1cc4949f03b3940b4a82257ef0acf2cd7b9e6ce)
PackageManager: allow build-time disabling of components

Allow components to be specified as disabled at build time
(applied on boot).

This allows stock OTA components to be marked as disabled in
CM builds.

Change-Id: I6e4499cc40a779792a5ea97a10137399dad7d69f

Conflicts:
	core/res/res/values/symbols.xml

Conflicts:
	core/res/res/values/symbols.xml