mobile/android/config/proguard.cfg

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

michael@0 1 # Dalvik renders preverification unuseful (Would just slightly bloat the file).
michael@0 2 -dontpreverify
michael@0 3
michael@0 4 # Uncomment to have Proguard list dead code detected during the run - useful for cleaning up the codebase.
michael@0 5 # -printusage
michael@0 6
michael@0 7 -dontskipnonpubliclibraryclassmembers
michael@0 8 -verbose
michael@0 9 -allowaccessmodification
michael@0 10
michael@0 11 # Preserve all fundamental application classes.
michael@0 12 -keep public class * extends android.app.Activity
michael@0 13 -keep public class * extends android.app.Application
michael@0 14 -keep public class * extends android.app.Service
michael@0 15 -keep public class * extends android.app.backup.BackupAgentHelper
michael@0 16 -keep public class * extends android.content.BroadcastReceiver
michael@0 17 -keep public class * extends android.content.ContentProvider
michael@0 18 -keep public class * extends android.preference.Preference
michael@0 19 -keep public class * extends org.mozilla.gecko.sync.syncadapter.SyncAdapter
michael@0 20 -keep class org.mozilla.gecko.sync.syncadapter.SyncAdapter
michael@0 21
michael@0 22 # Preserve all native method names and the names of their classes.
michael@0 23 -keepclasseswithmembernames class * {
michael@0 24 native <methods>;
michael@0 25 }
michael@0 26
michael@0 27 -keepclasseswithmembers class * {
michael@0 28 public <init>(android.content.Context, android.util.AttributeSet, int);
michael@0 29 }
michael@0 30
michael@0 31 -keepclassmembers class * extends android.app.Activity {
michael@0 32 public void *(android.view.View);
michael@0 33 }
michael@0 34
michael@0 35 # Preserve enums. (For awful reasons, the runtime accesses them using introspection...)
michael@0 36 -keepclassmembers enum * {
michael@0 37 *;
michael@0 38 }
michael@0 39
michael@0 40 #
michael@0 41 # Rules from ProGuard's Android example:
michael@0 42 # http://proguard.sourceforge.net/manual/examples.html#androidapplication
michael@0 43 #
michael@0 44
michael@0 45 # Switch off some optimizations that trip older versions of the Dalvik VM.
michael@0 46
michael@0 47 -optimizations !code/simplification/arithmetic
michael@0 48
michael@0 49 # Keep a fixed source file attribute and all line number tables to get line
michael@0 50 # numbers in the stack traces.
michael@0 51 # You can comment this out if you're not interested in stack traces.
michael@0 52
michael@0 53 -renamesourcefileattribute SourceFile
michael@0 54 -keepattributes SourceFile,LineNumberTable
michael@0 55
michael@0 56 # RemoteViews might need annotations.
michael@0 57
michael@0 58 -keepattributes *Annotation*
michael@0 59
michael@0 60 # Preserve all View implementations, their special context constructors, and
michael@0 61 # their setters.
michael@0 62
michael@0 63 -keep public class * extends android.view.View {
michael@0 64 public <init>(android.content.Context);
michael@0 65 public <init>(android.content.Context, android.util.AttributeSet);
michael@0 66 public <init>(android.content.Context, android.util.AttributeSet, int);
michael@0 67 public void set*(...);
michael@0 68 }
michael@0 69
michael@0 70 # Preserve all classes that have special context constructors, and the
michael@0 71 # constructors themselves.
michael@0 72
michael@0 73 -keepclasseswithmembers class * {
michael@0 74 public <init>(android.content.Context, android.util.AttributeSet);
michael@0 75 }
michael@0 76
michael@0 77 # Preserve the special fields of all Parcelable implementations.
michael@0 78
michael@0 79 -keepclassmembers class * implements android.os.Parcelable {
michael@0 80 static android.os.Parcelable$Creator CREATOR;
michael@0 81 }
michael@0 82
michael@0 83 # Preserve static fields of inner classes of R classes that might be accessed
michael@0 84 # through introspection.
michael@0 85
michael@0 86 -keepclassmembers class **.R$* {
michael@0 87 public static <fields>;
michael@0 88 }
michael@0 89
michael@0 90 # Preserve the required interface from the License Verification Library
michael@0 91 # (but don't nag the developer if the library is not used at all).
michael@0 92
michael@0 93 -keep public interface com.android.vending.licensing.ILicensingService
michael@0 94
michael@0 95 -dontnote com.android.vending.licensing.ILicensingService
michael@0 96
michael@0 97 # The Android Compatibility library references some classes that may not be
michael@0 98 # present in all versions of the API, but we know that's ok.
michael@0 99
michael@0 100 -dontwarn android.support.**
michael@0 101
michael@0 102 # Preserve all native method names and the names of their classes.
michael@0 103
michael@0 104 -keepclasseswithmembernames class * {
michael@0 105 native <methods>;
michael@0 106 }
michael@0 107
michael@0 108 #
michael@0 109 # Mozilla-specific rules
michael@0 110 #
michael@0 111 # Merging classes can generate dex warnings about anonymous inner classes.
michael@0 112 -optimizations !class/merging/horizontal
michael@0 113 -optimizations !class/merging/vertical
michael@0 114
michael@0 115 # Keep miscellaneous targets.
michael@0 116
michael@0 117 # Keep the annotation.
michael@0 118 -keep @interface org.mozilla.gecko.mozglue.JNITarget
michael@0 119
michael@0 120 # Keep classes tagged with the annotation.
michael@0 121 -keep @org.mozilla.gecko.mozglue.JNITarget class *
michael@0 122
michael@0 123 # Keep all members of an annotated class.
michael@0 124 -keepclassmembers @org.mozilla.gecko.mozglue.JNITarget class * {
michael@0 125 *;
michael@0 126 }
michael@0 127
michael@0 128 # Keep annotated members of any class.
michael@0 129 -keepclassmembers class * {
michael@0 130 @org.mozilla.gecko.mozglue.JNITarget *;
michael@0 131 }
michael@0 132
michael@0 133 # Keep classes which contain at least one annotated element. Split over two directives
michael@0 134 # because, according to the developer of ProGuard, "the option -keepclasseswithmembers
michael@0 135 # doesn't combine well with the '*' wildcard" (And, indeed, using it causes things to
michael@0 136 # be deleted that we want to keep.)
michael@0 137 -keepclasseswithmembers class * {
michael@0 138 @org.mozilla.gecko.mozglue.JNITarget <methods>;
michael@0 139 }
michael@0 140 -keepclasseswithmembers class * {
michael@0 141 @org.mozilla.gecko.mozglue.JNITarget <fields>;
michael@0 142 }
michael@0 143
michael@0 144 # Keep Robocop targets. TODO: Can omit these from release builds. Also, Bug 916507.
michael@0 145
michael@0 146 # Same formula as above...
michael@0 147 -keep @interface org.mozilla.gecko.mozglue.RobocopTarget
michael@0 148 -keep @org.mozilla.gecko.mozglue.RobocopTarget class *
michael@0 149 -keepclassmembers class * {
michael@0 150 @org.mozilla.gecko.mozglue.RobocopTarget *;
michael@0 151 }
michael@0 152 -keepclassmembers @org.mozilla.gecko.mozglue.RobocopTarget class * {
michael@0 153 *;
michael@0 154 }
michael@0 155 -keepclasseswithmembers class * {
michael@0 156 @org.mozilla.gecko.mozglue.RobocopTarget <methods>;
michael@0 157 }
michael@0 158 -keepclasseswithmembers class * {
michael@0 159 @org.mozilla.gecko.mozglue.RobocopTarget <fields>;
michael@0 160 }
michael@0 161
michael@0 162 # Keep WebRTC targets.
michael@0 163 -keep @interface org.mozilla.gecko.mozglue.WebRTCJNITarget
michael@0 164 -keep @org.mozilla.gecko.mozglue.WebRTCJNITarget class *
michael@0 165 -keepclassmembers class * {
michael@0 166 @org.mozilla.gecko.mozglue.WebRTCJNITarget *;
michael@0 167 }
michael@0 168 -keepclassmembers @org.mozilla.gecko.mozglue.WebRTCJNITarget class * {
michael@0 169 *;
michael@0 170 }
michael@0 171 -keepclasseswithmembers class * {
michael@0 172 @org.mozilla.gecko.mozglue.WebRTCJNITarget <methods>;
michael@0 173 }
michael@0 174 -keepclasseswithmembers class * {
michael@0 175 @org.mozilla.gecko.mozglue.WebRTCJNITarget <fields>;
michael@0 176 }
michael@0 177
michael@0 178 # Keep generator-targeted entry points.
michael@0 179 -keep @interface org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI
michael@0 180 -keep @org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI class *
michael@0 181 -keepclassmembers class * {
michael@0 182 @org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI *;
michael@0 183 }
michael@0 184 -keepclasseswithmembers class * {
michael@0 185 @org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI <methods>;
michael@0 186 }
michael@0 187 -keepclasseswithmembers class * {
michael@0 188 @org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI <fields>;
michael@0 189 }
michael@0 190
michael@0 191 -keep @interface org.mozilla.gecko.mozglue.generatorannotations.WrapEntireClassForJNI
michael@0 192 -keep @org.mozilla.gecko.mozglue.generatorannotations.WrapEntireClassForJNI class *
michael@0 193 -keepclassmembers @org.mozilla.gecko.mozglue.generatorannotations.WrapEntireClassForJNI class * {
michael@0 194 *;
michael@0 195 }
michael@0 196
michael@0 197 # Disable obfuscation because it makes exception stack traces more difficult to read.
michael@0 198 -dontobfuscate
michael@0 199
michael@0 200 # Suppress warnings about missing descriptor classes.
michael@0 201 #-dontnote **,!ch.boye.**,!org.mozilla.gecko.sync.**

mercurial