Support ADB product keys purging with a dedicated flag
Instead of checking the build variant look for the value of a dedicated
flag to decide if we need to do the purging. The value of
RELEASE_BUILD_PURGE_PRODUCT_ADB_KEYS is set to true on user and false on
userdebug/eng across all releases. Because of that this patch does not
bring any functional changes.
BUG: b/373580227
Test: Add $(warning foo) to the conditional block. Verify that the output
of lunch husky-${aosp_current,trunk_staging}-{user,userdebug,eng}
is as expected.
Change-Id: Ice6042025e9d2767e3eee158960eaab46f9b7fd4
diff --git a/core/product_config.mk b/core/product_config.mk
index 692e375..d18770b 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -468,10 +468,17 @@
$(eval SANITIZER.$(TARGET_PRODUCT).$(m).CONFIG := $(cf))))
_psmc_modules :=
-# Reset ADB keys for non-debuggable builds
-ifeq (,$(filter eng userdebug,$(TARGET_BUILD_VARIANT)))
+# Reset ADB keys. If RELEASE_BUILD_USE_VARIANT_FLAGS is set look for
+# the value of a dedicated flag. Otherwise check if build variant is
+# non-debuggable.
+ifneq (,$(RELEASE_BUILD_USE_VARIANT_FLAGS))
+ifneq (,$(RELEASE_BUILD_PURGE_PRODUCT_ADB_KEYS))
PRODUCT_ADB_KEYS :=
endif
+else ifeq (,$(filter eng userdebug,$(TARGET_BUILD_VARIANT)))
+ PRODUCT_ADB_KEYS :=
+endif
+
ifneq ($(filter-out 0 1,$(words $(PRODUCT_ADB_KEYS))),)
$(error Only one file may be in PRODUCT_ADB_KEYS: $(PRODUCT_ADB_KEYS))
endif