• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 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 package com.android.systemui.car.systembar;
17 
18 import android.content.Context;
19 import android.view.InsetsFrameProvider;
20 import android.view.ViewGroup;
21 import android.view.WindowManager;
22 
23 import androidx.annotation.Nullable;
24 
25 import com.android.systemui.car.systembar.CarSystemBarController.SystemBarSide;
26 
27 import java.util.List;
28 
29 /**
30  * Interface for classes that provide system bar configurations.
31  */
32 public interface SystemBarConfigs {
33 
34     /**
35      * Invalidate cached resources and fetch from resources config file.
36      *
37      * <p>
38      * This method should be called when the system bar configurations need to be refreshed,
39      * such as when an RRO (Runtime Resource Overlay) is applied.
40      * </p>
41      */
resetSystemBarConfigs()42     void resetSystemBarConfigs();
43 
44     /**
45      * Invalidates cached window context and creates a new window from application context.
46      *
47      * <p>
48      * This method should be called when the window context configurations are not in sync with
49      * application context configurations.
50      * </p>
51      */
resetSystemBarWindowContext()52     void resetSystemBarWindowContext();
53 
54     /**
55      * When creating system bars or overlay windows, use a WindowContext
56      * for that particular window type to ensure proper display metrics.
57      */
getWindowContextBySide(@ystemBarSide int side)58     Context getWindowContextBySide(@SystemBarSide int side);
59 
60     /**
61      * @return The system bar view for the given side. {@code null} if side is unknown.
62      */
63     @Nullable
getSystemBarLayoutBySide(@ystemBarSide int side, boolean isSetUp)64     ViewGroup getSystemBarLayoutBySide(@SystemBarSide int side, boolean isSetUp);
65 
66     /**
67      * @return the systembar window for the given side. {@code null} if side is unknown.
68      */
69     @Nullable
getWindowLayoutBySide(@ystemBarSide int side)70     ViewGroup getWindowLayoutBySide(@SystemBarSide int side);
71 
72     /**
73      * @return The {@link WindowManager.LayoutParams}, or {@code null} if the side is unknown
74      * or the system bar is not enabled.
75      */
getLayoutParamsBySide(@ystemBarSide int side)76     WindowManager.LayoutParams getLayoutParamsBySide(@SystemBarSide int side);
77 
78     /**
79      * @return {@code true} if the system bar is enabled, {@code false} otherwise.
80      */
getEnabledStatusBySide(@ystemBarSide int side)81     boolean getEnabledStatusBySide(@SystemBarSide int side);
82 
83     /**
84      * @return {@code true} if the system bar should be hidden, {@code false} otherwise.
85      */
getHideForKeyboardBySide(@ystemBarSide int side)86     boolean getHideForKeyboardBySide(@SystemBarSide int side);
87 
88     /**
89      * Applies padding to the given system bar view.
90      *
91      * @param view The system bar view
92      */
insetSystemBar(@ystemBarSide int side, ViewGroup view)93     void insetSystemBar(@SystemBarSide int side, ViewGroup view);
94 
95     /**
96      * @return A list of system bar sides sorted by their Z order.
97      */
getSystemBarSidesByZOrder()98     List<@SystemBarSide Integer> getSystemBarSidesByZOrder();
99 
100     /**
101      * @return one of the following values, or {@code -1} if the side is unknown
102      * STATUS_BAR = 0
103      * NAVIGATION_BAR = 1
104      * STATUS_BAR_EXTRA = 2
105      * NAVIGATION_BAR_EXTRA = 3
106      */
getSystemBarInsetTypeBySide(@ystemBarSide int side)107     int getSystemBarInsetTypeBySide(@SystemBarSide int side);
108 
109     /**
110      * @param index must be one of the following values
111      *              STATUS_BAR = 0
112      *              NAVIGATION_BAR = 1
113      *              STATUS_BAR_EXTRA = 2
114      *              NAVIGATION_BAR_EXTRA = 3
115      *              see {@link #getSystemBarInsetTypeBySide(int)}
116      * @return The {@link InsetsFrameProvider}, or {@code null} if the side is unknown
117      */
getInsetsFrameProvider(int index)118     InsetsFrameProvider getInsetsFrameProvider(int index);
119 
120     /**
121      * @return whether the left toolbar is used for display compat.
122      */
isLeftDisplayCompatToolbarEnabled()123     boolean isLeftDisplayCompatToolbarEnabled();
124 
125     /**
126      * @return whether the right toolbar is used for display compat.
127      */
isRightDisplayCompatToolbarEnabled()128     boolean isRightDisplayCompatToolbarEnabled();
129 }
130