blob: 3b278b40acea3a9ffadc1f6914b317caf9c38ad5 [file] [log] [blame]
Brad Stenning034a049372018-06-15 15:29:19 -07001/*
2 * Copyright (C) 2018 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
17package com.android.systemui;
18
19import android.content.Context;
Brad Stenning034a049372018-06-15 15:29:19 -070020
21import com.android.internal.widget.LockPatternUtils;
22import com.android.keyguard.ViewMediatorCallback;
Adora Zhang0237b9c2019-03-08 12:27:09 -080023import com.android.systemui.car.CarNotificationEntryManager;
Gus Prevasec9e1f02018-12-18 15:28:12 -050024import com.android.systemui.car.CarNotificationInterruptionStateProvider;
Brad Stenning034a049372018-06-15 15:29:19 -070025import com.android.systemui.statusbar.car.CarFacetButtonController;
26import com.android.systemui.statusbar.car.CarStatusBarKeyguardViewManager;
Adora Zhang0237b9c2019-03-08 12:27:09 -080027import com.android.systemui.statusbar.notification.NotificationEntryManager;
Gus Prevasec9e1f02018-12-18 15:28:12 -050028import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider;
Brad Stenning034a049372018-06-15 15:29:19 -070029import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
Brad Stenning8d1a51c2018-11-20 17:34:16 -080030import com.android.systemui.volume.CarVolumeDialogComponent;
31import com.android.systemui.volume.VolumeDialogComponent;
Brad Stenning034a049372018-06-15 15:29:19 -070032
Jason Monk27d01a622018-12-10 15:57:09 -050033import javax.inject.Singleton;
34
35import dagger.Component;
36import dagger.Module;
37import dagger.Provides;
38
Brad Stenning034a049372018-06-15 15:29:19 -070039/**
40 * Class factory to provide car specific SystemUI components.
41 */
42public class CarSystemUIFactory extends SystemUIFactory {
43
Jason Monk27d01a622018-12-10 15:57:09 -050044 private CarDependencyComponent mCarDependencyComponent;
45
46 @Override
47 protected void init(Context context) {
48 super.init(context);
49 mCarDependencyComponent = DaggerCarSystemUIFactory_CarDependencyComponent.builder()
50 .contextHolder(new ContextHolder(context))
51 .build();
52 }
53
54 public CarDependencyComponent getCarDependencyComponent() {
55 return mCarDependencyComponent;
56 }
57
Brad Stenning034a049372018-06-15 15:29:19 -070058 public StatusBarKeyguardViewManager createStatusBarKeyguardViewManager(Context context,
Adora Zhang0237b9c2019-03-08 12:27:09 -080059 ViewMediatorCallback viewMediatorCallback, LockPatternUtils lockPatternUtils) {
Brad Stenning034a049372018-06-15 15:29:19 -070060 return new CarStatusBarKeyguardViewManager(context, viewMediatorCallback, lockPatternUtils);
61 }
62
Brad Stenning8d1a51c2018-11-20 17:34:16 -080063 public VolumeDialogComponent createVolumeDialogComponent(SystemUI systemUi, Context context) {
64 return new CarVolumeDialogComponent(systemUi, context);
65 }
66
Brad Stenning034a049372018-06-15 15:29:19 -070067 @Override
Gus Prevasec9e1f02018-12-18 15:28:12 -050068 public NotificationInterruptionStateProvider provideNotificationInterruptionStateProvider(
69 Context context) {
70 return new CarNotificationInterruptionStateProvider(context);
71 }
72
Gus Prevas59ec2ff2018-12-28 16:20:28 -050073 @Override
74 public boolean provideAllowNotificationLongPress() {
75 return false;
76 }
77
Jason Monk27d01a622018-12-10 15:57:09 -050078 @Module
79 protected static class ContextHolder {
80 private Context mContext;
81
82 public ContextHolder(Context context) {
83 mContext = context;
84 }
85
86 @Provides
87 public Context provideContext() {
88 return mContext;
89 }
90 }
91
92 @Singleton
93 @Component(modules = ContextHolder.class)
94 public interface CarDependencyComponent {
95 CarFacetButtonController getCarFacetButtonController();
Brad Stenning034a049372018-06-15 15:29:19 -070096 }
Adora Zhang0237b9c2019-03-08 12:27:09 -080097
98 /**
99 * Use {@link CarNotificationEntryManager}, which does nothing when adding a notification.
100 */
101 @Singleton
102 public NotificationEntryManager provideNotificationEntryManager(Context context) {
103 return new CarNotificationEntryManager(context);
104 }
Brad Stenning034a049372018-06-15 15:29:19 -0700105}