[Q] ADB Shell Input Keyevent 26 - Thinkpad Tablet General

Hi,
I'm trying to Wake my device using the adb interface.
I works fine is when I turn it off using:
adb shell input keyevent 26
but it does not turn back on using the same
Any ideas?
Thanks!

Related

Unlock a Nexus 7 with ADB

Just a quick trick for pattern locks, needs a rooted device, I can't find a quicker way that simulates a real unlock:
adb pull /data/system/gesture.key unlockbkp
adb shell rm /data/system/gesture.key
adb shell input tap 600 1375
adb push unlockbkp /data/system/gesture.key
del[or rm] unlockbkp
The coords are for a Nexus 7 2013 only, will need to be adjusted for other devices.
Freddy

[Q]How to send MMS using ADB

Hello im trying to send MMS using ADB on phisical device, for SMS the code im using is simple
Code:
adb shell start -a android.action.SENDTO -d sms:xxxxxxxxx --es sms_body "SMS BODY"
adb shell input keyevent 22
adb shell input keyevent 66
The code im trying to write should work for two cases:
1. Take photo and attach it to my msg
2. Select photo from My Files and attach it.
Do You know how to do that? I will appreciate any help.
Redg
Iksior
Any one?

adb shell from device terminal emulator

I used to be able to run adb shell from terminal emulators on my devices
I can use adb shell on my Galaxy Tab S2 LP
But I can not run adb shell on my rooted Moto X MM
Code:
~$ su
[email protected]:/storage/emulated/0 # adb version
tmp-mksh: adb: not found
any one know how to resolve this issue ?
All su commands aren't doing anything for me since marshmallow
Run adb shell then adb version
Sent from my XT1575 using Tapatalk

Fast Keyevent Simulation (Android Shell)

I am developing a Keyboard Bot (Automated Text Typing) in which the only problem I'm facing is speed (Regardless of which device is used). The App requires root and it works perfectly fine in typing text.
Using
Code:
adb shell input text <String>
or
Code:
adb shell input keyevent <KEYCODE_NAME>
works perfectly fine in sending text to the android device, but my issue is speed.
Using something like
Code:
input keyevent KEYCODE_A KEYCODE_A KEYCODE_SPACE KEYCODE_A KEYCODE_ENTER;
will type the text quickly, but separating it into 2 commands will result in a (1 sec) delay between the 2 commands (Much Slower).
Sample Shell Code:
Method 1 (Much faster):
Code:
input keyevent KEYCODE_A KEYCODE_A KEYCODE_ENTER KEYCODE_A KEYCODE_A KEYCODE_ENTER;
Method 2:
Code:
input keyevent KEYCODE_A KEYCODE_A KEYCODE_ENTER;
input keyevent KEYCODE_A KEYCODE_A KEYCODE_ENTER;
I wanted to type a large text as fast as possible, so i called a long shell
Code:
input keyevent KEYCODE_A .... KEYCODE_ENTER
But having a shell script with input keyevent followed by a large combination of KEYCODE_A for instance, will not be executed. (Large Shell Commands are aborted)
After the shell command
Code:
input keyevent KEYCODE_A
, there will be a 1 second delay before the next "input" command executes.
What would be the best way to send large text without having long delays?
I am aware that sendevent is faster in sending large text, but how can i programmatically use it with an APP with root privilages?
Is there a way i can use Instrumentation from my root app on third party apps without having to transform my app into a system app?
Note:
The weakness of input text <String> is that it also has a limit to it's size and it can't perform special keyevents inside of it (Like the Back Button or Enter/New Line ).
I have been looking for an answer for quite sometime, but i haven't found a working method. (I searched for a way to send text using "sendevent" code.
My Sample Code: (Simple Program that will type a certain text multiple times)
Service Class
Code:
public class InputTextService extends IntentService {
public InputTextService() {
super("ServiceQAZ");
}
@Override
protected void onHandleIntent(Intent intent) {
//Using chainfire libsuperuser
Log.i("Service","Entered");
try {
Thread.sleep(5L* 1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
Log.i("Service","Sleep Finished");
//String[] cmds = { "input text hello","input keyevent KEYCODE_ENTER"};
String[] cmds = { "input keyevent KEYCODE_H KEYCODE_E KEYCODE_L KEYCODE_L KEYCODE_O","input keyevent KEYCODE_ENTER"};
// if(Shell.SU.available()) {
for(int i = 0; i < 100; i++) {
Shell.SU.run(cmds); // Works Everywhere
//Shell.SH.run(cmds); //Only works in application
}
// }
Log.i("Service","Input Sent");
}
}
Thanks in Advance.
Hi this might be a bit off topic but I am working on my own app and the first command that the app tries to run when i press a button is mount -o rw,remount /system to get mount partition as rw, so i can further execute other commands, however app works fine on other phones but on my phone it shows the following issue in su logs :device or resource busy , can't mount , please help I've tried almost everything, i am able to mount using terminal emulator but not via app
dewankpant said:
Hi this might be a bit off topic but I am working on my own app and the first command that the app tries to run when i press a button is mount -o rw,remount /system to get mount partition as rw, so i can further execute other commands, however app works fine on other phones but on my phone it shows the following issue in su logs :device or resource busy , can't mount , please help I've tried almost everything, i am able to mount using terminal emulator but not via app
Click to expand...
Click to collapse
I would recommend that you use the library "Root Tools" which has a mount command that will try different methods of mounting a directory. I've been using it for a while and it's great.
Stround said:
I would recommend that you use the library "Root Tools" which has a mount command that will try different methods of mounting a directory. I've been using it for a while and it's great.
Click to expand...
Click to collapse
Actually my problem is something different, i am using this command in my own app and when i see the log of my app in su i see it shows that device or resource is busy, how can i overcome that
I think that my question is different from the purpose of this thread, but I do not want to build a new thread, so please forgive me.
As you know, input keyevent is a very slow command. But I tested this instead of "input keyevent 3".
"am start -c android.intent.category.HOME -a android.intent.action.MAIN"
I found out this was way faster than input keyevent 3.
So someone smart developers, could you write down the strings like "am start blah blah blah" as "input keyevent 4" (back) for me?

Adb Shell

can someone please help i cant get adb shell command to work, i can adb push/pull or reboot and all commands work fine but adb shell returns /system/bin/sh: adb: not found
please help i have shield 2017 and at a loss what to do

Categories

Resources