Hi,
Finally I can enter recovery mode after messing up with build.prop on Xperia Tablet S
tablet is visible in ADB as
C:\Users\Amiga\Desktop\adb>adb devices
List of devices attached
0123456789ABCDEF recovery
but rest of the commands doesn't work
C:\Users\Amiga\Desktop\adb>adb shell
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
error: closed
So I don't know how to pull out build.prop from Tablet
Amiga4ever123 said:
Hi,
Finally I can enter recovery mode after messing up with build.prop on Xperia Tablet S
tablet is visible in ADB as
C:\Users\Amiga\Desktop\adb>adb devices
List of devices attached
0123456789ABCDEF recovery
but rest of the commands doesn't work
C:\Users\Amiga\Desktop\adb>adb shell
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
error: closed
So I don't know how to pull out build.prop from Tablet
Click to expand...
Click to collapse
The reason you are getting the "error: closed" message is because the version of System Recovery installed on your tablet inhibits ADB from accessing the tablet's file system. You are not going to be able to pull or push the build.prop file.
Ok I can't use ADb so how can I replace faulty build.prop file or make recovery? Any ZIP file that I can put on SD card?
Amiga4ever123 said:
Ok I can't use ADb so how can I replace faulty build.prop file or make recovery? Any ZIP file that I can put on SD card?
Click to expand...
Click to collapse
You can try copying an OTA update file to an SD card and using System Recovery to install it, but I do not believe doing that will work. I believe you have bricked your tablet to the point where you have to send your tablet to Sony for repair.
Cat McGowan said:
You can try copying an OTA update file to an SD card and using System Recovery to install it, but I do not believe doing that will work. I believe you have bricked your tablet to the point where you have to send your tablet to Sony for repair.
Click to expand...
Click to collapse
So its very easy to brick this amazing sony device
Cat McGowan said:
The reason you are getting the "error: closed" message is because the version of System Recovery installed on your tablet inhibits ADB from accessing the tablet's file system. You are not going to be able to pull or push the build.prop file.
Click to expand...
Click to collapse
Hi cat tried to PM you but can?t do it...
Can you teach me how to copy/restore (pull and or push) the original build.prop in my cell (now bricked) i had the original file (buil.prop) inside it... i am learning about adb commands. thanksss. The main problem I have: An issue with ADB VCOM drivers (in windows) (tried in a couple of PCS, the device manager "see" the vcom preloader only a little moment (when connect the cell with usb cable) and then dissapear... then with command adb devices: no devices found... can you help me?
federimau said:
Hi cat tried to PM you but can?t do it...
Can you teach me how to copy/restore (pull and or push) the original build.prop in my cell (now bricked) i had the original file (buil.prop) inside it... i am learning about adb commands. thanksss. The main problem I have: An issue with ADB VCOM drivers (in windows) (tried in a couple of PCS, the device manager "see" the vcom preloader only a little moment (when connect the cell with usb cable) and then dissapear... then with command adb devices: no devices found... can you help me?
Click to expand...
Click to collapse
The reason ADB is reporting no devices are found may be because (1) your device is bricked, which probably means you are not going to be able to pull/push files from/to your device, (2) you do not have ADB drivers for your device properly installed on your PC, and/or (3) you do not have USB debugging enabled in your tablet's Developer options settings.
It's good you are learning how to use ADB and there are plenty of ADB tutorials to be found via Google, etc.; e.g., HERE.
Here is what you specifically ask for.
Pulling the build.prop file from your tablet to your PC is easy, just use these commands.
Code:
adb wait-for-device
adb pull /system/build.prop
adb kill-server
Pushing the build.prop file from your PC to your tablet is more complicated.
(1) Your tablet must have root access. If it doesn't, attempts at pushing the file to your tablet's /system directory will fail.
(2) Along with having root access, you must have SuperSU or Superuser, and Busybox installed on the tablet.
(3) You have to temporarily set your tablet's /system directory's properties from RO to RW, which must be done quickly because your tablet's OS monitors the /system directory's properties and will reboot the tablet if it detects the directory's properties have been changed from RO.
(4) To issue the ADB commands as quickly as possible, the commands must be put into a DOS batch command script file. For example, create and run a batch file named doit.bat containing the following commands.
Code:
adb wait-for-device
adb push build.prop /build.prop
adb shell "su -c 'stop ric'"
adb shell "su -c 'busybox pkill -f /sbin/ric'"
adb shell "su -c 'mount -ro remount,rw /'"
adb shell "su -c 'chmod 0440 /sbin/ric'"
adb shell "su -c 'stop ric'"
adb shell "su -c 'busybox pkill -f /sbin/ric'"
adb shell "su -c 'mount -ro remount,rw /system'"
adb shell "su -c 'busybox cp -af /build.prop /system/build.prop'"
adb shell "su -c 'chmod 0744 /system/build.prop'"
adb shell "su -c 'rm /build.prop'"
adb shell "exit"
adb kill-server
Good luck.
Cat McGowan said:
The reason ADB is reporting no devices are found may be because (1) your device is bricked, which probably means you are not going to be able to pull/push files from/to your device, (2) you do not have ADB drivers for your device properly installed on your PC, and/or (3) you do not have USB debugging enabled in your tablet's Developer options settings.
It's good you are learning how to use ADB and there are plenty of ADB tutorials to be found via Google, etc.; e.g., HERE.
Here is what you specifically ask for.
Pulling the build.prop file from your tablet to your PC is easy, just use these commands.
Code:
adb wait-for-device
adb pull /system/build.prop
adb kill-server
Pushing the build.prop file from your PC to your tablet is more complicated.
(1) Your tablet must have root access. If it doesn't, attempts at pushing the file to your tablet's /system directory will fail.
(2) Along with having root access, you must have SuperSU or Superuser, and Busybox installed on the tablet.
(3) You have to temporarily set your tablet's /system directory's properties from RO to RW, which must be done quickly because your tablet's OS monitors the /system directory's properties and will reboot the tablet if it detects the directory's properties have been changed from RO.
(4) To issue the ADB commands as quickly as possible, the commands must be put into a DOS batch command script file. For example, create and run a batch file named doit.bat containing the following commands.
Code:
adb wait-for-device
adb push build.prop /build.prop
adb shell "su -c 'stop ric'"
adb shell "su -c 'busybox pkill -f /sbin/ric'"
adb shell "su -c 'mount -ro remount,rw /'"
adb shell "su -c 'chmod 0440 /sbin/ric'"
adb shell "su -c 'stop ric'"
adb shell "su -c 'busybox pkill -f /sbin/ric'"
adb shell "su -c 'mount -ro remount,rw /system'"
adb shell "su -c 'busybox cp -af /build.prop /system/build.prop'"
adb shell "su -c 'chmod 0744 /system/build.prop'"
adb shell "su -c 'rm /build.prop'"
adb shell "exit"
adb kill-server
Good luck.
Click to expand...
Click to collapse
Wowww Cat, you are the one!! Thanks in Advance
The main problem I have: An issue with device recognition in windows PC... driver ADB VCOM MTK 6592 (tried in different PCS windows Xp and 8) (the device manager "see" the vcom preloader but only a little moment (in the first instant when connect the cell (cell off) with usb cable) and then dissapear (disconnect) the vcom preloader... I think If I can reach the way to get this connection running ok I can progress with this... will fight hard...
When I type the command adb devices, result: no devices found...
Tried to upgrade the vcom drivers (when i can catch it in the active state in device manager)... nothing
Tried to "on" the phone... nothing
Tried to flash a new ROM from Recovery (MIUI or Feelingme 078)... ERROR installation aborted
I can see this effect (with usbview): the usb is recognized in the PC (but just for a little moment at the instant when plug it), then disconnect...
I need to recover the original build.prop.bak from coolpad memory, rename it to build.prop and send it to coolpad again...
I think i can flash (from recovery) an original build. prop (packed as update.zip) doing the wipes and apply update from sdcard)... anyone can assist me on this?
This new 9976A item comes to me with 048 version, custom buid version 265 and rooted from factory...
Anyone can please help me?
Cat McGowan said:
The reason ADB is reporting no devices are found may be because (1) your device is bricked, which probably means you are not going to be able to pull/push files from/to your device, (2) you do not have ADB drivers for your device properly installed on your PC, and/or (3) you do not have USB debugging enabled in your tablet's Developer options settings.
It's good you are learning how to use ADB and there are plenty of ADB tutorials to be found via Google, etc.; e.g., HERE.
Here is what you specifically ask for.
Pulling the build.prop file from your tablet to your PC is easy, just use these commands.
Code:
adb wait-for-device
adb pull /system/build.prop
adb kill-server
Pushing the build.prop file from your PC to your tablet is more complicated.
(1) Your tablet must have root access. If it doesn't, attempts at pushing the file to your tablet's /system directory will fail.
(2) Along with having root access, you must have SuperSU or Superuser, and Busybox installed on the tablet.
(3) You have to temporarily set your tablet's /system directory's properties from RO to RW, which must be done quickly because your tablet's OS monitors the /system directory's properties and will reboot the tablet if it detects the directory's properties have been changed from RO.
(4) To issue the ADB commands as quickly as possible, the commands must be put into a DOS batch command script file. For example, create and run a batch file named doit.bat containing the following commands.
Code:
adb wait-for-device
adb push build.prop /build.prop
adb shell "su -c 'stop ric'"
adb shell "su -c 'busybox pkill -f /sbin/ric'"
adb shell "su -c 'mount -ro remount,rw /'"
adb shell "su -c 'chmod 0440 /sbin/ric'"
adb shell "su -c 'stop ric'"
adb shell "su -c 'busybox pkill -f /sbin/ric'"
adb shell "su -c 'mount -ro remount,rw /system'"
adb shell "su -c 'busybox cp -af /build.prop /system/build.prop'"
adb shell "su -c 'chmod 0744 /system/build.prop'"
adb shell "su -c 'rm /build.prop'"
adb shell "exit"
adb kill-server
Good luck.
Click to expand...
Click to collapse
Cat i will need to pull the backup file... then the code i need is... (please monitor it for me)
adb wait-for-device
adb pull /system/build.prop.bak
adb kill-server
and... when you push the correct and original file
adb wait-for-device
adb push build.prop /build.prop
is it ok? or the path is this?
adb push build.prop /system/build.prop
(if there are a build.prop in the device this will overwrite it?
federimau said:
Cat i will need to pull the backup file... then the code i need is... (please monitor it for me)
adb wait-for-device
adb pull /system/build.prop.bak
adb kill-server
and... when you push the correct and original file
adb wait-for-device
adb push build.prop /build.prop
is it ok? or the path is this?
adb push build.prop /system/build.prop
(if there are a build.prop in the device this will overwrite it?
Click to expand...
Click to collapse
adb push build.prop /system/build.prop
Cat McGowan said:
adb push build.prop /system/build.prop
Click to expand...
Click to collapse
Thanks cat, as i say, the main problem in this case is: i have a short window of time when the windows PC see the driver in the device manager... then disconnects... do you have any idea what can i do to establish this connection betweeen the android device and the computer without interruption?
---------- Post added at 05:22 PM ---------- Previous post was at 05:12 PM ----------
Cat McGowan said:
adb push build.prop /system/build.prop
Click to expand...
Click to collapse
cat, i´m doing 2 bat files (edited with notepad, is this correct?)
one file: pull.bat
with code
adb wait-for-device
adb pull /system/build.prop.bak
adb kill-server
another file: push.bat
with code
adb wait-for-device
adb push build.prop /system/build.prop
adb shell "su -c 'stop ric'"
adb shell "su -c 'busybox pkill -f /sbin/ric'"
adb shell "su -c 'mount -ro remount,rw /'"
adb shell "su -c 'chmod 0440 /sbin/ric'"
adb shell "su -c 'stop ric'"
adb shell "su -c 'busybox pkill -f /sbin/ric'"
adb shell "su -c 'mount -ro remount,rw /system'"
adb shell "su -c 'busybox cp -af /build.prop /system/build.prop'"
adb shell "su -c 'chmod 0744 /system/build.prop'"
adb shell "su -c 'rm /build.prop'"
adb shell "exit"
adb kill-server
what do you think?
---------- Post added at 05:51 PM ---------- Previous post was at 05:22 PM ----------
federimau said:
Thanks cat, as i say, the main problem in this case is: i have a short window of time when the windows PC see the driver in the device manager... then disconnects... do you have any idea what can i do to establish this connection betweeen the android device and the computer without interruption?
---------- Post added at 05:22 PM ---------- Previous post was at 05:12 PM ----------
cat, i´m doing 2 bat files (edited with notepad, is this correct?)
one file: pull.bat
with code
adb wait-for-device
adb pull /system/build.prop.bak
adb kill-server
another file: push.bat
with code
adb wait-for-device
adb push build.prop /system/build.prop
adb shell "su -c 'stop ric'"
adb shell "su -c 'busybox pkill -f /sbin/ric'"
adb shell "su -c 'mount -ro remount,rw /'"
adb shell "su -c 'chmod 0440 /sbin/ric'"
adb shell "su -c 'stop ric'"
adb shell "su -c 'busybox pkill -f /sbin/ric'"
adb shell "su -c 'mount -ro remount,rw /system'"
adb shell "su -c 'busybox cp -af /build.prop /system/build.prop'"
adb shell "su -c 'chmod 0744 /system/build.prop'"
adb shell "su -c 'rm /build.prop'"
adb shell "exit"
adb kill-server
what do you think?
Click to expand...
Click to collapse
I think need to remove the first line?
adb wait-for-device
federimau said:
Thanks cat, as i say, the main problem in this case is: i have a short window of time when the windows PC see the driver in the device manager... then disconnects... do you have any idea what can i do to establish this connection betweeen the android device and the computer without interruption?
Click to expand...
Click to collapse
You need to solve that problem before you can do anything else. Find an xda-developers forum that deals with your device and look there for fixes for your device's drivers. I am confident I can help you with Sony tablet drivers, but not your device's drivers. I don't even know the model of your device.
Create and use the following CheckDriver.bat file to help you troubleshoot the drivers. The script simply opens a DOS command window, starts the adb server, then lists the devices the adb server finds. The DOS command window will stay open until you press any key. If the script hangs, press ctrl+c to abort the script and close the DOS command window, then open another DOS command window and issue the "adb kill-server" command to stop the adb server.
Code:
@echo off
echo Starting ADB server and waiting for device.
echo.
adb wait-for-device
adb devices
pause
adb kill-server
federimau said:
cat, i´m doing 2 bat files (edited with notepad, is this correct?)
one file: pull.bat
with code
adb wait-for-device
adb pull /system/build.prop.bak
adb kill-server
another file: push.bat
with code
adb wait-for-device
adb push build.prop /system/build.prop
adb shell "su -c 'stop ric'"
adb shell "su -c 'busybox pkill -f /sbin/ric'"
adb shell "su -c 'mount -ro remount,rw /'"
adb shell "su -c 'chmod 0440 /sbin/ric'"
adb shell "su -c 'stop ric'"
adb shell "su -c 'busybox pkill -f /sbin/ric'"
adb shell "su -c 'mount -ro remount,rw /system'"
adb shell "su -c 'busybox cp -af /build.prop /system/build.prop'"
adb shell "su -c 'chmod 0744 /system/build.prop'"
adb shell "su -c 'rm /build.prop'"
adb shell "exit"
adb kill-server
what do you think?
Click to expand...
Click to collapse
Looks okay. Just keep in mind that the scripts are based on what is required for Sony tablets. Your device may require something a little different.
federimau said:
I think need to remove the first line?
adb wait-for-device
Click to expand...
Click to collapse
No. The "adb wait-for-device" command is what starts the adb server and causes the script to wait until the adb server detects a device before the next command in the script is issued.
Similar to the CheckDevice.bat file, you can insert the "@echo off" command at the beginning of your .bat files and the "pause" command just before the "adb kill-server" to cause the DOS command window stay open so you can see what is going on and the DOS command window will stay open until you press any key. Again, if the script hangs, press ctrl+c to abort the script and close the DOS command window, then open another DOS command window and issue the "adb kill-server" command to stop the adb server.
Cat McGowan said:
You need to solve that problem before you can do anything else. Find an xda-developers forum that deals with your device and look there for fixes for your device's drivers. I am confident I can help you with Sony tablet drivers, but not your device's drivers. I don't even know the model of your device.
Create and use the following CheckDriver.bat file to help you troubleshoot the drivers. The script simply opens a DOS command window, starts the adb server, then lists the devices the adb server finds. The DOS command window will stay open until you press any key. If the script hangs, press ctrl+c to abort the script and close the DOS command window, then open another DOS command window and issue the "adb kill-server" command to stop the adb server.
Code:
@echo off
echo Starting ADB server and waiting for device.
echo.
adb wait-for-device
adb devices
pause
adb kill-server
Looks okay. Just keep in mind that the scripts are based on what is required for Sony tablets. Your device may require something a little different.
No. The "adb wait-for-device" command is what starts the adb server and causes the script to wait until the adb server detects a device before the next command in the script is issued.
Similar to the CheckDevice.bat file, you can insert the "@echo off" command at the beginning of your .bat files and the "pause" command just before the "adb kill-server" to cause the DOS command window stay open so you can see what is going on and the DOS command window will stay open until you press any key. Again, if the script hangs, press ctrl+c to abort the script and close the DOS command window, then open another DOS command window and issue the "adb kill-server" command to stop the adb server.
Click to expand...
Click to collapse
I am working with all of you advices... i owe you a drink (if you agree!!!) Thanks
Cat McGowan said:
You need to solve that problem before you can do anything else. Find an xda-developers forum that deals with your device and look there for fixes for your device's drivers. I am confident I can help you with Sony tablet drivers, but not your device's drivers. I don't even know the model of your device.
Create and use the following CheckDriver.bat file to help you troubleshoot the drivers. The script simply opens a DOS command window, starts the adb server, then lists the devices the adb server finds. The DOS command window will stay open until you press any key. If the script hangs, press ctrl+c to abort the script and close the DOS command window, then open another DOS command window and issue the "adb kill-server" command to stop the adb server.
Code:
@echo off
echo Starting ADB server and waiting for device.
echo.
adb wait-for-device
adb devices
pause
adb kill-server
Looks okay. Just keep in mind that the scripts are based on what is required for Sony tablets. Your device may require something a little different.
No. The "adb wait-for-device" command is what starts the adb server and causes the script to wait until the adb server detects a device before the next command in the script is issued.
Similar to the CheckDevice.bat file, you can insert the "@echo off" command at the beginning of your .bat files and the "pause" command just before the "adb kill-server" to cause the DOS command window stay open so you can see what is going on and the DOS command window will stay open until you press any key. Again, if the script hangs, press ctrl+c to abort the script and close the DOS command window, then open another DOS command window and issue the "adb kill-server" command to stop the adb server.
Click to expand...
Click to collapse
Cat, i can not establish a stable and in-time connection between cell and PC...
type
adb wait-for-device
and never "see" the cell
i have the drivers upgraded
with usbview software i see the PC "see" the cell a short amount of time, then disconnects...
any advice??
federimau said:
Cat, i can not establish a stable and in-time connection between cell and PC...
type
adb wait-for-device
and never "see" the cell
i have the drivers upgraded
with usbview software i see the PC "see" the cell a short amount of time, then disconnects...
any advice??
Click to expand...
Click to collapse
Sounds to me your device simply is not responding to the adb server's attempt to connect. Again, my advice is for you to find an xda-developers forum that deals specifically with your device and look there for fixes for your device.
@Cat McGowan
Thank you for the info,
but it's not working on Recovery mode!
I try to backup and restore the build.prop file on cmd in recovery & in bootloop case.
working:
adb wait-for-device
adb pull /system/build.prop.bak or adb pull /system/build.prop
adb kill-server
not working push to the system: (even the cmd showing the opposite)
adb wait-for-device
adb push build.prop /system/build.prop
adb kill-server
I'm tring to resotre from PC or SD card...
(after changing the permission to system folder (instead only build.prop file) to 00644 the device keep get to Recovery mode! (with root browser app)
only flashing again the rom fix it.)
I got an error too:
- exec '/system/bin/sh' failed: Permission denied (13) -
by the way what Should to be on?
SuperSU or Superuser (ADB shell allow ?)
Developer Mode (Enable ADB ) +USB Debugging on
i'm worng what else?
I want to add some info:
I know the best way to edit this file only by : Notepad++ or EditPlus editor to preserve UNIX encoding
or Turbo Editor ( File Editor ) app.
read here:
http://forum.xda-developers.com/showpost.php?p=54970011&postcount=171
http://forum.xda-developers.com/showpost.php?p=55094822&postcount=203
and great script from user.
http://forum.xda-developers.com/showpost.php?p=55113422&postcount=208
will this work too on recovery or bootloops mode?
backup:
adb shell
su
mount -o remount,rw /system
cp /system/build.prop /system/build.prop.bak
mount -o ro,remount /system/ /system
----
restore:
adb shell
su
mount -o remount,rw /system
cp system/build.prop system/build.prop.bootloop
cp system/build.prop.bak system/build.prop
chmod 00644 system/build.prop
reboot
I've rooted my phone using Magisk
I want to enable/disable Wifi using a shell script
Enabling or diabling works fine using command below
adb -s <serial> shell "svc wifi enable"
But when i start a SSH session svc throws an "Aborted" error
# svc wifi enable
Aborted
Info:
# adb -s <serial> shell "whoami"
shell
# adb -s <serial> shell "which svc"
/system/bin/svc
# adb -s <serial> shell "which sh"
/system/bin/sh
Also tried logging in SSH as user "shell"
Why is svc giving this error, is there a way to fix this ?
ReMiOS said:
I've rooted my phone using Magisk
I want to enable/disable Wifi using a shell script
Enabling or diabling works fine using command below
adb -s <serial> shell "svc wifi enable"
But when i start a SSH session svc throws an "Aborted" error
# svc wifi enable
Aborted
Info:
# adb -s <serial> shell "whoami"
shell
# adb -s <serial> shell "which svc"
/system/bin/svc
# adb -s <serial> shell "which sh"
/system/bin/sh
Also tried logging in SSH as user "shell"
Why is svc giving this error, is there a way to fix this ?
Click to expand...
Click to collapse
I'm facing the same issue here, did you mage to solve it?
estevaofv said:
I'm facing the same issue here, did you mage to solve it?
Click to expand...
Click to collapse
Unfortunately not ...
i have no clue
Hello friend, I just found the solution:
export ANDROID_DATA=/data
just run the above command, it was an environment variable related issue, I found the solution on the link below:
Can not run some CMDs over SSH · Issue #12 · Magisk-Modules-Repo/ssh
PixelExperience_caf_whyred-9.0 Magisk 19.2 Can not run some su CMDs over SSH shell, but over ADB everything is OK The error gives a sign of 'Aborted' Have been using SSH-Module for some time now, s...
github.com
estevaofv said:
Hello friend, I just found the solution:
export ANDROID_DATA=/data
just run the above command, it was an environment variable related issue, I found the solution on the link below:
Can not run some CMDs over SSH · Issue #12 · Magisk-Modules-Repo/ssh
PixelExperience_caf_whyred-9.0 Magisk 19.2 Can not run some su CMDs over SSH shell, but over ADB everything is OK The error gives a sign of 'Aborted' Have been using SSH-Module for some time now, s...
github.com
Click to expand...
Click to collapse
It works now
Great Solution ! Thanks !
I've put it in my ~/.profile to load it automatically at login (using SSH magisk module)
I've upgraded to Android 10 after this svc just gave an rc =1
# svc
1|
# echo $?
1
Fixed is by adding this to my ~/.profile
export PATH=$PATH:/sbin
export ANDROID_DATA=/data
export ANDROID_RUNTIME_ROOT=/apex/com.android.runtime
export ANDROID_TZDATA_ROOT=/apex/com.android.tzdata
# svc
Available commands:
help Show information about the subcommands
power Control the power manager
data Control mobile data connectivity
wifi Control the Wi-Fi manager
usb Control Usb state
nfc Control NFC functions
bluetooth Control Bluetooth service
system-server System server process related command
I can ad hoc open any given Activity on the Android phone while connected over USB to adb on the Windows PC, but how do I DUPLICATE the SAME THING, but from the phone itself?
For example, how can I run this Activity, ad hoc, on the Android phone?
ACTION: "android.intent.action.MAIN"
PACKAGE: "com.google.android.gms"
CLASS: "com.google.android.gms.ads.settings.AdsSettingsActivity"
Click to expand...
Click to collapse
For illustrative purposes, below is a trivial example of ad hoc opening the "Reset Advertiser ID" Activity on the Android phone.
1. Install & test adb on your PC (I tested this only on Windows 10)
2. Connect your Android device over USB (mine is Samsung, Android 11)
3. Paste this command into a Windows command window:
C:\> adb shell am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity
That's just a trivial example where I can't yet figure out yet how to duplicate that popping up of a given Activity on the android phone for any given Activity, if all I know is the name of that given Activity (and which isn't already found in a static list inside of the shortcut creator apps).
Here are more examples I've tested for other Activities.
Code:
C:\> adb shell am start -n com.android.settings/.Settings
C:\> adb shell am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity
C:\> adb shell am start -n com.google.android.gms/.location.settings.LocationAccuracyActivity
C:\> adb shell am start -n com.android.settings/.applications.ManageApplications
C:\> adb shell am start -n com.google.android.gms/.update.SystemUpdateActivity
C:\> adb shell am start -n com.samsung.android.secsoundpicker/.SecSoundPickerActivity
C:\> adb shell am start -n com.android.settings/.Settings\$NotificationAppListActivity
C:\> adb shell am start -n com.android.settings/.Settings\$AppMemoryUsageActivity
C:\> adb shell am start -n com.android.settings/.Settings\$NotificationAppListActivity
C:\> adb shell am start -n com.android.settings/.Settings\$SecDisabledAppsActivity
C:\> adb shell am start -n com.android.settings/.Settings\$PowerUsageSummaryActivity
C:\> adb shell am start -n com.android.settings/.Settings\$AppAndNotificationDashboardActivity
C:\> adb shell am start -n com.google.android.gms/.app.settings.GoogleSettingsLink
C:\> adb shell am start -n com.google.android.gms/.app.settings.GoogleSettingsIALink
C:\> adb shell am start -n com.google.android.gms/co.g.Space
C:\> adb shell am start -n com.google.android.gms/.gcm.GcmDiagnostics
C:\> adb shell am start -n com.google.android.gms/.nearby.exposurenotification.settings.SettingsActivity
C:\> adb shell am start -n com.google.android.gms/.nearby.sharing.ContactSelectActivity
C:\> adb shell am start -n com.google.android.gms/.mdm.settings.AdmSettingsActivity
C:\> adb shell am start -n com.android.settings/.network.telephony.MobileNetworkActivity
After each command line above you can close the previous results using the adb command shown below (because you can't open an Android Settings Activity on top of an existing Android Settings Activity):
Code:
C:\> adb shell am force-stop com.android.settings
I'm well aware that we can create permanent homescreen shortcuts using shortcut creator applications; but this question is not about creating a homescreen shortcut for permanent access to Android Activities.
This question is how to instantly open ANY given Activity ad hoc (i.e., on a case-by-case basis) on Android whenever you want to - just from the name like we did above using adb (but without needing adb to do it).
Pack all the ADB commands listed in a Linux shell script ( means omitting "adb shell" part ), put this script into /data/local/tmp, make script executable and finally run this script in Terminal Emulator on phone.
jwoegerbauer said:
Pack all the ADB commands listed in a Linux shell script ( means omitting "adb shell" part ), put this script into /data/local/tmp, make script executable and finally run this script in Terminal Emulator on phone.
Click to expand...
Click to collapse
That worked! Thank you!
Below is my first testcase, which was the simple example of popping up the "Reset Advertising ID" Activity on Android when all you know is the unique name of the Activity.
This alias (which I named "resetadid") that worked first was:
$ alias resetadid='am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity'
This saves that alias into your bashrc file for safekeeping.
$ alias >> ~/.bashrc
To run that alias at the Android Termux command line, I just type:
$ resetadid
(which will pop up the named Activity on your phone)
Then I put that line into a shell script that I named "resetadid.sh"
$ am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity
And I put the following line into another shell script (named "closegms.sh") to close that gms (google mobile services) Activity.
$ adb shell am force-stop com.google.android.gms
Note for the shell scripts to work, I had to run these commands.
$ pkg install termux-exec
$ termux-fix-shebang ./resetadid.sh
Click to expand...
Click to collapse
This is the "./resetadid.sh" shell script that survives rebooting:
#!/data/data/com.termux/files/usr/bin/bash
am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity
To run that script at the Android Termux command line, I just type:
$ ./resetadid.sh
(that will pop up the named Activity on your phone)
Normally we won't need to close that Activity because resetting the advertising ID will close it when we hit the "reset" and "ok" buttons, but for now we need to close the Activity after we pop it up.
To that end is this temporary "closegms.sh" shell script.
#!/data/data/com.termux/files/usr/bin/bash
adb shell am force-stop com.google.android.gms
There are only two things left.
1. How to put that Termux command in a homescreen icon for free?
2. What to add to that shell script to actually press the "Reset" button?
Anyone know how to add a shell script to the Android homescreen?
Anyone know how to add a command to press the "reset" button?
Typically by long tapping on the home screen, you can create a shortcut to an existing script or add a live folder that contains all of your scripts.
BTW:
Termux is a Terminal Emulator what allows you to run ( Linux conformant ) Android Shell commands / scripts.
jwoegerbauer said:
Typically by long tapping on the home screen, you can create a shortcut to an existing script or add a live folder that contains all of your scripts.
Click to expand...
Click to collapse
Thanks for that advice which works to create, not a shortcut to a script, but a widget to a script (a shortcut would be nicer as it fits in homescreen folders).
It's not as simple as just long tapping because there is a ton of syntax involved, and the files have to be in critical directories, and even the version of Termux matters extremely greatly.
But it does work. Thanks.
So we can now create a homescreen widget that will bring up any given Activity if all we know is the Activity name!
I'll write it up in the next post.
jwoegerbauer said:
BTW:
Termux is a Terminal Emulator what allows you to run ( Linux conformant ) Android Shell commands / scripts.
Click to expand...
Click to collapse
The "right" Termux appears to be that on F-Droid and NOT the one on Google Play as documented elsewhere on the net, this being one link.
For this kind of shell scripts (to run Activities) do you think Andronix will help (Andronis is apparently Linux on top of Android along with Android without the need for rooting).
So we can now create a homescreen widget that will bring up any given Activity if all we know is the Activity name!
For anyone who reads this, may I ask that you please invest five minutes in testing this out and letting everyone here know how it works for you?
What I wrote below is designed so you can just follow the cookbook and you should end up with a widget on your homescreen which will open up to ANY named Activity (but I only give one example below) if all you know is the unique name of that Activity.
Install the F-Droid Termux
(Do not use the Google Play Termux!)
Install the F-Droid Termux:Widget
Start Termux on your Android device
All commands below are run on the Termux command line.
If you had to back out the Google Play Termux in favor of the F-Droid Termux, you'll want to re-create & re-test the alias to a simple Activity such as "Reset Ad ID" as explained earlier in this thread, just to test your syntax.
Re-create:
Code:
alias resetadid='am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity'
Re-test:
Code:
$ resetadid
Then re-create & re-test the shell script we previously described earlier in this thread.
Re-create:
Code:
#!/data/data/com.termux/files/usr/bin/bash
am start -n com.google.android.gms/.ads.settings.AdsSettingsActivity
Re-test:
Code:
$ ./resetadid.sh
Now we're ready to put that command on your homescreen!
Create two directories which are defined in the Termux-Widget help.
Code:
$ mkdir -p $HOME/.shortcuts
$ mkdir -p $HOME/.shortcuts/tasks
Note I'm not sure what the "tasks" directory is for but Termux:Widget docs say to create it.
Move the shell script you created earlier into the $HOME/.shortcuts directory.
Code:
$mv ~/resetadid.sh $HOME/.shortcuts/.
Add the Termux Widget to your homescreen.
Long press your Android homescreen.
Select "Widgets"
Select "Termux:Widget"
Place that "Termux:Widget" on your Android homescreen
Click to expand...
Click to collapse
Depending on your Android version...
It will ask:
"Create widget and allow access?"
To which you press "Yes" to put your widget on the homescreen.
Click to expand...
Click to collapse
To interact with the now-running widget, just press the named entry showing up in that Termux Widget.
Code:
resetadid.sh
Depending on your Android version...
It may ask: "Termux requires "Display over other apps" permission
to start terminal sessions from background on Android >=10."
"Grants it from Settings -> Apps -> Termux -> Advanced" [sic]
Click to expand...
Click to collapse
If needed, grant Termux permission to display over other apps:
Code:
Android11:Settings > Apps > Your apps > Termux > Appear on top = (change off to on)
Now you can press the always running Termux:Widget icon on your homescreen to bring up the desired Activity.
Does this work for you to bring up the named Activity on Android with the only thing you know being the unique Activity name?
If so, here's what's left that I know of:
a. Figure out how to add a step to actually press the "Reset" button!
b. Figure out how to use a shortcut instead of an always-running widget (which can't be placed inside a homescreen folder)
c. Figure out how to run this automatically such as when there is a screen unlocking event.
--
Notes: Keep in mind the goal is to be able to interact with ANY known Android Activity using only freeware (so that everyone can do it); resetting the ad id is just one of the simplest examples.
Interested users can try this on the "Show Running Services" Activity (e.g., for implementing a "ps -aux|kill -9" shortcut).
Hey,
whenever I issue a reboot command via adb to a device that is connected via network / tcp, adb freezes (I guess because it waits for the response to the command that never arrives because the device is offline). Regardless if I use "adb reboot" or "adb shell reboot" ... I tried delaying the reboot with sleep and spawning it separately with & but nothing worked...
Code:
adb shell "sleep 5 &"
adb shell "(sleep 5) &"
adb shell "(sleep 5 &)"
It always waits until execution finished...
Any ideas?
If you invoke the SLEEP command it gets processed - even if forced to get processed in background.
FYI: Running a command in background simply means a user-interaction isn't possible.
jwoegerbauer said:
If you invoke the SLEEP command it gets processed - even if forced to get processed in background.
FYI: Running a command in background simply means a user-interaction isn't possible.
Click to expand...
Click to collapse
Yeah, but when I execute "sleep 5" within the shell, I cannot do anything until sleep finished. When I execute "sleep 5 &" within the sell, I can immediately enter the next command.
Same is NOT true with adb shell. Both "adb shell sleep 5" and "adb shell sleep 5 &" wait until sleep finish.
Of course I want "sleep" to execute in background. I want to execute "sleep 5 && reboot &" so adb has time to read the response and I can execute "adb disconnect" on the host before the device reboots.
Each
Code:
adb [-d|-e|-s <serialNumber>] shell "<shell_command>"
invokes a separate ( new ) terminal session and waits for this session has finished
To get around this open a remote shell, means invoke a terminal session only once and execute the commands desired
Code:
adb [-d|-e|-s <serialNumber>] shell
<shell_command>
exit
I'm sorry but I don't understand what u mean by that :/
I want to run this on my host:
Code:
adb command_that_will_reboot_connected_device_in_5_sec_without_blocking
adb disconnect
...
Any solutions for that?
If BusyBox is installed on device's Android, and if BusyBox has commands crond & crontab & reboot implemented, then you can create on Android a scheduled task to reboot Android by means of crontab
Example ( untested ) what re-boots Android in 1 minute:
Code:
adb shell
mkdir -p '/data/local/tmp/cron'
echo */1 * * * * reboot > /data/local/tmp/cron/crontab
busybox crond -c /data/local/tmp/cron
busybox crontab -c '/data/local/tmp/cron/' '/data/local/tmp/cron/crontab'
exit
Well, that sounds pretty overkill...
Found a solution... I moved the problem to the host by spawning the "hanging" adb process seperately (using windows in this case):
Code:
start adb reboot
timeout /t 3
adb disconnect
...