blob: 05e5f6b8470ed0131778ff547608d6513506d2c2 [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
Joe Onoratof3c3c4f2010-10-21 11:09:02 -040019import android.app.Service;
Joe Onoratof3c3c4f2010-10-21 11:09:02 -040020import android.content.Intent;
Joe Onoratof3c3c4f2010-10-21 11:09:02 -040021import android.os.IBinder;
John Spurlockb0e49fc2013-06-12 15:50:50 -040022
23import java.io.FileDescriptor;
24import java.io.PrintWriter;
Joe Onoratof3c3c4f2010-10-21 11:09:02 -040025
26public class SystemUIService extends Service {
Joe Onoratof3c3c4f2010-10-21 11:09:02 -040027
Joe Onoratof3c3c4f2010-10-21 11:09:02 -040028 @Override
Jorim Jaggi3beffdf2014-04-03 17:37:37 +020029 public void onCreate() {
30 super.onCreate();
31 ((SystemUIApplication) getApplication()).startServicesIfNeeded();
32 }
33
34 @Override
Joe Onoratof3c3c4f2010-10-21 11:09:02 -040035 public IBinder onBind(Intent intent) {
36 return null;
37 }
38
39 @Override
40 protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
Jorim Jaggicff0acb2014-03-31 16:35:15 +020041 SystemUI[] services = ((SystemUIApplication) getApplication()).getServices();
Joe Onorato10523b4d2010-10-25 10:42:46 -070042 if (args == null || args.length == 0) {
Jorim Jaggicff0acb2014-03-31 16:35:15 +020043 for (SystemUI ui: services) {
Joe Onorato10523b4d2010-10-25 10:42:46 -070044 pw.println("dumping service: " + ui.getClass().getName());
45 ui.dump(fd, pw, args);
46 }
47 } else {
48 String svc = args[0];
Jorim Jaggicff0acb2014-03-31 16:35:15 +020049 for (SystemUI ui: services) {
Joe Onorato10523b4d2010-10-25 10:42:46 -070050 String name = ui.getClass().getName();
51 if (name.endsWith(svc)) {
52 ui.dump(fd, pw, args);
53 }
54 }
Joe Onoratof3c3c4f2010-10-21 11:09:02 -040055 }
56 }
57}
58