(OK) Use Android Code to Enable USB Debugging
来源:互联网 发布:淘宝三无产品处罚 编辑:程序博客网 时间:2024/06/06 04:51
https://www.recovery-android.com/tips/enable-usb-debugging-with-android-code.html
--Thursday, Jun.23, 2016
As Android users, you must be familiar with USB debugging mode, which allows you to have a full use of your phone when connecting to computer. To enable it, you can manage the privacy data like contacts, messages, call logs, etc. stored in Android with the 3-party software on computer. You can easily enable USB debugging in the "Settings" interface in the phone. Here, we are going to share a technical way with you - enable USB debugging with Android code automatically.Firstly, let’s have a look at the analysis of the code of USB debugging. In the resource code "packages/apps/Settings/src/com/android /settings/DevelopmentSettings.java", you can find the code related to USB Debugging:
In this file, it will save the values in the Settings database according to the user settings. In other places of the settings will perform a corresponding action according to the dynamic change of the values.
After searching, the value in "frameworks/base/services/java/com/android/server/NotificationManagerService.java" is used to judge whether notification should be shown in the status bar. The code is as below:
With the code analysis, we can get the USB debugging automatically turned on relying on the program.
When finished the above steps, you still cannot get USB debugging enabled yet. With Logcat, you can find that the code written in it still have no right to enable USB debugging, because "android.permission.WRITE_SECURE_SETTINGS" disallows common program to perform, and there must be a system signature or being put in /system/app directory.
You can add two permissions in "AndroidManifest.xml" like follows:
After pushing the Java program code in /system/app directory and add the 0644 permission in the .apk, you can restart your phone. Now, the USB debugging is automatically enabled.
0 0
- (OK) Use Android Code to Enable USB Debugging
- enable usb debugging by code
- How to Enable USB Debugging Mode on Android
- How to Enable USB-Debugging with Nexus 5 for Android Studio
- this device has been lockedfor debugging。to enable debugging
- Android USB debugging 功能失效
- Debugging Native Android Platform Code
- Debugging Native Android Platform Code
- error: exception handling disabled, use -fexceptions to enable under Android NDK enviroement
- (OK) how to compile the source code for Android-x86 (Android 7.1.1)
- [tip] Enable Peoplecode debugging
- Use code to approve SPListItem
- Secure USB debugging in Android 4.2.2
- Android* System-Level Java*/C++ Code Debugging
- Android* System-Level Java*/C++ Code Debugging
- Android* System-Level Java*/C++ Code Debugging
- Debugging Linux kernel code on Android platforms
- How to use the HTML source for debugging issues
- 原点
- 小白自述 + 一年后重拾 《打包》
- UGUI学习笔记(三) 各控件使用总结
- 运行Android Studio报找不到32位的jdk
- 最简android之wifi调试
- (OK) Use Android Code to Enable USB Debugging
- 10G向40G网络升级的两种布线方案比较
- I/O多路复用之select
- 深入浅出ES6(十二):代理 Proxies
- Linux开源资源
- SPI总线协议介绍
- ASP.NET ZERO 学习 —— (18) 应用开发Demo之扩展电话信息
- JAVA语言基础第一天学习
- 使用时段:“【周几】【时间】可用”,如“周一到周五全天可用”,“周一、周二14:00-22:00可用”