follow to kitkat changes their new fixes for active display

pulled from ChOS credit for 0xD34D

follow kitkat changes and fix ActiveDisplay never disabled after using turn off display option

pulled from omni , credit for Squadzone

using another logic to determine, when need to hide Statusbar and Navigationbar
we dont want systemui visibility reset if lockscreen still enable and ActiveDisplay force to Turn Off

Correct ActiveDisplay visibility when launch Ongoing Notifications

fix Back button navbar cant work on some conditions

since AD detect User Activity, we dont want to override UserActivity inside View, so do only if AD visibilty are Gone

also add patch to keyguard, do not reset if ActiveDisplay visibility Visible
taken from Lockscreen Notification by David L.-W <david.leppla.weber@gmail.com>

Change-Id: Ia4c1aa78e0ab2067cc071036cc8723d9e1ccf893
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.

Change-Id: Id7afcd858f341ad929606d302c5741efa99a7c6f
Refactor ActiveDisplay

This reverts following commits:

Base: Disable proximity sensor when screen goes on in ActiveDisplay/P… …
d3cc63ccd1 Browse code
codex-corp authored 2 months ago codex-corp committed 2 months ago

follow to kitkat changes their new fixes for active display …
568a433716 Browse code
codex-corp authored 3 months ago

Add Back

Active Display: Sort notifications by newest to oldest …
7674882824 Browse code
0xD34D authored 4 months ago

Active Display: Add some synchronization …
b3b33db6a6 Browse code
0xD34D authored 4 months ago
Schubi

[1/2] Base: Pimp up ActiveDisplay …

- Active display: turn off display if device gets pocketed again
  OmniKang/android_frameworks_base@3c13963

- Active display: Option to change display timeout
  OmniKang/android_frameworks_base@31a3c7d

- Active display: Add some log output
  OmniKang/android_frameworks_base@5be6bd5

- Active display: Add threshold to proximity sensor
  OmniKang/android_frameworks_base@fc4561b

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

Active display: Ability to turn off the screen, when a not clearable … …
d047508943 Browse code
Der-Schubi authored 4 months ago

This reverts commit d3cc63ccd1ff2bdbdd6d6ddd9761d9e31b383120.

Conflicts:
	core/java/android/provider/Settings.java
	packages/Keyguard/src/com/android/keyguard/KeyguardViewMediator.java

Refactor ActiveDisplay
Squashed Sync Omni Active Display [1/2]

all credits goes to omni team and AD orginal author

[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.
base: ActiveDisplay: fix for disappearing notification bar

PS2
dont do it on secure lockscreens
PS4
check if lookscreen is enabled

Base: Fix ActiveDisplay problem
follow kitkat changes
fix ActiveDisplay never disabled after using turn off display option

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 :/)

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

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.

[1/2] Base: fix ActiveDisplay for WifiOnly Devices
also fix for devices with unsupported Proximity sensor and Light sensor

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.

Base: more fix Active Display

Base: more fix Active Display (again)

[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
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)
allow bypass AD if no notification and lockscreen is secure
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

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

Signed-off-by: hany <hany.alsamman@gmail.com>

Conflicts:
	packages/ExternalStorageProvider/res/values-lb/strings.xml
	packages/SystemUI/res/values/colors.xml
	packages/SystemUI/res/values/probam_dimens.xml
	packages/SystemUI/res/values/probam_strings.xml
	packages/SystemUI/res/values/probam_styles.xml

Squashed Sync Omni Active Display [1/2]