From 719fed4e950c494ce3190d3162050b6d5c4b69ed Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Thu, 28 Feb 2019 16:15:44 +0000 Subject: Fix hiddenapi issue when REMOVE_ATB_FROM_BCP=true If the android.test.base is not on the bootclasspath then its stubs should not be used as input to the hiddenapi processor. Bug: 73711752 Test: make REMOVE_ATB_FROM_BCP=true droid && atest -p cts/tests/signature Change-Id: Ib03899001e4350c9ad9e757e9e6d7d41bb0a3896 --- java/hiddenapi_singleton.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'java/hiddenapi_singleton.go') diff --git a/java/hiddenapi_singleton.go b/java/hiddenapi_singleton.go index 23f6cb0ee..ceafb59e0 100644 --- a/java/hiddenapi_singleton.go +++ b/java/hiddenapi_singleton.go @@ -89,7 +89,13 @@ func stubFlagsRule(ctx android.SingletonContext) { // Public API stubs publicStubModules := []string{ "android_stubs_current", - "android.test.base.stubs", + } + + // Add the android.test.base to the set of stubs only if the android.test.base module is on + // the boot jars list as the runtime will only enforce hiddenapi access against modules on + // that list. + if inList("android.test.base", ctx.Config().BootJars()) { + publicStubModules = append(publicStubModules, "android.test.base.stubs") } // System API stubs -- cgit v1.2.3-59-g8ed1b