PEEK [1/2]

Sensors are fully disabled when screen is on. When you turn the screen off,
it will start polling both gyroscope and proximity sensor values. If it detects
using the gyroscope sensor that device is lying on a table, it disables proximity
polling. If it detects with proximity sensor that it is in your pocket, it disables
gyroscope polling. This way, we save some battery from the beginning. Later, when you
receive a notification, it enables a partial wakelock (CPU on but at low frequency),
and starts listening for movement, either from getting it out your pocket or lifting
off from the table. If it detects those events, it will turn on screen and show the notification.
Wakelock timeouts on 10 secs, so if you receive a notification and there is no movement in that time,
sensors will stop polling after that time, disabling peek interaction until a new notification comes.
Peek doesn't process low and min priority notifications.

https://plus.google.com/+ParanoidAndroidCorner/posts/3wppxakBSVR

Contributors:
@D4rKn3sSyS
@Anu6is
@BigBrother1984

Signed-off-by: Jesus David <jesdga95@gmail.com>
Signed-off-by: Curtis Mayers <curtis.mayers@gmail.com>
Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>

Conflicts:

	packages/SystemUI/res/values/pa_dimens.xml
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java

Change-Id: I8fd01b8f0dae0a8fe0a0d1035c9625bc4aa82de3

Conflicts:
	packages/SystemUI/res/values/cr_dimens.xml
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
PEEK: Beautify bridging layers code

* Save new instances for Peek and PowerManager:
    Create it only in BaseStatusBar when start() method is called. That one
    will be passed throught the sub layers such like new helper class so another
    feature can check Peek state invocking from NotificationHelper class.
* Move phone listener to new helper class.
* Do not show Peek on sim pin lock screen.
* Process new incoming notifications only if screen is off, keep updating notification array separately.
* General cleanup.

Original Commit:
https://gerrit.paranoidandroid.co/#/c/4176/

Change-Id: I2a23e7618b695e1bef80aae57baefbe337f3db41

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
NotificationHelper: Create broadcast receiver for Peek app

Change-Id: I9a5e2ddc4db10746203972e4f024d31344f82727
[1/2] Prepare NotificationManagerService for new format

* Needed for blacklisting

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

Conflicts:
	services/java/com/android/server/NotificationManagerService.java
Apps: Add blacklist interface [1/2]

Include peek and floating mode implementations.
Applies to every floating mode launch way.

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

Conflicts:
	core/java/android/app/INotificationManager.aidl
	packages/SystemUI/res/values/cr_strings.xml
	packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
	services/java/com/android/server/NotificationManagerService.java
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/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

PS2: replace incallUI background for our non-intrusive
Change-Id: I5898103671d7b82c89a6ffcee5a30cf79f22341a

Conflicts:
	core/java/android/app/INotificationManager.aidl
	core/java/android/provider/Settings.java
	packages/SystemUI/res/layout/status_bar_expanded_header.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/phone/PhoneStatusBar.java
	services/java/com/android/server/NotificationManagerService.java
FWBase - Floating Window: Welcome back

* Port squashed jellybean floating window to kitkat.

Floating window contributors:
@drcmda
@beerbong
@D4rKn3sSyS

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

Merge notification manager service changes.

Change-Id: I823ce054549c7a7da2759097e3e08fbeacb9d3cb
Signed-off-by: MURA Stefano [STELIX PippoX3] <ssspinni@gmail.com>

Conflicts:
	packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
FWBase - Kill floating activities running in the same thread when tapping outside

This change makes all activities from the same app to be finished when
we tap outside the halo window. Other apps running in different threads
(floating or not) won't be finished.

Port from here:
https://github.com/ParanoidAndroid/android_frameworks_base/commit/f489f45ab2ba5dd4991c241917f7f4b0fd74b884

Change-Id: I14e2e181c502093b3180b11e5e7eb2f81e3ee456
Signed-off-by: MURA Stefano [STELIX PippoX3] <ssspinni@gmail.com>
Dismiss IME when floating window is dismissed

Previously the IME would be stuck on screen if the
floating window was dismissed while it was showing.

Change-Id: I8ca61b07ed89bae85eabd8db23f87b6f1f0b179f
Signed-off-by: Evan Anderson <evan@thelinuxman.us>
FWBase - Launch floating notifications from notification panel (long click)
FWBase - Floating mode in blacklist

* Status bar - long click on notification select 'floating mode' option

fix derp in floating notification launch

Notification long press fix

Conflicts:
	packages/SystemUI/res/menu/notification_popup_menu.xml
	packages/SystemUI/res/values/pa_strings.xml

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

Signed-off-by: MURA Stefano [STELIX PippoX3] <ssspinni@gmail.com>

Change-Id: I334fbb4f2ec9684bc3fa7d348f5c6609ad090d59

Conflicts:
	core/res/res/values/cr_strings.xml
	packages/SystemUI/res/menu/notification_popup_menu.xml
	packages/SystemUI/res/values/cr_strings.xml
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java

Also blacklist floating

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

Change-Id: I2de29a9507388273b9b6277f6ee1098f38d49238

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