SystemUI: Display Pie in forced immersive mode

When an app developer decides that it is needed, immersive mode can be
turned on by the app. Prior to this commit, the stock navigation bar
was always shown when it was done. This commit creates a special
immersive mode (forced immersive mode) which is enabled when an app
requests immersive mode (status bar and navigation bar can be hidden)
if the user has chosen to use Pie prior to this. This mode then makes
Pie appear instead of the stock navigation bar.

It should be noted that this also introduces a minor issue when the
user turns off the standard immersive mode as when doing so, the new
forced immersive state is enabled until the QS panel is closed/swiped
up, after which the system automatically switches over to the fully
disabled state. This is caused by the QS panel still appearing to be
immersive to the system. It can be seen on the other side of the QS
tile as it will say "Forced" for the new special immersive state and
"Disabled" for the fully disabled immersive state.

Change-Id: I7beaaa5771f97de187c506cfa2547c52f084b51f
Themes: Add method to "apply all" a theme

Change-Id: Ic8feaeade6c52707e6b5b17921b1b577b94ec8cf
Themes: Add URI for querying previews of applied components.

Change-Id: I97417901f3b03fc82df5a823970991ddd8092df2
QS: Link the screen timeout tile to the settings

This commit simply makes long-pressing the back of the sleep tile (the
screen timeout selection part of the tile) start the appropriate
settings activity (Display settings). This matches the behaviour of
most other QS tiles where there are additional settings screens.

Change-Id: Ia36764f1a606cd3166a11516fe3709ce9bffd125
Themes: Make notification list bg themeable

Thanks Thomas Ekelschot :)

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Themes: Allow theming navbar bg color

Change-Id: I256afc30fc018ea752769029c5246bc7310c23a6
Merge "Themes: Make notification list bg themeable" into kitkat
Merge "QS: Link the screen timeout tile to the settings" into kitkat
Merge remote-tracking branch 'pa_upstream/kitkat' into legacy
Merge "SystemUI: Display Pie in forced immersive mode" into kitkat
Merge "Themes: Allow theming navbar bg color" into kitkat
QuickSettings: Refresh RSSI tile on tap

When tapping the RSSI tile to disable mobile data, the indicator
would not show immediately because the view is not updated until
the next signal refresh.  Refreshing on tap makes more since so
that the user sees instant feedback.

Change-Id: I70d3e08e9a4af4f5d764d8c90cbaf944f4f25139
Signed-off-by: Evan Anderson <evan@thelinuxman.us>
Merge remote-tracking branch 'pa_upstream/kitkat' into legacy
Allow subclasses to override bindPreferences().

Allows them to modify adapter behaviour.

Change-Id: I6767e3988740b674fbdf40a903cd2ef3949ca7db
Themes: Fix ResourceNotFoundException when updating  applied theme

If the user has a theme applied and there is an update to that theme,
then the themed apps will crash. This is because the theme's APK path changes,
but the apps do not update their resources. Apps were not updating their resources
because updateConfiguration() determined that the config (which only has pkgName) hasn't changed.

The problem is fixed by first applying the default theme config and then re-applying the
updated theme.

SystemUI was crashing with a NPE while verifying this fix, so a NP check was added to SystemUI as well.

Change-Id: I00e32fc1535b4d279fcb37c35f868501ecc1dd19

Conflicts:
	packages/SystemUI/src/com/android/systemui/quicksettings/UserTile.java
IconPackHelper: Respect the original size of bitmap icons

When use icon packs on low-resolution devices, for example, my HDPI
phone, it seems that using the size returned by
getLauncherLargeIconSize() will cause a blurness on
some icons that are not included in the icon pack because of the compose
function.

This patch respects the original size of the icon if the icon is an
instance of BitmapDrawable but use the size returned by
getLauncherLargeIconSize() if the icon is an instance of PaintDrawable.
This will remove icon blurness on low-resolution devices.

Change-Id: Ifcb39020d934a9c7cb409e1206a179d64f99aa37
Restore lazy loading of LoadedApk resources

This was broken in 8fff544ec349593cfa61ae2f5ec59419fff666b6. Since that change,
resources are always initialized in getPackageInfo(), even if they haven't been
loaded before (mResources == null).

It shouldn't be necessary in *any* case to preload the resources at this point.
Anything using the resources should call LoadedApk.getResources(), which will
initialize them just when needed. Setting mResources to null resets the cache
and will force a reload the next time the resources are requested.

Change-Id: I9bc9986297478e99752b1e2b9bd04dab3dcc9656
Themes: Support applying components from multiple themes [1/3]

The current implementation assumes the components being passed
into the ThemeService belong to the same theme.  This patch uses
a Map instead of a List to pass in a mapping of components to
package names, allowing us to apply several components from
different themes.

Requesting a theme change now takes a Map<String, String> which
maps components to the theme package name they will be applied
from.
Example:
    Map<String, String> componentMap = new HashMap<String,String>();
    componentMap.add(ThemesColumns.MODIFIES_ICONS, "com.mytheme.blue");
    componentMap.add(ThemesColumns.MODIFIES_OVERLAYS, "com.mytheme.red");

    ThemeManager tm = (ThemeManager) contex.getSystemService(Context.THEME_SERVICE);
    tm.requestThemeChange(componentMap);

Change-Id: I13fa17eabecb824884fe522d5dc1822a4d7c55f4
Merge remote-tracking branch 'pa/kitkat' into kitkat-next
Recents: Cleanup and fix visibility of ClearAll buttons

- Make it clean. Also this is a short life patch, top corner clear all will
  be moved as a function of hw buttons (ex long pressing desired assigned button ),
  reflects PA logic and muscle memory with soft navbar implement.

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

Recents: Need to consider if pie is on along with immersive

- Checking just the on the spot stored value result always true then

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

Recents: Fix rushness

- Missing parenthesis

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