Themes: Build icon cache when applying icons

The theme service will schedule building of the icon cache when
an icon pack is applied.  This will allow the icon cache to be
populated immediately after icons are applied rather than build
it up as icons are requested.

Change-Id: I453eda5f6298ff79e22827c622a0eddcab9c721d
Themes: Pass resource IDs instead of bitmaps [1/2]

Rather than passing around bitmaps in the ComposedIconInfo we
can pass the resource IDs associated with each of the components
and retrieve those drawables when composing the icon.

Change-Id: If855e60e505571f25316e6728e423fbee62c32d3
Themes: Allow clearing the wallpaper and ls wallpaper

By providing an empty string for the MODS_LAUNCHER and
MODS_LOCKSCREEN components, the theme service will clear out any
existing wallpaper the user had set.  This provides the same
functionality as if the user was picking "No wallpaper" from the
picker.

Change-Id: I0c349ad4afa2bcef2c302105315709786510c0aa
Themes: setUserRequired(false) when updating audibles

This prevents the following exception
F/Environment(18007): Path requests must specify a user by using UserEnvironment
F/Environment(18007): java.lang.Throwable
F/Environment(18007):   at android.os.Environment.throwIfUserRequired(Environment.java:787)

Change-Id: Ic6ac7537079ed27912c40683c877e05992b708e9
Make sure ThemeConfig is non-null when loading resources

When the device boots into safemode, the theme config will end up
being null and we need to check that prior to using it to retrieve
resources for the StatusBarIconView

This fixes CYAN-5009

Change-Id: I1a90bc9f9c65cb41a6e58947bbd1b6d7728a952b
Themes: Add ability to apply color filters to composed icons

Themes can include one or more of the following filter tags in
assets/icons/res/xml/appfilter.xml

    <!-- HUE filter
         Integer value between -180 and 180 representing the degree.
         0 = no change
    -->
    <filter name="hue">0</filter>

    <!-- SATURATION filter.
         0 = grayscale, 100 = no change, 200 = over saturated
    -->
    <filter name="saturation">0</filter>

    <!-- BRIGHTNESS filter.
         0 = pitch black, 100 = no change, 200 = 200% brightness
    -->
    <filter name="brightness">100</filter>

    <!-- CONTRAST filter.
         -100 = minimal contrast, 0 = no change, 100 = maximum contrast
    -->
    <filter name="contrast">100</filter>

    <!-- ALPHA filter.
         0 = transparent, 100 = opaque
    -->
    <filter name="alpha">75</filter>

    <!-- INVERT filter.
         Valid values are true or false
         true = invert colors
    -->
    <filter name="invert">false</filter>

    <!-- TINT filter.
         A hexadecimal value representing ARGB
    -->
    <filter name="tint">#ff0000ff</filter>

Change-Id: I2431237dd2766176be16c730020557ce87d623e4
Themes: Fix icon filters clamping to wrong values

Change-Id: Iab3cce465f8bdfd7c30a020fda254728349c5ebe
Themes: Make sure composed icon info is meaningful

We don't want to try and create a composed icon if the parts that
make up a composed icon are not valid or set.

Change-Id: I3d9e7432e4b351de9c0a4e662e028932ee7f08e2

Conflicts:
	core/java/android/content/res/Resources.java
Fix Z-Recents Crash
Themes: Fix blurry composed icons

In a composed icon the original icon could be scaled incorrectly
due to a density mismatch resulting in blurry icons.

For example, Grouper has a screen density of 213 dpi but Trebuchet will want to show a larger icon and therefore
requests to the framework to load app icons with a slightly higher density of 320dpi (XHDPI bucket).

When Resources.loadDrawable(TypedValue value, ...) is called, it will use observe value.density. Since the image
is from the XHDPI bucket it will have a TypedValue.density of 320dpi, much higher than the screen's 213dpi, and therefore
loadDrawablei() will configure BitmapFactory to scale down the image to match the screen density. This is not what we want,
so this patch modifies the density value to prevent scaling, much the same way getDrawableForDensity() does.

Change-Id: Ie638c8576872f9115dc029bb4823b50bb31ecebf
Themes: Load missing style attributes from original style

If a theme overrides a style in an app and does not include all
the attributes found in the original, it is possible for the app
to crash because it cannot locate an attribute it is expecting.

To overcome this we need to check the attributes in the original
style's bag and add any missing attributes to the current bag being
populated.  Currently we have only seen one theme that causes this
behavior, but there could be others out there or we may eventually
see this happen in the wild as apps update and the themes have not
had a chance to incorporate the new additions from the app.

Change-Id: Id44aa83a6c58a0b042d2b32171bed5e794352670
Move idmap to frameworks/base [2/2]

idmap depends on libandroidfw, so it should go in frameworks/base.
This follows AOSP which moved idmap to frameworks/base back in
February of 2014.

Change-Id: Ice308a5299a69fd1fbc084a7c76a317c7dec3689
frameworks: add ongoing notification while collecting bug report

Change-Id: I644da7046b3cbbd0ec601f0e35dfbad6adf4dcf5
Signed-off-by: Roman Birg <roman@cyngn.com>
Themes: Avoid NPE when setting text in TickerView

It is possible, with the right timing, to receive an NPE in TextSwitcher
when a notification comes in during recreation of the status bar because
of a theme change.

Change-Id: Ia35ad0346f232df905ecff69158b71f3bf61a163
Themes: Fix setting wallpaper from a legacy theme

Change-Id: I3bfc9ee24d2a3ee5c1bdb97f2c07427e6d723206
Themes: Track NotFoundException on app launch failure

We should probably keep an eye on NotFoundExceptions too since they
are a common exception thrown when a bad theme is applied.

Change-Id: I2ccaed0349a90ab99b99fb83cef0c9183d598088
Themes: Remove listener if exception is thrown

If something goes wrong and a client does not remove itself, the
theme manager may still have a reference to the listener and an
exception is thrown while trying to call one of the listener's methods.
When this happens, we should not only log it but remove the bad listener.

Change-Id: I052cdcc10b0eaa75ebf076b3ece5f8a668d3868e
Merge branch 'ose' of https://github.com/Team-OSE/frameworks_base into HEAD
SlimPIE: Configurable sensitivity [1/2]

Change-Id: I695c892f045b4201e75eae5c183b976c273750b3
Signed-off-by: Lokesh Chamane <lokesh.c703@gmail.com>
Themes: Fix native crash in libandroidfw

If a missing attribute needs to be added in somewhere in the middle
of the bag, a segfault would occur because we change curEntry to a
value that is beyond the set's allocated space.  This patch stores
curEntry in prevEntry before changing it's value and memmove uses
prevEntry to index the set.

Change-Id: Ie70f2ad465097c3acf76caa729999c424fb01ee2