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)
This commit is contained in:
Nathan Toone 2015-05-05 20:10:50 -06:00
Родитель bb97bae3b3
Коммит 79c3b4b7be
6 изменённых файлов: 27 добавлений и 10 удалений

Просмотреть файл

@ -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)

Просмотреть файл

@ -87,7 +87,7 @@
<application android:label="@string/moz_app_displayname"
android:icon="@drawable/icon"
android:logo="@drawable/logo"
android:name="org.mozilla.gecko.GeckoApplication"
android:name="@MOZ_ANDROID_APPLICATION_CLASS@"
android:hardwareAccelerated="true"
# The preprocessor does not yet support arbitrary parentheses, so this cannot
# be parenthesized thus to clarify that the logical AND operator has precedence:
@ -107,7 +107,7 @@
<!-- If the windowSoftInputMode adjust* flag changes below, the
setSoftInputMode call in BrowserSearch#onStop must also be updated. -->
<activity android:name="org.mozilla.gecko.BrowserApp"
<activity android:name="@MOZ_ANDROID_BROWSER_INTENT_CLASS@"
android:label="@string/moz_app_displayname"
android:taskAffinity="@ANDROID_PACKAGE_NAME@.BROWSER"
android:alwaysRetainTaskState="true"
@ -134,7 +134,7 @@
for backwards compatibility. -->
<activity-alias android:name=".App"
android:label="@MOZ_APP_DISPLAYNAME@"
android:targetActivity="org.mozilla.gecko.BrowserApp">
android:targetActivity="@MOZ_ANDROID_BROWSER_INTENT_CLASS@">
<!-- android:priority ranges between -1000 and 1000. We never want
another activity to usurp the MAIN action, so we ratchet our
priority up. -->
@ -356,7 +356,7 @@
<!-- Masquerade as the Resolver so that we can be opened from the Marketplace. -->
<activity-alias
android:name="com.android.internal.app.ResolverActivity"
android:targetActivity="org.mozilla.gecko.BrowserApp"
android:targetActivity="@MOZ_ANDROID_BROWSER_INTENT_CLASS@"
android:exported="true" />
<receiver android:name="org.mozilla.gecko.GeckoUpdateReceiver">

Просмотреть файл

@ -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@";

Просмотреть файл

@ -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]

Просмотреть файл

@ -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

Просмотреть файл

@ -1,5 +1,5 @@
<activity
android:name="org.mozilla.search.SearchActivity"
android:name="@MOZ_ANDROID_SEARCH_INTENT_CLASS@"
android:launchMode="singleTop"
android:icon="@drawable/search_launcher"
android:label="@string/search_app_name"
@ -40,9 +40,9 @@
android:name="org.mozilla.search.SearchPreferenceActivity"
android:logo="@drawable/search_launcher"
android:label="@string/search_pref_title"
android:parentActivityName="org.mozilla.search.SearchActivity"
android:parentActivityName="@MOZ_ANDROID_SEARCH_INTENT_CLASS@"
android:theme="@style/SettingsTheme" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="org.mozilla.search.SearchActivity"/>
android:value="@MOZ_ANDROID_SEARCH_INTENT_CLASS@"/>
</activity>