1 /*
2  * Copyright (C) 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.util.DisplayMetrics;
20 
21 import androidx.annotation.NonNull;
22 
23 /**
24  * Class that provides information around the current status of a window area feature. Contains
25  * the current {@link WindowAreaComponent.WindowAreaStatus} value corresponding to the
26  * rear display presentation feature, as well as the {@link DisplayMetrics} for the rear facing
27  * display.
28  */
29 class RearDisplayPresentationStatus implements ExtensionWindowAreaStatus {
30 
31     @WindowAreaComponent.WindowAreaStatus
32     private final int mWindowAreaStatus;
33 
34     @NonNull
35     private final DisplayMetrics mDisplayMetrics;
36 
RearDisplayPresentationStatus(@indowAreaComponent.WindowAreaStatus int status, @NonNull DisplayMetrics displayMetrics)37     RearDisplayPresentationStatus(@WindowAreaComponent.WindowAreaStatus int status,
38             @NonNull DisplayMetrics displayMetrics) {
39         mWindowAreaStatus = status;
40         mDisplayMetrics = displayMetrics;
41     }
42 
43     /**
44      * Returns the {@link androidx.window.extensions.area.WindowAreaComponent.WindowAreaStatus}
45      * value that relates to the current status of a feature.
46      */
47     @Override
48     @WindowAreaComponent.WindowAreaStatus
getWindowAreaStatus()49     public int getWindowAreaStatus() {
50         return mWindowAreaStatus;
51     }
52 
53     /**
54      * Returns the {@link DisplayMetrics} that corresponds to the window area that a feature
55      * interacts with. This is converted to size class information provided to developers.
56      */
57     @Override
58     @NonNull
getWindowAreaDisplayMetrics()59     public DisplayMetrics getWindowAreaDisplayMetrics() {
60         return mDisplayMetrics;
61     }
62 }
63