[Q] Can you customize app order? Can you customize launcher at all? - Nexus Player Q&A, Help & Troubleshooting

I was recently told how I can turn recommendations off per app, but after i turn them all off there is still a row on the top, it just says it can't find recommendations now. Pretty dumb.
Anyone know how to get rid of the row or how to change the order of the applications? Seems like we need a new launcher from Nova team or something.
Edit: Change the order of the applications in the application row, not like the order of recommendation apps.

I wasn't able to do so yet :/

Yes, you can reorder the apps but it requires root. Basically, you need to extract /data/data/com.google.android.leanbacklauncher/databases/launcher.db, copy it to somewhere with an sqlite3 binary and the manipulate the 'entity_score' column in the 'entity' table.
This is what it looks like by default (excerpt):
$ sqlite3 ./launcher.db
SQLite version 3.8.7.4 2014-12-09 01:34:36
Enter ".help" for usage hints.
sqlite> .mode tab
sqlite> select entity_score, key from entity_scores order by entity_score desc limit 20;
20 com.HBO
19 com.showtime.showtimeanytime
18 com.songza.tv
17 com.google.android.play.games
16 com.dishworld
15 com.sling
14 com.hulu.livingroomplus
13 com.netflix.ninja
12 com.google.android.music
11 com.android.vending
10 com.google.android.youtube.tv
9 com.google.android.videos
8 com.google.android.apps.mediashell
7 com.google.android.apps.plus
0 com.ted.android.tv
0 com.plexapp.android
0 com.google.android.gms
0 com.google.android.katniss
0 com.google.android.tts
0 com.google.android.marvin.talkback
Click to expand...
Click to collapse
Notice how certain big-name media apps are magically ordered high out of the box - even though I have never had these installed?
Anyway, let's say that I want the Kodi icon to be presented very early on, say around where Netflix lives. Simple:
sqlite> select entity_score,key from entity_scores where key like '%kodi%';
0 org.xbmc.kodi
sqlite> select entity_score,key from entity_scores where key like '%netflix%';
13 com.netflix.ninja
sqlite> update entity set entity_score=13 where key='org.xbmc.kodi';
sqlite> select entity_score,key from entity_scores where key like '%kodi%';
13 org.xbmc.kodi
Click to expand...
Click to collapse
Now exit sqlite3, push the updated launcher.db to the device (make sure it has the same ownership and permissions as before), kill the leanback launcher or just reboot and behold your new launcher order.
See also this thread: http://forum.xda-developers.com/showpost.php?p=62824567&postcount=10
And this: https://www.reddit.com/r/nexusplayer/comments/3j4g6e/rearrange_programs_with_root/

It is now possible to customize the order of Android TV home screen apps directly through the Leanback Launcher.
http://www.androidpolice.com/2015/1...rder-your-apps-in-version-1-1-4-apk-download/

Related

adding programs shortcut to settings

i want to add some progarm shortcut to settings . personal . system . connection
is there any way to do it by reg or else
Hi,
this is easy. Look with this example on Sliding Keyboard Sounds.
Add the content from attached zip file to OEMDrivers.
Make reg entries to your OEM Packages:
This entrie add APP to Settings:
[HKEY_LOCAL_MACHINE\Software\HTC\HTCCPL\Applet20] next applet is 21, next 22 etc.
"CmdLine"="" enter here app commands
"Path"="\\Program Files\\SlideSound\\SlideSound.exe"
"Title"="SlideSound"
"Name"="SlideSound"
and this entrie to Settings Group:
[HKEY_LOCAL_MACHINE\ControlPanel\SlideSound]
"Group"=dword:0
Group 0 = personal
Group 1 = system
Group 2 = connections
wfg
starbase64
this doesn't work for me on the kaiser!
I was trying to add the Long Press End Key settings to my system section.

[Guide][Tasker] Check cell network type

***Requires Root*** (unless someone can show me a way that doesn't)
Checks the cell network type, NOT DATA TYPE.
Background: I am a truck driver for three months a year during my summer break from university. I love streaming music, but I love Nexus phones (and my $30 a month truly unlimited everything from T-Mobile!). Because I am on T-Mobile, my data connection on the interstates SUCK. So, I went ahead and got a prepaid Verizon mobile hotspot with the 10GB a month plan to use while on the road. However, I go through large cities frequently, so using the hotspot all the time is not ideal. I came up with the idea to use Tasker to track which mobile network type I am connected to, and turn off wifi when I gain HSPA or LTE, or turn wifi on when I lose HSPA or LTE. Sounds simple right? WRONG! The problem is that the only state context that Tasker has is Mobile Data, and can be set to 2G, 3G, 3G-HSPA, or 4G. I thought this would be enough, however, once wifi is connected, the mobile data state becomes None. So instead, I had to figure which string I needed from a dumpsys, output that string's value to a Tasker variable, and from there I could set If / Else statements. So let's begin:
First, I had to open up a terminal emulator and type in:
Code:
su
This will ask for Superuser access, simply allow always, and accept.
Next, type in:
Code:
dumpsys | grep DUMP
This will show you the different services you can view with dumpsys! Quite a bit of info there.
Now, from the helpful people over in the Tasker groups forum, I learned that network status is in
Code:
telephony.registry
So to only show that (instead of a huge long list of all the info), you will type in:
Code:
dumpsys telephony.registry
From here you can scroll through all the states. There will be a lot of values, but the one we are looking for is
Code:
mServiceState
In this case, I see it as (will vary between phone and provider):
Code:
mServiceState=0 home T-Mobile T-Mobile 310260 HSPA CSS not supported -1 -1 RoamInd=-1 DefRoamInd=-1 EmergOnly=False
"That's cool. Now what do I do with it?"
I'll tell you! With this info, head over to Tasker and make a profile (I used a time profile to activate every two minutes). After you make your profile, name a new task (I named it Celltype). Now add an activity, select Shell, then Run Shell. We've got some cool stuff here right? Yes, we do. It is a good idea to simply type in the command:
Code:
dumpsys telephony.registry | grep mServiceState | awk '{print}'
and set your timeout (mine is 4 seconds). Check the Use Root box, then in the Store Output In field, type a new variable name (I used %STATE); don't use a variable that is already in use! Dandy! Now just hit the back button and add another action. This time, select Alert and pick one (I picked popup, so that is what I am using in this guide).
Find the Text field, and enter your variable (%STATE) for me. Now just hit the back button, then hit the Play button in the lower left hand corner. You should get a Superuser request, allow it. Then, you should get a popup with the output of mServiceState, which for me is:
Code:
0 home T-Mobile T-Mobile 310260 HSPA CSS not supported -1 -1 RoamInd=-1 DefRoamInd=-1 EmergOnly=False
If you do not get a string like that, try changing '{print}' to '{print $0}' in the Command field in your Run Shell action.
Now find your network type. For me it is HSPA. Then count the position that network type text is in the mServiceState string. This is separated by spaces, so if I count mine, HSPA is in the sixth position (your's may vary). Did you notice I had you put at the end of the dumpsys in the Run Shell action:
Code:
awk | '{print]'
Well that prints out the result to whatever you tell Tasker to. You can do a lot of cool things with the print function, but I'm only going to cover what is relevant to this guide, which is the position identifier, $. In this case, since the text I want is in the sixth position, I will change the Command field in the Run Shell action to:
Code:
dumpsys telephone.registry | grep mServiceState | awk '{print $6}'
Your's may be in a different position, say it is in position three. Then you will put '{print $3}' at the end of your Command field. Again, make sure Use Root is checked and Store Output In has your created variable typed in.
Hit the back button to bring you to the main Task screen, and hit the play button in the lower left hand corner again. This time, in your popup, you should get the network type only. In my case, I got a popup that had the text, HSPA. If all goes well, and you do get ONLY the network type, then congrats! If you didn't, go back and make sure everything is correct (variable matches across actions).
If everything is dandy at this point, you can go ahead and delete the popup action (or keep it until you are all done with everything, like I did). What I did next is add a new action, selected Task and selected If. In the If action; type your created variable into the field on the left, then choose your matching method (mine is Matches) and type what you want it to match (or not match, etc) in the field on the right (for me, I typed HSDPA/HSPA/HSPA+/HSUPA/LTE, the / meaning OR).
After that, you can add whatever sub actions you want executed if your If statement is met. Once you have those done, you can add an Else action and any sub actions you want executed if your If statement is NOT met!
I have attached my XML from Tasker (just unzip, then import the XML), so you can go ahead and check out my whole project, break it apart and turn it into your own, whatever. If you share it, just please mention me. Or don't :crying:
P.S. If I missed anything, let me know! However, I AM a truck driver right now, I don't have very much time, but I will try to help if anyone needs it.
A truck-driving, college-studying, android-coder... Art Bell would be so proud.
:good:
Thanks, appreciate the tutorial. Interesting...
Thank you so much for this tips
It's very nice to improve my 2g/3g switching profile.
Here's what im using now:
Profile Name: Display On + 3g
Events: Display Unlocked + Not Wifi Connected ***
My task: 3g Enable
1 - Send Intent
Action
action.intellig.CHANGE_NETWORK_TYPE
Extra
extra.intellig.NETWORK_TYPE:0
2 - Flash
Text 3g
3 - Wait
1 minute
4 - Run Shell
Command
dumpsys telephony.registry | grep mServiceState | awk '{print $7}'
Use Root checked
Store Output In %STATE
5 - If
Condition
%STATE ~ GSM
6 - Send Intent
Action
action.intellig.CHANGE_NETWORK_TYPE
Extra
extra.intellig.NETWORK_TYPE:2
7 - Flash
Text 3g Forced
Hey.
Amazing share but im trying it doesnt work right now on lolipop i think.
Or i cant do it i dont know
Do you use this task right now?

[Q] newbie help

hi, ive tried cm, but it wont let me controll it from my keyboard, (aosp crash) and i rly want to use it stock, now im rooted, i can go back to stock, i can even have a launcher on it, as long as i can keep its stock purpose, to play my music and look awesome while doing it, but i cant get past the welcome screen, now, is there any way to bypass that?
meldalinn said:
hi, ive tried cm, but it wont let me controll it from my keyboard, (aosp crash) and i rly want to use it stock, now im rooted, i can go back to stock, i can even have a launcher on it, as long as i can keep its stock purpose, to play my music and look awesome while doing it, but i cant get past the welcome screen, now, is there any way to bypass that?
Click to expand...
Click to collapse
Not really. I'm thinking about how to make the ring dance using setting persist, but I'll have a lot to learn before then.
animal24 said:
Not really. I'm thinking about how to make the ring dance using setting persist, but I'll have a lot to learn before then.
Click to expand...
Click to collapse
nice, when u do, pls post a guide, i would rly love being able to use the leds, ure running cyan?
animal24 said:
Not really. I'm thinking about how to make the ring dance using setting persist, but I'll have a lot to learn before then.
Click to expand...
Click to collapse
Pro-tip: using setprop is really slow, IIRC. There is a program called avrlights that is used via a shell that allows you to change the ring faster with more granularity. If you're looking to get some dancing going on, avrlights is probably what you want (just know that it's kind of janky). On the other hand, if you just want to change the whole ring color, setprop will work, but it's still kinda slow.
mcsaucy said:
Pro-tip: using setprop is really slow, IIRC. There is a program called avrlights that is used via a shell that allows you to change the ring faster with more granularity. If you're looking to get some dancing going on, avrlights is probably what you want (just know that it's kind of janky). On the other hand, if you just want to change the whole ring color, setprop will work, but it's still kinda slow.
Click to expand...
Click to collapse
I like you already.
---------- Post added at 09:56 PM ---------- Previous post was at 09:53 PM ----------
mcsaucy said:
Pro-tip: using setprop is really slow, IIRC. There is a program called avrlights that is used via a shell that allows you to change the ring faster with more granularity. If you're looking to get some dancing going on, avrlights is probably what you want (just know that it's kind of janky). On the other hand, if you just want to change the whole ring color, setprop will work, but it's still kinda slow.
Click to expand...
Click to collapse
Is this in the play store? I can't find it.
animal24 said:
I like you already.
---------- Post added at 09:56 PM ---------- Previous post was at 09:53 PM ----------
Is this in the play store? I can't find it.
Click to expand...
Click to collapse
Happy to help out.
It's not in the Play Store. avrlights is not an Android app. It is a compiled binary that exists on CyanogenMod-enabled Q's.
Here's how it works:
Open the Terminal Emulator app
Type "su -" (without quotes) and press enter
Give Terminal Emulator root access when prompted
Type "avrlights <ARGUMENTS>" (without quotes and see the arguments section below) and press enter again
So, you only need to do steps 1 through 3 when you open up a Terminal Emulator session. After all, once you're at a root shell, you don't need to get a root shell again.
So, let's talk arguments. If you just run "avrlights", it should set your LEDs to the default color (whatever is stored in persist.sys.ringcolor). If you run "avrlights <COLOR>", you change the ring color. If you run "avrlights <COLOR1> <COLOR2> <COLOR3> <COLOR4> <COLOR5> ... <COLOR32>" you can change each LED to a color.
How does this work? Well, first things first. Let's talk about encoding color. Color for a RGB LED on the Q (we have 32 around the ring of the Q) is 24-bit, with 8 bits per channel. This is fairly common. The strength of each channel is represented by a value ranging between 0 and 255 in base 10, or 0x00 and 0xff in hexadecimal, where 0 (0x00) is completely off and 255 (0xff) is full force.
With me so far? You can make a lot of different colors by combining these 3 component colors. I'd recommend Googling for a RGB color wheel and playing around with one of those if you want to get a better grasp.
You can combine these primitive colors using pretty simple math to represent more complex colors. For example, solid yellow would be (r,g,b) -> (255, 255, 0). If you mash these 3 values together using (r * 256 * 256 + g * 256 + b) to get a single number for your color, you can now update your ring with avrlights! It would be really nice if you could just use hexadecimal to update avrlights (that way it's just 0xRRGGBB and you don't need to do math on the fly), which is why I included that feature in my rewrite. In the mean time, you can kind of update with hex. Just do the following: "avrlights $( printf '%d' 0xRRGGBB ) ..." The printf statement converts your hex to base 10 on the fly, making it an acceptable workaround.
TL;DR: open up Terminal Emulator and run `avrlights $( printf '%d' 0xRRGGBB )` where RR, GG, and BB are your component colors in hex. You can specify multiple colors in a single call. To do so, just add them to the list of arguments.
mcsaucy said:
Happy to help out.
It's not in the Play Store. avrlights is not an Android app. It is a compiled binary that exists on CyanogenMod-enabled Q's.
Here's how it works:
Open the Terminal Emulator app
Type "su -" (without quotes) and press enter
Give Terminal Emulator root access when prompted
Type "avrlights <ARGUMENTS>" (without quotes and see the arguments section below) and press enter again
So, you only need to do steps 1 through 3 when you open up a Terminal Emulator session. After all, once you're at a root shell, you don't need to get a root shell again.
So, let's talk arguments. If you just run "avrlights", it should set your LEDs to the default color (whatever is stored in persist.sys.ringcolor). If you run "avrlights <COLOR>", you change the ring color. If you run "avrlights <COLOR1> <COLOR2> <COLOR3> <COLOR4> <COLOR5> ... <COLOR32>" you can change each LED to a color.
How does this work? Well, first things first. Let's talk about encoding color. Color for a RGB LED on the Q (we have 32 around the ring of the Q) is 24-bit, with 8 bits per channel. This is fairly common. The strength of each channel is represented by a value ranging between 0 and 255 in base 10, or 0x00 and 0xff in hexadecimal, where 0 (0x00) is completely off and 255 (0xff) is full force.
With me so far? You can make a lot of different colors by combining these 3 component colors. I'd recommend Googling for a RGB color wheel and playing around with one of those if you want to get a better grasp.
You can combine these primitive colors using pretty simple math to represent more complex colors. For example, solid yellow would be (r,g,b) -> (255, 255, 0). If you mash these 3 values together using (r * 256 * 256 + g * 256 + b) to get a single number for your color, you can now update your ring with avrlights! It would be really nice if you could just use hexadecimal to update avrlights (that way it's just 0xRRGGBB and you don't need to do math on the fly), which is why I included that feature in my rewrite. In the mean time, you can kind of update with hex. Just do the following: "avrlights $( printf '%d' 0xRRGGBB ) ..." The printf statement converts your hex to base 10 on the fly, making it an acceptable workaround.
TL;DR: open up Terminal Emulator and run `avrlights $( printf '%d' 0xRRGGBB )` where RR, GG, and BB are your component colors in hex. You can specify multiple colors in a single call. To do so, just add them to the list of arguments.
Click to expand...
Click to collapse
So to set the mute color we still use setprop i imagine.
animal24 said:
So to set the mute color we still use setprop i imagine.
Click to expand...
Click to collapse
I believe so. There is some weird stuff that can go down due to the use of uninitialized memory, IIRC. Looking at the code, the mute LED looks to be set to the first color you give it.
Code:
color = prepare_leds(colors[0]);
ioctl(fd,AVR_LED_SET_MUTE,&color);

sendevent for input tap x y?

I'm struggling to build up a Tasker routine to automate the USB Audio setup with one screen tap.
To do that I need a method for emulating screen taps (like for "off" and "host" and "close" in the USB Mode Utility, for example). I've already discovered that Eclair lacks the shell command "input tap x y". That would have been the easy route.
I'm not sure about "sendevent" and I'm even less sure about the syntax. Every resource I look at seems written for people who already know the answer. The typical syntax seems to be something like
sendevent /dev/input/event2 x x x
I can see in the root directory that there is a dev folder and in that an input folder. In there are listed 5 things:
21:14 event0
21:14 event1
21:14 event2
21:14 mice
21:14 mouse0
Does anyone know if "sendevent" is a valid shell command in Eclair and, if so, the functions of the events listed above?
Edit: well, I have a partial answer. Running an adb shell getevent I found the following:
event2 = zForce Touchscreen
event1 = gpio-keys [hardware, I assume?)
event0 = TWL4030 Keypad
It said it could not find a driver version for mice or mouse0 because it was not a typewriter (duh).
So it looks like event2 is what I need to deal with. Now if I only understood how. I know I need the screen coordinates where the touch is to be emulated
and I have an app for that.
As much as I love UsbMode, you don't need it.
For a script, you are better off just doing what it does yourself.
Code:
echo host > /sys/devices/platform/musb_hdrc/mode
echo peripheral > /sys/devices/platform/musb_hdrc/mode
echo 0 > /sys/devices/platform/bq24073/force_current
echo 500000 > /sys/devices/platform/bq24073/force_current
Renate NST said:
As much as I love UsbMode, you don't need it.
For a script, you are better off just doing what it does yourself.
Code:
echo host > /sys/devices/platform/musb_hdrc/mode
echo peripheral > /sys/devices/platform/musb_hdrc/mode
echo 0 > /sys/devices/platform/bq24073/force_current
echo 500000 > /sys/devices/platform/bq24073/force_current
Click to expand...
Click to collapse
Wow, and I was so excited because I figured out how to use sendevent w/Tasker to "press" the OFF button in the USB Mode Utility app today!
I really appreciate your response, Renate, so please bear with my lack of Android understanding. I can see that the first line is equivalent to tapping "host" (at least I hope that's what it is...). The the second is how to get back to normal mode.
By extension I am guessing that the third line is equivalent to "off" while the last line is equivalent to "auto". Right so far?
Now the most important question: so is "echo" a shell command I can use? I looked it up and it appears to be, just want to check before I try typing that into Tasker (not that it's half as bad as 8 sendevents to "touch" the screen one time!).
And one last question: is there a similar command equivalent to the "beep" of AudioCTRL (i.e., to kickstart the audio)
Edit: oh, wait, this is it, isn't it: kill -9 19409 [that being the PID of mediaserver on my NST]
Thanks for your help!
Woo-Hoo!!
The shell commands from Renate work great in a simple toggle Task. I just need to work on a few wait times and it's a done deal. One-touch USB Audio!
One question: the command "echo 500000 > /sys/devices/platform/bq24073/force_current" leaves the Max. current setting at 500 mA rather than "Auto". I'm guessing since there is nothing attached to the USB port anyway when you're all done that this is OK?
@nmyshkin
Values are 0, 100000, 500000, 1500000, auto for off, 100mA, 500mA, 1.5A, auto
Renate NST said:
@nmyshkin
Values are 0, 100000, 500000, 1500000, auto for off, 100mA, 500mA, 1.5A, auto
Click to expand...
Click to collapse
Perfect! Thanks so much. I've got a little widget on my homescreen now that does the work behind the scenes! Still struggling with a shortcut that I could customize a little.
I looked at the App Creator for Tasker but see that it requires Android 2.3. I wonder if created apps would therefore be for 2.3 or up? If not, I'd install it on my Nook Tablet running CM 10.2, make an app and export it. That would be cool.
Edit: both completed. Tasker widget here, stand-alone apps here.
Digging up an old thread here, but I'm trying to figure out a way to use an 'input tap' type event for my nook touch. I've got everything set up for a digital picture frame that can dynamically load images but the only slideshow viewer that I found to work doesn't start automatically, it loads on a file location menu first and I need to manually start the slideshow with a button press. Is there an 'input tap' equivalent that will work with the nook?
Figured it out. The adb shell command getevent will return a series of commands when you touch the screen (make sure it is a simple touch and not multiple points). Use these results (converting your numbers from hex to dec) as the command, in my case the correct sequence was:
sendevent /dev/input/event2 3 0 509
sendevent /dev/input/event2 3 1 58
sendevent /dev/input/event2 1 330 1
sendevent /dev/input/event2 0 0 0
sendevent /dev/input/event2 1 330 0
sendevent /dev/input/event2 0 0 0
Obviously it will be different for you, but the general sequence is x coordinate, y coordinate, touch screen, blank, release touch, blank.
And it works (i'm using a series of tasker adb shell commands)!
I don't know which viewer you are using (or even anything about them), but I'll be that it can take a path as data in the actuating Intent.
Then you'd only need something like:
Code:
am start -n com.neatoh.viewer/.Viewer -e Path /MyPhotos
No, these are all hypothetical values.

[BASH SCRIPT] Torch fix for pie GSIs

so, I was googling around a bit, a few days ago, and found out you can control the torch (and other leds) from the command line, or a bash script.
Prerequisites
root (magisk or superSU)
FX file manager or Termux
Text editor
Instructions
Create a file in a directory of your choice with a '.sh' extension
Add the following code to the file:
Code:
su -c 'echo 255 > /sys/class/leds/torch/brightness'
Run the shell script in termux (cd to the directory and run it) or run it using FX, it will ask for root access if you haven't already granted it
Your torch is now on!
To turn it off create another file with
Code:
su -c 'echo 0 > /sys/class/leds/torch/brightness'
in it
Tested on an Honor 9 and P10+
If you have dual tone flash, yo may find different values cause either led to come on, for me, '255' is the yellow flash and '1' is the white flash
For a bit more messing around, cd to the '/sys/class/leds' directory, you will see a few more directories for other LEDs on your device, controlling them is exactly the same as the torch!
Works for me, thanks a bunch dude
EDIT: on honor 7x/Huawei mate se
Thank you so much for this but I found in my own experience, and from comments I saw where this has been shared, that a bash script perhaps wasn't the most effective to have to run each time so I thought of implementing this to Tasker, create a "pseudo toggle" and allocate it to a quick setting tile. The algorithm is:
Code:
If flashlightStatus = TRUE then
Run shell command: su -c 'echo 0 /sys/class/leds/torch/brightness'
Set variable flashlightStatus to FALSE
Else
Run shell command: su -c 'echo 3 /sys/class/leds/torch/brightness'
Set variable flashlightStatus to TRUE
End If
I set it up this way because if you've never set the variable before (or if it clears on reboot or something) then it won't equal true and would still enable. Also, when I set the brightness to 255 the torch had a slight yellow tint so upon further reading, despite that 255 should be full brightness, apparently max brightness is 3 and is a white light (this seems to disable automatically after around 750ms however). Hope this will help those who are still without a torch on treble GSIs.
P.S. I also set up a quick profile that if the flashlight status variable = true then to wait 750ms and check if still true then change to false and turn off the torch; this would reset to compensate for the OS turning the torch off automatically but Tasker still thinking it was on. I'm not sure how necessary this is or whether it's overkill or not.
beejkitsune said:
Thank you so much for this but I found in my own experience, and from comments I saw where this has been shared, that a bash script perhaps wasn't the most effective to have to run each time so I thought of implementing this to Tasker, create a "pseudo toggle" and allocate it to a quick setting tile. The algorithm is:
Code:
If flashlightStatus = TRUE then
Run shell command: su -c 'echo 0 /sys/class/leds/torch/brightness'
Set variable flashlightStatus to FALSE
Else
Run shell command: su -c 'echo 3 /sys/class/leds/torch/brightness'
Set variable flashlightStatus to TRUE
End If
I set it up this way because if you've never set the variable before (or if it clears on reboot or something) then it won't equal true and would still enable. Also, when I set the brightness to 255 the torch had a slight yellow tint so upon further reading, despite that 255 should be full brightness, apparently max brightness is 3 and is a white light (this seems to disable automatically after around 750ms however). Hope this will help those who are still without a torch on treble GSIs.
P.S. I also set up a quick profile that if the flashlight status variable = true then to wait 750ms and check if still true then change to false and turn off the torch; this would reset to compensate for the OS turning the torch off automatically but Tasker still thinking it was on. I'm not sure how necessary this is or whether it's overkill or not.
Click to expand...
Click to collapse
mind if i improve this?
Code:
su -c 'if grep -q 1 /sys/class/leds/torch/brightness; then echo 0 > /sys/class/leds/torch/brightness; else echo 1 > /sys/class/leds/torch/brightness; fi'
-- obviously you can change the 1 to whatever you want
that is the code i'm using, prevents the use of an unnecessary variable, so is faster, and will use less resources, plus its pretty much fail safe, since it reads the current state of the torch to determine if its on or off, so if something else sets it to a state it still works, if something else set you variable externally then the torch becomes messed up until a reboot.
plus, im assuming that variable is a tasker thing? not everyone will use tasker, so eliminating the variable all together makes it work on any app that can add custom quick settings tiles
ambitiousButRubbish said:
mind if i improve this?
Code:
su -c 'if grep -q 1 /sys/class/leds/torch/brightness; then echo 0 > /sys/class/leds/torch/brightness; else echo 1 > /sys/class/leds/torch/brightness; fi'
-- obviously you can change the 1 to whatever you want
that is the code i'm using, prevents the use of an unnecessary variable, so is faster, and will use less resources, plus its pretty much fail safe, since it reads the current state of the torch to determine if its on or off, so if something else sets it to a state it still works, if something else set you variable externally then the torch becomes messed up until a reboot.
plus, im assuming that variable is a tasker thing? not everyone will use tasker, so eliminating the variable all together makes it work on any app that can add custom quick settings tiles
Click to expand...
Click to collapse
Yes, the variable is a Tasker thing so I'm glad there is a solution that wouldn't rely on it. Thanks for the upgrade and I've already switched out my Tasker profile for this. Doesn't seem any quicker or anything but more simple!

Categories

Resources