[CLOSED] how can i change dumpsys configuration by adb shell - Android Developer Previews

I was wondering if there is any way to change a dumpsys config of the adb shell like when I use dumpsys power there at the end there is a configuration called ambientDisplaySuppressed=false and I wanted to know if you can change it and leave it true or any other config

Charmoso said:
I was wondering if there is any way to change a dumpsys config of the adb shell like when I use dumpsys power there at the end there is a configuration called ambientDisplaySuppressed=false and I wanted to know if you can change it and leave it true or any other config
Click to expand...
Click to collapse
@Charmoso Thread closed as duplicate of
how can i change dumpsys configuration by adb shell
I was wondering if there is any way to change a dumpsys config of the adb shell like when I use dumpsys power there at the end there is a configuration called ambientDisplaySuppressed=false and I wanted to know if you can change it and leave it...
forum.xda-developers.com
Please review the XDA Forum Rules with special emphasis on rule no. 5 and post only ONCE! Thanks for your cooperation.
Regards
Oswald Boelcke
Senior Moderator

Related

[IMPROVED FIX] ADHOC Mode with scripts to switch between ADHOC and Infrastructure

This -> View attachment adhoc-switcher.zip <- archive includes the modified wpa_supplicant file that supports ADHOC mode, along with scripts to switch back and forth between the ADHOC mode wpa_supplicant and the stock (Infrastructure only) wpa_supplicant on your NC.
The included file adhoc-switcher.sh is will do all of the work for you.
From the included README file:
Unzip the archive View attachment adhoc-switcher.zip into the same directory as your adb binary.
Execute ./adhoc-switcher.sh in your adb binary directory.
# md5sum adhoc-switcher.zip
e682e1578df1a253f1e4c42fd89f37d5 adhoc-switcher.zip
When you run adhoc-switcher.sh, you will see the following output telling you what it is doing:
Code:
$ ./adhoc-switcher.sh
(1) Remounting /system as read-write...
(2) Making backup of original wpa_supplicant at:
/system/bin/wpa_supplicant.original...
(3) Making local backup of /system/bin/wpa_supplicant.original...
2070 KB/s (226036 bytes in 0.106s)
(4) Pushing up new files to /system/bin/...
wpa_supplicant.adhoc: 1662 KB/s (226028 bytes in 0.132s)
wpa_supplicant.infrastructure: 1711 KB/s (226036 bytes in 0.128s)
ap: 6 KB/s (271 bytes in 0.042s)
adhoc: 6 KB/s (253 bytes in 0.040s)
(5) Setting permissions on new files in /system/bin/...
(6) Setting Wifi mode to Infrastructure (ap)...
(7) Remounting /system as read-only...
All done!
To switch between Access Point (AP) [Infrastructure] mode and ADHOC mode,
execute the following commands on your NC:
# su
# ap
To switch to Access Point [Infrastructure] mode, execute the following
commands on your NC:
# su
# adhoc
You should turn off wifi before executing these commands.
Hope you find this useful.
John - your friendly neighborhood e-thug.
Thank you. Will give this a try.
Any chance of anyone creating a toggle widget that can toggle between both with a simple tap.
Sent from my SGH-T959 using XDA App
Very nice John. Good quick fix for the adhoc switching. Appreciate the effort.
Sent from the totally awesome Rooted Nook Color
rxr said:
Thank you. Will give this a try.
Any chance of anyone creating a toggle widget that can toggle between both with a simple tap.
Sent from my SGH-T959 using XDA App
Click to expand...
Click to collapse
I'd love to do that but, my netbook just isn't up to the task of running a full-on android dev environment. Over Christmas, I'll try to remember to bring the "big" laptop back with me.
If someone else beats me to it, that would be great too.
Maybe we could get the SoftKeys app to allow a new button to appear to toggle the wifi setting?
johnopsec said:
This -> View attachment 464007 <- archive includes the modified wpa_supplicant file that supports ADHOC mode, along with scripts to switch back and forth between the ADHOC mode wpa_supplicant and the stock (Infrastructure only) wpa_supplicant on your NC.
Click to expand...
Click to collapse
Hey there, Mr. eThug. Thanks for the update. But I didn't it was necessary. After installing the original fixed wpa_supplicant, I can connect to adhoc and infrastructure networks. Or is there something else I'm missing?
edison said:
Hey there, Mr. eThug. Thanks for the update. But I didn't it was necessary. After installing the original fixed wpa_supplicant, I can connect to adhoc and infrastructure networks. Or is there something else I'm missing?
Click to expand...
Click to collapse
The ADHOC capable wpa_supplicant has a bug that requires you restart wifi any time the NC sleeps. The original does not. Since my personal use is with standard Infrastructure (AP) connections primarily and ADHOC only on occasion, I decided that it would be handy to be able to switch between them easily.
You have a typo in the script, line 28 I think, should be "adb shell" and you have "db" shell.
Messes with permissions.
KitF said:
You have a typo in the script, line 28 I think, should be "adb shell" and you have "db" shell.
Messes with permissions.
Click to expand...
Click to collapse
I just verified from my local copy and also downloaded the archive I uploaded to the site. They're identical and in every instance, it is "./adb shell" just as it should be.
Any possibility you opened adhoc-switcher.sh in an editor and accidently deleted a character? Other than that, the MD5SUM of the original archive is:
# md5sum adhoc-switcher.zip
e682e1578df1a253f1e4c42fd89f37d5 adhoc-switcher.zip
Make sure that the MD5SUM matches for what you downloaded.
Oh that's right, I must have messed it up somehow converting it into a windows Batch file.
Any way we can get some sort of GUI app or a widget toggle for this? Seems like it would be handy for when I need to tether to my phone when there's no wifi around.
KitF said:
Oh that's right, I must have messed it up somehow converting it into a windows Batch file.
Any way we can get some sort of GUI app or a widget toggle for this? Seems like it would be handy for when I need to tether to my phone when there's no wifi around.
Click to expand...
Click to collapse
Cool. Glad we tracked that down!
I'd love a widget or app to switch between them. Two things though... This is a temporary "fix" for an issue. Once they get the bugs worked out of wpa_supplicant so it can support Infrastructure and ADHOC and not have the sleep issue, we won't need to switch back and forth between them. Second: I don't have a full-blown android dev platform to do an app or widget myself so, someone else would need to do it.
Maybe using gscript lite as was done here : http://www.chinadigitalcomm.com/android-a81/a81e-connect-to-ad-hoc-wifi-t1413-10.html
I suppose running sh scripts doesn't work on Windows?
nikescar said:
I suppose running sh scripts doesn't work on Windows?
Click to expand...
Click to collapse
Nope. But if you're up to the task, it should be easy for you to convert the script to winblowz .bat format for the most part.
I tried to modify the scripts to run through gscript and I thought it worked initially. Then when I went to switch it waste my wifi. Had to restore from the backup.
Gscripts would be nice I'm just not smart enough to do it.
Did you switch Wifi off before switching?
Also here's my converted .bat that I used:
Code:
echo
echo "(1) Remounting /system as read-write..."
adb shell "mount -o remount rw /system"
echo
echo "(2) Making backup of original wpa_supplicant at:"
echo "/system/bin/wpa_supplicant.original..."
adb shell "mv /system/bin/wpa_supplicant /system/bin/wpa_supplicant.original"
echo
echo "(3) Making local backup of /system/bin/wpa_supplicant.original..."
echo
adb pull /system/bin/wpa_supplicant.original
echo
echo "(4) Pushing up new files to /system/bin/..."
echo
echo -n "wpa_supplicant.adhoc: "
adb push wpa_supplicant.adhoc /system/bin/
echo -n "wpa_supplicant.infrastructure: "
adb push wpa_supplicant.infrastructure /system/bin/
echo -n "ap: "
adb push ap /system/bin/
echo -n "adhoc: "
adb push adhoc /system/bin/
echo
echo "(5) Setting permissions on new files in /system/bin/..."
adb shell "chmod 755 /system/bin/wpa_supplicant.*"
adb shell "chmod 755 /system/bin/ap"
adb shell "chmod 755 /system/bin/adhoc"
echo
echo "(6) Setting Wifi mode to Infrastructure (ap)..."
adb shell "ln -s /system/bin/wpa_supplicant.infrastructure /system/bin/wpa_supplicant"
echo
echo "(7) Remounting /system as read-only..."
adb shell "mount -o remount,ro /dev/block/mmcblk0p5 /system"
echo
echo "All done!"
echo
A bit messy but it works.
KitF said:
Did you switch Wifi off before switching?
Click to expand...
Click to collapse
Thanks for the bat.
What I was trying to do is modify the scripts to run through the gscripts app for Android. That way we could switch on the go a bit easier. Sure I could use a console emulator but one click (actually two) is what I was looking for.
I might give it a try later, the .sh files available here http://www.chinadigitalcomm.com/android-a81/a81e-connect-to-ad-hoc-wifi-t1413-10.html can be opened with a text editor and it looks like the command just "crushes" the file.
I can see the ad-hoc network created by my phone and I connect. But none of the web-based apps are working. Says I am connected but no data comes through. Any ideas?
The .bat file is a good idea.
I factory reset my Nook again (tried to return it for one that flickers less). I had to go through this again. I was distracted when going through the commands and had mucked something up - Wifi wouldn't start back up at all after I tried to switch back and forth. But I knew it worked because I had it working yesterday.
Poked my head in and checked security (ls -l /system/bin) , I could tell the security of the files didn't match. Looks like I missed one or two of the chmod commands (kids were probably distracting me). Fixed 'em up and it's working fine now.
At least with a .bat file or the like, there's less chance for a typo.

[ROOKIE][DEV][HOWTO] Permenant BN-OTA Update Block

From this thread:
http://forum.xda-developers.com/showthread.php?t=874871
Attached is a working sqlite3 binary.
Copy it to /system/bin
(I transfered it to my SD, then used rootexplorer (mount R/W) to copy into /system/bin))
you will now be able to edit sqlite databases on the nook itself.
--------------------------------------------------------------------------------
Attached Files sqlite3.7z (11.9 KB, 56 views)
--------------------------------------------------------------------------------
In your terminal:
$ adb pull /data/data/com.bn.devicemanager/databases/devicemanager.db devicemanager.db
$ sqlite3 devicemanager.db
sqlite> update registry set value='manual' where name='com.bn.device.fota.mode';
sqlite> .q
$ adb push devicemanager.db /data/data/com.bn.devicemanager/databases/devicemanager.db
$ adb reboot
Congrats Your NC is now permanently blocked from any future BN OTA auto updates.
No more build.prop spoof hacks for each release (sideload only),,,,,, yada yada
sleep like a baby.........with yur wifi on.
Nook got pissed and reset itself. Good thing I have backups.
bonzer2u, thanks! Just did it on my rooted (1.0.1 version) nook and so far no issues.
That reminds me that the prereqs are you need to be rooted with SU and ADB working.....DOH
Jeeeez and of course credit where credit is due...
JoshMiers - for providing the sqlite3 binary post.
and
ixampl - for providing the clues that lead me to find the appropriate db and setting to hack.
Finally, disclaimer: Apply and/or feel free to incorporate into your projects at your own risk, if your NC self distructs, yur on yur own......NOT
Instructions don't use sqlite3 binary on device
Your instructions work fine assuming that the computer connected to the NC has the sqlite3 binary installed. The sqlite3 binary you link to could be used to make the changes inside adb shell but it's not documented as such. Just wanted to give that note to help clear up anyone's confusion if they run into issues with the given instructions. Other than that, thanks for the tip!
The sqlite3 binary I posted is for use on the Nook itself. If you want to do that instead of doing adb pull/push just do this in an adb shell:
Code:
# sqlite3 /data/data/com.bn.devicemanager/databases/devicemanager.db
sqlite> update registry set value='manual' where name='com.bn.device.fota.mode';
sqlite> .q
# reboot
JoshMiers said:
The sqlite3 binary I posted is for use on the Nook itself. If you want to do that instead of doing adb pull/push just do this in an adb shell:
Code:
# sqlite3 /data/data/com.bn.devicemanager/databases/devicemanager.db
sqlite> update registry set value='manual' where name='com.bn.device.fota.mode';
sqlite> .q
# reboot
Click to expand...
Click to collapse
Easier then I thought, thanks again Josh....
hoban_eris said:
Your instructions work fine assuming that the computer connected to the NC has the sqlite3 binary installed. The sqlite3 binary you link to could be used to make the changes inside adb shell but it's not documented as such. Just wanted to give that note to help clear up anyone's confusion if they run into issues with the given instructions. Other than that, thanks for the tip!
Click to expand...
Click to collapse
If I understand you correctly, my PC is a dell win7-32 laptop and it doesn't have any sqlite3 installed binary on it? I did however use it to download and transfer the sqlite3 binary Josh posted to my nook??
Yes Josh mentioned the adb shell version above.
I did initially forget to mention you need to be rooted and have SU and ADB functioning as a prereq, my bad, but it is pretty obvious.....
If you have adb working on your PC, the chances are that you have sqlite binary on your PC since it seems to come with the android sdk in the tools folder (for example, android-sdk_r07-windows\android-sdk-windows\tools). When I did it on mine, I used the commands from the OP, and did it on the PC with nook connected, but didn't use the linked sqlite3 binary for nook).
droidseban said:
If you have adb working on your PC, the chances are that you have sqllite binary on your PC since it comes with the android sdk in the tools folder (for example, android-sdk_r07-windows\android-sdk-windows\tools). When I did it on mine, I followed your directions, and did it on the PC with nook connected, but didn't use the linked sqllite3 binary for nook).
Click to expand...
Click to collapse
Ahh I see now and didnt know that... I understand what you guys are referring to now.
Thanks for clearing that up, like my post title suggests, still just a rookie with the nook that is.....
We are all here to learn from each other.
Looking through the rest of the entries in the registry table, there is this entry: "com.bn.device.fota.next_connect_default_interval" which is set to the value 604800000. Assuming this is in milliseconds as usual, it translates to 7 days. So, nook is set to check for updates once every week. I guess you can try upping this number also to avoid the updates.
Adding a command to raise the udate check interval to a year to the steps from OP (NOTE: no space in "...default_interval". Not sure why the forum software is inserting it):
$ adb pull /data/data/com.bn.devicemanager/databases/devicemanager.db devicemanager.db
$ sqlite3 devicemanager.db
sqlite> update registry set value='manual' where name='com.bn.device.fota.mode';
sqlite> update registry set value='31557600000' where name='com.bn.device.fota.next_connect_default_interval';
sqlite> .q
$ adb push devicemanager.db /data/data/com.bn.devicemanager/databases/devicemanager.db
$ adb reboot
excellent, did you notice the download URL in the table as well?????
Someone suggested another way to perma-stop OTA would be to add the url
https://csqaint.barnesandnoble.com/bncloud/serviceG 127.0.0.1
to our hosts file?
Do you think this would work as well?
I would think so, but it might crash the process that checks for the updates.
bonzer2u said:
Someone suggested another way to perma-stop OTA would be to add the url
https://csqaint.barnesandnoble.com/bncloud/serviceG 127.0.0.1
to our hosts file? Do you think this would work as well?
Click to expand...
Click to collapse
No -- the hostname csqaint does not resolve outside BN.
I don't think it is directly going to https://csqaint.barnesandnoble.com/bncloud/serviceG. My guess is Nook goes to https://bncs.barnesandnoble.com/bncloud/oauthpage/BnOAuthMgmt.jsp to authorize the connection, establishes a VPN, and then move on to https://csqaint.barnesandnoble.com/bncloud/serviceG.
bonzer2u said:
From this thread:
http://forum.xda-developers.com/showthread.php?t=874871
Attached is a working sqlite3 binary.
Copy it to /system/bin
(I transfered it to my SD, then used rootexplorer (mount R/W) to copy into /system/bin))
you will now be able to edit sqlite databases on the nook itself.
--------------------------------------------------------------------------------
Attached Files sqlite3.7z (11.9 KB, 56 views)
--------------------------------------------------------------------------------
In your terminal:
$ adb pull /data/data/com.bn.devicemanager/databases/devicemanager.db devicemanager.db
$ sqlite3 devicemanager.db
sqlite> update registry set value='manual' where name='com.bn.device.fota.mode';
sqlite> .q
$ adb push devicemanager.db /data/data/com.bn.devicemanager/databases/devicemanager.db
$ adb reboot
Congrats Your NC is now permanently blocked from any future BN OTA auto updates.
No more build.prop spoof hacks for each release (sideload only),,,,,, yada yada
sleep like a baby.........with yur wifi on.
Click to expand...
Click to collapse
I like your method better than spoofing the build.prop of 1.1.
Would it be okay with you if I make this into a Clockwork update.zip ?
thecubed said:
I like your method better than spoofing the build.prop of 1.1.
Would it be okay with you if I make this into a Clockwork update.zip ?
Click to expand...
Click to collapse
Absolutely and goes for anyone it might be useful for......
I dont get sqlite 2
Hi All,
Noob quiestion,
I go in adb shell promt "#" by typing "adb shell" in command line.
when I type sqlite3 I get "sqlite3 : not found"
Am I missing anything?

How to find "getprop" parameter location

Looking to see if there's a terminal/adb command to find where exactly a "getprop" parameter's location resides?
Basically I need to find where the parameter
Code:
dolby.ds.virt.bluetooth off
resides so I can change the output to
Code:
dolby.ds.virt.bluetooth on
.
I looked in the build.prop, su.d, and other folders without any luck. I used the setprop command to enable it, rebooted and it didn't stick. I then added it to my /system/su.d setprop folder, and all other commands stuck BUT that particular one....? So it's getting turned back off somehow, from some other location I can't find?
Any help is appreciated!:good:
Bump? Tried a bunch of shell commands, best so far is "pm path #command# /sdcard/titties" ? No error, but outputs nothing....

Does rooting work on logic L61 smartphones?

Good day, I would like to know how to go about rooting a logic L61 smartphone seeing as it isn't listed in rooted devices section. Is it possible that the phone gets bricked while being rooted, does it support root? I just want to be able to increase my display colour saturation, which is very dull for some reason, but I need root access. Please and thank you for your help.
You may consider to temporarily root phone's Anndroid what has no side-effects.
jwoegerbauer said:
You may consider to temporarily root phone's Anndroid what has no side-effects.
Click to expand...
Click to collapse
How do I temporarily root?
Ricardo Paddyfoot said:
How do I temporarily root?
Click to expand...
Click to collapse
To give you an idea how this can get achieved here excerpt of one of my Windows CMD-scripts
Code:
set and_arch=64 & set retval=
for /f %%a in ('!adb! shell "getprop ro.product.cpu.abilist64"') do ( set retval=%%a )
if [!retval!]==[] ( set and_arch=32 )
set su_binary=%CD%\SU-Binaries\ARM\!and_arch!\su
if not exist "!su_binary!" ( echo !su_binary! not found & goto :end )
!adb! shell "mkdir -p -m644 !data_partition!/local/tmp"
!adb! shell "mkdir -p -m644 !data_partition!/local/etc"
!adb! push !su_binary! !data_parttion!/local/tmp/ >nul
!adb! shell "chmod 0755 !data_partitio!/local/tmp/su"
As you may realize the SU-binary is simply copied into Android, can then be used immediately.
Thanks for the help, I was trying to use magisk to root my phone (android 10) however my device is not supported for twrp so I can't install it, Is there any other way to root android 10? Also I don't have a PC and have zero coding knowledge. I would be so happy if I could just use the sa2ration app.
Would also love to do this but need guidance. I have a PC. So I just need pointing in the right direction...

How to duplicate what adb does to ad hoc open any given Activity on the Android phone?

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).

Categories

Resources