1 /* 2 * Copyright (C) 2025, 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 #pragma once 18 19 namespace android { 20 namespace aidl { 21 22 // Copied from android.is.IBinder.[FIRST|LAST]_CALL_TRANSACTION 23 const int kFirstCallTransaction = 1; 24 const int kLastCallTransaction = 0x00ffffff; 25 26 // Following IDs are all offsets from kFirstCallTransaction 27 28 // IDs for meta transactions. Most of the meta transactions are implemented in 29 // the framework side (Binder.java or Binder.cpp). But these are the ones that 30 // are auto-implemented by the AIDL compiler. 31 const int kFirstMetaMethodId = kLastCallTransaction - kFirstCallTransaction; 32 const int kGetInterfaceVersionId = kFirstMetaMethodId; 33 const int kGetInterfaceHashId = kFirstMetaMethodId - 1; 34 // Additional meta transactions implemented by AIDL should use 35 // kFirstMetaMethodId -1, -2, ...and so on. 36 37 // Reserve 100 IDs for meta methods, which is more than enough. If we don't reserve, 38 // in the future, a newly added meta transaction ID will have a chance to 39 // collide with the user-defined methods that were added in the past. So, 40 // let's prevent users from using IDs in this range from the beginning. 41 const int kLastMetaMethodId = kFirstMetaMethodId - 99; 42 43 // Range of IDs that is allowed for user-defined methods. 44 const int kMinUserSetMethodId = 0; 45 const int kMaxUserSetMethodId = kLastMetaMethodId - 1; 46 47 } // namespace aidl 48 } // namespace android 49