1 /*
2  * Copyright (C) 2006 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 /**
20  * Basic interface for finding and publishing system services.
21  *
22  * An implementation of this interface is usually published as the
23  * global context object, which can be retrieved via
24  * BinderNative.getContextObject().  An easy way to retrieve this
25  * is with the static method BnServiceManager.getDefault().
26  *
27  * @hide
28  */
29 public interface IServiceManager extends IInterface
30 {
31     /**
32      * Retrieve an existing service called @a name from the
33      * service manager.  Blocks for a few seconds waiting for it to be
34      * published if it does not already exist.
35      */
getService(String name)36     public IBinder getService(String name) throws RemoteException;
37 
38     /**
39      * Retrieve an existing service called @a name from the
40      * service manager.  Non-blocking.
41      */
checkService(String name)42     public IBinder checkService(String name) throws RemoteException;
43 
44     /**
45      * Place a new @a service called @a name into the service
46      * manager.
47      */
addService(String name, IBinder service, boolean allowIsolated)48     public void addService(String name, IBinder service, boolean allowIsolated)
49                 throws RemoteException;
50 
51     /**
52      * Return a list of all currently running services.
53      */
listServices()54     public String[] listServices() throws RemoteException;
55 
56     /**
57      * Assign a permission controller to the service manager.  After set, this
58      * interface is checked before any services are added.
59      */
setPermissionController(IPermissionController controller)60     public void setPermissionController(IPermissionController controller)
61             throws RemoteException;
62 
63     static final String descriptor = "android.os.IServiceManager";
64 
65     int GET_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION;
66     int CHECK_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+1;
67     int ADD_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+2;
68     int LIST_SERVICES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+3;
69     int CHECK_SERVICES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+4;
70     int SET_PERMISSION_CONTROLLER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+5;
71 }
72