我是靠谱客的博主 明亮小白菜,最近开发中收集的这篇文章主要介绍去掉SystemUI apk后adb调试不生效,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

去掉SystemUI后打开adb调试,连接adb报error: device unauthorized.
This adbd’s $ADB_VENDOR_KEYS is not set; try ‘adb kill-server’ if that seems wrong.
Otherwise check for a confirmation dialog on your device.原因是打开adb调试应该会出现Debug权限确认的Dialog,其实该dialog是一个activity,启动的是frameworks/base/core/res/res/values/config.xml下的

<!-- Name of the activity or service that prompts the user to reject, accept, or whitelist
an adb host's public key, when an unwhitelisted host connects to the local adbd.
Can be customized for other product types -->
<string name="config_customAdbPublicKeyConfirmationComponent"
>com.android.systemui/com.android.systemui.usb.UsbDebuggingActivity</string>
<!-- Name of the activity that prompts the secondary user to acknowledge she/he needs to
switch to the primary user to enable USB debugging.
Can be customized for other product types -->
<string name="config_customAdbPublicKeyConfirmationSecondaryUserComponent"
>com.android.systemui/com.android.systemui.usb.UsbDebuggingSecondaryUserActivity</string>

去掉SystemUI后无法进入UsbDebuggingActivity或UsbDebuggingSecondaryUserActivity去授权,只需要在启动该activity的代码块中去默认开启debug权限即可,在frameworks/base/services/usb/java/com/android/server/usb/UsbDebuggingManager.java的private void startConfirmation(String key, String fingerprints) 方法内添加如下代码

if(fingerprints == null){
return;
}
try {
IBinder b = ServiceManager.getService(Context.USB_SERVICE);
IUsbManager service = IUsbManager.Stub.asInterface(b);
if (true) {
service.allowUsbDebugging(true, key);
} else {
service.denyUsbDebugging();
}
} catch (Exception e) {
Slog.e(TAG, "Unable to notify Usb service", e);
}

最后

以上就是明亮小白菜为你收集整理的去掉SystemUI apk后adb调试不生效的全部内容,希望文章能够帮你解决去掉SystemUI apk后adb调试不生效所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(42)

评论列表共有 0 条评论

立即
投稿
返回
顶部