1 /*
2  * Copyright 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 androidx.privacysandbox.ui.core
18 
19 /**
20  * A factory that creates [SessionObserver] instances that can be attached to a
21  * [SandboxedUiAdapter.Session]. Many [SessionObserver]s may be created for the same
22  * [SandboxedUiAdapter.Session].
23  */
24 interface SessionObserverFactory {
25     /**
26      * The set of signals that should be collected for each [SandboxedUiAdapter.Session]. This set
27      * of signals is defined by [SandboxedUiAdapterSignalOptions].
28      *
29      * The set of signals that are supported by the client will be sent in the
30      * [SessionObserverContext] object in [SessionObserver.onSessionOpened].
31      */
32     val signalOptions: Set<String>
33         get() = setOf()
34 
35     /**
36      * Called if a new [SandboxedUiAdapter.Session] has been opened by the [SandboxedUiAdapter] that
37      * this factory is registered to. This will not be called for sessions that are already open.
38      */
createnull39     fun create(): SessionObserver
40 }
41