tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

proguard-rules.txt (5600B)


      1 # Modified from https://robotsandpencils.com/blog/use-proguard-android-library/.
      2 
      3 # Preserve all annotations.
      4 
      5 -keepattributes *Annotation*
      6 
      7 # Preserve all .class method names.
      8 
      9 -keepclassmembernames class * {
     10    java.lang.Class class$(java.lang.String);
     11    java.lang.Class class$(java.lang.String, boolean);
     12 }
     13 
     14 # Preserve all native method names and the names of their classes.
     15 
     16 -keepclasseswithmembernames,includedescriptorclasses class * {
     17    native <methods>;
     18 }
     19 
     20 # Preserve the special static methods that are required in all enumeration
     21 # classes.
     22 
     23 -keepclassmembers class * extends java.lang.Enum {
     24    public static **[] values();
     25    public static ** valueOf(java.lang.String);
     26 }
     27 
     28 # Explicitly preserve all serialization members. The Serializable interface
     29 # is only a marker interface, so it wouldn't save them.
     30 # You can comment this out if your library doesn't use serialization.
     31 # If your code contains serializable classes that have to be backward
     32 # compatible, please refer to the manual.
     33 
     34 -keepclassmembers class * implements java.io.Serializable {
     35    static final long serialVersionUID;
     36    static final java.io.ObjectStreamField[] serialPersistentFields;
     37    private void writeObject(java.io.ObjectOutputStream);
     38    private void readObject(java.io.ObjectInputStream);
     39    java.lang.Object writeReplace();
     40    java.lang.Object readResolve();
     41 }
     42 
     43 # Preserve all View implementations and their special context constructors.
     44 
     45 -keep public class * extends android.view.View {
     46    public <init>(android.content.Context);
     47    public <init>(android.content.Context, android.util.AttributeSet);
     48    public <init>(android.content.Context, android.util.AttributeSet, int);
     49    public void set*(...);
     50 }
     51 
     52 # Keep setters in Views so that animations can still work.
     53 # See http://proguard.sourceforge.net/manual/examples.html#beans
     54 # From tools/proguard/proguard-android.txt.
     55 -keepclassmembers public class * extends android.view.View {
     56   void set*(***);
     57   *** get*();
     58 }
     59 
     60 # Preserve all classes that have special context constructors, and the
     61 # constructors themselves.
     62 
     63 -keepclasseswithmembers class * {
     64    public <init>(android.content.Context, android.util.AttributeSet);
     65 }
     66 
     67 # Preserve the special fields of all Parcelable implementations.
     68 
     69 -keepclassmembers class * implements android.os.Parcelable {
     70    static android.os.Parcelable$Creator CREATOR;
     71 }
     72 
     73 # Preserve static fields of inner classes of R classes that might be accessed
     74 # through introspection.
     75 
     76 -keepclassmembers class **.R$* {
     77  public static <fields>;
     78 }
     79 
     80 # GeckoView specific rules.
     81 
     82 # Keep everthing in org.mozilla.geckoview
     83 -keep class org.mozilla.geckoview.** { *; }
     84 
     85 -keep class org.mozilla.gecko.SysInfo {
     86    *;
     87 }
     88 
     89 -keep class org.mozilla.gecko.mozglue.JNIObject {
     90    *;
     91 }
     92 
     93 -keep class * extends org.mozilla.gecko.mozglue.JNIObject {
     94    *;
     95 }
     96 
     97 # Keep the annotation.
     98 -keep @interface org.mozilla.gecko.annotation.JNITarget
     99 
    100 # Keep classes tagged with the annotation.
    101 -keep @org.mozilla.gecko.annotation.JNITarget class *
    102 
    103 # Keep all members of an annotated class.
    104 -keepclassmembers @org.mozilla.gecko.annotation.JNITarget class * {
    105    *;
    106 }
    107 
    108 # Keep annotated members of any class.
    109 -keepclassmembers class * {
    110    @org.mozilla.gecko.annotation.JNITarget *;
    111 }
    112 
    113 # Keep classes which contain at least one annotated element. Split over two directives
    114 # because, according to the developer of ProGuard, "the option -keepclasseswithmembers
    115 # doesn't combine well with the '*' wildcard" (And, indeed, using it causes things to
    116 # be deleted that we want to keep.)
    117 -keepclasseswithmembers class * {
    118    @org.mozilla.gecko.annotation.JNITarget <methods>;
    119 }
    120 -keepclasseswithmembers class * {
    121    @org.mozilla.gecko.annotation.JNITarget <fields>;
    122 }
    123 
    124 # Keep WebRTC targets.
    125 -keep @interface org.mozilla.gecko.annotation.WebRTCJNITarget
    126 -keep @org.mozilla.gecko.annotation.WebRTCJNITarget class *
    127 -keepclassmembers class * {
    128    @org.mozilla.gecko.annotation.WebRTCJNITarget *;
    129 }
    130 -keepclassmembers @org.mozilla.gecko.annotation.WebRTCJNITarget class * {
    131    *;
    132 }
    133 -keepclasseswithmembers class * {
    134    @org.mozilla.gecko.annotation.WebRTCJNITarget <methods>;
    135 }
    136 -keepclasseswithmembers class * {
    137    @org.mozilla.gecko.annotation.WebRTCJNITarget <fields>;
    138 }
    139 
    140 # Keep generator-targeted entry points.
    141 -keep @interface org.mozilla.gecko.annotation.WrapForJNI
    142 -keep @org.mozilla.gecko.annotation.WrapForJNI class *
    143 -keepclassmembers,includedescriptorclasses class * {
    144    @org.mozilla.gecko.annotation.WrapForJNI *;
    145 }
    146 -keepclasseswithmembers,includedescriptorclasses class * {
    147    @org.mozilla.gecko.annotation.WrapForJNI <methods>;
    148 }
    149 -keepclasseswithmembers,includedescriptorclasses class * {
    150    @org.mozilla.gecko.annotation.WrapForJNI <fields>;
    151 }
    152 
    153 # Keep all members of an annotated class.
    154 -keepclassmembers,includedescriptorclasses @org.mozilla.gecko.annotation.WrapForJNI class * {
    155    *;
    156 }
    157 
    158 # Keep Reflection targets.
    159 -keep @interface org.mozilla.gecko.annotation.ReflectionTarget
    160 -keep @org.mozilla.gecko.annotation.ReflectionTarget class *
    161 -keepclassmembers class * {
    162    @org.mozilla.gecko.annotation.ReflectionTarget *;
    163 }
    164 -keepclassmembers @org.mozilla.gecko.annotation.ReflectionTarget class * {
    165    *;
    166 }
    167 -keepclasseswithmembers class * {
    168    @org.mozilla.gecko.annotation.ReflectionTarget <methods>;
    169 }
    170 -keepclasseswithmembers class * {
    171    @org.mozilla.gecko.annotation.ReflectionTarget <fields>;
    172 }
    173 
    174 # Bug 1838031 - Needed for SnakeYAML
    175 -dontwarn java.beans.BeanInfo
    176 -dontwarn java.beans.FeatureDescriptor
    177 -dontwarn java.beans.IntrospectionException
    178 -dontwarn java.beans.Introspector
    179 -dontwarn java.beans.PropertyDescriptor