Launch floating notifications from notification panel (long click)

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

fix derp in floating notification launch

Notification long press fix

Conflicts:
	packages/SystemUI/res/values/ras_strings.xml
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
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: Ie6d6f46b2e23be60f991520ed480c2866fb2d0e3
Long press recents to switch to last app

Change-Id: I8c52a7b40d4229d523bccc1c9246673b82f5b48b
Conflicts:
	core/java/android/provider/Settings.java
	packages/SystemUI/res/values/ras_strings.xml
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
Never load launcher on long press recents

Related: AOSPA-279

Change-Id: I7860d84c4eb36fe0f592dfc4d5b2769040abf182
Avoid SystemUI crash due to NPE BaseStatusBar.createNotificationViews()
returns null# Please enter the commit message for your changes. Lines
starting when it reports handleNotificationError(), leading to# with '#'
will be ignored, and an empty message aborts the commit. a forced crash
of the misbehaving app. However, it# On branch kk-ras-pa should not add
a null object of Notification.Entry# Changes to be committed:
since it will also crash SystemUI (crashing at compare).#	modified:   packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
On-The-Spot: Add clear all recents button to user preferences.

PS3: Add proper drawable thanks to / by Dani Rosenkamp @DaNi--
     Fix wrong change id (from abandoned commit)
PS4: More logic drawable

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

Conflicts:
	core/java/android/provider/Settings.java
	packages/SystemUI/res/values-ca/pa_strings.xml
	packages/SystemUI/res/values-es/pa_strings.xml
	packages/SystemUI/res/values/ras_strings.xml
	packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
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:
	core/java/android/provider/Settings.java
	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.

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

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
[1/2] Prepare NotificationManagerService for new format

* Needed for blacklisting

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
Change-Id: I7801d65016aa949a5e2406e00871229a602829b9
[1/2] Add support for Peek app

Disable built in peek when Peek app is installed. Enable it again on app's unistall.

Signed-off-by: Carlo Savignano <stevewatersy@gmail.com>
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:
	packages/SystemUI/res/values/ras_strings.xml
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/src/com/android/systemui/statusbar/BaseStatusBar.java
	packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationHelper.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
	services/input/InputWindow.cpp
Revert "HOVER [1/2]"

This reverts commit 704f8070a3bf2448fa5214c2b132e1c06f4aa319.
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>
Add TYPE_MAGNIFICATION_OVERLAY to InputWindowInfo::isTrustedOverlay()

This fixes a bug where a View with filterTouchesWhenObscured will have
all touches filtered when in magnification accessibility mode. This is
due to magnification being a separate Window over top of the running
Activity. The method onFilterTouchEventForSecurity in View will then
always return false when filterTouchesWhenObscured is enabled on the
View. By adding the magnification Window to the list of Trusted Overlays
we can ensure that touches will work properly with this property enabled.

Change-Id: I07706588a625682d05da5cb19f401139eb08a54c
Signed-off-by: houst0nn <houstonn@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:
	packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
	packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
Revert "TextView: Prevent more NPEs"

This reverts commit 087181eb3cc293bdb30584e37c4e04ab060e08bc.

I dunno why this breaks TextView in Chrome app, get rid of safe checks then! lol
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