Run appcompat on vendor and product-services.
Also add some more relevant information at the beginning of each report,
to make triaging of the reports easier.
To test this I declared ExactCalculator as
LOCAL_PRODUCT_SERVICES_MODULE, and this is the resulting log:
"""
Package name: com.android.calculator2
Module name in Android tree: ExactCalculator
Local path in Android tree: packages/apps/ExactCalculator
Install path on aosp_marlin-eng: out/target/product/marlin/system/product-services/app/ExactCalculator/ExactCalculator.apk
appcompat.sh output:
NOTE: appcompat.sh is still under development. It can report
API uses that do not execute at runtime, and reflection uses
that do not exist. It can also miss on reflection uses.
1: Reflection light greylist Landroid/os/Bundle;->getIBinder use(s):
Landroid/support/v4/app/BundleCompat$BundleCompatBaseImpl;->getBinder(Landroid/os/Bundle;Ljava/lang/String;)Landroid/os/IBinder;
2: Reflection light greylist Landroid/view/View;->mAccessibilityDelegate use(s):
Landroid/support/v4/view/ViewCompat$ViewCompatBaseImpl;->hasAccessibilityDelegate(Landroid/view/View;)Z
3: Reflection light greylist Landroid/view/View;->mMinHeight use(s):
Landroid/support/v4/view/ViewCompat$ViewCompatBaseImpl;->getMinimumHeight(Landroid/view/View;)I
4: Reflection light greylist Landroid/view/View;->mMinWidth use(s):
Landroid/support/v4/view/ViewCompat$ViewCompatBaseImpl;->getMinimumWidth(Landroid/view/View;)I
4 hidden API(s) used: 0 linked against, 4 through reflection
0 in blacklist
0 in dark greylist
4 in light greylist
To run an analysis that can give more reflection accesses,
but could include false positives, pass the --imprecise flag.
"""
Test: m (also on internal)
Bug: 110073830
Change-Id: I5114f51d1ab163e954fcffb159ef335abc289cf6
diff --git a/core/definitions.mk b/core/definitions.mk
index 3512598..514239b 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2547,14 +2547,31 @@
ifeq ($(HOST_OS),linux)
# Runs appcompat and store logs in $(PRODUCT_OUT)/appcompat
+define extract-package
+$(if $(filter aapt2, $(1)), \
+ $(AAPT2) dump $@ | awk -F ' |=' '/^Package/{print $$3}' >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log &&, \
+ $(AAPT) dump badging $@ | awk -F \' '/^package/{print $$2}' >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log &&)
+endef
+define appcompat-header
+$(hide) \
+ mkdir -p $(PRODUCT_OUT)/appcompat && \
+ rm -f $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
+ echo -n "Package name: " >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
+ $(call extract-package, $(1)) \
+ echo "Module name in Android tree: $(PRIVATE_MODULE)" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
+ echo "Local path in Android tree: $(PRIVATE_PATH)" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
+ echo "Install path on $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT): $(PRIVATE_INSTALLED_MODULE)" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
+ echo >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log
+endef
define run-appcompat
$(hide) \
- mkdir -p $(PRODUCT_OUT)/appcompat; \
- art/tools/veridex/appcompat.sh --dex-file=$@ 2>&1 > $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log;
+ echo "appcompat.sh output:" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
+ art/tools/veridex/appcompat.sh --dex-file=$@ 2>&1 >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log
endef
else
+appcompat-header =
run-appcompat =
-endif
+endif # HOST_OS == linux
# Remove dynamic timestamps from packages
#