Bug 856163 - Part 2: Move preprocessed code to AppConstants. r=kats,mfinkle,rnewman
authorBrian Nicholson <bnicholson@mozilla.com>
Tue, 09 Apr 2013 17:10:47 -0700
changeset 140026 5966e48d3c633a392a02987f8064c2322a81d4e3
parent 140025 9518bed6e1b89f8c6d182350e15b8bac2bac6dd2
child 140027 948b0710f7278890a7fbd7083705ce26d64be924
push id350
push userbbajaj@mozilla.com
push dateMon, 29 Jul 2013 23:00:49 +0000
treeherdermozilla-release@064965b37dbd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats, mfinkle, rnewman
bugs856163
milestone23.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 856163 - Part 2: Move preprocessed code to AppConstants. r=kats,mfinkle,rnewman
mobile/android/base/AndroidManifest.xml.in
mobile/android/base/App.java.in
mobile/android/base/AppConstants.java.in
mobile/android/base/BrowserApp.java
mobile/android/base/CrashReporter.java
mobile/android/base/CrashReporter.java.in
mobile/android/base/GeckoActivity.java
mobile/android/base/GeckoActivity.java.in
mobile/android/base/GeckoApp.java
mobile/android/base/GeckoAppInfo.java.in
mobile/android/base/GeckoAppShell.java
mobile/android/base/GeckoPreferences.java
mobile/android/base/Makefile.in
mobile/android/base/Restarter.java
mobile/android/base/Restarter.java.in
mobile/android/base/SmsManager.java
mobile/android/base/SmsManager.java.in
mobile/android/base/UpdateService.java
mobile/android/base/UpdateServiceHelper.java
mobile/android/base/UpdateServiceHelper.java.in
mobile/android/base/WebApp.java.in
mobile/android/base/db/BrowserContract.java.in
mobile/android/base/resources/menu-large-v11/browser_app_menu.xml
mobile/android/base/resources/menu-large-v11/browser_app_menu.xml.in
mobile/android/base/resources/menu-v11/browser_app_menu.xml
mobile/android/base/resources/menu-v11/browser_app_menu.xml.in
mobile/android/base/resources/menu-xlarge-v11/browser_app_menu.xml
mobile/android/base/resources/menu-xlarge-v11/browser_app_menu.xml.in
mobile/android/base/resources/menu/browser_app_menu.xml
mobile/android/base/resources/menu/browser_app_menu.xml.in
mobile/android/base/resources/xml/preferences.xml
mobile/android/base/resources/xml/preferences.xml.in
toolkit/crashreporter/nsExceptionHandler.cpp
--- a/mobile/android/base/AndroidManifest.xml.in
+++ b/mobile/android/base/AndroidManifest.xml.in
@@ -66,17 +66,17 @@
                  android:name="org.mozilla.gecko.GeckoApplication"
 		 android:hardwareAccelerated="true"
 #if MOZILLA_OFFICIAL
 		 android:debuggable="false">
 #else
 		 android:debuggable="true">
 #endif
 
-        <activity android:name="App"
+        <activity android:name=".App"
                   android:label="@MOZ_APP_DISPLAYNAME@"
                   android:configChanges="keyboard|keyboardHidden|mcc|mnc|orientation|screenSize"
                   android:windowSoftInputMode="stateUnspecified|adjustResize"
                   android:launchMode="singleTask"
                   android:theme="@style/Gecko.App">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />
@@ -181,30 +181,30 @@
         </receiver>
 
         <receiver android:name="org.mozilla.gecko.ReferrerReceiver" android:exported="true">
             <intent-filter>
                 <action android:name="com.android.vending.INSTALL_REFERRER" />
             </intent-filter>
         </receiver>
 
-        <activity android:name="Restarter"
+        <activity android:name="org.mozilla.gecko.Restarter"
                   android:process="@ANDROID_PACKAGE_NAME@Restarter"
                   android:theme="@style/Gecko">
           <intent-filter>
             <action android:name="org.mozilla.gecko.restart"/>
             <action android:name="org.mozilla.gecko.restart_update"/>
           </intent-filter>
         </activity>
 
 #include ../services/manifests/AnnouncementsAndroidManifest_activities.xml.in
 #include ../services/manifests/SyncAndroidManifest_activities.xml.in
 
 #if MOZ_CRASHREPORTER
-  <activity android:name="CrashReporter"
+  <activity android:name="org.mozilla.gecko.CrashReporter"
             android:label="@string/crash_reporter_title"
             android:icon="@drawable/crash_reporter"
             android:theme="@style/Gecko"
             android:excludeFromRecents="true">
           <intent-filter>
             <action android:name="org.mozilla.gecko.reportCrash" />
           </intent-filter>
 	</activity>
--- a/mobile/android/base/App.java.in
+++ b/mobile/android/base/App.java.in
@@ -1,66 +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/. */
 
 #filter substitution
 package @ANDROID_PACKAGE_NAME@;
 
-import android.view.MenuItem;
-
 import org.mozilla.gecko.BrowserApp;
-import org.mozilla.gecko.GeckoProfile;
-import org.mozilla.gecko.R;
-import org.mozilla.gecko.util.HardwareUtils;
-
-public class App extends BrowserApp {
-    @Override
-    public int getLayout() { return R.layout.gecko_app; }
-
-    @Override
-    public String getPackageName() {
-        return "@ANDROID_PACKAGE_NAME@";
-    }
-
-    @Override
-    public String getContentProcessName() {
-        return "@MOZ_CHILD_PROCESS_NAME@";
-    }
-
-    @Override
-    protected String getDefaultProfileName() {
-        String profile = GeckoProfile.findDefaultProfile(this);
-        return (profile != null ? profile : "default");
-    }
 
-    @Override
-    public String getDefaultUAString() {
-        String deviceType = "Mobile";
-        if (HardwareUtils.isTablet())
-            deviceType = "Tablet";
-        return "Mozilla/5.0 (Android; " + deviceType + "; rv:@MOZ_APP_VERSION@) Gecko/@MOZ_APP_VERSION@ Firefox/@MOZ_APP_VERSION@";
-    }
+/**
+ * This class serves only as a namespace wrapper for BrowserApp.
+ */
+public class App extends BrowserApp {}
 
-    @Override
-    public String getUAStringForHost(String host) {
-        // With our standard UA String, we get a 200 response code and 
-        // client-side redirect from t.co. This bot-like UA gives us a 
-        // 301 response code
-        if ("t.co".equals(host))
-            return "Redirector/@MOZ_APP_VERSION@ (Android; rv:@MOZ_APP_VERSION@)";
-        return getDefaultUAString();
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-#ifdef MOZ_PROFILING
-        if (item.getItemId() == org.mozilla.gecko.R.id.toggle_profiling) {
-            org.mozilla.gecko.GeckoAppShell.sendEventToGecko(
-                org.mozilla.gecko.GeckoEvent.createBroadcastEvent("ToggleProfiling", null));
-            return true;
-        }
-#endif
-        return super.onOptionsItemSelected(item);
-    }
-}
-
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/AppConstants.java.in
@@ -0,0 +1,86 @@
+#filter substitution
+/* -*- 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;
+
+public class AppConstants {
+    public static final String ANDROID_PACKAGE_NAME = "@ANDROID_PACKAGE_NAME@";
+    public static final String BROWSER_INTENT_CLASS = ANDROID_PACKAGE_NAME + ".App";
+    public static final String MANGLED_ANDROID_PACKAGE_NAME = "@MANGLED_ANDROID_PACKAGE_NAME@";
+    public static final String MOZ_APP_ABI = "@MOZ_APP_ABI@";
+    public static final String MOZ_APP_BASENAME = "@MOZ_APP_BASENAME@";
+    public static final String MOZ_APP_BUILDID = "@MOZ_APP_BUILDID@";
+    public static final String MOZ_APP_ID = "@MOZ_APP_ID@";
+    public static final String MOZ_APP_NAME = "@MOZ_APP_NAME@";
+    public static final String MOZ_APP_VERSION = "@MOZ_APP_VERSION@";
+    public static final String MOZ_CHILD_PROCESS_NAME = "@MOZ_CHILD_PROCESS_NAME@";
+    public static final String MOZ_UPDATE_CHANNEL = "@MOZ_UPDATE_CHANNEL@";
+    public static final String OS_TARGET = "@OS_TARGET@";
+
+    public static final String USER_AGENT_BOT_LIKE = "Redirector/" + AppConstants.MOZ_APP_VERSION +
+        " (Android; rv:" + AppConstants.MOZ_APP_VERSION + ")";
+
+    public static final String USER_AGENT_FENNEC_MOBILE = "Mozilla/5.0 (Android; Mobile; rv:" +
+        AppConstants.MOZ_APP_VERSION + ") Gecko/" +
+        AppConstants.MOZ_APP_VERSION + " Firefox/" +
+        AppConstants.MOZ_APP_VERSION;
+
+    public static final String USER_AGENT_FENNEC_TABLET = "Mozilla/5.0 (Android; Tablet; rv:" +
+        AppConstants.MOZ_APP_VERSION + ") Gecko/" +
+        AppConstants.MOZ_APP_VERSION + " Firefox/" +
+        AppConstants.MOZ_APP_VERSION;
+
+    public static final int MOZ_MIN_CPU_VERSION = @MOZ_MIN_CPU_VERSION@;
+
+    public static final boolean MOZ_ANDROID_ANR_REPORTER =
+#ifdef MOZ_ANDROID_ANR_REPORTER
+    true;
+#else
+    false;
+#endif
+
+    public static final String MOZ_PKG_SPECIAL =
+#ifdef MOZ_PKG_SPECIAL
+    "@MOZ_PKG_SPECIAL@";
+#else
+    null;
+#endif
+
+    public static final boolean MOZ_PROFILING =
+#ifdef MOZ_PROFILING
+    true;
+#else
+    false;
+#endif
+
+    public static final boolean MOZ_TELEMETRY_ON_BY_DEFAULT =
+#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
+    true;
+#else
+    false;
+#endif
+
+    public static final boolean MOZ_TELEMETRY_REPORTING =
+#ifdef MOZ_TELEMETRY_REPORTING
+    true;
+#else
+    false;
+#endif
+
+    public static final boolean MOZ_UPDATER =
+#ifdef MOZ_UPDATER
+    true;
+#else
+    false;
+#endif
+
+    public static final boolean MOZ_WEBSMS_BACKEND =
+#ifdef MOZ_WEBSMS_BACKEND
+    true;
+#else
+    false;
+#endif
+}
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -1461,16 +1461,20 @@ abstract public class BrowserApp extends
         MenuItem charEncoding = aMenu.findItem(R.id.char_encoding);
         MenuItem findInPage = aMenu.findItem(R.id.find_in_page);
         MenuItem desktopMode = aMenu.findItem(R.id.desktop_mode);
 
         // Only show the "Quit" menu item on pre-ICS or television devices.
         // In ICS+, it's easy to kill an app through the task switcher.
         aMenu.findItem(R.id.quit).setVisible(Build.VERSION.SDK_INT < 14 || HardwareUtils.isTelevision());
 
+        if (AppConstants.MOZ_PROFILING) {
+            aMenu.findItem(R.id.toggle_profiling).setVisible(true);
+        }
+
         if (tab == null || tab.getURL() == null) {
             bookmark.setEnabled(false);
             forward.setEnabled(false);
             share.setEnabled(false);
             saveAsPDF.setEnabled(false);
             findInPage.setEnabled(false);
             return true;
         }
@@ -1538,16 +1542,21 @@ abstract public class BrowserApp extends
                 return true;
 
         }
         return super.onContextItemSelected(item);
     }
 
     @Override
     public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == R.id.toggle_profiling) {
+            GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("ToggleProfiling", null));
+            return true;
+        }
+
         Tab tab = null;
         Intent intent = null;
         switch (item.getItemId()) {
             case R.id.bookmark:
                 tab = Tabs.getInstance().getSelectedTab();
                 if (tab != null) {
                     if (item.isChecked()) {
                         tab.removeBookmark();
@@ -1722,9 +1731,18 @@ abstract public class BrowserApp extends
     public void onResume()
     {
         super.onResume();
         if (mAboutHomeContent != null) {
             mAboutHomeContent.refresh();
         }
 
     }
+
+    @Override
+    public int getLayout() { return R.layout.gecko_app; }
+
+    @Override
+    protected String getDefaultProfileName() {
+        String profile = GeckoProfile.findDefaultProfile(this);
+        return (profile != null ? profile : "default");
+    }
 }
rename from mobile/android/base/CrashReporter.java.in
rename to mobile/android/base/CrashReporter.java
--- a/mobile/android/base/CrashReporter.java.in
+++ b/mobile/android/base/CrashReporter.java
@@ -1,15 +1,14 @@
 /* -*- Mode: Java; 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/. */
 
-#filter substitution
-package @ANDROID_PACKAGE_NAME@;
+package org.mozilla.gecko;
 
 import java.util.HashMap;
 import java.util.Map;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.FileReader;
@@ -29,20 +28,16 @@ import android.content.SharedPreferences
 import android.os.Build;
 import android.os.Bundle;
 import android.os.Handler;
 import android.util.Log;
 import android.view.View;
 import android.widget.Button;
 import android.widget.CheckBox;
 
-import org.mozilla.gecko.GeckoApp;
-import org.mozilla.gecko.R;
-
-
 public class CrashReporter extends Activity
 {
     private static final String LOGTAG = "GeckoCrashReporter";
 
     private static final String PASSED_MINI_DUMP_KEY = "minidumpPath";
     private static final String MINI_DUMP_PATH_KEY = "upload_file_minidump";
     private static final String PAGE_URL_KEY = "URL";
     private static final String NOTES_KEY = "Notes";
@@ -274,24 +269,25 @@ public class CrashReporter extends Activ
                     sendPart(os, boundary, key, extras.get(key));
                 }
             }
 
             // Add some extra information to notes so its displayed by
             // crash-stats.mozilla.org. Remove this when bug 607942 is fixed.
             StringBuffer sb = new StringBuffer();
             sb.append(extras.containsKey(NOTES_KEY) ? extras.get(NOTES_KEY) + "\n" : "");
-            if (@MOZ_MIN_CPU_VERSION@ < 7)
+            if (AppConstants.MOZ_MIN_CPU_VERSION < 7) {
                 sb.append("nothumb Build\n");
+            }
             sb.append(Build.MANUFACTURER).append(' ')
               .append(Build.MODEL).append('\n')
               .append(Build.FINGERPRINT);
             sendPart(os, boundary, NOTES_KEY, sb.toString());
 
-            sendPart(os, boundary, "Min_ARM_Version", "@MOZ_MIN_CPU_VERSION@");
+            sendPart(os, boundary, "Min_ARM_Version", Integer.toString(AppConstants.MOZ_MIN_CPU_VERSION));
             sendPart(os, boundary, "Android_Manufacturer", Build.MANUFACTURER);
             sendPart(os, boundary, "Android_Model", Build.MODEL);
             sendPart(os, boundary, "Android_Board", Build.BOARD);
             sendPart(os, boundary, "Android_Brand", Build.BRAND);
             sendPart(os, boundary, "Android_Device", Build.DEVICE);
             sendPart(os, boundary, "Android_Display", Build.DISPLAY);
             sendPart(os, boundary, "Android_Fingerprint", Build.FINGERPRINT);
             sendPart(os, boundary, "Android_CPU_ABI", Build.CPU_ABI);
@@ -338,18 +334,18 @@ public class CrashReporter extends Activ
 
         doFinish();
     }
 
     private void doRestart() {
         try {
             String action = "android.intent.action.MAIN";
             Intent intent = new Intent(action);
-            intent.setClassName("@ANDROID_PACKAGE_NAME@",
-                                "@ANDROID_PACKAGE_NAME@.App");
+            intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
+                                AppConstants.BROWSER_INTENT_CLASS);
             Log.i(LOGTAG, intent.toString());
             startActivity(intent);
         } catch (Exception e) {
             Log.e(LOGTAG, "error while trying to restart", e);
         }
     }
 
     private String unescape(String string) {
rename from mobile/android/base/GeckoActivity.java.in
rename to mobile/android/base/GeckoActivity.java
--- a/mobile/android/base/GeckoActivity.java.in
+++ b/mobile/android/base/GeckoActivity.java
@@ -1,14 +1,12 @@
 /* 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/. */
 
-#filter substitution
-
 package org.mozilla.gecko;
 
 import android.app.Activity;
 import android.content.ComponentName;
 import android.content.Intent;
 
 interface GeckoActivityStatus {
     public boolean isGeckoActivityOpened();
@@ -33,29 +31,31 @@ public class GeckoActivity extends Activ
         super.onResume();
 
         if (getApplication() instanceof GeckoApplication) {
             ((GeckoApplication) getApplication()).onActivityResume(this);
             mGeckoActivityOpened = false;
         }
     }
 
-#ifdef MOZ_ANDROID_ANR_REPORTER
     @Override
     public void onCreate(android.os.Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        ANRReporter.register(getApplicationContext());
+        if (AppConstants.MOZ_ANDROID_ANR_REPORTER) {
+            ANRReporter.register(getApplicationContext());
+        }
     }
 
     @Override
     public void onDestroy() {
-        ANRReporter.unregister();
+        if (AppConstants.MOZ_ANDROID_ANR_REPORTER) {
+            ANRReporter.unregister();
+        }
         super.onDestroy();
     }
-#endif
 
     @Override
     public void startActivity(Intent intent) {
         mGeckoActivityOpened = checkIfGeckoActivity(intent);
         super.startActivity(intent);
     }
 
     @Override
@@ -64,19 +64,18 @@ public class GeckoActivity extends Activ
         super.startActivityForResult(intent, request);
     }
 
     private static boolean checkIfGeckoActivity(Intent intent) {
         // Whenever we call our own activity, the component and its package name is set.
         // If we call an activity from another package, or an open intent (leaving android to resolve)
         // component has a different package name or it is null.
         ComponentName component = intent.getComponent();
-        return (component != null
-                && component.getPackageName() != null
-                && component.getPackageName().equals("@ANDROID_PACKAGE_NAME@"));
+        return (component != null &&
+                AppConstants.ANDROID_PACKAGE_NAME.equals(component.getPackageName()));
     }
 
     @Override
     public boolean isGeckoActivityOpened() {
         return mGeckoActivityOpened;
     }
 
     public boolean isApplicationInBackground() {
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -180,16 +180,19 @@ abstract public class GeckoApp
     private String mPrivateBrowsingSession;
 
     private PointF mInitialTouchPoint = null;
 
     abstract public int getLayout();
     abstract public boolean hasTabsSideBar();
     abstract protected String getDefaultProfileName();
 
+    private static final String RESTARTER_ACTION = "org.mozilla.gecko.restart";
+    private static final String RESTARTER_CLASS = "org.mozilla.gecko.Restarter";
+
     void toggleChrome(final boolean aShow) { }
 
     void focusChrome() { }
 
     @Override
     public void onTabChanged(Tab tab, Tabs.TabEvents msg, Object data) {
         // When a tab is closed, it is always unselected first.
         // When a tab is unselected, another tab is always selected first.
@@ -1753,18 +1756,30 @@ abstract public class GeckoApp
         // Some phones (eg. nexus S) need at least a 8x16 preview size
         mMainLayout.addView(cameraView, new AbsoluteLayout.LayoutParams(8, 16, 0, 0));
     }
 
     public void disableCameraView() {
         mMainLayout.removeView(cameraView);
     }
 
-    abstract public String getDefaultUAString();
-    abstract public String getUAStringForHost(String host);
+    public String getDefaultUAString() {
+        return HardwareUtils.isTablet() ? AppConstants.USER_AGENT_FENNEC_TABLET :
+                                          AppConstants.USER_AGENT_FENNEC_MOBILE;
+    }
+
+    public String getUAStringForHost(String host) {
+        // With our standard UA String, we get a 200 response code and
+        // client-side redirect from t.co. This bot-like UA gives us a
+        // 301 response code
+        if ("t.co".equals(host)) {
+            return AppConstants.USER_AGENT_BOT_LIKE;
+        }
+        return getDefaultUAString();
+    }
 
     class PrefetchRunnable implements Runnable {
         private String mPrefetchUrl;
 
         PrefetchRunnable(String prefetchUrl) {
             mPrefetchUrl = prefetchUrl;
         }
 
@@ -2067,43 +2082,42 @@ abstract public class GeckoApp
 
     @Override
     public Object onRetainNonConfigurationInstance() {
         // Send a non-null value so that we can restart the application, 
         // when activity restarts due to configuration change.
         return Boolean.TRUE;
     } 
 
-    @Override
-    abstract public String getPackageName();
-    abstract public String getContentProcessName();
+    public String getContentProcessName() {
+        return AppConstants.MOZ_CHILD_PROCESS_NAME;
+    }
 
     public void addEnvToIntent(Intent intent) {
         Map<String,String> envMap = System.getenv();
         Set<Map.Entry<String,String>> envSet = envMap.entrySet();
         Iterator<Map.Entry<String,String>> envIter = envSet.iterator();
         int c = 0;
         while (envIter.hasNext()) {
             Map.Entry<String,String> entry = envIter.next();
             intent.putExtra("env" + c, entry.getKey() + "="
                             + entry.getValue());
             c++;
         }
     }
 
     public void doRestart() {
-        doRestart("org.mozilla.gecko.restart");
+        doRestart(RESTARTER_ACTION);
     }
 
     public void doRestart(String action) {
         Log.d(LOGTAG, "doRestart(\"" + action + "\")");
         try {
             Intent intent = new Intent(action);
-            intent.setClassName(getPackageName(),
-                                getPackageName() + ".Restarter");
+            intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME, RESTARTER_CLASS);
             /* TODO: addEnvToIntent(intent); */
             intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
                             Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
             Log.d(LOGTAG, "Restart intent: " + intent.toString());
             GeckoAppShell.killAnyZombies();
             startActivity(intent);
         } catch (Exception e) {
             Log.e(LOGTAG, "Error effecting restart.", e);
--- a/mobile/android/base/GeckoAppInfo.java.in
+++ b/mobile/android/base/GeckoAppInfo.java.in
@@ -31,17 +31,17 @@ public final class GeckoAppInfo
         return "@MOZ_APP_VERSION@";
     }
 
     public static String getBuildID() {
         return "@MOZ_APP_BUILDID@";
     }
 
     public static String getUpdateChannel() {
-        return UpdateServiceHelper.UPDATE_CHANNEL;
+        return AppConstants.MOZ_UPDATE_CHANNEL;
     }
 
     public static String getPlatformBuildID() {
         // Technically the platform build ID may be different, but we'll never know
         return getBuildID();
     }
 
     public static String getLocale() {
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -576,17 +576,18 @@ public class GeckoAppShell
 
         return getWebAppIntent(index, aURI);
     }
 
     public static Intent getWebAppIntent(int aIndex, String aURI) {
         Intent intent = new Intent();
         intent.setAction(GeckoApp.ACTION_WEBAPP_PREFIX + aIndex);
         intent.setData(Uri.parse(aURI));
-        intent.setClassName(GeckoApp.mAppContext, GeckoApp.mAppContext.getPackageName() + ".WebApps$WebApp" + aIndex);
+        intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
+                            AppConstants.ANDROID_PACKAGE_NAME + ".WebApps$WebApp" + aIndex);
         return intent;
     }
 
     // "Installs" an application by creating a shortcut
     // This is the entry point from AndroidBridge.h
     static void createShortcut(String aTitle, String aURI, String aIconData, String aType) {
         if ("webapp".equals(aType)) {
             Log.w(LOGTAG, "createShortcut with no unique URI should not be used for aType = webapp!");
@@ -614,18 +615,18 @@ public class GeckoAppShell
                 // the intent to be launched by the shortcut
                 Intent shortcutIntent;
                 if (aType.equalsIgnoreCase(SHORTCUT_TYPE_WEBAPP)) {
                     shortcutIntent = getWebAppIntent(aURI, aUniqueURI, aTitle, aIcon);
                 } else {
                     shortcutIntent = new Intent();
                     shortcutIntent.setAction(GeckoApp.ACTION_BOOKMARK);
                     shortcutIntent.setData(Uri.parse(aURI));
-                    shortcutIntent.setClassName(GeckoApp.mAppContext,
-                                                GeckoApp.mAppContext.getPackageName() + ".App");
+                    shortcutIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
+                                                AppConstants.BROWSER_INTENT_CLASS);
                 }
         
                 Intent intent = new Intent();
                 intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
                 if (aTitle != null)
                     intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, aTitle);
                 else
                     intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, aURI);
@@ -653,18 +654,18 @@ public class GeckoAppShell
                 if (aType.equalsIgnoreCase(SHORTCUT_TYPE_WEBAPP)) {
                     int index = WebAppAllocator.getInstance(GeckoApp.mAppContext).getIndexForApp(aUniqueURI);
                     shortcutIntent = getWebAppIntent(aURI, aUniqueURI, "", null);
                     if (shortcutIntent == null)
                         return;
                 } else {
                     shortcutIntent = new Intent();
                     shortcutIntent.setAction(GeckoApp.ACTION_BOOKMARK);
-                    shortcutIntent.setClassName(GeckoApp.mAppContext,
-                                                GeckoApp.mAppContext.getPackageName() + ".App");
+                    shortcutIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
+                                                AppConstants.BROWSER_INTENT_CLASS);
                     shortcutIntent.setData(Uri.parse(aURI));
                 }
         
                 Intent intent = new Intent();
                 intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
                 if (aTitle != null)
                     intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, aTitle);
                 else
@@ -1062,17 +1063,17 @@ public class GeckoAppShell
         }
 
         final String scheme = uri.getScheme();
 
         final Intent intent;
         if ("vnd.youtube".equals(scheme) && getHandlersForURL(targetURI, action).length == 0) {
             // Special case youtube to fallback to our own player
             intent = new Intent(VideoPlayer.VIDEO_ACTION);
-            intent.setClassName(GeckoApp.mAppContext.getPackageName(),
+            intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
                                 "org.mozilla.gecko.VideoPlayer");
         } else {
             intent = getIntentForActionString(action);
         }
 
         // Start with the original URI. If we end up modifying it,
         // we'll overwrite it.
         intent.setData(uri);
@@ -1203,17 +1204,17 @@ public class GeckoAppShell
             "- title = '" + aAlertTitle + "'\n" +
             "- text = '" + aAlertText +"'\n" +
             "- cookie = '" + aAlertCookie +"'\n" +
             "- name = '" + aAlertName + "'");
 
         // The intent to launch when the user clicks the expanded notification
         String app = GeckoApp.mAppContext.getClass().getName();
         Intent notificationIntent = new Intent(GeckoApp.ACTION_ALERT_CALLBACK);
-        notificationIntent.setClassName(GeckoApp.mAppContext, app);
+        notificationIntent.setClassName(AppConstants.ANDROID_PACKAGE_NAME, app);
         notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 
         int notificationID = aAlertName.hashCode();
 
         // Put the strings into the intent as an URI "alert:?name=<alertName>&app=<appName>&cookie=<cookie>"
         Uri.Builder b = new Uri.Builder();
         Uri dataUri = b.scheme("alert").path(Integer.toString(notificationID))
                                        .appendQueryParameter("name", aAlertName)
--- a/mobile/android/base/GeckoPreferences.java
+++ b/mobile/android/base/GeckoPreferences.java
@@ -49,38 +49,58 @@ public class GeckoPreferences
     private static final String LOGTAG = "GeckoPreferences";
 
     private ArrayList<String> mPreferencesList;
     private PreferenceScreen mPreferenceScreen;
     private static boolean sIsCharEncodingEnabled = false;
     private static final String NON_PREF_PREFIX = "android.not_a_preference.";
 
     // These match keys in resources/xml/preferences.xml.in.
-    public static String PREFS_MP_ENABLED         = "privacy.masterpassword.enabled";
-    public static String PREFS_MENU_CHAR_ENCODING = "browser.menu.showCharacterEncoding";
-    public static String PREFS_ANNOUNCEMENTS_ENABLED = NON_PREF_PREFIX + "privacy.announcements.enabled";
-    public static String PREFS_UPDATER_AUTODOWNLOAD  = "app.update.autodownload";
+    private static String PREFS_ANNOUNCEMENTS_ENABLED = NON_PREF_PREFIX + "privacy.announcements.enabled";
+    private static String PREFS_CATEGORY_GENERAL = "category_general";
+    private static String PREFS_CATEGORY_PRIVACY = "category_privacy";
+    private static String PREFS_MENU_CHAR_ENCODING = "browser.menu.showCharacterEncoding";
+    private static String PREFS_MP_ENABLED = "privacy.masterpassword.enabled";
+    private static String PREFS_TELEMETRY_ENABLED = "toolkit.telemetry.enabled";
+    private static String PREFS_TELEMETRY_ENABLED_PRERELEASE = "toolkit.telemetry.enabledPreRelease";
+    private static String PREFS_UPDATER_AUTODOWNLOAD = "app.update.autodownload";
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         addPreferencesFromResource(R.xml.preferences);
         registerEventListener("Sanitize:Finished");
 
         if (Build.VERSION.SDK_INT >= 14)
             getActionBar().setHomeButtonEnabled(true);
+
+        mPreferenceScreen = getPreferenceScreen();
+        if (!AppConstants.MOZ_UPDATER) {
+            ((PreferenceGroup) mPreferenceScreen.findPreference(PREFS_CATEGORY_GENERAL))
+                    .removePreference(findPreference(PREFS_UPDATER_AUTODOWNLOAD));
+        }
+
+        Preference telemetryPref = findPreference(PREFS_TELEMETRY_ENABLED);
+        if (AppConstants.MOZ_TELEMETRY_REPORTING) {
+            if (AppConstants.MOZ_TELEMETRY_ON_BY_DEFAULT) {
+                telemetryPref.setKey(PREFS_TELEMETRY_ENABLED_PRERELEASE);
+            }
+        } else {
+            ((PreferenceGroup) mPreferenceScreen.findPreference(PREFS_CATEGORY_PRIVACY))
+                    .removePreference(telemetryPref);
+        }
+
     }
 
     @Override
     public void onWindowFocusChanged(boolean hasFocus) {
         if (!hasFocus)
             return;
 
         mPreferencesList = new ArrayList<String>();
-        mPreferenceScreen = getPreferenceScreen();
         initGroups(mPreferenceScreen);
         initValues();
     }
 
     @Override
     protected void onDestroy() {
         super.onDestroy();
         unregisterEventListener("Sanitize:Finished");
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -39,16 +39,17 @@ UTIL_JAVA_FILES := \
   util/INIParser.java \
   util/INISection.java \
   util/StringUtils.java \
   util/ThreadUtils.java \
   util/UiAsyncTask.java \
   $(NULL)
 
 FENNEC_JAVA_FILES = \
+  ANRReporter.java \
   ActivityHandlerHelper.java \
   AlertNotification.java \
   AllCapsTextView.java \
   AndroidImport.java \
   AndroidImportPreference.java \
   AnimatorProxy.java \
   AnimatedHeightLayout.java \
   AppNotificationClient.java \
@@ -83,30 +84,32 @@ FENNEC_JAVA_FILES = \
   FlowLayout.java \
   FontSizePreference.java \
   FormAssistPopup.java \
   ForwardButton.java \
   GeckoAccessibility.java \
   GeckoApplication.java \
   GeckoApp.java \
   GeckoAppShell.java \
+  GeckoActivity.java \
   GeckoBatteryManager.java \
   GeckoConnectivityReceiver.java \
   GeckoEditable.java \
   GeckoEvent.java \
   GeckoHalDefines.java \
   GeckoInputConnection.java \
   GeckoMenu.java \
   GeckoMenuInflater.java \
   GeckoMenuItem.java \
   GeckoMessageReceiver.java \
   GeckoSubMenu.java \
   GeckoPreferences.java \
   GeckoProfile.java \
   GeckoPopupMenu.java \
+  GeckoSmsManager.java \
   GeckoThread.java \
   GlobalHistory.java \
   GeckoViewsFactory.java \
   HeightChangeAnimation.java \
   InputMethods.java \
   JavaAddonManager.java \
   LightweightTheme.java \
   LightweightThemeDrawable.java \
@@ -124,41 +127,44 @@ FENNEC_JAVA_FILES = \
   NSSBridge.java \
   CustomEditText.java \
   PrefsHelper.java \
   PrivateDataPreference.java \
   PrivateTab.java \
   PropertyAnimator.java \
   ProfileMigrator.java \
   PromptService.java \
+  Restarter.java \
   sqlite/ByteBufferInputStream.java \
   sqlite/MatrixBlobCursor.java \
   sqlite/SQLiteBridge.java \
   sqlite/SQLiteBridgeException.java \
   ReaderModeUtils.java \
   RemoteTabs.java \
   RobocopAPI.java \
   ServiceNotificationClient.java \
   SessionParser.java \
   SetupScreen.java \
   ShapedButton.java \
   SiteIdentityPopup.java \
+  SmsManager.java \
   SuggestClient.java \
   SurfaceBits.java \
   Tab.java \
   Tabs.java \
   TabsPanel.java \
   TabsTray.java \
   TabsAccessor.java \
   TailTouchDelegate.java \
   Telemetry.java \
   TextSelection.java \
   TextSelectionHandle.java \
   ThumbnailHelper.java \
   TouchEventInterceptor.java \
+  UpdateServiceHelper.java \
   VideoPlayer.java \
   WebAppAllocator.java \
   ZoomConstraints.java \
   gfx/Axis.java \
   gfx/BitmapUtils.java \
   gfx/BufferedCairoImage.java \
   gfx/CairoGLInfo.java \
   gfx/CairoImage.java \
@@ -211,35 +217,30 @@ FENNEC_JAVA_FILES = \
   widget/TwoWayView.java \
   GeckoNetworkManager.java \
   GeckoScreenOrientationListener.java \
   UpdateService.java \
   GeckoUpdateReceiver.java \
   ReferrerReceiver.java \
   $(NULL)
 
-ifdef MOZ_WEBSMS_BACKEND
-FENNEC_JAVA_FILES += GeckoSmsManager.java
-endif
-
 ifdef MOZ_WEBRTC
 WEBRTC_VIDEO_CAPTURE_JAVA_FILES = \
   CaptureCapabilityAndroid.java \
   VideoCaptureAndroid.java \
   VideoCaptureDeviceInfoAndroid.java \
   $(NULL)
 
 WEBRTC_JAVA_FILES = \
   $(addprefix $(DEPTH)/media/webrtc/trunk/webrtc/modules/video_capture/android/java/org/webrtc/videoengine/, $(WEBRTC_VIDEO_CAPTURE_JAVA_FILES)) \
   $(NULL)
 endif
 
 ifdef MOZ_ANDROID_ANR_REPORTER
 DEFINES += -DMOZ_ANDROID_ANR_REPORTER=1
-FENNEC_JAVA_FILES += ANRReporter.java
 endif
 
 FENNEC_PP_JAVA_VIEW_FILES = \
   GeckoButton.java \
   GeckoImageButton.java \
   GeckoImageView.java \
   GeckoEditText.java \
   GeckoFrameLayout.java \
@@ -248,36 +249,28 @@ FENNEC_PP_JAVA_VIEW_FILES = \
   GeckoTextSwitcher.java \
   GeckoTextView.java \
   $(NULL)
 
 FENNEC_PP_JAVA_FILES = \
   App.java \
   WebApp.java \
   WebApps.java \
-  GeckoActivity.java \
   GeckoAppInfo.java \
-  Restarter.java \
   db/BrowserContract.java \
   db/BrowserProvider.java \
   db/PasswordsProvider.java \
   db/FormHistoryProvider.java \
   db/TabsProvider.java \
   db/GeckoProvider.java \
-  SmsManager.java \
-  UpdateServiceHelper.java \
+  AppConstants.java \
   $(NULL)
 
 FENNEC_PP_XML_FILES = \
-  res/xml/preferences.xml \
   res/xml/searchable.xml \
-  res/menu/browser_app_menu.xml \
-  res/menu-v11/browser_app_menu.xml \
-  res/menu-large-v11/browser_app_menu.xml \
-  res/menu-xlarge-v11/browser_app_menu.xml \
   $(NULL)
 
 ifneq (,$(findstring -march=armv7,$(OS_CFLAGS)))
 MIN_CPU_VERSION=7
 else
 MIN_CPU_VERSION=5
 endif
 
@@ -525,18 +518,19 @@ RES_VALUES_LAND_V14 = \
   res/values-land-v14/dimens.xml \
   $(NULL)
 
 RES_VALUES_V14 = \
   res/values-v14/styles.xml \
   $(NULL)
 
 RES_XML = \
-	$(SYNC_RES_XML) \
-	$(NULL)
+  res/xml/preferences.xml \
+  $(SYNC_RES_XML) \
+  $(NULL)
 
 RES_ANIM = \
   res/anim/awesomebar_fade_in.xml \
   res/anim/awesomebar_fade_out.xml \
   res/anim/awesomebar_hold_still.xml \
   res/anim/grow_fade_in.xml \
   res/anim/grow_fade_in_center.xml \
   res/anim/shrink_fade_out.xml \
@@ -982,26 +976,30 @@ RES_COLOR = \
   res/color/abouthome_section_title.xml \
   res/color/awesome_bar_title.xml \
   res/color/awesome_bar_title_hint.xml \
   res/color/menu_item_title.xml \
   res/color/select_item_multichoice.xml \
   $(NULL)
 
 RES_MENU = \
+  res/menu/abouthome_topsites_contextmenu.xml \
   res/menu/awesomebar_contextmenu.xml \
+  res/menu/browser_app_menu.xml \
   res/menu/gecko_app_menu.xml \
   res/menu/titlebar_contextmenu.xml \
-  res/menu/abouthome_topsites_contextmenu.xml \
+  res/menu-large-v11/browser_app_menu.xml \
+  res/menu-v11/browser_app_menu.xml \
+  res/menu-xlarge-v11/browser_app_menu.xml \
   $(NULL)
 
 JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
 
 ifdef MOZ_CRASHREPORTER
-FENNEC_PP_JAVA_FILES += CrashReporter.java
+FENNEC_JAVA_FILES += CrashReporter.java
 RES_DRAWABLE_MDPI += res/drawable-mdpi/crash_reporter.png
 RES_LAYOUT += res/layout/crash_reporter.xml
 endif
 
 MOZ_ANDROID_DRAWABLES += \
   $(SYNC_RES_DRAWABLE)                                                          \
   mobile/android/base/resources/drawable/abouthome_logo.xml                     \
   mobile/android/base/resources/drawable/abouthome_promo_box.xml                \
rename from mobile/android/base/Restarter.java.in
rename to mobile/android/base/Restarter.java
--- a/mobile/android/base/Restarter.java.in
+++ b/mobile/android/base/Restarter.java
@@ -1,56 +1,53 @@
 /* -*- 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/. */
 
-#filter substitution
-package @ANDROID_PACKAGE_NAME@;
+package org.mozilla.gecko;
 
 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
 import android.util.Log;
 
-import org.mozilla.gecko.GeckoAppShell;
-
 public class Restarter extends Activity {
     private static final String LOGTAG = "GeckoRestarter";
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
-        Log.i(LOGTAG, "trying to restart @MOZ_APP_NAME@");
+        Log.i(LOGTAG, "Trying to restart " + AppConstants.MOZ_APP_NAME);
         try {
             int countdown = 40;
             while (GeckoAppShell.checkForGeckoProcs() &&  --countdown > 0) {
                 // Wait for the old process to die before we continue
                 try {
                     Thread.sleep(100);
                 } catch (InterruptedException ie) {}
             }
-            
+
             if (countdown <= 0) {
                 // if the countdown expired, something is hung
                 GeckoAppShell.killAnyZombies();
                 countdown = 10;
                 // wait for the kill to take effect
                 while (GeckoAppShell.checkForGeckoProcs() &&  --countdown > 0) {
                     try {
                         Thread.sleep(100);
                     } catch (InterruptedException ie) {}
                 }
             }
         } catch (Exception e) {
             Log.i(LOGTAG, e.toString());
         }
         try {
             Intent intent = new Intent(Intent.ACTION_MAIN);
-            intent.setClassName("@ANDROID_PACKAGE_NAME@",
-                                "@ANDROID_PACKAGE_NAME@.App");
+            intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME,
+                                AppConstants.BROWSER_INTENT_CLASS);
             Bundle b = getIntent().getExtras();
             if (b != null)
                 intent.putExtras(b);
             intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
             intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
             Log.i(LOGTAG, intent.toString());
             startActivity(intent);
         } catch (Exception e) {
rename from mobile/android/base/SmsManager.java.in
rename to mobile/android/base/SmsManager.java
--- a/mobile/android/base/SmsManager.java.in
+++ b/mobile/android/base/SmsManager.java
@@ -1,31 +1,27 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; 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;
 
-#ifdef MOZ_WEBSMS_BACKEND
-import org.mozilla.gecko.GeckoSmsManager;
-#endif
-
 class SmsManager
 {
-  static private ISmsManager sInstance = null;
+    static private ISmsManager sInstance = null;
 
-  static public ISmsManager getInstance() {
-#ifdef MOZ_WEBSMS_BACKEND
-    if (sInstance == null) {
-      sInstance = new GeckoSmsManager();
+    static public ISmsManager getInstance() {
+        if (AppConstants.MOZ_WEBSMS_BACKEND) {
+            if (sInstance == null) {
+                sInstance = new GeckoSmsManager();
+            }
+        }
+        return sInstance;
     }
-#endif
-    return sInstance;
-  }
 }
 
 interface ISmsManager
 {
   public void start();
   public void stop();
   public void shutdown();
 
--- a/mobile/android/base/UpdateService.java
+++ b/mobile/android/base/UpdateService.java
@@ -1,17 +1,19 @@
 /* -*- 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.updater;
 
+import org.mozilla.gecko.AppConstants;
+import org.mozilla.gecko.R;
+
 import org.mozilla.apache.commons.codec.binary.Hex;
-import org.mozilla.gecko.R;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
 import android.app.AlarmManager;
 import android.app.IntentService;
 import android.app.Notification;
@@ -131,18 +133,18 @@ public class UpdateService extends Inten
         resultIntent.putExtra("result", result.toString());
         sendBroadcast(resultIntent);
     }
 
     private int getUpdateInterval(boolean isRetry) {
         int interval;
         if (isRetry) {
             interval = INTERVAL_RETRY;
-        } else if (UpdateServiceHelper.UPDATE_CHANNEL.equals("nightly") ||
-                   UpdateServiceHelper.UPDATE_CHANNEL.equals("aurora")) {
+        } else if (AppConstants.MOZ_UPDATE_CHANNEL.equals("nightly") ||
+                   AppConstants.MOZ_UPDATE_CHANNEL.equals("aurora")) {
             interval = INTERVAL_SHORT;
         } else {
             interval = INTERVAL_LONG;
         }
 
         return interval;
     }
 
rename from mobile/android/base/UpdateServiceHelper.java.in
rename to mobile/android/base/UpdateServiceHelper.java
--- a/mobile/android/base/UpdateServiceHelper.java.in
+++ b/mobile/android/base/UpdateServiceHelper.java
@@ -1,38 +1,37 @@
 /* -*- 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/. */
 
-#filter substitution
-
 package org.mozilla.gecko.updater;
 
+import org.mozilla.gecko.AppConstants;
 import org.mozilla.gecko.util.GeckoJarReader;
 
 import android.content.Context;
 import android.content.Intent;
 
 import android.content.pm.PackageManager;
 import android.content.pm.ApplicationInfo;
 
 import android.os.Build;
 
 import android.util.Log;
 
 import java.net.URL;
 
 public class UpdateServiceHelper {
-    public static final String ACTION_REGISTER_FOR_UPDATES = "@ANDROID_PACKAGE_NAME@.REGISTER_FOR_UPDATES";
-    public static final String ACTION_UNREGISTER_FOR_UPDATES = "@ANDROID_PACKAGE_NAME@.UNREGISTER_FOR_UPDATES";
-    public static final String ACTION_CHECK_FOR_UPDATE = "@ANDROID_PACKAGE_NAME@.CHECK_FOR_UPDATE";
-    public static final String ACTION_CHECK_UPDATE_RESULT = "@ANDROID_PACKAGE_NAME@.CHECK_UPDATE_RESULT";
-    public static final String ACTION_DOWNLOAD_UPDATE = "@ANDROID_PACKAGE_NAME@.DOWNLOAD_UPDATE";
-    public static final String ACTION_APPLY_UPDATE = "@ANDROID_PACKAGE_NAME@.APPLY_UPDATE";
+    public static final String ACTION_REGISTER_FOR_UPDATES = AppConstants.ANDROID_PACKAGE_NAME + ".REGISTER_FOR_UPDATES";
+    public static final String ACTION_UNREGISTER_FOR_UPDATES = AppConstants.ANDROID_PACKAGE_NAME + ".UNREGISTER_FOR_UPDATES";
+    public static final String ACTION_CHECK_FOR_UPDATE = AppConstants.ANDROID_PACKAGE_NAME + ".CHECK_FOR_UPDATE";
+    public static final String ACTION_CHECK_UPDATE_RESULT = AppConstants.ANDROID_PACKAGE_NAME + ".CHECK_UPDATE_RESULT";
+    public static final String ACTION_DOWNLOAD_UPDATE = AppConstants.ANDROID_PACKAGE_NAME + ".DOWNLOAD_UPDATE";
+    public static final String ACTION_APPLY_UPDATE = AppConstants.ANDROID_PACKAGE_NAME + ".APPLY_UPDATE";
 
     // Flags for ACTION_CHECK_FOR_UPDATE
     public static final int FLAG_FORCE_DOWNLOAD = 1;
     public static final int FLAG_OVERWRITE_EXISTING = 1 << 1;
     public static final int FLAG_REINSTALL = 1 << 2;
     public static final int FLAG_RETRY = 1 << 3;
 
     // Name of the Intent extra for the autodownload policy, used with ACTION_REGISTER_FOR_UPDATES
@@ -44,74 +43,78 @@ public class UpdateServiceHelper {
     public static final int AUTODOWNLOAD_ENABLED = 2;
 
     // Name of the Intent extra that holds the flags for ACTION_CHECK_FOR_UPDATE
     public static final String EXTRA_UPDATE_FLAGS_NAME = "updateFlags";
 
     // Name of the Intent extra that holds the APK path, used with ACTION_APPLY_UPDATE
     public static final String EXTRA_PACKAGE_PATH_NAME = "packagePath";
 
-    public static final String UPDATE_CHANNEL = "@MOZ_UPDATE_CHANNEL@";
-
     private static final String LOGTAG = "UpdateServiceHelper";
-    private static final String BUILDID = "@MOZ_APP_BUILDID@";
     private static final String DEFAULT_UPDATE_LOCALE = "en-US";
 
-#ifdef MOZ_PKG_SPECIAL
-    private static final String UPDATE_URL = "https://aus2.mozilla.org/update/4/@MOZ_APP_BASENAME@/@MOZ_APP_VERSION@/%BUILDID%/Android_@MOZ_APP_ABI@-@MOZ_PKG_SPECIAL@/%LOCALE%/@MOZ_UPDATE_CHANNEL@/%OS_VERSION%/default/default/@MOZ_APP_VERSION@/update.xml";
-#else
-    private static final String UPDATE_URL = "https://aus2.mozilla.org/update/4/@MOZ_APP_BASENAME@/@MOZ_APP_VERSION@/%BUILDID%/Android_@MOZ_APP_ABI@/%LOCALE%/@MOZ_UPDATE_CHANNEL@/%OS_VERSION%/default/default/@MOZ_APP_VERSION@/update.xml";  
-#endif
-    
+    private static final String UPDATE_URL;
+
+    static {
+        final String pkgSpecial;
+        if (AppConstants.MOZ_PKG_SPECIAL != null) {
+            pkgSpecial = "-" + AppConstants.MOZ_PKG_SPECIAL;
+        } else {
+            pkgSpecial = "";
+        }
+        UPDATE_URL = "https://aus2.mozilla.org/update/4/" + AppConstants.MOZ_APP_BASENAME + "/" +
+                     AppConstants.MOZ_APP_VERSION         +
+                     "/%BUILDID%/Android_ "               + AppConstants.MOZ_APP_ABI + pkgSpecial +
+                     "/%LOCALE%/"                         + AppConstants.MOZ_UPDATE_CHANNEL +
+                     "/%OS_VERSION%/default/default/"     + AppConstants.MOZ_APP_VERSION +
+                     "/update.xml";
+    }
+
     public enum CheckUpdateResult {
         // Keep these in sync with mobile/android/chrome/content/about.xhtml
         NOT_AVAILABLE,
         AVAILABLE,
         DOWNLOADING,
         DOWNLOADED
     }
 
     public static URL getUpdateUrl(Context context, boolean force) {
         PackageManager pm = context.getPackageManager();
 
         String locale = null;
         try {
-            ApplicationInfo info = pm.getApplicationInfo("@ANDROID_PACKAGE_NAME@", 0);
+            ApplicationInfo info = pm.getApplicationInfo(AppConstants.ANDROID_PACKAGE_NAME, 0);
             String updateLocaleUrl = "jar:jar:file://" + info.sourceDir + "!/omni.ja!/update.locale";
 
             locale = GeckoJarReader.getText(updateLocaleUrl);
 
             if (locale != null)
                 locale = locale.trim();
             else
                 locale = DEFAULT_UPDATE_LOCALE;
         } catch (android.content.pm.PackageManager.NameNotFoundException e) {
             // Shouldn't really be possible, but fallback to default locale
             Log.i(LOGTAG, "Failed to read update locale file, falling back to " + DEFAULT_UPDATE_LOCALE);
             locale = DEFAULT_UPDATE_LOCALE;
         }
 
         String url = UPDATE_URL.replace("%LOCALE%", locale).
             replace("%OS_VERSION%", Build.VERSION.RELEASE).
-            replace("%BUILDID%", force ? "0" : BUILDID);
+            replace("%BUILDID%", force ? "0" : AppConstants.MOZ_APP_BUILDID);
 
         try {
             return new URL(url);
         } catch (java.net.MalformedURLException e) {
             Log.e(LOGTAG, "Failed to create update url: ", e);
             return null;
         }
     }
 
     public static boolean isUpdaterEnabled() {
-#ifdef MOZ_UPDATER
-        return true;
-#else
-        return false;
-#endif
+        return AppConstants.MOZ_UPDATER;
     }
 
     public static void registerForUpdates(Context context, String policy) {
         if (policy == null)
             return;
 
         int intPolicy;
         if (policy.equals("wifi")) {
--- a/mobile/android/base/WebApp.java.in
+++ b/mobile/android/base/WebApp.java.in
@@ -141,44 +141,16 @@ public class WebApp extends GeckoApp {
             Animation fadein = AnimationUtils.loadAnimation(this, R.anim.grow_fade_in_center);
             fadein.setStartOffset(500);
             fadein.setDuration(1000);
             image.startAnimation(fadein);
         }
     }
 
     @Override
-    public String getPackageName() {
-        return "@ANDROID_PACKAGE_NAME@";
-    }
-
-    @Override
-    public String getContentProcessName() {
-        return "@MOZ_CHILD_PROCESS_NAME@";
-    }
-
-    @Override
-    public String getDefaultUAString() {
-        String deviceType = "Mobile";
-        if (HardwareUtils.isTablet())
-            deviceType = "Tablet";
-        return "Mozilla/5.0 (Android; " + deviceType + "; rv:@MOZ_APP_VERSION@) Gecko/@MOZ_APP_VERSION@ Firefox/@MOZ_APP_VERSION@";
-    }
-
-    @Override
-    public String getUAStringForHost(String host) {
-        // With our standard UA String, we get a 200 response code and 
-        // client-side redirect from t.co. This bot-like UA gives us a 
-        // 301 response code
-        if ("t.co".equals(host))
-            return "Redirector/@MOZ_APP_VERSION@ (Android; rv:@MOZ_APP_VERSION@)";
-        return getDefaultUAString();
-    }
-
-    @Override
     protected String getDefaultProfileName() {
         String action = getIntent().getAction();
         if (!action.startsWith(ACTION_WEBAPP_PREFIX)) {
             Log.e(LOGTAG, "WebApp launch, but intent action is " + action + "!");
             return null;
         }
 
         return "webapp" + action.substring(ACTION_WEBAPP_PREFIX.length());
--- a/mobile/android/base/db/BrowserContract.java.in
+++ b/mobile/android/base/db/BrowserContract.java.in
@@ -1,29 +1,31 @@
 /* -*- 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/. */
 
 #filter substitution
 package org.mozilla.gecko.db;
 
+import org.mozilla.gecko.AppConstants;
+
 import android.net.Uri;
 
 public class BrowserContract {
-    public static final String AUTHORITY = "@ANDROID_PACKAGE_NAME@.db.browser";
+    public static final String AUTHORITY = AppConstants.ANDROID_PACKAGE_NAME + ".db.browser";
     public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY);
 
-    public static final String PASSWORDS_AUTHORITY = "@ANDROID_PACKAGE_NAME@.db.passwords";
+    public static final String PASSWORDS_AUTHORITY = AppConstants.ANDROID_PACKAGE_NAME + ".db.passwords";
     public static final Uri PASSWORDS_AUTHORITY_URI = Uri.parse("content://" + PASSWORDS_AUTHORITY);
 
-    public static final String FORM_HISTORY_AUTHORITY = "@ANDROID_PACKAGE_NAME@.db.formhistory";
+    public static final String FORM_HISTORY_AUTHORITY = AppConstants.ANDROID_PACKAGE_NAME + ".db.formhistory";
     public static final Uri FORM_HISTORY_AUTHORITY_URI = Uri.parse("content://" + FORM_HISTORY_AUTHORITY);
-    
-    public static final String TABS_AUTHORITY = "@ANDROID_PACKAGE_NAME@.db.tabs";
+
+    public static final String TABS_AUTHORITY = AppConstants.ANDROID_PACKAGE_NAME + ".db.tabs";
     public static final Uri TABS_AUTHORITY_URI = Uri.parse("content://" + TABS_AUTHORITY);
 
     public static final String PARAM_PROFILE = "profile";
     public static final String PARAM_PROFILE_PATH = "profilePath";
     public static final String PARAM_LIMIT = "limit";
     public static final String PARAM_IS_SYNC = "sync";
     public static final String PARAM_SHOW_DELETED = "show_deleted";
     public static final String PARAM_IS_TEST = "test";
rename from mobile/android/base/resources/menu-large-v11/browser_app_menu.xml.in
rename to mobile/android/base/resources/menu-large-v11/browser_app_menu.xml
--- a/mobile/android/base/resources/menu-large-v11/browser_app_menu.xml.in
+++ b/mobile/android/base/resources/menu-large-v11/browser_app_menu.xml
@@ -24,18 +24,18 @@
           android:title="@string/new_tab"/>
 
     <item android:id="@+id/new_private_tab"
           android:icon="@drawable/ic_menu_new_private_tab"
           android:title="@string/new_private_tab"/>
 
     <item android:id="@+id/share"
           android:icon="@drawable/ic_menu_share"
-          android:title="@string/share" /> 
-    
+          android:title="@string/share" />
+
     <item android:id="@+id/find_in_page"
           android:icon="@drawable/ic_menu_find_in_page"
           android:title="@string/find_in_page" />
 
     <item android:id="@+id/desktop_mode"
           android:icon="@drawable/ic_menu_desktop_mode_off"
           android:title="@string/desktop_mode"
           android:checkable="true" />
@@ -67,13 +67,12 @@
     <item android:id="@+id/char_encoding"
           android:visible="false"
           android:title="@string/char_encoding"/>
 
     <item android:id="@+id/settings"
           android:icon="@drawable/ic_menu_settings"
           android:title="@string/settings" />
 
-#ifdef MOZ_PROFILING
     <item android:id="@+id/toggle_profiling"
+          android:visible="false"
           android:title="@string/toggle_profiling" />
-#endif
 </menu>
rename from mobile/android/base/resources/menu-v11/browser_app_menu.xml.in
rename to mobile/android/base/resources/menu-v11/browser_app_menu.xml
--- a/mobile/android/base/resources/menu-v11/browser_app_menu.xml.in
+++ b/mobile/android/base/resources/menu-v11/browser_app_menu.xml
@@ -25,18 +25,18 @@
           android:title="@string/new_tab"/>
 
     <item android:id="@+id/new_private_tab"
           android:icon="@drawable/ic_menu_new_private_tab"
           android:title="@string/new_private_tab"/>
 
     <item android:id="@+id/share"
           android:icon="@drawable/ic_menu_share"
-          android:title="@string/share" /> 
-    
+          android:title="@string/share" />
+
     <item android:id="@+id/find_in_page"
           android:icon="@drawable/ic_menu_find_in_page"
           android:title="@string/find_in_page" />
 
     <item android:id="@+id/desktop_mode"
           android:icon="@drawable/ic_menu_desktop_mode_off"
           android:title="@string/desktop_mode"
           android:checkable="true" />
@@ -68,13 +68,12 @@
     <item android:id="@+id/char_encoding"
           android:visible="false"
           android:title="@string/char_encoding"/>
 
     <item android:id="@+id/settings"
           android:icon="@drawable/ic_menu_settings"
           android:title="@string/settings" />
 
-#ifdef MOZ_PROFILING
     <item android:id="@+id/toggle_profiling"
+          android:visible="false"
           android:title="@string/toggle_profiling" />
-#endif
 </menu>
rename from mobile/android/base/resources/menu-xlarge-v11/browser_app_menu.xml.in
rename to mobile/android/base/resources/menu-xlarge-v11/browser_app_menu.xml
--- a/mobile/android/base/resources/menu-xlarge-v11/browser_app_menu.xml.in
+++ b/mobile/android/base/resources/menu-xlarge-v11/browser_app_menu.xml
@@ -25,18 +25,18 @@
           android:title="@string/new_tab"/>
 
     <item android:id="@+id/new_private_tab"
           android:icon="@drawable/ic_menu_new_private_tab"
           android:title="@string/new_private_tab"/>
 
     <item android:id="@+id/share"
           android:icon="@drawable/ic_menu_share"
-          android:title="@string/share" /> 
-    
+          android:title="@string/share" />
+
     <item android:id="@+id/find_in_page"
           android:icon="@drawable/ic_menu_find_in_page"
           android:title="@string/find_in_page" />
 
     <item android:id="@+id/desktop_mode"
           android:icon="@drawable/ic_menu_desktop_mode_off"
           android:title="@string/desktop_mode"
           android:checkable="true" />
@@ -68,13 +68,12 @@
     <item android:id="@+id/char_encoding"
           android:visible="false"
           android:title="@string/char_encoding"/>
 
     <item android:id="@+id/settings"
           android:icon="@drawable/ic_menu_settings"
           android:title="@string/settings" />
 
-#ifdef MOZ_PROFILING
     <item android:id="@+id/toggle_profiling"
+          android:visible="false"
           android:title="@string/toggle_profiling" />
-#endif
 </menu>
rename from mobile/android/base/resources/menu/browser_app_menu.xml.in
rename to mobile/android/base/resources/menu/browser_app_menu.xml
--- a/mobile/android/base/resources/menu/browser_app_menu.xml.in
+++ b/mobile/android/base/resources/menu/browser_app_menu.xml
@@ -21,18 +21,18 @@
           android:icon="@drawable/ic_menu_new_tab"
           android:title="@string/new_tab"/>
 
     <item android:id="@+id/new_private_tab"
           android:icon="@drawable/ic_menu_new_private_tab"
           android:title="@string/new_private_tab"/>
 
     <item android:id="@+id/share"
-          android:title="@string/share" /> 
-    
+          android:title="@string/share" />
+
     <item android:id="@+id/save_as_pdf"
           android:title="@string/save_as_pdf" />
 
     <item android:id="@+id/find_in_page"
           android:title="@string/find_in_page" />
 
     <item android:id="@+id/desktop_mode"
           android:title="@string/desktop_mode"
@@ -49,13 +49,12 @@
 
     <item android:id="@+id/char_encoding"
           android:visible="false"
           android:title="@string/char_encoding"/>
 
     <item android:id="@+id/settings"
           android:title="@string/settings" />
 
-#ifdef MOZ_PROFILING
     <item android:id="@+id/toggle_profiling"
+          android:visible="false"
           android:title="@string/toggle_profiling" />
-#endif
 </menu>
rename from mobile/android/base/resources/xml/preferences.xml.in
rename to mobile/android/base/resources/xml/preferences.xml
--- a/mobile/android/base/resources/xml/preferences.xml.in
+++ b/mobile/android/base/resources/xml/preferences.xml
@@ -1,33 +1,31 @@
-#filter substitution
 <?xml version="1.0" encoding="utf-8"?>
 <!-- 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/. -->
 
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                   xmlns:gecko="http://schemas.android.com/apk/res-auto"
                   android:enabled="false">
 
-    <PreferenceCategory android:title="@string/pref_category_general">
+    <PreferenceCategory android:title="@string/pref_category_general"
+                        android:key="category_general">
         <org.mozilla.gecko.LinkPreference android:title="@string/pref_about_firefox"
                                           url="about:" />
 
         <org.mozilla.gecko.SyncPreference android:title="@string/pref_sync"
                                           android:persistent="false" />
 
-#ifdef MOZ_UPDATER
         <ListPreference android:key="app.update.autodownload"
                         android:title="@string/pref_update_autodownload"
                         android:entries="@array/pref_update_autodownload_entries"
                         android:entryValues="@array/pref_update_autodownload_values"
                         android:persistent="false" />
-#endif
 
     </PreferenceCategory>
 
     <PreferenceCategory android:title="@string/pref_category_content">
 
         <ListPreference android:key="browser.menu.showCharacterEncoding"
                         android:title="@string/pref_char_encoding"
                         android:entries="@array/pref_char_encoding_entries"
@@ -50,17 +48,18 @@
         <CheckBoxPreference
                         android:key="browser.zoom.reflowOnZoom"
                         android:title="@string/pref_reflow_on_zoom"
                         android:defaultValue="false"
                         android:persistent="false" />
 
     </PreferenceCategory>
 
-    <PreferenceCategory android:title="@string/pref_category_privacy">
+    <PreferenceCategory android:title="@string/pref_category_privacy"
+                        android:key="category_privacy">
 
         <ListPreference android:key="network.cookie.cookieBehavior"
                         android:title="@string/pref_cookies_menu"
                         android:entries="@array/pref_cookies_entries"
                         android:entryValues="@array/pref_cookies_values"
                         android:persistent="false" />
 
         <!-- keys prefixed with "android.not_a_preference." are not synced with Gecko -->
@@ -88,26 +87,19 @@
                             android:defaultValue="false"
                             android:persistent="false" />
 
         <CheckBoxPreference android:key="browser.search.suggest.enabled"
                             android:title="@string/pref_search_suggestions"
                             android:defaultValue="true"
                             android:persistent="false" />
 
-#ifdef MOZ_TELEMETRY_REPORTING
-        <CheckBoxPreference
-#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
-                            android:key="toolkit.telemetry.enabledPreRelease"
-#else
-                            android:key="toolkit.telemetry.enabled"
-#endif
+        <CheckBoxPreference android:key="toolkit.telemetry.enabled"
                             android:title="@string/pref_telemetry"
                             android:persistent="false" />
-#endif
 
         <CheckBoxPreference android:key="android.not_a_preference.privacy.announcements.enabled"
                             android:title="@string/pref_show_product_announcements"
                             android:defaultValue="true"
                             android:persistent="true" />
 
     </PreferenceCategory>
 
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -832,17 +832,17 @@ nsresult SetExceptionHandler(nsIFile* aX
 #elif !defined(__ANDROID__)
     nsCString crashReporterPath_temp;
 
     exePath->GetNativePath(crashReporterPath_temp);
     crashReporterPath = ToNewCString(crashReporterPath_temp);
 #else
     // On Android, we launch using the application package name
     // instead of a filename, so use ANDROID_PACKAGE_NAME to do that here.
-    nsCString package(ANDROID_PACKAGE_NAME "/.CrashReporter");
+    nsCString package(ANDROID_PACKAGE_NAME "/org.mozilla.gecko.CrashReporter");
     crashReporterPath = ToNewCString(package);
 #endif
   }
 
   // get temp path to use for minidump path
 #if defined(XP_WIN32)
   nsString tempPath;