Skip to content

Commit

Permalink
Bug 1207708 - Part 1: Add MOZ_ANDROID_GCM{_SENDERID} build flags. r=s…
Browse files Browse the repository at this point in the history
…ebastian

These flags are not intended to be feature specific.  On day one, we
intend to support a single GCM-backed feature -- Push Notifications --
but the set of GCM-consuming features is potentially large (e.g.,
possibly Firefox Sync tickles and Send Tab to Device alerts).  Such
features can and will have their own build flags.

Note that GCM sender IDs are not sensitive -- see link in code
comment.  Since this is something custom branding will almost always
want to set, I don't want to bury the default value in confvars.sh.
  • Loading branch information
ncalexan committed Oct 28, 2015
1 parent 2963748 commit e5c0241
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
17 changes: 17 additions & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -3755,6 +3755,7 @@ MOZ_LOCALE_SWITCHER=
MOZ_ANDROID_READING_LIST_SERVICE=
MOZ_ANDROID_SEARCH_ACTIVITY=
MOZ_ANDROID_DOWNLOADS_INTEGRATION=
MOZ_ANDROID_GCM=
MOZ_ANDROID_MLS_STUMBLER=
MOZ_ANDROID_SHARE_OVERLAY=
MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
Expand Down Expand Up @@ -3911,6 +3912,14 @@ MOZ_ARG_WITH_STRING(adjust-sdk-keyfile,
MOZ_INSTALL_TRACKING_ADJUST_SDK_APP_TOKEN=`cat $withval`)
AC_SUBST(MOZ_INSTALL_TRACKING_ADJUST_SDK_APP_TOKEN)

# Allow specifying a GCM sender ID key file that contains the sender ID used for
# GCM requests. Note that GCM sender IDs are not sensitive: see, for example,
# http://stackoverflow.com/a/18216063.
MOZ_ARG_WITH_STRING(gcm-senderid-keyfile,
[ --with-gcm-senderid-keyfile=file GCM sender ID for GCM requests],
MOZ_ANDROID_GCM_SENDERID=`cat $withval`)
AC_SUBST(MOZ_ANDROID_GCM_SENDERID)

# Whether to include optional-but-large font files in the final APK.
# We want this in mobile/android/confvars.sh, so it goes early.
MOZ_ARG_DISABLE_BOOL(android-include-fonts,
Expand Down Expand Up @@ -4886,6 +4895,13 @@ if test -n "$MOZ_SWITCHBOARD"; then
AC_DEFINE(MOZ_SWITCHBOARD)
fi

dnl ========================================================
dnl = Enable GCM on Android.
dnl ========================================================
if test -n "$MOZ_ANDROID_GCM"; then
AC_DEFINE(MOZ_ANDROID_GCM)
fi

dnl ========================================================
dnl = Enable IPDL's "expensive" unit tests
dnl ========================================================
Expand Down Expand Up @@ -8592,6 +8608,7 @@ AC_SUBST(MOZ_WEBSMS_BACKEND)
AC_SUBST(MOZ_ANDROID_BEAM)
AC_SUBST(MOZ_LOCALE_SWITCHER)
AC_SUBST(MOZ_DISABLE_GECKOVIEW)
AC_SUBST(MOZ_ANDROID_GCM)
AC_SUBST(MOZ_ANDROID_GECKOLIBS_AAR)
AC_SUBST(MOZ_ANDROID_READING_LIST_SERVICE)
AC_SUBST(MOZ_ANDROID_SEARCH_ACTIVITY)
Expand Down
14 changes: 14 additions & 0 deletions mobile/android/base/AppConstants.java.in
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,20 @@ public class AppConstants {
false;
//#endif

public static final boolean MOZ_ANDROID_GCM =
//#ifdef MOZ_ANDROID_GCM
true;
//#else
false;
//#endif

public static final String MOZ_ANDROID_GCM_SENDERID =
//#ifdef MOZ_ANDROID_GCM_SENDERID
"@MOZ_ANDROID_GCM_SENDERID@";
//#else
null;
//#endif

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 OMNIJAR_NAME = "@OMNIJAR_NAME@";
Expand Down
3 changes: 2 additions & 1 deletion mobile/android/base/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -835,11 +835,12 @@ ANDROID_ASSETS_DIRS += [
for var in ('MOZ_ANDROID_ANR_REPORTER', 'MOZ_LINKER_EXTRACT', 'MOZ_DEBUG',
'MOZ_ANDROID_SEARCH_ACTIVITY', 'MOZ_NATIVE_DEVICES', 'MOZ_ANDROID_MLS_STUMBLER',
'MOZ_ANDROID_SHARE_OVERLAY', 'MOZ_ANDROID_DOWNLOADS_INTEGRATION', 'MOZ_INSTALL_TRACKING',
'MOZ_ANDROID_GCM',
'MOZ_ANDROID_TAB_QUEUE', 'MOZ_ANDROID_FIREFOX_ACCOUNT_PROFILES'):
if CONFIG[var]:
DEFINES[var] = 1

for var in ('MOZ_UPDATER', 'MOZ_PKG_SPECIAL'):
for var in ('MOZ_UPDATER', 'MOZ_PKG_SPECIAL', 'MOZ_ANDROID_GCM_SENDERID'):
if CONFIG[var]:
DEFINES[var] = CONFIG[var]

Expand Down
5 changes: 5 additions & 0 deletions mobile/android/confvars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ MOZ_ANDROID_TAB_QUEUE=1
# Use the low-memory GC tuning.
export JS_GC_SMALL_CHUNK_SIZE=1

# Enable GCM registration on Nightly builds only.
if test "$NIGHTLY_BUILD"; then
MOZ_ANDROID_GCM=1
fi

# Enable Firefox Account avatars.
MOZ_ANDROID_FIREFOX_ACCOUNT_PROFILES=1

Expand Down

0 comments on commit e5c0241

Please sign in to comment.