fb: TRDS 3.0 and new theme engine preparation (1/4)

For the one who do not know this feature see as reference
the first two versions here:

https://github.com/SlimRoms/frameworks_base/commit/b330fde28306286572ba390e451a72539c0c3576

https://github.com/SlimRoms/frameworks_base/commit/3194015737b7944b4185fca007b8d167a0675cd8

we got now over a year now a lot experience how to handle the qualifier fallback
as well how to theme it and how to handle other apps. Based on this knowledge we
redid some parts of TRDS engine with following new features/additions and fixes
to have now a final perfect working TRDS

- compared to the old versions where it was needed on some apps to restart them
  in background this is not needed any more. All is handled about the internal
  AOSP resource handling and on qualifier change the caches are cleared
  and the apps get an onconfigurationchanged to restart the activity
  like it is doing on orientation change eg
- inverted folder is now depreciated and the new folders are holodark
  and hololight which allows on the one hand a dark theme (at least
  how TRDS started) and a light based theme hololight
- This name change is mainly because of the new theme engine which
  will come which uses this as base to add 2 external themes at the same
  time and give the user the ability to switch between them. But this is
  still in early stages and this commit is just the preparation for it
- Two new automodes are now integrated. User can enable the twilight modus
  which enables/disables holodark/hololight depending on the daytime...means
  on the evening it switches to holodark on normal day it is hololight.
  The other automode is based on light conditions....means that if it is
  dark outside it switches to holodark....if we have bright light conditions
  it switches immediatelly to hololight. Due of the resource cache handling now
  this happens immediatelly for the user and feels completly system integrated
  and happens without delay. A bit comparable to some navigation tool for cars
  which can switch automatically from dark to light and back
- currently the auto modes as well the manual mode switches between holodark
  and hololight. Due that we do not have currently anything hololight themed
  in the source hololight = stock theme. We will give the user the ability
  later when done to choose between which modes the user want to switch
  (stock/holodark/hololight). But this does not make sense at the moment.
  As soon as we have done the light theme or theme engine (lets see what
  comes first) we will open the ability to choose it. This is only a small code change
- a lot small tweaks and fixes went as well into the new version

Whatever this commit as usual adds the support for it. The themeing is done in the
other commits by kroz which is as well way more extended then on the older versions

cheers

PatchSets:
- minor code cleanup

PatchSet5:
- use one value for auto modes

PatchSet6:
- kill resource caches on configuration change

PatchSet7:
- register settings observer lol

PatchSet8:
- fix not assigment of config mode change (typo lol)

PatchsSet 9 -11:
- playing around aosp qualifier is not that flexible then I thought
whatever back in most parts to original implementation handling

PatchSet 12:
- now no restarts of any application needed any more like it was on 4.3...yeaaah
- fix wrong shifting in native adapter
- fix wrong call of twilightmode
- disable debug
- cleanup

PatchSet 13:
- fix lightsensor

Patchset 14:
- no need currently to recreate the navbar we can do if a theme needs it

Patchset 16:
- synchronize on sending config change
- only send if system is ready
- fire first update when system is ready

-rebase

Change-Id: Ic88838247c47d2a92b55d1cb1b00330f2d62fb88
Signed-off-by: iceandfire <arhamjamal@gmail.com>

Conflicts:
	core/java/android/app/ResourcesManager.java
	core/java/android/content/res/Resources.java
	core/java/android/provider/Settings.java
	core/java/com/android/internal/app/ResolverActivity.java
	core/res/res/values/slim_symbols.xml
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
	services/java/com/android/server/UiModeManagerService.java
fb: add ticker entries only if we are not recreating statusbar

if both happens at the same time it will result in an systemUI crash.
Funny that since 2 years where this method exist no one discovered it.
Due to the new theme lightsensor mode we have way more switches so
maybe thats why I got it now

whatever we had already a check but the tick method can be called from
outside as well so just check if we are in the recreation or not and return
if we are in recreation process. Old check is now redundant and can be
removed

Change-Id: I0feeaaa16d14fc631124d155dc18ba346f788796
Signed-off-by: iceandfire <arhamjamal@gmail.com>

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
fb: TRDS dark base theme

Change-Id: Ie25abfbf5258ac479ca8bc91033f6892bbbc6741
fb: lock statusbar recreation and release after ticker is done

In rare cases it happens that the ticker call just happened and a recreation
was called which results in a crah due of the missing binder.
To avoid it lock the recreation when a ticker call is in progress
and release it after it is done and notify the recreation to go ahead

Change-Id: Iedbf858bdb2ac2ad97563e344a571b384e17cfc7
Signed-off-by: iceandfire <arhamjamal@gmail.com>

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
trds:[framework] dark images adjustments

Change-Id: Ie038c4a1aa535708c23f099fb5e836407e3d1603
Revert "fb: lock statusbar recreation and release after ticker is done"

This reverts commit deb4c3efbdf092689dd9c19779e81fe927f26e21.
Revert "fb: add ticker entries only if we are not recreating statusbar"

This reverts commit 28c61f75750b46b46563130a3a009f0240455db3.
trds: improve dialogs and menu popups

Change-Id: I54da4ac0236dfe16ee964ccb070944206d0544e2
trds: consistent glow for menu dropdown and popup

Change-Id: I248872cbd67471495f8b95036d995f25e2ca4459
Frameworks: SlimRecents - add TRDS

replaced xml drawable with 9patch drawable to remove the overdraw

moved opt cards drawables into opt cards repo

Change-Id: I8ca379337298dcfc33b9ea288ea15440a2e0b0b4
Fix build

Change-Id: Idc18a0ee5195f95c468004a85babd03b426788ee
Signed-off-by: iceandfire <arhamjamal@gmail.com>
fb: TRDS some tweaks and fixes (1/2)

some smaller issues fixed and optimizations:

- fix twilightmode was wrong assigned to wrong value
- ligtsensor mode after first immediattely switch it does
  not allow for 5sec to switch again....after the 5sec it switches
  to current state if the sensor changed its state in this time.
  This prevends on the one hand on bad light conditions a permanent
  switch between dark/light as well it does not bring the system into
  troubles due of to much configuration changes at the same time
- get rid completly of the observe for the UI_THEME_MODE value and
  handle all over the UIModeManager
- adapt slimActions and settings to this new behaviour/method
- some cleanup and minor fixes

Change-Id: I4b2401bf7bef992ad3112ae5ccc852cd29b46bd0
Signed-off-by: iceandfire <arhamjamal@gmail.com>

Conflicts:
	core/java/com/android/internal/util/slim/SlimActions.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
	services/java/com/android/server/UiModeManagerService.java
Frameworks: TRDS fix possible UI freeze on auto mode change

- only call on theme mode change when auto mode changes. Under special conditions
  it can happen that it is called twice
- ensure that whenever a mode change is really done to close the notification shade
- minor cleanup

Change-Id: If1ffd4c1d2c1d8b17b6e7867a42bad1776e82c0c
Signed-off-by: iceandfire <arhamjamal@gmail.com>

Conflicts:
	core/java/com/android/internal/util/slim/SlimActions.java
	packages/SystemUI/src/com/android/systemui/quicksettings/ThemeTile.java
	services/java/com/android/server/UiModeManagerService.java
fb: TRDS change auto detect light conditions method

Currently on critical light conditions it still switches to often between
on and off which results in bad UX and in worse cases to unusable phone
due that it is permanently switching. To prevend that slacken the light mode
level detection and set it when it goes to dark mode way more higher (LIGHT_CONDITION)
and when into light mode back to lower level (DARK_CONDITION)

PS
- 25 looks good

Change-Id: I665f3141fe31f26ca371d10593ff95174d68fc9e
Merge branch 'kitkat' of https://github.com/TeamHorizon/platform_frameworks_base into kitkat

Signed-off-by: iceandfire <arhamjamal@gmail.com>

Conflicts:
	core/res/res/values/custom_symbols.xml

Change-Id: Ida18c1bf1c2c48e40c4df385d671f777418b3f18