Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c055f178 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Update docs for onBackPressed" into sc-dev am: 1e40e406

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14908762

Change-Id: Icdabc49d75823d5be4ef42ad2f84fc79b3f5e2a2
parents d3438e52 1e40e406
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -3866,9 +3866,26 @@ public class Activity extends ContextThemeWrapper
    }

    /**
     * Called when the activity has detected the user's press of the back
     * key.  The default implementation simply finishes the current activity,
     * but you can override this to do whatever you want.
     * Called when the activity has detected the user's press of the back key. The default
     * implementation depends on the platform version:
     *
     * <ul>
     *     <li>On platform versions prior to {@link android.os.Build.VERSION_CODES#S}, it
     *         finishes the current activity, but you can override this to do whatever you want.
     *
     *     <li><p>Starting with platform version {@link android.os.Build.VERSION_CODES#S}, for
     *         activities that are the root activity of the task and also declare an
     *         {@link android.content.IntentFilter} with {@link Intent#ACTION_MAIN} and
     *         {@link Intent#CATEGORY_LAUNCHER} in the manifest, the current activity and its
     *         task will be moved to the back of the activity stack instead of being finished.
     *         Other activities will simply be finished.
     *
     *         <p>If you target version {@link android.os.Build.VERSION_CODES#S} or later and
     *         override this method, it is strongly recommended to call through to the superclass
     *         implementation after you finish handling navigation within the app.
     * </ul>
     *
     * @see #moveTaskToBack(boolean)
     */
    public void onBackPressed() {
        if (mActionBar != null && mActionBar.collapseActionView()) {