Bug 1415778 - Part 2: Move AppConstants to o.m.geckoview.BuildConfig. r=jchen
authorNick Alexander <nalexander@mozilla.com>
Wed, 08 Nov 2017 21:14:44 -0800
changeset 391800 721a4ebc14c49da057bcddaaf337b1759dc3a58f
parent 391799 cf5e219ebfdaa3267ce408809414fca54cedadca
child 391801 e4807befdc6a47767c4fb3e6573061588593ea0d
push id55343
push usernalexander@mozilla.com
push dateTue, 14 Nov 2017 21:06:47 +0000
treeherderautoland@e4807befdc6a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjchen
bugs1415778
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1415778 - Part 2: Move AppConstants to o.m.geckoview.BuildConfig. r=jchen Some of these make no sense for GeckoView, but perfect is the enemy of the good here. MozReview-Commit-ID: 9MwRkc61v9P
mobile/android/geckoview/BuildConfig.java.in
mobile/android/geckoview/build.gradle
mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashHandler.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/EventDispatcher.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHLSDemuxerWrapper.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHLSResourceWrapper.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsAudioRenderer.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsPlayer.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsRendererBase.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsVideoRenderer.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/MediaDrmProxy.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/RemoteMediaDrmBridgeStub.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ActivityUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/GeckoBundle.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/IntentUtils.java
--- a/mobile/android/geckoview/BuildConfig.java.in
+++ b/mobile/android/geckoview/BuildConfig.java.in
@@ -49,9 +49,58 @@ public class BuildConfig {
         MOZ_APP_VERSION + ") Gecko/" +
         MOZ_APP_VERSION + " GeckoView/" +
         MOZ_APP_VERSION;
 
     /**
      * Target CPU architecture: "armeabi-v7a", "arm64-v8a", "x86", "mips", ..
      */
     public static final String ANDROID_CPU_ARCH = "@ANDROID_CPU_ARCH@";
+
+    public static final String MOZ_UPDATE_CHANNEL = "@MOZ_UPDATE_CHANNEL@";
+
+    public static final int MIN_SDK_VERSION = @MOZ_ANDROID_MIN_SDK_VERSION@;
+
+    // Is the underlying compiled C/C++ code compiled with --enable-debug?
+    public static final boolean DEBUG_BUILD =
+//#ifdef MOZ_DEBUG
+    true;
+//#else
+    false;
+//#endif
+
+    // See this wiki page for more details about channel specific build defines:
+    // https://wiki.mozilla.org/Platform/Channel-specific_build_defines
+    // This makes no sense for GeckoView and should be removed as soon as possible.
+    public static final boolean RELEASE_OR_BETA =
+//#ifdef RELEASE_OR_BETA
+    true;
+//#else
+    false;
+//#endif
+
+    // This makes no sense for GeckoView and should be removed as soon as possible.
+    public static final boolean NIGHTLY_BUILD =
+//#ifdef NIGHTLY_BUILD
+    true;
+//#else
+    false;
+//#endif
+
+    // This makes no sense for GeckoView and should be removed as soon as possible.
+    public static final boolean MOZ_CRASHREPORTER =
+//#ifdef MOZ_CRASHREPORTER
+    true;
+//#else
+    false;
+//#endif
+
+    // Official corresponds, roughly, to whether this build is performed on
+    // Mozilla's continuous integration infrastructure. You should disable
+    // developer-only functionality when this flag is set.
+    // This makes no sense for GeckoView and should be removed as soon as possible.
+    public static final boolean MOZILLA_OFFICIAL =
+//#ifdef MOZILLA_OFFICIAL
+    true;
+//#else
+    false;
+//#endif
 }
--- a/mobile/android/geckoview/build.gradle
+++ b/mobile/android/geckoview/build.gradle
@@ -76,16 +76,36 @@ android {
         // MOZILLA_VERSION is oddly quoted from autoconf, but we don't have to handle it specially in Gradle.
         buildConfigField 'String', "MOZILLA_VERSION", "\"${mozconfig.substs.MOZILLA_VERSION}\"";
         buildConfigField 'String', "OMNIJAR_NAME", "\"${mozconfig.substs.OMNIJAR_NAME}\"";
 
         buildConfigField 'String', "USER_AGENT_GECKOVIEW_MOBILE", "\"Mozilla/5.0 (Android \" + android.os.Build.VERSION.RELEASE + \"; Mobile; rv: ${mozconfig.substs.MOZ_APP_VERSION}) Gecko/${mozconfig.substs.MOZ_APP_VERSION} GeckoView/${mozconfig.substs.MOZ_APP_VERSION}\"";
         buildConfigField 'String', "USER_AGENT_GECKOVIEW_TABLET", "\"Mozilla/5.0 (Android \" + android.os.Build.VERSION.RELEASE + \"; Tablet; rv: ${mozconfig.substs.MOZ_APP_VERSION}) Gecko/${mozconfig.substs.MOZ_APP_VERSION} GeckoView/${mozconfig.substs.MOZ_APP_VERSION}\"";
 
         buildConfigField 'String', "ANDROID_CPU_ARCH", "\"${mozconfig.substs.ANDROID_CPU_ARCH}\"";
+
+        buildConfigField 'int', 'MIN_SDK_VERSION', mozconfig.substs.MOZ_ANDROID_MIN_SDK_VERSION;
+
+        // Is the underlying compiled C/C++ code compiled with --enable-debug?
+        buildConfigField 'boolean', 'DEBUG_BUILD', mozconfig.substs.DEBUG_BUILD ? 'true' : 'false';
+
+        // See this wiki page for more details about channel specific build defines:
+        // https://wiki.mozilla.org/Platform/Channel-specific_build_defines
+        // This makes no sense for GeckoView and should be removed as soon as possible.
+        buildConfigField 'boolean', 'RELEASE_OR_BETA', mozconfig.substs.RELEASE_OR_BETA ? 'true' : 'false';
+        // This makes no sense for GeckoView and should be removed as soon as possible.
+        buildConfigField 'boolean', 'NIGHTLY_BUILD', mozconfig.substs.NIGHTLY_BUILD ? 'true' : 'false';
+        // This makes no sense for GeckoView and should be removed as soon as possible.
+        buildConfigField 'boolean', 'MOZ_CRASHREPORTER', mozconfig.substs.MOZ_CRASH_REPORTER ? 'true' : 'false';
+
+        // Official corresponds, roughly, to whether this build is performed on
+        // Mozilla's continuous integration infrastructure. You should disable
+        // developer-only functionality when this flag is set.
+        // This makes no sense for GeckoView and should be removed as soon as possible.
+        buildConfigField 'boolean', 'MOZILLA_OFFICIAL', mozconfig.substs.MOZILLA_OFFICIAL ? 'true' : 'false';
     }
 
     buildTypes {
         withGeckoBinaries {
             initWith release
         }
         withoutGeckoBinaries { // For clarity and consistency throughout the tree.
             initWith release
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashHandler.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashHandler.java
@@ -22,16 +22,18 @@ import android.content.Intent;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.net.Uri;
 import android.os.Build;
 import android.os.Bundle;
 import android.os.Process;
 import android.util.Log;
 
+import org.mozilla.geckoview.BuildConfig;
+
 public class CrashHandler implements Thread.UncaughtExceptionHandler {
 
     private static final String LOGTAG = "GeckoCrashHandler";
     private static final Thread MAIN_THREAD = Thread.currentThread();
     private static final String DEFAULT_SERVER_URL =
         "https://crash-reports.mozilla.com/submit?id=%1$s&version=%2$s&buildid=%3$s";
 
     // Context for getting device information
@@ -303,18 +305,16 @@ public class CrashHandler implements Thr
                 final Intent intent = new Intent(action);
                 intent.setComponent(new ComponentName(pkg, component));
                 intent.putExtra("minidumpPath", dumpFile);
                 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                 context.startActivity(intent);
                 return true;
             }
 
-            // Avoid AppConstants dependency for SDK version constants,
-            // because CrashHandler could be used outside of Fennec code.
             if (Build.VERSION.SDK_INT < 17) {
                 pb = new ProcessBuilder(
                     "/system/bin/am", "start",
                     "-a", action,
                     "-n", pkg + '/' + component,
                     "--es", "minidumpPath", dumpFile);
             } else {
                 pb = new ProcessBuilder(
@@ -451,28 +451,28 @@ public class CrashHandler implements Thr
     }
 
     public static CrashHandler createDefaultCrashHandler(final Context context) {
         return new CrashHandler(context) {
             @Override
             protected Bundle getCrashExtras(final Thread thread, final Throwable exc) {
                 final Bundle extras = super.getCrashExtras(thread, exc);
 
-                extras.putString("ProductName", AppConstants.MOZ_APP_BASENAME);
-                extras.putString("ProductID", AppConstants.MOZ_APP_ID);
-                extras.putString("Version", AppConstants.MOZ_APP_VERSION);
-                extras.putString("BuildID", AppConstants.MOZ_APP_BUILDID);
-                extras.putString("Vendor", AppConstants.MOZ_APP_VENDOR);
-                extras.putString("ReleaseChannel", AppConstants.MOZ_UPDATE_CHANNEL);
+                extras.putString("ProductName", BuildConfig.MOZ_APP_BASENAME);
+                extras.putString("ProductID", BuildConfig.MOZ_APP_ID);
+                extras.putString("Version", BuildConfig.MOZ_APP_VERSION);
+                extras.putString("BuildID", BuildConfig.MOZ_APP_BUILDID);
+                extras.putString("Vendor", BuildConfig.MOZ_APP_VENDOR);
+                extras.putString("ReleaseChannel", BuildConfig.MOZ_UPDATE_CHANNEL);
                 return extras;
             }
 
             @Override
             public boolean reportException(final Thread thread, final Throwable exc) {
-                if (AppConstants.MOZ_CRASHREPORTER && AppConstants.MOZILLA_OFFICIAL) {
+                if (BuildConfig.MOZ_CRASHREPORTER && BuildConfig.MOZILLA_OFFICIAL) {
                     // Only use Java crash reporter if enabled on official build.
                     return super.reportException(thread, exc);
                 }
                 return false;
             }
         };
     }
 }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/EventDispatcher.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/EventDispatcher.java
@@ -9,16 +9,17 @@ package org.mozilla.gecko;
 import org.mozilla.gecko.annotation.ReflectionTarget;
 import org.mozilla.gecko.annotation.RobocopTarget;
 import org.mozilla.gecko.annotation.WrapForJNI;
 import org.mozilla.gecko.mozglue.JNIObject;
 import org.mozilla.gecko.util.BundleEventListener;
 import org.mozilla.gecko.util.EventCallback;
 import org.mozilla.gecko.util.GeckoBundle;
 import org.mozilla.gecko.util.ThreadUtils;
+import org.mozilla.geckoview.BuildConfig;
 
 import org.json.JSONException;
 import org.json.JSONObject;
 
 import android.os.Bundle;
 import android.os.Handler;
 import android.util.Log;
 
@@ -111,30 +112,30 @@ public final class EventDispatcher exten
                     List<T> listeners = listenersMap.get(event);
                     if (listeners == null) {
                         // Java doesn't let us put Class<? extends List<T>> as the type for listType.
                         @SuppressWarnings("unchecked")
                         final Class<? extends List<T>> type = (Class) listType;
                         listeners = type.newInstance();
                         listenersMap.put(event, listeners);
                     }
-                    if (!AppConstants.RELEASE_OR_BETA && listeners.contains(listener)) {
+                    if (!BuildConfig.RELEASE_OR_BETA && listeners.contains(listener)) {
                         throw new IllegalStateException("Already registered " + event);
                     }
                     listeners.add(listener);
                 }
             }
         } catch (final IllegalAccessException | InstantiationException e) {
             throw new IllegalArgumentException("Invalid new list type", e);
         }
     }
 
     private void checkNotRegisteredElsewhere(final Map<String, ?> allowedMap,
                                              final String[] events) {
-        if (AppConstants.RELEASE_OR_BETA) {
+        if (BuildConfig.RELEASE_OR_BETA) {
             // for performance reasons, we only check for
             // already-registered listeners in non-release builds.
             return;
         }
         for (final Map<String, ?> listenersMap : Arrays.asList(mGeckoThreadListeners,
                                                                mUiThreadListeners,
                                                                mBackgroundThreadListeners)) {
             if (listenersMap == allowedMap) {
@@ -156,17 +157,17 @@ public final class EventDispatcher exten
                                         final String[] events) {
         synchronized (listenersMap) {
             for (final String event : events) {
                 if (event == null) {
                     continue;
                 }
                 List<T> listeners = listenersMap.get(event);
                 if ((listeners == null ||
-                     !listeners.remove(listener)) && !AppConstants.RELEASE_OR_BETA) {
+                     !listeners.remove(listener)) && !BuildConfig.RELEASE_OR_BETA) {
                     throw new IllegalArgumentException(event + " was not registered");
                 }
             }
         }
     }
 
     public void registerGeckoThreadListener(final BundleEventListener listener,
                                             final String... events) {
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
@@ -32,16 +32,17 @@ import org.mozilla.gecko.gfx.BitmapUtils
 import org.mozilla.gecko.permissions.Permissions;
 import org.mozilla.gecko.process.GeckoProcessManager;
 import org.mozilla.gecko.SysInfo;
 import org.mozilla.gecko.util.HardwareCodecCapabilityUtils;
 import org.mozilla.gecko.util.HardwareUtils;
 import org.mozilla.gecko.util.IOUtils;
 import org.mozilla.gecko.util.ProxySelector;
 import org.mozilla.gecko.util.ThreadUtils;
+import org.mozilla.geckoview.BuildConfig;
 
 import android.Manifest;
 import android.annotation.SuppressLint;
 import android.app.Activity;
 import android.app.ActivityManager;
 import android.content.Context;
 import android.content.Intent;
 import android.content.SharedPreferences;
@@ -124,22 +125,22 @@ public class GeckoAppShell
         protected Context getAppContext() {
             return getApplicationContext();
         }
 
         @Override
         protected Bundle getCrashExtras(final Thread thread, final Throwable exc) {
             final Bundle extras = super.getCrashExtras(thread, exc);
 
-            extras.putString("ProductName", AppConstants.MOZ_APP_BASENAME);
-            extras.putString("ProductID", AppConstants.MOZ_APP_ID);
-            extras.putString("Version", AppConstants.MOZ_APP_VERSION);
-            extras.putString("BuildID", AppConstants.MOZ_APP_BUILDID);
-            extras.putString("Vendor", AppConstants.MOZ_APP_VENDOR);
-            extras.putString("ReleaseChannel", AppConstants.MOZ_UPDATE_CHANNEL);
+            extras.putString("ProductName", BuildConfig.MOZ_APP_BASENAME);
+            extras.putString("ProductID", BuildConfig.MOZ_APP_ID);
+            extras.putString("Version", BuildConfig.MOZ_APP_VERSION);
+            extras.putString("BuildID", BuildConfig.MOZ_APP_BUILDID);
+            extras.putString("Vendor", BuildConfig.MOZ_APP_VENDOR);
+            extras.putString("ReleaseChannel", BuildConfig.MOZ_UPDATE_CHANNEL);
 
             final String appNotes = getAppNotes();
             if (appNotes != null) {
                 extras.putString("Notes", appNotes);
             }
             return extras;
         }
 
@@ -159,17 +160,17 @@ public class GeckoAppShell
 
                 reportJavaCrash(exc, getExceptionStackTrace(exc));
 
             } catch (final Throwable e) {
             }
 
             // reportJavaCrash should have caused us to hard crash. If we're still here,
             // it probably means Gecko is not loaded, and we should do something else.
-            if (AppConstants.MOZ_CRASHREPORTER && AppConstants.MOZILLA_OFFICIAL) {
+            if (BuildConfig.MOZ_CRASHREPORTER && BuildConfig.MOZILLA_OFFICIAL) {
                 // Only use Java crash reporter if enabled on official build.
                 return super.reportException(thread, exc);
             }
             return false;
         }
     };
 
     private static String sAppNotes;
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHLSDemuxerWrapper.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHLSDemuxerWrapper.java
@@ -4,23 +4,23 @@
 
 
 package org.mozilla.gecko.media;
 
 import android.util.Log;
 
 import java.util.concurrent.ConcurrentLinkedQueue;
 
-import org.mozilla.gecko.AppConstants;
+import org.mozilla.geckoview.BuildConfig;
 import org.mozilla.gecko.annotation.WrapForJNI;
 import org.mozilla.gecko.mozglue.JNIObject;
 
 public final class GeckoHLSDemuxerWrapper {
     private static final String LOGTAG = "GeckoHLSDemuxerWrapper";
-    private static final boolean DEBUG = AppConstants.NIGHTLY_BUILD || AppConstants.DEBUG_BUILD;;
+    private static final boolean DEBUG = BuildConfig.NIGHTLY_BUILD || BuildConfig.DEBUG_BUILD;;
 
     // NOTE : These TRACK definitions should be synced with Gecko.
     public enum TrackType {
         UNDEFINED(0),
         AUDIO(1),
         VIDEO(2),
         TEXT(3);
         private int mType;
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHLSResourceWrapper.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHLSResourceWrapper.java
@@ -1,23 +1,23 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.media;
 
 import android.util.Log;
 
-import org.mozilla.gecko.AppConstants;
+import org.mozilla.geckoview.BuildConfig;
 import org.mozilla.gecko.annotation.WrapForJNI;
 import org.mozilla.gecko.mozglue.JNIObject;
 
 public class GeckoHLSResourceWrapper {
     private static final String LOGTAG = "GeckoHLSResourceWrapper";
-    private static final boolean DEBUG = AppConstants.NIGHTLY_BUILD || AppConstants.DEBUG_BUILD;
+    private static final boolean DEBUG = BuildConfig.NIGHTLY_BUILD || BuildConfig.DEBUG_BUILD;
     private BaseHlsPlayer mPlayer = null;
     private boolean mDestroy = false;
 
     public static class Callbacks extends JNIObject
     implements BaseHlsPlayer.ResourceCallbacks {
         @WrapForJNI(calledFrom = "gecko")
         Callbacks() {}
 
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsAudioRenderer.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsAudioRenderer.java
@@ -5,17 +5,17 @@
 package org.mozilla.gecko.media;
 
 import android.media.MediaCodec;
 import android.media.MediaCodec.BufferInfo;
 import android.media.MediaCodec.CryptoInfo;
 import android.os.Build;
 import android.util.Log;
 
-import org.mozilla.gecko.AppConstants;
+import org.mozilla.geckoview.BuildConfig;
 
 import com.google.android.exoplayer2.C;
 import com.google.android.exoplayer2.Format;
 import com.google.android.exoplayer2.RendererCapabilities;
 import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
 import com.google.android.exoplayer2.mediacodec.MediaCodecInfo;
 import com.google.android.exoplayer2.mediacodec.MediaCodecSelector;
 import com.google.android.exoplayer2.mediacodec.MediaCodecUtil;
@@ -23,17 +23,17 @@ import com.google.android.exoplayer2.uti
 
 import java.nio.ByteBuffer;
 
 public class GeckoHlsAudioRenderer extends GeckoHlsRendererBase {
     public GeckoHlsAudioRenderer(GeckoHlsPlayer.ComponentEventDispatcher eventDispatcher) {
         super(C.TRACK_TYPE_AUDIO, eventDispatcher);
         assertTrue(Build.VERSION.SDK_INT >= 16);
         LOGTAG = getClass().getSimpleName();
-        DEBUG = AppConstants.NIGHTLY_BUILD || AppConstants.DEBUG_BUILD;;
+        DEBUG = BuildConfig.NIGHTLY_BUILD || BuildConfig.DEBUG_BUILD;;
     }
 
     @Override
     public final int supportsFormat(Format format) {
         /*
          * FORMAT_EXCEEDS_CAPABILITIES : The Renderer is capable of rendering
          *                               formats with the same mime type, but
          *                               the properties of the format exceed
@@ -134,17 +134,17 @@ public class GeckoHlsAudioRenderer exten
         // should indicate to the last(latest) format.
         GeckoHLSSample sample = GeckoHLSSample.create(buffer,
                                                       bufferInfo,
                                                       cryptoInfo,
                                                       mFormats.size() - 1);
 
         mDemuxedInputSamples.offer(sample);
 
-        if (AppConstants.DEBUG_BUILD) {
+        if (BuildConfig.DEBUG_BUILD) {
             Log.d(LOGTAG, "Demuxed sample PTS : " +
                           sample.info.presentationTimeUs + ", duration :" +
                           sample.duration + ", formatIndex(" +
                           sample.formatIndex + "), queue size : " +
                           mDemuxedInputSamples.size());
         }
     }
 
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsPlayer.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsPlayer.java
@@ -31,29 +31,29 @@ import com.google.android.exoplayer2.ups
 import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
 import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
 import com.google.android.exoplayer2.upstream.DefaultHttpDataSource;
 import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory;
 import com.google.android.exoplayer2.upstream.HttpDataSource;
 import com.google.android.exoplayer2.util.MimeTypes;
 import com.google.android.exoplayer2.util.Util;
 
-import org.mozilla.gecko.AppConstants;
 import org.mozilla.gecko.GeckoAppShell;
 import org.mozilla.gecko.annotation.ReflectionTarget;
+import org.mozilla.geckoview.BuildConfig;
 
 import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.atomic.AtomicInteger;
 
 @ReflectionTarget
 public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
     private static final String LOGTAG = "GeckoHlsPlayer";
     private static final DefaultBandwidthMeter BANDWIDTH_METER = new DefaultBandwidthMeter();
     private static final int MAX_TIMELINE_ITEM_LINES = 3;
-    private static final boolean DEBUG = AppConstants.NIGHTLY_BUILD || AppConstants.DEBUG_BUILD;
+    private static final boolean DEBUG = BuildConfig.NIGHTLY_BUILD || BuildConfig.DEBUG_BUILD;
 
     private static AtomicInteger sPlayerId = new AtomicInteger(0);
     /*
      *  Because we treat GeckoHlsPlayer as a source data provider.
      *  It will be created and initialized with a URL by HLSResource in
      *  Gecko media pipleine (in cpp). Once HLSDemuxer is created later, we
      *  need to bridge this HLSResource to the created demuxer. And they share
      *  the same GeckoHlsPlayer.
@@ -262,17 +262,17 @@ public class GeckoHlsPlayer implements B
 
     private DataSource.Factory buildDataSourceFactory(Context ctx, DefaultBandwidthMeter bandwidthMeter) {
         return new DefaultDataSourceFactory(ctx, bandwidthMeter,
                 buildHttpDataSourceFactory(bandwidthMeter));
     }
 
     private HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
         return new DefaultHttpDataSourceFactory(
-            AppConstants.USER_AGENT_FENNEC_MOBILE,
+            BuildConfig.USER_AGENT_GECKOVIEW_MOBILE,
             bandwidthMeter /* listener */,
             DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
             DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS,
             true /* allowCrossProtocolRedirects */
         );
     }
 
     private synchronized long getDuration() {
@@ -815,9 +815,9 @@ public class GeckoHlsPlayer implements B
             mThread.quit();
             mThread = null;
         }
         mDemuxerCallbacks = null;
         mResourceCallbacks = null;
         mIsPlayerInitDone = false;
         mIsDemuxerInitDone = false;
     }
-}
\ No newline at end of file
+}
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsRendererBase.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsRendererBase.java
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.media;
 
 import android.util.Log;
 
-import org.mozilla.gecko.AppConstants;
+import org.mozilla.geckoview.BuildConfig;
 
 import com.google.android.exoplayer2.BaseRenderer;
 import com.google.android.exoplayer2.C;
 import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
 import com.google.android.exoplayer2.Format;
 import com.google.android.exoplayer2.FormatHolder;
 
 import java.nio.ByteBuffer;
@@ -284,17 +284,17 @@ public abstract class GeckoHlsRendererBa
 
     /*
      * This is called by ExoPlayerImplInternal.java.
      * ExoPlayer checks the status of renderer, i.e. isReady() / isEnded(), and
      * calls renderer.render by passing its wall clock time.
      */
     @Override
     public void render(long positionUs, long elapsedRealtimeUs) {
-        if (AppConstants.DEBUG_BUILD) {
+        if (BuildConfig.DEBUG_BUILD) {
             Log.d(LOGTAG, "positionUs = " + positionUs +
                           ", mInputStreamEnded = " + mInputStreamEnded);
         }
         if (mInputStreamEnded) {
             return;
         }
         if (mFormats.size() == 0) {
             readFormat();
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsVideoRenderer.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/GeckoHlsVideoRenderer.java
@@ -5,17 +5,17 @@
 package org.mozilla.gecko.media;
 
 import android.media.MediaCodec;
 import android.media.MediaCodec.BufferInfo;
 import android.media.MediaCodec.CryptoInfo;
 import android.os.Build;
 import android.util.Log;
 
-import org.mozilla.gecko.AppConstants;
+import org.mozilla.geckoview.BuildConfig;
 
 import com.google.android.exoplayer2.C;
 import com.google.android.exoplayer2.Format;
 import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
 import com.google.android.exoplayer2.mediacodec.MediaCodecInfo;
 import com.google.android.exoplayer2.mediacodec.MediaCodecSelector;
 import com.google.android.exoplayer2.mediacodec.MediaCodecUtil;
 import com.google.android.exoplayer2.RendererCapabilities;
@@ -51,17 +51,17 @@ public class GeckoHlsVideoRenderer exten
     // prepending each keyframe. When video format changes, this information
     // changes accordingly.
     private byte[] mCSDInfo = null;
 
     public GeckoHlsVideoRenderer(GeckoHlsPlayer.ComponentEventDispatcher eventDispatcher) {
         super(C.TRACK_TYPE_VIDEO, eventDispatcher);
         assertTrue(Build.VERSION.SDK_INT >= 16);
         LOGTAG = getClass().getSimpleName();
-        DEBUG = AppConstants.NIGHTLY_BUILD || AppConstants.DEBUG_BUILD;;
+        DEBUG = BuildConfig.NIGHTLY_BUILD || BuildConfig.DEBUG_BUILD;;
     }
 
     @Override
     public final int supportsMixedMimeTypeAdaptation() {
         return ADAPTIVE_NOT_SEAMLESS;
     }
 
     @Override
@@ -346,17 +346,17 @@ public class GeckoHlsVideoRenderer exten
         int range = sizeOfNoDura >= 17 ? 17 : sizeOfNoDura;
         GeckoHLSSample[] inputArray =
             mDemuxedNoDurationSamples.toArray(new GeckoHLSSample[sizeOfNoDura]);
         if (range >= 17 && !mInputStreamEnded) {
             calculateSamplesWithin(inputArray, range);
 
             GeckoHLSSample toQueue = mDemuxedNoDurationSamples.poll();
             mDemuxedInputSamples.offer(toQueue);
-            if (AppConstants.DEBUG_BUILD) {
+            if (BuildConfig.DEBUG_BUILD) {
                 Log.d(LOGTAG, "Demuxed sample PTS : " +
                               toQueue.info.presentationTimeUs + ", duration :" +
                               toQueue.duration + ", isKeyFrame(" +
                               toQueue.isKeyFrame() + ", formatIndex(" +
                               toQueue.formatIndex + "), queue size : " +
                               mDemuxedInputSamples.size() + ", NoDuQueue size : " +
                               mDemuxedNoDurationSamples.size());
             }
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/MediaDrmProxy.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/MediaDrmProxy.java
@@ -5,17 +5,16 @@
 
 package org.mozilla.gecko.media;
 
 import java.util.ArrayList;
 import java.util.UUID;
 
 import org.mozilla.gecko.mozglue.JNIObject;
 import org.mozilla.gecko.annotation.WrapForJNI;
-import org.mozilla.gecko.AppConstants;
 
 import android.media.MediaCodecInfo;
 import android.media.MediaCodecList;
 import android.media.MediaCrypto;
 import android.media.MediaDrm;
 import android.os.Build;
 import android.util.Log;
 
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/RemoteMediaDrmBridgeStub.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/media/RemoteMediaDrmBridgeStub.java
@@ -1,14 +1,13 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.media;
-import org.mozilla.gecko.AppConstants;
 
 import java.util.ArrayList;
 
 import android.media.MediaCrypto;
 import android.os.Build;
 import android.os.IBinder;
 import android.os.RemoteException;
 import android.util.Log;
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ActivityUtils.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ActivityUtils.java
@@ -9,18 +9,16 @@ import android.app.Activity;
 import android.content.Context;
 import android.content.ContextWrapper;
 import android.content.Intent;
 import android.os.Build;
 import android.view.View;
 import android.view.Window;
 import android.view.WindowManager;
 
-import org.mozilla.gecko.AppConstants;
-
 public class ActivityUtils {
     private ActivityUtils() {
     }
 
     public static void setFullScreen(Activity activity, boolean fullscreen) {
         // Hide/show the system notification bar
         Window window = activity.getWindow();
 
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/GeckoBundle.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/GeckoBundle.java
@@ -2,17 +2,16 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.util;
 
 import org.mozilla.gecko.annotation.RobocopTarget;
 import org.mozilla.gecko.annotation.WrapForJNI;
-import org.mozilla.gecko.AppConstants;
 
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
 
 import android.os.Build;
 import android.os.Bundle;
 import android.os.Parcel;
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareUtils.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareUtils.java
@@ -1,18 +1,15 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.util;
 
-import org.mozilla.gecko.AppConstants;
-import org.mozilla.gecko.SysInfo;
-
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.content.res.Configuration;
 import android.os.Build;
 import android.system.Os;
 import android.util.Log;
 
 import org.mozilla.gecko.SysInfo;
@@ -124,17 +121,17 @@ public final class HardwareUtils {
     }
 
     /**
      * @return false if the current system is not supported (e.g. APK/system ABI mismatch).
      */
     public static boolean isSupportedSystem() {
         // We've had crash reports from users on API 10 (with minSDK==15). That shouldn't even install,
         // but since it does we need to protect against it:
-        if (Build.VERSION.SDK_INT < AppConstants.Versions.MIN_SDK_VERSION) {
+        if (Build.VERSION.SDK_INT < BuildConfig.MIN_SDK_VERSION) {
             return false;
         }
 
         // See http://developer.android.com/ndk/guides/abis.html
         final boolean isSystemX86 = isX86System();
         final boolean isSystemARM = !isSystemX86 && isARMSystem();
         final boolean isSystemARM64 = isARM64System();
 
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/IntentUtils.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/IntentUtils.java
@@ -8,17 +8,16 @@ package org.mozilla.gecko.util;
 
 import android.content.ComponentName;
 import android.content.Intent;
 import android.os.Bundle;
 import android.support.annotation.CheckResult;
 import android.support.annotation.NonNull;
 import android.text.TextUtils;
 
-import org.mozilla.gecko.AppConstants;
 import org.mozilla.gecko.mozglue.SafeIntent;
 
 import java.util.HashMap;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 /**
  * Utilities for Intents.