Android 4.4系統,User模式adb默認開啟,取消授權,開啟root調試記錄


開啟User模式adb,取消授權,修改如下:

1、 /build/core/main.mk  修改以下內容

ifeq (true,$(strip $(enable_target_debugging)))
# Target is more debuggable and adbd is on by default
ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1
# Include the debugging/testing OTA keys in this build.
INCLUDE_TEST_OTA_KEYS := true
else # !enable_target_debugging
# Target is less debuggable and adbd is off by default

#把0改為1

ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0
endif # !enable_target_debugging

2,

frameworks/base/services/java/com/android/server/usb/UsbDeviceManager.java

修改以下內容:

public class UsbDeviceManager {
mUseUsbNotification = !massStorageSupported;

// make sure the ADB_ENABLED setting value matches the current state
 Settings.Global.putInt(mContentResolver, Settings.Global.ADB_ENABLED, mAdbEnabled ? 1 : 0);


/* SPRD: reset the usb functions flag for usb function and SprdUsbSettings display @{ */
if (Settings.Global.getInt(mContentResolver,

 將 mAdbEnabled ? 1 : 0 修改為 1,即

Settings.Global.putInt(mContentResolver, Settings.Global.ADB_ENABLED, 1);

 

開啟User模式 Adb root權限,修改如下:

 

1,system/core/adb/Android.mk 

修改以下內容:

LOCAL_SRC_FILES := \
LOCAL_CFLAGS := -O2 -g -DADB_HOST=0 -Wall -Wno-unused-parameter
LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE

ifneq (,$(filter user userdebug eng,$(TARGET_BUILD_VARIANT)))
LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1
endif

LOCAL_MODULE := adbd

將紅色部分注釋掉

2,/system/core/adb/adb.c

修改以下內容:

static void drop_capabilities_bounding_set_if_needed() {

static int should_drop_privileges() {
#ifndef ALLOW_ADBD_ROOT
return 1;
#else /* ALLOW_ADBD_ROOT */
int secure = 0;
char value[PROPERTY_VALUE_MAX];
@@ -1243,7 +1243,7 @@ static int should_drop_privileges() {
}
}
}
 return secure;
#endif /* ALLOW_ADBD_ROOT */
}
#endif /* !ADB_HOST */

 將 標紅的部分修改為 return 0

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM