user版本如何打开root权限之android6.0

1.修改ro.adb.secure属性

diff --git a/common/DeviceCommon.mk b/common/DeviceCommon.mk
index ef80897..8f61493 100644
--- a/common/DeviceCommon.mk
+++ b/common/DeviceCommon.mk
@@ -88,7 +88,7 @@ PRODUCT_PROPERTY_OVERRIDES += \
     persist.sys.apr.enabled=0 \
     persist.sys.engpc.disable=1 \
     persist.sys.sprd.wcnreset=1 \
-    ro.adb.secure=1 \
+    ro.adb.secure=0 \
     persist.sys.ag.enable=false \
     persist.sys.net.packet = 0 \
     persist.sys.start_udpdatastall=0 \

2.修改sepolicy

/external/sepolicy$ git  diff
diff --git a/Android.mk b/Android.mk
index 1b903bd..e7b9537 100644
--- a/Android.mk
+++ b/Android.mk
@@ -61,7 +61,7 @@ $(sepolicy_policy.conf): PRIVATE_MLS_CATS := $(MLS_CAT
 $(sepolicy_policy.conf) : $(call build_policy, $(sepolicy_build_files))
        @mkdir -p $(dir $@)
        $(hide) m4 -D mls_num_sens=$(PRIVATE_MLS_SENS) -D mls_num_cats=$
-               -D target_build_variant=$(TARGET_BUILD_VARIANT) \
+               -D target_build_variant=eng \
                -s $^ > $@
        $(hide) sed '/dontaudit/d' $@ > [email protected]

3.修改adb模块的android.mk

diff --git a/adb/Android.mk b/adb/Android.mk
index d4adbfb..d35cf66 100644
--- a/adb/Android.mk
+++ b/adb/Android.mk
@@ -235,12 +235,13 @@ LOCAL_CFLAGS := \
     -D_GNU_SOURCE \
     -Wno-deprecated-declarations \

-LOCAL_CFLAGS += -DALLOW_ADBD_NO_AUTH=$(if $(filter userdebug eng,$(TARGET_BUILD_VARIANT)
+#LOCAL_CFLAGS += -DALLOW_ADBD_NO_AUTH=$(if $(filter user userdebug eng,$(TARGET_BUILD_VARIANT

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

你可能感兴趣的:(技术总结)