EXTRA_APPLICATION_ID seems not to work in the tablet. Do you know
other work around to reuse tab of the Browser.apk when starting the
Browser by intent from my service. This is directly related to
[9902225]. Any hints is appreciated.

[9902225]: 
http://stackoverflow.com/questions/9901820/browser-extra-application-id-not-working-in-ics

Cause: The resuseTab() will not be called if the device is a tablet.

See line:

    * 3-tablet) Open new tab

See line:

    if (activateVoiceSearch || !BrowserActivity.isTablet(mActivity)) {

// Browser.apk source code (Android 4.0.3_r1-6)

    com.android.browser.IntentHandler

    void onNewIntent(Intent intent) {
    ....
       /*
         * TODO: Don't allow javascript URIs
         * 0) If this is a javascript: URI, *always* open a new tab
         * 1) If this is a voice search, re-use tab for appId
         *    If there is no appId, use current tab
         * 2) If the URL is already opened, switch to that tab
         * 3-phone) Reuse tab with same appId
         * 3-tablet) Open new tab
         */
        final String appId = intent
                .getStringExtra(Browser.EXTRA_APPLICATION_ID);
        if (!TextUtils.isEmpty(urlData.mUrl) &&
                urlData.mUrl.startsWith("javascript:")) {
            // Always open javascript: URIs in new tabs
            mController.openTab(urlData);
            return;
        }
        if ((Intent.ACTION_VIEW.equals(action)
                // If a voice search has no appId, it means that it
came
                // from the browser.  In that case, reuse the current
tab.
                || (activateVoiceSearch && appId != null))
                && !mActivity.getPackageName().equals(appId)) {
            if (activateVoiceSearch || !
BrowserActivity.isTablet(mActivity)) {
                Tab appTab = mTabControl.getTabFromAppId(appId);
                if (appTab != null) {
                    mController.reuseTab(appTab, urlData);
                    return;
                }
            }
            // No matching application tab, try to find a regular tab
            // with a matching url.
            Tab appTab = mTabControl.findTabWithUrl(urlData.mUrl);
            if (appTab != null) {
                // Transfer ownership
                appTab.setAppId(appId);
                if (current != appTab) {
                    mController.switchToTab(appTab);
                }
                // Otherwise, we are already viewing the correct tab.
            } else {
                // if FLAG_ACTIVITY_BROUGHT_TO_FRONT flag is on, the
url
                // will be opened in a new tab unless we have reached
                // 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.
                Tab tab = mController.openTab(urlData);
                if (tab != null) {
                    tab.setAppId(appId);
                    if ((intent.getFlags() &
Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) {
                        tab.setCloseOnBack(true);
                    }
                }
            }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to