Home | History | Annotate | Download | only in os
      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      */
     36     IBinder getService(String name) throws RemoteException;
     37 
     38     /**
     39      * Retrieve an existing service called @a name from the
     40      * service manager.  Non-blocking.
     41      */
     42     IBinder checkService(String name) throws RemoteException;
     43 
     44     /**
     45      * Place a new @a service called @a name into the service
     46      * manager.
     47      */
     48     void addService(String name, IBinder service, boolean allowIsolated, int dumpFlags)
     49             throws RemoteException;
     50 
     51     /**
     52      * Return a list of all currently running services.
     53      */
     54     String[] listServices(int dumpFlags) 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      */
     60     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     /*
     73      * Must update values in IServiceManager.h
     74      */
     75     /* Allows services to dump sections according to priorities. */
     76     int DUMP_FLAG_PRIORITY_CRITICAL = 1 << 0;
     77     int DUMP_FLAG_PRIORITY_HIGH = 1 << 1;
     78     int DUMP_FLAG_PRIORITY_NORMAL = 1 << 2;
     79     /**
     80      * Services are by default registered with a DEFAULT dump priority. DEFAULT priority has the
     81      * same priority as NORMAL priority but the services are not called with dump priority
     82      * arguments.
     83      */
     84     int DUMP_FLAG_PRIORITY_DEFAULT = 1 << 3;
     85     int DUMP_FLAG_PRIORITY_ALL = DUMP_FLAG_PRIORITY_CRITICAL | DUMP_FLAG_PRIORITY_HIGH
     86             | DUMP_FLAG_PRIORITY_NORMAL | DUMP_FLAG_PRIORITY_DEFAULT;
     87     /* Allows services to dump sections in protobuf format. */
     88     int DUMP_FLAG_PROTO = 1 << 4;
     89 
     90 }
     91