1 /* 2 * Copyright (C) 2009 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 android.os; 18 19 import java.util.Map; 20 21 public final class ServiceManager { 22 23 /** 24 * Returns a reference to a service with the given name. 25 * 26 * @param name the name of the service to get 27 * @return a reference to the service, or <code>null</code> if the service doesn't exist 28 */ getService(String name)29 public static IBinder getService(String name) { 30 return null; 31 } 32 33 /** 34 * Place a new @a service called @a name into the service 35 * manager. 36 * 37 * @param name the name of the new service 38 * @param service the service object 39 */ addService(String name, IBinder service)40 public static void addService(String name, IBinder service) { 41 // pass 42 } 43 44 /** 45 * Retrieve an existing service called @a name from the 46 * service manager. Non-blocking. 47 */ checkService(String name)48 public static IBinder checkService(String name) { 49 return null; 50 } 51 52 /** 53 * Return a list of all currently running services. 54 */ listServices()55 public static String[] listServices() throws RemoteException { 56 // actual implementation returns null sometimes, so it's ok 57 // to return null instead of an empty list. 58 return null; 59 } 60 61 /** 62 * This is only intended to be called when the process is first being brought 63 * up and bound by the activity manager. There is only one thread in the process 64 * at that time, so no locking is done. 65 * 66 * @param cache the cache of service references 67 * @hide 68 */ initServiceCache(Map<String, IBinder> cache)69 public static void initServiceCache(Map<String, IBinder> cache) { 70 // pass 71 } 72 } 73