Java Code Examples for org.chromium.base.ApiCompatibilityUtils#finishAndRemoveTask()

The following examples show how to use org.chromium.base.ApiCompatibilityUtils#finishAndRemoveTask() . 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: ChromeLauncherActivity.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == FIRST_RUN_EXPERIENCE_REQUEST_CODE) {
        if (resultCode == Activity.RESULT_OK) {
            // User might have opted out during FRE, so check again.
            if (mIsCustomTabIntent) {
                launchCustomTabActivity();
                finish();
            } else {
                launchTabbedMode();
                finish();
            }
            return;
        }

        // TODO(aruslan): FAIL.
        ApiCompatibilityUtils.finishAndRemoveTask(this);
    }
}
 
Example 2
Source File: AsyncInitializationActivity.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private final void onCreateInternal(Bundle savedInstanceState) {
    if (DocumentModeAssassin.getInstance().isMigrationNecessary()) {
        super.onCreate(null);

        // Kick the user to the MigrationActivity.
        UpgradeActivity.launchInstance(this, getIntent());

        // Don't remove this task -- it may be a DocumentActivity that exists only in Recents.
        finish();
        return;
    }

    if (!isStartedUpCorrectly(getIntent())) {
        super.onCreate(null);
        ApiCompatibilityUtils.finishAndRemoveTask(this);
        return;
    }

    super.onCreate(savedInstanceState);
    mOnCreateTimestampMs = SystemClock.elapsedRealtime();
    mOnCreateTimestampUptimeMs = SystemClock.uptimeMillis();
    mSavedInstanceState = savedInstanceState;

    ChromeBrowserInitializer.getInstance(this).handlePreNativeStartup(this);
}
 
Example 3
Source File: AsyncInitializationActivity.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Extending classes should override {@link AsyncInitializationActivity#preInflationStartup()},
 * {@link AsyncInitializationActivity#setContentView()} and
 * {@link AsyncInitializationActivity#postInflationStartup()} instead of this call which will
 * be called on that order.
 */
@Override
protected final void onCreate(Bundle savedInstanceState) {
    if (DocumentModeAssassin.getInstance().isMigrationNecessary()) {
        super.onCreate(null);

        // Kick the user to the MigrationActivity.
        UpgradeActivity.launchInstance(this, getIntent());

        // Don't remove this task -- it may be a DocumentActivity that exists only in Recents.
        finish();
        return;
    }

    if (!isStartedUpCorrectly(getIntent())) {
        super.onCreate(null);
        ApiCompatibilityUtils.finishAndRemoveTask(this);
        return;
    }

    super.onCreate(savedInstanceState);
    mOnCreateTimestampMs = SystemClock.elapsedRealtime();
    mOnCreateTimestampUptimeMs = SystemClock.uptimeMillis();
    mSavedInstanceState = savedInstanceState;

    ChromeBrowserInitializer.getInstance(this).handlePreNativeStartup(this);
}
 
Example 4
Source File: WebappActivity.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void finishNativeInitialization() {
    if (!mWebappInfo.isInitialized()) {
        ApiCompatibilityUtils.finishAndRemoveTask(this);
        return;
    }

    initializeUI(getSavedInstanceState());
    super.finishNativeInitialization();
    mIsInitialized = true;
}
 
Example 5
Source File: WebappActivity.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
protected void onNewIntent(Intent intent) {
    if (intent == null) return;
    super.onNewIntent(intent);

    WebappInfo newWebappInfo = createWebappInfo(intent);
    if (newWebappInfo == null) {
        Log.e(TAG, "Failed to parse new Intent: " + intent);
        ApiCompatibilityUtils.finishAndRemoveTask(this);
    } else if (newWebappInfo.shouldForceNavigation() && mIsInitialized) {
        getActivityTab().loadUrl(new LoadUrlParams(
                newWebappInfo.uri().toString(), PageTransition.AUTO_TOPLEVEL));
    }
}
 
Example 6
Source File: SingleTabModel.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * In webapps, calls finish on the activity, but keeps it in recents. In Document mode,
 * finishes and removes from recents. We use mBlockNewWindows flag to distinguish the user
 * of this model.
 */
private void completeActivity() {
    if (mBlockNewWindows) {
        mActivity.finish();
    } else {
        ApiCompatibilityUtils.finishAndRemoveTask(mActivity);
    }
}
 
Example 7
Source File: UpgradeActivity.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void continueApplicationLaunch() {
    if (mIsDestroyed) return;

    ApiCompatibilityUtils.finishAndRemoveTask(this);
    if (mIntentToFireAfterUpgrade != null && ApplicationStatus.hasVisibleActivities()) {
        startActivity(mIntentToFireAfterUpgrade);
        overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
        mIntentToFireAfterUpgrade = null;
    }
}
 
Example 8
Source File: SingleTabModel.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * In webapps, calls finish on the activity, but keeps it in recents. In Document mode,
 * finishes and removes from recents. We use mBlockNewWindows flag to distinguish the user
 * of this model.
 */
private void completeActivity() {
    if (mBlockNewWindows) {
        mActivity.finish();
    } else {
        ApiCompatibilityUtils.finishAndRemoveTask(mActivity);
    }
}
 
Example 9
Source File: UpgradeActivity.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void continueApplicationLaunch() {
    if (mIsDestroyed) return;

    ApiCompatibilityUtils.finishAndRemoveTask(this);
    if (mIntentToFireAfterUpgrade != null && ApplicationStatus.hasVisibleActivities()) {
        startActivity(mIntentToFireAfterUpgrade);
        overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
        mIntentToFireAfterUpgrade = null;
    }
}
 
Example 10
Source File: SingleTabModel.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * In webapps, calls finish on the activity, but keeps it in recents. In Document mode,
 * finishes and removes from recents. We use mBlockNewWindows flag to distinguish the user
 * of this model.
 */
private void completeActivity() {
    if (mBlockNewWindows) {
        mActivity.finish();
    } else {
        ApiCompatibilityUtils.finishAndRemoveTask(mActivity);
    }
}
 
Example 11
Source File: UpgradeActivity.java    From delion with Apache License 2.0 5 votes vote down vote up
private void continueApplicationLaunch() {
    if (mIsDestroyed) return;

    ApiCompatibilityUtils.finishAndRemoveTask(this);
    if (mIntentToFireAfterUpgrade != null && ApplicationStatus.hasVisibleActivities()) {
        startActivity(mIntentToFireAfterUpgrade);
        overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
        mIntentToFireAfterUpgrade = null;
    }
}
 
Example 12
Source File: SeparateTaskCustomTabActivity.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
protected void handleFinishAndClose() {
    ApiCompatibilityUtils.finishAndRemoveTask(this);
}
 
Example 13
Source File: WebappLauncherActivity.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    launchActivity();
    ApiCompatibilityUtils.finishAndRemoveTask(this);
}
 
Example 14
Source File: AsyncInitializationActivity.java    From 365browser with Apache License 2.0 4 votes vote down vote up
private void abortLaunch() {
    super.onCreate(null);
    ApiCompatibilityUtils.finishAndRemoveTask(this);
}
 
Example 15
Source File: SeparateTaskCustomTabActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public void finishAndClose() {
    ApiCompatibilityUtils.finishAndRemoveTask(this);
}
 
Example 16
Source File: SeparateTaskCustomTabActivity.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
protected void handleFinishAndClose() {
    ApiCompatibilityUtils.finishAndRemoveTask(this);
}
 
Example 17
Source File: WebappLauncherActivity.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    launchActivity();
    ApiCompatibilityUtils.finishAndRemoveTask(this);
}