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.view.View; 19 20 import com.android.systemui.car.systembar.element.CarSystemBarElementController; 21 import com.android.systemui.car.systembar.element.CarSystemBarElementStateController; 22 import com.android.systemui.car.systembar.element.CarSystemBarElementStatusBarDisableController; 23 import com.android.systemui.car.users.CarSystemUIUserUtil; 24 import com.android.systemui.car.wm.scalableui.EventDispatcher; 25 import com.android.systemui.settings.UserTracker; 26 27 import dagger.assisted.Assisted; 28 import dagger.assisted.AssistedFactory; 29 import dagger.assisted.AssistedInject; 30 31 /** 32 * A CarSystemBarElementController for handling ControlCenter button interactions. 33 */ 34 public class ControlCenterButtonController extends CarSystemBarButtonController { 35 36 @AssistedInject ControlCenterButtonController(@ssisted CarSystemBarButton ccButton, CarSystemBarElementStatusBarDisableController disableController, CarSystemBarElementStateController stateController, UserTracker userTracker, EventDispatcher eventDispatcher, ButtonSelectionStateController buttonSelectionStateController)37 public ControlCenterButtonController(@Assisted CarSystemBarButton ccButton, 38 CarSystemBarElementStatusBarDisableController disableController, 39 CarSystemBarElementStateController stateController, 40 UserTracker userTracker, EventDispatcher eventDispatcher, 41 ButtonSelectionStateController buttonSelectionStateController) { 42 super(ccButton, disableController, stateController, userTracker, eventDispatcher, 43 buttonSelectionStateController); 44 45 ccButton.setVisibility( 46 CarSystemUIUserUtil.isMUMDSystemUI() ? View.VISIBLE : View.GONE); 47 } 48 49 @AssistedFactory 50 public interface Factory extends 51 CarSystemBarElementController.Factory<CarSystemBarButton, 52 ControlCenterButtonController> { 53 } 54 55 @Override shouldBeVisible()56 protected boolean shouldBeVisible() { 57 return CarSystemUIUserUtil.isMUMDSystemUI(); 58 } 59 } 60