1 /*
2  * Copyright 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 package androidx.window.area
18 
19 import androidx.window.core.ExperimentalWindowApi
20 
21 /**
22  * Callback to update the client on the WindowArea Session being started and ended.
23  *
24  * TODO(b/207720511) Move to window-java module when Kotlin API Finalized
25  */
26 @ExperimentalWindowApi
27 interface WindowAreaSessionCallback {
28 
29     /**
30      * Notifies about a start of a session. Provides a reference to the current [WindowAreaSession]
31      * the application the ability to close the session through [WindowAreaSession.close].
32      */
onSessionStartednull33     fun onSessionStarted(session: WindowAreaSession)
34 
35     /**
36      * Notifies about an end of a [WindowAreaSession].
37      *
38      * @param t [Throwable] to provide information on if the session was ended due to an error. This
39      *   will only occur if a session is attempted to be enabled when it is not available, but can
40      *   be expanded to alert for more errors in the future.
41      */
42     fun onSessionEnded(t: Throwable?)
43 }
44