Revert HeadsUp

Revert "HeadsUp: Fix dismiss on back key press."

This reverts commit 2d574ef3359ea2b607b2ad17084b22afc1d055b4.

Revert "HeadsUp: Correctly add and remove the window"

This reverts commit 9b46c0f28a72370dae1b25a49d8a14d422a6acac.

Revert "HeadsUp: Only remove heads up if attached to window"

This reverts commit 423ada871cde54303303e2c67de25f2bd60070d4.

Revert "SystemUI: Clear disappearing children and remove HeadsUp on recreate."

This reverts commit 1fa5372a1010c92ed19a845333213cd204962d46.

Revert "BaseStatusBar: Dismiss heads up on backpress."

This reverts commit 7c8d7c7bff171d18d96627e6ca044b4e3ffe193f.

Revert "PhoneStatusBar: Readd headsup view when theme change occurs."

This reverts commit 5816a833fba98d322168ca9dcb0deb07185b8379.

Revert "SystemUI: Improve HeadsUp expanding performance."

This reverts commit 46b8b9f996a850a4e71fa074ecbe9b0876a7d264.

Revert "HeadsUp: Respect system decorations when adding view."

This reverts commit 21d0252e7eff06edde447e863cfefe0c5966217d.

Revert "HeadsUp: Add heads up quicksettings tile. (1/2)"

This reverts commit c076fcced1107cd59f78dc54b29139c1a58356db.

Change-Id: I175a5b0da1082859e519dd946a5b65e6b911b61a

Revert "HeadsUp: Add heads up blacklist options. (1/2)"

This reverts commit db72934bce78a4b482d62e1ba127b29b168ad2dc.

Revert "HeadsUp: Fix resetHeadsUpDecayTimer."

This reverts commit affc3ac80769fef4c3b02c75832c08a4a297051a.

Revert "HeadsUp: Clean up."

This reverts commit 8e3a2994be8ac39ec23ba69b452fb5b61376f42e.

*Revert "SystemUI: improve one finger notification expansion"

This reverts commit cd1ec655ab78fb180b9ec162e4d218416df75ba8.

Revert "SystemUI: Expose heads up."

This reverts commit 80ac1df3722cbe205ebdac514c6da561e13a6f0d.
Frameworks: Heads up meets SlimKat....SlimKat meets Google IO [1/4]

First introduced from apple, showed as android version on PA as hover and now found
in android code as native implementation we want to do our interpretation of this feature.
Especially thanks PA and CM for some of the UX ideas.

We have basically split this feature in two parts.

1. Googles native integration. We keep it as is and use the native flags for it. Apps
   (in our case Dialer, Mms, Email per account) can force show a heads up notification
   if the notification is important. So basically same what was shown on Google IO the first
   time to the public. Eg the dialer on SlimKat is doing exactly the same now like google want it.
   Due that we use same flags like google every future app with heads up support will automatically
   show as heads up.

2. Give the user an ability to enable heads up mode for third party apps which do not have a native
   integration. Well first thought was on which apps a user would usally use it (keeping in minde the idea from google....heads up
   is for important notifications and for nothing more)? Right on chat, email
   or social apps. On all other apps it simply does not make sense at all. Which leads into the question why the
   current integrations are handling blacklists or whitelists and enable it per default for all apps. This
   is from UX point of view an absolutely no go (just imagine the user blacklists half of the 200 apps installed lol).
   Aside that parsing long lists is a peformance problem.

   So our attempt goes into another direction. Headsup for (native integration is another story) apps is disabled
   by default. We bind the information directly to the application package. So each app carries the information itself.
   The user can either enable it with a longlick in the notification drawer on the notification or in Settings->app->App info
   as well via a check box. As soon it is enabled for this app every notification from this app will show as heads up as long
   it is not an ongoing notification.

   In general on system signed apps the user is not allowed to change the heads up state. Thats nothing the user should
   decide....the system should do. Aside that it prevends user to enable heads up for eg IME selector etc etc.

Thats the basic concept behind. In addition to this concept following things were done.

- Introduce a new expanded notification flag. Apps can send it via extra metadata to force
  a expanded heads up notification is it is needed (eg dialer).
- Add a user option to enable always expanded on heads up notification
- Add a user option to set the timeout for the heads up view.
- Introduce a snooze button. Every heads up notification has a snooze button on the top right. If the user press it
  heads up is disabled for a certain time (like a do not disturb mode). The time length is user configurable in settings.
- We had a bunch of user which want to use heads up in a more intrusive way. Current default behaviour is that a heads up
  shows up if the user did not push the heads up of this app into background. This is due that the system assumes if the user
  put it into background he or she do not want to be disturbed by notifications of this app at the moment. Of course in the moment
  the user interacted with the background notification heads up is activated again. This leads like google suggested in a very
  good non intrusive way. Well but some user use it in another way (especially on immversive mode) and want to be notified on every
  notification update of this app via heads up. Due of this understandable other user behaviour we add an option for it to allow
  this scenario.
- Detect direction of the swipe. Left swipe will dismiss the notification (if it is not a non clearable). Right swipe will just
  hide the heads up and the notification is still in background accessable in the notification drawer.

Other then that some fixes were done as well (eg utilize the back button, correctly handle the hiding of the heads up,
handle action buttons on heads up view correctly, fix several expanded desktop and immersive issues
and some other issues the AOSP implementation currently has)

To summarize...heads up this way is very non intrusive and especially we do not need a bunch of settings or blacklists.
So it is pretty straight forward, fast, clean and user friendly.

Some visual examples:

https://plus.google.com/107859134357373490612/posts/bJABHs1aNMj

Change-Id: I5d2140a8b7520ca4e30949d392c14dd0625ea177
Slim Heads up: change behaviour of back key

Currently back key hides the heads up. We change it that the back key is still
working for the app which has focus and not for the heads up at all.

Reasons:

1. A lot user requested this due that they often hide the heads up during they work
   on the phone, simply due that the back button is often pressed on a normal workflow.
   The results is indeed that a lot heads up windows are missed excidentaly.

2. First I thought to make it optional. But there is another big reason to do it this way. Current
   behaviour is that the heads up view gets focus...and that we dispatch the back key only. Thing is
   that other key events are still rooted to the heads up window. Well most things a user will not see.
   But eg on apps with input field some keys on the IME keyboard do not work during the heads up is showing
   which is a big no go when we assume that heads up needs to be as much non intrusive as possible.

That being said we remove the dispatch override and give the heads up window FLAG_NOT_FOCUSABLE flag
which will bypass any key events to the window behind which had focus before the heads up showed up.

FLAG_NOT_TOUCH_MODAL we can remove due that FLAG_NOT_FOCUSABLE automatically enables the FLAG_NOT_TOUCH_MODAL flag.

Change-Id: Ied4c7d2dd5b99f89af958f01db980a36d431bbc3