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 */ 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 */ 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 */ 48 public static IBinder checkService(String name) { 49 return null; 50 } 51 52 /** 53 * Return a list of all currently running services. 54 * @return an array of all currently running services, or <code>null</code> in 55 * case of an exception 56 */ 57 public static String[] listServices() { 58 // actual implementation returns null sometimes, so it's ok 59 // to return null instead of an empty list. 60 return null; 61 } 62 63 /** 64 * This is only intended to be called when the process is first being brought 65 * up and bound by the activity manager. There is only one thread in the process 66 * at that time, so no locking is done. 67 * 68 * @param cache the cache of service references 69 * @hide 70 */ 71 public static void initServiceCache(Map<String, IBinder> cache) { 72 // pass 73 } 74 } 75