• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.window;
18 
19 import android.annotation.IntDef;
20 
21 import java.lang.annotation.Retention;
22 import java.lang.annotation.RetentionPolicy;
23 
24 /**
25  * Non-default ahead-of-time system OnBackInvokedCallback.
26  * @hide
27  */
28 public interface SystemOverrideOnBackInvokedCallback extends OnBackInvokedCallback {
29     /**
30      * No override request
31      */
32     int OVERRIDE_UNDEFINED = 0;
33 
34     /**
35      * Navigating back will bring the task to back
36      */
37     int OVERRIDE_MOVE_TASK_TO_BACK = 1;
38 
39     /**
40      * Navigating back will finish activity, and remove the task if this activity is root activity.
41      */
42     int OVERRIDE_FINISH_AND_REMOVE_TASK = 2;
43 
44     /** @hide */
45     @IntDef({
46             OVERRIDE_UNDEFINED,
47             OVERRIDE_MOVE_TASK_TO_BACK,
48             OVERRIDE_FINISH_AND_REMOVE_TASK,
49     })
50     @Retention(RetentionPolicy.SOURCE)
51     @interface OverrideBehavior {
52     }
53 
54     /**
55      * @return Override type of this callback.
56      */
57     @OverrideBehavior
overrideBehavior()58     default int overrideBehavior() {
59         return OVERRIDE_UNDEFINED;
60     }
61 }
62