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