• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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.os.ParcelFileDescriptor;
20 
21 /**
22  * Interface for accessing the RPC server of a service.
23  *
24  * @hide
25  */
26 interface IAccessor {
27     /**
28      * The connection info was not available for this service.
29      * This happens when the user-supplied callback fails to produce
30      * valid connection info.
31      * Depending on the implementation of the callback, it might be helpful
32      * to retry.
33      */
34     const int ERROR_CONNECTION_INFO_NOT_FOUND = 0;
35     /**
36      * Failed to create the socket. Often happens when the process trying to create
37      * the socket lacks the permissions to do so.
38      * This may be a temporary issue, so retrying the operation is OK.
39      */
40     const int ERROR_FAILED_TO_CREATE_SOCKET = 1;
41     /**
42      * Failed to connect to the socket. This can happen for many reasons, so be sure
43      * log the error message and check it.
44      * This may be a temporary issue, so retrying the operation is OK.
45      */
46     const int ERROR_FAILED_TO_CONNECT_TO_SOCKET = 2;
47     /**
48      * Failed to connect to the socket with EACCES because this process does not
49      * have perimssions to connect.
50      * There is no need to retry the connection as this access will not be granted
51      * upon retry.
52      */
53     const int ERROR_FAILED_TO_CONNECT_EACCES = 3;
54     /**
55      * Unsupported socket family type returned.
56      * There is no need to retry the connection as this socket family is not
57      * supported.
58      */
59     const int ERROR_UNSUPPORTED_SOCKET_FAMILY = 4;
60 
61     /**
62      * Adds a connection to the RPC server of the service managed by the IAccessor.
63      *
64      * This method can be called multiple times to establish multiple distinct
65      * connections to the same RPC server.
66      *
67      * @throws ServiceSpecificError with message and one of the IAccessor::ERROR_ values.
68      *
69      * @return A file descriptor connected to the RPC session of the service managed
70      *         by IAccessor.
71      */
addConnection()72     ParcelFileDescriptor addConnection();
73 
74     /**
75      * Get the instance name for the service this accessor is responsible for.
76      *
77      * This is used to verify the proxy binder is associated with the expected instance name.
78      */
getInstanceName()79     String getInstanceName();
80 }
81