📄 proguard-rules.pro

jabjab / proguard-rules.pro
9.3 kB Raw History
1-dontobfuscate
2-renamesourcefileattribute SourceFile
3-keepattributes SourceFile,LineNumberTable
4
5
6-keep class tel.xmpp.jabjab.**
7-keep class im.conversations.**
8
9-keep class org.whispersystems.**
10
11-keep class com.kyleduo.switchbutton.Configuration
12
13-keep class com.soundcloud.android.crop.**
14
15-keep class com.google.android.gms.**
16
17-keep class org.openintents.openpgp.*
18-keep class org.webrtc.** { *; }
19
20# JNI Zero stuff (used by webrtc; copied from chrome)
21-keep class org.jni_zero.** { *; }
22-dontwarn org.jni_zero.**
23
24-keepclasseswithmembers,allowaccessmodification class ** {
25 @**org.jni_zero.AccessedByNative <fields>;
26}
27-keepclasseswithmembers,includedescriptorclasses,allowaccessmodification,allowoptimization class ** {
28 @**org.jni_zero.CalledByNative <methods>;
29}
30-keepclasseswithmembers,includedescriptorclasses,allowaccessmodification,allowoptimization class ** {
31 @**org.jni_zero.CalledByNativeUnchecked <methods>;
32}
33
34-keepclasseswithmembernames,includedescriptorclasses,allowaccessmodification class ** {
35 native <methods>;
36}
37
38-keepclasseswithmembers class !cr_allowunused,**J.N {
39 public long *_HASH;
40}
41
42-keep class net.fellbaum.jemoji.** { *; }
43-keeppackagenames net.fellbaum.jemoji.**
44-keepdirectories jemoji
45
46-dontwarn javax.mail.internet.MimeMessage
47-dontwarn javax.mail.internet.MimeBodyPart
48-dontwarn javax.mail.internet.SharedInputStream
49-dontwarn javax.activation.DataContentHandler
50-dontwarn org.bouncycastle.mail.**
51-dontwarn org.bouncycastle.x509.util.LDAPStoreHelper
52-dontwarn org.bouncycastle.jce.provider.X509LDAPCertStoreSpi
53-dontwarn org.bouncycastle.cert.dane.**
54-dontwarn rocks.xmpp.addr.**
55-dontwarn com.google.firebase.analytics.connector.AnalyticsConnector
56-dontwarn java.lang.**
57-dontwarn com.google.auto.service.AutoService
58-dontwarn javax.lang.**
59
60-dontwarn com.android.org.conscrypt.SSLParametersImpl
61-dontwarn org.apache.harmony.xnet.provider.jsse.SSLParametersImpl
62-dontwarn org.bouncycastle.jsse.BCSSLParameters
63-dontwarn org.bouncycastle.jsse.BCSSLSocket
64-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
65-dontwarn org.openjsse.javax.net.ssl.SSLParameters
66-dontwarn org.openjsse.javax.net.ssl.SSLSocket
67-dontwarn org.openjsse.net.ssl.OpenJSSE
68-dontwarn org.jetbrains.annotations.**
69
70-keepclassmembers class tel.xmpp.jabjab.http.services.** {
71 !transient <fields>;
72}
73
74# Needed for proper GSON deserialization
75-keep class com.google.gson.reflect.TypeToken
76-keep class * extends com.google.gson.reflect.TypeToken
77-keep public class * implements java.lang.reflect.Type
78
79# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
80# EnclosingMethod is required to use InnerClasses.
81-keepattributes Signature, InnerClasses, EnclosingMethod
82
83# Retrofit does reflection on method and parameter annotations.
84-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
85
86# Retain service method parameters when optimizing.
87-keepclassmembers,allowshrinking,allowobfuscation interface * {
88 @retrofit2.http.* <methods>;
89}
90
91# Ignore annotation used for build tooling.
92-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
93
94# Ignore JSR 305 annotations for embedding nullability information.
95-dontwarn javax.annotation.**
96
97# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
98-dontwarn kotlin.Unit
99
100# Top-level functions that can only be used by Kotlin.
101-dontwarn retrofit2.KotlinExtensions
102-dontwarn retrofit2.KotlinExtensions$*
103
104
105# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy
106# and replaces all potential values with null. Explicitly keeping the interfaces prevents this.
107-if interface * { @retrofit2.http.* <methods>; }
108-keep,allowobfuscation interface <1>
109
110# Keep inherited services.
111-if interface * { @retrofit2.http.* <methods>; }
112-keep,allowobfuscation interface * extends <1>
113
114# With R8 full mode generic signatures are stripped for classes that are not
115# kept. Suspend functions are wrapped in continuations where the type argument
116# is used.
117-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
118
119# R8 full mode strips generic signatures from return types if not kept.
120-if interface * { @retrofit2.http.* public *** *(...); }
121-keep,allowoptimization,allowshrinking,allowobfuscation class <3>
122
123# Guava doesn’s ship a complete file - base.pro
124
125# Throwables uses internal APIs for lazy stack trace resolution
126-dontnote sun.misc.SharedSecrets
127-keep class sun.misc.SharedSecrets {
128 *** getJavaLangAccess(...);
129}
130-dontnote sun.misc.JavaLangAccess
131-keep class sun.misc.JavaLangAccess {
132 *** getStackTraceElement(...);
133 *** getStackTraceDepth(...);
134}
135
136# FinalizableReferenceQueue calls this reflectively
137# Proguard is intelligent enough to spot the use of reflection onto this, so we
138# only need to keep the names, and allow it to be stripped out if
139# FinalizableReferenceQueue is unused.
140#
141# (Under Android, we end up using Finalzier non-reflectively, so we could
142# likely rework all this configuration.)
143-keepclassmembernames class com.google.common.base.internal.Finalizer {
144 *** startFinalizer(...);
145}
146# However, it cannot "spot" that this method needs to be kept IF the class is.
147-keepclassmembers class com.google.common.base.internal.Finalizer {
148 *** startFinalizer(...);
149}
150
151-keepclassmembernames class com.google.common.base.FinalizableReference {
152 void finalizeReferent();
153}
154-keepclassmembers class com.google.common.base.FinalizableReference {
155 void finalizeReferent();
156}
157
158# Guava - cache.pro
159
160# Striped64 uses this
161-dontwarn sun.misc.Unsafe
162
163# Striped64 appears to make some assumptions about object layout that
164# really might not be safe. This should be investigated.
165-keepclassmembers class com.google.common.cache.Striped64 {
166 *** base;
167 *** busy;
168}
169-keepclassmembers class com.google.common.cache.Striped64$Cell {
170 <fields>;
171}
172
173
174# random shit from https://github.com/google/guava/issues/8345
175
176-keep class com.google.common.cache.** { *; }
177-keepclassmembers class com.google.common.cache.LocalCache$Strength {
178public static **[] values();
179public static ** valueOf(java.lang.String);
180}
181
182
183# Guava collect pro
184
185# The nested FieldSettersHolder class looks these up.
186#
187# We use -keepclassmembernames because we want for ImmutableMultimap and its
188# fields to be stripped if it's unused: -keepclassmembernames says that, *if*
189# you're keeping the fields, you need to leave their names untouched. (Anyone
190# who is using ImmutableMultimap will certainly be using its fields. So we
191# don't need to worry that an ImmutableMultimap user will have the fields
192# optimized away.)
193#
194# This configuration is untested....
195
196-keepclassmembernames class com.google.common.collect.ImmutableMultimap {
197 *** map;
198 *** size;
199}
200# similarly:
201-keepclassmembernames class com.google.common.collect.ConcurrentHashMultiset {
202 *** countMap;
203}
204# similarly:
205-keepclassmembernames class com.google.common.collect.ImmutableSetMultimap {
206 *** emptySet;
207}
208# similarly:
209-keepclassmembernames class com.google.common.collect.AbstractSortedMultiset {
210 *** comparator;
211}
212# similarly:
213-keepclassmembernames class com.google.common.collect.TreeMultiset {
214 *** range;
215 *** rootReference;
216 *** header;
217}
218
219# concurrent
220
221# Futures.getChecked, in both of its variants, is incompatible with proguard.
222
223# Used by AtomicReferenceFieldUpdater, sun.misc.Unsafe, and VarHandle.
224# We could be more precise about which classes these are defined in, but that feels error-prone.
225-keepclassmembers class com.google.common.util.concurrent.AbstractFuture** {
226 *** waitersField;
227 *** valueField;
228 *** listenersField;
229 *** thread;
230 *** next;
231}
232-keepclassmembers class com.google.common.util.concurrent.AbstractFutureState** {
233 *** waitersField;
234 *** valueField;
235 *** listenersField;
236 *** thread;
237 *** next;
238}
239-keepclassmembers class com.google.common.util.concurrent.AtomicDouble {
240 *** value;
241}
242-keepclassmembers class com.google.common.util.concurrent.AggregateFutureState {
243 *** remainingField;
244 *** seenExceptionsField;
245}
246
247# Since Unsafe is using the field offsets of these inner classes, we don't want
248# to have class merging or similar tricks applied to these classes and their
249# fields. It's safe to allow obfuscation, since the by-name references are
250# already preserved in the -keep statement above.
251-keep,allowshrinking,allowobfuscation class com.google.common.util.concurrent.AbstractFuture** {
252 <fields>;
253}
254-keep,allowshrinking,allowobfuscation class com.google.common.util.concurrent.AbstractFutureState** {
255 <fields>;
256}
257
258# AbstractFuture uses this
259-dontwarn sun.misc.Unsafe
260
261# MoreExecutors references AppEngine
262-dontnote com.google.appengine.api.ThreadManager
263-keep class com.google.appengine.api.ThreadManager {
264 static *** currentRequestThreadFactory(...);
265}
266-dontnote com.google.apphosting.api.ApiProxy
267-keep class com.google.apphosting.api.ApiProxy {
268 static *** getCurrentEnvironment (...);
269}
270
271# guava - hash.pro
272
273# LittleEndianByteArray uses this
274-dontwarn sun.misc.Unsafe
275
276# Striped64 appears to make some assumptions about object layout that
277# really might not be safe. This should be investigated.
278-keepclassmembers class com.google.common.hash.Striped64 {
279 *** base;
280 *** busy;
281}
282-keepclassmembers class com.google.common.hash.Striped64$Cell {
283 <fields>;
284}
285
286# UnsignedBytes uses this
287-dontwarn sun.misc.Unsafe

Built with passion for open-source software, XMPP, privacy, and security —
the belief that people deserve communication tools that serve them, not surveil them.

Dedicated to every brave man and woman who stands up against tyranny and oppression across the world.
And in memory of those who were silenced before they could speak freely.