1 /*
2  * Copyright 2023 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.extensions.area;
18 
19 import android.content.Context;
20 import android.view.View;
21 import android.view.Window;
22 
23 import androidx.window.extensions.RequiresVendorApiLevel;
24 
25 import org.jspecify.annotations.NonNull;
26 
27 /**
28  * An interface representing a container in an extension window area in which app content can be
29  * shown.
30  *
31  * @see WindowAreaComponent#getRearDisplayPresentation()
32  */
33 public interface ExtensionWindowAreaPresentation {
34 
35     /**
36      * Returns the {@link Context} for the window that is being used
37      * to display the additional content provided from the application.
38      */
39     @RequiresVendorApiLevel(level = 3)
getPresentationContext()40     @NonNull Context getPresentationContext();
41 
42     /**
43      * Sets the {@link View} that the application wants to display in the extension window area.
44      */
45     @RequiresVendorApiLevel(level = 3)
setPresentationView(@onNull View view)46     void setPresentationView(@NonNull View view);
47 
48     /**
49      * Returns the {@link Window} for the rear display presentation area.
50      */
51     @RequiresVendorApiLevel(level = 4)
getWindow()52     default @NonNull Window getWindow() {
53         throw new UnsupportedOperationException("This method must not be called unless there is a"
54                 + " corresponding override implementation on the device.");
55     }
56 }
57