frameworks/base: Fix to avoid UI freeze issue.

Due to some race condition in WindowManagerService, Screenshot
layer remains as topmost and buffers are not flipped hence
no updates seen on the screen. So, trying to destroy persistent
layer explicitly if freeze timeout expires 6sec.

Change-Id: Ibe295550a7431a4f633a57e7dfab0cbda102ab87

(cherry picked from commit f8146d56eab71245cf6b86d0c5a4725c528d8a0b)

(cherry picked from commit c6789fe6da4e6855e9409851a6469d20561cbe49)
MediaMuxer: handle expection for add track

Native addTrack call throws IllegalArgumentException on failure.
Catch this exception in MediaMuxer and throw IllegalArgumentException
that calling function can trap.

Change-Id: I97239ee2272c754ef6d7d54c5a27d1889ac01b80

(cherry picked from commit 1dd6f42412fb6a15c64acb71028798432ff06ba9)

(cherry picked from commit 7fc3e90b3f4aece035cfedb2790d35ef3938d7a6)
SystemUI: Remove unnecessary mobile data activity icon update

The unnecessary mobile data activity icon update causes activity
icon is 0 when mobile data is not actually used. As a result, data
icon will not show even if data connected.

As mobile data activity icon has updated in updateDataIcon, do not
update it again in refreshViews. Remove unnecessary mobile activity
indicator icon update.

Change-Id: Ib39c55a39a0623cc9a2d14508d487f86e3a0f82f
CRs-Fixed: 745386

(cherry picked from commit b30569b021d81a0598dbc5f131ef5f1de31f2d0d)

(cherry picked from commit 46a0e182b4f833c7ff771679958a1cacb43d0d57)
SystemUI: Set zen mode to no interruptions if silent mode is set

When setting ringer mode to silent and current zen mode is off, zen
mode will become priority interruptions mode. As a result, ringer mode
is set to normal mode in updateZenMode.

Set zen mode to no interruptions when ringer mode is set to silent.

CRs-Fixed: 744813

Change-Id: Id104e5473d0e8d624b06dfc9e5dbd8d9f7627b6e

(cherry picked from commit 18d823cb53b13fae2a9a17d6fae4a466c311529e)

(cherry picked from commit ace02afe713b6d3e715dfcac10608055fdb27ef2)
SystemUI: Fix task manager title not change with language issue

When system language changes, task manager title and kill all button
name do not update.

Set task manager title and kill all button name when refresh task manager
view to ensure they change with system language. Rename task manager tile
to meet multi language requirement.

CRs-Fixed: 741079

Change-Id: Ic247c2a70cd63ccb87fd2f3bea05196e28060857

(cherry picked from commit 5e0f5527a8f025b3939e73a8bee42ceaa864efc2)

(cherry picked from commit db9bfe55cdc158d5815c22cf7a967ef7e0c4e30f)
SystemUI: Fix sim pin lock message displaying incorrectly issue

When verify password successfully and no sim card is pin locked,
getSimPinLockSubId returning invalid sub id causes slot name
displays incorrectly.

Do not update sub info if sub id is invalid, remove inappropriate
security message update to avoid displaying incorrectly.

CRs-Fixed: 737973

Change-Id: Ic4c4aca09456008c72677aedd9caa6af9e84da8f

(cherry picked from commit 2c364790e9bf971738bb5fcc5524221528ef3ca3)

(cherry picked from commit e55ad3de48892df8d20ba1d376e7867271e79c35)
VideoView: Check state before calling suspend

Only call suspend under certain states. There is a possibility
that when activity is finished, pause gets called before destroy
calling suspend and stop on mediaplayer respectively. This will
result in stop failure as it has already been suspended.

CRs-Fixed: 750459
Change-Id: I34c24d6abe3726b163f9a582d73b31dfd4094e44

(cherry picked from commit a17b9b9fb312624d181e238fb317644666f0743e)

(cherry picked from commit 54b4a123b2b1aeef8dc67e5a753d4bfc0e209591)
Allow override of DUN settings

Allow override of system DUN settings by setting
persist.sys.dun.override
to one of the following values:
2 = not set, 0 = DUN not required, 1 = DUN required
If the prop is not set or is set to an invalid value the system setting
will be used.

Conflicts:
	services/java/com/android/server/connectivity/Tethering.java

Change-Id: I296f303a23351e4ab29898895abfcd313c747db9

(cherry picked from commit efe7da1bd9d95e38e69557ce3494a60983705dfe)

(cherry picked from commit 99265de817dbe0773849daecf401c53f8a319ae5)
Sounds: Cleanup duplicate ringtones/alarms

Removes duplicates from AllAudio makefile and fixes title tag of
Promethium (from Platinum).

Change-Id: I767a846dbc5575ec9f86b1326e0b9f7aa015086b

(cherry picked from commit 0f195e0204665437d331606a4335cd4ca54a8119)

(cherry picked from commit bef866a2ee4395c50fe5c661d6fbdeded2907a28)
immersive mode: don't unconfirm a package, that's just dumb

* This is very annoying for specialized apps
* See here for a great explanation http://stackoverflow.com/a/20309721
* The fact that it doesn't even notify the user until the NEXT time they
  run it makes it completely pointless in my opinion anyway.

Change-Id: I423611efc07d467e1d81c66d58adcff331be8b38

(cherry picked from commit 06f2cac348465bc44ef436a563c1ea8ed3e121d6)
frameworks/base: Add support for fully transparent layers

Allow apps to specify a window to be fully transparent. This hint
can be used later by the compositor to drop the layer.

Change-Id: Ib58f1026e74ca39e7160d2adcb34ebf50ec28a9a

(cherry picked from commit 5387341d7a0cc3cfc24cec98f0f0c4c3bab45349)

(cherry picked from commit e08abe81163442cb68dcd633e59cae56c3c6021c)
Optimize drawBitmapMesh using TRIANGLE_STRIP

Draw BitmapMesh using STRIP instead of TRIANGLES.
Depending on where the bottleneck is located in the pipeline,
there is a potential for saving two-thirds of the time spent rendering.
The speedup is due to avoiding redundant operations,
i.e., mapping each vertex four times to texture and color attribute,
sending each vertex twice to the GPU, vertex processing of GPU ...

In this patch:
1. Refactoring mesh using Strip.
2. Batch triangles by adding degenerate triangles.
3. Optimize computing positions of texture and color attribute.

Benchmark: Drawing Bitmap(1152x768 px) with 200x200 meshes
Performance is doubled (from 26.4 fps to 53 fps, Nexus10).
Memory footprint: only 17% of original method.
(from 240000 to 40401 vertices with xy, uv, rgba data.)

Change-Id: I08c5c20d981d88528ce7b02012feefae468d6ec4
Signed-off-by: kui.zheng <kui.zheng@arm.com>

(cherry picked from commit ccec048da3a86d67b4d487101fff15711c833f47)

(cherry picked from commit 14d1e55dbbc96ef161b6a3bbe5fed082dd2dba45)
Merge pull request #68 from AOSPA-legacy/lollipop

merge from AOSPA-legacy