HOVER [1/2]

Notifications refined:
The way you handle with the incoming notifications defines how much you enjoy your device.
Hover shows you those notifications when you need them in a beautiful card that briefly appears
on your screen. For a detailed look of the notification, you can swipe down to expand some more
info, or you can tap it to open the related app using PA’s floating mode.

Introducing Hover:
https://plus.google.com/107979589566958860409/posts/DC4KyDd1cDC
https://plus.google.com/107979589566958860409/posts/BtWoGpNd8Fq

This is revision 4 of the original base by @D4rKn3sSyS . Hover works by moving the
notification view from statusBar container to Hover’s one and re-themes notifications
in the process. When hover is active it is the owner of the view, special care must
be taken to not  manipulate the statusbar reference while hoveris active.
Hover’s view state is managed by a handler based timer. When any touch event is received
or a gesture completed the timer is restarted, upon expiration of the timer hover is
hidden or will show next notification in the list if there is one (or more) to show.
The timer along with animation listeners  regulates the rate at which Hover can process new
notifications, acting as a spam filter for noisy applications. Upon first run a dialog is
displayed explaining Hover to new users. More infos in code’s documentation.

Todo:
- Swipe up to dismiss only the hover window not the notification in status bar.
- Transparent support has been tweaked a bit but needs a more proper solution
- Edge gap fix for Theme Engine themes overriding notifications draws
- Long press action(s)
- MInor tweaks noted in the code’s comments

CONTRIBUTORS:
@D4rKn3sSyS
@BigBrother1984
@Anu6is
@beerbong
@aaronpoweruser
@David96
@linuxman94

Drawables by @arzbhatia

Signed-off-by: Jesus David <jesdga95@gmail.com>
Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Signed-off-by: Curtis Mayers <curtis.mayers@gmail.com>
Signed-off-by: Yamil Ghazi <stevewatersy@gmail.com>
Signed-off-by: Aaron Gascoigne <atlrudeboi1@gmail.com>
Signed-off-by: David L.-W. <david.leppla.weber@gmail.com>
Signed-off-by: Evan Anderson <evan@thelinuxman.us>
Conflicts:
	packages/SystemUI/res/layout/status_bar_expanded_header.xml
	packages/SystemUI/res/values/pa_dimens.xml
	packages/SystemUI/res/values/pa_strings.xml
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
	services/input/InputWindow.cpp
	services/java/com/android/server/NotificationManagerService.java

Conflicts:
	packages/SystemUI/res/values/liquid_dimens.xml
	packages/SystemUI/res/values/liquid_strings.xml
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
	services/java/com/android/server/NotificationManagerService.java

Conflicts:
	core/java/android/app/INotificationManager.aidl
	packages/SystemUI/res/layout/status_bar_expanded_header.xml
	packages/SystemUI/res/values/liquid_dimens.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
	packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
	services/java/com/android/server/NotificationManagerService.java

Change-Id: If83452272440cd175bb2c061c3755b5b8e3e5e5c
HOVER: Fix a couple of things:

- Handle Ticker properly. Update mTicking, call related statements
  and disable ticker for blacklisted apps only when hover is off.
- Remove a bad patch when you release your finger, there is no need and
  along with showCurrentNotification() call at setNotification() can even
  be a bad call.
- Notification removal is already done at BaseStatusBar. Remove useless code.

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
StatusBarView: Ensure to not overload in/out animations

- Post animate call in main thread, thanks @David96
- Handle animation checking current view visibility

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Signed-off-by: David L.-W. <xD_e-mail@gmx.de>

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
ExpandHelper: Improve one finger expanding forced handling

Instead of force returning false if view is null, setup a boolean
to force it with custom views like hover. Cherry-picked from CM.

Also request disallow intercept on drag started.

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>

Conflicts:
	packages/SystemUI/src/com/android/systemui/ExpandHelper.java

Change-Id: Ifde0bccda5f042f4c07a84aa74a402fda4974b11
StatusBarView: Avoid unnecessary calls to mHandler.post()

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Signed-off-by: David L.-W. <xD_e-mail@gmx.de>
HOVER: Options to exclude non-clearable and low priority notifications [1/2]

Change-Id: I0563a5a05f697202d11343451c481d8a150717d5

Conflicts:
	core/java/android/provider/Settings.java

Conflicts:
	core/java/android/provider/Settings.java

Conflicts:
	core/java/android/provider/Settings.java
Master switch to disable Hover [1/2]

Change-Id: I928bf5c42fb4a33109198475cc136bd86f11056d

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

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

Conflicts:
	core/java/android/provider/Settings.java

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java

Conflicts:
	core/java/android/provider/Settings.java

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
HOVER: Option to disable HOVER-Button in StatusBar [1/2]

If the button is hidden, user can activate Hover in the Settings instead

Change-Id: I76e99da7a83b6a5dd35c2965b311009dfc819085

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
HOVER: Option to only show up in Fullscreen-Mode [1/2]

Change-Id: I913fce9e54fc0c79f0b3406a4173bb4b55fd6e25
HOVER: Disabling HOVER isn't necessary at all [1/2] …

as we can just hide the HOVER-Button in StatusBar

Change-Id: Idde34acc859e6191a71239616b2b69f09650ef49

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java

Conflicts:
	core/java/android/provider/Settings.java

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
HOVER: Option to exclude topmost app [1/2]

Originally taken from Tigger2014:
https://github.com/Tigger2014/android_frameworks_base-1/commit/5af0e1c84e86e9b4e6947163aaf58e9ab541079d

Change-Id: I6da9027af4c7bc74945a06b97b876f94cf817844
HOVER: Ensure to clear after reparenting all notifications

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Change-Id: I8d3735836952394942f044ebd067d7cc7a82bc2e
HOVER: Match notification width on tablets too

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>

Conflicts:
	packages/SystemUI/res/values/pa_dimens.xml
	packages/SystemUI/src/com/android/systemui/statusbar/notification/Hover.java

Conflicts:
	packages/SystemUI/res/values/liquid_dimens.xml

Change-Id: I56fc037e2b3f6efb58f99cc5ca6f317f9b750572
HOVER: Rework showing behavior on tablets

- Don't animate out statusbar on tablets
- Cleanup

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
HOVER: Don't process and/or show foreground app notifications

- Don't show notification of foreground app
- Animate the ticker in this case so user can see it

Inspired from changes linked here https://gerrit.paranoidandroid.co/#/c/4453/10

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Change-Id: I9f45e1641a7478c7e460c32133db00bd67f63e75

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/notification/Hover.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
HOVER: Fix notification content not being updated

Change-Id: I6f5e95cfff9b78cdabd1d9aa00e0577b0ab78508
Hover notification timeout [1/2]

Allow user to set how much time the hover notification will stay visisible without touch the screen

Change-Id: I5847adb3f33522d9d78867685f9867477542c37e

Conflicts:

	core/java/android/provider/Settings.java
HOVER: Theme Engine compatibilities and some resources tweaks

Use default notification dimens, avoid setting a custom one.
A bit of cleanup too.

Notifications:
Hardcode dimensions to android defaults. Avoid themes to change them,
Ribbons feature (present on CM based roms mostly) needs that.

Thanks to +John Xionidis to help me trick this out for full CM11 made themes :)

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Change-Id: Iccf12061c045c29db4bc73736dac68e52dda198c
Conflicts:
	packages/SystemUI/res/values/pa_dimens.xml
	packages/SystemUI/src/com/android/systemui/statusbar/notification/Hover.java

Conflicts:
	packages/SystemUI/res/values/liquid_dimens.xml
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
HOVER: Respect screen limits when adding view

As for what @Decad3nce reported here http://review.cyanogenmod.org/#/c/66654/
we shouldn't keep FLAG_LAYOUT_NO_LIMITS so view doesn't exceed the screen limits.

Thank you Adnan :)

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Change-Id: Ifcbc4a1143362e1b7dd40e710126060688c894b9
HOVER: Don't treat touch outside event as true if is animating

- It needs to wait animation to be finished to start listen for touch outside
  and runs hide timer.

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>