Module to prevent certain apps from triggering Ambient Display - Xposed General

I'm hoping I can write a module that will prevent notifications from certain apps from triggering the ambient display. In theory, if we hook the right place in the DozeService and can grab the package name (or something else unique) from the notification, we can then compare it to a list and prevent the screen from turning on if necessary.
I'm looking at this as a base, since it already hooks DozeService: https://github.com/gavinhungry/Xpos...mbientnotifications/AmbientNotifications.java
My biggest hurdle right now is where the best place in DozeService.java would be to hook to: 1) grab the notification info and 2) prevent the screen wakeup. I'm thinking the onTrigger() function in TriggerSensor, but I'm not too familiar with this area of Android.
Could anyone point me in the right direction?

lonequid said:
I'm hoping I can write a module that will prevent notifications from certain apps from triggering the ambient display. In theory, if we hook the right place in the DozeService and can grab the package name (or something else unique) from the notification, we can then compare it to a list and prevent the screen from turning on if necessary.
I'm looking at this as a base, since it already hooks DozeService: https://github.com/gavinhungry/Xpos...mbientnotifications/AmbientNotifications.java
My biggest hurdle right now is where the best place in DozeService.java would be to hook to: 1) grab the notification info and 2) prevent the screen wakeup. I'm thinking the onTrigger() function in TriggerSensor, but I'm not too familiar with this area of Android.
Could anyone point me in the right direction?
Click to expand...
Click to collapse
Are you aware that the GravityBox module has the functionality to customize all aspects of notifications, by app, including LED color, blink pattern, vibration, sound, timeouts, priority, count, ambient display, heads-up, and disabling them completely?
I'd be amazed if it didn't already have the functions you desire.

Spott07 said:
Are you aware that the GravityBox module has the functionality to customize all aspects of notifications, by app, including LED color, blink pattern, vibration, sound, timeouts, priority, count, ambient display, heads-up, and disabling them completely?
I'd be amazed if it didn't already have the functions you desire.
Click to expand...
Click to collapse
I will take a look. I mainly wanted to prevent LightFlow's persistent notification from triggering it, but if I can replace LightFlow with GravityBox that's basically the same.

Related

[Wrong Section] Disable Lollipop Heads Up notifications?

Now that we're seeing the first release of Xposed for Lollipop, one of the first mods I'd like to see is disabling Heads Up notifications and going back to putting them all in the tray. Anyone know if any modules will be implementing this functionality soon? It's one of the strongest reasons my N5 is still on Kitkat.
I hate it too. Stays on screen way too long and no way to dismiss it without dismissing the notification. I've read that the module "notification ticker on lollipop" disables heads up but its done nothing for me on my OnePlus running cm12.
goo.gl/JnTJaZ
Hoping to see a module specifically for this soon.
You shouldn't expect mods written for stock to have a predictable effect on CM12. That's ultimately a functionality that CM12 needs to implement for themselves.
Me too. I really hate it when whatsapp notifications appear while I'm watching my videos or playing my games.
the "notification ticker on lollipop" module doesn't work well from what I've experienced.. works partially
EDIT: it does work
the thing is the module inside the xposed framework is 1.0 which is not good
but here is the 1.1 version which works good but from some reason is not shown in the xposed framework itself.. so youl have to download it and install it manually by yourself
I hate it too, but it looks very nice.. and after few weeks with Lollipop I feel that heads up notifications will be the worst when it shows on a full screen app ( MX Player, YouTube, Game ) and blocks 1/4 to even 3/4 the screen !!
So I would rather have an options to
1- set auto hide time for the notification.
2- option to hide the notification all times or only in full screen apps, or hide for/in specific list of apps
But I guess this will be too much for a mod. to do.
I would like to see a mod where you can slide *up* the notification and it disappears into the tray without being dismissed.
The Xposed General is not the correct section for module related questions/requests. Please read the guidelines of this section, as well as the forum rules. You're looking for this thread for module requests.

Lollipop notifications - disable auto expand

Hello!
I am wondering if there is an xposed module (or a setting) to disable auto expanded notifications on Android 5.0 Lollipop. I am only reading about auto expanding all notification and thinks like this.
But i want to disable auto expanded notifications. The reason is mainly PowerAmp app which has a notification to control music playback. The thing is that my phone screen is pretty small (Samsung Galaxy s3 mini with CM12) and PowerAmp notification is always expanded.
So, is it possible to disable auto expanding notifications on Android Lollipop? I have already tried "App Settings" xposed module, but an option "Disable big notifications" does not seem to work.
Thank you!
You could try GravityBox, or NotificationManager. I have no idea if any of them supports modifying behaviour you want to change though.
If I were you, I'd lower the dpi in build.prop, as I find Music controls to be quite handy
I have to admit that my request is quiet unusual.
GravityBox and NotificationManager do not have those functions.
Could you point me to some direction to learn something more about that build.prop? I have never modified that file before...
Me too
DecentM said:
You could try GravityBox, or NotificationManager. I have no idea if any of them supports modifying behaviour you want to change though.
If I were you, I'd lower the dpi in build.prop, as I find Music controls to be quite handy
Click to expand...
Click to collapse
Old thread, but I am looking to stop any notification from expanding in Lollipop/Marshmallow. The reason is I might accidentally swipe on a notification while I am just swiping to get to the settings panel, and there is no way to collapse the notification again.I hate it, one of the reason I am still on KitKat
Did you guys ever find a way to do this? Expanded notifications are annoying and take up a lot of space. And save a whole ONE tap.

Gestures not working

I've got gestures enabled in accessibility but when I have a notification and wave NY hand over sensor area it doesn't wake up or give me a view.
What could cause this?
I used the basic xml file with package disabler. Is there anything in there that could have caused it?
Jmgilliam16 said:
I've got gestures enabled in accessibility but when I have a notification and wave NY hand over sensor area it doesn't wake up or give me a view.
What could cause this?
I used the basic color file with package disabler. Is there anything in there that could have caused it?
Click to expand...
Click to collapse
hi,
firstly, the wake up gesture works fine for me. No issues, I have stock Rom (920C device) not rooted and no apps disabled. A few tips to remember. If correct setting is enabled in Accessibility /Dexterity and interaction /Gesture wake up . You don't wave your hand actually, its more of a "slow motion effect /action" over the device /sensor, than a fast wave etc.
Also check some combination in Settings if it is set correctly.... eg Notification reminder and LED indicator (re notification light flashing etc) clashes with each other.
And yes,
if you play around with apps like Package Disabler you must expect that disabling certain system apps can break other apps depending on the one you disabled ?
Good luck
Thanks. Will check all of that.
There is no "Gesture wake up" in my stock rooted N9208. Only direct Call, smart alert, silent and screenshot are available.
Elmar1801 said:
There is no "Gesture wake up" in my stock rooted N9208. Only direct Call, smart alert, silent and screenshot are available.
Click to expand...
Click to collapse
hi,
see screenshot attached, good luck
Elmar1801 said:
There is no "Gesture wake up" in my stock rooted N9208. Only direct Call, smart alert, silent and screenshot are available.
Click to expand...
Click to collapse
That's a different thing, gesture wake up is in Dexterity and Accessibility.
I've got mine "on".
You're right. Found it and it's working.

[GUIDE] How to enable Ambient Display Proximity Wake feature on OOS

As most of you might know, OnePlus removed the proximity wake option from OOS lately, replacing it with the lift to wake feature. If you want to use the proximity wake feature, you either have to switch to a custom ROM or use an outdated version of OOS. Both options might be suited for most people, but in case you prefer to use latest OOS and still want to use proximity wake, I have some kind of workaround.
PLEASE NOTE: it seems that the given shell command does not work on Android Oreo (OOS Open Beta as of writing). Check the latest posts of this thread for any progress.
I came across this shell command, which will trigger the ambient display:
Code:
am broadcast -a com.android.systemui.doze.pulse com.android.systemui
A big shoutout to @Quinny899 for providing me the code to trigger ambient display by shell command.
You can use this command with Tasker to trigger it when the proximity sensor is covered for some seconds or even when you wave your hand over it. I haven't had the time to get such a profile working until now, but I know that it can be archived easily.
In case you use the above command, ensure you check the "use root" option in Tasker's context menu for the shell command!
EDIT: I managed to get this working :good: Below my implementation. I am sure there is room for optimization, but this is just a basic task and it works for me (OOS 4.5.13 with Tasker 5.0u6).
You need three profiles. Two of them will check the proximity sensor state while screen is off, the third one actually triggers the ambient display while screen is off and proximity sensor has been covered (by waving over it for example).
First of all, we need to ensure that Tasker will monitor the proximity sensor while screen is off. For this, open the three-dot menu, select Preferences and navigate to the Monitor tab. Set "Proximity Sensor" to "On". That's it.
Second, you have to enable the Ambient Display option via Settings -> Display, otherwise this won't work at all (thanks to @Devildire for confirmation)
Let's have a look at the needed profiles:
Code:
[B]PROFILE [I]Prox OFF[/I]
[/B]State -> Sensor -> Proximity Sensor -> invert
State -> Display -> Display State -> "Off"
[B]TASK [I]Proximity uncovered[/I]
[/B]Variable -> Set -> %Prox = false
[B]PROFILE [I]Prox ON[/I]
[/B]State -> Sensor -> Proximity Sensor
State -> Display -> Display State -> "Off"
[B]TASK [I]Proximity covered[/I]
[/B]Variable -> Set -> %Prox = true
[B]PROFILE [I]Wake Ambient Display[/I]
[/B]State -> Display -> Display State -> "Off"
State -> Variables -> Variable Value -> %Prox = true
[B]TASK [I]Wake Proximity Display[/I]
[/B]Task -> Wait -> 1s
Task -> IF -> %Prox = false
Code -> Run Shell -> am broadcast -a com.android.systemui.doze.pulse com.android.systemui (DON'T FORGET TO CHECK "USE ROOT")
That's it. Now turn off your screen and try to wake the ambient display by waving your hand over the proximity sensor.
EDIT: Tasker profiles can be found in post #7.
EDIT #2: @Arstoien provided us with an improved version of my basic tasks, check it out here.
Thanks for the guide on how to, great work from you for the community
OP updated with instructions. Feel free to comment and share your experience or any kind of optimization proposes. Please note that the implementation is only a rough imitation of the original proximity wake feature, most likely this implementation needs some polishing.
Hey there. Sounds intriguing... I'm not understanding the stacked profiles... It seems you've got it triggering with two conditions. How do you do that?
Or... Would it be possible to upload the profiles and tasks for importing?
@saccentekennedy
If you want to add another trigger to a profile, just long-press the first trigger condition and Tasker will prompt you with a popup window where you can select to add another trigger option.
If anyone else is interested, I might upload the profiles later.
Hi guys , any file so that we can import it on tasker (if it has such system) to get this. !!??!!
Please find attached the requested profiles.
EDIT: You might want to change the wait time within the wake ambient display task to 1s instead of 300ms, this one actually works way better.
Portgas D. Ace said:
Please find attached the requested profiles.
Click to expand...
Click to collapse
Works! Thanks for sharing this.
Is root required?
BloomerzUK said:
Is root required?
Click to expand...
Click to collapse
Yes look in the code last line
Mhm I have root, Tasker has a root-entry in magisk, added the profiles in post #7, changed the proximity sensor to yes, but it is not working.
Ok... So I've discovered that this breaks pocket mode... Every time I took my phone out to unlock with my finger, it had already registered several attempts my leg had made. I guess it makes sense this might be a problem.
dre-z said:
Mhm I have root, Tasker has a root-entry in magisk, added the profiles in post #7, changed the proximity sensor to yes, but it is not working.
Click to expand...
Click to collapse
As said before, this is just a rough workaround, it works for me (but not as perfect as the former in-built option). It works if you move your hand slowly over the sensor.
saccentekennedy said:
Ok... So I've discovered that this breaks pocket mode... Every time I took my phone out to unlock with my finger, it had already registered several attempts my leg had made. I guess it makes sense this might be a problem.
Click to expand...
Click to collapse
Hmm, I don't have this issue, but we might add another trigger option to the wake ambient profile: only trigger if display is face-up. This way it won't be triggered if the device is in your pocket.
After looking over what you steup in Tasker........The biggest question is "What does the phone do when it is in your pocket?" I think if you can figure out a solid Tasker-based solution to that question, this will be something worth using. Great work.
It works (more or less)
@dre-z:
try changing the wait time within the wake ambient display task to 1s instead of 300ms. Works better for me and might enable the whole thing on your device. 300ms to wait until your hand moved over the sensor completely seems to be a bit too short.
Portgas D. Ace said:
@dre-z:
try changing the wait time within the wake ambient display task to 1s instead of 300ms. Works better for me and might enable the whole thing on your device. 300ms to wait until your hand moved over the sensor completely seems to be a bit too short.
Click to expand...
Click to collapse
I think I am doing something wrong. Doesn't work at all. Thanks for your help anyways
Seems like the command is not working for me. The command triggers, but the screen doesn't wake up. Any ideas what's wrong?
Devildire said:
Seems like the command is not working for me. The command triggers, but the screen doesn't wake up. Any ideas what's wrong?
Click to expand...
Click to collapse
Did you check the "use root" option in the corresponding task?
I use the downloaded profles and yes, root is checked. Using OP5 up to date OOS.
Edit: maybe there is something wrong with shell execution. Can you give me information about what I have to enter using tasker's "send intent" action instead?

Can Tasker create an icon to set the volume to a specific value...

...and to set the brightness to a specific value? I can do this easily in Windows, but not in Android.
Perhaps you figured it out by now, but just in case, the answer is definitely yes, I use that very functionality for brightness on my phone:
1. Create a new task
2. Add a "Display Brightness" action to this task (the value in this action doesn't represent percentage, so you might need to experiment with the number to get the desired brightness)
3. Add a "Tasker Shortcut" widget to your home screen. It will lead you to select the name of the task you created.
-It will also require you to select an icon for the widget, which you will do with the 9 squares at the bottom of the task edit screen (I already selected an Android robot icon in the picture).
-When adding the widget, you may also encounter an error message requiring you to open Tasker and exit with the back button to close it out properly in order for the widget to work.
There would be a similar process for volume, but you'd have to choose the appropriate action for which volume you want to adjust: ringer/system/media, etc.
Yes, I did figure it out, but thanks for posting that clear explanation, which is rare. It will probably help someone.
My most interesting program so far is a reliable way to turn the display off and on automatically to save battery power and, more importantly, to extend the lifetime of the power button.
Even with a reliable program, though, Tasker sometimes delays responding when it is closed and the display is off, so I've found that Tasker must be left running all the time. This is easy to arrange: in Android task viewing mode, click the lock icon at the top right of the screen view pane so that it becomes solid.
Such locks persist forever, I think, and are therefore quite confusing to newcomers to Adenoid, I mean Android.
You're welcome. Hopefully it might. I sympathize with the new user, since often it's difficult to get a solid, helpful answer from an advanced user regarding a beginner's topic.
As for Tasker being killed on occasion, unfortunately the circumstances surrounding that vary dramatically between devices. For example, whatever lock icon you're talking about to fix the issue on your device is not on my phone at all, so it would not work as a solution for me.
Do you have the option to "Use reliable alarms" in Tasker? I'm not sure if its presence varies between Android versions. I have that option set to "always"*, and I've never had a single time where Tasker fired late or was killed. It uses a persistent system alarm to keep tasker "in mind" all the time.
*And battery optimization for Tasker turned off, of course
david0001 said:
Yes, I did figure it out, but thanks for posting that clear explanation, which is rare. It will probably help someone.
My most interesting program so far is a reliable way to turn the display off and on automatically to save battery power and, more importantly, to extend the lifetime of the power button.
Even with a reliable program, though, Tasker sometimes delays responding when it is closed and the display is off, so I've found that Tasker must be left running all the time. This is easy to arrange: in Android task viewing mode, click the lock icon at the top right of the screen view pane so that it becomes solid.
Such locks persist forever, I think, and are therefore quite confusing to newcomers to Adenoid, I mean Android.
Click to expand...
Click to collapse
Enabling Use Reliable Alarms doesn't help. I think at this point I would say that getting Tasker to work when the display is locked is not obvious. Perhaps it is documented somewhere.
Basically, the bad symptom is as follows: after the display has been locked for a few minutes, moving the device fails to turn the display on again. Something kicks or locks Tasker out, but only after more than just a few seconds.
Sorry about not realizing that locking an app in memory is not part of Android. I'm using an inexpensive TCL A3 device sold by Tracfone. Locking is nice when you want to avoid startup delays for a task.

Categories

Resources