• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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 
18 package android.window;
19 
20 import android.window.BackMotionEvent;
21 import android.window.IBackAnimationHandoffHandler;
22 
23 /**
24  * Interface that wraps a {@link OnBackInvokedCallback} object, to be stored in window manager
25  * and called from back handling process when back is invoked.
26  *
27  * @hide
28  */
29 oneway interface IOnBackInvokedCallback {
30    /**
31     * Called when a back gesture has been started, or back button has been pressed down.
32     * Wraps {@link OnBackInvokedCallback#onBackStarted(BackEvent)}.
33     *
34     * @param backMotionEvent The {@link BackMotionEvent} containing information about the touch
35     *        or button press.
36     */
onBackStarted(in BackMotionEvent backMotionEvent)37     void onBackStarted(in BackMotionEvent backMotionEvent);
38 
39     /**
40      * Called on back gesture progress.
41      * Wraps {@link OnBackInvokedCallback#onBackProgressed(BackEvent)}.
42      *
43      * @param backMotionEvent The {@link BackMotionEvent} containing information about the latest
44      *                        touch point and the progress that the back animation should seek to.
45      */
onBackProgressed(in BackMotionEvent backMotionEvent)46     void onBackProgressed(in BackMotionEvent backMotionEvent);
47 
48     /**
49      * Called when a back gesture or back button press has been cancelled.
50      * Wraps {@link OnBackInvokedCallback#onBackCancelled()}.
51      */
onBackCancelled()52     void onBackCancelled();
53 
54     /**
55      * Called when a back gesture has been completed and committed, or back button pressed
56      * has been released and committed.
57      * Wraps {@link OnBackInvokedCallback#onBackInvoked()}.
58      */
onBackInvoked()59     void onBackInvoked();
60 
61     /**
62      * Sets whether the back gesture is past the trigger threshold.
63      */
setTriggerBack(in boolean triggerBack)64     void setTriggerBack(in boolean triggerBack);
65 
66    /**
67     * Sets a {@link IBackAnimationHandoffHandler} that can be used to hand off the back animation.
68     */
setHandoffHandler(in IBackAnimationHandoffHandler handoffHandler)69     void setHandoffHandler(in IBackAnimationHandoffHandler handoffHandler);
70 }
71