adb command to open settings and change them - command

I'm looking for adb command to open settings and change them. For example: this command open display settings
adb shell am start -n com.android.settings/.DisplaySettings
I want to go further in menu to Display output mode then choose 720P 60HZ
As my menu is like this on android tv box:
Settings > Display > Display output Mode > HDMI 720P60HZ etc
Is there a adb command to do this go through settings then choose 720P60Hz directly with shell ?

Use this command to see a help on how you can use the settings adb shell command:
adb shell settings
Use get and put commands (after settings) to change the settings.
You will have to figure out the KEYs (use list) and acceptable VALUEs yourself (read documentation like https://developer.android.com/reference/android/provider/Settings.Global for the global NAMESPACE).

I'm not sure how to change the value directly, but to expand on another answer (and also because it sounds like this is what you're asking for), you can use adb to navigate through settings windows and pick different things in the UI. I've done that with some settings I can't seem to set a value from a single adb command. I just use the virtual Tab key to navigate through the menu items then press Enter to select a submenu or toggle an option.
I don't have an android tv box so I don't have the setting you do, but the commands would look something like this:
adb shell am start -a android.settings.DISPLAY_SETTINGS
adb shell input keyevent TAB
adb shell input keyevent TAB
adb shell input keyevent ENTER
adb shell input keyevent TAB
adb shell input keyevent TAB
adb shell input keyevent TAB
adb shell input keyevent TAB
adb shell input keyevent ENTER
adb shell am force-stop com.android.settings
You can try sending one tab command at a time to see how many you need to send before getting to the item you want.
Tips:
You can also use the Back button to go back a page:
adb shell input keyevent BACK
And you can use the arrow keys to navigate through confirmation popups (or move brightness/volume sliders):
adb shell input keyevent DPAD_RIGHT
adb shell input keyevent DPAD_LEFT
adb shell input keyevent DPAD_UP
adb shell input keyevent DPAD_DOWN
Here's a list of more key commands you can use (just look for the ones preceded by KEYCODE_, and remove that part. e.g. KEYCODE_BACK would be BACK as illustrated above):
https://developer.android.com/reference/android/view/KeyEvent
And here's a list of more direct settings windows you can launch:
https://stackoverflow.com/a/39873312
Copied here: (just precede them with adb shell am start -a to launch)
com.android.settings
com.android.settings.APPLICATION_DEVELOPMENT_SETTINGS
com.android.settings.DISPLAY_SETTINGS
com.android.settings.DOCK_SETTINGS
com.android.settings.QUICK_LAUNCH_SETTINGS
com.android.settings.SOUND_SETTINGS
com.android.settings.TTS_SETTINGS
com.android.settings.VOICE_INPUT_OUTPUT_SETTINGS
android.settings.ACCESSIBILITY_SETTINGS
android.settings.ACCOUNT_SYNC_SETTINGS
android.settings.ACCOUNT_SYNC_SETTINGS_ADD_ACCOUNT
android.settings.ADD_ACCOUNT_SETTINGS
android.settings.AIRPLANE_MODE_SETTINGS
android.settings.APN_SETTINGS
android.settings.APPLICATION_SETTINGS
android.settings.BLUETOOTH_SETTINGS
android.settings.DATA_ROAMING_SETTINGS
android.settings.DATE_SETTINGS
android.settings.DEVICE_INFO_SETTINGS
android.settings.DISPLAY_SETTINGS
android.settings.INPUT_METHOD_SETTINGS
android.settings.INTERNAL_STORAGE_SETTINGS
android.settings.LOCALE_SETTINGS
android.settings.LOCATION_SOURCE_SETTINGS
android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS
android.settings.MANAGE_APPLICATIONS_SETTINGS
android.settings.MEMORY_CARD_SETTINGS
android.settings.PRIVACY_SETTINGS
android.settings.SECURITY_SETTINGS
android.settings.SETTINGS
android.settings.SOUND_SETTINGS
android.settings.SYNC_SETTINGS
android.settings.SYSTEM_UPDATE_SETTINGS
android.settings.USER_DICTIONARY_SETTINGS
android.settings.WIFI_IP_SETTINGS
android.settings.WIFI_SETTINGS
android.settings.WIRELESS_SETTINGS
ACCESSIBILITY_FEEDBACK_SETTINGS
android.net.vpn.SETTINGS
android.search.action.SEARCH_SETTINGS
android.search.action.WEB_SEARCH_SETTINGS

As far as I know ther is no such functionality. However, you can use the
adb shell input tap <x> <y>
command to trigger a touch event. Unfortunately, such code will not work device-indepently as the position of your settings on the screen depends on the device you are using.
Alternatively you can try the
adb shell input keyevent <19|20|21|22>
command to emulate curser events to select the setting you want to alter.
Finally, you can use
adb shell input keyevent 66
to trigger the enter key. This should work on all devices having the same options in the settings submenu.

Related

Neovim: how to send keys to terminal emulator

When I open up a nvim terminal emulator and enter the following command, trying to execute command 'python':
:normal! ipython
It turned out the register content is pasted onto the screen, as if 'p' is pressed under normal mode, even if 'i' has been pressed in prior to (supposedly) enter terminal-insert mode.
This does not help either:
:execute "normal! ipython\<CR>"
Where have I gone wrong, and how could I do it correctly?
Alternatively I used termopen() to execute a command in the terminal on start, something like
:call termopen('python')
But still, no idea about how to do so with normal!.
:normal! ipython
doesn't mean "run the program". It means "switch to Normal mode and run !" which is a filter command; then run i that is switch to Insert mode and insert "python".
To run a command from the vim command line use
:!ipython

Stop android emulator from command line jump pop up message

So i am start my Android emulator from command line using this command:
%ANDROID_HOME%\emulator\emulator.exe -avd Pixel_XL_API_27
And when i want to stop i am using this command:
adb -e emu kill
So after this command i have window message:
Any option to disable this message >
Adding -no-snapshot-save parameter will disable snapshot.
You can check other params available at https://developer.android.com/studio/run/emulator-commandline#startup-options

VSC Command Log

Trying to figure out how to create a key binding for a specific command.
I can see the command in the pallete but it has no bindings so I can't see it in the keybindings.json.
Is there any way I can LOG all commands being executed within VSC so that I can perform the command and see the command name in the log?
Edit:
To make it clear:
I want general method to know how I can find what commands were issued along with their command IDs.
I already know I find some commands in the default keybindings file and that's NOT a general way to find the command you have run. It doesn't list all command not does it explain what they each are and you can't use it to verify that it is the command you executed.
You can create binding using Keyboard Shortcuts as well (Preferences: Open Keyboard Shortcuts command). You can search by command name and and even check its corresponding id:
Second option is that you can enable tracing and see executed commands in output panel (it looks like it doesn't log commands executed from command palette though):
Set log level to trace.
You can either pass --log argument when starting VS Code like: code --log trace (doesn't work for me for some reason) or execute Developer: Set Log Level... from command palette:
After that, you should see executed commands in output panel for Window process.
The "Toggle Line Comment" command's id is editor.action.commentLine.
You can find all the command ids by using the search feature in the Keyboard Shortcuts Editor (on macOS you can open it via Application Menu > Preferences > Keyboard Shortcuts or using the shortcut Cmd+K Cmd+S).
In the keybindings.json you can trigger the autocomplete help (i.e. Ctrl+Space) and search all available commands.

Screen capture of mobile using adb in Power shell

i am using power shell programming to take a screen shot of android mobile and show in the gui of PC application that us built using power shell programming...
when screen capture button is clicked..it show error that sc.png does not exists
it means adb command is not capturing screen and save in sd cad....
$buttonTakeScreenCapture_Click={
.\adb.exe shell screencap -p > sc.png
.\adb.exe pull /sdcard/sc.png
Do not use redirection:
.\adb.exe shell screencap -p /sdcard/sc.png
.\adb.exe pull /sdcard/sc.png

full screen mode (25*80) command line scripting

when you run a script (such as vbscript) from 25*80 (full screen mode of dos prompt) and that your script call a windows application (such as notepad), at the end of the operation, focus remains on the desktop (although "command prompt" at the taskbar minimized and wait for only one "{enter}" to go back in 25*80 full screen command prompt)
how can i do that? (go back to full screen command prompt at the end of the call windows app. from my script)
look at shell command START
Make your command prompt shortcut in fullscreen mode (25*80) by setting property & dbl click on it.
At the prompt enter start /b notepad, and then push enter and see what happen. How can you return to command prompt in full screen mode and how to automate it?