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 | |
| 19 | import android.content.Context; |
| 20 | import android.util.Log; |
Xiaohui Chen | 5da7135 | 2016-02-22 10:04:41 -0800 | [diff] [blame] | 21 | import android.view.View; |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 22 | import android.view.ViewGroup; |
| 23 | |
| 24 | import com.android.internal.widget.LockPatternUtils; |
| 25 | import com.android.keyguard.ViewMediatorCallback; |
Muyuan Li | 94ce94e | 2016-02-24 16:20:54 -0800 | [diff] [blame] | 26 | import com.android.systemui.shortcut.ShortcutKeyDispatcher; |
Xiaohui Chen | 5da7135 | 2016-02-22 10:04:41 -0800 | [diff] [blame] | 27 | import com.android.systemui.statusbar.ScrimView; |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 28 | import com.android.systemui.statusbar.phone.KeyguardBouncer; |
Xiaohui Chen | 5da7135 | 2016-02-22 10:04:41 -0800 | [diff] [blame] | 29 | import com.android.systemui.statusbar.phone.ScrimController; |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 30 | import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; |
| 31 | import com.android.systemui.statusbar.phone.StatusBarWindowManager; |
| 32 | |
| 33 | /** |
| 34 | * Class factory to provide customizable SystemUI components. |
| 35 | */ |
| 36 | public class SystemUIFactory { |
| 37 | private static final String TAG = "SystemUIFactory"; |
| 38 | |
| 39 | static SystemUIFactory mFactory; |
| 40 | |
| 41 | public static SystemUIFactory getInstance() { |
| 42 | return mFactory; |
| 43 | } |
| 44 | |
| 45 | public static void createFromConfig(Context context) { |
| 46 | final String clsName = context.getString(R.string.config_systemUIFactoryComponent); |
| 47 | if (clsName == null || clsName.length() == 0) { |
| 48 | throw new RuntimeException("No SystemUIFactory component configured"); |
| 49 | } |
| 50 | |
| 51 | try { |
| 52 | Class<?> cls = null; |
| 53 | cls = context.getClassLoader().loadClass(clsName); |
| 54 | mFactory = (SystemUIFactory) cls.newInstance(); |
| 55 | } catch (Throwable t) { |
| 56 | Log.w(TAG, "Error creating SystemUIFactory component: " + clsName, t); |
| 57 | throw new RuntimeException(t); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | public SystemUIFactory() {} |
| 62 | |
| 63 | public StatusBarKeyguardViewManager createStatusBarKeyguardViewManager(Context context, |
| 64 | ViewMediatorCallback viewMediatorCallback, LockPatternUtils lockPatternUtils) { |
| 65 | return new StatusBarKeyguardViewManager(context, viewMediatorCallback, lockPatternUtils); |
| 66 | } |
| 67 | |
| 68 | public KeyguardBouncer createKeyguardBouncer(Context context, ViewMediatorCallback callback, |
| 69 | LockPatternUtils lockPatternUtils, StatusBarWindowManager windowManager, |
| 70 | ViewGroup container) { |
| 71 | return new KeyguardBouncer(context, callback, lockPatternUtils, windowManager, container); |
| 72 | } |
Xiaohui Chen | 5da7135 | 2016-02-22 10:04:41 -0800 | [diff] [blame] | 73 | |
| 74 | public ScrimController createScrimController(ScrimView scrimBehind, ScrimView scrimInFront, |
| 75 | View headsUpScrim, boolean scrimSrcEnabled) { |
| 76 | return new ScrimController(scrimBehind, scrimInFront, headsUpScrim, scrimSrcEnabled); |
| 77 | } |
Muyuan Li | 94ce94e | 2016-02-24 16:20:54 -0800 | [diff] [blame] | 78 | |
| 79 | public <T> T createInstance(Class<T> classType) { |
| 80 | return null; |
| 81 | } |
Xiyuan Xia | 1b30f79 | 2016-01-06 08:50:30 -0800 | [diff] [blame] | 82 | } |