change app tab behavior
Bug: 3422554
allow apps to open links in new tabs
don't close tabs on back if they were launched from other apps
Change-Id: I3d58354cceca46c15761f70216fa63edb71f0545
diff --git a/src/com/android/browser/IntentHandler.java b/src/com/android/browser/IntentHandler.java
index 77db538..fa8bfbc 100644
--- a/src/com/android/browser/IntentHandler.java
+++ b/src/com/android/browser/IntentHandler.java
@@ -145,14 +145,18 @@
|| (activateVoiceSearch && appId != null))
&& !mActivity.getPackageName().equals(appId)
&& (flags & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) {
- Tab appTab = mTabControl.getTabFromId(appId);
- if (appTab != null) {
- mController.reuseTab(appTab, appId, urlData);
- return;
+ if (activateVoiceSearch) {
+ Tab appTab = mTabControl.getTabFromId(appId);
+ if (appTab != null) {
+ mController.reuseTab(appTab, appId, urlData);
+ return;
+ } else {
+ mController.openTabAndShow(null, urlData, false, appId);
+ }
} else {
// No matching application tab, try to find a regular tab
// with a matching url.
- appTab = mTabControl.findUnusedTabWithUrl(urlData.mUrl);
+ Tab appTab = mTabControl.findUnusedTabWithUrl(urlData.mUrl);
if (appTab != null) {
if (current != appTab) {
mController.switchToTab(mTabControl.getTabIndex(appTab));
@@ -164,7 +168,7 @@
// MAX_TABS. Then the url will be opened in the current
// tab. If a new tab is created, it will have "true" for
// exit on close.
- mController.openTabAndShow(null, urlData, true, appId);
+ mController.openTabAndShow(null, urlData, false, appId);
}
}
} else {