From d46c1bffa91a7e8031121f8eafa8bf8b6750b573 Mon Sep 17 00:00:00 2001 From: Adithya R Date: Thu, 26 Jan 2023 14:39:32 +0530 Subject: [PATCH] [DNM] init: Spoof build type property to user Also set release-keys and disable `ro.debuggable`. Avoids "root" detection in some banking-related apps whilst having the convenience of userdebug builds, such as adb root or permissive selinux. Avoid this in eng build to keep necessary debugging intact. Change-Id: I78ec5abe4db8083c0e02157c0bcd1a3d99fb9a5d --- init/Android.bp | 1 + init/property_service.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/init/Android.bp b/init/Android.bp index dce50ea4b..c3c84164f 100644 --- a/init/Android.bp +++ b/init/Android.bp @@ -153,6 +153,7 @@ libinit_cc_defaults { }, eng: { cppflags: [ + "-DENG_BUILD", "-USHUTDOWN_ZERO_TIMEOUT", "-DSHUTDOWN_ZERO_TIMEOUT=1", ], diff --git a/init/property_service.cpp b/init/property_service.cpp index a1b56dd6e..89c914107 100644 --- a/init/property_service.cpp +++ b/init/property_service.cpp @@ -1366,6 +1366,12 @@ static void SetSafetyNetProps() { InitPropertySet("ro.boot.verifiedbootstate", "green"); InitPropertySet("ro.boot.veritymode", "enforcing"); InitPropertySet("ro.build.tags", "release-keys"); + +#ifndef ENG_BUILD + // Spoof non-eng builds (such as userdebug) to user + InitPropertySet("ro.build.type", "user"); + InitPropertySet("ro.debuggable", "0"); +#endif } void PropertyInit() {