[Tasker] [Root] Always-on capacitive button backlights

shockwaverider

Senior Member
Aug 13, 2011
228
65
58
Helsinki
I've put together a Tasker project (based on the information I found in this post) which allows the OP5's capacitive button backlights to be kept on all the time and to easily be switched back and forth between different states, via either a popup dialog or quick settings tile. I've only used it on Android OOS versions of Oreo 8.1 and I have no idea if it works on Pie.

Once the project has been downloaded and imported, follow these steps to get things working and looking right:

If you plan to use the popup, set a shortcut to open the task "Backlight Status Control With Icons", this will open up a dialog from which you can choose how you want the backlights to behave. There's also a profile and tasks included to set up a quick settings tile to cycle through the different settings. The dialog and quick settings tile can be used alongside each other, as can the native settings app, nothing should cause conflicts.

Dialog / Scene icons: You can use the dialog as-is, but it'll look stupid and you'll get laughed at, which is why I've uploaded icons for you to add to it. It isn't hard to do. First, download the attached icons zip file and extract it wherever. In Tasker, open the scene "Backlights Menu" for editing and click on the "AZ" icon at the bottom left. This will open a list of all the scene elements. There are three icon elements, open these one at a time and point them to the corresponding icons from the extracted zip (Image>>Local Media>>extracted folder). There are also three dividers which all use the icon "divider.png", plug these in and you're all set!

Quick Settings tile: The profile and task I set up cycle the button backlights through each of the three states (default>>always on>>always off). To set a custom QS tile, pull down quick settings and click on the pencil icon at the bottom right to open it for editing. On the bottom half of the screen are the unused tiles. Tasker has three tiles available to use, the one farthest to the right is number three, and that's the one I've set up the profile to use. (If you're already using that one, open up the tasks "Backlights QS Tile", "Backlight Reset QS Tile" and "Backlights Kill QS Tile" and edit the actions in those so they don't conflict with your current setup.) Drag that one to the top half of the screen where the active tiles are, get everything arranged how you want it and then back out and go and open up Tasker. Import the project if you haven't already. Tap on the task ""Backlights Reset QS Tile" to open it and tap the play icon at the bottom left. The tile should now be initialized.

Recommended: I put a couple icons in the zip for the QS tile, "icon_default.png" and "icon_off.png". They should be added to the tasks "Button Backlights Off" (icon_off.png), "Button Backlights On" (icon_default.png), and "Button Backlights Default" (icon_default.png). Add them by opening each task for editing, clicking the grid icon at the bottom of the screen, and then navigating to the extracted icons (Local Media>>extracted icons folder).
 

Attachments

Last edited:

shockwaverider

Senior Member
Aug 13, 2011
228
65
58
Helsinki
Hello, Thanks for the work.
Do you know if it is possible to increase the brightness?
I'm absolutely sure I did find something involving scripts to adjust the brightness, but right now I can't seem to find it, I'll let you know if I do.

OK, I'll go ahead and upload the continuation of my work. It's a Tasker project which, when triggered, pops up a dialog with the options of setting the backlights always on, always off, or the default behavior; basically just a cleaner and easier way to toggle the settings back and forth. It also forces the lights off almost as soon as the screen turns off, as well as when the daydream/screen saver kicks in. I would love to export this as an apk, but I haven't managed to make that work, so Tasker (and root) are required.

Import the project into Tasker and set a shortcut/trigger for the task "Backlight Status Control", it's pretty much self-explanatory from there.

Update: Figured out how to get App Factory to work, so now there's an installable apk for those who don't have Tasker installed. Still requires root, of course, and I would also recommend turning off battery optimization for the app and clearing caches, it behaved a bit strangely before I did that. If you have Tasker, I recommend importing the project anyway as it seems to run just a touch faster.

All links are in the OP.
 
Last edited:

shockwaverider

Senior Member
Aug 13, 2011
228
65
58
Helsinki
New version up, the main difference is that the chosen state survives a reboot whereas before rebooting with the lights set to Always On caused the lights to actually be always off when the device restarted. I probably fussed with the icons a bit as well, can't remember if I had already done that or not.

Links are in the first post.
 

shockwaverider

Senior Member
Aug 13, 2011
228
65
58
Helsinki
And another one. This version fixes two things. First, it only keeps the profiles active when they're actually needed rather than all the time, giving you probably a minute or two of extra battery life. And then it (hopefully) fixes the last potential conflicts when switching states in the device's settings app rather than this project's dialog. This required an extra one each of profile, task and variable as well as adding some actions to a few existing tasks.

As of right now, I'm only uploading xml's, as the exported apk's have been unstable when I've tested them on my device. If you really want to try it and don't have Tasker installed, pm me and I'll send you the app to install at your own risk.

Anyone who has downloaded and imported the xml may have correctly guessed that I don't have a whole lot of experience with Tasker. I would like to take this opportunity to invite anyone who has noticed something that could be done better and/or differently to give me honest feedback. As simple as this project is, it has nevertheless been frustrating at times and I would love to have the benefits of others experience.

:)
 

shockwaverider

Senior Member
Aug 13, 2011
228
65
58
Helsinki
Can't import, Tasker says the project "contained bad data." File seemed to download fine, 41.83 kb.
Sorry to hear it's not working for you. I've successfully downloaded and imported the project using two different devices, so the file itself doesn't seem to be the problem. It's possible, of course, that your download somehow got mangled along the way, so if you haven't already, try downloading it again and see what happens.

And... I'm honestly not sure what other advice to give you. Google just turned up really basic stuff like making sure you're not in beginner mode and that you're not actually trying to import it as a task or profile, stuff like that.

Tasker can be massively frustrating and picky, and I'm far from being an expert on it. Considering this is the first real feedback I've gotten on this thread, I don't know if anyone else has had similar issues, I just assumed no news is good news and that it works for everyone who's tried it. If anyone else has any ideas about why this would happen, feel free to share!
 
Last edited:

shockwaverider

Senior Member
Aug 13, 2011
228
65
58
Helsinki
Updated xml now with HAPTIC FEEDBACK omg lol! Also changed/added quite a bit of stuff to hopefully make it run a bit more efficiently in the background, so a few less toast notifications and magisk log entries to look at, otherwise nothing really noticeable.

EDIT: Apologies to those who already downloaded the new one, but I just updated the update :/ Maybe it's just placebo, but it feels like decreasing the vibrate duration made it feel a bit more responsive, no need to redownload if you're already happy with it.
 
Last edited:
  • Like
Reactions: enskje

shockwaverider

Senior Member
Aug 13, 2011
228
65
58
Helsinki
I totally forgot that Tasker lets you set Quick Settings tiles! So I've uploaded a new version that can set up a quick tile to cycle through the button states, it's disabled by default and naturally requires a bit of work to get it going but the instructions are, as usual, in the first post along with the attachments. Note that if you're going to use the quick tile you might also want to download the new icons.zip as well, check out the instructions and screenshots to see how it looks. Otherwise the only other change is the dialog pop-up got a bit smaller and very slightly transparent, there's a screenshot of that as well to help you decide if it's worth the bother.

EDIT: If you had problems with the QS tile not cycling through the settings correctly, download the newest version, it seems to have fixed it. Sorry for the inconvenience.
 
Last edited:

shockwaverider

Senior Member
Aug 13, 2011
228
65
58
Helsinki
New one up. The last version was inconsistent updating the QS tile when setting the lights from the settings app. Let's see how I screwed up this one then. Link and instructions in the first post, blablabla...
 

shockwaverider

Senior Member
Aug 13, 2011
228
65
58
Helsinki
Another week, another try to make the QS tile behave the way I want. Seems to be working over the last days of testing it, but then I say that every time. I also changed some task names so that the labels under the QS icons are accurate, and I uploaded a new icon zip with icons that imo look better in the OOS beta builds, the ones for the stable builds are still in there as well. You guys are smart, you'll figure it out.
 
Last edited:

Lord Sithek

Senior Member
Dec 19, 2018
463
185
53
Hi, I'm quite new with the Tasker projects! I have tried this one on my Xiaomi Redmi Note 4x (Android 7.0 Xiaomi.eu) and Samsung Galaxy Note 2014 Edition (LineageOS 14.1). I wanted to achieve buttons backlight when charger plugged in, but without screen waking. On Xiaomi it seems to work fine, but on Samsung I ended up with the error:
16.48.31/E Run Shell: ->
16.48.31/E Run Shell: ->
16.48.31/E Run Shell: ->
16.48.31/Shell runBackground echo 1 > /sys/class/leds/button-backlight/brightness root: true timeout: -1
16.48.31/Shell start process-thread ID 341
16.48.31/E add wait type Shell1 time 2147483647
16.48.31/E add wait type Shell1 done
16.48.31/E add wait task
16.48.31/E Error: 1
Can somebody explain me in a simple manner, what is wrong? I'm still begginer with Tasker ?
 
Last edited:

david19au

Senior Member
Jul 17, 2012
407
95
0
Prague
Hi, I'm quite new with the Tasker projects! I have tried this one on my Xiaomi Redmi Note 4x (Android 7.0 Xiaomi.eu) and Samsung Galaxy Note 2014 Edition (LineageOS 14.1). I wanted to achieve buttons backlight when charger plugged in, but without screen waking. On Xiaomi it seems to work fine, but on Samsung I ended up with the error:
16.48.31/E Run Shell: ->
16.48.31/E Run Shell: ->
16.48.31/E Run Shell: ->
16.48.31/Shell runBackground echo 1 > /sys/class/leds/button-backlight/brightness root: true timeout: -1
16.48.31/Shell start process-thread ID 341
16.48.31/E add wait type Shell1 time 2147483647
16.48.31/E add wait type Shell1 done
16.48.31/E add wait task
16.48.31/E Error: 1
Can somebody explain me in a simple manner, what is wrong? I'm still begginer with Tasker ?
You're in a wrong thread and possibly wrong forum too. This is about AoD on OxygenOS, not MIUI or LOS or Tasker.
 

shockwaverider

Senior Member
Aug 13, 2011
228
65
58
Helsinki
You're in a wrong thread and possibly wrong forum too. This is about AoD on OxygenOS, not MIUI or LOS or Tasker.
I mean, "Tasker" is in the thread title... And this thread is about the capacitive button backlights, which is what Lord Sithek is asking about, not AoD.

Can somebody explain me in a simple manner, what is wrong? I'm still begginer with Tasker ?
Sorry, I don't think I can help you, I don't really know that much about shell commands and definitely can't troubleshoot for an unfamiliar device. You'd be better off trying the Tasker forums on XDA or /r/tasker. Good luck!
 

Lord Sithek

Senior Member
Dec 19, 2018
463
185
53
Oh, thanks, it's a nicer reply :) It's true I rushed a little bit, I just googled "Tasker buttons backlight" and I didn't check what device is actually considered :eek: I'm still newbie here, but I want to learn more :cyclops: Thanks for the links, I will check the threads :good:
 
  • Like
Reactions: shockwaverider

shockwaverider

Senior Member
Aug 13, 2011
228
65
58
Helsinki
I haven't updated this in a few months because it more or less worked; however, I still encountered problems with the quick settings tile not cycling properly after a reboot, as well as Tasker throwing errors, although these didn't seem to affect functionality. Anyway, I had a few days off during the holidays and was able to stop the errors from occurring as well as come up with a workaround (although not a real solution) for the problems I had with the qs tile. And so, I present what should be the final version of this mod. Link in the first post, along with setup instructions.

Btw, anyone tried this with Pie? I'm not planning on making the jump anytime soon, so I'm just curious if it works or not.
 
Last edited: