1 /* 2 * Copyright (c) 2021, 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 #ifndef PACKAGES_SCRIPTEXECUTOR_SRC_JNIUTILS_H_ 17 #define PACKAGES_SCRIPTEXECUTOR_SRC_JNIUTILS_H_ 18 19 #include "jni.h" 20 21 extern "C" { 22 #include "lua.h" 23 } 24 25 #include <android-base/result.h> 26 27 namespace com { 28 namespace android { 29 namespace car { 30 namespace scriptexecutor { 31 32 // Helper function which takes android.os.Bundle object in "bundle" argument 33 // and converts it to Lua table on top of Lua stack. All key-value pairs are 34 // converted to the corresponding key-value pairs of the Lua table as long as 35 // the Bundle value types are supported. At this point, we support boolean, 36 // integer, double and String types in Java. 37 void pushBundleToLuaTable(JNIEnv* env, lua_State* lua, jobject bundle); 38 39 } // namespace scriptexecutor 40 } // namespace car 41 } // namespace android 42 } // namespace com 43 44 #endif // PACKAGES_SCRIPTEXECUTOR_SRC_JNIUTILS_H_ 45