Revert "Reduce memory leaks by removing all views."

This reverts commit 86f5a56bdd22709be262761941fca95a2a038f47.

(cherry picked from commit e1f1c0ab97174c5f7b63cd6dcfe49d8605d6c5c0)
WallpaperPicker: Destroy cropview to avoid leaks

If the cropview's TiledImageRenderer is rendering threads, the activity
context gets leaked. Avoid that by invoking its destroy in onDestroy() of activity.

Change-Id: I0804c903d14d3f3d13529f0fe90d12784d97e93f
(cherry picked from commit aa20c7948c290597187d76520231349eacf36f18)
National Roaming: Allow T-Mobile AT (MNC03) to roam on 3 AT (MNC10) in Austria

Change-Id: Ief827259fdcb5bfa13bd643f80a8547a56cc934c
(cherry picked from commit 27497817e042325bb1958ad4387dedd41e82733f)
SystemUI: Cleanup and enhance notification drawer header

- Crop properly images on tablets and landscale
- Use a separate layer instead of breaking header background
- Fix bug where you couldn't turn header back on after turning it off
- Added a gradient overlay

Change-Id: Ife399b82a3f272fb2ecc8e738c5f274f7682a556

Conflicts:

	packages/SystemUI/res/layout/status_bar_expanded_header.xml

(cherry picked from commit 4461646d470f721b1c930ff176afb04af1e99e09)
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:

SlimRoms/frameworks_base@b330fde

SlimRoms/frameworks_base@3194015

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

============================================

PS: Added two classes (part of SlimRoms)
TRDSConstant.java
TRDSActions.java

Those two will be used to control enable/disable TRDS

Change-Id: I5fb21c022ad507b6c49c2909d4897955311a9436

Conflicts:

	core/res/res/values/cr_config.xml
	core/res/res/values/cr_symbols.xml
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

(cherry picked from commit e21800f3760fbdf22fd50071cc3375ce37f04364)
fb: TRDS dark base theme

Change-Id: Ie25abfbf5258ac479ca8bc91033f6892bbbc6741
(cherry picked from commit 22a634f7f061e6ed59c9544a360f51bf4a0b25d6)
trds:[framework] dark images adjustments

Change-Id: Ie038c4a1aa535708c23f099fb5e836407e3d1603
(cherry picked from commit cdc1451b27484053c0e2ccc2ffcab3ee090c4587)
TRDS: Dark DocumentsUI

for Downloads app

PS:
- fix settings

Change-Id: I87d49e97b8a0a67bd4d85f0137eb0960155428cb

Conflicts:
	packages/DocumentsUI/AndroidManifest.xml
	packages/DocumentsUI/res/layout/activity.xml
	packages/DocumentsUI/res/layout/fragment_save.xml
	packages/DocumentsUI/res/layout/item_doc_grid.xml
	packages/DocumentsUI/res/values/colors.xml
	packages/DocumentsUI/res/values/styles.xml

(cherry picked from commit c0a1efa66ce4bc144c55d5dbce28323fe1ecda9c)
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

Conflicts:

	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

(cherry picked from commit 9d6d5feab262d2d8ba041c63f9f665f3a389b029)
trds: improve dialogs and menu popups

Change-Id: I54da4ac0236dfe16ee964ccb070944206d0544e2
(cherry picked from commit 8fd28f09d7b4d6ad134c31d160323f8259ac5679)
trds: consistent glow for menu dropdown and popup

Change-Id: I248872cbd67471495f8b95036d995f25e2ca4459
(cherry picked from commit bc7b99bc9dac0b45da89e464671f31301bd673aa)
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
(cherry picked from commit d5c573f135898afcf62a50035d7d6da6f4a4d48a)
QS: add theme switcher tile (TRDS) 1/2

this adds a theme switcher tile

normal click: turn on/off dark/light theme
longpress: switch between the auto modes (manual/light sensor/twilight)

Change-Id: I63e3c163ce165b09c1331c13554bc090a6217911

Conflicts:

	core/java/com/android/internal/util/cm/QSConstants.java
	core/res/res/values/cr_strings.xml
	packages/SystemUI/res/values/cr_strings.xml
	packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsController.java

(cherry picked from commit 9a393b21a64f6eae800db1541859357512ca94ed)
Temporary TRDS new pngs

Change-Id: I3e9c88cbab7e9ee759849282fdbe026359fa3965
(cherry picked from commit 2f8c63aafffe39274ebbf832b1d8d95895f962d9)
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: I2f5c7fbcdad71c8dcbf547f4bc5943a95416d7a3
(cherry picked from commit a29a12d795c5f5c4ba3143cc6adb2388cb34977f)
Peek wake timeout (1/2)

- Allow user to set how long peek notification will hold screen on

- This is totally based on @LorDClockaN with very little adjustments. A big thanks to him for this
Original commit: https://github.com/AICP/frameworks_base/commit/90b47fc55ec59520d6dd5dd828ff48a3a3dca1d4

Change-Id: I3a3c7e6f99edd9c861566b2d738d31e7657a0322

Conflicts:

	core/java/android/provider/Settings.java
	packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationPeek.java

(cherry picked from commit e3d69fd3b2b2fa33fad4f1739b64b10d73e82ed2)
Keep app when opening floating window from recents panel

Start activity asynchronously by appending it to system's
message queue to let RecentsPanelView cleanly execute
dismissAndGoBack before the floating window gets started.

Change-Id: Ie58ddc81b4ea897b4243404a58fae47583e49e1a
(cherry picked from commit 20a498aa62554b455f5150fb559263efc8760c06)
Dismiss IME when floating window is dismissed

Previously the IME would be stuck on screen if the
floating window was dismissed while it was showing.

Original id from PA gerrit -> Change-Id: I8ca61b07ed89bae85eabd8db23f87b6f1f0b179f
Signed-off-by: Evan Anderson <evan@thelinuxman.us>

Change-Id: If38e65f61ba309d22306bf4b37c3c55630c006ed
(cherry picked from commit 2b6af23006374c0d9cb947a6bf1609ddfd3b0fc6)
SystemUI: Smart Pull-Down - Any Notification (1/2)

Change-Id: I1749d0e166df707f125e454a47826b6e4df531fc
(cherry picked from commit 9df7f6d05b3c7439e0000107e666d9c3e08303b7)
Make Network stats themeable

(cherry picked from commit e232976ea8c264a2f47d590c675e291ddd00fd6d)