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