frameworks/base/: Fix black wallpaper issue when home pressed.

In the specified usecase, there is a completely new set of
windows that appear on the screen during rotation. And the
existing code in the framework ignores the drawstate of the
hidden windows.

Wait till the drawState is ready for the hidden windows also.

CRs-Fixed: 521758

Change-Id: Ibd96502059c84210ad84ecb03aac5eca28f3c9fe
(cherry picked from commit 3384b25ae83a535e05a58a16941555b6ee7005f3)
(cherry picked from commit 2fa1eea7fd819b11ee6cc8f8f6921fdaeeabb4bf)
Align all rotation values according to panel orientation

Align all rotation values according to the panel orientation
specified by the user in system.prop.

Change-Id: I2a2d6f42db8bd2e3c46a3a3180954c6221ab891f
base: App crash when select suggestion's length more than specified.

App crashed by catch IndexOutOfBoundsException which raised
by check span range when select suggested string.The root
cause is that the editor will truncate the suggested string
which length is more than it specified, but it also set span
use the suggestion's original length.

Update the suggestion's real length after editor replace the
original string to suggested.

Change-Id: I2d765701934a9e68be172cb87a104590f3cdeceb
CRs-Fixed: 532211
/platform/frameworks/base: Fix SystemUI crash on Recent App

Issue: SystemUI crash is observed when Context MenuItem is
       selected on the recent apps activity [Long pressing
       two recent apps at same time or Long press, lock and
       unlock the screen]

Fix: Changed the code to make sure that only one context
     menu is active at a time and also dismissed the
     context menu on pause of the RecentsActivity

CRs-Fixed: 539509

Change-Id: Ia50bed7bfad6fde7beeaec37fa6402177eee1d40
base: Support the runtime overlay for system apps.

 - Support the runtime overlay for all the system apps.
 - Fix the permission problem of framework resource overlay at runtime.

Change-Id: Ibaf226008c5c5225615cfa5b8a04e6cee9b923d3
Use highp precision for scaled coordination

If scaled coordination is closer to zero than what
the medium precision can store, distance becomes
zero and it causes divided by zero.

Change-Id: I8ee921dd1f57564a442e685266b12d95fc08e165
AssetManager: Add runtime overlay support for '/system/priv-app'.

Add runtime overlay support in '/system/priv-app', which is newly added
on the new version for some system apps.

Change-Id: I7c8c360cf9b45fd68c206c0f179112d7a7aede9e
Magnification: Fix screen freeze after activity resumes from rotation

mMagnifedViewport.onRotationChangedLocked() will call setShown(),
and then cancel a anime. As the anime should be only canceled in
a looper, if it is executed in the onRotationChangedLocked() of
DisplayMagnifier, a crash will be caused. Therefore when the
magnification is enabled, the activity will crash after rotation.

Move mMagnifedViewport.onRotationChangedLocked() from main thread
into the handler. When MESSAGE_NOTIFY_ROTATION_CHANGED is received,
execute it. As handler is created with a looper, the crash will be
fixed.

CRs-Fixed: 541799

Change-Id: I2a78f24f73d5a9b8693e557d18e2fb01fcaec8fa
UsbSettings: Add UMS mode support

Android only supports MTP and PTP mode in UsbSettings screen, this change
is to add USB mass storage mode.

Change-Id: If7e49ae022c187063d30316b6a017d6089d97713
Release wakelocks acquired by SyncManager

Release the wakelocks internally acquired by SyncManager to improve
power performance.

Change-Id: I6d9663292cb4471d92ed9132beb7ed1ba2e8128f
CRs-Fixed: 585825
frameworks/base: Fix the random UI corruption

On low memory device, when a view goes to background. Its HW layer cache
will be destroyed to release memory. There is a very rare case that the
hardware render is not valid when destroy the layer, so the layer is not
destroyed and reused when the view comes to foreground. But the GL
context has changed, so the view is not rendered correctly due to its
HW layer cache. To fix this issue, destroy the layer in a safelyRun. Make
sure the layer is destroyed correctly.

Change-Id: I1c714e1d53db7353d5169e874a7cd0f527c3f67b
CRs-Fixed: 623239
Display: Initialize mRotation to panel orientation.

    - Fixes the homescreen layout to be prepared based on the panel
      orientation.
    - Disables the rotation animation from 0 to panel orientation after
      bootup.

Change-Id: Ie77e53ade087df05e102c45bf9d12bdaf09583f7
GC: Improve the string parsing for GC parameter setting

Improve the string parsing for GC parameter system property.
Previously we only recoganize plain number for dalvik.vm.heapminfree
and dalvik.vm.heapconcurrentstart, while users tend to use format as
2m.  Improve the string parse to cover such cases.

Change-Id: Iaf0152bc4d77e1caabc307a9a7b0e5b261f8e441
lowmemorykiller: Overwrite LMK parameters for low-tier devices

LMK parameters calculated by default algorithm were not optimal for
low-tier devices. Values mentioned here were well tested and
evaluated w.r.t memory and performance for such setups.

Change-Id: I40ed92d204aae6e758028ea1e9bd4ec7226dbe2b
Tunning max allowed boot starting bg services

The serialize running of background services feature
delay some services startup when system bootup.
This feature lead some abnormal behavior at the early of
system startup, some requests can't be responsed in time.
Tunning will be disabled after system complete bootup.

Change-Id: I834607d9156253bee13848586a8136e24760fdf4
CRs-Fixed: 620331
frameworks: extended tile rendering to avoid unresolves

extended tile rendering to avoid unnecessary resolves and
unresolves caused by apps.

Change-Id: Ie255a680b0fea0726fa2e5b0594be2bd924bc4ee
WallpaperCropper: Fix crash when set .gif as wallpaper

It returns an equivalent scaled cropBounds as true
crop bounds, then it set the rounded rect by rounding
"out" the true crop rect, this make the rounded crop
rect may out range of the original bitmap, then an error
will happen.

We change to check the rounded crop rect, if it is out
the range of original bitmap, we set the original bitmap
bounds as rounded crop bounds.

CRs-Fixed: 622582

Change-Id: I215ef2a0165adaaadb05c62dee741a8ea6926144
DocumentsUI: Fix the issue of download status was displayed incompletely

The layout arrangement of date, size and summary are unreasonable.
Text was ellipsized when summary has too much characters.

Reconfigure "layout_weight" of date, size and summary can fix this
issue.

CRs-Fixed: 619201

Change-Id: I0c00d08d4793a38b80988378b4b510bdb3bf8720
frameworks: support for disabling extended tile rendering

extended tile rendering to be disabled or enabled using property

Change-Id: I62ca839702569155a8ca3572e933d46ec4381866
    Show notification when charging.

    If user selects "Charging" option from
    USB computer conection, show the notification
    "Connected in charging mode", which will also
    prevent the pending intent from getting removed.
    CRs-Fixed: 641540

Change-Id: I93a04efe52e8280da95438ceb02b4054610a4d6e