FW: Remove Hover [2/2]

in favor of Slim's heads up. Adios

Revert "SystemUI: improve one finger notification expansion"

This reverts commit e013343df2dc6fd3fe87052be3fdaccebf550db0.

Revert "Do not launch floating window when on default launcher"

This reverts commit b279451ffcc28e95593431dd396f4c41994050f9.

Revert "HOVER: Don't treat touch outside event as true if is animating"

This reverts commit dd5c17b63a56fe9f76ab0407e68a0229a5f9a3a2.

Revert "HOVER: Respect screen limits when adding view"

This reverts commit 065400df2fa9092b362bfb3a8734a643d1c4181b.

Revert "ExpandHelper: Performance improvement during expanding"

This reverts commit 1e195224fb4fcbac4346d249798584c29140cf55.

Revert "HOVER: Don't process and/or show foreground app notifications"

This reverts commit 8cd819ce43729af61c80c5ea8bc0b034158c1c94.

Revert "HOVER: Rework showing behavior on tablets"

This reverts commit 8721b6501ea4c76b35300221ca766cce2369a2b2.

Revert "HOVER: Fix notification content not being updated"

This reverts commit 409459dca7e50868dad7f915c9aa2f75efebe9ba.

Revert "HOVER: Ensure to clear after reparenting all notifications"

This reverts commit b9dbb6d2d3c9b566a257d3e4406800d8c5921471.

Revert "HOVER: Match notification width on tablets too"

This reverts commit 48f2cee5b3a6f1b24beded4e8474d702b9045095.

Revert "StatusBarView: Avoid unnecessary calls to mHandler.post()"

This reverts commit 07d69b87968d4c19f0def732a1e900ceb4f59402.

Revert "ExpandHelper: Improve one finger expanding forced handling"

This reverts commit 723a1da73957f7e90ac7fb0d8d9500721cbbbe46.

Revert "StatusBarView: Ensure to not overload in/out animations"

This reverts commit 109af64faab9fe1fc1114411167b26d21fb5f1e6.

Revert "HOVER: Theme Engine compatibilities and some resources tweaks"

This reverts commit a6f6c21a3c47e66426f2c7d42c0934a2365ddf15.

Revert "HOVER: Fix a couple of things:"

This reverts commit 8d70b3d9474a159f4ad7c4fcdeff7ef5c646eaca.

Revert "Frameworks: Store dialpad showing state (1/2)"

This reverts commit 935292c59bab39d4526a3d87ba41459984e9f6f0.

Revert "HOVER [1/2]"

This reverts commit 4a62693bba0a11f69521e65ef3d2bd3f2502efa0.

Conflicts:
	core/java/android/provider/Settings.java
	core/res/res/values/cm_colors.xml
	packages/SystemUI/res/values/cr_dimens.xml
	packages/SystemUI/res/values/cr_strings.xml
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
	packages/SystemUI/src/com/android/systemui/statusbar/notification/Hover.java

Change-Id: Ic864ab77f302b5c1a974e18aca6bbe863d7b475c
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

Conflicts:
	core/java/android/app/Notification.java
	core/java/android/provider/Settings.java
	core/res/res/values/slim_strings.xml
	packages/SystemUI/AndroidManifest.xml
	packages/SystemUI/res/values/slim_strings.xml
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Change-Id: I81a7473ca48eb5fd91263ec63c82957d8b3ad17b
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
HeadsUp: Only remove heads up if attached to window

Attempting to remove mHeadsUpNoficiationView from the window manager
when it is not currently attached will throw an IllegalArgumentException
so we check if it is attached and if so remove it, otherwise carry on.

As well remove possible left children in statusbarview

Change-Id: Ida916eba496c4183e47288ef24a8a93c46a7eddf
SystemUI: improve one finger notification expansion

Sometimes the quick settings ribbon would eat the initial ACTION_DOWN
setting mInitialTouchY in the expand helper, but we are clearly not in a
notification that we can expand here. So only set the initial y point if
we are inside the notification scrollview.

Change-Id: I877a6d5db4ec02d24f734d3284d554da13608322
HeadsUp: Correctly add and remove the window

isAttachedToWindow() basically works to determine if the view was attached or not.

But on the boot up process when already addHeadsUpView is called but the system is not
fully up and a recreation happens (eg on TRDS...due that the UIModeManager is doing its work as soon as system is ready)
the view gets attached....but not removed on the recreation due that at this time isAttachedToWindow() will return false even though the
window was added.

To solve simply use a boolean instead of isAttachedToWindow()

Change-Id: Ib576a83cadc581683f2a5b0afc922c53b01888b7
fb: do not block home button if incoming call is a background call

The user want to navigate ahead if it is a call in background.
So we allow it.

Change-Id: If40b8abba05b600191bfc1403f197e624fd7a360
fb: Show heads up at the bottom of the screen (1/2)

Due of user requests and indeed especially on hw key devices for a better
workflow we add an option to show heads up notifications on the bottom instead
of the top.

Animation we leave as is due that if it slide from the bottom into the screen it happens
to often that the user accidentaly interacts with it. If it comes from the top of the
container we add, the user has enough time to realize it. Sometimes a ms can make a big difference.

As well this commit fixes the wrong gap on the top if user boots up directly
into immersive mode.

PS:
- if IME keyboard is showing show the heads up on the top to do not disturb the typing.
PS:
- NPE if updatePosition is called to early from the system.

Change-Id: Iea7fbe466808531a9351cf4048570b8f56eb698e
Merge remote-tracking branch 'CarbonDev/kk' into kk