summaryrefslogtreecommitdiffstats
path: root/mobile/android/config/proguard
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /mobile/android/config/proguard
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'mobile/android/config/proguard')
-rw-r--r--mobile/android/config/proguard/adjust-keeps.cfg20
-rw-r--r--mobile/android/config/proguard/appcompat-v7-keeps.cfg11
-rw-r--r--mobile/android/config/proguard/leakcanary-keeps.cfg7
-rw-r--r--mobile/android/config/proguard/play-services-keeps.cfg19
-rw-r--r--mobile/android/config/proguard/proguard-android.cfg78
-rw-r--r--mobile/android/config/proguard/proguard.cfg185
-rw-r--r--mobile/android/config/proguard/strip-libs.cfg41
7 files changed, 361 insertions, 0 deletions
diff --git a/mobile/android/config/proguard/adjust-keeps.cfg b/mobile/android/config/proguard/adjust-keeps.cfg
new file mode 100644
index 000000000..0c0fc2158
--- /dev/null
+++ b/mobile/android/config/proguard/adjust-keeps.cfg
@@ -0,0 +1,20 @@
+# Rules to make the Adjust install tracking library work.
+# via https://github.com/adjust/android_sdk#5-add-permissions
+
+-keep class com.adjust.sdk.plugin.MacAddressUtil {
+ java.lang.String getMacAddress(android.content.Context);
+}
+-keep class com.adjust.sdk.plugin.AndroidIdUtil {
+ java.lang.String getAndroidId(android.content.Context);
+}
+-keep class com.google.android.gms.common.ConnectionResult {
+ int SUCCESS;
+}
+-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
+ com.google.android.gms.ads.identifier.AdvertisingIdClient$Info
+ getAdvertisingIdInfo (android.content.Context);
+}
+-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
+ java.lang.String getId ();
+ boolean isLimitAdTrackingEnabled();
+}
diff --git a/mobile/android/config/proguard/appcompat-v7-keeps.cfg b/mobile/android/config/proguard/appcompat-v7-keeps.cfg
new file mode 100644
index 000000000..fdaa2a4aa
--- /dev/null
+++ b/mobile/android/config/proguard/appcompat-v7-keeps.cfg
@@ -0,0 +1,11 @@
+# Avoid https://code.google.com/p/android/issues/detail?id=187611 and
+# http://stackoverflow.com/q/32813894 when building with Gradle. Why
+# these aren't defined in appcompat-v7.aar/proguard.txt is beyond me.
+
+-keep public class android.support.v7.widget.** { *; }
+-keep public class android.support.v7.internal.widget.** { *; }
+-keep public class android.support.v7.internal.view.menu.** { *; }
+
+-keep public class * extends android.support.v4.view.ActionProvider {
+ public <init>(android.content.Context);
+}
diff --git a/mobile/android/config/proguard/leakcanary-keeps.cfg b/mobile/android/config/proguard/leakcanary-keeps.cfg
new file mode 100644
index 000000000..f9e5df87c
--- /dev/null
+++ b/mobile/android/config/proguard/leakcanary-keeps.cfg
@@ -0,0 +1,7 @@
+# LeakCanary
+-keep class org.eclipse.mat.** { *; }
+-keep class com.squareup.leakcanary.** { *; }
+-keep class com.squareup.haha.** { *; }
+
+# With LeakCanary 1.4-beta1 this creates a pile of warnings
+-dontwarn com.squareup.haha.**
diff --git a/mobile/android/config/proguard/play-services-keeps.cfg b/mobile/android/config/proguard/play-services-keeps.cfg
new file mode 100644
index 000000000..b3aaf80aa
--- /dev/null
+++ b/mobile/android/config/proguard/play-services-keeps.cfg
@@ -0,0 +1,19 @@
+# Rules to prevent Google Play Services from exploding
+# (From http://developer.android.com/google/play-services/setup.html#Proguard
+# With the reference to "Object" changed so it'll actually *work*...)
+-keep class * extends java.util.ListResourceBundle {
+ protected java.lang.Object[][] getContents();
+}
+
+-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
+ public static final *** NULL;
+}
+
+-keepnames @com.google.android.gms.common.annotation.KeepName class *
+-keepclassmembernames class * {
+ @com.google.android.gms.common.annotation.KeepName *;
+}
+
+-keepnames class * implements android.os.Parcelable {
+ public static final ** CREATOR;
+}
diff --git a/mobile/android/config/proguard/proguard-android.cfg b/mobile/android/config/proguard/proguard-android.cfg
new file mode 100644
index 000000000..93acf28d1
--- /dev/null
+++ b/mobile/android/config/proguard/proguard-android.cfg
@@ -0,0 +1,78 @@
+# This is a configuration file for ProGuard.
+# http://proguard.sourceforge.net/index.html#manual/usage.html
+#
+# Starting with version 2.2 of the Android plugin for Gradle, these files are no longer used. Newer
+# versions are distributed with the plugin and unpacked at build time. Files in this directory are
+# no longer maintained.
+
+-dontusemixedcaseclassnames
+-dontskipnonpubliclibraryclasses
+-verbose
+
+# Optimization is turned off by default. Dex does not like code run
+# through the ProGuard optimize and preverify steps (and performs some
+# of these optimizations on its own).
+-dontoptimize
+-dontpreverify
+# Note that if you want to enable optimization, you cannot just
+# include optimization flags in your own project configuration file;
+# instead you will need to point to the
+# "proguard-android-optimize.txt" file instead of this one from your
+# project.properties file.
+
+-keepattributes *Annotation*
+-keep public class com.google.vending.licensing.ILicensingService
+-keep public class com.android.vending.licensing.ILicensingService
+
+# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
+-keepclasseswithmembernames class * {
+ native <methods>;
+}
+
+# keep setters in Views so that animations can still work.
+# see http://proguard.sourceforge.net/manual/examples.html#beans
+-keepclassmembers public class * extends android.view.View {
+ void set*(***);
+ *** get*();
+}
+
+# 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);
+}
+
+# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
+-keepclassmembers enum * {
+ public static **[] values();
+ public static ** valueOf(java.lang.String);
+}
+
+-keepclassmembers class * implements android.os.Parcelable {
+ public static final android.os.Parcelable$Creator CREATOR;
+}
+
+-keepclassmembers class **.R$* {
+ public static <fields>;
+}
+
+# The support library contains references to newer platform versions.
+# Don't warn about those in case this app is linking against an older
+# platform version. We know about them, and they are safe.
+-dontwarn android.support.**
+
+# Understand the @Keep support annotation.
+-keep class android.support.annotation.Keep
+
+-keep @android.support.annotation.Keep class * {*;}
+
+-keepclasseswithmembers class * {
+ @android.support.annotation.Keep <methods>;
+}
+
+-keepclasseswithmembers class * {
+ @android.support.annotation.Keep <fields>;
+}
+
+-keepclasseswithmembers class * {
+ @android.support.annotation.Keep <init>(...);
+}
diff --git a/mobile/android/config/proguard/proguard.cfg b/mobile/android/config/proguard/proguard.cfg
new file mode 100644
index 000000000..f44730e72
--- /dev/null
+++ b/mobile/android/config/proguard/proguard.cfg
@@ -0,0 +1,185 @@
+# Dalvik renders preverification unuseful (Would just slightly bloat the file).
+-dontpreverify
+
+# Uncomment to have Proguard list dead code detected during the run - useful for cleaning up the codebase.
+# -printusage
+
+-dontskipnonpubliclibraryclassmembers
+-verbose
+-allowaccessmodification
+
+# Preserve all fundamental application classes.
+-keep public class * extends android.app.Activity
+-keep public class * extends android.app.Application
+-keep public class * extends android.app.Service
+-keep public class * extends android.app.backup.BackupAgentHelper
+-keep public class * extends android.content.BroadcastReceiver
+-keep public class * extends android.content.ContentProvider
+-keep public class * extends android.preference.Preference
+-keep public class * extends org.mozilla.gecko.fxa.sync.FxAccountSyncAdapter
+-keep class org.mozilla.gecko.fxa.sync.FxAccountSyncAdapter
+
+-keep public class * extends android.support.v4.app.Fragment
+
+# Preserve all native method names and the names of their classes.
+-keepclasseswithmembernames class * {
+ native <methods>;
+}
+
+-keepclasseswithmembers class * {
+ public <init>(android.content.Context, android.util.AttributeSet, int);
+}
+
+-keepclassmembers class * extends android.app.Activity {
+ public void *(android.view.View);
+}
+
+
+# Keep setters in Views so that animations can still work.
+# See http://proguard.sourceforge.net/manual/examples.html#beans
+# From tools/proguard/proguard-android.txt.
+-keepclassmembers public class * extends android.view.View {
+ void set*(***);
+ *** get*();
+}
+
+# Keep setters in support Fragment so that Robocop tests work,
+# specifically testBrowserSearchVisibility.
+-keepclassmembers public class * extends android.support.v4.app.Fragment {
+ void set*(***);
+ *** get*();
+}
+
+# Preserve enums. (For awful reasons, the runtime accesses them using introspection...)
+-keepclassmembers enum * {
+ *;
+}
+
+#
+# Rules from ProGuard's Android example:
+# http://proguard.sourceforge.net/manual/examples.html#androidapplication
+#
+
+# Keep a fixed source file attribute and all line number tables to get line
+# numbers in the stack traces.
+# You can comment this out if you're not interested in stack traces.
+
+-renamesourcefileattribute SourceFile
+-keepattributes SourceFile,LineNumberTable
+
+# RemoteViews might need annotations.
+
+-keepattributes *Annotation*
+
+# Preserve all View implementations, their special context constructors, and
+# their setters.
+
+-keep public class * extends android.view.View {
+ public <init>(android.content.Context);
+ public <init>(android.content.Context, android.util.AttributeSet);
+ public <init>(android.content.Context, android.util.AttributeSet, int);
+ public void set*(...);
+}
+
+# Preserve all classes that have special context constructors, and the
+# constructors themselves.
+
+-keepclasseswithmembers class * {
+ public <init>(android.content.Context, android.util.AttributeSet);
+}
+
+# Preserve the special fields of all Parcelable implementations.
+
+-keepclassmembers class * implements android.os.Parcelable {
+ static android.os.Parcelable$Creator CREATOR;
+}
+
+# Preserve static fields of inner classes of R classes that might be accessed
+# through introspection.
+
+-keepclassmembers class **.R$* {
+ public static <fields>;
+}
+
+# Preserve the required interface from the License Verification Library
+# (but don't nag the developer if the library is not used at all).
+
+-keep public interface com.android.vending.licensing.ILicensingService
+
+-dontnote com.android.vending.licensing.ILicensingService
+
+# The Android Compatibility library references some classes that may not be
+# present in all versions of the API, but we know that's ok.
+
+-dontwarn android.support.**
+
+# Preserve all native method names and the names of their classes.
+
+-keepclasseswithmembernames class * {
+ native <methods>;
+}
+
+#
+# Mozilla-specific rules
+#
+# Merging classes can generate dex warnings about anonymous inner classes.
+-optimizations !class/merging/horizontal
+-optimizations !class/merging/vertical
+
+# This optimisation causes corrupt bytecode if we run more than two passes.
+# Testing shows that running the extra passes of everything else saves us
+# more than this optimisation does, so bye bye!
+-optimizations !code/allocation/variable
+
+# Keep miscellaneous targets.
+
+# Keep Robocop targets. TODO: Can omit these from release builds. Also, Bug 916507.
+
+# Same formula as above...
+-keep @interface org.mozilla.gecko.annotation.RobocopTarget
+-keep @org.mozilla.gecko.annotation.RobocopTarget class *
+-keepclassmembers class * {
+ @org.mozilla.gecko.annotation.RobocopTarget *;
+}
+-keepclassmembers @org.mozilla.gecko.annotation.RobocopTarget class * {
+ *;
+}
+-keepclasseswithmembers class * {
+ @org.mozilla.gecko.annotation.RobocopTarget <methods>;
+}
+-keepclasseswithmembers class * {
+ @org.mozilla.gecko.annotation.RobocopTarget <fields>;
+}
+
+-keep class **.R$*
+
+# Keep all interfaces that might be dynamically required by Java Addons.
+-keep class org.mozilla.javaaddons.* {
+ *;
+}
+
+-keep class org.mozilla.javaaddons.*$* {
+ *;
+}
+
+# Disable obfuscation because it makes exception stack traces more difficult to read.
+-dontobfuscate
+
+# Suppress warnings about missing descriptor classes.
+#-dontnote **,!ch.boye.**,!org.mozilla.gecko.sync.**
+
+-include "play-services-keeps.cfg"
+
+# Don't print spurious warnings from the support library.
+# See: http://stackoverflow.com/questions/22441366/note-android-support-v4-text-icucompatics-cant-find-dynamically-referenced-cl
+-dontnote android.support.**
+
+-include "adjust-keeps.cfg"
+
+-include "leakcanary-keeps.cfg"
+
+-include "appcompat-v7-keeps.cfg"
+
+-include "proguard-android.cfg"
+
+-include "../../geckoview/proguard-rules.txt"
diff --git a/mobile/android/config/proguard/strip-libs.cfg b/mobile/android/config/proguard/strip-libs.cfg
new file mode 100644
index 000000000..80a1f151c
--- /dev/null
+++ b/mobile/android/config/proguard/strip-libs.cfg
@@ -0,0 +1,41 @@
+# Proguard step for stripping debug information.
+#
+# This is useful to work around a bug in the way Proguard handles debug information: it
+# sometimes corrupts it. Classes with corrupt debug information cannot be dexed, but
+# classes with *no* debug information can be. There's no way to configure Proguard to
+# delete debug information on a per-class basis, so we need this special extra step for
+# stripping debug information only from those classes for which the Proguard bug is
+# encountered.
+#
+# Currently, this pass is applied to all bundled library jars for which we are not
+# compiling the source. This is slightly more than is strictly necessary to work around
+# the Proguard bug, but such debug information is of negligible value and stripping it
+# too slightly simplifies the makefile and saves us a handful of kilobytes of binary size.
+#
+# Configuring Proguard to do nothing except strip metadata is done by having it run only
+# the obfuscation pass, but with a configuration that prevents it from renaming any classes.
+# It then attempts to delete class metadata, so we further configure it not to do so for
+# anything except the problematic debug information.
+
+# Run only the obfuscator.
+-dontoptimize
+-dontshrink
+-dontpreverify
+-verbose
+
+# Don't rename anything.
+-keeppackagenames
+
+# Seriously, don't rename anything.
+-keep class *
+-keepclassmembers class * {
+ *;
+}
+
+# Don't delete other useful metadata.
+-keepattributes Exceptions,InnerClasses,Signature,Deprecated,*Annotation*,EnclosingMethod
+
+# Don't print spurious warnings from the support library.
+# See: http://stackoverflow.com/questions/22441366/note-android-support-v4-text-icucompatics-cant-find-dynamically-referenced-cl
+-dontnote android.support.**
+-dontwarn android.support.**