[1/2] Frameworks: Slim recent app screen

One of the parts on AOSP google missed to update/improve in the last
couple of releases is the recent app screen to allow better and faster
multitasking. I had always a special vision how it could/should look
and gives the user a faster workflow.

This commit is now our new recent screen. It is a complete new implementation
and replaces googles AOSP recent app screen. The code changes in the base itself
are quiet miniml to call the new recent screen.

Some notes:

1. This patch needs a new repo: frameworks_opt_cards which is a central repo
   to get any kind of googles cards style. Thanks Gabrielle Mariotti a ton who
   made the base for this library and hellped a lot out.  We just fixed together with him some parts
   and mad it useable as AOSP central library. So we can use it later for other
   changes as well

2. Preload needs to work 100%. So it is needed to check that the calling parts
   (like hw key rebinding, pie, navigation bar) do a proper preload. If they do not
   recent screen will just not show up. To follow what they are doing you can enable
   debug in RecentController.java which exactly shows what was called.

Some notes to the patch itself:

- Recent app  screen slides from the right edge into the screen

- Show recent apps in new google card style. Most recent apps show
  expanded with the app screenshot. Other are collapsed. Of course
  the user can change expanded/collapse of each app during the session where the state
  will be restored on next access.

- Compared to AOSP recents we do a 3 stage loading
  1. step: preload the task list and build or update the cards (does not load any content at this point)
  2. step: User actually toggled the recent screen....icons, text and screenshot thumbnail which will get visible are loaded now
  3. step: Recent screen is fully animated in. All other non visible content at this time are loaded now.
  This allows a smooth experience for the user and a minimal load on the first 2 steps. Especially important due that we handle
  a lot animations which are very picky when it comes to background loads. last 2 steps are async multithreaded loading tasks.

- We are using for the app icons and thumbnails a bitmap LRU cache controller to have fast access to the bitmaps we need. This improves especially
  the scrolling and as well the loading time due that allready loaded app icons are holded in the LRU cache.

- Theme support is included as well for all items the recent screen has

- Most important point: Way faster workflow now. The recent screen neither freezes the underlaying app nor it does interrupt the current process the
  user is in. It just slides over the current app about 40% of the screen. Back button as well just an outside touch (which will be passed trough to the app)
  allows to immediatelly go ahead in your workflow.

- Normal click opens an app, longpress opens app detail screen (note: we have only one hidden action on our current recents. If we later decide there could be
  other actions as well...showing a google card menu button on the top right is a very easy task and allready provided from the frameworks_opt_cards lib)
  swipe left or right removes the app from the current tasks

- Pinch to zoom out gesture provides the ability to remove all tasks with a big red warning!!

- All above mentioned actions are animated.

- As usual it is multiDpi compatible

- A lot work went into the optimizing especially for low end non gfx devices where animations
  as well listview scrolling is not that easy. We got the maximum out of optimization here which
  gives acceptable results on low end devices and amazing one on the gfx capable devices.

- A small side note this patch contains as well a fix on navigation bar preload.

Thats the short description.....user need to see it to get the real benefits of this new way.

cheers

kufi

----------------------------------

Modifications by codex-corp

SlimRecent: Make it optional [1/2]

https://github.com/AOSB/android_frameworks_base/commit/dbb5540884826786bfec9f7ea42a515a09c4094e
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
Frameworks: Do proper recent preload on hw key rebinding.

Current behaviour is that it is one time preloaded. And after that if again
a recent call is fired it does not preload again....which results eg on new
recents in not opening recent at all or on all recents in sometimes weird list
behaviour.

Ensure that the mPreloadedRecentApps is set back to false when an action
is peformed to give it free for next recent call. We either can assume
that it was cancelled allready (so mPreloadedRecentApps is allready false)
or that a recent action was called so we set it to false to give it free
for next call.

As well this commit removes the code duplication

Change-Id: Ib589356dde661476ee6090c437de7493eedcc10d

Conflicts:
	policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
Frameworks: hw key rebinding. Allow virtual keys to preload recents

Apps like LMT or similar which send hw key events as virtual key
cannot load new recents right now due of missing proper preload.
Well it was before as well broken the old recents was just not that
strict then the new one....but it should be due that this was one of the
main reasons why the old one was buggy. Bad preloading

whatever fix it and simply allow virtual keys which fire app switchter
key to fire a recents preload.

Change-Id: I09b96b50894af8a91c261e17c736a66ca377952d
Frameworks: slimrecents: call app details screen correctly

So feedback shows that we only have 2 bugs. For the one patch is up. The other
one is fixed here.

two problems

1. Longpress opened the detail screen twice and wrong

2. It shows up in the task list which it should not. Going inline
   with the AOSP implementation of it.

use TaskStackBuilder to call it proper with our animation on top.

Change-Id: I18ba0a23ee91fe259143567d157bf24a72e1036a
Frameworks: slimrecents: allow closing recents in middle of the open animation

As reported by Tejus Kandachar steps to reproduce:

Press Recents button and very quicky tap on one of the apps in the recents list,
just as recents list is sliding in. If done fast, the app opens but recents screen does not close.
If done normally it slides away as expected.

Fix it with allowing to close the pannel as well on animation in state.

Change-Id: I4c52e6e6a4fd4b3a2a63bc364ead055f0e619faf
Frameworks: Slimrecents: cover bad 3rd party apps behaviour

Recent app screen as well the original AOSP one needs a proper preloading.
We discovered due of reports that a lot apps (launcher etc) just call over
the SystemUIService some even with reflection :/ just the toggle and no
preload at all.

Whatever we cover this behaviour due that we do not want to break 3rd party
apps. If someone calls the toggle without proper preload we preload them first before
the recent starts animating. Listener takes already care on it for low end devices. We
just use this now and let the taskloader in this case decide when the recent app screen
can be shown.

As well this commit disables the logcat spam lol. Forgot to disable debug on the relase
commit

PS:
- fixed code style issue
- go on out animation down in the runable delay. Not needed to be that long at all

PS:
- add another safety check

PS
- another one

Change-Id: I43a47185da446b9ecaec114c1835ecfd20c3ac73
Frameworks: keep IME keyboard alive due recent is showing

Change-Id: Ieae9b899afa99739cc5cfa536a03d6827567c24b
Frameworks: make recent multiuser compatible

wondering how it worked at all on AOSP recents. Whatever call the
list dependent on the user who is using it

Change-Id: Ieae1d8ee2b71597bcb2025222c22d4514220ecc3
Frameworks: SlimRecents: go more inline with AOSP and add menu + new googly shortcuts

This commit changes the longpress behaviour. Like on stock aosp longpress opens the menu with this options

1. App info (like stock)

2. Play Store link to the app

3. Amazon store link to the app

Note: the store links are only shown if the app has the info that it was installed by one of this
stores. So stock apps (installed by system) or sideloaded apps do not show this link.

As well some backup apps break this entry on restore lol.

As well a bit cleanup on here and there and remove the close panel call on cancelPreload. Not needed

PS
- disable debug

PS
- set correct style
- disable one default debug

Change-Id: I29769f48ce6073acb6105f5590b93c671d6fc0d4

Conflicts:
	packages/SystemUI/res/values/mahdi_strings.xml
	packages/SystemUI/res/values/styles.xml
Frameworks: fix the random fc on pinch

Well logic error from me which can lead in an recycle bitmap fc due of a race
condition. Reason is simple it the animation needs for whatever reason longer then
the removing the tasks the view is probably still visible and recycle of the bitmap
results in a fc.

To fix it just remove the tasks after the animation is done and we definitly know
that no items are visble which are recycled.

Change-Id: I7878e02e6fb1887f8d11304550e083d107095a4a
Frameworks: go kitkat + style tweaks and follow googles color sheme

Googles color sheme on cards is

card: ffffff
aditional content: f5f5f5
background: e5e5e5

first two we did...background not. Follow the color sheme due it has a better contrast.

As well remove the non google rounded edges.

Allow drawing behin status and navigation bar if the bars are translucent

PS:
- due it is now a system window ensure that all other system windows are closed when opening recents.
PS
- minor tweaks
PS
- remove one unused flag
PS
- respect app system ui visibility status and reflect it for smoother experience
PS
- bring back TYPE_RECENT_OVERLAY window layouparams back to live. It was never documented
nor depreciated. Was used in the past for GB recents and is even updated till today although
nothing in the system is using it.

Make it fully functionall (it is basically just an extended TYPE_SYSTEM_DIALOG) and allow
this window type to extend its content behind navigation bar.

PS
- minor fix...init the systemUI flags for the view allready on preload to prevent positioning
of the listview.
PS
- draw always behind navigation bar as long it is not immersive mode or hide navigation bar mode
- add more margin to the delete icon for kill all

Change-Id: If38036dded961fcf0a6d8c2e7d2ba44a8e1dd08a

Conflicts:
	core/java/android/view/IWindowManager.aidl
	packages/SystemUI/res/layout/slim_recent.xml
	services/java/com/android/server/wm/WindowManagerService.java
Frameworks: derp

well it does not effect us due that we proper preload etc. But if it is not
a cancel repload event should reset the mIsPreloaded flag

sorry

Change-Id: Icc531dcd6bae187473f65ec7da267c72f9edbcf6
Frameworks: SlimRecents make it RTL/LTR aware + scaling + lefty mode (1/3)

This commit adds several features:

- Make it fully RTL/LTR aware. Means it shows up on the oposite side if an RTL
  language was choosen. As well icon, textposition, menu etc follows RTL direction.
  So like AOSP guidelines suggest it is fully compatible now for all locals

- Add scaling mode....user can scale the overall size down (especially for the
  user with stock dpi requested)

- Add lefty mode. Recent panel shows up on the left edge instead of the right edge

As well this commit unlinks the construct of the card with the update of the content. This
reduces one update call on construct and gives a tight faster loading.
Slim Recents: add favorite mode

Allow user to set favorite apps in recent task list. User can set them with
longpress on the app icon. This apps are always shown in the task list above
the first default one (on phone the first 2 which always show the last 2 active
tasks). Favorites are shown in order of last time they were called. Favorites
settings are saved permanently till the user removed it from favorites.

As well this commit fixes the wrong icon if an package has more then one
activity to call (eg Google+ and Google Photo).

Using for all now a unique identifier.
SystemUI: Notification Reminder - Update Reminder

Add button to notification to update reminder
	time once it fires (to let it fire again).

Change-Id: Ie369bf4c478553a0c792308949b053790c001b61

Conflicts:
	packages/SystemUI/res/values/mahdi_strings.xml
frameworks: including build.prop property "ro.config.vc_music_vol_steps"
to control music steps amount (like it is
with "ro.config.vc_call_vol_steps" and call volume steps)

Change-Id: I81a3188919482383e015974818e7042d521ac679
Don't let apps disable the SIM PIN entry screen.

As the user (who controls the app behaviour after all) likely doesn't
see the PIN screen as a lock screen (he likely wants telephony) and the
PIN screen is not shown on a timer-driven basis, it should be treated
specially.

Change-Id: I8d48ab5f097bc926f67eab5835d9b5f1e581db15
Frameworks: Lockscreen Colors and Lock Image [1/2]

PS2: Separate all color elements
	into separate prefs.
	Also colorize bouncer frame
	for secure lockscreens.
PS3: Whitespace

PS?: Add Lock Icon Picker =]
PS?: Add "Colorize Custom Icon" option.
fb: fix and pimp custom lockscreen handle (1/2)

problem on current implementation is that it is not
multiDpi compatible. As well it looks a bit weird if
the user set a square image always. This commit does

- introduce central circleimage method to get circle image crops
- before it was assumed that the height of the handle image is
  108px (mdpi base) which is correct but the original handle
  has a lot unused space around to fit better into the view.
  Whatever after messurment of the real height 68px is correct
  of course calculated against the current density
- both above combined results into a always nice looking
  custom circle icon on the lockscreen dpi and device undependent
- saved file in settings calculates the needed image size
  base on the current density.

Patchset:
- use for custom bitmap our colorize methods due that
  the result looks way nicer then the usual colorfilter

Patchset:
- use AntiAlias

Change-Id: Id0321e0e9176f8f765980f69b412658dbb929ef3

Conflicts:
	core/java/com/android/internal/widget/multiwaveview/GlowPadView.java

Conflicts:
	core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
	packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java