From 06689ad1b264d512a794d99fce5aa23045d12658 Mon Sep 17 00:00:00 2001 From: Jared Duke Date: Wed, 7 Sep 2022 12:24:36 -0700 Subject: [PATCH] Treat R8 warnings as failures for system_server Treating warnings as failures avoids unexpected issues at build and runtime, particularly for missing class references. Unblock this by adding explicit top-level references to several stub classes, and suppressing a warning for optional jacococ class references (guarded by a runtime check in CoverageService). Test: m services (also w/ EMMA_INSTRUMENT(_FRAMEWORK)=true) Bug: 242088131 Change-Id: Iee02a30eeccdcf785e90438d1557867ffda659e7 --- services/Android.bp | 3 +++ services/proguard.flags | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/services/Android.bp b/services/Android.bp index 89643704658a4..4d38b067d3a44 100644 --- a/services/Android.bp +++ b/services/Android.bp @@ -58,6 +58,7 @@ system_optimized_java_defaults { // retracing infra. optimize: false, shrink: true, + ignore_warnings: false, proguard_flags_files: ["proguard.flags"], }, // Note: Optimizations are disabled by default if unspecified in @@ -174,6 +175,8 @@ java_library { "android.hidl.manager-V1.0-java", "framework-tethering.stubs.module_lib", "service-art.stubs.system_server", + "service-permission.stubs.system_server", + "service-sdksandbox.stubs.system_server", ], // Uncomment to enable output of certain warnings (deprecated, unchecked) diff --git a/services/proguard.flags b/services/proguard.flags index c648f7d3ac45d..eb5c7144c9672 100644 --- a/services/proguard.flags +++ b/services/proguard.flags @@ -118,3 +118,7 @@ -keep,allowoptimization,allowaccessmodification class com.android.server.usage.StorageStatsManagerLocal { *; } -keep,allowoptimization,allowaccessmodification class com.android.internal.util.** { *; } -keep,allowoptimization,allowaccessmodification class android.os.** { *; } + +# CoverageService guards optional jacoco class references with a runtime guard, so we can safely +# suppress build-time warnings. +-dontwarn org.jacoco.agent.rt.*