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.

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

mercurial