I'm trying to fully automate the CTS tests (including the Google registration part), but I'm running into a bit of a problem with the USB debugging/RSA fingerprint dialog that comes up when you first connect your device to the computer. Without manually pressing the OK button, the ADB cannot detect the device, so my Monkeyrunner script will not start. How would you go about automatically confirming this dialog? Better yet, is there a way to auto-accept the RSA fingerprint from the computer so at the very least ADB communication can be established so that the Monkeyrunner script can click on the dialog?
I've tried:
Pre-installing an APK in the system/app partition that makes calls
to Settings.Global.putInt(...) to enable USB debugging by default,
but you still get the confirmation dialog.
Modifying the
default.prop file found in the ramdisk part of the boot.img image,
but you still get the same problem as 1)
Extracting the relevant
bits of code from UsbDebuggingManager.java to extract the RSA
fingerprint and putting it in an APK, but I get a "Connection
Failed" error.
Is there something I overlooked? Or is this impossible without swapping the Kernel with another one?
Actually, I realized I made a mistake when flashing the boot.img file back onto the device. Now that I've got it flashed correctly, I am no longer prompted with the USB Debugging dialog in the beginning.
Make sure you have the following flags set in your default.prop:
ro.debuggable=1
persist.sys.usb.config=mtp,adb
ro.adb.secure=0
and you should be good to go. With these set, it's not necessary to pre-install an APK into the system/app folder to change the ADB_ENABLED settings using Settings.Global.putint(...)
Related
I develop using a pixel 2xl and a macbook pro. I have a problem that is bugging me since months now. When i connect the phone to the pc i get the classic popup asking to "Allow usb debugging? The computer's RSA key fingerprint is: xx:xx:xx:xx:xx:.....xx:xx" and then the box with "Always allow from this computer" and the two buttons "cancel" and "allow".
The problem is that i get two different key fingerprints, one doesn't work with android studio and I have to click "cancel" and switch on and off the "Usb debugging" switch until i finally get the right key.
I tried to uninstall Android Studio and all the related folders, following the How to completely uninstall Android Studio on Mac?
and when nothing was installed on the pc i still got the rogue key fingerprint on the message.
I tried to delete the only adbkey.pub and only the good key fingerprint changed. I tried to "Revoke Usb debugging authorizations" on the device but nothing. I run a "ps aux | grep adb" and no adb was running when i still got the rogue key fingerprint. No other adbkey files seem present on my pc too.
Where this rogue key fingerprint comes from? how to get rid of it?
This is seriously making my developing days a big big pain.
Thanks
I think i found finally the solution:
IMPORTANT: to diagnose the problem was essential to "Revoke USB debugging authorisations" from the developer options on the device, and never check the "Always allow from this computer". If you check that option instead, the popup will not appear and you could find yourself connected but with a wrong RSA key. In android studio you will see your device connected on the usb list but not as android device. This will look as a problem of the connection (cable, etc) but instead the connection mechanism is working, it's just that Android Studio will not be able to use it due to wrong fingerprint.
The rogue RSA key fingerprint was triggered by chrome://inspect with Discover USB devices checked. This option allows you to see the Android device without adb, so it probably mimics behaviour of the adb with its own certificate. This is a big big mistake from chrome developers, because it interferes with the Android Studio behaviour! It doesn't store the certificate it uses on ~/.Android folder in a adbkey.pub so it makes very difficult to discover the problem.
I used chrome inspect to see the database of my app using facebook stetho. I had always a tab opened and that made my last two months of coding like hell! Hope this helps someone.
I am using Android 6 Marshmellow.
I need to perform a local backup on Whatsapp without access to the screen. The motherboard has been damaged possibly beyond repair. The net result: Nothing displays on the screen. I have tried Windows 10 programs that display the Android screen in a window on PC but they don't work - possibly because the phone is failing to produce an output in the first place.
One program I used is this but the screenshot that the java app takes is pitch black. Hence my assumption the motherboard is incapable of producing a display at all.
Therefore, I would like to know if there is a way to execute app-specific commands such as telling Whatsapp to create a local backup via adb tools. So use Whatsapp via the Windows command line, through adb, as you can on Linux.
I cannot interact with the display; touch inputs are not registered. It has a password but the phone is not encrypted. My Windows 10 PC is a trusted PC and the phone has developer tools on.
More info here.
If you set that phone up for development and you can use adb commands to install an app (and send other intents), you might be able to try this out: Vysor
You can test this by simply turning on your phone, plug it in via USB cable and then run "adb devices" on your PC. Make sure adb.exe is in your Window's path.
Download the Windows app, install it and run it. Then plug in your phone. If this phone has developer options enabled and has been white-listed for the particular PC you're using, then it should allow the Windows app to install the Vysor Android app and start it. Once that happens, it should be able to connect and you'll see the phone's screen on your PC. Try it out with a working phone first if you like.
Good luck!
Find your emulator device ID. Run C:>adb devices
Find the package you want to debug. Run adb shell pm list packages .
Set the app to debug at startup (note the -w)
Start the app in the emulator.
Connect Android Studio Debugger.
Point to source code and set breakpoints.
So I have a parasite application installed on the phone that blocks the device from booting to bootloader and bunch of other stuff. It is also set as a device administartor thus it can't be uninstalled (deactivate administartor rights is also impossible). So to fix this problem I decompiled the APK of this app and changed the code so I can deactivate the admin rights. Unfortunately recompiled APK can not be installed over the existing application.
Adb error:
INSTALL_FAILED_UPDATE_INCOMPATIBLE
So is there a way to force install the app without uninstalling it? Or if my approach is wrong can you advice me on how to get rid of this annoying app.
Unfortunately recompiled APK can not be installed over the existing application.
No, because you have no access to former key that was used to sign the installed the parasite APK package.
If your device is rooted then you can try to boot to recovery like TWRP and carefully mess with system partition removing/editing files to prevent this particular app from starting (should suffice to simply remove its folder).
it blocks the device from booting to bootloader
How it does so? Most devices offer certain key combination (i.e. hold volume up + power) to boot in other modes, so unless you got it on very low level you can try that way.
So to fix this problem I decompiled the APK
If possible, I'd first backup my data (if there's any you want to backup) and simply factory reset the device. May save you some time.
EDIT
Idk how exactly it blocks the bootloader but it does (holding power, home, volume down just restarts the device)
You can always try to reboot to recovery/bootloader using adb:
adb reboot [bootloader|recovery]
- reboots the device, optionally into the bootloader or recovery program.
Objective
I'm developing a custom app for internal use on a rooted android mini-pc.
The goal (between others... so...many...others...) is to be able to turn on and off a tv using the serial port embeeded on the tv.
I'm using an FTDI UART RS232 serial usb cable for it.
Status
The application is working right now, using an android library (serial-driver) i can communicate with the tv, but the problem is that the device asks for permissions every install (and sometimes, weirdly, again on the same device), so it needs to be improved.
Issue
Since the device doesn't have mouse or keyboard by default, when this happens someone has to click the buttons, and since the device is normally hidden behind the screen, it can be really annoying.
My two bits
This problem, i feel, can be solved by two methods, but i still haven't been able to make them work.
Since the device is rooted, i might be able to modify an unknown (to me) parameter that allows me to bypass the permission request. For this i have tried to make an intent filter for the usb device, and to rewrite the interface that controlls this behaviour, both without success. Is there a way to make this android version more lenient about permissions?
I use for other reasons SuperSU inside the app, so i can use the full width of the might shell power. Using this i've been trying to send commands manually to the device (/dev/bus/usb/00X/00Y), but this haven't worked. My theory is that it's beacuse of the permissions of the device path, but even doing an unhealthy chmod 777 i cannot have them working.
So, that's my problem right now. I hope someone here can help me.
Additional data
Running: Custom Android 4.4.2 (Cannot be changed)
Needs to be doable solely from within the apk (but it can use shell commands)
We don't have the manufacturer signature to install it as a system app
We can use only one app, so i cannot have another one to move this one to /sys/apps, and i don't know if an app can do that to itself.
using Busybox stty -F /dev/.../ returns "Operation not permitted"
I was doing the Android tutorial on the Google website and I was at the point where you want to run your fantastic Hello World application on your phone. When I run my application from Eclipse, I see that my phone status is ?? and the target is unknown. When running adb devices in cmd, it says that my phone is unauthorized. It appears that it has something to do with the RSA fingerprint prompt. I don't remember ever getting such a prompt. Yes, I am running in PTP mode and debugging is enabled. I tried, after looking around on internet for multiple hours:
-Enabling/disabling debugging mode repeatedly
-Uninstalling and reinstalling my drivers for my phone or ADB
-adb-killserver and adb-startserver
-Restarting my phone and unplugging/replugging in multiple ways
I did notice that in my (user)/.android/ folder, I don't have a file called adbkey.pub (which is apparently the file that's supposed to have my key). Anyway, I don't think I've ever received the prompt about RSA fingerprint and I can't make it appear in any way.
Do you guys have any idea what I could do at this point. I tried about everything on these forums and around on the Internet but maybe there is something else I could do. Should I reset my phone to factory settings at this point to make the prompt appear again?
Make sure your android SDK is up to date (I think we're on v22.xx of the tools). Older versions fail in the manner you describe when hooked up to Android 4.2+ devices.
Do you have MTP transfer mode on? I just had this problem, solved by restarting the adb server and then disabled MTP on the phone at which point it immediately prompted for the RSA fingerprint and connected.