1f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato/* 2f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato * Copyright (C) 2010 The Android Open Source Project 3f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato * 4f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato * Licensed under the Apache License, Version 2.0 (the "License"); 5f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato * you may not use this file except in compliance with the License. 6f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato * You may obtain a copy of the License at 7f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato * 8f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato * http://www.apache.org/licenses/LICENSE-2.0 9f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato * 10f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato * Unless required by applicable law or agreed to in writing, software 11f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato * distributed under the License is distributed on an "AS IS" BASIS, 12f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato * See the License for the specific language governing permissions and 14f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato * limitations under the License. 15f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato */ 16f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato 17f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onoratopackage com.android.systemui; 18f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato 19f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onoratoimport android.app.Service; 20f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onoratoimport android.content.Intent; 21f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onoratoimport android.os.IBinder; 22b0e49fc93c146d7ddc8e1f27ec67306a71168510John Spurlock 23b0e49fc93c146d7ddc8e1f27ec67306a71168510John Spurlockimport java.io.FileDescriptor; 24b0e49fc93c146d7ddc8e1f27ec67306a71168510John Spurlockimport java.io.PrintWriter; 25f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato 26f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onoratopublic class SystemUIService extends Service { 27f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato 28f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato @Override 293beffdf4a0081a97356f46d50e10541b1a213153Jorim Jaggi public void onCreate() { 303beffdf4a0081a97356f46d50e10541b1a213153Jorim Jaggi super.onCreate(); 313beffdf4a0081a97356f46d50e10541b1a213153Jorim Jaggi ((SystemUIApplication) getApplication()).startServicesIfNeeded(); 323beffdf4a0081a97356f46d50e10541b1a213153Jorim Jaggi } 333beffdf4a0081a97356f46d50e10541b1a213153Jorim Jaggi 343beffdf4a0081a97356f46d50e10541b1a213153Jorim Jaggi @Override 35f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato public IBinder onBind(Intent intent) { 36f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato return null; 37f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato } 38f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato 39f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato @Override 40f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { 41cff0acb6b1eea23c3f44a078a0a5e81c11faea35Jorim Jaggi SystemUI[] services = ((SystemUIApplication) getApplication()).getServices(); 4210523b4d0c99cec86647130426d470a1e02a44f6Joe Onorato if (args == null || args.length == 0) { 43cff0acb6b1eea23c3f44a078a0a5e81c11faea35Jorim Jaggi for (SystemUI ui: services) { 4410523b4d0c99cec86647130426d470a1e02a44f6Joe Onorato pw.println("dumping service: " + ui.getClass().getName()); 4510523b4d0c99cec86647130426d470a1e02a44f6Joe Onorato ui.dump(fd, pw, args); 4610523b4d0c99cec86647130426d470a1e02a44f6Joe Onorato } 4710523b4d0c99cec86647130426d470a1e02a44f6Joe Onorato } else { 4810523b4d0c99cec86647130426d470a1e02a44f6Joe Onorato String svc = args[0]; 49cff0acb6b1eea23c3f44a078a0a5e81c11faea35Jorim Jaggi for (SystemUI ui: services) { 5010523b4d0c99cec86647130426d470a1e02a44f6Joe Onorato String name = ui.getClass().getName(); 5110523b4d0c99cec86647130426d470a1e02a44f6Joe Onorato if (name.endsWith(svc)) { 5210523b4d0c99cec86647130426d470a1e02a44f6Joe Onorato ui.dump(fd, pw, args); 5310523b4d0c99cec86647130426d470a1e02a44f6Joe Onorato } 5410523b4d0c99cec86647130426d470a1e02a44f6Joe Onorato } 55f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato } 56f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato } 57f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato} 58f3c3c4fd14cb4185ec6df5a4355aab8b9f4039dcJoe Onorato 59