From 4c3c03129ba95dccab30ba7579dc91b97843271f Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Thu, 10 May 2018 15:50:02 +0100 Subject: Include in hidden API dark greylist based on package name Dark greylist has so far been populated with the remaining class members of classes listed on the light greylist. This patch changes the rule to include all remaining classes and class members in the same package (sub-packages not included). Bug: 64382372 Test: make -j64 out/target/common/obj/PACKAGING/hiddenapi-dark-greylist.txt Change-Id: Icf3f60f1e776f092103c612fc3995ce0e66617ea --- Android.mk | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'Android.mk') diff --git a/Android.mk b/Android.mk index ccf3894a3d02..66c9529317f2 100644 --- a/Android.mk +++ b/Android.mk @@ -945,21 +945,21 @@ $(LOCAL_LIGHT_GREYLIST): $(LOCAL_SRC_ALL) $(call assert-is-subset,$@,$(LOCAL_SRC_PRIVATE_API)) $(call assert-has-no-overlap,$@,$(LOCAL_SRC_FORCE_BLACKLIST)) -# Generate dark greylist as remaining members of classes on the light greylist, -# as well as the members of their inner classes. +# Generate dark greylist as remaining classes and class members in the same +# package as classes listed in the light greylist. # The algorithm is as follows: # (1) extract the class descriptor from each entry in LOCAL_LIGHT_GREYLIST -# (2) strip the final semicolon and anything after (and including) a dollar sign, -# e.g. 'Lpackage/class$inner;' turns into 'Lpackage/class' -# (3) insert all entries from LOCAL_SRC_PRIVATE_API which begin with the stripped -# descriptor followed by a semi-colon or a dollar sign, e.g. matching a regex -# '^Lpackage/class[;$]' +# (2) strip everything after the last forward-slash, +# e.g. 'Lpackage/subpackage/class$inner;' turns into 'Lpackage/subpackage/' +# (3) insert all entries from LOCAL_SRC_PRIVATE_API which begin with the package +# name but do not contain another forward-slash in the class name, e.g. +# matching '^Lpackage/subpackage/[^/;]*;' # (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/$$.*//' | sort | uniq | \ - while read CLASS_DESC; do \ - grep -E "^$${CLASS_DESC}[;$$]" $(LOCAL_SRC_PRIVATE_API); \ + <(sed 's/\->.*//' $(LOCAL_LIGHT_GREYLIST) | sed 's/\(.*\/\).*/\1/' | sort | uniq | \ + while read PKG_NAME; do \ + grep -E "^$${PKG_NAME}[^/;]*;" $(LOCAL_SRC_PRIVATE_API); \ done | sort | uniq) \ > $@ $(call assert-is-subset,$@,$(LOCAL_SRC_PRIVATE_API)) @@ -988,4 +988,3 @@ include $(call first-makefiles-under,$(LOCAL_PATH)) endif endif # ANDROID_BUILD_EMBEDDED - -- cgit v1.2.3