Keep USB debugging enabled while disabling "Allow USB debugging" prompt (6.0)? - Android Q&A, Help & Troubleshooting

Keep USB debugging enabled while disabling "Allow USB debugging" prompt (6.0)?
I copy the same public/private key pair on all computers I use to adb into my phone. I know how to make adbd start listening on tcp on boot, but it's not safe because in my network, my phone gets a public IP address, and I could get a storm of auth requests..
How can I force Android to not display that prompt anymore?

Related

[TUT] ADB over WI-FI

ADB over Wi-Fi​Some of us might like to connect the device over WiFi for debugging, instead of using the data cable. Here's the required tutorial to do so
Requirements
1. Android device (duh!!!)
2. ADB in the computer (again duh!!!)
3. Root privileges
4. Terminal emulator (download from here)​
Let's begin then​Open terminal emulator on your device. Enter the following code
Code:
su [color="red"]Grant superuser here[/color]
setprop service.adb.tcp.port 5555 [color="red"]Can be anything else[/color]
stop adbd
start adbd
Check it with this
Code:
getprop service.adb.tcp.port
It will return 5555 or the number you entered in the above code​
Enter the following code on your computer in command prompt or shell
Code:
adb connect 192.168.0.151
Instead of 192.168.0.151, enter your device IP address​
To make your device listen on USB again, just restart the device. And enter the code on your computer
Code:
adb usb
I would definitely use the USB cable to push large files or even small files that you really don't want to risk corrupting (partition images you plan on dding, etc).
Very importantly, keep in mind, when your phone is listening for adb via WiFi, it's wide open... anybody that has adb installed and knows your device's IP address can access it without a password. Again, a simple reboot will turn it off though.​
Credits
JeepFreak for this post in the One X forum​
Reserved
Reserved for app​
I want to thank the OP, however belatedly, for writing these root instructions for users to connect their PC and phone via adb over Wi-Fi without USB cables being involved.
As the OP is well aware, non-rooted Android 10 and below allowed wireless adb connections AFTER a USB connection was first established (adb start-server && adb tcpip 5555 && adb connect [IP]:5555), but that changed (for the better) in Android 11 and above with the new new Developer options Wireless debugging random port assignments (adb connect [IP]:[PORT] or adb pair [IP]:[PORT] [PIN]) such that the adb wireless connection never needs USB cable ever again.
Given Android 11 allows Developer options Wireless debugging via a random port, and Android 12 new Developer options Wireless debugging allows that to be accessed even easier with a new Developer options Wireless debugging tile, the only thing missing is a way to get, after the fact, the random port assignment that Android uses for the adb wireless connection to your PC.
Some related threads for reference might be...
[adb,scrcpy,vysor] What ports does Android 12 randomly set when Wi-Fi connecting via Wireless debugging adb "pair" or "connect" commands?
(PSA) Using the new Android 12 TILE for 'Developer options' 'Wireless debugging' to establish adb connection over Wi-Fi without USB
What's the difference between Windows/Android adb "connect" versus adb "pair" when mirroring Android 12 over Wi-Fi onto a Windows PC?
The only question that's missing an answer preventing a perfect completely Wi-Fi automatic solution is...
Does anyone know how to obtain that random Android port address from the PC?

adb Unauthorized except in 5.1.1

I currently have 5.1.1 installed on my honor 5x and am able to use adb automatically without accepting an RSA prompt (have installed twrp, rooted, etc.) but when I dload a MM stock rom and use usb debugging it is unauthorized and I get no RSA prompt I've even gone as far as to delete /data/misc/adb from my device and adbkey.pub from my desktop but there is still no pop up authorization in MM
Developer options -> Revoke authorisation (something like that), replug. If that doesn't help, change connection mode to file transfer and try again.
ShadySquirrel said:
Developer options -> Revoke authorisation (something like that), replug. If that doesn't help, change connection mode to file transfer and try again.
Click to expand...
Click to collapse
I actually don't have a "revoke authorization" button below usb debugging, odd I know but I've tried all those options to no avail
Tsunetoma said:
I actually don't have a "revoke authorization" button below usb debugging, odd I know but I've tried all those options to no avail
Click to expand...
Click to collapse
Tried toggling the debugging switch? I had issues like these on one of my previous devices, but usually these were fixed with a simple port change or debug off/on switch, if revoke->replug didn't work.
Have you checked drivers, or if dmesg says something about the device, if you're on Linux? Sometimes even running multiple adb instances (like one from terminal and one from Android Studio, for example) can cause this behviour.
Enable rsa key authentication

How to enable ADB in AOSP user build?

Device: Nexus 6P
ROM: AOSP android-8.1.0_r1 branch
I am having trouble connecting to adb due to error "device unauthorized" error. The device authorization works fine in "user-debug" angler build, but not "user" angler build.
I have tried "common" solutions outlined in stackoverflow[https://stackoverflow.com/questions/23081263/adb-android-device-unauthorized], none of which works for me.
None working solutions:
1. Switched usb connection mode to PTP or MIDI
2. Revoking USB Debugging on phone, no such option on the ROM in the debugging section
3. Restart adb server
4. Toggling usb debugging options
5. Regenerated adb keys (%HOME%/.android contains adbkey.pub and adbkey key pair file), adb-kill server, then try reconnecting
6. Delete adb keys, adb-kill server, then try reconnecting adb
Any tips?
bump?
2 characters
2 characters

[SOLVED] Help needed using adb to curb crazy Wi-Fi data usage by Google

Hi all,
First of all, many apologies because I imagine that my situation below has been discussed here many times. TL;DR section at the bottom.
I have been trying to use adb to set an option on my Redmi Note 5 phone, to no avail. For the background of why I need that: I have arrived yesterday at my travel destination and I've realized that the app named "Google" has used over 2.24 GB of Wi-Fi data as reported by data usage in the Security app. In less than 24 hours! I've also installed and used the app Network Connections. All of this was in an effort to control the high bandwidth speed I was seeing in the notification bar (over 100 KB/s for minutes, without interruption). I have restricted network usage for all applications on Wi-Fi as well as on mobile data, disabled Sync (all forms of sync, believe me), and done everything I could think of to prevent the huge Wi-Fi usage, including rebooting the phone each time I changed a setting. The "Test Network" tile in Security still shows that about 100% of the bandwidth usage is by "Google" app. 90% of that usage is downloads and I can't figure out what Google is downloading to my device, which I've been using for a year without ever connecting it to a Wi-Fi network, until yesterday. Somehow, on my Redmi Note 5 running MIUI 11, "Wi-Fi" is equated to "unlimited network, with no cap, and no reason to be reasonable".
The root problem is that the Wi-Fi I'm connecting to is metered, and apparently, MIUI has removed the underlying Android option to set a Wi-Fi connection as metered. The solution, as I've discovered online is to issue an adb command (cmd netpolicy set metered-network <name of network> true).
Therefore, I head to using adb. Many pages online deal with enabling Developer Options and US debugging, and I had already done just that in the past.
However, in the instructions on using adb, each such page speaks at a certain point in the list of instructions of a dialog box that is supposed to show up on the phone ("Allow USB debugging?" with something about a computer fingerprint), but it never showed up on my device. The command adb devices does not list anything, not even in a command line opened as an administrator. The adb executable that I'm using is from the Android Platform Tools (platform-tools_r29.0.5-windows.zip).
Many forum pages hint to a missing driver. But I can easily plug the phone via USB and download files and photos from the phone to the computer. If it was a driver issue, shouldn't I have problems doing file transfers?
Moreover, each time I plug the phone via USB, I see a notification from "Android system" stating "USB debugging connected" followed by "Tap to turn off USB debugging", which tells me that USB debugging is working.
TL;DR
adb devices lists nothing when my Redmi Note 5 is connected via USB. I guess it's a driver issue. How can I get the appropriate driver? I would like to avoid downloading sketchy driver packs from random websites such as the ones from xiaomi advices (e.g. the "driver" for Redmi Note 5 was uploaded on October 5, 2014!!!).
Thank you.
do you already set enable usb debugging on developer setting?
You can try to install Xiaomi Mi PC Suite on your PC, after the installation, open the program and connect your phone with the USB cable, that will install the correct drivers, I hope. Then you can close the program and activate USB debugging in Developer Options in your phone, and try again to write the command in the terminal.
EriecTan said:
do you already set enable usb debugging on developer setting?
Click to expand...
Click to collapse
Yes. Both the plain "USB debugging" and the "USB debugging (Security settings)".
openCode168 said:
You can try to install Xiaomi Mi PC Suite on your PC, after the installation, open the program and connect your phone with the USB cable, that will install the correct drivers, I hope. Then you can close the program and activate USB debugging in Developer Options in your phone, and try again to write the command in the terminal.
Click to expand...
Click to collapse
Well, I have installed PC Suite 2.2.0.7032 to no avail: when I connect the phone via USB, a PC suite window shows up and says "Looks like you're missing some drivers... Make sure you're this system's administrator", which I am. I can't believe that in this day and age it is so difficult to find official drivers for a device that's been sold by the thousands.
Thanks for your help.
OMFG, I did it!
Before I say anything more: I have uninstalled Mi PC Suite.
The solution is in the mode that is active in the notification shade once the phone is connected via USB to the computer. In the notification shade, there was a notification from Android system that read "Charging this device via USB, tap for more options". Once I tapped and chose "File transfer", things changed!
At the same time, the Device Manger had been opened on the computer an I was seeing a yellow overlay icon over "SDM636-MTP _SN:xxxxx" in category "Other devices". As soon as I chose "File transfer", the device "SDM636-MTP" disappeared and a new category "Android Phone" showed up, along with a subcategory that read "Android Composite ADB interface". The "ADB" in the title prompted me to try using adb. That's when it all worked! Here is a transcript of the command line session, during which at some point I got (on the phone) a dialog box about authorizing the computer, also showing an RSA fingerprint. I obviously authorized the computer :
Code:
Microsoft Windows [version 6.3.9600]
(c) 2013 Microsoft Corporation. Tous droits réservés.
D:\Programs\adb>adb devices
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
fce3c2e3 unauthorized
D:\Programs\adb>adb devices
List of devices attached
fce3c2e3 device
D:\Programs\adb>adb shell
whyred:/ $ cmd netpolicy list wifi-networks
waav19781502;none
WI-FI HOME;none
whyred:/ $ cmd netpolicy set metered-network "WI-FI HOME" true
255|whyred:/ $ cmd netpolicy list wifi-networks
waav19781502;none
WI-FI HOME;true
whyred:/ $
So the problem was not about drivers like I thought and complained about, it was about choosing the appropriate mode once the phone is connected to a computer via USB.
I'll see now whether setting the Wi-Fi networks as metered will be enough to stop Google from using up the data allowance.
EDIT: Setting the network as metered did the trick: what was previously hovering well above 100 to 200 KB/s is now around 0.05 - 3.00 KB/s, due this time not to "Google" but to "Google Services Framework" and "Google Play Store"

Android 12 Developer options adb "Wireless debugging" option keeps turning off

The Android 12's new features for 'Developer options' 'Wireless debugging' is fantastic because you never need a USB cable anymore to connect between the PC and the Android phone using adb (e.g., when using Vysor or scrcpy).
However, I am CONSTANTLY having to turn the Developer options for "Wireless debugging" back on because that Developer option for Wireless debugging goes from ON to OFF (and stays off) every time the Wi-Fi is turned off on the phone.
Is there any way to keep the Developer option for Wireless debugging on?
GalaxyA325G said:
Is there any way to keep the Developer option for Wireless debugging on?
Click to expand...
Click to collapse
Hello and good afternoon, @GalaxyA325G
Prior to your next posting please read the guidances that are stuck on top of every forum like
[Read Before Posting]QUESTIONS DO NOT BELONG IN GENERAL
Hello Everybody, In order to attempt to keep this forum neat and tidy the moderation team is asking you to post your questions into the Questions and Answers (Q&A) forum and not into the General section. You can find the Q&A forum by clicking...
forum.xda-developers.com
and the others. I've moved the thread to Android Q&A.
Thanks for your cooperation!
Regards
Oswald Boelcke
Senior Moderator
Unfortunately, the question remains unanswered.
Here's some additional background for those who haven't kept up with the wonderful new changes in Android 11 and above...
[adb,scrcpy,vysor] What ports does Android 12 randomly set when Wi-Fi connecting via Wireless debugging adb "pair" or "connect" commands?
Bear in mind that Android 10 and below allowed wireless adb connections AFTER a USB connection was first established (adb tcpip 5555 && adb connect [IP]:5555), but that changed (for the better) in Android 11 and above with the new new Developer options Wireless debugging random port assignments (adb connect [IP]:[PORT] or adb pair [IP]:[PORT] [PIN]) such that the adb wireless connection never needs USB cable ever again.
Given Android 11 allows Developer options Wireless debugging via a random port, and Android 12 new Developer options Wireless debugging allows that to be accessed even easier with a new Developer options Wireless debugging tile, the only thing missing is a way to KEEP that random port from constantly changing on us.
One way to do that is to keep the Developer options Wireless debugging option turned on, hence the question asked in this thread of...
Is there any way to keep the Developer option for Wireless debugging on (even if the Wi-Fi automatically turns itself off)?
Digging further into the forum search... I found this thread....
Permanent Wifi on Unrooted Device
So I just set this option but I'm not sure yet how to tell if it worked.
adb shell settings put global cw_disable_wifimediator 1
Click to expand...
Click to collapse
Hi: only you need to disable riru or lsposed from magisk manager Then restart your device you're problem is solved.
GalaxyA325G said:
Digging further into the forum search... I found this thread....
Permanent Wifi on Unrooted Device
So I just set this option but I'm not sure yet how to tell if it worked.
Click to expand...
Click to collapse
Did it work?
XDrz said:
Hi Master ! I want help ! How can I turn on "wireless debugging" by root command without touch screen or usb debug?
I just want my phone turn on the "wireless debugging" after each reboot. I've wrote some cmd in a script file and let it run after system start:
svc wifi disable
sleep 5 # have a wait to ensure wifi is off
svc wifi enable
sleep 5 # have a wait to ensure it connected to PC hotspot
su
setprop service.adb.tcp.port 7777
# setprop persist.adb.tcp.port 7777 # have to try
stop adbd
start adbd
exit
I've tried many times and I'm tried. I found that there is no properties like "wifi_adb" or "debug.adb_wifi" can let me turn on wirelesss debugging switch after reboot. I have to touch it on screen so that I can connect adb over wifi.
is there any method to let the phone auto enable "wireless debugging"(even always enable) after reboot? I have ROOT !!! I SHOULD COUDL DO IT ![cry][cry] [cry] [cry] [cry]
Click to expand...
Click to collapse
I just have tried commands above and none of them could work. it just changes wifi adb port to what you want but no cmd can enable "wireless debugging" switch under developer options. why there is no properties like "debug.hwui.force_dark" that can be auto enable by "setprop".
even I'm rooted...

Categories

Resources