安卓user版本默认开启debug模式,默认adb能连接

亲测有效! 在展锐sl8541e android8.1代码包上面测试,只需修改两点

1.默认为debug打开模式,默认ro.debuggable=1(默认允许debug)

build/make/core/main.mk

ifeq (true,$(strip $(enable_target_debugging)))
   INCLUDE_TEST_OTA_KEYS := true
 else # !enable_target_debugging
   # Target is less debuggable and adbd is off by default
-  ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0
+  ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1
 endif # !enable_target_debugging

2.去掉   连上USB线之后,界面弹出是否授权连接的弹出框,并默认授权连接

        public void onReceive(Context content, Intent intent) {
            String action = intent.getAction();
            if (!UsbManager.ACTION_USB_STATE.equals(action)) {
                return;
            }
            //boolean connected = intent.getBooleanExtra(UsbManager.USB_CONNECTED, false);
			boolean connected = false; //default set false
            if (!connected) {
                mActivity.finish();
            }
			//add begin
			try {
			IBinder b = ServiceManager.getService(USB_SERVICE);
			IUsbManager service = IUsbManager.Stub.asInterface(b);
			service.allowUsbDebugging(true, mKey);
			} 
			catch (Exception e) {
			Log.e(TAG, "Unable to notify Usb service", e);
			}
            //add end

        }

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值