Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit f32710d

Browse files
committed
Bug 847898 - Put Android Beam support behind a confvar variable. r=mfinkle
1 parent 35d113c commit f32710d

5 files changed

Lines changed: 26 additions & 3 deletions

File tree

configure.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4263,6 +4263,7 @@ MOZ_USE_NATIVE_POPUP_WINDOWS=
42634263
MOZ_ANDROID_HISTORY=
42644264
MOZ_WEBSMS_BACKEND=
42654265
MOZ_ANDROID_WALLPAPER=
4266+
MOZ_ANDROID_BEAM=
42664267
ACCESSIBILITY=1
42674268
MOZ_SYS_MSG=
42684269
MOZ_TIME_MANAGER=
@@ -5146,6 +5147,13 @@ if test -n "$MOZ_ANDROID_WALLPAPER"; then
51465147
AC_DEFINE(MOZ_ANDROID_WALLPAPER)
51475148
fi
51485149

5150+
dnl ========================================================
5151+
dnl = Enable NFC permission on Android
5152+
dnl ========================================================
5153+
if test -n "$MOZ_ANDROID_BEAM"; then
5154+
AC_DEFINE(MOZ_ANDROID_BEAM)
5155+
fi
5156+
51495157
dnl ========================================================
51505158
dnl = Build Personal Security Manager
51515159
dnl ========================================================
@@ -8594,6 +8602,7 @@ AC_SUBST(MOZ_METRO)
85948602
AC_SUBST(MOZ_ANDROID_HISTORY)
85958603
AC_SUBST(MOZ_WEBSMS_BACKEND)
85968604
AC_SUBST(MOZ_ANDROID_WALLPAPER)
8605+
AC_SUBST(MOZ_ANDROID_BEAM)
85978606
AC_SUBST(ENABLE_STRIP)
85988607
AC_SUBST(PKG_SKIP_STRIP)
85998608
AC_SUBST(STRIP_FLAGS)

mobile/android/base/AndroidManifest.xml.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@
4444
<uses-feature android:name="android.hardware.location.gps" android:required="false"/>
4545
<uses-feature android:name="android.hardware.touchscreen"/>
4646

47+
#ifdef MOZ_ANDROID_BEAM
4748
<!-- Android Beam support -->
4849
<uses-permission android:name="android.permission.NFC"/>
4950
<uses-feature android:name="android.hardware.nfc"/>
51+
#endif
5052

5153
#ifdef MOZ_WEBRTC
5254
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
@@ -125,12 +127,14 @@
125127
<action android:name="android.intent.action.SEARCH" />
126128
</intent-filter>
127129

130+
#ifdef MOZ_ANDROID_BEAM
128131
<intent-filter>
129132
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
130133
<category android:name="android.intent.category.DEFAULT" />
131134
<data android:scheme="http" />
132135
<data android:scheme="https" />
133136
</intent-filter>
137+
#endif
134138

135139
<meta-data android:name="android.app.searchable"
136140
android:resource="@xml/searchable" />

mobile/android/base/AppConstants.java.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,11 @@ public class AppConstants {
8686
#else
8787
false;
8888
#endif
89+
90+
public static final boolean MOZ_ANDROID_BEAM =
91+
#ifdef MOZ_ANDROID_BEAM
92+
true;
93+
#else
94+
false;
95+
#endif
8996
}

mobile/android/base/BrowserApp.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ public boolean onInterceptMotionEvent(View view, MotionEvent event) {
536536
Distribution.init(this, getPackageResourcePath());
537537
JavaAddonManager.getInstance().init(getApplicationContext());
538538

539-
if (Build.VERSION.SDK_INT >= 14) {
539+
if (AppConstants.MOZ_ANDROID_BEAM && Build.VERSION.SDK_INT >= 14) {
540540
NfcAdapter nfc = NfcAdapter.getDefaultAdapter(this);
541541
if (nfc != null) {
542542
nfc.setNdefPushMessageCallback(new NfcAdapter.CreateNdefMessageCallback() {
@@ -632,7 +632,7 @@ public void onDestroy() {
632632
unregisterEventListener("Feedback:MaybeLater");
633633
unregisterEventListener("Telemetry:Gather");
634634

635-
if (Build.VERSION.SDK_INT >= 14) {
635+
if (AppConstants.MOZ_ANDROID_BEAM && Build.VERSION.SDK_INT >= 14) {
636636
NfcAdapter nfc = NfcAdapter.getDefaultAdapter(this);
637637
if (nfc != null) {
638638
// null this out even though the docs say it's not needed,
@@ -1664,7 +1664,7 @@ protected void onNewIntent(Intent intent) {
16641664

16651665
String action = intent.getAction();
16661666

1667-
if (Build.VERSION.SDK_INT >= 10 && NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) {
1667+
if (AppConstants.MOZ_ANDROID_BEAM && Build.VERSION.SDK_INT >= 10 && NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) {
16681668
String uri = intent.getDataString();
16691669
GeckoAppShell.sendEventToGecko(GeckoEvent.createURILoadEvent(uri));
16701670
}

mobile/android/confvars.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ MOZ_MEDIA_NAVIGATOR=1
2222
# Enable SET_WALLPAPER permission
2323
MOZ_ANDROID_WALLPAPER=1
2424

25+
# Enable NFC permission
26+
MOZ_ANDROID_BEAM=1
27+
2528
if test "$LIBXUL_SDK"; then
2629
MOZ_XULRUNNER=1
2730
else

0 commit comments

Comments
 (0)