blob: e880cc8fd10a3699ccbba147a813f4ef8ac17f00 [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
Ned Burnsc7cfa692020-02-12 21:38:50 -050024import androidx.annotation.NonNull;
25
John Spurlockde84f0e2013-06-12 12:41:00 -040026import java.io.FileDescriptor;
27import java.io.PrintWriter;
28
Ned Burnsc7cfa692020-02-12 21:38:50 -050029/**
30 * A top-level module of system UI code (sometimes called "system UI services" elsewhere in code).
31 * Which SystemUI modules are loaded can be controlled via a config resource.
32 *
33 * @see SystemUIApplication#startServicesIfNeeded()
34 */
35public abstract class SystemUI implements Dumpable {
Dave Mankoffa5d8a392019-10-10 12:21:09 -040036 protected final Context mContext;
Joe Onoratof3c3c4f2010-10-21 11:09:02 -040037
Dave Mankoffa5d8a392019-10-10 12:21:09 -040038 public SystemUI(Context context) {
39 mContext = context;
40 }
41
Joe Onoratof3c3c4f2010-10-21 11:09:02 -040042 public abstract void start();
John Spurlock209bede2013-07-17 12:23:27 -040043
Daniel Sandler0ad460b2010-12-14 12:14:53 -050044 protected void onConfigurationChanged(Configuration newConfig) {
45 }
Joe Onoratof3c3c4f2010-10-21 11:09:02 -040046
Ned Burnsc7cfa692020-02-12 21:38:50 -050047 @Override
48 public void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter pw, @NonNull String[] args) {
Joe Onoratof3c3c4f2010-10-21 11:09:02 -040049 }
John Spurlockd08de372013-06-24 13:06:08 -040050
Dan Sandlerdc5f16b2014-04-22 11:51:42 -040051 protected void onBootCompleted() {
52 }
53
Julia Reynolds037d8082018-03-18 15:25:19 -040054 public static void overrideNotificationAppName(Context context, Notification.Builder n,
55 boolean system) {
Adrian Roose25c18d2016-06-17 15:59:49 -070056 final Bundle extras = new Bundle();
Julia Reynolds037d8082018-03-18 15:25:19 -040057 String appName = system
58 ? context.getString(com.android.internal.R.string.notification_app_name_system)
59 : context.getString(com.android.internal.R.string.notification_app_name_settings);
60 extras.putString(Notification.EXTRA_SUBSTITUTE_APP_NAME, appName);
Adrian Roose25c18d2016-06-17 15:59:49 -070061
62 n.addExtras(extras);
63 }
Joe Onoratof3c3c4f2010-10-21 11:09:02 -040064}