From 3b9de3624858fa4f5107e5460792be5c7be321a6 Mon Sep 17 00:00:00 2001 From: Brian Nicholson Date: Tue, 9 Apr 2013 17:10:47 -0700 Subject: [PATCH] Bug 856163 - Part 2: Move preprocessed code to AppConstants. r=kats,mfinkle,rnewman --HG-- rename : mobile/android/base/CrashReporter.java.in => mobile/android/base/CrashReporter.java rename : mobile/android/base/GeckoActivity.java.in => mobile/android/base/GeckoActivity.java rename : mobile/android/base/Restarter.java.in => mobile/android/base/Restarter.java rename : mobile/android/base/SmsManager.java.in => mobile/android/base/SmsManager.java rename : mobile/android/base/UpdateServiceHelper.java.in => mobile/android/base/UpdateServiceHelper.java rename : mobile/android/base/resources/menu-large-v11/browser_app_menu.xml.in => mobile/android/base/resources/menu-large-v11/browser_app_menu.xml rename : mobile/android/base/resources/menu-v11/browser_app_menu.xml.in => mobile/android/base/resources/menu-v11/browser_app_menu.xml rename : mobile/android/base/resources/menu-xlarge-v11/browser_app_menu.xml.in => mobile/android/base/resources/menu-xlarge-v11/browser_app_menu.xml rename : mobile/android/base/resources/menu/browser_app_menu.xml.in => mobile/android/base/resources/menu/browser_app_menu.xml rename : mobile/android/base/resources/xml/preferences.xml.in => mobile/android/base/resources/xml/preferences.xml --- mobile/android/base/AndroidManifest.xml.in | 6 +- mobile/android/base/App.java.in | 59 +------------ mobile/android/base/AppConstants.java.in | 86 +++++++++++++++++++ mobile/android/base/BrowserApp.java | 18 ++++ ...ashReporter.java.in => CrashReporter.java} | 16 ++-- ...ckoActivity.java.in => GeckoActivity.java} | 17 ++-- mobile/android/base/GeckoApp.java | 30 +++++-- mobile/android/base/GeckoAppInfo.java.in | 2 +- mobile/android/base/GeckoAppShell.java | 15 ++-- mobile/android/base/GeckoPreferences.java | 30 +++++-- mobile/android/base/Makefile.in | 34 ++++---- .../{Restarter.java.in => Restarter.java} | 13 ++- .../{SmsManager.java.in => SmsManager.java} | 20 ++--- mobile/android/base/UpdateService.java | 8 +- ...elper.java.in => UpdateServiceHelper.java} | 51 +++++------ mobile/android/base/WebApp.java.in | 28 ------ .../android/base/db/BrowserContract.java.in | 12 +-- ...r_app_menu.xml.in => browser_app_menu.xml} | 7 +- ...r_app_menu.xml.in => browser_app_menu.xml} | 7 +- ...r_app_menu.xml.in => browser_app_menu.xml} | 7 +- ...r_app_menu.xml.in => browser_app_menu.xml} | 7 +- .../{preferences.xml.in => preferences.xml} | 18 ++-- toolkit/crashreporter/nsExceptionHandler.cpp | 2 +- 23 files changed, 267 insertions(+), 226 deletions(-) create mode 100644 mobile/android/base/AppConstants.java.in rename mobile/android/base/{CrashReporter.java.in => CrashReporter.java} (97%) rename mobile/android/base/{GeckoActivity.java.in => GeckoActivity.java} (88%) rename mobile/android/base/{Restarter.java.in => Restarter.java} (87%) rename mobile/android/base/{SmsManager.java.in => SmsManager.java} (75%) rename mobile/android/base/{UpdateServiceHelper.java.in => UpdateServiceHelper.java} (70%) rename mobile/android/base/resources/menu-large-v11/{browser_app_menu.xml.in => browser_app_menu.xml} (97%) rename mobile/android/base/resources/menu-v11/{browser_app_menu.xml.in => browser_app_menu.xml} (97%) rename mobile/android/base/resources/menu-xlarge-v11/{browser_app_menu.xml.in => browser_app_menu.xml} (97%) rename mobile/android/base/resources/menu/{browser_app_menu.xml.in => browser_app_menu.xml} (96%) rename mobile/android/base/resources/xml/{preferences.xml.in => preferences.xml} (94%) diff --git a/mobile/android/base/AndroidManifest.xml.in b/mobile/android/base/AndroidManifest.xml.in index c971c55383f..44edff4738b 100644 --- a/mobile/android/base/AndroidManifest.xml.in +++ b/mobile/android/base/AndroidManifest.xml.in @@ -71,7 +71,7 @@ android:debuggable="true"> #endif - - @@ -199,7 +199,7 @@ #include ../services/manifests/SyncAndroidManifest_activities.xml.in #if MOZ_CRASHREPORTER - envMap = System.getenv(); @@ -2090,15 +2105,14 @@ abstract public class GeckoApp } 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); diff --git a/mobile/android/base/GeckoAppInfo.java.in b/mobile/android/base/GeckoAppInfo.java.in index 90d4c6fad9c..0e7122cc8f0 100644 --- a/mobile/android/base/GeckoAppInfo.java.in +++ b/mobile/android/base/GeckoAppInfo.java.in @@ -36,7 +36,7 @@ public final class GeckoAppInfo } public static String getUpdateChannel() { - return UpdateServiceHelper.UPDATE_CHANNEL; + return AppConstants.MOZ_UPDATE_CHANNEL; } public static String getPlatformBuildID() { diff --git a/mobile/android/base/GeckoAppShell.java b/mobile/android/base/GeckoAppShell.java index 6d71ecb565b..3742a5fb5be 100644 --- a/mobile/android/base/GeckoAppShell.java +++ b/mobile/android/base/GeckoAppShell.java @@ -581,7 +581,8 @@ public class GeckoAppShell 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; } @@ -619,8 +620,8 @@ public class GeckoAppShell 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(); @@ -658,8 +659,8 @@ public class GeckoAppShell } 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)); } @@ -1067,7 +1068,7 @@ public class GeckoAppShell 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); @@ -1208,7 +1209,7 @@ public class GeckoAppShell // 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(); diff --git a/mobile/android/base/GeckoPreferences.java b/mobile/android/base/GeckoPreferences.java index 7a36dbcfa75..1bd15875e90 100644 --- a/mobile/android/base/GeckoPreferences.java +++ b/mobile/android/base/GeckoPreferences.java @@ -54,10 +54,14 @@ public class GeckoPreferences 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) { @@ -67,6 +71,23 @@ public class GeckoPreferences 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 @@ -75,7 +96,6 @@ public class GeckoPreferences return; mPreferencesList = new ArrayList(); - mPreferenceScreen = getPreferenceScreen(); initGroups(mPreferenceScreen); initValues(); } diff --git a/mobile/android/base/Makefile.in b/mobile/android/base/Makefile.in index b4b314a86ff..c6637fb3316 100644 --- a/mobile/android/base/Makefile.in +++ b/mobile/android/base/Makefile.in @@ -44,6 +44,7 @@ UTIL_JAVA_FILES := \ $(NULL) FENNEC_JAVA_FILES = \ + ANRReporter.java \ ActivityHandlerHelper.java \ AlertNotification.java \ AllCapsTextView.java \ @@ -88,6 +89,7 @@ FENNEC_JAVA_FILES = \ GeckoApplication.java \ GeckoApp.java \ GeckoAppShell.java \ + GeckoActivity.java \ GeckoBatteryManager.java \ GeckoConnectivityReceiver.java \ GeckoEditable.java \ @@ -102,6 +104,7 @@ FENNEC_JAVA_FILES = \ GeckoPreferences.java \ GeckoProfile.java \ GeckoPopupMenu.java \ + GeckoSmsManager.java \ GeckoThread.java \ GlobalHistory.java \ GeckoViewsFactory.java \ @@ -129,6 +132,7 @@ FENNEC_JAVA_FILES = \ PropertyAnimator.java \ ProfileMigrator.java \ PromptService.java \ + Restarter.java \ sqlite/ByteBufferInputStream.java \ sqlite/MatrixBlobCursor.java \ sqlite/SQLiteBridge.java \ @@ -141,6 +145,7 @@ FENNEC_JAVA_FILES = \ SetupScreen.java \ ShapedButton.java \ SiteIdentityPopup.java \ + SmsManager.java \ SuggestClient.java \ SurfaceBits.java \ Tab.java \ @@ -154,6 +159,7 @@ FENNEC_JAVA_FILES = \ TextSelectionHandle.java \ ThumbnailHelper.java \ TouchEventInterceptor.java \ + UpdateServiceHelper.java \ VideoPlayer.java \ WebAppAllocator.java \ ZoomConstraints.java \ @@ -216,10 +222,6 @@ FENNEC_JAVA_FILES = \ ReferrerReceiver.java \ $(NULL) -ifdef MOZ_WEBSMS_BACKEND -FENNEC_JAVA_FILES += GeckoSmsManager.java -endif - ifdef MOZ_WEBRTC WEBRTC_VIDEO_CAPTURE_JAVA_FILES = \ CaptureCapabilityAndroid.java \ @@ -234,7 +236,6 @@ endif ifdef MOZ_ANDROID_ANR_REPORTER DEFINES += -DMOZ_ANDROID_ANR_REPORTER=1 -FENNEC_JAVA_FILES += ANRReporter.java endif FENNEC_PP_JAVA_VIEW_FILES = \ @@ -253,26 +254,18 @@ 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))) @@ -530,8 +523,9 @@ RES_VALUES_V14 = \ $(NULL) RES_XML = \ - $(SYNC_RES_XML) \ - $(NULL) + res/xml/preferences.xml \ + $(SYNC_RES_XML) \ + $(NULL) RES_ANIM = \ res/anim/awesomebar_fade_in.xml \ @@ -987,16 +981,20 @@ RES_COLOR = \ $(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 diff --git a/mobile/android/base/Restarter.java.in b/mobile/android/base/Restarter.java similarity index 87% rename from mobile/android/base/Restarter.java.in rename to mobile/android/base/Restarter.java index ea14a59ad72..ee7887fc2a6 100644 --- a/mobile/android/base/Restarter.java.in +++ b/mobile/android/base/Restarter.java @@ -3,22 +3,19 @@ * 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) { @@ -27,7 +24,7 @@ public class Restarter extends Activity { Thread.sleep(100); } catch (InterruptedException ie) {} } - + if (countdown <= 0) { // if the countdown expired, something is hung GeckoAppShell.killAnyZombies(); @@ -44,8 +41,8 @@ public class Restarter extends Activity { } 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); diff --git a/mobile/android/base/SmsManager.java.in b/mobile/android/base/SmsManager.java similarity index 75% rename from mobile/android/base/SmsManager.java.in rename to mobile/android/base/SmsManager.java index 22211fab3f1..6ddfa45f817 100644 --- a/mobile/android/base/SmsManager.java.in +++ b/mobile/android/base/SmsManager.java @@ -5,22 +5,18 @@ 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 diff --git a/mobile/android/base/UpdateService.java b/mobile/android/base/UpdateService.java index a33d8615c70..b90a64b49ee 100644 --- a/mobile/android/base/UpdateService.java +++ b/mobile/android/base/UpdateService.java @@ -5,9 +5,11 @@ package org.mozilla.gecko.updater; -import org.mozilla.apache.commons.codec.binary.Hex; +import org.mozilla.gecko.AppConstants; import org.mozilla.gecko.R; +import org.mozilla.apache.commons.codec.binary.Hex; + import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -136,8 +138,8 @@ public class UpdateService extends IntentService { 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; diff --git a/mobile/android/base/UpdateServiceHelper.java.in b/mobile/android/base/UpdateServiceHelper.java similarity index 70% rename from mobile/android/base/UpdateServiceHelper.java.in rename to mobile/android/base/UpdateServiceHelper.java index 0b698b7b258..959737d5b23 100644 --- a/mobile/android/base/UpdateServiceHelper.java.in +++ b/mobile/android/base/UpdateServiceHelper.java @@ -3,10 +3,9 @@ * 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; @@ -22,12 +21,12 @@ 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; @@ -49,18 +48,26 @@ public class UpdateServiceHelper { // 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, @@ -74,7 +81,7 @@ public class UpdateServiceHelper { 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); @@ -91,7 +98,7 @@ public class UpdateServiceHelper { 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); @@ -102,11 +109,7 @@ public class UpdateServiceHelper { } 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) { diff --git a/mobile/android/base/WebApp.java.in b/mobile/android/base/WebApp.java.in index 9fe6a7536d5..04b54840a34 100644 --- a/mobile/android/base/WebApp.java.in +++ b/mobile/android/base/WebApp.java.in @@ -145,34 +145,6 @@ public class WebApp extends GeckoApp { } } - @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(); diff --git a/mobile/android/base/db/BrowserContract.java.in b/mobile/android/base/db/BrowserContract.java.in index 78a6947bbbd..4cb72f03884 100644 --- a/mobile/android/base/db/BrowserContract.java.in +++ b/mobile/android/base/db/BrowserContract.java.in @@ -6,19 +6,21 @@ #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"; diff --git 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 similarity index 97% 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 index 55ca1971274..55c6bee973a 100644 --- 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 @@ -29,8 +29,8 @@ - + android:title="@string/share" /> + @@ -72,8 +72,7 @@ android:icon="@drawable/ic_menu_settings" android:title="@string/settings" /> -#ifdef MOZ_PROFILING -#endif diff --git a/mobile/android/base/resources/menu-v11/browser_app_menu.xml.in b/mobile/android/base/resources/menu-v11/browser_app_menu.xml similarity index 97% 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 index 4d0ff3246f8..6253e9ca1a7 100644 --- a/mobile/android/base/resources/menu-v11/browser_app_menu.xml.in +++ b/mobile/android/base/resources/menu-v11/browser_app_menu.xml @@ -30,8 +30,8 @@ - + android:title="@string/share" /> + @@ -73,8 +73,7 @@ android:icon="@drawable/ic_menu_settings" android:title="@string/settings" /> -#ifdef MOZ_PROFILING -#endif diff --git 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 similarity index 97% 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 index 2f312e6fb4c..e673c097fe7 100644 --- 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 @@ -30,8 +30,8 @@ - + android:title="@string/share" /> + @@ -73,8 +73,7 @@ android:icon="@drawable/ic_menu_settings" android:title="@string/settings" /> -#ifdef MOZ_PROFILING -#endif diff --git a/mobile/android/base/resources/menu/browser_app_menu.xml.in b/mobile/android/base/resources/menu/browser_app_menu.xml similarity index 96% rename from mobile/android/base/resources/menu/browser_app_menu.xml.in rename to mobile/android/base/resources/menu/browser_app_menu.xml index b497da7821c..d76442cd605 100644 --- a/mobile/android/base/resources/menu/browser_app_menu.xml.in +++ b/mobile/android/base/resources/menu/browser_app_menu.xml @@ -26,8 +26,8 @@ android:title="@string/new_private_tab"/> - + android:title="@string/share" /> + @@ -54,8 +54,7 @@ -#ifdef MOZ_PROFILING -#endif diff --git a/mobile/android/base/resources/xml/preferences.xml.in b/mobile/android/base/resources/xml/preferences.xml similarity index 94% rename from mobile/android/base/resources/xml/preferences.xml.in rename to mobile/android/base/resources/xml/preferences.xml index 3d6f730bf8d..3a42ec77f3a 100644 --- a/mobile/android/base/resources/xml/preferences.xml.in +++ b/mobile/android/base/resources/xml/preferences.xml @@ -1,4 +1,3 @@ -#filter substitution