From 94c2ab6562cce6b7a1c4f40552b2c0ce47c2c35b Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Wed, 30 May 2018 13:59:11 +0100 Subject: [PATCH] Build dark greylist from public + light grey API The dark greylist is meant to contain non-SDK APIs which are "related" to APIs accessible to apps without restrictions. The list used to be built as all non-SDK APIs in the same package as those on the light greylist. That is not sufficient and should include the public SDK API packages too. This patch modifies the makefile to generate a list of public API DEX signatures with Doclava and then use that as a basis for the dark greylist generation. This should not be merged outside P branches as the build rules have been migrated to Soong. Bug: 80461842 Bug: 64382372 Test: make out/target/common/obj/PACKAGING/hiddenapi-blacklist.txt Change-Id: Ief5e050280fbe0e87eba539fb73c34661d5fd83e Merged-In: I357fcba75909495ba2b46b9ed1b532e65fee3fe1 --- Android.mk | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Android.mk b/Android.mk index 66c9529317f21..a984a0fdd5b47 100644 --- a/Android.mk +++ b/Android.mk @@ -447,6 +447,7 @@ LOCAL_DROIDDOC_OPTIONS:=\ -showUnannotated \ -showAnnotation android.annotation.SystemApi \ -showAnnotation android.annotation.TestApi \ + -dexApi $(INTERNAL_PLATFORM_DEX_API_FILE) \ -privateDexApi $(INTERNAL_PLATFORM_PRIVATE_DEX_API_FILE) \ -removedDexApi $(INTERNAL_PLATFORM_REMOVED_DEX_API_FILE) \ -nodocs @@ -457,7 +458,8 @@ LOCAL_UNINSTALLABLE_MODULE := true include $(BUILD_DROIDDOC) -$(full_target): .KATI_IMPLICIT_OUTPUTS := $(INTERNAL_PLATFORM_PRIVATE_DEX_API_FILE) \ +$(full_target): .KATI_IMPLICIT_OUTPUTS := $(INTERNAL_PLATFORM_DEX_API_FILE) \ + $(INTERNAL_PLATFORM_PRIVATE_DEX_API_FILE) \ $(INTERNAL_PLATFORM_REMOVED_DEX_API_FILE) # ==== check javadoc comments but don't generate docs ======== @@ -878,6 +880,7 @@ LOCAL_BLACKLIST := $(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST) LOCAL_SRC_GREYLIST := frameworks/base/config/hiddenapi-light-greylist.txt LOCAL_SRC_VENDOR_LIST := frameworks/base/config/hiddenapi-vendor-list.txt LOCAL_SRC_FORCE_BLACKLIST := frameworks/base/config/hiddenapi-force-blacklist.txt +LOCAL_SRC_PUBLIC_API := $(INTERNAL_PLATFORM_DEX_API_FILE) LOCAL_SRC_PRIVATE_API := $(INTERNAL_PLATFORM_PRIVATE_DEX_API_FILE) LOCAL_SRC_REMOVED_API := $(INTERNAL_PLATFORM_REMOVED_DEX_API_FILE) @@ -885,6 +888,7 @@ LOCAL_SRC_ALL := \ $(LOCAL_SRC_GREYLIST) \ $(LOCAL_SRC_VENDOR_LIST) \ $(LOCAL_SRC_FORCE_BLACKLIST) \ + $(LOCAL_SRC_PUBLIC_API) \ $(LOCAL_SRC_PRIVATE_API) \ $(LOCAL_SRC_REMOVED_API) @@ -957,7 +961,8 @@ $(LOCAL_LIGHT_GREYLIST): $(LOCAL_SRC_ALL) # (4) subtract entries shared with LOCAL_LIGHT_GREYLIST $(LOCAL_DARK_GREYLIST): $(LOCAL_SRC_ALL) $(LOCAL_LIGHT_GREYLIST) comm -13 <(sort $(LOCAL_LIGHT_GREYLIST) $(LOCAL_SRC_FORCE_BLACKLIST)) \ - <(sed 's/\->.*//' $(LOCAL_LIGHT_GREYLIST) | sed 's/\(.*\/\).*/\1/' | sort | uniq | \ + <(cat $(LOCAL_SRC_PUBLIC_API) $(LOCAL_LIGHT_GREYLIST) | \ + sed 's/\->.*//' | sed 's/\(.*\/\).*/\1/' | sort | uniq | \ while read PKG_NAME; do \ grep -E "^$${PKG_NAME}[^/;]*;" $(LOCAL_SRC_PRIVATE_API); \ done | sort | uniq) \