1 /* 2 * Copyright (C) 2020 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 #include <android/binder_ibinder.h> 18 #include <android/binder_parcel.h> 19 #include <android/binder_status.h> 20 #include <android/persistable_bundle.h> 21 22 /* Platform only */ 23 #if defined(ANDROID_PLATFORM) || defined(__ANDROID_VENDOR__) 24 #include <android/binder_ibinder_platform.h> 25 #include <android/binder_manager.h> 26 #include <android/binder_parcel_platform.h> 27 #include <android/binder_process.h> 28 #include <android/binder_rpc.h> 29 #include <android/binder_shell.h> 30 #include <android/binder_stability.h> 31 #endif 32 33 namespace android { 34 35 namespace c_interface { 36 37 // Expose error codes from anonymous enum in binder_status.h 38 enum StatusCode { 39 OK = STATUS_OK, 40 UNKNOWN_ERROR = STATUS_UNKNOWN_ERROR, 41 NO_MEMORY = STATUS_NO_MEMORY, 42 INVALID_OPERATION = STATUS_INVALID_OPERATION, 43 BAD_VALUE = STATUS_BAD_VALUE, 44 BAD_TYPE = STATUS_BAD_TYPE, 45 NAME_NOT_FOUND = STATUS_NAME_NOT_FOUND, 46 PERMISSION_DENIED = STATUS_PERMISSION_DENIED, 47 NO_INIT = STATUS_NO_INIT, 48 ALREADY_EXISTS = STATUS_ALREADY_EXISTS, 49 DEAD_OBJECT = STATUS_DEAD_OBJECT, 50 FAILED_TRANSACTION = STATUS_FAILED_TRANSACTION, 51 BAD_INDEX = STATUS_BAD_INDEX, 52 NOT_ENOUGH_DATA = STATUS_NOT_ENOUGH_DATA, 53 WOULD_BLOCK = STATUS_WOULD_BLOCK, 54 TIMED_OUT = STATUS_TIMED_OUT, 55 UNKNOWN_TRANSACTION = STATUS_UNKNOWN_TRANSACTION, 56 FDS_NOT_ALLOWED = STATUS_FDS_NOT_ALLOWED, 57 UNEXPECTED_NULL = STATUS_UNEXPECTED_NULL, 58 }; 59 60 // Expose exception codes from anonymous enum in binder_status.h 61 enum ExceptionCode { 62 NONE = EX_NONE, 63 SECURITY = EX_SECURITY, 64 BAD_PARCELABLE = EX_BAD_PARCELABLE, 65 ILLEGAL_ARGUMENT = EX_ILLEGAL_ARGUMENT, 66 NULL_POINTER = EX_NULL_POINTER, 67 ILLEGAL_STATE = EX_ILLEGAL_STATE, 68 NETWORK_MAIN_THREAD = EX_NETWORK_MAIN_THREAD, 69 UNSUPPORTED_OPERATION = EX_UNSUPPORTED_OPERATION, 70 SERVICE_SPECIFIC = EX_SERVICE_SPECIFIC, 71 PARCELABLE = EX_PARCELABLE, 72 73 /** 74 * This is special, and indicates to native binder proxies that the 75 * transaction has failed at a low level. 76 */ 77 TRANSACTION_FAILED = EX_TRANSACTION_FAILED, 78 }; 79 80 namespace consts { 81 82 enum { 83 FIRST_CALL_TRANSACTION = FIRST_CALL_TRANSACTION, 84 LAST_CALL_TRANSACTION = LAST_CALL_TRANSACTION, 85 }; 86 87 enum { 88 FLAG_ONEWAY = FLAG_ONEWAY, 89 #if defined(ANDROID_PLATFORM) || defined(__ANDROID_VENDOR__) 90 FLAG_CLEAR_BUF = FLAG_CLEAR_BUF, 91 FLAG_PRIVATE_LOCAL = FLAG_PRIVATE_LOCAL, 92 #endif 93 }; 94 95 enum { 96 APERSISTABLEBUNDLE_KEY_NOT_FOUND = APERSISTABLEBUNDLE_KEY_NOT_FOUND, 97 APERSISTABLEBUNDLE_ALLOCATOR_FAILED = APERSISTABLEBUNDLE_ALLOCATOR_FAILED, 98 }; 99 100 } // namespace consts 101 102 } // namespace c_interface 103 104 } // namespace android 105