WIP: Dark Gummy toggle

Change-Id: Ia0a04a92f3a98130e0369970ff8c671b637e4233
Merge "Frameworks: Fix memory leak + cleanup" into kk4.4
Merge changes Iaf656f1a,I58d63d34,I53455249 into kk4.4

* changes:
  FaceUnlock: Check if faceunlock is disabled
  Frameworks: fix possible NPE + and missing expandable panel
  Frameworks: Fix linked volume does not persist after reboot.
Avoid collision with RIL constant 1138, used in some Samsung devices for RIL_UNSOL_TETHERED_MODE_STATE_CHANGED.
Needs http://review.cyanogenmod.org/#/c/61292/
Thanks to iptux on XDA for pointing out the change in constants between
CM-10.2 and CM-11.0.

Change-Id: I64011408f4cce9aeb1b56e325226f8e649eff2b6
Frameworks: option to hide the noSim icon (1/2)

Change-Id: I4d2194046aabc577a66befa93d31763070b27ad1
frameworks/base: forward port DC-HSPAP support from cm-10

PS10: add new drawables, I need to add new QS drawables and also RTL support
PS11: fix blank space and prevents checkapi to fail
PS13: fixed tile icon and rebase

Change-Id: I1503c464b2db841fc193e57311e62415f5ff40f2
fix a couple of issues in frameworks/telephony

update phonenumberutils inline with cm
fix void for toggling lte

Change-Id: I435623e8c38e9edd68474c6704191bb0005bcc2a
make signal options multiuser capable

Change-Id: I16ed373ac8ef24a8f014d65aac4b687f40e1e3ed
Convert all selinux_android_restorecon and _setfilecon calls to new API.

libselinux selinux_android_restorecon API is changing to the more
general interface with flags and dropping the older variants.

Also get rid of the old, no longer used selinux_android_setfilecon API
and rename selinux_android_setfilecon2 to it as it is the only API in use.

Change-Id: I1e71ec398ccdc24cac4ec76f1b858d0f680f4925
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
base: Add theme support to Ringtone picker activitiy

Patchset 3: Add support for theme RingtonePreference view. The dialog is
            automatically adjusted to the caller activity base theme.
Patchset 4: Don't break the android api

For Ringtones:

http://review.cyanogenmod.org/#/c/61393/

For Profiles:

Usage:

Intent intent = new Intent(ProfileManager.ACTION_PROFILE_PICKER);
intent.putExtra(ProfileManager.EXTRA_PROFILE_DIALOG_THEME, R.style.CustomDialogTheme); <<< Add your custom dialog theme here
startActivityForResult(intent, 0);

Style Usage:

Define an style that inherits from an android base theme

<style name="CustomDialogThemeDark" parent="@*android:style/Theme.Holo.Dialog.Alert">

or

<style name="CustomDialogThemeLight" parent="@*android:style/Theme.Holo.Light.Dialog.Alert">

or define your own dialog style

Change-Id: Icadbcf2c617c51177466989acdab9435066a47a0
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
FileUtils: add method to get UUID of a volume

Change-Id: I41b76c5e01c82a2f8e67b33133a76947877a2814
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
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

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
Base: Check ProcessesReady before broadcast

Most of the time testIsSystemReady is used to know if we are allowed to broadcast intents.
But in broadcast intent method we check mProcessesReady flag (not mSystemReady).
If we broadcast after systemReady flag but before ProcessesReady flag, system will crash

Adding condition to check if system & processes are ready fix that race condition
Signed-off-by: Fabien DUVOUX <fabien.duvoux@gmail.com>

Change-Id: I2eec1c4f280daf29f4741919a7636b02da341e32
Don't confuse stat and stat64.

Bug: 11865851
Change-Id: I45e65036d86c58943b9c273777f3f8be79a6966f
Insufficient ProcessRecord cleanup when persistent process is killed

When persistent process with Service restarts, ActivityManagerService
does not reset ProcessRecord#hasClientActivites to false
(because ProcessRecord of persistent process is continued using
after killing).

It disturbs updating LRU list in ActivityManagerService, and then,
when new process calls ActivityManagerProxy#publishContentProviders,
SecurityException happens because of no entry in the list.

Bug: 13517358

Change-Id: I46b064f71a4f7025ade1bf117801352a7ab22e6a
AudioService: Fix absolute volume for AVRCP

Avrcp.java uses max volume obtained by getStreamMaxVolume() when
converting to AVRCP levels and it returns non-scaled volume index.
For this reason volume index needs to be dispatched to Avrcp before
scaling as otherwise Avrcp will convert volume level incorrectly,
i.e. max volume index for music stream is 15 and any volume index
>1 (>10 after scaling) will result in setting *MAXIMUM* volume level
on headset which is not safe for listener.

Change-Id: Ia799eec578ed2326ec18b69f2ee4f2a60c664514
Audio: Fixed system/call stream volume can't adjust with HS connected.

Issue Description:
When headset connected, the system/voice call stream volume can't be
adjusted from Volume bar.

Root Cause:
Currently adjustStreamVolume is applied to stream type alias and the
device for the stream alias. So when headset connected and adjust
volume for SYSTEM_STREAM, the operation will be applied to RING_STREAM
(which is aliased by SYSTEM_STREAM) and speaker. As headset is returned
from getDeviceForStream(SYSTEM_STREAM), but speaker for RING_STREAM.

Solution:
Change the adjustStreamVolume to apply volume to the stream alias and
the device for the stream type exactly.

Change-Id: Icd226d9eb197017cd3c186a0096edaed755680ec
Signed-off-by: Guo Xie <gxie@marvell.com>
Prevent Lockscreen album art from activating FLAG_KEEP_SCREEN_ON

This is a small fix to the showWallpaper method, in which a power
consumption problem has been introduced. This showWallpaper method
toggles the window flag FLAG_SHOW_WALLPAPER, when album art is being
shown in Lockscreen. It is important to set pixel format to
PixelFormat.OPAQUE if flag FLAG_SHOW_WALLPAPER is not being set.

If not, an application that uses window flag FLAG_KEEP_SCREEN_ON
will prevent the keyguard from going to sleep and drain battery.

Change-Id: I1808be28047977ae5ac4dd1168ea25cac8a55a78
Solve three memory leaks related to PatchCache

A Patch can be fairly large, holding bitmap data, but
is also frequently leaked which adds to the severity.
The feature is used in many important processes such
as Home, SystemUI and Chrome.

The following leaks are solved:

1. The Patch itself was not always freed.
PatchCache::removeDeferred() can mark patches to be
cared for by PatchCache::clearGarbage(). But
mCache.remove() would only destroy the container
and the pointer, not the Patch object itself.

2. The vertices stored in the Patch at Patch::createMesh()
would always leak. The empty/default destructor in Patch
would not properly destroy "vertices" since it's just a
pointer.

3. A BufferBlock that's added to the mFreeBlocks
in PatchCache could leak. The leak happened when a
patch later needed the entire free block, because the
object was removed from the list but never deleted
in PatchCache::setupMesh().

Change-Id: I41e60824479230b67426fc546d3dbff294c8891f