Java Code Examples for org.chromium.chrome.browser.util.FeatureUtilities#isTabModelMergingEnabled()

The following examples show how to use org.chromium.chrome.browser.util.FeatureUtilities#isTabModelMergingEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChromeTabbedActivity.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void onResumeWithNative() {
    super.onResumeWithNative();

    CookiesFetcher.restoreCookies(this);
    StartupMetrics.getInstance().recordHistogram(false);

    if (FeatureUtilities.isTabModelMergingEnabled()) {
        boolean inMultiWindowMode = MultiWindowUtils.getInstance().isInMultiWindowMode(this);
        // Merge tabs if the activity is not in multi-window mode and mMergeTabsOnResume is true
        // or unset because the activity is just starting or was destroyed.
        if (!inMultiWindowMode && (mMergeTabsOnResume == null || mMergeTabsOnResume)) {
            maybeMergeTabs();
        }
        mMergeTabsOnResume = false;
    }
    mVrShellDelegate.maybeResumeVR();

    mLocaleManager.setSnackbarManager(getSnackbarManager());
    mLocaleManager.startObservingPhoneChanges();
}
 
Example 2
Source File: ChromeTabbedActivity.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
    super.onMultiWindowModeChanged(isInMultiWindowMode);
    if (!FeatureUtilities.isTabModelMergingEnabled()) return;
    if (!isInMultiWindowMode) {
        // If the activity is currently resumed when multi-window mode is exited, try to merge
        // tabs from the other activity instance.
        if (ApplicationStatus.getStateForActivity(this) == ActivityState.RESUMED) {
            maybeMergeTabs();
        } else {
            mMergeTabsOnResume = true;
        }
    }
}
 
Example 3
Source File: ChromeTabbedActivity.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@SuppressLint("NewApi")
private boolean isMergedInstanceTaskRunning() {
    if (!FeatureUtilities.isTabModelMergingEnabled() || sMergedInstanceTaskId == 0) {
        return false;
    }

    ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    for (AppTask task : manager.getAppTasks()) {
        RecentTaskInfo info = DocumentUtils.getTaskInfoFromTask(task);
        if (info == null) continue;
        if (info.id == sMergedInstanceTaskId) return true;
    }
    return false;
}
 
Example 4
Source File: TabWindowManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public TabModelSelector buildSelector(Activity activity,
        TabCreatorManager tabCreatorManager, int selectorIndex) {
    // Merge tabs if this is the TabModelSelector for ChromeTabbedActivity and there are no
    // other instances running. This indicates that it is a complete cold start of
    // ChromeTabbedActivity. Tabs should only be merged during a cold start of
    // ChromeTabbedActivity and not other instances (e.g. ChromeTabbedActivity2).
    boolean mergeTabs = FeatureUtilities.isTabModelMergingEnabled()
            && activity.getClass().equals(ChromeTabbedActivity.class)
            && getInstance().getNumberOfAssignedTabModelSelectors() == 0;
    TabPersistencePolicy persistencePolicy = new TabbedModeTabPersistencePolicy(
            selectorIndex, mergeTabs);
    return new TabModelSelectorImpl(
            activity, tabCreatorManager, persistencePolicy, true, true);
}
 
Example 5
Source File: ChromeTabbedActivity.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void onResumeWithNative() {
    super.onResumeWithNative();

    if (shouldDestroyIncognitoProfile()) {
        Profile.getLastUsedProfile().getOffTheRecordProfile().destroyWhenAppropriate();
    } else {
        CookiesFetcher.restoreCookies(this);
    }

    StartupMetrics.getInstance().recordHistogram(false);

    if (FeatureUtilities.isTabModelMergingEnabled()) {
        boolean inMultiWindowMode = MultiWindowUtils.getInstance().isInMultiWindowMode(this);
        // Merge tabs if the activity is not in multi-window mode and mMergeTabsOnResume is true
        // or unset because the activity is just starting or was destroyed.
        if (!inMultiWindowMode && (mMergeTabsOnResume == null || mMergeTabsOnResume)) {
            maybeMergeTabs();
        }
        mMergeTabsOnResume = false;
    }

    mLocaleManager.setSnackbarManager(getSnackbarManager());
    mLocaleManager.startObservingPhoneChanges();

    if (isWarmOnResume()) {
        SuggestionsEventReporterBridge.onActivityWarmResumed();
    } else {
        SuggestionsEventReporterBridge.onColdStart();
    }
}
 
Example 6
Source File: ChromeTabbedActivity.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
    super.onMultiWindowModeChanged(isInMultiWindowMode);
    if (!FeatureUtilities.isTabModelMergingEnabled()) return;
    if (!isInMultiWindowMode) {
        // If the activity is currently resumed when multi-window mode is exited, try to merge
        // tabs from the other activity instance.
        if (ApplicationStatus.getStateForActivity(this) == ActivityState.RESUMED) {
            maybeMergeTabs();
        } else {
            mMergeTabsOnResume = true;
        }
    }
}
 
Example 7
Source File: ChromeTabbedActivity.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@SuppressLint("NewApi")
private boolean isMergedInstanceTaskRunning() {
    if (!FeatureUtilities.isTabModelMergingEnabled() || sMergedInstanceTaskId == 0) {
        return false;
    }

    ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    for (AppTask task : manager.getAppTasks()) {
        RecentTaskInfo info = DocumentUtils.getTaskInfoFromTask(task);
        if (info == null) continue;
        if (info.id == sMergedInstanceTaskId) return true;
    }
    return false;
}
 
Example 8
Source File: TabWindowManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public TabModelSelector buildSelector(Activity activity,
        TabCreatorManager tabCreatorManager, int selectorIndex) {
    // Merge tabs if this is the TabModelSelector for ChromeTabbedActivity and there are no
    // other instances running. This indicates that it is a complete cold start of
    // ChromeTabbedActivity. Tabs should only be merged during a cold start of
    // ChromeTabbedActivity and not other instances (e.g. ChromeTabbedActivity2).
    boolean mergeTabs = FeatureUtilities.isTabModelMergingEnabled()
            && activity.getClass().equals(ChromeTabbedActivity.class)
            && getInstance().getNumberOfAssignedTabModelSelectors() == 0;
    TabPersistencePolicy persistencePolicy = new TabbedModeTabPersistencePolicy(
            selectorIndex, mergeTabs);
    return new TabModelSelectorImpl(
            activity, tabCreatorManager, persistencePolicy, true, true);
}