blob: 6b30a89d51c0115fd4437f1a16a290f17ec191b1 [file] [log] [blame]
Joe Onoratof3c3c4f2010-10-21 11:09:02 -04001/*
2 * Copyright (C) 2010 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
Adrian Roose25c18d2016-06-17 15:59:49 -070019import android.app.Notification;
Joe Onoratof3c3c4f2010-10-21 11:09:02 -040020import android.content.Context;
Daniel Sandler0ad460b2010-12-14 12:14:53 -050021import android.content.res.Configuration;
Adrian Roose25c18d2016-06-17 15:59:49 -070022import android.os.Bundle;
Joe Onoratof3c3c4f2010-10-21 11:09:02 -040023
John Spurlockde84f0e2013-06-12 12:41:00 -040024import java.io.FileDescriptor;
25import java.io.PrintWriter;
John Spurlockd08de372013-06-24 13:06:08 -040026import java.util.Map;
John Spurlockde84f0e2013-06-12 12:41:00 -040027
Jason Monk49fa0162017-01-11 09:21:56 -050028public abstract class SystemUI implements SysUiServiceProvider {
Joe Onoratof3c3c4f2010-10-21 11:09:02 -040029 public Context mContext;
John Spurlockd08de372013-06-24 13:06:08 -040030 public Map<Class<?>, Object> mComponents;
Joe Onoratof3c3c4f2010-10-21 11:09:02 -040031
32 public abstract void start();
John Spurlock209bede2013-07-17 12:23:27 -040033
Daniel Sandler0ad460b2010-12-14 12:14:53 -050034 protected void onConfigurationChanged(Configuration newConfig) {
35 }
Joe Onoratof3c3c4f2010-10-21 11:09:02 -040036
37 public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
38 }
John Spurlockd08de372013-06-24 13:06:08 -040039
Dan Sandlerdc5f16b2014-04-22 11:51:42 -040040 protected void onBootCompleted() {
41 }
42
John Spurlockd08de372013-06-24 13:06:08 -040043 @SuppressWarnings("unchecked")
44 public <T> T getComponent(Class<T> interfaceType) {
45 return (T) (mComponents != null ? mComponents.get(interfaceType) : null);
46 }
47
48 public <T, C extends T> void putComponent(Class<T> interfaceType, C component) {
49 if (mComponents != null) {
50 mComponents.put(interfaceType, component);
51 }
52 }
Adrian Roose25c18d2016-06-17 15:59:49 -070053
54 public static void overrideNotificationAppName(Context context, Notification.Builder n) {
55 final Bundle extras = new Bundle();
56 extras.putString(Notification.EXTRA_SUBSTITUTE_APP_NAME,
57 context.getString(com.android.internal.R.string.android_system_label));
58
59 n.addExtras(extras);
60 }
Joe Onoratof3c3c4f2010-10-21 11:09:02 -040061}