Keep classes/fields only used via reflection

Bug: 30355720
Change-Id: I9c8325a0b42cda5beeb8dfe76bde46afd2bec727
This commit is contained in:
Justin Klaassen
2016-08-01 16:16:40 -07:00
parent 0ac9f80a28
commit ab7041107f
2 changed files with 16 additions and 2 deletions

View File

@@ -6,8 +6,8 @@
# We want to keep methods in Activity that could be used in the XML attribute onClick. # We want to keep methods in Activity that could be used in the XML attribute onClick.
-keepclassmembers class * extends android.app.Activity { -keepclassmembers class * extends android.app.Activity {
public void *(android.view.View); public void *(android.view.View);
public void *(android.view.MenuItem); public void *(android.view.MenuItem);
} }
# Keep setters in Views so that animations can still work. # Keep setters in Views so that animations can still work.
@@ -27,3 +27,15 @@
-keepclasseswithmembers class * { -keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int); public <init>(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;
}

View File

@@ -17,10 +17,12 @@
package com.android.settings.overlay; package com.android.settings.overlay;
import android.content.Context; import android.content.Context;
import android.support.annotation.Keep;
/** /**
* {@link FeatureFactory} implementation for AOSP Settings. * {@link FeatureFactory} implementation for AOSP Settings.
*/ */
@Keep
public final class FeatureFactoryImpl extends FeatureFactory { public final class FeatureFactoryImpl extends FeatureFactory {
@Override @Override