run shell: input tap not working anymore? - Tasker Tips & Tricks

Hey everyone,
Since updating to Marshmallow, I seem to have lost the functionality of
Code:
run shell input tap
Anyone else have this issue (and hopefully a solution?)
ps: I checked the "use root" box

supermooshman said:
Hey everyone,
Since updating to Marshmallow, I seem to have lost the functionality of
Code:
run shell input tap
Anyone else have this issue (and hopefully a solution?)
ps: I checked the "use root" box
Click to expand...
Click to collapse
Add this line above your input tap, so the whole script is:
su -cn u:r:system_app:s0
input tap 1425 1350
Edit: requires busybox to be correctly installed, I believe.
Sent from my SM-G928F using Tapatalk

RuggedHunter said:
Add this line above your input tap, so the whole script is:
su -cn u:r:system_app:s0
input tap 1425 1350
Edit: requires busybox to be correctly installed, I believe.
Sent from my SM-G928F using Tapatalk
Click to expand...
Click to collapse
My setup is
A3: Launch App [ App:Location Data: Exclude From Recent Apps: off ]
A4: Run Shell [ Command:input tap 1300 447 Timeout (Seconds):1 Use Root: on
A5: Run Shell [ Command:input tap 650 705 Timeout (Seconds):1 Use Root: on
A6: Run Shell [ Command:input tap 570 830 Timeout (Seconds):1 Use Root: on
all works except the A6 . cant seems to make it work, what I am doing wrong

Try adding a wait command between the taps. Something like 300ms should suffice.
Sent from my HTC One using Tapatalk

RuggedHunter said:
Add this line above your input tap, so the whole script is:
su -cn u:r:system_app:s0
input tap 1425 1350
Click to expand...
Click to collapse
I don't know what that first line means but it does the trick beautifully.
Thanks

That crazy su -cn u:r:system worked for me too! hot dog! THANKS!

Related

External Bluetooth Keyboard Mapping with HTC Vivid

Hello,
I didn't know if there was already a post for this, my searches were coming up not matching anything.
If you happen to have an external keyboard (bluetooth in my case), you might have the problem that many of the key events from the keyboard do not map nicely to the HTC Vivid. I am running 4.0.3 in my case with 3.6 sense, and other than the alpha-numerics, many of the system level keys were not working for me. Since I often play HD video from my phone to the HDTV, it's handy for me to control things like Volume_UP/Down, HOME / MENU / BACK, Pause / Play, Select Movie title, reply to Text, etc. So I had to find a way to improve the keyboard mappings to make it functional, and I was curious if others may have done similar things as what I describe here. I am still stuck on a few mappings, so would glad to have any info from others who have succeeded or failed in a similar regard.
I went and spent about $35 for this G-Cube bluetooth keyboard model BK-30 at Frye's.
h t t p :// www .gggcube .com/ Upload/ ProImgs/ smaImg/ 201303101915016774.jpg
It was a nice weight with a good feel on the keys, and good enough for a test run. The bluetooth device was discovered and paired easily on my HTC Vivid, and some of the system functions from keyboard were working, like Volume UP/Down and Mute. But I noticed right away I had no way to open a MENU option, or to perform a BACK function from a given application or settings screen. In order to change the keyboard mappings, it's necessary to boot into Recovery, un-mount /system and use ADB to re-mount /system in order to be able to edit the file called Generic.kl (keyboard layout file) which lives in the /system/usr/keylayout/ directory. Here are the steps I used to update the file.
Before editing the Generic.kl file, it's helpful to gather some information using an APP called KeyEvent Display (free in Google Play store).
1. Download, Install and Run the KeyEvent Display application, it gives you a keyEvent monitor for the Bluetooth Keyboard
2. Pick a few keys on the Bluetooth which seem to do nothing, and press them, noting their SCANCODE values in the app. I chose the PrintScr, Pause/Break, Insert and Delete keys, just as a test. These 4 keys gave me scancodes of 99, 119, 110, and 111, respectively.
Now, you can reboot the phone into Recovery, and perform operations using ADB, providing your PC has the right USB drivers. Usually installing HTC Sync will give you these drivers, or from Ubuntu Linux, you may not need them. Google to install the ADB tool
1. Make sure your Vivid is rooted with a Recovery Image for bootup
2. Boot into Recovery, Connect your USB cable from the PC, and test that your ADB tool can properly communicate:
a) to use ADB, you need to have download these files (adb.exe, AdbWinApi.dll and AdbWinUsbApi.dll)
b) from the directory where you have ADB, test the connection with a simple 'adb devices'
c) you should get a response from the phone device like this:
[C:\Users\JohnDoe\ADB_Tool] adb devices
adb server is out of date. killing...
* daemon started successfully *
List of devices attached
FA27VVJ01452 device
Click to expand...
Click to collapse
3. Assuming you are successful, you can now send ADB commands to the phone as needed here below. (If you got nothing after List of devices attached, you can research this seperately - its usually and USB driver issue.) ADB commands are used to mount and unmount file systems (like /system), to send commands or open a shell to the phone, and to push and pull files back and forth.
a) adb remount (should see: remount succeeded)
NOTE: if this fails with an error, use your Recovery Developer options to un-mount /system first, then try again.
b) adb pull /system/usr/keylayout/Generic.kl
NOTE: Generic.kl is the file we want with all the mappings of keyEvents. If the file is pulled successfully, you see something like:
pull /system/usr/keylayout/Generic.kl
982 KB/s (9058 bytes in 0.009s)
Click to expand...
Click to collapse
c) Note with File Explorer in the folder with ADB, you should have a copy of the Generic.kl file.
d) Make a backup of this file, you can cause the keyboard and other items to fail with incorrect changes!
e) Edit the file with your favorite text editor, and look for sections that we want to change, for example:
key 109 PAGE_DOWN
key 110 INSERT
key 111 FORWARD_DEL
# key 112 "KEY_MACRO"
key 113 VOLUME_MUTE
key 114 VOLUME_DOWN
key 115 VOLUME_UP
key 116 POWER WAKE
Click to expand...
Click to collapse
f) Change keys 110 and 111 (for example) to now look like this, and then save the file:
key 109 PAGE_DOWN
key 110 BACK
key 111 MENU
# key 112 "KEY_MACRO"
Click to expand...
Click to collapse
g) adb push Generic.kl /system/usr/keylayout/ (this places the file back to the phone)
h) adb shell (need a shell to reset the permissions of the file)
i) chmod 644 /system/usr/keylayout/Generic.kl (should be read only to group/world)
j) ls -l /system/usr/keylayout/ (check to see ownership and permissions look correct)
ls -l /system/usr/keylayout/
-rw-r--r-- 1 root root 894 Jul 12 2012 AVRCP.kl
-rw-r--r-- 1 root root 9048 Nov 12 20:59 Generic.kl
-rw-r--r-- 1 root root 1293 Jul 12 2012 Vendor_045e_Product_028e.kl
-rw-r--r-- 1 root root 1027 Jul 12 2012 Vendor_046d_Product_c216.kl
Click to expand...
Click to collapse
k) exit (exit from the ADB shell)
l) adb reboot (reboot the phone out of recovery into normal mode)
3. Now when the phone is ready, test the new key functions you have defined. For me, I had success with the MENU, BACK, CALL and ENVELOPE functions, among others. It is very helpful that I can use ALT-TAB to toggle between running apps.
The main one which I am failing to define is the 'OPEN ALL APPS'. If anyone else is performing mappings such as these for an external bluetooth keyboard, I would be interested to know which functions you have gotten to work. I am now at a state where I can control most everything, provided it is already running in the background. But I can't swipe my Sense desktop left and right, and I have trouble toggling certain switches like Wifi and Mobile data. Any suggestions or thoughts on these functions are appreciated.
Darren
Troubleshooting TIP: You can also run ADB when the phone is running in Normal Mode and you have the USB cable connected from your phoe to the PC. Then you can test certain keypresses through functions that are formatted in this way:
adb shell input keyevent 5
Click to expand...
Click to collapse
On my phone, this function will send the CALL event with brings up the phone from the desktop.
Other examples (you can also launch then from a *.cmd file):
If you have a terminal open on the phone, will send "ls -l"(includes the space-62 and enter-66):
@echo off
adb shell input keyevent 40
adb shell input keyevent 47
adb shell input keyevent 62
adb shell input keyevent 69
adb shell input keyevent 40
adb shell input keyevent 66
Click to expand...
Click to collapse
If you have a terminal open on the phone, will send "env|grep PATH":
@echo off
adb shell input text "env"
adb shell input text "|"
adb shell input text "grep"
adb shell input keyevent 62
adb shell input text "PATH"
adb shell input keyevent 66
Click to expand...
Click to collapse

[HOW TO] Integrate Tasker with Allo (requires root)

I woud like to share the task I created to send commands to Allo.
The concept is very simple.
1) Insert a record on Allo's database and call the app to trigger the query.
2) Set a profile that get the notification and read the answer directly from the database.
3) Use the result to do anything you want: TTS, set a widget (Zooper, Minimalistic, etc)
It requires ROOT and Sqlite binary installed to read the database. In this case, I'm using sqlite's binary that comes with Titanium Backup (/data/data/com.keramidas.TitaniumBackup/files/sqlite3)
Before you run this task you need to set %sqlite variable with sqlite full path, also you will need enable the accessibility settings to Tasker in order to intercept the system notifications.
This task has to be called with the command as a parameter, or you can edit %text variable with your command directly
Code:
Allo - Send (152)
A1: Stop [ With Error:eek:ff Task: ] If [ %par1 !Set ]
A2: Variable Set [ Name:%text To:%par1 Do Maths:eek:ff Append:eek:ff ]
<Set SQLITE path>
A3: Variable Set [ Name:%sqlite To:/data/data/com.keramidas.TitaniumBackup/files/sqlite3 Do Maths:eek:ff Append:eek:ff ]
<Insert command into Allo database table>
A4: Run Shell [ Command:%sqlite /data/data/com.google.android.apps.fireball/databases/fireball.db "insert into messages (message_id, conversation_id, sender_id, received_timestamp, server_timestamp, message_status, seen, read_status, text, initial_insert_timestamp,type) VALUES (lower(hex(randomblob(4))) || '-' || lower(hex(randomblob(2))) || '-' || lower(hex(randomblob(2))) || '-' || lower(hex(randomblob(2))) || '-' || lower(hex(randomblob(6))), (SELECT _id FROM conversations WHERE participant_normalized_destination = 'google' limit 1), 1, strftime('%s000', 'now'), strftime('%s000000', 'now'), 3, 1, 1, '%text', strftime('%s000', 'now'), 2);
select last_insert_rowid() ;" Timeout (Seconds):0 Use Root:eek:n Store Output In:%out Store Errors In: Store Result In: Continue Task After Error:eek:n ]
<Store the inserted record ID into a global variable>
A5: Variable Set [ Name:%ALLO_ID To:%out Do Maths:eek:ff Append:eek:ff ]
<Launch Allo to process the command>
A6: Launch App [ App:Allo Data: Exclude From Recent Apps:eek:ff Always Start New Copy:eek:ff ]
A7: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
<This is necessary in order to receive an Allo notification with the answer>
A8: Go Home [ Page:0 ]
You will notice the global variable %ALLO_ID used to set the _id of the inserted record. You will need it later in order to recover Allo's answers.
This is a Task example to read the answer and say it by "text to speech". But you can do other automation tasks as you need.
Code:
Allo - Say (154)
A1: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
A2: Variable Set [ Name:%sqlite To:/data/data/com.keramidas.TitaniumBackup/files/sqlite3 Do Maths:eek:ff Append:eek:ff ]
A3: Run Shell [ Command:%sqlite /data/data/com.google.android.apps.fireball/databases/fireball.db "select text from messages where message_id like 'R:google%' and text is not null and _id > '%ALLO_ID' ;" Timeout (Seconds):0 Use Root:eek:n Store Output In:%out Store Errors In: Store Result In: Continue Task After Error:eek:n ]
A4: If [ %out !Set ]
A5: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ]
A6: Run Shell [ Command:%sqlite3 /data/data/com.google.android.apps.fireball/databases/fireball.db "select text from messages where message_id like 'R:google%' and text is not null and _id > '%ALLO_ID' ;" Timeout (Seconds):0 Use Root:eek:n Store Output In:%out Store Errors In: Store Result In: Continue Task After Error:eek:n ]
A7: End If
A8: Flash [ Text:%out Long:eek:ff ]
A9: Say [ Text:%out Engine:Voice:default:default Stream:3 Pitch:4 Speed:4 Respect Audio Focus:eek:n Network:eek:ff Continue Task Immediately:eek:ff ]
Sample Project with the Tasks:
View attachment Allo.prj.xml
Share yours Allo's commands here. What would you automate with this ?
ok, this looks pretty awesome ..I'm trying to get Google spoken search results on my huawei watch and this looks promising
ok, yeah, this is super awesome .. I now have 'limited' spoken Google search results on my huawei watch ... ( I'm a junkie addicted to autovoice+wearshell+ tasker ) ...
QUESTION: spoken search results are limited because many of the answers Google Assistant provides aren't just plain text ... so, how could the notification from Allo be parsed or converted or whatever? could AutoNotifications tasker plugin accomplish this? or some other tasker plugin?
...this project is still awesome as is though wow
I have imported the Project, Tested it gives me error when I run the Say Task after running the Test Task.
I have titaniumbackup pro installed and also set fullpath to variable.
There is error on the Run Shell Action. What can I do>?
Also tested Tasker has Root by using shell action input taps.
fenchai said:
I have imported the Project, Tested it gives me error when I run the Say Task after running the Test Task.
I have titaniumbackup pro installed and also set fullpath to variable.
There is error on the Run Shell Action. What can I do>?
Also tested Tasker has Root by using shell action input taps.
Click to expand...
Click to collapse
my import worked and I DID NOT set the fullpath variable ... I also have Titanium Backup pro installed ...
try deleting the project, then back fully out of tasker, then import project again and MAKE NO CHANGES .. just run the test and see what happens
pablo71 said:
my import worked and I DID NOT set the fullpath variable ... I also have Titanium Backup pro installed ...
try deleting the project, then back fully out of tasker, then import project again and MAKE NO CHANGES .. just run the test and see what happens
Click to expand...
Click to collapse
Yeah, Did it, fully backed out twice after importing too. Gives me error on the Say Test task. Maybe its because I am using Magisk root. But I already tested Tasker has root access. Even checked superuser to make sure. Error on Both Shell Runs
fenchai said:
Maybe its because I am using Magisk root.
Click to expand...
Click to collapse
I bet you are right .. I'm still on KitKat so I don't need systemless root, but I've read in other threads that strange issues were fixed by creating the file "su" in system folder (or something like that) by using the touch command ... can't remember the threads or procedure exactly but doing that helps some apps realize root really exists (according to those users it fixed problems for) ... best of luck
Update: this breaks Android Pay but...
from this post by Chainfire:
Yes, some apps look for the su binary in hardcoded locations. SuperSU in systemless mode by default does not touch /system, but if you create /system/bin/su and/or /system/xbin/su yourself (with the above statement in mind, doing so from Recovery is probably best), it will override those files with the correct binary each boot. This should fix most misbehaving apps (that do not rely on modifying /system on a device which currently does not allow this).
and:
I haven't tested this, but from looking at the script in the SuperSU.zip file, I think you can do the following after installing systemless root:
adb shell
su
mount -o remount,rw /system
touch /sbin/su /system/bin/su /system/xbin/su
mount -o remount,ro /system
exit
I ran these commands over ADB in Recovery and lo and behold, Secure Settings works again.
pablo71 said:
ok, yeah, this is super awesome .. I now have 'limited' spoken Google search results on my huawei watch ... ( I'm a junkie addicted to autovoice+wearshell+ tasker ) ...
QUESTION: spoken search results are limited because many of the answers Google Assistant provides aren't just plain text ... so, how could the notification from Allo be parsed or converted or whatever? could AutoNotifications tasker plugin accomplish this? or some other tasker plugin?
...this project is still awesome as is though wow
Click to expand...
Click to collapse
Unfortunally several answers are not in plain text, for that reason I had to include: " and text is not null" condition to SQL I think it would be difficult to read because the answer is on BLOB fields..
I'm also an addict to Tasker/Autovoice using my MotoX voice commands..
hotsync100 said:
I'm also an addict to Tasker/Autovoice using my MotoX voice commands..
Click to expand...
Click to collapse
most excellent! .. that's the only way .. this thread explains how to get sql to read the text in BLOB fields .. http://stackoverflow.com/questions/828650/how-do-i-get-textual-contents-from-blob-in-oracle-sql I can figure it out but shucks, maybe you know a faster way to plug in the the command string to what you wrote .. I bang my head against lots of walls because i sometimes get different results
pablo71 said:
this thread explains how to get sql to read the text in BLOB fields ..
Click to expand...
Click to collapse
Unfortunally that functions are for Oracle and we are using Sqlite..
We can get the hex value of BLOB field using this command:
"select hex(blob_data) from messages where message_id like 'R:google%' and text is null limit 1"
.. but, it is huge for Tasker.. and still we have to convert it to ascii to be readable.. there is no tasks to convert it in tasker .. Only from hex to decimal.
hotsync100 said:
Unfortunally that functions are for Oracle and we are using Sqlite..
We can get the hex value of BLOB field using this command:
"select hex(blob_data) from messages where message_id like 'R:google%' and text is null limit 1"
.. but, it is huge for Tasker.. and still we have to convert it to ascii to be readable.. there is no tasks to convert it in tasker .. Only from hex to decimal.
Click to expand...
Click to collapse
ahhh ... now I get it ... we're gonna need a bigger boat
pablo71 said:
I bet you are right .. I'm still on KitKat so I don't need systemless root, but I've read in other threads that strange issues were fixed by creating the file "su" in system folder (or something like that) by using the touch command ... can't remember the threads or procedure exactly but doing that helps some apps realize root really exists (according to those users it fixed problems for) ... best of luck
Update: this breaks Android Pay but...
from this post by Chainfire:
Yes, some apps look for the su binary in hardcoded locations. SuperSU in systemless mode by default does not touch /system, but if you create /system/bin/su and/or /system/xbin/su yourself (with the above statement in mind, doing so from Recovery is probably best), it will override those files with the correct binary each boot. This should fix most misbehaving apps (that do not rely on modifying /system on a device which currently does not allow this).
and:
I haven't tested this, but from looking at the script in the SuperSU.zip file, I think you can do the following after installing systemless root:
adb shell
su
mount -o remount,rw /system
touch /sbin/su /system/bin/su /system/xbin/su
mount -o remount,ro /system
exit
I ran these commands over ADB in Recovery and lo and behold, Secure Settings works again.
Click to expand...
Click to collapse
Hi, Yeah, I have also tried it. I dont think its the systemless method. Maybe its android 6.0. We would need more people to confirm.
@pablo71 I found a way to convert hex to ascii using Javascript ..
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
but unfortunally there is not much text on results..
hotsync100 said:
@pablo71 I found a way to convert hex to ascii using Javascript ..
View attachment 3906968
but unfortunally there is not much text on results..
View attachment 3906969 View attachment 3906967
Click to expand...
Click to collapse
you're amazing! this is a start!
This is a Task example to get data for a BLOB field..
View attachment Allo___Blob.tsk.xml
fenchai said:
Hi, Yeah, I have also tried it. I dont think its the systemless method. Maybe its android 6.0. We would need more people to confirm.
Click to expand...
Click to collapse
I think this is not related with Android 6.0, because my MotoX has that version and works fine!
hotsync100 said:
This is a Task example to get data for a BLOB field..
View attachment 3907008
Click to expand...
Click to collapse
hey this so appreciated .. I'm gonna be off work in an hour and I'm gonna plug this as soon as I get home ... this is really cool!!! Having this feature on my watch is going to be so much faster than pulling out my phone and talking into it or typing on it
3 hours later: I think I'm seeing some ways tasker could use variable splitters and search/replace actions to extract useful text .. this looks pretty promising
Hi, i don't really get android shells commands, so i would like to know if we can send a message with this?
Regards,
How empty variable from sqlite?
I've developed new appreciation for this project the past couple months, and I've been using it more and more often to get spoken Google Results on my watch ... I've learned to stick with simple questions using precise words and I'm happy with the results! (how old is George Lucas, how many original star trek episodes were there, what is the deepest point in the Pacific ocean, etc )... I still haven't found a good way to extract text from the blob fields, BUT THIS PROJECT PRODUCES RESULTS! ... it's good enough as is ... GREAT WORK!!

creating my 1st module: but service.sh never run

Magisk v19.3 on lineageos 16.0 for wt86047
trying to create my first module, no files to replace, just one task: run a remove.sh script
I put following two lines in ./common/service.sh , but there's no file created after boot , seems the service.sh itself never be run at all.
echo -e "\n------------${MODPATH}----------------------------" >> /sdcard/s.txt >&1
sh ./remove.sh
LATESTARTSERVICE=true in ./install.sh --YES
./META-INF/com/google/android/update-binary updated --YES
./module.prop edited --YES
the module installed with no error --YES
manual run remove.sh successfully in terminal after reboot --YES
called from service.sh --NO
need help, THANK YOU!
attached remove.sh
Code:
#!/system/bin/sh
DIRFILE="/sdcard/dir"
if [ -f "$USRFILE" ];then
while IFS= read -r LINE
do
if [ -n "${LINE}" ];then
...
...
fi
I haven't looked at what might be your issue, but you don't need a module for that... Just place your remove.sh script in /data/adb/service.d and give it execution permission.
Didgeridoohan said:
I haven't looked at what might be your issue, but you don't need a module for that... Just place your remove.sh script in /data/adb/service.d and give it execution permission.
Click to expand...
Click to collapse
thanks. but it doesn't work either.
When I manually run the script from terminal, it prompt 'Permission denied.'
But it works after execute 'su' first.
Is this the reason? But how could I authorise root right to the script since it doesn't pop dialogbox at all.
Again, I haven't looked at your script at all, but...
Any scripts run by Magisk at boot will run with superuser permission. That's not your issue...
Might be that the script has to run after boot is completed (if it works while booted but not during boot). You can look for the sys.boot_completed and when it's changed to 1 you can let the script execute.
I use this code in my modules, if it can help
Code:
_SLEEPBOOT=60
# ...
RETRY_INTERVAL=${_SLEEPBOOT} #in seconds
MAX_RETRY=30
retry=${MAX_RETRY}
while (("$retry" > "0")) && [ "$(getprop sys.boot_completed)" != "1" ]; do
sleep ${RETRY_INTERVAL}
((retry--))
done
Didgeridoohan said:
Again, I haven't looked at your script at all, but...
Any scripts run by Magisk at boot will run with superuser permission. That's not your issue...
Might be that the script has to run after boot is completed (if it works while booted but not during boot). You can look for the sys.boot_completed and when it's changed to 1 you can let the script execute.
Click to expand...
Click to collapse
Code:
# Wait for boot to complete
until [ "$(getprop sys.boot_completed)" ]
do
sleep 2
done
insert this code to script but still not work...
after all, found the solution:
don't use '/sdcard/, use '/storage/emulated/0/' instead, don't know why
funnypc said:
Code:
# Wait for boot to complete
until [ "$(getprop sys.boot_completed)" ]
do
sleep 2
done
insert this code to script but still not work...
after all, found the solution:
don't use '/sdcard/, use '/storage/emulated/0/' instead, don't know why
Click to expand...
Click to collapse
Might have worked if you had checked for sys.boot_completed = 1.
But yeah, /sdcard isn't available during boot. To be even more sure it'll work you could use /data/media/0 instead. That's always available (as long as /data is accessible).
Didgeridoohan said:
Might have worked if you had checked for sys.boot_completed = 1.
But yeah, /sdcard isn't available during boot. To be even more sure it'll work you could use /data/media/0 instead. That's always available (as long as /data is accessible).
Click to expand...
Click to collapse
though the script can work alone , I still want make it a module so that could install/disable easier with magisk gui than terminal.
currently I'm add a 'bypass' mode while script load, if volume key pressed repeatly. (like xposed does) but the code can only work after unlock, it seems the getevent can't work after system reboot, before keyguard unlocked. any workaround? thx!
Code:
#!/system/bin/sh
KEYSTRING="KEY_VOLUME"
KEYREPEAT=1
KEYCOUNTS=0
until [ "$(getprop sys.boot_completed)" ]
do
sleep 2
done
setenforce Permissive
echo 300 > /sys/class/timed_output/vibrator/enable
sleep 0.3
for i in `seq 1 4`;
do
EVENT=$(timeout 1 getevent -l -q -c 1)
RESULT=`echo $EVENT | grep -c $KEYSTRING`
input keyevent mouse
if [ "$RESULT" -gt 0 ] ;then
KEYCOUNTS=`expr $KEYCOUNTS + $RESULT`
echo 100 > /sys/class/timed_output/vibrator/enable
fi
done
if [ "$KEYCOUNTS" -gt "$KEYREPEAT" ] ;then
echo 1000 > /sys/class/timed_output/vibrator/enable
fi
Simple, just put your code in the service.sh file of the module instead of a separate script file...
Didgeridoohan said:
Simple, just put your code in the service.sh file of the module instead of a separate script file...
Click to expand...
Click to collapse
can't work. so I put the keypress detection part in a standalone script for debug. just script in service.d folder, not pack to module yet.
if I run the script manually in terminal after keyguard unlocked, everything works as I want
but not when keyguard locked status just after reboot.
funnypc said:
can't work. so I put the keypress detection part in a standalone script for debug. just script in service.d folder, not pack to module yet.
if I run the script manually in terminal after keyguard unlocked, everything works as I want
but not when keyguard locked status just after reboot.
Click to expand...
Click to collapse
I mean the code from your remove.sh file, not the key detecting stuff... That way you can disable the module from the Manager and also from TWRP (or other custom recovery) by placing a disable file in the module directory or enabling Magisk Core Only Mode by placing a .disable_magisk file in /cache.

super user dumpsys won't provide global results

I am running the command dumpsys using the following command line.
su -c dumpsys window windows | grep mCurrentFocus
I am getting the result mCurrentFocus=null
When I run from the shell window (adb shell)
dumpsys window windows | grep mCurrentFocus
I get the correct result (I correctly get the program launcher)
mCurrentFocus=Window{f7ca03b u0 com.anddoes.gingerapex/com.anddoes.launcher.Launcher}
It looks like su is only letting me access a subset of results related to the calling application.
Is there a way to get the global results.
Thanks!
atomclock said:
I am running the command dumpsys using the following command line.
su -c dumpsys window windows | grep mCurrentFocus
I am getting the result mCurrentFocus=null
When I run from the shell window (adb shell)
dumpsys window windows | grep mCurrentFocus
I get the correct result (I correctly get the program launcher)
mCurrentFocus=Window{f7ca03b u0 com.anddoes.gingerapex/com.anddoes.launcher.Launcher}
It looks like su is only letting me access a subset of results related to the calling application.
Is there a way to get the global results.
Long story short... I have written a task killing application and I don't want to kill the topmost application.
Thanks!
Click to expand...
Click to collapse
Task killing app is useless since Android managing the RAM pretty well.
You can try out with this:
https://developer.android.com/reference/android/app/usage/UsageStatsManager
Basically set the start time when your service start working and end time let it be current one, so it can get the top most running app in that n secs of amount of time you added.
Sent from my Redmi Note 8 Pro using Tapatalk

updown: remap hardware keys with root or adb wifi and Tasker

I really wanted to remap volume keys to page up and down in Chrome. I couldn't figure out how to do it well with existing tools (e.g., any tool using input keyevent will have an unavoidable lag), so I ended up writing an input remapper commandline tool which can be dropped to /data/local/tmp/ and activated either via a root shell or adb in Tasker for whatever apps you want it. And while I was at it, I made the tool more general, so you can use it to do whatever other remappings you want, or even to broadcast a Tasker intent (or run a shell script) on a hardware key.
The tool is only for people comfortable with commandline stuff.
My binaries are compiled for 64-bit arm. Get updown from: https://github.com/arpruss/updown
Installation:
Code:
adb push updown /data/local/tmp
adb shell chmod 755 /data/local/tmp/updown
Then to activate the volume to page up/down remap, do a root or adb wifi shell action that executes:
Code:
killall updown; /data/local/tmp/updown &
(Don't forget the ampersand to make updown run in the background.) Then when it's time to stop the remap:
Code:
killall updown
What I then did for my use was to run the activation command on entry into an app in Tasker and the killall on exit.
While the default remapping is for volume up/down, you can do various other remaps. For more information on the command-line parameters for updown, see: https://github.com/arpruss/updown/blob/main/README.md
(That said, I am not personally using updown with Tasker any more, since I have now made my xposed xupdown module work again with newer Androids.)
I recompiled it so it should work on both 32 and 64 bit devices.

Categories

Resources