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

Conflicts:
	core/java/android/app/IconPackHelper.java
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
Fix ressource leak in getFileCrC

Change-Id: If8a63fa355664d360aab6ecba92c82cd56b745b8
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
Revert "QuickSettings : Register/unregister cast tile one time"

This causes a CTS failure: android.security.cts.ListeningPortsTest
  testNoRemotelyAccessibleListeningUdp6Ports

This reverts commit e037c1fe6dbdcd077719f7fc7b1902a887b56c23.

Change-Id: Idc145b6fb17490664fb5614d44e1ae92c98df844
Add navbar background preview to ThemesContract

Change-Id: Id3ed43c86649b1757fec7f3fc7dee2d2730258e2
Fix JNI error in exception reporting.

There was a JNI error where when you got an OOM and called
report_exception, it would call two NewStringUTF in a row without
checking the return values. This could mean that the first one
threw a new OOME and the second one would cause a JNI error when
it also attempted to throw an OOME with a pending OOME.

Bug: 16843627
Change-Id: Ie4f9f9a5f8b7993cd3655d42a6718c0a5e1199f8
HOVER: A few improvements

- Better touch outside touch input handling
- On touch outside hide both case (expanded and non) in 1.25 secs
- Tweak clear foreground notification when we are on the same app
- Code style
- Tiny cleanup

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Change-Id: Ibb0c7c09ae3256bbf744f359cca651c8cb8112d9
Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/notification/HoverLayout.java

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/notification/HoverLayout.java
ExpandHelper: Improve one finger expanding forced handling

Instead of force returning false if view is null, setup a boolean
to force it with custom views like hover. Cherry-picked from CM.

Also request disallow intercept on drag started.

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>

Conflicts:
	packages/SystemUI/src/com/android/systemui/ExpandHelper.java
	packages/SystemUI/src/com/android/systemui/statusbar/notification/HoverLayout.java
Don't unnecessarily set LayoutParams on children

Setting LayoutParams on children triggers requestLayout
which can be expensive and result in significantly lower
framerate for children layouts that don't need it. When
requestLayout method is invoked the needToMeasure boolean
will be true, this is what we'd like to avoid unless
it is actually needed.

BUG: https://code.google.com/p/android/issues/detail?id=72733

Change-Id: Id5d8f3431b5f943b1279eae41ee43d32a99514fc
Signed-off-by: Jacob Abrams <satur9nine@gmail.com>
[ActivityManager] Prevent provider creating twice.

Root Cause:
If a process which contains provider is starting by not
from accessing provider, e.g. service/activity/receiver,
its providers' will be created during handleBindApplication.
And before the process complete publish provider to
ActivityManagerService, if there is an access to its provider,
these providers will be created again (there will have 2nd onCreate).

Solution:
Check if provider record is existed, do not schedule install provider,
becuase it is already creating and will be published later.

Change-Id: Ic200ceae042c014c86e7edee0acd013b513af334
ActivityManagerService: Penalise large apps going to background

Large applications (PSS more than a given threshold) when closed are
penalised with higher ADJ. Now, they will be more prone to be killed by
lowmemorykiller during memory pressure levels. This ensures better app
concurrency and improved subsequent latencies as it leaves some more room
for other smaller bg apps to be alive

Change-Id: I448fa12f55370949b22075595cd75b9c29e5d4b5
Prevent killing of process during service bringup

ActivityManagerService sometimes kills the process whose service
is being brought up during bindService.
This happens when the process starts hitting some Pss threashold.
Specifically this is causing InCallUI process to be killed during
bind request from Phone app.

CRs-Fixed: 681329

Change-Id: Id548a22d7e7ce3aa0b0511763078f813fafd6e16
Add reboot reason to detect device shutdown

This change will detect silent device shutdown

Change-Id: Ia3c13e372b02dd4d3ec4a99d1c1f7c4787977ac3
SystemServer: Move sensor init to a new thread.

Move Sensor init to a separate thread so that it doesn't block the
critical booting path.

Initializing Sensors in separate thread has been seen to improve boot
time on customer devices with low-tier / ult chipsets(less cpu cores)

Change-Id: I5c46a5805c04ffe551019b4683523e3bf70274a2
Magnification: Fix screen freeze after activity resumes from rotation

mMagnifedViewport.onRotationChangedLocked() will call setShown(),
and then cancel a anime. As the anime should be only canceled in
a looper, if it is executed in the onRotationChangedLocked() of
DisplayMagnifier, a crash will be caused. Therefore when the
magnification is enabled, the activity will crash after rotation.

Move mMagnifedViewport.onRotationChangedLocked() from main thread
into the handler. When MESSAGE_NOTIFY_ROTATION_CHANGED is received,
execute it. As handler is created with a looper, the crash will be
fixed.

CRs-Fixed: 541799

Change-Id: I2a78f24f73d5a9b8693e557d18e2fb01fcaec8fa
User defined wifi/usb tether network. [1/2]

Change-Id: I1989c5332ba598a04094b03d6a5de32d72f7fa1c