From ab7041107f9b34ae53cb5b269b95ab2120255d53 Mon Sep 17 00:00:00 2001 From: Justin Klaassen Date: Mon, 1 Aug 2016 16:16:40 -0700 Subject: [PATCH] Keep classes/fields only used via reflection Bug: 30355720 Change-Id: I9c8325a0b42cda5beeb8dfe76bde46afd2bec727 --- proguard.flags | 16 ++++++++++++++-- .../settings/overlay/FeatureFactoryImpl.java | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/proguard.flags b/proguard.flags index ba855b9512d..d644f47887c 100644 --- a/proguard.flags +++ b/proguard.flags @@ -6,8 +6,8 @@ # We want to keep methods in Activity that could be used in the XML attribute onClick. -keepclassmembers class * extends android.app.Activity { - public void *(android.view.View); - public void *(android.view.MenuItem); + public void *(android.view.View); + public void *(android.view.MenuItem); } # Keep setters in Views so that animations can still work. @@ -27,3 +27,15 @@ -keepclasseswithmembers class * { public (android.content.Context, android.util.AttributeSet, int); } + +# Keep annotated classes or class members. +-keep @android.support.annotation.Keep class * +-keepclassmembers class * { + @android.support.annotation.Keep *; +} + +# Keep specific fields used via reflection. +-keepclassmembers class * { + public static ** SEARCH_INDEX_DATA_PROVIDER; + public static ** SUMMARY_PROVIDER_FACTORY; +} diff --git a/src/com/android/settings/overlay/FeatureFactoryImpl.java b/src/com/android/settings/overlay/FeatureFactoryImpl.java index ce561f3d17d..f5271723723 100644 --- a/src/com/android/settings/overlay/FeatureFactoryImpl.java +++ b/src/com/android/settings/overlay/FeatureFactoryImpl.java @@ -17,10 +17,12 @@ package com.android.settings.overlay; import android.content.Context; +import android.support.annotation.Keep; /** * {@link FeatureFactory} implementation for AOSP Settings. */ +@Keep public final class FeatureFactoryImpl extends FeatureFactory { @Override