Add heap configuration for 1080p phones with 2048m

 * Increase heap start size to 16m to minimize GC with larger bitmaps

Change-Id: I8fbba2e5a2a2cf2d7a6898ca6bae8639d6cf5a19
provide overrides for hwui memory limits for xxhdpi phones

Change-Id: I8b369619cd07530d0468a5449da30f338c13c7d2
hwui: Update configuration for 2GB/1080p devices

Change-Id: I73357a35bee22d76d3fe8a98ece91c5c9d19371d
[2/2] Speed up booting on multicore devices.

Add multithreading support.

Change-Id: I13630de9d75d13c0368d261b3564b787067b65b1
native: TRDS 3.0 and new theme engine preparation (2/4)

For the one who do not know this feature see as reference
the first two versions here:

https://github.com/SlimRoms/frameworks_base/commit/b330fde28306286572ba390e451a72539c0c3576

https://github.com/SlimRoms/frameworks_base/commit/3194015737b7944b4185fca007b8d167a0675cd8

we got now over a year now a lot experience how to handle the qualifier fallback
as well how to theme it and how to handle other apps. Based on this knowledge we
redid some parts of TRDS engine with following new features/additions and fixes
to have now a final perfect working TRDS

- compared to the old versions where it was needed on some apps to restart them
  in background this is not needed any more. All is handled about the internal
  AOSP resource handling and on qualifier change the caches are cleared
  and the apps get an onconfigurationchanged to restart the activity
  like it is doing on orientation change eg
- inverted folder is now depreciated and the new folders are holodark
  and hololight which allows on the one hand a dark theme (at least
  how TRDS started) and a light based theme hololight
- This name change is mainly because of the new theme engine which
  will come which uses this as base to add 2 external themes at the same
  time and give the user the ability to switch between them. But this is
  still in early stages and this commit is just the preparation for it
- Two new automodes are now integrated. User can enable the twilight modus
  which enables/disables holodark/hololight depending on the daytime...means
  on the evening it switches to holodark on normal day it is hololight.
  The other automode is based on light conditions....means that if it is
  dark outside it switches to holodark....if we have bright light conditions
  it switches immediatelly to hololight. Due of the resource cache handling now
  this happens immediatelly for the user and feels completly system integrated
  and happens without delay. A bit comparable to some navigation tool for cars
  which can switch automatically from dark to light and back
- currently the auto modes as well the manual mode switches between holodark
  and hololight. Due that we do not have currently anything hololight themed
  in the source hololight = stock theme. We will give the user the ability
  later when done to choose between which modes the user want to switch
  (stock/holodark/hololight). But this does not make sense at the moment.
  As soon as we have done the light theme or theme engine (lets see what
  comes first) we will open the ability to choose it. This is only a small code change
- a lot small tweaks and fixes went as well into the new version

Whatever this commit as usual adds the support for it. The themeing is done in the
other commits by kroz which is as well way more extended then on the older versions

cheers
Change-Id: Ibc5aaec5661455477815043440fae86052a395ce
Add GESTURE_SENSOR input source

Change-Id: If61a7e7bf2d8b2665db7ca57ed68a4462d0c1783
GC triggering performance optimizations.

Copy the correct starting heap size at process init.
Interfaces to set GC/managed heap parameters.

Change-Id: Ia2b158aa28254d88f68c9534a0eef580aa811b10
(cherry picked from commit 60c25a585aaa81496e83fb134502594caa0dceb6)
(cherry picked from commit 8873acb0ffc224388eeadc7204ddb6bff4819c7f)
(cherry picked from commit 6ca5469d1fbfb432a945df49e276fc4edc1eff87)
Extend installd to support SELinux restorecon function.

Implement new restorecondata function which will allow
the relabeling of /data/data and /data/user directories.
This is needed in the case of certain OTAs. Not every
boot will apply this relabeling however. Consult change
I77bf2a0c4c34b1feef6fdf4d6c3bd92dbf32f4a1 for
clarification on this issue.

Change-Id: I05e8b438950ddb908e46c9168ea6ee601e6d674f
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
restorecon /data/media when re-creating it for multi-user upgrade.

Change-Id: I112c61863f2104d1962697c54cff25106e9b48a0
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Proper security labeling of multi-user data directories.

Add seinfo paramater to appropriate make directory
functions. This allows proper labeling for multi-user
scenarios.

Change-Id: Iaba7c40645bc7b6cc823d613da0c3782acf6ddd5
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
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>
New command line tool 'idmap'

Introduce a new tool 'idmap' to handle generation and verification of
idmap files. The tool is modelled on 'dexopt', and is intended to be
used similarly, notably by 'installd'.
See cmds/idmap/idmap.cpp for further documentation on 'idmap'.

Note: this commit is interdependent on a commit in project build/ to add
'idmap' to PRODUCT_PACKAGES.

Note: the changes to androidfw are only stubs. The actual implementation
will be provided in Runtime resource overlay, iteration 2.

Change-Id: I7131b74ece1e46c8a9c0a31d103e686aa07da2bb
Runtime resource overlay, iteration 2

Support any number of overlay packages. Support any target package.

UPDATED PACKAGE MATCHING
------------------------
In Runtime resource overlay, iteration 1, only a single overlay package
was considered. Package matching was based on file paths:
/vendor/overlay/system/framework-res.apk corresponded to
/system/framework-res.apk. Introduce a more flexible matching scheme
where any package is an overlay package if its manifest includes

    <overlay targetPackage="com.target.package"/>

For security reasons, an overlay package must fulfill certain criteria
to take effect: see below.

THE IDMAP TOOL AND IDMAP FILES
------------------------------
Idmap files are created by the 'idmap' binary; idmap files must be
present when loading packages. For the Android system, Zygote calls
'idmap' as part of the resource pre-loading. For application packages,
'idmap' is invoked via 'installd' during package installation (similar
to 'dexopt').

UPDATED FLOW
------------
The following is an outline of the start-up sequences for the Android
system and Android apps. Steps marked with '+' are introduced by this
commit.

Zygote initialization
   Initial AssetManager object created
+    idmap --scan creates idmaps for overlays targeting 'android', \
           stores list of overlays in /data/resource-cache/overlays.list
   AssetManager caches framework-res.apk
+  AssetManager caches overlay packages listed in overlays.list

Android boot
   New AssetManager's ResTable acquired
     AssetManager re-uses cached framework-res.apk
+    AssetManager re-uses cached 'android' overlays (if any)

App boot
   ActivityThread prepares AssetManager to load app.apk
+  ActivityThread prepares AssetManager to load app overlays (if any)
   New AssetManager's ResTable acquired as per Android boot

SECURITY
--------
Overlay packages are required to be pre-loaded (in /vendor/overlay).
These packages are trusted by definition. A future iteration of runtime
resource overlay may add support for downloaded overlays, which would
likely require target and overlay signatures match for the overlay to
be trusted.

LOOKUP PRIORITY
---------------
During resource lookup, packages are sequentially queried to provide a
best match, given the constraints of the current configuration. If any
package provide a better match than what has been found so far, it
replaces the previous match. The target package is always queried last.

When loading a package with more than one overlay, the order in which
the overlays are added become significant if several packages overlay
the same resource.

Had downloaded overlays been supported, the install time could have been
used to determine the load order. Regardless, for pre-installed
overlays, the install time is randomly determined by the order in which
the Package Manager locates the packages during initial boot. To support
a well-defined order, pre-installed overlay packages are expected to
define an additional 'priority' attribute in their <overlay> tags:

    <overlay targetPackage="com.target.package" priority="1234"/>

Pre-installed overlays are loaded in order of their priority attributes,
sorted in ascending order.

Assigning the same priority to several overlays targeting the same base
package leads to undefined behaviour. It is the responsibility of the
vendor to avoid this.

The following example shows the ResTable and PackageGroups after loading
an application and two overlays. The resource lookup framework will
query the packages in the order C, B, A.

        +------+------+-     -+------+------+
        | 0x01 |      |  ...  |      | 0x7f |
        +------+------+-     -+------+------+
            |                           |
        "android"                Target package A
                                        |
                       Pre-installed overlay B (priority 1)
                                        |
                       Pre-installed overlay C (priority 2)

Change-Id: If49c963149369b1957f7d2303b3dd27f669ed24e
New Theme Engine [2/6] CM11 Themes

See frameworks/base themes commit for full summary.

[SUMMARY]
1. Modifies idmap binary to include target APK in filename. Needed so one theme apk can have multi targets.
2. Allows aapt to be called via installd. Needed to compile resources found in a theme apk's assets folder.

[IDMAP EXAMPLE]
OLD: vendor@overlay@overlay.apk@idmap
NEW: vendor@overlay@overlay.apk@system@app@target.apk@idmap

[CONTRIBUTORS]
Andrew Mast <andy@cyngn.com>
Clark Scheff <clark@cyngn.com>
Special thanks to Mårten Kongstad and the rest of the Sony team for their work in idmap.

Change-Id: I0cb15830109ac36780c015e61348c00ec08d24a1
CM11 Themes: Store hash codes for target and overlay in idmap

Due to some system packages always having the same last modified
time stamp of 08/01/2008 we must use some other unique value to
determine that the contents of either the target or the overlay
have changed.  This unique value will be passed down from the java
layer and written to the idmap header.

This change requires the following patch from frameworks/base
http://review.cyanogenmod.org/62565

Change-Id: I0adcafaca96110268766d6e3349414364ecea4c3
CM11 Themes: Pipe stderr from aapt to logcat.

This will allow users to see why aapt failed when installing a
theme.

Change-Id: I74314daae9e844dce2f4c3eeb6c78a40b5ad6357
CM11 Themes: Common overlay for sharing resources. [2/2]

Change-Id: Ied21ede2f36ba16dd190bc1e6cec44fd8560ca90
Themes: Fix -110 install error [1/2]

aapt was being called from PM with a ' ' at the end of the cmd. This would
cause installd to read unexpected parts of memory which sometimes
causes it to parse the command incorrectly.

Change-Id: Id9f1170db05b40f030d6ea5009bed38bc9fc3b5f
Avoid calling idmap w/ trailing whitespace [2/2]

installd performs a buffer over-read if trailing ws is sent to it.
No observable effect found yet for idmap, but until installd is
fixed upstream, best to play it safe.

Change-Id: I002de7a9d177df16f91b47e7f87af59457c1f421
Merge tag 'android-4.4.3_r1.1' into kk-4.4.3

Android 4.4.3 release 1.1