NotificationHelper: We shouldn't use logical here, one case is enough no matter the order

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
NotificationHelper: Create broadcast receiver for Peek app

Store showing state.

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
NotificationHelper: Define Peek app broadcast intents

Continue this https://gerrit.paranoidandroid.co/#/c/4369/

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
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:
	core/java/android/provider/Settings.java
	packages/SystemUI/res/layout/status_bar_expanded_header.xml
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
	services/input/InputWindow.cpp
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>
Recents: ClearAll: Fix glitch on quick double tap

To reproduce:
Open five or more apps, open recents and tap twice very quick on
clear all button.

Setup a boolean to control the thread starting, don't relaunch if
clearAll's run() has been executed and is already firing up childs.

Along with this https://gerrit.paranoidandroid.co/#/c/4346/ UI/UX should
look great no matter how crazy and how many times the user click on recents.

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Change-Id: I0d393838c23e2585222cf7b181c2f7a6385494cd
PEEK: Sensors improvements

- Bring some fixes to the algorithm thanks to @D4rKn3sSyS
- Cleanup

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
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
HOVER: Match notification width on tablets too

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

Conflicts:
	packages/SystemUI/res/values/pa_dimens.xml
HOVER: Ensure to clear after reparenting all notifications

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Change-Id: I8d3735836952394942f044ebd067d7cc7a82bc2e
HOVER: Fix notification content not being updated

Change-Id: I6f5e95cfff9b78cdabd1d9aa00e0577b0ab78508
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
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>
HOVER: Fix status bar icon size

Thanks to Lo Huot

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Change-Id: I59d7a0d8712a5d0f7aa3dc12d9bc3e9884f69f98
HOVER: A few improvements

- Better touch outside touch input handling
- On touch outside hide both case (expanded and non) in 1.25 secs
- Tweak clear foreground notification when we are on the same app
- Code style
- Tiny cleanup

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Change-Id: Ibb0c7c09ae3256bbf744f359cca651c8cb8112d9
Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/notification/HoverLayout.java
SystemUI: Fix missing top task in recent panel

If preloadRecentTasksList was not called or was called too
late and RecentsActivty already started and last top activity has
excludeFromRecents flag setted it might be missing
from recent application list.

atken from cm11

Change-Id: Ia04913e7a89d51689f933cbc9ff3a84092fdb1cf