Snap for 4507882 from ad6569eefb8c3cf2b05ef7c9b91880fdf2b91a29 to pi-release

Change-Id: I29e7684a11b8f8d5c1b933724121cc094030e996
diff --git a/src/com/android/htmlviewer/HTMLViewerActivity.java b/src/com/android/htmlviewer/HTMLViewerActivity.java
index 20f2edc..38940c5 100644
--- a/src/com/android/htmlviewer/HTMLViewerActivity.java
+++ b/src/com/android/htmlviewer/HTMLViewerActivity.java
@@ -24,6 +24,7 @@
 import android.Manifest;
 import android.net.Uri;
 import android.os.Bundle;
+import android.provider.Browser;
 import android.util.Log;
 import android.view.View;
 import android.webkit.WebChromeClient;
@@ -161,6 +162,10 @@
                 selector.addCategory(Intent.CATEGORY_BROWSABLE);
                 selector.setComponent(null);
             }
+            // Pass the package name as application ID so that the intent from the
+            // same application can be opened in the same tab.
+            intent.putExtra(Browser.EXTRA_APPLICATION_ID,
+                            view.getContext().getPackageName());
 
             try {
                 view.getContext().startActivity(intent);