1 /* 2 * Copyright (C) 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 package com.android.systemui.car.systembar; 17 18 import android.annotation.IntDef; 19 import android.os.Bundle; 20 import android.view.View; 21 import android.view.ViewGroup; 22 23 import java.lang.annotation.ElementType; 24 import java.lang.annotation.Target; 25 import java.util.Set; 26 27 /** 28 * A controller for initializing the system bar views. 29 */ 30 public interface CarSystemBarViewController { 31 @IntDef(value = {BUTTON_TYPE_NAVIGATION, BUTTON_TYPE_KEYGUARD, BUTTON_TYPE_OCCLUSION}) 32 @Target({ElementType.TYPE_PARAMETER, ElementType.TYPE_USE}) 33 @interface ButtonsType { 34 } 35 int BUTTON_TYPE_NAVIGATION = 0; 36 int BUTTON_TYPE_KEYGUARD = 1; 37 int BUTTON_TYPE_OCCLUSION = 2; 38 39 /** 40 * Call to initialize the internal state. 41 */ init()42 void init(); 43 44 /** 45 * Call to save the internal state. 46 */ onSaveInstanceState(Bundle outState)47 void onSaveInstanceState(Bundle outState); 48 49 /** 50 * Call to restore the internal state. 51 */ onRestoreInstanceState(Bundle savedInstanceState)52 void onRestoreInstanceState(Bundle savedInstanceState); 53 54 /** 55 * Only visible so that this view can be attached to the window. 56 */ getView()57 ViewGroup getView(); 58 59 /** 60 * Sets the touch listeners that will be called from onInterceptTouchEvent and onTouchEvent 61 * 62 * @param statusBarWindowTouchListeners List of listeners to call from touch and intercept touch 63 */ setSystemBarTouchListeners(Set<View.OnTouchListener> statusBarWindowTouchListeners)64 void setSystemBarTouchListeners(Set<View.OnTouchListener> statusBarWindowTouchListeners); 65 66 /** 67 * Shows buttons of the specified {@link ButtonsType}. 68 * 69 * NOTE: Only one type of buttons can be shown at a time, so showing buttons of one type will 70 * hide all buttons of other types. 71 * 72 * @param buttonsType see {@link ButtonsType} 73 */ showButtonsOfType(@uttonsType int buttonsType)74 void showButtonsOfType(@ButtonsType int buttonsType); 75 } 76