[MOD] Script to toggle the keylights

Takenover83

Well-known member
Mar 7, 2011
499
76
0
Visit site
Thanks. I edited the screen-on profile and disabled the screen-off profile. That got me fixed up. Not the most noob friendly solution but it is a very good solution and much better then keylights0.2.apk
 

mmarz

Well-known member
Mar 9, 2011
1,130
447
0
Visit site
Thanks. I edited the screen-on profile and disabled the screen-off profile. That got me fixed up. Not the most noob friendly solution but it is a very good solution and much better then keylights0.2.apk

Awesome! I'm not the only weirdo doing this stuff!

Once you get familiar with tasker you can do some complicated stuff. You are pretty much writing your own apps on the fly.
 

vee

Well-known member
Feb 17, 2011
283
14
0
Visit site
I was wrong when I first answered your question. Check the main post for a method to do just that.

That's it? I'll try the adb commands when I get home later today. If they really do stay disabled, i'll be really happy, I personally see no use for them on my end.
 

mmarz

Well-known member
Mar 9, 2011
1,130
447
0
Visit site
That's it? I'll try the adb commands when I get home later today. If they really do stay disabled, i'll be really happy, I personally see no use for them on my end.

They do, you just have to run the command after every boot. You can use gscript to automate it or add it to an init.d script.
 

Takenover83

Well-known member
Mar 7, 2011
499
76
0
Visit site
mmarz, I am having trouble getting the newest keylights.rar up and going. This is on a fresh install of Harmonia 1.2

  • Installed tasker
  • Installed sl4a
  • copied the 4 script files to sdcard\sl4a\scripts\
  • copied the tasker xml to sdcard\tasker
  • pushed sush into /system/bin and chmod'ed
  • Code:
    adb remount
    adb push sush /system/bin/
    adb shell chmod 755 /system/bin/sush
  • Opened Tasker, Menu>Profile Data>Restore
  • Pressed Apply and rebooted
  • After rebooting, I see afterboot.sh runs and exits
  • Made sure sl4a had su access

Running, the keyflash script's in sl4a manually, I do see the key's flash quickly and then stop. So I am thinking the problem is within Tasker.
I have been testing with Google Voice SMS. (sending a text to GV and seeing if the keys flash)

Edit #1: Tested task "Togglekeylights". Hit the test button, turned the screen off, and a few seconds later the keys flash. So I am guessing I am having a problem with one of the other profiles. The only two I can test right now are VOIP and GV. I am currently not topped up, so I can not test the other profiles.
Edit #2: I fixed it. Had to enable the accessibility service for tasker. This needs added to instructions. Go to Settings>Accessibility> Enable Accesibility and Tasker.

22224015.png
73472924.png

20347116.png
69332438.png
 
Last edited:

mmarz

Well-known member
Mar 9, 2011
1,130
447
0
Visit site
Hmmm, I just tested the tasker profile I uploaded using GV sms and it worked. I would say that maybe you made a typo when you created the sl4a folders, but the scripts show up in sl4a. Try editing the Keylights task in Tasker. Select one of the run script commands and see if you can select the correct script using the magnifying glass icon.

Also, I put in a ten second delay between getting a notification and the lights blinking. I did that just for the missed call notification since the screen might be on after a missed call happens. But that adds a ten second delay for all notifications because of the way I set it up. Are you waiting long enough before deciding that it doesn't work? You can edit the delay by editing the Togglekeylights task.
 

easyguy

Well-known member
Apr 30, 2011
132
5
0
Visit site
This mod stops the blacklight from turning on when you press the key. If you just want to do the same on your own without Tasker, run the following through adb shell or a script with root privileges:

How do I do the above? adb shell or a script with root privileges.
 

mmarz

Well-known member
Mar 9, 2011
1,130
447
0
Visit site
Well, it turns out that running Tasker in loops causes the phone to not go to sleep. This means that when your lights are flashing, the battery will drain faster because your phone never goes into idle mode. I tried to get around this by running the loop within the script, but that failed because as soon as the phone does go idle, the script stops running and the lights stop flashing. So while this solution does work, it is not ideal.

What we really need is an app that puts the phone to sleep in between the the led flashes. The app I mentioned in the first post does that, but it only notifies you of incoming SMS. I made a work around by installing that app, and then having Tasker send myself an SMS whenever I want the lights to be triggered. This is also not ideal, but at least it saves your battery. I made a slightly modified version of the keylights app here: KeylightsOV.apk
I hope the author doesn't mind (he hasn't updated his thread since June of 2010), but I couldn't stand to look at the default icon he used.

Hopefully one of the rom devs will build in flashing the key lights for notifications into their rom, or some kind soul will make an app with more options for notifications. I am just too busy to start learning how to develop for Android myself.
 

Takenover83

Well-known member
Mar 7, 2011
499
76
0
Visit site
I wonder if we can decompile the dex and add a few more notifications, and recompile?

Edit: To decompile and recompile you need smali/baksmali

Decompile: java -jar baksmali.jar -o classout/ classes.dex
Recompile: java -Xmx512M -jar smali.jar classout/ -o classes.dex

Notifications that would be wanted
Missed calls
Missed SMS
Missed GV SMS
Gmail/Email
Groove IP missed calls or perhaps other voip (sipdroid/csipsimple)
Voicemail
 
Last edited:

mmarz

Well-known member
Mar 9, 2011
1,130
447
0
Visit site
I wonder if we can decompile the dex and add a few more notifications, and recompile?

Edit: To decompile and recompile you need smali/baksmali

Decompile: java -jar baksmali.jar -o classout/ classes.dex
Recompile: java -Xmx512M -jar smali.jar classout/ -o classes.dex

Notifications that would be wanted
Missed calls
Missed SMS
Missed GV SMS
Gmail/Email
Groove IP missed calls or perhaps other voip (sipdroid/csipsimple)
Voicemail

I decomplied it thinking I could do that, but it is a but more complicated than I anticipated: keylights.rar

The problem is that the author did not use a notification to turn on the lights. The author actually checks for an SMS in the inbox. That means to make it check for other items, you need to completely rewrite the program or have access to the source code. The decompiled code is too much of a mess to work with.
 

Takenover83

Well-known member
Mar 7, 2011
499
76
0
Visit site
I was afraid of that. Is the author MIA? I would be willing to pay for updates, as I am sure many other Optimus users would.
Edit: had a look over at sdx-developers. Look''s like he has not be around since a couple weeks after he posted the apk.
 

Takenover83

Well-known member
Mar 7, 2011
499
76
0
Visit site
Considering I have my WIFI set to never sleep, and leave Groove IP running 24/7, I am wondering how much of a additional effect Tasker's loop is having on battery. As a workaround, a configurable time-out can be added, correct? That way if I have went to count-sheep and I get a notification, it will not flash for the next 6-hours.