1 /* 2 * Copyright (C) 2018 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 #ifndef IIORAP_IFACE_DEF_H 18 #define IIORAP_IFACE_DEF_H 19 20 // Provide an x-macro that defines the 'IIorap.aidl' interface through repeated 21 // macro invocation on the member functions and their respective parameters. 22 // 23 // Future changes in the AIDL file to add new methods or change parameters should avoid 24 // a boilerplate-ripple effect in the rest of the codebase. 25 26 #define IIORAP_IFACE_DEF(FN_BEGIN, FN, FN_END) \ 27 FN_BEGIN(::com::google::android::startup::iorap::,IIorap) \ 28 /* name <see IORAP_BINDER_PARAM_JOIN> */ \ 29 FN(setTaskListener, (const ::android::sp<::com::google::android::startop::iorap::,ITaskListener,>&,listener)) /*NOLINT*/ \ 30 FN(onAppLaunchEvent,(const ::com::google::android::startop::iorap::,RequestId,&,request), \ 31 (const ::com::google::android::startop::iorap::,AppLaunchEvent,&,event)) \ 32 FN(onPackageEvent, (const ::com::google::android::startop::iorap::,RequestId,&,request), \ 33 (const ::com::google::android::startop::iorap::,PackageEvent,&,event)) \ 34 FN(onAppIntentEvent,(const ::com::google::android::startop::iorap::,RequestId,&,request), \ 35 (const ::com::google::android::startop::iorap::,AppIntentEvent,&,event)) \ 36 FN(onSystemServiceEvent, \ 37 (const ::com::google::android::startop::iorap::,RequestId,&,request), \ 38 (const ::com::google::android::startop::iorap::,SystemServiceEvent,&,event)) \ 39 FN(onSystemServiceUserEvent, \ 40 (const ::com::google::android::startop::iorap::,RequestId,&,request), \ 41 (const ::com::google::android::startop::iorap::,SystemServiceUserEvent,&,event))\ 42 FN_END() \ 43 44 // Convenience macros to unpack the 2nd parameter from IIORAP_IFACE_DEF#FN calls. 45 46 #define IORAP_BINDER_PARAM_JOIN_ALL(arg) IORAP_BINDER_PARAM_JOIN_ALL_IMPL arg 47 #define IORAP_BINDER_PARAM_JOIN_ALL_IMPL(type_l, type, type_r, name) type_l type type_r name 48 49 #define IORAP_BINDER_PARAM_JOIN_NAMES(arg) IORAP_BINDER_PARAM_JOIN_NAMES_IMPL arg 50 #define IORAP_BINDER_PARAM_JOIN_NAMES_IMPL(type_l, type, type_r, name) name 51 52 #endif //IIORAP_IFACE_DEF_H 53