android adb 权限改动

Posted brucemengbm

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了android adb 权限改动相关的知识,希望对你有一定的参考价值。

1. 改动 ADB ROOT权限:

system/core$ git diff adb/adb.c
diff --git a/adb/adb.c b/adb/adb.c
index 99bea0f..d8fc090 100644
--- a/adb/adb.c
+++ b/adb/adb.c
@@ -1217,6 +1217,11 @@ static void drop_capabilities_bounding_set_if_needed() {
 
 static int should_drop_privileges() {
 #ifndef ALLOW_ADBD_ROOT
+       char value[PROPERTY_VALUE_MAX];
+       property_get("hw.hasusbadbroot", value, "");
+       if(strcmp(value, "1") == 0)
+       return 0;
+ else
     return 1;
 #else /* ALLOW_ADBD_ROOT */
     int secure = 0;

同一时候在system.prop中加入hw.hasusbadbroot=1



2.去掉adb 密钥校验:

ro.adb.secure=0


3.改动开发人员选项隐藏

packages/apps/Settings/src/com/android/settings/Settings.java


     private void updateHeaderList(List<Header> target) {
-        final boolean showDev = mDevelopmentPreferences.getBoolean(
-                DevelopmentSettings.PREF_SHOW,
-                android.os.Build.TYPE.equals("eng"));
-        int i = 0;
+//        final boolean showDev = mDevelopmentPreferences.getBoolean(
+//                DevelopmentSettings.PREF_SHOW,
+//                android.os.Build.TYPE.equals("eng")); //samjiang modify
+               final boolean showDev = true; 
+               int i = 0;
 
         final UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
         mHeaderIndexMap.clear();

4.USB调试默认打开:

@@ -272,7 +272,7 @@ for these).
         <li>Installs APKs according to the product definition files; tags
             are ignored for APK modules.
         <li><code>ro.secure=1</code>
-        <li><code>ro.debuggable=0</code>
+        <li><code>ro.debuggable=1</code>
         <li><code>adb</code> is disabled by default.
     </td>
 </tr>

        "<code>make user</code>"
        <p>
        This is the flavor intended to be the final release bits.
        <ul>
        <li>Installs modules tagged with <code>shell_</code>$(TARGET_SHELL) and <code>user</code>.
        <li>Installs non-APK modules that have no tags specified.
        <li>Installs APKs according to the product definition files; tags
            are ignored for APK modules.
        <li><code>ro.secure=1</code>
        <li><code>ro.debuggable=1</code>
        <li><code>adb</code> is disabled by default.
    </td>
</tr>
<tr>
    <td>


@@ -350,7 +350,7 @@ 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












































































以上是关于android adb 权限改动的主要内容,如果未能解决你的问题,请参考以下文章

android系统如何通过$ adb 来获得/data/data目录的访问权限

通过 adb 列出 Android 应用程序的权限

Android 逆向Android 权限 ( adb 降权相关的属性 | ro.secure 属性 | ro.debuggable 属性 | service.adb.root 属性 )(代

Android 逆向Android 权限 ( adb 降权相关的属性 | ro.secure 属性 | ro.debuggable 属性 | service.adb.root 属性 )(代

adb push权限问题解决方法:RE管理器

adb无线连接android手机进行调试 无需获得root权限