From d770c05f6e3d07e9cdfe2535fd495f703d72370f Mon Sep 17 00:00:00 2001 From: Justin Klaassen Date: Tue, 28 Jun 2016 19:26:43 -0700 Subject: [PATCH] Ensure classes used via XML are kept by proguard Bug: 29795762 - Keep MenuItem onClick methods. - Keep View subclasses and animatable properties. Change-Id: I4449c8d6caee1d499d8816e62ffc482661df6bea --- proguard.flags | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/proguard.flags b/proguard.flags index 3b1749d93be..ba855b9512d 100644 --- a/proguard.flags +++ b/proguard.flags @@ -1,12 +1,29 @@ +# This is a configuration file for ProGuard. +# http://proguard.sourceforge.net/index.html#manual/usage.html + # Keep all Fragments in this package, which are used by reflection. -keep public class com.android.settings.** extends android.app.Fragment -# Keep click handlers. +# 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); } --keepclasseswithmembers class * { +# Keep setters in Views so that animations can still work. +-keep public class * extends android.view.View { + public (android.content.Context); public (android.content.Context, android.util.AttributeSet); public (android.content.Context, android.util.AttributeSet, int); + + void set*(***); + *** get*(); +} + +# Keep classes that may be inflated from XML. +-keepclasseswithmembers class * { + public (android.content.Context, android.util.AttributeSet); +} +-keepclasseswithmembers class * { + public (android.content.Context, android.util.AttributeSet, int); }