去掉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);
        }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值