Active display: Ability to turn off the screen, when a not clearable notification is present

Removing the last clearable notification in AD turns of the screen. But if there is a not clearable notification, there is no ability to turn it off directly.
This patch adds a power target on place of the 'clear notification' target of AD.

Change-Id: I807cca4c293ed732b441cfdcca50957b427809fa
[1/2] Base: Pimp up ActiveDisplay

This is a squashed commit of the following:

- Active display: turn off display if device gets pocketed again
  https://github.com/CyanKang/android_frameworks_base/commit/3c139633e2cb341452320207e93fd10b480b65ed

- Active display: Option to change display timeout
  https://github.com/CyanKang/android_frameworks_base/commit/31a3c7dced93bda9501915ea87f28f8fd541b650

- Active display: Add some log output
  https://github.com/CyanKang/android_frameworks_base/commit/5be6bd59c27b0994b2459e4fe360d35c43349929

- Active display: Add threshold to proximity sensor
  https://github.com/CyanKang/android_frameworks_base/commit/fc4561bf1e78d656e37b6bc51340767e1ffa03f6

  Display will only be activated if the proximity sensor was covered for 5 seconds or more.

OmniGears part: https://gerrit.omnirom.org/#/c/2818/

Change-Id: Ib934157da195eb307c3c852de3d0549ad06bd004

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/policy/activedisplay/ActiveDisplayView.java
Active Display: Add some synchronization

Change-Id: I713ab506307efed10f1e1045f0fc2f975fba91cc
Active Display: Sort notifications by newest to oldest

Change-Id: I08aad7743b9c2f793d48266d7e6f648a78432d78

Conflicts:
	packages/SystemUI/src/com/android/systemui/statusbar/policy/activedisplay/ActiveDisplayView.java
Active Display: Fix Derp

Change-Id: If6c89f3dd7c8f2c6434358750c7ed5732fc88066
[1/2] Uptodate ActiveDisplay with Omni

----------FRAMEWORK PARTS-------------------
revert this --> https://github.com/PAC-man/android_frameworks_base/commit/b3b33db6a6550adef586201ffefe81108b056d0e

https://github.com/omnirom/android_frameworks_base/commit/434928a07e43b727485b7abd79f47b0a1bc03a9f
[1/2] Base: Fix pimp up ActiveDisplay

This is a fix for the new features added with change: https://gerrit.omnirom.org/#/c/2819/

1. Fix the bug when Pocket mode is set to Notifications only and you
unlock your device with power key and if you put your hands over
proximity sensor the device will turn off (very annoying). The problem
was that mWakedByPocketMode it was put in wrong place.

2. Added an option in active display settings for "turn off display if
device gets pocketed again" (it's annoying for me, because i cover
the proximity very often).

3. Added an option in active display settings for proximity threshold.
I use this active display feature as an replacement for "sweep2wake",
and when my phone it's on the table, i just want to pass my hand over
it to show me the clock or notification (this was ok before the pimp up
commit), and now, you can choose how many seconds for proximity
threshold.

Practicaly, this commit fix one bug, and add settings for the
features added in 'pimp up' commit.

THANKS --> Sergiu Sandor <micku7zu@gmail.com>
-----------------------------------------------------------------------------------------------------
https://github.com/omnirom/android_frameworks_base/commit/e4d93db54a9cd27345ae44c4dad6a4eb40656b4e
base: ActiveDisplay: fix for disappearing notification bar

What a derp
http://jira.omnirom.org/browse/OMNI-158
http://jira.omnirom.org/browse/OMNI-101
PS2
dont do it on secure lockscreens
PS4
check if lookscreen is enabled

THANKS --> Maxwen
-----------------------------------------------------------------------------------------------------
https://github.com/omnirom/android_frameworks_base/commit/6df6cb44afac23178b53644fa590b2ed52fc73aa
 Base: Fix ActiveDisplay problem
follow kitkat changes
fix ActiveDisplay never disabled after using turn off display option

THANKS --> 0xD34D
-----------------------------------------------------------------------------------------------------
https://github.com/omnirom/android_frameworks_base/commit/aabb34f109cb2adbd6c9f271fc963beed728a58e
 Base: ActiveDisplay check for Immersive Mode Enable

As we know, Immersive Mode will force StatusBar and NavigationBar to Hide
while ActivieDisplay always setSystemUiVisibility flags for Both if enabled,
and will cause a conflict for that flags

// how to reproduce bug:
// set ImmersiveMode enable
// set ActiveDisplay enable
// Turn Off screen, swipe to sensor, ActiveDisplay showing
// Turn Off screen again (using Power button)
// Turn On screen (using Power button)
// pull Quicksettings, disable ImmersiveMode from ImmersiveTile
// Turn Off screen again, swipe to sensor, ActiveDisplay showing
// unlock via ActiveDisplay
// voila.... random flags will be set into setSystemUiVisibility
// (sometimes navbar or statusbar or both are gone)

lets make ActiveDisplay check for ImmersiveMode enable/disable,
so ActiveDisplay will not always setSystemUiVisibility flags
if ImmersiveMode enable

also workaround fix for unknown icon (?) sometimes appears
(if Show All Notification enabled)
(based from user report at XDA thread, why they always report there not in JIRA :/)

THANKS -->  Squadzone
-------------------------------------------------------------------------------------------------
https://github.com/omnirom/android_frameworks_base/commit/02f017e7f1a590a2c161de5408e28dd1e0d6318c
 Base: Disable proximity sensor when screen goes on in ActiveDisplay/PocketMode.

Active Display (in Pocket Mode) currently only switches off the proximity sensor in some cases.
If the user switches on the screen itself, the sensor is left running. This change
stops the sensor as soon as the screen goes on. Active Display already started the sensor each
time the screen goes off.

PS2: In the mode that turns the screen off again when the device is pocketed,
the sensor stays on until you leave ActiveDisplay.

THANKS -->  GidiKroon
--------------------------------------------------------------------------------------------------
https://github.com/omnirom/android_frameworks_base/commit/5fb130d9929e986ac995e4f1e13cf2e21aa6bc83
 Base: more fix Active Display

fix http://jira.omnirom.org/browse/OMNI-352
fix http://jira.omnirom.org/browse/OMNI-357

THANKS --> Squadzone
------------------------------------------------------------------------------------------------
https://github.com/omnirom/android_frameworks_base/commit/2806eabf10d410e7b01201c6d08c3fb69ba55ffd
 Base: more fix Active Display (again)

maybe fix
http://jira.omnirom.org/browse/OMNI-313
http://jira.omnirom.org/browse/OMNI-421
http://jira.omnirom.org/browse/OMNI-401

THANKS --> Squadzone
------------------------------------------------------------------------------------------------
https://github.com/omnirom/android_frameworks_base/commit/752e13f6d74126c85dead13f1cecb5a66d0a4d1c
 [1/2] Base: ActiveDisplay (rework interface)

really fix AD buggy stuff
tested with Music play
tested with No lockscreen
tested with faster screen turn off
check all sensor going off if AD not Showing or Disabled
fix notification posted/removed
make AD using System Window so it will covered all screen
fix Navbar translucent if Lockscreen Blur merged :P
now using Rounded Image
also introduce new RoundedImageView widget
 courtesy of @vinc3m1 (thanks)
fix build
fix sometimes screen turn off after unlock because screen timeout (hopefully)
now using new parser to get Notification data (thanks @Achep for the parser)
rework lightsensor manager
add NotificationUtils
fix brightness sometimes not changing

add support applications privacy mode (will not show content message if enable on each app)
see http://jira.omnirom.org/browse/OMNI-600

allow bypass AD if no notification and lockscreen is secure
see http://jira.omnirom.org/browse/OMNI-594

fix proximity always enable after adding new feature allow bypass AD
fix parsing notification data from app with targetSDK < 17

fix excluded app value (no body notice this broken since AD merged into OmniRom xD )

add option to allow bypass AD
make AD multiuser support

THANKS --> Squadzone
---------------------------------------------------------------------------------------------------
https://github.com/omnirom/android_frameworks_base/commit/452d3baad3db13e0b85ac8dcd6a89d56d1845032
 Base: fix ClockView ActiveDisplay

why no body report this bug?

this happen since AD merger into omnirom for the first time
i found this bug after using 24 time format LOL

THANKS --> Squadzone
--------------------------------------------------------------------------------------------
https://github.com/omnirom/android_frameworks_base/commit/3e1bc8ef78c37ace8ec149ac2e73af2217aaa20f
 ActiveDisplay: Fix for flo and other devices
The changes made to layout/active_display_content.xml were not
made to its layout-land and layout-sw600dp counterparts

Make them here too to stop flo from crashlooping in systemui.

These values may need to be tweaked later, but preventing crashloops
is top priority.

THANKS -->  Entropy512
------------------------------------------------------------------------------------------------
https://github.com/omnirom/android_frameworks_base/commit/3ca94cc408da6a2aa23c6658b17fd77ed693de46
 [1/2] Base: fix ActiveDisplay for WifiOnly Devices

fix http://jira.omnirom.org/browse/OMNI-637
also fix for devices with unsupported Proximity sensor and Light sensor

THANKS -->  Squadzone
------------------------------------------------------------------------------------------------

PAC commets:
not applyed QUIET HOURS -> https://github.com/omnirom/android_frameworks_base/commit/e3a1a775bcacc48512cfd47ea1274597d60ad5bf
is taken from slim & not implemented yet

Change-Id: Ib5b1d30faad057705cc6c24e439770a5ff5f16e8

Conflicts:
	core/java/android/provider/Settings.java
	packages/SystemUI/res/values/pac_dimens.xml
	packages/SystemUI/res/values/pac_strings.xml
FW: more improve Active display [1/2]

1. fix http://jira.omnirom.org/browse/OMNI-651
2. fix http://jira.omnirom.org/browse/OMNI-641
3. add http://jira.omnirom.org/browse/OMNI-652
4. Add option Double tap to sleep every where
5. Add option to show wallpaper blur behind active display
6. Allow to show numbers of notification on Handle (only show if notification count is enabled in bar settings)
7. minor improvements
8. add battery circle around handle (only show if battery circle around lockscreen handle enabled, see security settings)
9. fix http://jira.omnirom.org/browse/OMNI-665
10. fix whitespace

Change-Id: Ia9d38d0278718a5820c6d35aa8ca178e2ac476d5

Conflicts:
	core/java/android/provider/Settings.java
FW: Fix SystemUI because Activedisplay

fix http://jira.omnirom.org/browse/OMNI-708
fix http://paste.omnirom.org/view/e7039c0b
fix http://paste.omnirom.org/view/6977cb45

also need -> http://review.pac-rom.com/#/c/765/

Change-Id: I8079a2af728f3367d3532d798819d7ddc98ebdc0
FW: Active display bugfixes [1/2]

1. fix respect QuietHour changes
2. fix compute background bound for background image
3. fix http://jira.omnirom.org/browse/OMNI-724
4. fix http://jira.omnirom.org/browse/OMNI-722
5. fix http://jira.omnirom.org/browse/OMNI-709
6. remove useless layout
7. fix invalidation when sunlight mode disabled
8. fix fetch wallpaper
9. fix glowpad ring after configuration changes
10. disable wallpaper blur until we find fix for problem in OMNI-715
11. make sure when configuration changes, all view is rebuild, so there is double background window
    is showing
12. remove Wallpaper

need -->
http://review.pac-rom.com/#/c/765/
http://review.pac-rom.com/#/c/768/
and settings part ->
http://review.pac-rom.com/#/c/769/

PS2: update author
PS3: Derp fix

Change-Id: I186926feee97479c0e220f51f10ee88c8e0a45bd

Conflicts:
	core/java/android/provider/Settings.java
	packages/SystemUI/Android.mk