build: Degreenify java

Change-Id: Iac348407997f7e52844af0494ee59762df0819d7

Conflicts:
	core/java.mk
releasetools: use variable instead of fixed name for bootable image

When building for a device with a custom bootimage makefile, this
would cause the boot image to be used as the recovery image during
fastboot zip creation.

Change-Id: I075cfe4e9a2a8384d3767de351ec7f751f3e95ab

Conflicts:
	tools/releasetools/common.py
releasetools: Add radio images to fastboot packages

Fastboot packages should include radio images, if they exist. Also
generate a flash-radio.sh file if a filesmap file exists to indicate
the partition that a radio image should be flashed to.

Change-Id: Ic3392cc76407408b98aad00f36f4dfa3b9be176b
build: edify: use set_metadata for backuptool

Also use saner permissions on backuptool.sh

Change-Id: I50742b51867aa358f5924b8dc208833092a35bd9
Wrong product package: Gallery was replaced by Gallery2

Change-Id: Ia34e1fa9bc9ac494fac098eb86a5ddab78b6d149
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
build: Disable languages that have no translations

These languages have no translations at all and have no active maintainers
There is no point in having them enabled.

Change-Id: I2b0f6ca23ffb8c176edd38d67eddd35e4f78bc23

Conflicts:
	target/product/languages_full.mk
	target/product/locales_full.mk
Remove extra product property overrides

This appears to clash with vendor/cm/common mk's for overrides; causes
a broken default alarm (and OnTheHunt is so bleh).

Change-Id: I5ec990d3c5ad56b573c45f1a3b20169c989851a0
releasetools: Modify regex for radio files

The filesmap file may contain additional information (such as a
sha1 hash) after the parition name. We should still work in these
cases, but can ignore the additional data.

Change-Id: I0feaa5e94d48fa94b66b6c07e1946674fe703d85
build: Don't build video editor libraries

These are already defined in vendor/cm/config/common_full.mk
We don't want them included in common_mini_* builds
since we don't include video editor there

Change-Id: I7dae9c6736590be8cd080195da4062258ee4a424
releasetools: Add a newline for radio flashing scripts

When multiple radio images exist, make sure we put a newline at
the end of each flash command.

Change-Id: If113c88eb6dc90d2499f06c12e00494d7266a672
Colorize javac errors

You know those multi-line ones that are frequently interspersed with other buld output?
The ones that don't even have the word "error" in them to search for? The ones that make you look for an hour before finding them?

This makes them red.

ps2: fix jar_check failures cause by leaving empty stderr files in intermediates dirs
     this is probably not the best place to store stderr before colorizing it if javac
     exits non-zero, but it seems much lighter than mkdiring a bunch of temp directories
     or using sed to mangle the paths to point to per-intermediates directory unique
     temporary file names

Change-Id: I3b9b7d8a0c76958588ac1603b6742987d6dde54c
Signed-off-by: nuclearmistake <nuclearmistake@gmail.com>

Conflicts:
	core/definitions.mk
build: core: Parameterize recovery with a variant

Include extra vendor config early.  If RECOVERY_VARIANT is set, use it
to look for the recovery in an alternate path.

Change-Id: Iba54f0746d728c0dfeeb67b4d3166d5e25b1b5d7

Conflicts:
	core/pathmap.mk
derp
tools: getb64key - print the base64 version of a PEM public key file

Change-Id: Ia94ff560c88dfe85c3fa55db5c8219aa0d3419ee
Store the base64 release key in the OTA zips

This can be directly grepped in pre-existing package.xml tables
to make sure we're not trying to update to a differently signed
build

Change-Id: I7528a8e7c484ea9209cd665b9263328ae834586a
releasetools: Properly handle boot images that use dt

Instead of using a prebuilt boot/recovery image, bring the dt image
into the target files package and use it during package creation

Change-Id: I70ecf74423aad95a3eb8e085029c37450ae354a2

Conflicts:
	core/Makefile
	tools/releasetools/common.py
releasetools: Fix whitespace error for INSTALLED_DTIMAGE_TARGET

Copy/paste produced spaces instead of a tab; fix that

Change-Id: I937e5f6ffd2c947c77dc4baa7427b170c1ea4bcd
build: use /usr/bin/env to call python

Hardcoding the path to python instead of env is not recommended.  This
can break the build in some Linux environments that link /usr/bin/python
to python3.

Change-Id: I4c62eb391acc6d468ce24ac8640834e965e76e78
releasetools: bring back boot.img handling

This is required for galaxysmtd and other devices with custom
boot format.

This partially reverts "releasetools: Properly handle boot images that use dt"

Change-Id: Ib35001c2d9b906067e5a3c84712dc3a283a38cbb