From 79c3b4b7beb4ae314654b482d40515c8e8338b2e Mon Sep 17 00:00:00 2001 From: Nathan Toone Date: Tue, 5 May 2015 20:10:50 -0600 Subject: [PATCH] Bug 1161195 - Part 1: Set java class names at compile time. r=nalexander Rather than hardcoding the following classes in AppConstants.java.in and AndroidManifest.xml, they are set in confvars.sh: org.mozilla.gecko.GeckoApplication (Specified using MOZ_ANDROID_APPLICATION_CLASS) org.mozilla.gecko.BrowserApp (Specified using MOZ_ANDROID_BROWSER_INTENT_CLASS) org.mozilla.search.SearchActivity (Specified using MOZ_ANDROID_SEARCH_INTENT_CLASS) --- configure.in | 3 +++ mobile/android/base/AndroidManifest.xml.in | 8 ++++---- mobile/android/base/AppConstants.java.in | 13 ++++++++++--- mobile/android/base/moz.build | 1 + mobile/android/confvars.sh | 6 ++++++ .../SearchAndroidManifest_activities.xml.in | 6 +++--- 6 files changed, 27 insertions(+), 10 deletions(-) diff --git a/configure.in b/configure.in index b78ebeecddc6..19bd8ecea36b 100644 --- a/configure.in +++ b/configure.in @@ -8485,6 +8485,9 @@ AC_SUBST(MOZ_ANDROID_SHARE_OVERLAY) AC_SUBST(MOZ_ANDROID_TAB_QUEUE) AC_SUBST(MOZ_ANDROID_MLS_STUMBLER) AC_SUBST(MOZ_ANDROID_DOWNLOADS_INTEGRATION) +AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS) +AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS) +AC_SUBST(MOZ_ANDROID_SEARCH_INTENT_CLASS) AC_SUBST(MOZ_INSTALL_TRACKING) AC_SUBST(ENABLE_STRIP) AC_SUBST(PKG_SKIP_STRIP) diff --git a/mobile/android/base/AndroidManifest.xml.in b/mobile/android/base/AndroidManifest.xml.in index 8afdd5b3b32a..826e695d043d 100644 --- a/mobile/android/base/AndroidManifest.xml.in +++ b/mobile/android/base/AndroidManifest.xml.in @@ -87,7 +87,7 @@ - + android:targetActivity="@MOZ_ANDROID_BROWSER_INTENT_CLASS@"> @@ -356,7 +356,7 @@ diff --git a/mobile/android/base/AppConstants.java.in b/mobile/android/base/AppConstants.java.in index 20e3899612c0..7aa5fd8491e9 100644 --- a/mobile/android/base/AppConstants.java.in +++ b/mobile/android/base/AppConstants.java.in @@ -81,10 +81,17 @@ public class AppConstants { } /** - * The name of the Java class that launches the browser. + * The name of the Java class that represents the android application. */ - public static final String BROWSER_INTENT_CLASS_NAME = "org.mozilla.gecko.BrowserApp"; - public static final String SEARCH_INTENT_CLASS_NAME = "org.mozilla.search.SearchActivity"; + public static final String MOZ_ANDROID_APPLICATION_CLASS_NAME = "@MOZ_ANDROID_APPLICATION_CLASS@"; + /** + * The name of the Java class that launches the browser activity. + */ + public static final String BROWSER_INTENT_CLASS_NAME = "@MOZ_ANDROID_BROWSER_INTENT_CLASS@"; + /** + * The name of the Java class that launches the search activity. + */ + public static final String SEARCH_INTENT_CLASS_NAME = "@MOZ_ANDROID_SEARCH_INTENT_CLASS@"; public static final String GRE_MILESTONE = "@GRE_MILESTONE@"; diff --git a/mobile/android/base/moz.build b/mobile/android/base/moz.build index 37620f3ff0b8..c12dfb298bb0 100644 --- a/mobile/android/base/moz.build +++ b/mobile/android/base/moz.build @@ -753,6 +753,7 @@ for var in ('ANDROID_PACKAGE_NAME', 'ANDROID_CPU_ARCH', 'GRE_MILESTONE', 'MOZ_APP_BASENAME', 'MOZ_MOZILLA_API_KEY', 'MOZ_APP_DISPLAYNAME', 'MOZ_APP_ID', 'MOZ_APP_NAME', 'MOZ_APP_VENDOR', 'MOZ_APP_VERSION', 'MOZ_CHILD_PROCESS_NAME', + 'MOZ_ANDROID_APPLICATION_CLASS', 'MOZ_ANDROID_BROWSER_INTENT_CLASS', 'MOZ_ANDROID_SEARCH_INTENT_CLASS', 'MOZ_CRASHREPORTER', 'MOZ_UPDATE_CHANNEL', 'OMNIJAR_NAME', 'OS_TARGET', 'TARGET_XPCOM_ABI'): DEFINES[var] = CONFIG[var] diff --git a/mobile/android/confvars.sh b/mobile/android/confvars.sh index e3f68e90a4e6..da1ed1ecb633 100644 --- a/mobile/android/confvars.sh +++ b/mobile/android/confvars.sh @@ -16,6 +16,12 @@ MOZ_OFFICIAL_BRANDING_DIRECTORY=mobile/android/branding/official # See the --enable-android-min-sdk and --enable-android-max-sdk arguments in configure.in. MOZ_ANDROID_MIN_SDK_VERSION=9 +# There are several entry points into the Firefox application. These are the names of some of the classes that are +# listed in the Android manifest. They are specified in here to avoid hard-coding them in source code files. +MOZ_ANDROID_APPLICATION_CLASS=org.mozilla.gecko.GeckoApplication +MOZ_ANDROID_BROWSER_INTENT_CLASS=org.mozilla.gecko.BrowserApp +MOZ_ANDROID_SEARCH_INTENT_CLASS=org.mozilla.search.SearchActivity + MOZ_SAFE_BROWSING=1 MOZ_NO_SMART_CARDS=1 diff --git a/mobile/android/search/manifests/SearchAndroidManifest_activities.xml.in b/mobile/android/search/manifests/SearchAndroidManifest_activities.xml.in index 095fdf768f47..8097391fbcde 100644 --- a/mobile/android/search/manifests/SearchAndroidManifest_activities.xml.in +++ b/mobile/android/search/manifests/SearchAndroidManifest_activities.xml.in @@ -1,5 +1,5 @@ + android:value="@MOZ_ANDROID_SEARCH_INTENT_CLASS@"/>