17953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet/* 27953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * Copyright (C) 2009 The Android Open Source Project 37953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * 47953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * Licensed under the Apache License, Version 2.0 (the "License"); 57953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * you may not use this file except in compliance with the License. 67953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * You may obtain a copy of the License at 77953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * 87953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * http://www.apache.org/licenses/LICENSE-2.0 97953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * 107953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * Unless required by applicable law or agreed to in writing, software 117953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * distributed under the License is distributed on an "AS IS" BASIS, 127953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 137953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * See the License for the specific language governing permissions and 147953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * limitations under the License. 157953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet */ 167953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet 177953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohetpackage android.os; 187953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet 197953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohetimport java.util.Map; 207953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet 217953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohetpublic final class ServiceManager { 227953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet 237953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet /** 247953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * Returns a reference to a service with the given name. 257953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * 267953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * @param name the name of the service to get 277953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * @return a reference to the service, or <code>null</code> if the service doesn't exist 287953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet */ 297953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet public static IBinder getService(String name) { 307953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet return null; 317953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet } 327953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet 337953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet /** 347953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * Place a new @a service called @a name into the service 357953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * manager. 367953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * 377953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * @param name the name of the new service 387953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * @param service the service object 397953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet */ 407953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet public static void addService(String name, IBinder service) { 417953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet // pass 427953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet } 437953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet 447953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet /** 457953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * Retrieve an existing service called @a name from the 467953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * service manager. Non-blocking. 477953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet */ 487953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet public static IBinder checkService(String name) { 497953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet return null; 507953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet } 517953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet 527953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet /** 537953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * Return a list of all currently running services. 547953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet */ 557953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet public static String[] listServices() throws RemoteException { 5608e2a4b56f23ce02f17300438f76ccc1f663f183Xavier Ducrohet // actual implementation returns null sometimes, so it's ok 5708e2a4b56f23ce02f17300438f76ccc1f663f183Xavier Ducrohet // to return null instead of an empty list. 587953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet return null; 597953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet } 607953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet 617953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet /** 627953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * This is only intended to be called when the process is first being brought 637953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * up and bound by the activity manager. There is only one thread in the process 647953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * at that time, so no locking is done. 657953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * 667953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * @param cache the cache of service references 677953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet * @hide 687953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet */ 697953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet public static void initServiceCache(Map<String, IBinder> cache) { 707953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet // pass 717953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet } 727953e7d89b1d4d7297176fbb6aeea882577df8e6Xavier Ducrohet} 73