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 import android.annotation.UnsupportedAppUsage;
     20 
     21 /**
     22  * Basic interface for finding and publishing system services.
     23  *
     24  * An implementation of this interface is usually published as the
     25  * global context object, which can be retrieved via
     26  * BinderNative.getContextObject().  An easy way to retrieve this
     27  * is with the static method BnServiceManager.getDefault().
     28  *
     29  * @hide
     30  */
     31 public interface IServiceManager extends IInterface
     32 {
     33     /**
     34      * Retrieve an existing service called @a name from the
     35      * service manager.  Blocks for a few seconds waiting for it to be
     36      * published if it does not already exist.
     37      */
     38     @UnsupportedAppUsage
     39     IBinder getService(String name) throws RemoteException;
     40 
     41     /**
     42      * Retrieve an existing service called @a name from the
     43      * service manager.  Non-blocking.
     44      */
     45     @UnsupportedAppUsage
     46     IBinder checkService(String name) throws RemoteException;
     47 
     48     /**
     49      * Place a new @a service called @a name into the service
     50      * manager.
     51      */
     52     void addService(String name, IBinder service, boolean allowIsolated, int dumpFlags)
     53             throws RemoteException;
     54 
     55     /**
     56      * Return a list of all currently running services.
     57      */
     58     String[] listServices(int dumpFlags) throws RemoteException;
     59 
     60     /**
     61      * Assign a permission controller to the service manager.  After set, this
     62      * interface is checked before any services are added.
     63      */
     64     void setPermissionController(IPermissionController controller)
     65             throws RemoteException;
     66 
     67     static final String descriptor = "android.os.IServiceManager";
     68 
     69     int GET_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION;
     70     int CHECK_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+1;
     71     int ADD_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+2;
     72     int LIST_SERVICES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+3;
     73     int CHECK_SERVICES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+4;
     74     int SET_PERMISSION_CONTROLLER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+5;
     75 
     76     /*
     77      * Must update values in IServiceManager.h
     78      */
     79     /* Allows services to dump sections according to priorities. */
     80     int DUMP_FLAG_PRIORITY_CRITICAL = 1 << 0;
     81     int DUMP_FLAG_PRIORITY_HIGH = 1 << 1;
     82     int DUMP_FLAG_PRIORITY_NORMAL = 1 << 2;
     83     /**
     84      * Services are by default registered with a DEFAULT dump priority. DEFAULT priority has the
     85      * same priority as NORMAL priority but the services are not called with dump priority
     86      * arguments.
     87      */
     88     int DUMP_FLAG_PRIORITY_DEFAULT = 1 << 3;
     89     int DUMP_FLAG_PRIORITY_ALL = DUMP_FLAG_PRIORITY_CRITICAL | DUMP_FLAG_PRIORITY_HIGH
     90             | DUMP_FLAG_PRIORITY_NORMAL | DUMP_FLAG_PRIORITY_DEFAULT;
     91     /* Allows services to dump sections in protobuf format. */
     92     int DUMP_FLAG_PROTO = 1 << 4;
     93 
     94 }
     95