当前位置: 首页 > news >正文

山东省建设部网站seo技术外包 乐云践新专家

山东省建设部网站,seo技术外包 乐云践新专家,没注册可以做网站吗,手机响应式网站开发模板之家一、为什么需要开启USB信任和ADB调试 问题1:原始的AOSP,如果通过USB连接设备以后,会弹窗提示用户选择连接模式:MTP,大容量磁盘,照片等模式; 问题2:USB连接设备以后,需要…

一、为什么需要开启USB信任和ADB调试

问题1:原始的AOSP,如果通过USB连接设备以后,会弹窗提示用户选择连接模式:MTP,大容量磁盘,照片等模式;

问题2:USB连接设备以后,需要开启USB调试模式,才方便操作adb调试;

问题3:USB设备连接以后,电脑会弹窗是否信任设备,需要点击信任当前设备,否则设备连接不成功。

使用场景:我们是自己的系统,需要支持设备USB连接,以及adb远程调试(USB调试和TCP调回),因此,系统需要默认支持USB连接,支持USB调试,默认信任连接的设备。

二、集成步骤

2.1 关闭USB调试弹窗

frameworks/base/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java

@Overridepublic void onCreate(Bundle icicle) {
...(省略)
/**final AlertController.AlertParams ap = mAlertParams;ap.mTitle = getString(R.string.usb_debugging_title);ap.mMessage = getString(R.string.usb_debugging_message, fingerprints);ap.mPositiveButtonText = getString(R.string.usb_debugging_allow);ap.mNegativeButtonText = getString(android.R.string.cancel);ap.mPositiveButtonListener = this;ap.mNegativeButtonListener = this;// add "always allow" checkboxLayoutInflater inflater = LayoutInflater.from(ap.mContext);View checkbox = inflater.inflate(com.android.internal.R.layout.always_use_checkbox, null);mAlwaysAllow = (CheckBox)checkbox.findViewById(com.android.internal.R.id.alwaysUse);mAlwaysAllow.setText(getString(R.string.usb_debugging_always));ap.mView = checkbox;window.setCloseOnTouchOutside(false);setupAlert();**/notifyService(true,true);finish();
}

默认只要USB连接设备,默认就开启USB调试。关键方法是notifyService

/*** Notifies the ADB service as to whether the current ADB request should be allowed, and if* subsequent requests from this key should be allowed without user consent.** @param allow whether the connection should be allowed* @param alwaysAllow whether subsequent requests from this key should be allowed without user*                    consent*/private void notifyService(boolean allow, boolean alwaysAllow) {try {IBinder b = ServiceManager.getService(ADB_SERVICE);IAdbManager service = IAdbManager.Stub.asInterface(b);if (allow) {service.allowDebugging(alwaysAllow, mKey);} else {service.denyDebugging();}mServiceNotified = true;} catch (Exception e) {Log.e(TAG, "Unable to notify Usb service", e);}}

这个方法很简单,通过ADB服务,设置允许调试。

mKey是什么呢?就是设备指纹,即我们常说的设备SN。

2.2 授权ADB调试5555端口

device/qcom/lahaina/init.target.rc

    #Allow access to memory hotplug device attributeschown system system /sys/kernel/mem-offline/anon_migrate# ==== modify start===== zhouronghua open adb debug port 5555setprop service.adb.tcp.port 5555# ==== modify end=====

2.3 接收到USB连接默认开启USB调试

frameworks/base/packages/SystemUI/src/com/android/systemui/usb/UsbDebuggingActivity.java

在其中有监听USB连接和断开的广播接收器UsbDisconnectedReceiver,

private class UsbDisconnectedReceiver extends BroadcastReceiver {
...(省略)@Overridepublic void onReceive(Context content, Intent intent) {String action = intent.getAction();if (!UsbManager.ACTION_USB_STATE.equals(action)) {return;}// ====== modify begin ==========// fix: zhouronghua usb debug default auth// boolean connected = intent.getBooleanExtra(UsbManager.USB_CONNECTED, false);boolean connected = false;if (!connected) {Log.d(TAG, "USB disconnected, notifying service");// notifyService(false);mActivity.finish();}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);}// =========== modify end ==========}}

http://www.hkea.cn/news/323414/

相关文章:

  • 自己做的网站怎么改电话网络推广代运营公司
  • 做水果的网站有哪些google高级搜索
  • 怎么用网站做文案百度推广可以自己开户吗
  • 做的好的新闻网站排名优化
  • 购物网站开发功能百度联盟个人怎么接广告
  • 网站如何盈利流量费网站seo搜索引擎的原理是什么
  • 泰安房产价格最新域名年龄对seo的影响
  • 网站打不开怎么回事引流推广平台有哪些
  • 课程网站建设特色成都seo外包
  • 建设厅安全员证书查询网站外链seo推广
  • 邢台手机网站建设服务百度查重软件
  • 网站开发开题报告ppt竞价运营是做什么的
  • 网站代理怎么做的网站推广策划思路
  • 长沙网站seo公司百度权重5的网站能卖多少钱
  • 常德网站开发百度推广登录首页网址
  • 网站建设软件设计推广官网
  • 网站运营阶段站长之家app
  • discuz网站标题百度广告推广价格
  • 广州学校论坛网站建设疫情排行榜最新消息
  • 古董手表网站网络营销的主要方式和技巧
  • 做公司网站要那些资料百度电脑版下载官方
  • 定州网站建设公司企业网站源码
  • 0基础1小时网站建设教程如何给自己的公司建网站
  • 成都网站建设s1emens电商平台怎么加入
  • 六合哪家做网站建设域名注册查询软件
  • 网站建设的方案费用2023年新冠疫情最新消息
  • 九星市场做网站快速将网站seo
  • 长春做网站推广的公司提升神马关键词排名报价
  • 金融网站cms百度网盘客服电话人工服务
  • 美观网站建设物美价廉seo网站优化专员