Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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 | |
Yao Chen | 634acb9 | 2016-04-13 16:17:47 -0700 | [diff] [blame] | 19 | import android.content.ComponentName; |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 20 | import android.content.Context; |
Jason Monk | 9c7844c | 2017-01-18 15:21:53 -0500 | [diff] [blame] | 21 | import android.util.ArrayMap; |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 22 | import android.util.Log; |
Xiaohui Chen | 5da7135 | 2016-02-22 10:04:41 -0800 | [diff] [blame] | 23 | import android.view.View; |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 24 | import android.view.ViewGroup; |
| 25 | |
| 26 | import com.android.internal.widget.LockPatternUtils; |
| 27 | import com.android.keyguard.ViewMediatorCallback; |
Jason Monk | 9c7844c | 2017-01-18 15:21:53 -0500 | [diff] [blame] | 28 | import com.android.systemui.Dependency.DependencyProvider; |
Annie Chin | 1ea4935 | 2016-05-27 15:23:35 -0700 | [diff] [blame] | 29 | import com.android.systemui.R; |
Annie Chin | 937a991 | 2016-05-31 10:14:23 -0700 | [diff] [blame] | 30 | import com.android.systemui.assist.AssistManager; |
Jorim Jaggi | 241ae10 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 31 | import com.android.systemui.keyguard.DismissCallbackRegistry; |
Annie Chin | 937a991 | 2016-05-31 10:14:23 -0700 | [diff] [blame] | 32 | import com.android.systemui.statusbar.BaseStatusBar; |
Zachary Iqbal | f50284c | 2017-01-22 18:54:46 -0800 | [diff] [blame^] | 33 | import com.android.systemui.statusbar.KeyguardIndicationController; |
Xiaohui Chen | 5da7135 | 2016-02-22 10:04:41 -0800 | [diff] [blame] | 34 | import com.android.systemui.statusbar.ScrimView; |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 35 | import com.android.systemui.statusbar.phone.KeyguardBouncer; |
Jorim Jaggi | 40db029 | 2016-06-27 17:58:03 -0700 | [diff] [blame] | 36 | import com.android.systemui.statusbar.phone.LightBarController; |
Zachary Iqbal | f50284c | 2017-01-22 18:54:46 -0800 | [diff] [blame^] | 37 | import com.android.systemui.statusbar.phone.LockIcon; |
Jorim Jaggi | e31f6b8 | 2016-07-01 16:15:09 -0700 | [diff] [blame] | 38 | import com.android.systemui.statusbar.phone.LockscreenWallpaper; |
Xiaohui Chen | eb04a99 | 2016-03-22 14:58:03 -0700 | [diff] [blame] | 39 | import com.android.systemui.statusbar.phone.NotificationIconAreaController; |
| 40 | import com.android.systemui.statusbar.phone.PhoneStatusBar; |
Xiaohui Chen | 311b98e | 2016-03-30 11:55:54 -0700 | [diff] [blame] | 41 | import com.android.systemui.statusbar.phone.QSTileHost; |
Xiaohui Chen | 5da7135 | 2016-02-22 10:04:41 -0800 | [diff] [blame] | 42 | import com.android.systemui.statusbar.phone.ScrimController; |
Xiaohui Chen | 311b98e | 2016-03-30 11:55:54 -0700 | [diff] [blame] | 43 | import com.android.systemui.statusbar.phone.StatusBarIconController; |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 44 | import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; |
| 45 | import com.android.systemui.statusbar.phone.StatusBarWindowManager; |
Xiaohui Chen | 311b98e | 2016-03-30 11:55:54 -0700 | [diff] [blame] | 46 | import com.android.systemui.statusbar.policy.BatteryController; |
| 47 | import com.android.systemui.statusbar.policy.BluetoothController; |
| 48 | import com.android.systemui.statusbar.policy.CastController; |
| 49 | import com.android.systemui.statusbar.policy.FlashlightController; |
| 50 | import com.android.systemui.statusbar.policy.HotspotController; |
| 51 | import com.android.systemui.statusbar.policy.KeyguardMonitor; |
| 52 | import com.android.systemui.statusbar.policy.LocationController; |
| 53 | import com.android.systemui.statusbar.policy.NetworkController; |
| 54 | import com.android.systemui.statusbar.policy.NextAlarmController; |
| 55 | import com.android.systemui.statusbar.policy.RotationLockController; |
| 56 | import com.android.systemui.statusbar.policy.SecurityController; |
| 57 | import com.android.systemui.statusbar.policy.UserInfoController; |
| 58 | import com.android.systemui.statusbar.policy.UserSwitcherController; |
| 59 | import com.android.systemui.statusbar.policy.ZenModeController; |
Yao Chen | 634acb9 | 2016-04-13 16:17:47 -0700 | [diff] [blame] | 60 | import com.android.systemui.volume.VolumeDialogController; |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 61 | |
| 62 | /** |
| 63 | * Class factory to provide customizable SystemUI components. |
| 64 | */ |
| 65 | public class SystemUIFactory { |
| 66 | private static final String TAG = "SystemUIFactory"; |
| 67 | |
| 68 | static SystemUIFactory mFactory; |
| 69 | |
| 70 | public static SystemUIFactory getInstance() { |
| 71 | return mFactory; |
| 72 | } |
| 73 | |
| 74 | public static void createFromConfig(Context context) { |
| 75 | final String clsName = context.getString(R.string.config_systemUIFactoryComponent); |
| 76 | if (clsName == null || clsName.length() == 0) { |
| 77 | throw new RuntimeException("No SystemUIFactory component configured"); |
| 78 | } |
| 79 | |
| 80 | try { |
| 81 | Class<?> cls = null; |
| 82 | cls = context.getClassLoader().loadClass(clsName); |
| 83 | mFactory = (SystemUIFactory) cls.newInstance(); |
| 84 | } catch (Throwable t) { |
| 85 | Log.w(TAG, "Error creating SystemUIFactory component: " + clsName, t); |
| 86 | throw new RuntimeException(t); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | public SystemUIFactory() {} |
| 91 | |
| 92 | public StatusBarKeyguardViewManager createStatusBarKeyguardViewManager(Context context, |
| 93 | ViewMediatorCallback viewMediatorCallback, LockPatternUtils lockPatternUtils) { |
| 94 | return new StatusBarKeyguardViewManager(context, viewMediatorCallback, lockPatternUtils); |
| 95 | } |
| 96 | |
| 97 | public KeyguardBouncer createKeyguardBouncer(Context context, ViewMediatorCallback callback, |
Jorim Jaggi | 241ae10 | 2016-11-02 21:57:33 -0700 | [diff] [blame] | 98 | LockPatternUtils lockPatternUtils, |
| 99 | ViewGroup container, DismissCallbackRegistry dismissCallbackRegistry) { |
| 100 | return new KeyguardBouncer(context, callback, lockPatternUtils, container, |
| 101 | dismissCallbackRegistry); |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 102 | } |
Xiaohui Chen | 5da7135 | 2016-02-22 10:04:41 -0800 | [diff] [blame] | 103 | |
Jorim Jaggi | 40db029 | 2016-06-27 17:58:03 -0700 | [diff] [blame] | 104 | public ScrimController createScrimController(LightBarController lightBarController, |
| 105 | ScrimView scrimBehind, ScrimView scrimInFront, View headsUpScrim, |
| 106 | LockscreenWallpaper lockscreenWallpaper) { |
| 107 | return new ScrimController(lightBarController, scrimBehind, scrimInFront, headsUpScrim); |
Xiaohui Chen | 5da7135 | 2016-02-22 10:04:41 -0800 | [diff] [blame] | 108 | } |
Muyuan Li | 94ce94e | 2016-02-24 16:20:54 -0800 | [diff] [blame] | 109 | |
Yao Chen | 634acb9 | 2016-04-13 16:17:47 -0700 | [diff] [blame] | 110 | public VolumeDialogController createVolumeDialogController(Context context, |
| 111 | ComponentName name) { |
| 112 | return new VolumeDialogController(context, name); |
| 113 | } |
| 114 | |
Xiaohui Chen | eb04a99 | 2016-03-22 14:58:03 -0700 | [diff] [blame] | 115 | public NotificationIconAreaController createNotificationIconAreaController(Context context, |
| 116 | PhoneStatusBar phoneStatusBar) { |
| 117 | return new NotificationIconAreaController(context, phoneStatusBar); |
| 118 | } |
| 119 | |
Zachary Iqbal | f50284c | 2017-01-22 18:54:46 -0800 | [diff] [blame^] | 120 | public KeyguardIndicationController createKeyguardIndicationController(Context context, |
| 121 | ViewGroup indicationArea, LockIcon lockIcon) { |
| 122 | return new KeyguardIndicationController(context, indicationArea, lockIcon); |
| 123 | } |
| 124 | |
Xiaohui Chen | 311b98e | 2016-03-30 11:55:54 -0700 | [diff] [blame] | 125 | public QSTileHost createQSTileHost(Context context, PhoneStatusBar statusBar, |
Jason Monk | 9c7844c | 2017-01-18 15:21:53 -0500 | [diff] [blame] | 126 | StatusBarIconController iconController) { |
| 127 | return new QSTileHost(context, statusBar, iconController); |
Xiaohui Chen | 311b98e | 2016-03-30 11:55:54 -0700 | [diff] [blame] | 128 | } |
| 129 | |
Muyuan Li | 94ce94e | 2016-02-24 16:20:54 -0800 | [diff] [blame] | 130 | public <T> T createInstance(Class<T> classType) { |
| 131 | return null; |
| 132 | } |
Annie Chin | 1ea4935 | 2016-05-27 15:23:35 -0700 | [diff] [blame] | 133 | |
Jason Monk | 9c7844c | 2017-01-18 15:21:53 -0500 | [diff] [blame] | 134 | public void injectDependencies(ArrayMap<String, DependencyProvider> providers, |
| 135 | Context context) { } |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 136 | } |