Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e916f430 authored by Jared Duke's avatar Jared Duke
Browse files

Relax system server proguard keep rules

SystemService classes are now explicitly referenced if they are
bundled in services.jar, so we need only ensure that their constructors
are kept.

This paves the way for build-time stripping of SystemService types that
are guarded by build-time flags. However, this change should be a no-op
as all such references are assumed reachable.

Bug: 203143243
Test: m + compare services.jar and ensure no SystemService changes
Change-Id: I97eeed3a275d272ae0e00916f52f84a17e65325d
parent 5447f715
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -44,6 +44,9 @@ import com.android.server.am.EventLogTags;
import com.android.server.pm.ApexManager;
import com.android.server.pm.UserManagerInternal;
import com.android.server.utils.TimingsTraceAndSlog;
import com.android.tools.r8.keepanno.annotations.KeepTarget;
import com.android.tools.r8.keepanno.annotations.TypePattern;
import com.android.tools.r8.keepanno.annotations.UsesReflection;

import dalvik.system.PathClassLoader;

@@ -207,6 +210,11 @@ public final class SystemServiceManager implements Dumpable {
     * @throws RuntimeException if the service fails to start.
     */
    @android.ravenwood.annotation.RavenwoodKeep
    @UsesReflection(
            @KeepTarget(
                    instanceOfClassConstantExclusive = SystemService.class,
                    methodName = "<init>",
                    methodParameterTypePatterns = {@TypePattern(constant = Context.class)}))
    public <T extends SystemService> T startService(Class<T> serviceClass) {
        try {
            final String name = serviceClass.getName();
+0 −5
Original line number Diff line number Diff line
@@ -29,11 +29,6 @@
  public protected *;
}

# Derivatives of SystemService and other services created via reflection
-keep,allowoptimization,allowaccessmodification class * extends com.android.server.SystemService {
  public <methods>;
}

# Accessed from com.android.compos APEX
-keep,allowoptimization,allowaccessmodification class com.android.internal.art.ArtStatsLog {
   public static void write(...);