Some cherry-picks AOSP

Fix a programmatic smooth scroll bug

Bug: smoothScrollToPosition() stops at child view of which height is
higher than list view itself.

Change-Id: I695ca9db4c706aa7f365967dd3916f9a01917346
Signed-off-by: Yongyi Li <yongyi.li.cn@gmail.com>

Properly rotate full [-pi, +pi] orientation range if available

The code currently in place assumes that orientation has a range
of [-pi/2, +pi/2] as may be found with a touch digitizer. However,
when used with a digitzer that can report the full [-pi, +pi] range
of orientations (e.g. a stylus) the calculations here are incorrect.

This patch checks if the post-rotation value is out of range for
the axis, and wraps it back around.

Change-Id: I03a22f7bf9526a5d995df1a18430d6dd24c6d6ee

Fix spurious ANR occurence when MOTION batch event is not served by the InputTransporter

Sometimes Batch event of MOTION type is not processed by the Input Transporter
even though it is queued to the waitQueue-Responsible for ANR whenever any event
response does not come from the App. To fix this issue, one Boolean lock is added.
Thus InputTransporter wont ignore the Batch event.
Issue: https://code.google.com/p/android/issues/detail?id=41755

Change-Id: I3bb2eb4cf1f8ecdd1d04671c0e8205dee4ad3a6c

Revert "Fix spurious ANR occurence when MOTION batch event is not served by the InputTransporter"

This reverts commit 022eb04f1ec31cb98bf42bd27ffac7c315135e35.
A lot of commits for new generation

Setting max hidden apps to 55

Now that we know this is not the culprit of the lag lets use a value that is in a *sweet spot* between 40 and 60 leaning towards 60. (as steve K said all of this shit is arbitrary but In my testing 60 runs great)

Revert "Handle nested folder case"

This reverts commit 2e3e0c3a493aec4bea60d4195a4290e1bd08001b.

Revert "Decrease lag generated by autorotation on"

This reverts commit 47f58dcc33f98dc897ccd6229d20fd82ddf94c70.

gps: fixed logic for finding the best package

Fixed the logic for finding the best package,
as it was always picking the last package in
the list as the best (regardless of which package
had the highest version) if there were multiple
packages with higher versions that the current.

Change-Id: Ibd61f0a050d65feb8bb1584f59b0a11974333af5

Clear Recents: Free fall of layout

Signed-off-by: Daniel <daxx4182@gmail.com>

It helps to catch the right exception.

Bug: 7238149
Change-Id: I7b60ec44d1d1d5ece8a871cb089f811b611f4a4a

Allow theming of lockscreen

Change-Id: I10799482e0b393746b4c9818f94862109fac6006

Remove the fixed-length buffer in DdmHandleNativeHeap.getLeakInfo.

It was possible to overrun this buffer, and even if you did fill
the buffer in a single read and exit the loop, the "string" still
wouldn't be terminated.

Bug: 8468088
Change-Id: Ia19f4d26dfd79e7b63807a7ec9540b932163d246

Two REMOVE_PROVIDER messages caused by race condition.

Fix a bug in unstable ContentProvider.
IllegalStateException: ref counts can't go to zero here: stable=0 unstable=0
IllegalStateException: unstable count < 0: -1

There is a race between main thread and background database thread. Main thread
is responsible for handling the REMOVE_PROVIDER message. Database thread starts
insert or query request again and again. acquireProvider in db thread will often
snatch provider from the jaws of death, sometime it fails to remove REMOVE_PROVIDER
which is already fired out from MessageQueue. But completeRemoveProvider in main
thread gets suspended when trying to execute the critical section. If db thread
released the provider before main thread resumes the execution, then two
REMOVE_PROVIDER messages will be executed.

Change-Id: I8588aa1d1a8bc444dcd2adf6f8bc3f055cebbdc4
Signed-off-by: Guobin Zhang <guobin.zhang@intel.com>

Miragefy

Change-Id: I595419d60d4a3937a4b0a8ed666193031fa7dfd0