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

企业网站建设工作总结校园推广方案

企业网站建设工作总结,校园推广方案,青岛胶南做网站的,网站上传根目录一、为什么需要开启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/29985/

相关文章:

  • 昭通网站制作aso优化技巧
  • 制作网站时怎样做滚动字幕新网站多久会被百度收录
  • 余姚物流做网站微信指数是搜索量吗
  • 怎样做网站轮播今日国内重大新闻事件
  • 想给大学做网站百度网盘搜索神器
  • jsp网站开发论文官方app下载安装
  • 关于机场建设的网站今日疫情最新情况
  • 网站域名注册服务商google浏览器官方
  • 通过网站开发工具怎么改自动跳网站百度指数有哪些功能
  • 可以发锚文本的网站百度搜索官方网站
  • 东莞网站建设企慕简述如何优化网站的方法
  • 可以做网站的公司seo外包
  • 自己怎么做网站视频赚钱5g网络优化培训
  • 数据库修改网站管理员密码seo网站有优化培训吗
  • 福田做商城网站建设找哪家公司好抖音怎么运营和引流
  • 厘米售卡站怎么做网站禁止搜索引擎收录的方法
  • 网站首页滚动图片怎么做谷歌搜索关键词排名
  • 嵩县网站开发友情链接获取的途径有哪些
  • 国家企业信息公示网(广东)海南快速seo排名优化
  • 高端网站设计 上海徐州seo排名公司
  • 泰安网站建设公司排名石家庄最新消息
  • 域名只做邮箱没网站要备案吗常见的网络推广方式包括
  • 昆山建设局网站360搜索首页
  • 正常做网站多少钱无锡网站制作无锡做网站
  • php做网站csdn网站seo公司哪家好
  • 今日头条建站工具何鹏seo
  • wordpress 培训模板优化落实疫情防控新十条
  • 关于做外汇现货的网站太原整站优化排名外包
  • 星悦做任务网站是新网站百度收录
  • 十大营销网站seo关键词查询工具