Launch into browser when a URL is received over NFC.
Change-Id: I32c6dcc4e257a32a341b9c2f165cd3764da08b64
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 00354a4..2056176 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -102,6 +102,13 @@
<data android:scheme="file" />
<data android:mimeType="application/x-webarchive-xml"/>
</intent-filter>
+ <!-- Accept inbound NFC URLs at a low priority -->
+ <intent-filter android:priority="-101">
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <data android:scheme="http" />
+ <data android:scheme="https" />
+ </intent-filter>
<!-- We are also the main entry point of the browser. -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
diff --git a/src/com/android/browser/IntentHandler.java b/src/com/android/browser/IntentHandler.java
index 8d1b784..4a8fa22 100644
--- a/src/com/android/browser/IntentHandler.java
+++ b/src/com/android/browser/IntentHandler.java
@@ -27,6 +27,7 @@
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
+import android.nfc.NfcAdapter;
import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.Browser;
@@ -95,6 +96,7 @@
boolean activateVoiceSearch = RecognizerResultsIntent
.ACTION_VOICE_SEARCH_RESULTS.equals(action);
if (Intent.ACTION_VIEW.equals(action)
+ || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)
|| Intent.ACTION_SEARCH.equals(action)
|| MediaStore.INTENT_ACTION_MEDIA_SEARCH.equals(action)
|| Intent.ACTION_WEB_SEARCH.equals(action)
@@ -214,7 +216,8 @@
if (intent != null
&& (intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0) {
final String action = intent.getAction();
- if (Intent.ACTION_VIEW.equals(action)) {
+ if (Intent.ACTION_VIEW.equals(action) ||
+ NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) {
url = UrlUtils.smartUrlFilter(intent.getData());
if (url != null && url.startsWith("http")) {
final Bundle pairs = intent