Display: Dirty region propagation

Pass Dirty region values from HW renderer to Surface Texture.

Change-Id: Ibd121ed398a1319d3daf26f9fd39a03323bba666
Audio: Fix title of system ringtone contains messy meta

Title in the Meta information of Bootest.ogg contains
junk characters which is displayed in Settings->Sound-
>Phone ringtones.

Correct the binary file to solve this issue.

Change-Id: I91c0519bb55ee5e74f783b0c147acbde641f6502
CRs-Fixed: 569976
AudioService: add STREAM_DTMF to stream affected by ringer mode

-STREAM_DTMF volume muted when phone in vibration or silence
 mode but will not restore when back to normal mode by setting
 STREAM_RING volume to 1
-Add STREAM_DTMF to the list of stream volume affected by ringer
 mode

Change-Id: Ib91d6b2c09e10b5cd86ae192cf334c69884da294
CRs-Fixed: 549908

Conflicts:
	media/java/android/media/AudioService.java
Bluetooth: Handle exceptions for bluetoot socket read

Handled IO exception in read function of BluetootSocket,
and also introduced a null check for mSocketIS.

CRs-Fixed: 605606
Change-Id: Ic948c72269e0de486a8f49163830528b002198ff
Fix graphics corruption caused by HWUI caches

Some caches(PatchCache, TextureCache, PathCache) for HWUI
uses deferred removal for their cache entries even though
actual resource objects are immediately freed by
ResourceCache.
For this reason, the uniqueness of a resource address in
the caches is not guaranteed in specific cases.
(Because malloc() can return the same address when malloc()
and free() called very frequently.)

So it can be possible the cache have two cache entries for
two different resources but the same memory address.
(Of course one of the resources is already freed.)
It also can be possible mGarbage vector in PatchCache has
duplicated addresses and this can lead to duplicated free
blocks in the free block list and graphics corruption.
(Deferred removal was implmeneted based on an assumption of
unique resource addresses.)

So this patch makes sure resource objects are freed after
the resources are removed from the caches to guarantee
the uniqueness of a resource address and prevent graphics
corruption.

Change-Id: I040f033a4fc783d2c4bc04b113589657c36fb15b
Signed-off-by: Sangkyu Lee <sk82.lee@lge.com>

Fix AOSP build - DO NOT MERGE

Change-Id: I42b420c2ce89ce364a2809b28b827964e6923fa1
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
Squashed commit of QuickBoot feature from Qualcomm

QuickBoot: don't log boot events when in QuickBoot mode.

Don't need log boot events when booting from QuickBoot mode.

Change-Id: Id381530418c09ac1d650f45e7a368dbd7945aff3

QuickBoot: don't wake up screen when usb connected

Don't wake up screen in QuickBoot mode when usb connected.

Change-Id: If65936a0edbbc3b36a0768294e5c3bd7d741018a

QuickBoot: filt out alarms that for non-system users

Don't allow alarms for non-system users when under QUickBoot
mode.

Change-Id: I322d08f7236b6895462c4cd3304326c66f67ddd2

QuickBoot: restrict app's auto start under Quickboot mode

Don't let broadcast trigger apps auto start when in Quickboot mode.

Change-Id: I5d156cbea4ef18397ce4569cb74f73a446a6e49b

QuickBoot: remove alarms for killed apps

Device may be woken up by WAKEUP alarms, which have been set
by those killed apps before. Here to get the killed apps list
and remove the alarms from AlarmManagerService.

Change-Id: Ib34f5fc234b834b2fe4528229c267c8693fc76cb

SyncManager: Fix SyncManager null pointer issue under QuickBoot

BOOT_COMPLETED broadcast will cause mBootQueue null pointer issue.
Then system_server will crash. Add protection here to avoid
system_server crash.

Change-Id: I78029dfa90709455e4c2220e06b95640383655f8

QuickBoot: add execption restore mechanism

There may be some exceptions like battery unplugged When device
is put into QuickBoot mode. Then device will be in airplane
mode after next boot. We don't want such kind of things happen.
So start restore task to check if need restore before main
screen shows.

Change-Id: I3d0967c2f446fd71eca87ff085617edca549c984

QuickBoot: switch normal power off to quickboot

Handle power off button when quickboot mode enabled.

Change-Id: I6a668cbe823018b5e508633a76202d0df0381694

QuickBoot: support QuickBoot power on

Support long press power key to power on when in QuickBoot mode.

Change-Id: Id493d352bce73683b9696a2685a6c902f1195799

QuickBoot: Don't handle SHUTDOWN broadcast from QuickBoot

Don't process the ACTION_SHUTDOWN broadcast sent by QuickBoot.
It is only for apps.
Change-Id: I73d1a7b8edda0a898dd052831033806e18b37c99

QuickBoot: rename some intents and broadcasts

Modify some improper names for intents or broadcasts of QuickBoot.

Change-Id: I92357b0110643bb425199452cb03bd75248a5d83

QuickBoot: Support poweroff alarm under QuickBoot mode

Add white list in QuickBoot mode to support poweroff alarm.
    1. Allow original deskclock app and quickboot app to be launched.
    2. Don't filter out deskclock's alarms.

Change-Id: Ie4254e3da45837d3185d3daba625a42c50fd7f52

QuickBoot: enable poweroff charging under QuickBoot mode

control native charger's enable/disable under QuickBoot
mode.

Change-Id: I4f80c74b042e03bddc9f7fe419f4ed1f8b1409d5

QuickBoot: Add wakeup check under QuickBoot mode

We only want QuickBoot application to wakeup screen in QuickBoot
mode. Add wakeup check to filter out other wakeup callers.

Change-Id: Id82a0938003d2a776efda0e39a57877f41fc1ee4

Conflicts:
	policy/src/com/android/internal/policy/impl/GlobalActions.java
	services/java/com/android/server/AlarmManagerService.java
	services/java/com/android/server/power/PowerManagerService.java
bootanim: Add continuous splash support

 * We may or may not want to have a very smooth transition from the
   bootloader into Android by way of a continuous splash feature.
 * Add a compile-time flag which disables the initial screen clearing
   so that we don't drop a frame during the transition.

Change-Id: Ic453c901f1030ffebd9bdbeec59109bb5c585629
server: start cne service

Connectivity Engine (CnE) provides advanced network selection per socket,
reduced signalling traffic, and increased power savings.
The service implements the interface defined by CNEManager which Android
applications may use.

Change-Id: I9ffd1f5d60f5e9e185ab482a35b3b07f29a4124c
(cherry picked from commit 3a4e3ba1bc67c460ec3c2fd4ef169ae25e3e69b1)
(cherry picked from commit 1bb0036652318ac8bbecf3e6c810bbc779387c61)
(cherry picked from commit 3c8af4a2546d9b71d113072d680107cb56651e71)
(cherry picked from commit 861a4b062196020bf24a5b3731c717b5b95a7d77)
(cherry picked from commit e3dba9799892f13c5bc2376b81cf5dceae17492c)

Add Connectivity Engine (CnE) WQE support

Enhanced connectivity features viz. Wifi Quality Estimation.
Supports dual network mode - wifi & mobile simultaneously.
Use QcConnectivityService when CnE is enabled for all CnE features.

Change-Id: I14b02e21515bfc1b5fd2fc4f28e5190fa80f83f8

server: Initialize ConnectivityService on low memory device

Skip initialization of QcConnectivityService and
use ConnectivityService.java for a low memory device

CRs-Fixed: 531430

Change-Id: I2111ec32f6e40ca79b7fc91ec4cef97ac27f3b3a

Update CNE feature values.

Start QcConnectivityServices for the new
application traffic profiling feature too.

Change-Id: I52ae76420ebd098d43fe0663f41ce622a407b90e

connectivity: allow inheritance to subclass

set modifier to protected in order to allow
subclass to use the same data and avoid redefinition.

Change-Id: I2dc688d3e433775cb073ec6faae3981807212cc9

Change visibility of methods

Change the visibility of some methods so that
they are accessible to the child class.

Change-Id: Ie1a45978b42742cac0aaedba29fb2375882c0ae4
CRs-Fixed: 611347

Conflicts:
	services/java/com/android/server/SystemServer.java
frameworks/base: Call setDirtyRect to update dirty rectangle

This change updates dirty rectangle instead of dirty region of a
surface.

Change-Id: Ic5c6e68ff644911a596a2432fd14868edbff9b17
quickboot: Only enable QuickBoot if package is installed

 * Also move to Settings.Global

Change-Id: I87e1464d717b41437072523c0ecab52227d7888b

Conflicts:
	policy/src/com/android/internal/policy/impl/GlobalActions.java
quickboot: Disable quickboot by default

* We probably don't want to enable this by default on devices that have
  it because it is confusing to users attempting to shut down their
  phones.

Change-Id: I80eb946f93509cb3b32f6c790611597921b9c54a
decouple SW FLP and HW FLP overlay flags

currently there is only overlay flag shared by SW FLP and HW FLP. This
change allows having different overlay setting for sw / hw FLPs.

Change-Id: I643fa70380e7568ae851d23e87917a5b4b599fe8
CRs-Fixed: 622338
Fix setSurfaceTexture to handle surface caching

Changed the TextureView.setSurfaceTexture to apply the
existing listener to the surface provided in the method.
This is done to allow surface caching to work.
Whenever a new SurfaceTexture gets created, its listener is
created as well, so when the setSurfaceTexture is called
we should be attaching the listener to the new surface.

Change-Id: I4c1a704c587e977ab7a6b1fe3a7d3e0d20d00218
CRs-Fixed: 639136
Bluetooth: pause music player on A2dp service disconnect

When A2dp service disconnects as part of SSR, it marks a2dp state
as unavailable in Audio module but does not pause music player, as
a result when bluedroid stack restarts as part of sub system restart,
media player does not pause and music continues to play on device
speaker.
This change helps to pause the media player, in addition to marking
a2dp as unavailable, so that media player pauses when a2dp service
forcibly disconnects as part of sub system restart with A2dp in
connected state.

CRs-Fixed: 590462
Change-Id: I05ee5bcc808eb438156b64181d54e8ccabe1e186
Bluetooth: Add Total track number.

Add support to add total number of tracks in
Meta-data

Change-Id: I5b1287f791615adcd4f920fe5c7cae0c7c7b04ea
CRs-Fixed: 627869
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
Media process is crashing with NullPointer exception

Sometime, while creating thumnails list of media files in
compose MMS->attach file,  filepath may be null due to
synchronization issue.
Adding NULL check to avoid NUllPointer exception.

Change-Id: Id6cf5612a959b3ae15b44bc60dbbcbe40c624f09
CRs-Fixed: 636494
frameworks/base: Fix change propagating issue

destroyLayer() function has been modified in kk. It is not correct
to propagate the UI corruption fix from jb to kk without considering
the new changes made in kk. This change is to make it align with
the new code in kk.

Change-Id: I34d11b230b9390fe8a989ab6f9c7d3a48d586205
Bluetooth: Adds check to verify Bluetooth adapter state

This checks whether bluetooth is turned ON or not in
BLE stop scan process. BLE scan apis are called from applications
so need to check if BT adapter state is ON to avoid Bluetooth
crash

Change-Id: Ifc472be9b3f8baf978d6cdca2e4743a75b951635
CRs-Fixed: 634617