userバージョンはroot権限のandroid 7を開く方法です.0

3861 ワード

1.ro.の修正adb.Secureプロパティ

/code/1-Android7.0/build$ git diff
diff --git a/core/main.mk b/core/main.mk
index 713467b..6f2fefc 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -394,7 +394,7 @@ ifneq (,$(user_variant))
   ADDITIONAL_DEFAULT_PROPERTIES += security.perf_harden=1

   ifeq ($(user_variant),user)
-    ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=1
+    #ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=0
   endif

   ifeq ($(user_variant),userdebug)
@@ -402,7 +402,7 @@ ifneq (,$(user_variant))
     tags_to_install += debug
   else
     # Disable debugging in plain user builds.
-    enable_target_debugging :=
+    #enable_target_debugging :=
   endif

   # Disallow mock locations by default for user builds

2.sepolicyの変更

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

@@ -103,7 +103,7 @@ $(LOCAL_BUILT_MODULE): $(sepolicy_policy.conf) $(HOST_OUT_EXECUTABLES)/checkpoli
        $(hide) $(HOST_OUT_EXECUTABLES)/checkpolicy -M -c $(POLICYVERS) -o [email protected] $<
        $(hide) $(HOST_OUT_EXECUTABLES)/checkpolicy -M -c $(POLICYVERS) -o $(dir $ [email protected]
-       $(hide) if [ "$(TARGET_BUILD_VARIANT)" = "user" -a -s [email protected] ]; then \
+       $(hide) if [ "$(TARGET_BUILD_VARIANT)" = "" -a -s [email protected] ]; then \
                echo "==========" 1>&2; \
                echo "ERROR: permissive domains not allowed in user builds" 1>&2; \
                echo "List of invalid domains:" 1>&2; \

3.adbモジュールのAndroidを修正する.mkファイル

/code/1-Android7.0/system/core$ git diff
diff --git a/adb/Android.mk b/adb/Android.mk
index f1d3bee..f6b36e9 100644
--- a/adb/Android.mk
+++ b/adb/Android.mk
@@ -319,9 +319,9 @@ LOCAL_CFLAGS := \
     -D_GNU_SOURCE \
     -Wno-deprecated-declarations \

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

-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

4.adb rootを入力しない場合、デフォルトはroot権限です.上記の第1点を以下のように修正する必要があります.
/code/1-Android7.0/build$ git diff
diff --git a/core/main.mk b/core/main.mk
index 713467b..d422aa1 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -390,11 +390,11 @@ enable_target_debugging := true
 tags_to_install :=
 ifneq (,$(user_variant))
   # Target is secure in user builds.
-  ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1
+  ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0
   ADDITIONAL_DEFAULT_PROPERTIES += security.perf_harden=1

   ifeq ($(user_variant),user)
-    ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=1
+   ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure= 0
   endif

   ifeq ($(user_variant),userdebug)
@@ -402,7 +402,7 @@ ifneq (,$(user_variant))
     tags_to_install += debug
   else
     # Disable debugging in plain user builds.
-    enable_target_debugging :=
+    #enable_target_debugging :=
   endif
   #Disallow mock locations by default for user builds