Brad Stenning | 034a04937 | 2018-06-15 15:29:19 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.android.systemui; |
| 18 | |
| 19 | import android.content.Context; |
Brad Stenning | 034a04937 | 2018-06-15 15:29:19 -0700 | [diff] [blame] | 20 | |
| 21 | import com.android.internal.widget.LockPatternUtils; |
| 22 | import com.android.keyguard.ViewMediatorCallback; |
Brad Stenning | 034a04937 | 2018-06-15 15:29:19 -0700 | [diff] [blame] | 23 | import com.android.systemui.statusbar.car.CarFacetButtonController; |
| 24 | import com.android.systemui.statusbar.car.CarStatusBarKeyguardViewManager; |
Brad Stenning | 034a04937 | 2018-06-15 15:29:19 -0700 | [diff] [blame] | 25 | import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; |
Brad Stenning | 8d1a51c | 2018-11-20 17:34:16 -0800 | [diff] [blame] | 26 | import com.android.systemui.volume.CarVolumeDialogComponent; |
| 27 | import com.android.systemui.volume.VolumeDialogComponent; |
Brad Stenning | 034a04937 | 2018-06-15 15:29:19 -0700 | [diff] [blame] | 28 | |
Jason Monk | 27d01a62 | 2018-12-10 15:57:09 -0500 | [diff] [blame] | 29 | import javax.inject.Singleton; |
| 30 | |
| 31 | import dagger.Component; |
Jason Monk | 27d01a62 | 2018-12-10 15:57:09 -0500 | [diff] [blame] | 32 | |
Brad Stenning | 034a04937 | 2018-06-15 15:29:19 -0700 | [diff] [blame] | 33 | /** |
| 34 | * Class factory to provide car specific SystemUI components. |
| 35 | */ |
| 36 | public class CarSystemUIFactory extends SystemUIFactory { |
| 37 | |
Jason Monk | 27d01a62 | 2018-12-10 15:57:09 -0500 | [diff] [blame] | 38 | private CarDependencyComponent mCarDependencyComponent; |
| 39 | |
| 40 | @Override |
Govinda Wasserman | 8d49d0d | 2019-08-22 16:51:48 -0400 | [diff] [blame] | 41 | protected SystemUIRootComponent buildSystemUIRootComponent(Context context) { |
Jason Monk | 27d01a62 | 2018-12-10 15:57:09 -0500 | [diff] [blame] | 42 | mCarDependencyComponent = DaggerCarSystemUIFactory_CarDependencyComponent.builder() |
| 43 | .contextHolder(new ContextHolder(context)) |
| 44 | .build(); |
Govinda Wasserman | 8d49d0d | 2019-08-22 16:51:48 -0400 | [diff] [blame] | 45 | return DaggerCarSystemUIRootComponent.builder() |
| 46 | .dependencyProvider(new com.android.systemui.DependencyProvider()) |
| 47 | .contextHolder(new ContextHolder(context)) |
| 48 | .build(); |
Jason Monk | 27d01a62 | 2018-12-10 15:57:09 -0500 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | public CarDependencyComponent getCarDependencyComponent() { |
| 52 | return mCarDependencyComponent; |
| 53 | } |
| 54 | |
Brad Stenning | 034a04937 | 2018-06-15 15:29:19 -0700 | [diff] [blame] | 55 | public StatusBarKeyguardViewManager createStatusBarKeyguardViewManager(Context context, |
Adora Zhang | 0237b9c | 2019-03-08 12:27:09 -0800 | [diff] [blame] | 56 | ViewMediatorCallback viewMediatorCallback, LockPatternUtils lockPatternUtils) { |
Brad Stenning | 034a04937 | 2018-06-15 15:29:19 -0700 | [diff] [blame] | 57 | return new CarStatusBarKeyguardViewManager(context, viewMediatorCallback, lockPatternUtils); |
| 58 | } |
| 59 | |
Brad Stenning | 8d1a51c | 2018-11-20 17:34:16 -0800 | [diff] [blame] | 60 | public VolumeDialogComponent createVolumeDialogComponent(SystemUI systemUi, Context context) { |
| 61 | return new CarVolumeDialogComponent(systemUi, context); |
| 62 | } |
| 63 | |
Jason Monk | 27d01a62 | 2018-12-10 15:57:09 -0500 | [diff] [blame] | 64 | @Singleton |
| 65 | @Component(modules = ContextHolder.class) |
| 66 | public interface CarDependencyComponent { |
| 67 | CarFacetButtonController getCarFacetButtonController(); |
Brad Stenning | 034a04937 | 2018-06-15 15:29:19 -0700 | [diff] [blame] | 68 | } |
Brad Stenning | 034a04937 | 2018-06-15 15:29:19 -0700 | [diff] [blame] | 69 | } |