Remove T-mobile items not used by new theme engine

Change-Id: I1e9c14e63ec25fdff61cfd2b7b8a05b1e488e558
Move theme strings to cm_strings.xml

Also correct application->app

Change-Id: I13afe2b810ccb8f9a5fa9484a5cd93ec9820ed6e

Conflicts:
	core/res/res/values/cm_strings.xml
CM11 Themes: Take into account ALL res/xml dirs

Only res/xml was being searched for redirection XML files, which
causes themes that use xml-v14, xml-v19, etc to be overlooked and
resources not being mapped.

Change-Id: I8ccad5770250150a95ec3b89be56f8d01025b126

Conflicts:
	core/java/android/content/pm/PackageParser.java
derp
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

Conflicts:
	core/java/android/app/ContextImpl.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
	services/java/com/android/server/pm/PackageManagerService.java
Runtime resource overlay, iteration 2, test cases

Add automated test cases for runtime resource overlay, iteration 2.

The test cases are a mixture of 'adb shell' commands and regular
instrumentation tests. The device is rebooted between tests to setup
different overlay scenarios for framework-res.apk.

To verify Runtime resoure overlay, iteration 2, run
    $ frameworks/base/core/tests/overlaytests/testrunner.py

For a list of supported options, run
    $ frameworks/base/core/tests/overlaytests/testrunner.py --help

Change-Id: I692aa1a7ad073efd116b24f9ec7f197dfd65dfef
CM11 Themes: Use 32bit hash to decide if idmap should be created

Using the last modified time of the package to determine if an idmap
should be created is not always valid for system packages.  We have
observed some packages having a time stamp of 08/01/2008 even if the
package has changed.  This causes system packages, such as
frameworks-res.apk to not be properly mapped if IDs changed in this
package.

This patch will generate a 32 bit hash code based on the file's
MD5 sum.  This hash code is then provided to idmap for writing these
values into the idmap header for future comparison.

This patch requires the following change found in frameworks/native
http://review.cyanogenmod.org/62566

Change-Id: Ie9e0273aef96217f06b08774623dd5f1b290a3da

Conflicts:
	services/java/com/android/server/pm/Installer.java
	services/java/com/android/server/pm/PackageManagerService.java
Cleanup theme assets when done with them

Before this patch if phone was left on long enough it would reboot
when a theme was applied due to files being left open.

Change-Id: I4c242249fcf6e8097789c3dd6690104296485784

Conflicts:
	libs/androidfw/AssetManager.cpp
CM11 Themes: Put overlays in their own group.

Overlays will now be added to their own group and the
target group will contain a pointer to the overlay
package to be used in getResource and getBagLocked.

Change-Id: Icc6c6eb791f04966e68dbc099eae8e7129546414

Conflicts:
	libs/androidfw/ResourceTypes.cpp
CM11 Themes: Remove type matching restriction

Change-Id: I5a8ac8ff1794350ff9dc03b378c704bfb97d0a9e
CM11 Themes: Allow forcing idmap (re)creation.

Change-Id: I9f5938e9b1052da83b7f2cd7b1ff6f1ed270db6b