How to show command 'adb shell input tap x y' feedback on screen? - adb

I can enable setting "Point Feedback" by the command ADB shell settings put system show_touches 1. But When I run ADB shell input tap x y or ADB shell input swipe x1 y1 x2 y2, there's nothing on the screen.
So, how can I see the touch feedback by the ADB command on the screen?

Android > Settings > Developer Options settings
make sure the Pointer location option is enable

Related

How can we access Settings > Safety & emergency on Pixel XL API 33 via adb commands?

access Settings > Safety & emergency via adb commands?
I tried below commands but none are working.
adb shell am start -n com.android.settings/com.android.settings.emergency.EmergencyDashboardFragment
Starting: Intent { cmp=com.android.settings/.emergency.EmergencyDashboardFragment }
Error type 3
Error: Activity class {com.android.settings/com.android.settings.emergency.EmergencyDashboardFragment} does not exist.
emu64xa:/ # am start -n com.android.settings/com.android.settings.emergency.EmergencyDashboardFragment
adb shell am start -n com.android.settings/com.android.settings.SubSettings -e :android:show_fragment com.android.settings.emergency.EmergencyDashboardFragment
This only opens the settings, but not Settings > Safety & emergency

Is there any way to connect to a remote container without open a foder?

I am implementing a dev environment for Arduino an other MCUs. I have a container image with all the compilers and tool-chains required and I have an script to connect VSCode to it.
The connection magic is done by this:
CONTAINER_NAME="dev-environments-mcus"
hex=$(printf \{\"containerName\"\:\""$CONTAINER_NAME"\"\} | od -A n -t x1 | tr -d '[\n\t ]')
code --folder-uri vscode-remote://attached-container+${hex}/App_Home/mcu-projects
This works perfectly but the problem is that by doing this I am opening a specific folder in the container which is not ideal for a generic dev enviroment.
I would like to know if it is possible to replicate in cmdline the "Attach in new window" button behaviour, which open an "empty" window when you click on it.
Edit1: Replacing --folder-uri by --file-uri make my script work better but I would like to open no file or at least open the start page.
PS: Just in case you are curious this is the project github
Ok I think that I manage to solve it. I will share what I did just in case anyone find himself on the same situation.
I just had to use the option --file-uri rather than --folder-uri and append a slash / at then end of the command. Now no folder or empty file is open when VSCode starts.
This is how the script looks now:
CONTAINER_NAME="dev-environments-mcus"
hex=$(printf \{\"containerName\"\:\""$CONTAINER_NAME"\"\} | od -A n -t x1 | tr -d '[\n\t ]')
code --file-uri vscode-remote://attached-container+${hex}/

How to switch from one wifi network to another wifi in appium(Android&IOS)

Currently i'm working in Banking application for accessing security servers i have to switch one wifi network to another wifi is there any possible way in appium.
Anyone please help me on this
You can try Appium Studio. With which you can automate the process of switching from one wifi to another wifi channel.
You can find here on how to switch on the wifi in a single command.
But to change the wifi network, you have to automate the process.
We can use a workaround in android to connect to particular wifi.
Below are the steps:
Navigate to Settings-Wifi Screen.
Tap on the wifi-name.
Step1: Navigate to Settings-Wifi Screen.
For Windows OS:
String allCommand = null;
String commandForWifiSettings="am start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings";
allCommand = "cmd.exe /C adb -s " + deviceID + " " + commandForWifiSettings;
Process p = Runtime.getRuntime().exec(allCommand);
For Linux OS:
String allCommand = null;
String commandForWifiSettings="am start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings";
allCommand = "/bin/bash -l -c adb -s " + deviceID + " " + commandForWifiSettings;
Process p = Runtime.getRuntime().exec(allCommand);
Step2: Tap on the wifi-name in the wifi-settings screen. Add some wait before tapping on the element.
driver.findElement(By.xpath("//*[#text='Wifi-name']").click();

adb command - Marshmallow - change preferred network mode LTE/GSM

I am on the 6.0.1 Marshmallow OS and my previous commands to change the preferred network mode are no longer working.
Commands used in Kit Kat worked without issue:
adb shell sqlite3 /data/data/com.android.providers.settings/databases/settings.db "SELECT * FROM global WHERE name='preferred_network_mode'"
adb shell sqlite3 /data/data/com.android.providers.settings/databases/settings.db "update global SET value=1 WHERE name='preferred_network_mode'"
adb shell sqlite3 /data/data/com.android.providers.settings/databases/settings.db "select value FROM secure WHERE name='preferred_network_mode'
Commands from above entered in this OS result in output:
Error: no such table: global
I pulled the database file, which was completely empty:
adb pull /data/data/com.android.providers.settings/databases/
Is there any ADB command that I can use to change the preferred_network_mode to LTE/GSM?
After a lot of research, this was the working solution I found for Marshmallow.
The Preferred Network Mode numbers are found:
https://android.googlesource.com/platform/hardware/ril/+/master/include/telephony/ril.h#228
1 is GSM Only
11 is LTE Only
adb wait-for-devices
adb root
adb wait-for-devices
adb shell settings list global | grep pref
This returned to me both "preferred_network_mode" and "preferred_network_mode1"
adb shell settings put global preferred_network_mode 1
adb shell settings put global preferred_network_mode1 1
adb shell stop ril-daemon
adb shell start ril-daemon
For setting RAT on SUB1, run below command:
adb wait-for-devices
adb root
adb wait-for-devices
adb remount
adb shell settings put global preferred_network_mode 1
adb shell settings put global preferred_network_mode1 1
adb shell stop ril-daemon
adb shell start ril-daemon
adb shell settings put global airplane_mode_on 1
adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true
adb shell sleep 5;
adb shell settings put global airplane_mode_on 0
adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false
Now, check if RAT is set or not by running below command:
adb shell dumpsys telephony.registry | grep mServiceState
adb shell:
content update --uri content://settings/global --bind value:i:12 --where "name='preferred_network_mode'"
12 == LTE + WCDMA, for more see ril.h
dont forget to set preferred_network_mode1 and preferred_network_mode2 and preferred_network_mode3

How to get a response with an AT command via ADB?

I was doing what suggested here: Sending AT Commands Via ADB Android
So after I rooted my Samsung S5, I found my modem with this command: getprop rild.libargs and I got this result: -d /dev/smd0
Then I typed into my adb shell: echo -c "AT\r\n" > /dev/smd0
But nothing is returned.
I don't understand, any idea ?
I also tried other commands like: AT+CREG or AT+COPS=?, still nothing.

Resources