Help automating immersive mode - Samsung Galaxy S8 Questions and Answers

Hey, I'm trying to automate fullscreen immersive mode for some apps. And can't find a way to set this up using either tasker or automate. Any tips are appreciated.

domsch1988 said:
Hey, I'm trying to automate fullscreen immersive mode for some apps. And can't find a way to set this up using either tasker or automate. Any tips are appreciated.
Click to expand...
Click to collapse
Pretty simple with Tasker. Here's the profile description if you want too did it yourself, or import the attached profile and modify for the aod you want.
Profile: Immersive (601)
Application: Maps, Disney Junior, Netflix...
Enter: Full Immersive (602)
A1: Run Shell [ Command:su
settings put global policy_control immersive.full=* Timeout (Seconds):0 Use Rootff Store Output In: Store Errors In: Store Result In: ]
Exit: End Immersive (603)
A1: Run Shell [ Command:su
settings put global policy_control null* Timeout (Seconds):0 Use Rootff Store Output In: Store Errors In: Store Result In: ]
https://www.dropbox.com/s/x6yq7h3k4seucdo/Immersive.prf.xml?dl=0
Sent from my SM-G955F using Tapatalk

This is not working for me.
The command runs but nothing happens - any idea as to why?

Related

[Q] Delay for screen wake when receiving a call

Do you guys also have this issue with the screen taking 2-3sec to wake up after the phone stats ringing on incoming calls? Or is it only me? Do you guys have a fix? Or is it because I have exdialer installed?
I find there is a delay with it sadly
Sent from my LG-D802 using xda app-developers app
DialerEx was probably the cause. Uninstalled relieved partially the issue
I had this problem but i think having Go power manager lower my cpu caused it. I turned that off and it seems like i don't have the delay anymore
It depends greatly on your governor and CPU hotplug - I am using Ondemandplus with a 1 Ghz screen off frequency and Intelli hotplug. I get about 2-3 seconds of delay from when my phone vibrates to when the screen comes on (I use a QuickWindow case), but I was surprised today to find the screen instantly on when receiving a call.
Anyone find a fix for this yet?
*WARNING: Do not manually set your screen off frequency lower than 1Ghz. This will cause screen wake on call issues*
I get near instant screen wake on call with this and anyone is welcome to test it out.
Added the xml as an attachment that you can just extract and import directly into tasker!
Requirements are:
-Must be rooted
-Tasker app
-Secure settings app
Profile: Force Screen On Call (46)
State: Display State [ Isff ]
State: Call [ Type:Incoming Number:* ]
Enter: Anon (47)
A1: Secure Settings [ Configuration:Screen & Keyboard Lights On
1 Second Package:com.intangibleobject.securesettings.plugin Name:Secure Settings Timeout (Seconds):0 ]
Nice work
This does the trick,but it has a slight bug. My lockscreen wallpaper appears before the contact who is calling. Is this normal ?
demoncamber said:
*WARNING: Do not manually set your screen off frequency lower than 1Ghz. This will cause screen wake on call issues*
I get near instant screen wake on call with this and anyone is welcome to test it out.
Added the xml as an attachment that you can just extract and import directly into tasker!
Requirements are:
-Must be rooted
-Tasker app
-Secure settings app
Profile: Force Screen On Call (46)
State: Display State [ Isff ]
State: Call [ Type:Incoming Number:* ]
Enter: Anon (47)
A1: Secure Settings [ Configuration:Screen & Keyboard Lights On
1 Second Package:com.intangibleobject.securesettings.plugin Name:Secure Settings Timeout (Seconds):0 ]
Click to expand...
Click to collapse
I couldn't get that to stop, I think the screen is turning on before the call screen even gets initiated. I'll let you know if I find a way around it.
Sent from my LG-D801
demoncamber said:
I couldn't get that to stop, I think the screen is turning on before the call screen even gets initiated. I'll let you know if I find a way around it.
Sent from my LG-D801
Click to expand...
Click to collapse
That would be really cool thanks
demoncamber said:
I couldn't get that to stop, I think the screen is turning on before the call screen even gets initiated. I'll let you know if I find a way around it.
Sent from my LG-D801
Click to expand...
Click to collapse
Did you manage to solve something with the wallpaper appearing before caller? Really annoying, and it's almost perfect [emoji12]
metalboy94 said:
It depends greatly on your governor and CPU hotplug - I am using Ondemandplus with a 1 Ghz screen off frequency and Intelli hotplug. I get about 2-3 seconds of delay from when my phone vibrates to when the screen comes on (I use a QuickWindow case), but I was surprised today to find the screen instantly on when receiving a call.
Click to expand...
Click to collapse
Awesome
I actually have a bit of a better more optimized profile now. Attachment XML incoming. What this actually does is allows you to set as low as you want screen off cpu frequency in the first part, and then when the phone rings it will boost the cpu to max set frequency, or anything you want to set it to manually above 1GHz will work.
First things first, download the attachment, then first import the 3 files ending in tsk.xml into tasker, they should show up in your tasks section, then import the one ending in prf.xml
Then you can set whatever frequencies you want for your screen off max freq in "display off cpu" task in tasker, this can be basically anything. Then you can open the "Wake_On_Ring" task and set that max freq to anything ABOVE 1000mhz. I have it default set at 1.9GHz and it works almost instantly for me on call. But it's up to you. After that, everything is good to go.
Here's what it looks like:
Profile: Display Off Wake On Ring (27)
State: Display State [ Is off ]
Enter: Display Off Ring Manager (52)
A1: Perform Task [ Name display Off Cpu Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop off ] If [ %PHONEWASRINGING eq OFF ]
A2: Perform Task [ Name:Wake On Ring Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop off ] If [ %PHONEWASRINGING eq ON ]
Can't wait to give it a try, I will give you feedback regarding this soon
demoncamber said:
I actually have a bit of a better more optimized profile now. Attachment XML incoming. What this actually does is allows you to set as low as you want screen off cpu frequency in the first part, and then when the phone rings it will boost the cpu to max set frequency, or anything you want to set it to manually above 1GHz will work.
First things first, download the attachment, then first import the 3 files ending in tsk.xml into tasker, they should show up in your tasks section, then import the one ending in prf.xml
Then you can set whatever frequencies you want for your screen off max freq in "display off cpu" task in tasker, this can be basically anything. Then you can open the "Wake_On_Ring" task and set that max freq to anything ABOVE 1000mhz. I have it default set at 1.9GHz and it works almost instantly for me on call. But it's up to you. After that, everything is good to go.
Here's what it looks like:
Profile: Display Off Wake On Ring (27)
State: Display State [ Is off ]
Enter: Display Off Ring Manager (52)
A1: Perform Task [ Name display Off Cpu Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop off ] If [ %PHONEWASRINGING eq OFF ]
A2: Perform Task [ Name:Wake On Ring Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop off ] If [ %PHONEWASRINGING eq ON ]
Click to expand...
Click to collapse
I tried it and it does work better. The wallpaper doesn't show any more before call. Great job, thanks
Unfortunately, there is no difference for me. I still get a 2-3 seconds delay each incoming call
nfl mobile app not working on cloudy rom g3/verizion lg g2
My nfl mobile app is not working on cloudy rom g3. I have the lg g2 verizon. Please help fix it
Try a different rom... I've had great success with the G3 ported roms... No wake up lag on either one of these

Z1C and Tasker automation

Thought I would create a thread to discuss Tasker automation on the Z1C (help requests, troubleshooting, automation ideas, etc.)
First a help request:
Has anyone been successful in getting AutoInput or Sendevent shell commands (double taps, swipes) to work on the Z1C?
I've used this script in the past to record events and replicate them to create macros using Tasker shell, but the Z1C input devices (touchscreen, buttons) don't seem to be allowing capture using getevent:
http://forum.xda-developers.com/showthread.php?t=2233865
wernyuen said:
Thought I would create a thread to discuss Tasker automation on the Z1C (help requests, troubleshooting, automation ideas, etc.)
First a help request:
Has anyone been successful in getting AutoInput or Sendevent shell commands (double taps, swipes) to work on the Z1C?
I've used this script in the past to record events and replicate them to create macros using Tasker shell, but the Z1C input devices (touchscreen, buttons) don't seem to be allowing capture using getevent:
http://forum.xda-developers.com/showthread.php?t=2233865
Click to expand...
Click to collapse
Edit: always execute as root!!!!
task Swipe:
Script
execute Shell
input swipe x1 y1 x2 y2 speed
like:
input swipe 310 870 310 320 200
keyevents:
http://developer.android.com/reference/android/view/KeyEvent.html
like
power on/off
input keyevent 26 or
input keyevent KEYCODE_POWER
pause between actions:
sleep 1
sleep 2 etc.
tap:
input tap x y
start app:
am start -n app.name.name/ManifestActivity
close app:
am force-stop app.name.name
complete action screen on, unlock, start spotify, autoplay, screen off
am start -n com.spotify.music/.MainActivity;
sleep 2;
input keyevent 26;
sleep 1;
input swipe 310 870 310 320 200;
sleep 1;
input keyevent 126;
sleep 1;
input keyevent 26;
i hope it help
Maetz3 said:
Edit: always execute as root!!!!
task Swipe:
Script
execute Shell
input swipe x1 y1 x2 y2 speed
like:
input swipe 310 870 310 320 200
keyevents:
http://developer.android.com/reference/android/view/KeyEvent.html
like
power on/off
input keyevent 26 or
input keyevent KEYCODE_POWER
pause between actions:
sleep 1
sleep 2 etc.
tap:
input tap x y
start app:
am start -n app.name.name/ManifestActivity
close app:
am force-stop app.name.name
complete action screen on, unlock, start spotify, autoplay, screen off
am start -n com.spotify.music/.MainActivity;
sleep 2;
input keyevent 26;
sleep 1;
input swipe 310 870 310 320 200;
sleep 1;
input keyevent 126;
sleep 1;
input keyevent 26;
i hope it help
Click to expand...
Click to collapse
thanks! very helpful.
what about multi-touch or pinch-to-zoom? have not been able to find solutions that have bridged that online
double tap also seems to be a challenge for the Z1C, somehow even without sleep in between two "input taps" it is still too slow to be recognized as a double tap
wernyuen said:
thanks! very helpful.
what about multi-touch or pinch-to-zoom? have not been able to find solutions that have bridged that online
double tap also seems to be a challenge for the Z1C, somehow even without sleep in between two "input taps" it is still too slow to be recognized as a double tap
Click to expand...
Click to collapse
i dont know but i think you need something like nova launcher
i think you can combine this controls in tasker
for zoom you can use:
KEYCODE_ZOOM_IN (input keyevent 168)
KEYCODE_ZOOM_OUT (input keyevent 169)
Maetz3 said:
i dont know but i think you need something like nova launcher
i think you can combine this controls in tasker
for zoom you can use:
KEYCODE_ZOOM_IN (input keyevent 168)
KEYCODE_ZOOM_OUT (input keyevent 169)
Click to expand...
Click to collapse
Thanks ... tried the ZOOM_IN/OUT keyevents, but I think that is for the camera, I'm trying to implement this on Google Maps and Maps Engine, since they removed the Zoom and Scaling buttons on the official Google apps it's been a pain (and driving hazard) to manually zoom in and out with touchscreen input. (trying to map the zoom actions to my media controls on the steering wheel)
Hi all,
Let me start with an apology as I am not sure that I am in the right thread here, however tasker automation does seem to have alot of threads - I am confident that someone who knows more than me might be able to answer my questions/problems.
I am currently trying to automate a search in youtube using autovoice and autoinput. Via voice command so far I can get autoinput to launch youtube, and click the search bar, however I cant get it to input any text into the search bar! - So I really need to know, how to get autoinput to input variable text and search for it within youtube, not even sure which function of autoinput it would be to be honest.
Still learning.
Any help you can give would be fantastic,
Cheers
Dan
If what you want to achieve is to search YouTube, there are easier ways:
1. Simply ask Google Now to search or YouTube using the "watch" or "listen" command; or
2. Use an intent in Tasker to activate YouTube search with the search term %avcommnofilter (rather than try to use autoinput)
If you really must use autoinput, you can use the UI query action to find the right variable name for the search box, then use the 'autoinput action' action to paste your search term (%avcommnofilter) into the search box
dan34321 said:
Hi all,
Let me start with an apology as I am not sure that I am in the right thread here, however tasker automation does seem to have alot of threads - I am confident that someone who knows more than me might be able to answer my questions/problems.
I am currently trying to automate a search in youtube using autovoice and autoinput. Via voice command so far I can get autoinput to launch youtube, and click the search bar, however I cant get it to input any text into the search bar! - So I really need to know, how to get autoinput to input variable text and search for it within youtube, not even sure which function of autoinput it would be to be honest.
Still learning.
Any help you can give would be fantastic,
Cheers
Dan
Click to expand...
Click to collapse
I have a slightly different question how to make a script turning stamina mode on and off? It would be usefull because stamina sometimes prevents alarm apps from ringing in time.

Increasing torch power with root

Does anyone know how to increase the torch power? Like z1-z2-z3 years ago?
DELETED - misread
Kianush said:
I havent heard of that and touch sensitivity is really good but I think you can increase it b enabling glove mode.
Click to expand...
Click to collapse
toRch not toUch :laugh:
gabed90 said:
Does anyone know how to increase the torch power? Like z1-z2-z3 years ago?
Click to expand...
Click to collapse
I haven't figured out how to increase the stock torch brightness the same way I could on the Z3c, but I found an okay workaround to override it temporarily. On the stock MM ROM I'm running, the brightness is controlled by two files: "/sys/class/leds/led:torch_0/brightness" and "/sys/class/leds/led:torch_1/brightness". You can edit these to any number (don't burn out your led....I haven't tried anything above 1000), then toggle on the torch by changing "/sys/class/leds/led:switch/brightness" to "1". The torch can then be turned off by changing "/sys/class/leds/led:switch/brightness" to "0". The stock flashlight brightness is "12", which is really dim, but "90" has been a good brightness for me so far.
I wrote a script (attached) which toggles the torch on and off with a "90" brightness. It has to be run with su (root).
Code:
#!/system/bin/sh
toggle=$(cat /sys/class/leds/led:switch/brightness)
if [ "$toggle" = "0" ];then
echo 90 > /sys/class/leds/led:torch_0/brightness
echo 90 > /sys/class/leds/led:torch_1/brightness
echo 1 > /sys/class/leds/led:switch/brightness
echo "on"
else
echo 0 > /sys/class/leds/led:torch_0/brightness
echo 0 > /sys/class/leds/led:torch_1/brightness
echo 0 > /sys/class/leds/led:switch/brightness
echo "off"
fi
Also I used Script Manager to set up a home screen widget to run this script, so I have a "bright torch" toggle on my home screen. Maybe someone could make this into an app so this solution wouldn't be quite as clunky.
Hi! Does it work? How can I install it?
I tried to do the widget, but when I start it , Permission denied appears.
I have rooted device, and I gave SM manager root permissions...
mains75 said:
I tried to do the widget, but when I start it , Permission denied appears.
I have rooted device, and I gave SM manager root permissions...
Click to expand...
Click to collapse
Do you have the "Su" toggle turned on for that script in SM Manager? It's in the top bar when you setup the script.
Yes I have..
After some attempts It worked... Thankyou
I wonder why if I edit the 2 files manually, system resets their value after you turn on the torch with other apps...
dog77k said:
I wrote a script (attached) which toggles the torch on and off with a "90" brightness. It has to be run with su (root).
Code:
#!/system/bin/sh
toggle=$(cat /sys/class/leds/led:switch/brightness)
if [ "$toggle" = "0" ];then
echo 90 > /sys/class/leds/led:torch_0/brightness
echo 90 > /sys/class/leds/led:torch_1/brightness
echo 1 > /sys/class/leds/led:switch/brightness
echo "on"
else
echo 0 > /sys/class/leds/led:torch_0/brightness
echo 0 > /sys/class/leds/led:torch_1/brightness
echo 0 > /sys/class/leds/led:switch/brightness
echo "off"
fi
Also I used Script Manager to set up a home screen widget to run this script, so I have a "bright torch" toggle on my home screen. Maybe someone could make this into an app so this solution wouldn't be quite as clunky.
Click to expand...
Click to collapse
Thank you - your script works well!
A minor issue is that when you run the script thru the widget shortcut, it pulls open the Script Manager app. Do you know any way to avoid this? Maybe an additional line in the script that kills the current app?
Thanks again.
Longhorn Android said:
Thank you - your script works well!
A minor issue is that when you run the script thru the widget shortcut, it pulls open the Script Manager app. Do you know any way to avoid this? Maybe an additional line in the script that kills the current app?
Thanks again.
Click to expand...
Click to collapse
Good idea. Add this line to end of the script and it will close Script Manager.
Code:
killall os.tools.scriptmanager
dog77k said:
Good idea. Add this line to end of the script and it will close Script Manager.
Code:
killall os.tools.scriptmanager
Click to expand...
Click to collapse
Thanks - that works perfectly.
xz1 compact
I tried to run this script on Sony XZ1 compact, but when running ScriptManager writes "No such file or directory". What am I doing wrong? ROOT mean. The path on the system and similar files exist. I turn on the SU button at startup. Help please.
dog77k said:
I haven't figured out how to increase the stock torch brightness the same way I could on the Z3c, but I found an okay workaround to override it temporarily. On the stock MM ROM I'm running, the brightness is controlled by two files: "/sys/class/leds/led:torch_0/brightness" and "/sys/class/leds/led:torch_1/brightness". You can edit these to any number (don't burn out your led....I haven't tried anything above 1000), then toggle on the torch by changing "/sys/class/leds/led:switch/brightness" to "1". The torch can then be turned off by changing "/sys/class/leds/led:switch/brightness" to "0". The stock flashlight brightness is "12", which is really dim, but "90" has been a good brightness for me so far.
I wrote a script (attached) which toggles the torch on and off with a "90" brightness. It has to be run with su (root).
Code:
#!/system/bin/sh
toggle=$(cat /sys/class/leds/led:switch/brightness)
if [ "$toggle" = "0" ];then
echo 90 > /sys/class/leds/led:torch_0/brightness
echo 90 > /sys/class/leds/led:torch_1/brightness
echo 1 > /sys/class/leds/led:switch/brightness
echo "on"
else
echo 0 > /sys/class/leds/led:torch_0/brightness
echo 0 > /sys/class/leds/led:torch_1/brightness
echo 0 > /sys/class/leds/led:switch/brightness
echo "off"
fi
Also I used Script Manager to set up a home screen widget to run this script, so I have a "bright torch" toggle on my home screen. Maybe someone could make this into an app so this solution wouldn't be quite as clunky.
Click to expand...
Click to collapse
Thanks for the guide, now I successfully edited my config, and I can use godly torch app to control light intensity.
Meh, get this little bugger.
Far brighter than any smartphone with easy charging. I wuv my copy
MicroStream® USB | Rechargeable LED Pocket Flashlight | Streamlight®
#!/system/bin/sh
toggle=$(cat /sys/class/leds/led:switch_0/brightness)
if [ "$toggle" = "0" ];then
echo 90 > /sys/class/leds/led:torch_0/brightness
echo 90 > /sys/class/leds/led:torch_1/brightness
echo 1 > /sys/class/leds/led:switch_0/brightness
echo "on"
else
echo 0 > /sys/class/leds/led:torch_0/brightness
echo 0 > /sys/class/leds/led:torch_1/brightness
echo 0 > /sys/class/leds/led:switch_0/brightness
echo "off"
fi
Click to expand...
Click to collapse
i edit name folder switch to worck for xz3 i tested for me is worck good and plzz i need mehtod before edit in rom like defaut
Meh... bear in mind the led current was sinked at that level for a reason.
Although it goes much higher with the camera, it's only briefly.
Running it full time like that may exceed it's heat sinking capabilities and prematurely burn it out.
Everything happens for a reason... and it probably wasn't to keep you in the dark
plz i need methode for edit firmware or system for adjust torch
script worck for me for xperia xz3 by change switch to switch_0 and i need methode for set auto by sysytem

[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!

Useful Tasker script for rooted head units

Device needs to be rooted!
This does not work with apps from the supplier as radio, phone, player, video etc. These are nearly all included in the com.car.ui and I did not yet find a way to get them "catched".... may be there is another way... Would be nice if someone could point it to me.
Target of this script with Tasker:
I just wanted to reduce touch screen using while driving.
To start may be a player with a click on a button is one thing, but I may don´t want to stay in this app.
In this case I need to click the Home button and choose another app. On a head unit without hardware buttons sometimes hard to get the home button clicked.
But If I need to play around with the settings of the app, I don´t want to get rejected to the home screen during changing the app settings....
So the target was to create a task which:
Moves the app to background after a short time
To not move the app to background while touching the screen
To move the app to background if there is no touch within a predefined time.
I found a way to get back to the home screen if I opened a player (in this case DAB-Z from realzoulou) by using shell commands.
Example:
Code:
DAB_RETURN (3)
A1: Variable Clear [ Name:%Touch Pattern Matching:eek:ff Local Variables Only:eek:ff ]
A2: Wait [ MS:100 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A3: Variable Clear [ Name:%Dab Pattern Matching:eek:ff Local Variables Only:eek:ff ]
A4: Wait [ MS:0 Seconds:5 Minutes:0 Hours:0 Days:0 ]
A5: Run Shell [ Command:cat /proc/$(pidof -s com.zoulou.dab)/oom_adj Timeout (Seconds):0 Use Root:eek:n Store Output In:%Dab Store Errors In:%Dab_false Store Result In: Continue Task After Error:eek:n ]
A6: Wait [ MS:100 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A7: Run Shell [ Command:getevent -c 1 /dev/input/event1 Timeout (Seconds):5 Use Root:eek:n Store Output In:%Touch Store Errors In:%Touch_false Store Result In: Continue Task After Error:eek:n ]
A8: If [ %Touch Set ]
A9: Goto [ Type:Action Number Number:1 Label: ]
A10: Else
A11: Run Shell [ Command:cat /proc/$(pidof -s com.zoulou.dab)/oom_adj Timeout (Seconds):0 Use Root:eek:n Store Output In:%Dab Store Errors In:%Dab_false Store Result In: Continue Task After Error:eek:n ]
A12: Wait [ MS:100 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A13: If [ %Dab !~ 3 ]
A14: Go Home [ Page:1 ]
A15: Else
A16: End If
A17: End If
To use it for other apps you need to find the package name by using the shell:
Open ADB on your PC, connect to your Android in the same WiFi by:
adb connect [IP-Addresse]
adb shell
top (this command does not stop. You need to press "q" on your keyboard to stop it)
The output shows all running apps on your device. You need to search for the app name you want to use with this script.
Code:
cat /proc/$(pidof -s [app-name])/oom_adj
For DAB-Z it is:
Code:
cat /proc/$(pidof -s com.zoulou.dab)/oom_adj
This command returns the status of DAB-Z:
1 = App in foreground
0= App not running, or in background
Other apps can show different states. You need to find the status by using your PC for each app you want to get managed by this task.
The shell command:
Code:
getevent -c 1 /dev/input/event1
fetches touch events on the screen....
and waits in my script 5 sec, stores a touch in %Dab and keeps it empty if there was no touch on the screen.
If you touch it, the variable will be filled with a "0" (zero), otherwise the shell throws an exception which is the trigger to go back to the home screen.
Have fun with it.

Categories

Resources