hwui: Fix a sporadic crash seen during CTS runs

 * It's possible (due to race conditions) that a patch might be
   scheduled for removal twice. Just print a warning and continue
   instead of asserting and crashing.

Change-Id: I42865f6717816a743cc49ba15b839e6c3b57ed83
advanced reboot: add soft reboot option

Adds a "Soft reboot" option which restarts zygote, as requested in JIRA
CYAN-3998

AOKP: This is based on the original commit. However we are handling the
      reboot dialog differently.

Change-Id: Ia6e5ed9b053e1c5ebd1fc55e5692858b97f7e0fc
Signed-off-by: Roman Birg <roman@cyngn.com>
Fix attribute resolution in theme lookup

[Fixes Known Issues]
1. (CM) Chrome beta crashing w/ Hexo applied and menu button is pressed.
2. (AOSP) TextAppearance - fontFamily attr is incorrect (looked up in wrong package!) when
    a string value is defined in a style, and that style is set as the app's theme.

[Terminology]
1) Theme:    is the standard android definition of a theme.
             e.g in your manifest you may set android:theme="@style/foo"
2) CM-Theme: will be a Cyanogen theme. e.g. "Hexo"

3) Block: Also called index. Can be considered the cookie or ID to lookup a package in the resources.
          When a CM-Theme is applied, block 0 is framework, block 1 is the app, and block 2 is the
          CM-Theme.

[Background]
When a value for an attribute has not been found, the last resort is to look at a theme's base value.
This is done by using theme->getAttribute(...) which will return the value. The value is
unresolved if its a reference type. The block value will also be returned.

Since the value may be a reference and therefore unresolved, a call is then made to
ResTable::resolveReference(..) to do the final resolution. As part of its input, resolveReference
takes a block as a starting point.

In the case where resolveReference(...) is asked to resolve something that is not a reference,
for example, a string type, then it will simply return the same value and block. *Important* The block
value is then saved for the next call to get an attribute value. So if this block value is wrong
it will remain incorrect.

Therefore if resolveReference is passed the wrong starting block with a string value, then the wrong
block will be returned.

[Example]
1. 0x0101009b (android:attr/textColorLink) is first attribute to be looked up.
2. textColorLink has a value of 0x01020123 which maps to theme id 0x01020111. The block for theme
is "2" so block is set to 2. The value for this attribute is put into the array.
3. 0x010103ac (android:attr/fontFamily) is the next attribute to be looked up.
4. fontFamily is found in the theme as type string. The value is 0x7b9 (1977) and newblock variable
   is set to 1 since this value is found in the app's string pool. The block variable still == 2.
5. resolveReference() is called with block=2. The function does nothing and returns block=2.
   The fontFamily thus is stored wtih value=1977 and a block value of "2" instead of "0".

Change-Id: I2b979911b1b8ffb79c4cf310ae60682c84c11fcb
DocumentsUI: fix white action context bar in TRDS tablet view

Change-Id: I3c580a2aa4f8abbcfd06ad974518343f6e9190c5
PackageManager: Let system-defined permissions take precedence over settings

If a permission was already present in the device's settings due to having
no prior system definition, and the system tried to take it over
(after a version upgrade, for example), it'd fail, since the saved
value would clobber the one previously read from the permissions XML.

This breaks system-behavior changes (gid grants, in particular) unless
the user performs a factory reset after upgrading, which isn't acceptable.

Change-Id: If2e44110f6db735ad29cdf1086e814bd1299e290
MIUI carrier default to OFF

Fix logic

Change-Id: I1e0804e21efcd61a4f2a647fce52dc99e6efd869
Revert "Fix halo fc"

This reverts commit 34804790f81ecc290af2dd7e34dfaf0f07786bff.

Change-Id: I0f760f5952c496c5a9b403bc50924c591f2d4f13
Merge "Revert "Fix halo fc"" into kitkat
Fix logic again

Change-Id: Ie791e587068e107a2467eab556bcf10b7159a5ce
Merge "power: Add panel auto-brightness configuration" into kitkat
power: Add panel auto-brightness configuration

 * Some panel hardware requires that we twiddle some knobs in sysfs to
   enable proper display calibration (gamma, etc) when auto-brightness
   is enabled. Add a configuration value to handle this.

Change-Id: I3c793c3520fc6f9a18d5a3abf1fe0df803c5e580
Update styles.xml

Updating notification Text for Theme chooser

Change-Id: I32eec73c95ade37c36c03b4ef319beb5e81ed19e
Merge "Update styles.xml" into kitkat
Merge remote-tracking branch 'ap/kitkat' into kitkat
FWB: Show Heads Up on Bottom [1/2]

AICPfy

Change-Id: I7fbc6d5548f88913e299e91b8edd1563aeae736e
Support showing carrier/provider logo on statusbar [1/2]

- Added Toggle for users that don't like this feature
- Fixed icon size to match other statusbar icons so it doesn't look out of place

Change-Id: I98e70258af574ba42d0aa58853bf531e575f8d13
Fix halo fc

Change-Id: I57cfebfecad8ab8ba0a0b97af66d142e6adb2ef8
fix build

Change-Id: Ice83504b2a647d074249fedad2d166f93d1711cf
Themes: Only process themes that are applied during boot

Currently, the PackageManagerService will process all themes and
ensure their resources are compiled and available to the system.
This is highly inefficient and can bog the system down when booting.

This patch will only process the themes that are currently applied
durring boot and lets the ThemeService take care of queuing up the
others for processing.   This reduces boot time considerably,
especially when the user has many themes installed.

Change-Id: I52168a1751ad3bfc458048dd1558ad71cc16317a
Fix for carrier logo white space on first boot

Change-Id: I5843e72381d571bcc14c2ec3fb59d89b16ef5360