OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // This file is autogenerated by |
| 6 // base/android/jni_generator/jni_generator.py |
| 7 // For |
| 8 // com/google/vr/internal/controller/NativeCallbacks |
| 9 |
| 10 // Local modification includes: |
| 11 // 1. Remove all implementaiton, only keep definition. |
| 12 // 2. Use absolute path instead of relative path. |
| 13 // 3. Removed all helper functions such as: Create. |
| 14 // 4. Replace all nativeHandle to handle. This is because jni_generator.py |
| 15 // require jni functions start with "native" prefix. So we add the prefix to |
| 16 // generate the file. But the real jni functions in the static library |
| 17 // doesn't have the prefix. |
| 18 // 5. Added function RegisterNativeCallbacksNatives at the end of this file. |
| 19 |
| 20 #ifndef com_google_vr_internal_controller_NativeCallbacks_JNI |
| 21 #define com_google_vr_internal_controller_NativeCallbacks_JNI |
| 22 |
| 23 #include "base/android/jni_android.h" |
| 24 // ---------------------------------------------------------------------------- |
| 25 // Native JNI methods |
| 26 // ---------------------------------------------------------------------------- |
| 27 #include <jni.h> |
| 28 |
| 29 #include "base/android/jni_generator/jni_generator_helper.h" |
| 30 |
| 31 #include "base/android/jni_int_wrapper.h" |
| 32 |
| 33 // Step 1: forward declarations. |
| 34 namespace { |
| 35 const char kNativeCallbacksClassPath[] = |
| 36 "com/google/vr/internal/controller/NativeCallbacks"; |
| 37 // Leaking this jclass as we cannot use LazyInstance from some threads. |
| 38 base::subtle::AtomicWord g_NativeCallbacks_clazz __attribute__((unused)) = 0; |
| 39 #define NativeCallbacks_clazz(env) \ |
| 40 base::android::LazyGetClass(env, kNativeCallbacksClassPath, \ |
| 41 &g_NativeCallbacks_clazz) |
| 42 |
| 43 } // namespace |
| 44 |
| 45 namespace NativeCallbacks { |
| 46 |
| 47 // Step 2: method stubs. |
| 48 |
| 49 extern "C" __attribute__((visibility("default"))) void |
| 50 Java_com_google_vr_internal_controller_NativeCallbacks_handleStateChanged( |
| 51 JNIEnv* env, |
| 52 jobject jcaller, |
| 53 jlong userData, |
| 54 jint controllerId, |
| 55 jint newState); |
| 56 |
| 57 extern "C" __attribute__((visibility("default"))) void |
| 58 Java_com_google_vr_internal_controller_NativeCallbacks_handleControllerRecentere
d( |
| 59 JNIEnv* env, |
| 60 jobject jcaller, |
| 61 jlong userData, |
| 62 jlong timestampNanos, |
| 63 jfloat qx, |
| 64 jfloat qy, |
| 65 jfloat qz, |
| 66 jfloat qw); |
| 67 |
| 68 extern "C" __attribute__((visibility("default"))) void |
| 69 Java_com_google_vr_internal_controller_NativeCallbacks_handleTouchEvent( |
| 70 JNIEnv* env, |
| 71 jobject jcaller, |
| 72 jlong userData, |
| 73 jlong timestampNanos, |
| 74 jint action, |
| 75 jfloat x, |
| 76 jfloat y); |
| 77 |
| 78 extern "C" __attribute__((visibility("default"))) void |
| 79 Java_com_google_vr_internal_controller_NativeCallbacks_handleOrientationEvent( |
| 80 JNIEnv* env, |
| 81 jobject jcaller, |
| 82 jlong userData, |
| 83 jlong timestampNanos, |
| 84 jfloat qx, |
| 85 jfloat qy, |
| 86 jfloat qz, |
| 87 jfloat qw); |
| 88 |
| 89 extern "C" __attribute__((visibility("default"))) void |
| 90 Java_com_google_vr_internal_controller_NativeCallbacks_handleButtonEvent( |
| 91 JNIEnv* env, |
| 92 jobject jcaller, |
| 93 jlong userData, |
| 94 jlong timestampNanos, |
| 95 jint buttonCode, |
| 96 jboolean down); |
| 97 |
| 98 extern "C" __attribute__((visibility("default"))) void |
| 99 Java_com_google_vr_internal_controller_NativeCallbacks_handleAccelEvent( |
| 100 JNIEnv* env, |
| 101 jobject jcaller, |
| 102 jlong userData, |
| 103 jlong timestampNanos, |
| 104 jfloat x, |
| 105 jfloat y, |
| 106 jfloat z); |
| 107 |
| 108 extern "C" __attribute__((visibility("default"))) void |
| 109 Java_com_google_vr_internal_controller_NativeCallbacks_handleGyroEvent( |
| 110 JNIEnv* env, |
| 111 jobject jcaller, |
| 112 jlong userData, |
| 113 jlong timestampNanos, |
| 114 jfloat x, |
| 115 jfloat y, |
| 116 jfloat z); |
| 117 |
| 118 extern "C" __attribute__((visibility("default"))) void |
| 119 Java_com_google_vr_internal_controller_NativeCallbacks_handleServiceInitFailed( |
| 120 JNIEnv* env, |
| 121 jobject jcaller, |
| 122 jlong userData, |
| 123 jint failureReason); |
| 124 |
| 125 extern "C" __attribute__((visibility("default"))) void |
| 126 Java_com_google_vr_internal_controller_NativeCallbacks_handleServiceFailed( |
| 127 JNIEnv* env, |
| 128 jobject jcaller, |
| 129 jlong userData); |
| 130 |
| 131 extern "C" __attribute__((visibility("default"))) void |
| 132 Java_com_google_vr_internal_controller_NativeCallbacks_handleServiceUnavailable( |
| 133 JNIEnv* env, |
| 134 jobject jcaller, |
| 135 jlong userData); |
| 136 extern "C" __attribute__((visibility("default"))) void |
| 137 Java_com_google_vr_internal_controller_NativeCallbacks_handleServiceConnected( |
| 138 JNIEnv* env, |
| 139 jobject jcaller, |
| 140 jlong userData, |
| 141 jint flags); |
| 142 |
| 143 extern "C" __attribute__((visibility("default"))) void |
| 144 Java_com_google_vr_internal_controller_NativeCallbacks_handleServiceDisconnected
( |
| 145 JNIEnv* env, |
| 146 jobject jcaller, |
| 147 jlong userData); |
| 148 |
| 149 // Step 3: RegisterNatives. |
| 150 |
| 151 static const JNINativeMethod kMethodsNativeCallbacks[] = { |
| 152 {"handleStateChanged", |
| 153 "(" |
| 154 "J" |
| 155 "I" |
| 156 "I" |
| 157 ")" |
| 158 "V", |
| 159 reinterpret_cast<void*>( |
| 160 Java_com_google_vr_internal_controller_NativeCallbacks_handleStateChang
ed)}, |
| 161 {"handleControllerRecentered", |
| 162 "(" |
| 163 "J" |
| 164 "J" |
| 165 "F" |
| 166 "F" |
| 167 "F" |
| 168 "F" |
| 169 ")" |
| 170 "V", |
| 171 reinterpret_cast<void*>( |
| 172 Java_com_google_vr_internal_controller_NativeCallbacks_handleController
Recentered)}, |
| 173 {"handleTouchEvent", |
| 174 "(" |
| 175 "J" |
| 176 "J" |
| 177 "I" |
| 178 "F" |
| 179 "F" |
| 180 ")" |
| 181 "V", |
| 182 reinterpret_cast<void*>( |
| 183 Java_com_google_vr_internal_controller_NativeCallbacks_handleTouchEvent
)}, |
| 184 {"handleOrientationEvent", |
| 185 "(" |
| 186 "J" |
| 187 "J" |
| 188 "F" |
| 189 "F" |
| 190 "F" |
| 191 "F" |
| 192 ")" |
| 193 "V", |
| 194 reinterpret_cast<void*>( |
| 195 Java_com_google_vr_internal_controller_NativeCallbacks_handleOrientatio
nEvent)}, |
| 196 {"handleButtonEvent", |
| 197 "(" |
| 198 "J" |
| 199 "J" |
| 200 "I" |
| 201 "Z" |
| 202 ")" |
| 203 "V", |
| 204 reinterpret_cast<void*>( |
| 205 Java_com_google_vr_internal_controller_NativeCallbacks_handleButtonEven
t)}, |
| 206 {"handleAccelEvent", |
| 207 "(" |
| 208 "J" |
| 209 "J" |
| 210 "F" |
| 211 "F" |
| 212 "F" |
| 213 ")" |
| 214 "V", |
| 215 reinterpret_cast<void*>( |
| 216 Java_com_google_vr_internal_controller_NativeCallbacks_handleAccelEvent
)}, |
| 217 {"handleGyroEvent", |
| 218 "(" |
| 219 "J" |
| 220 "J" |
| 221 "F" |
| 222 "F" |
| 223 "F" |
| 224 ")" |
| 225 "V", |
| 226 reinterpret_cast<void*>( |
| 227 Java_com_google_vr_internal_controller_NativeCallbacks_handleGyroEvent)
}, |
| 228 {"handleServiceInitFailed", |
| 229 "(" |
| 230 "J" |
| 231 "I" |
| 232 ")" |
| 233 "V", |
| 234 reinterpret_cast<void*>( |
| 235 Java_com_google_vr_internal_controller_NativeCallbacks_handleServiceIni
tFailed)}, |
| 236 {"handleServiceFailed", |
| 237 "(" |
| 238 "J" |
| 239 ")" |
| 240 "V", |
| 241 reinterpret_cast<void*>( |
| 242 Java_com_google_vr_internal_controller_NativeCallbacks_handleServiceFai
led)}, |
| 243 {"handleServiceUnavailable", |
| 244 "(" |
| 245 "J" |
| 246 ")" |
| 247 "V", |
| 248 reinterpret_cast<void*>( |
| 249 Java_com_google_vr_internal_controller_NativeCallbacks_handleServiceUna
vailable)}, |
| 250 {"handleServiceConnected", |
| 251 "(" |
| 252 "J" |
| 253 "I" |
| 254 ")" |
| 255 "V", |
| 256 reinterpret_cast<void*>( |
| 257 Java_com_google_vr_internal_controller_NativeCallbacks_handleServiceCon
nected)}, |
| 258 {"handleServiceDisconnected", |
| 259 "(" |
| 260 "J" |
| 261 ")" |
| 262 "V", |
| 263 reinterpret_cast<void*>( |
| 264 Java_com_google_vr_internal_controller_NativeCallbacks_handleServiceDis
connected)}, |
| 265 }; |
| 266 |
| 267 static bool RegisterNativesImpl(JNIEnv* env) { |
| 268 if (base::android::IsManualJniRegistrationDisabled()) |
| 269 return true; |
| 270 |
| 271 const int kMethodsNativeCallbacksSize = arraysize(kMethodsNativeCallbacks); |
| 272 |
| 273 if (env->RegisterNatives(NativeCallbacks_clazz(env), kMethodsNativeCallbacks, |
| 274 kMethodsNativeCallbacksSize) < 0) { |
| 275 jni_generator::HandleRegistrationError(env, NativeCallbacks_clazz(env), |
| 276 __FILE__); |
| 277 return false; |
| 278 } |
| 279 |
| 280 return true; |
| 281 } |
| 282 |
| 283 static bool RegisterNativeCallbacksNatives(JNIEnv* env) { |
| 284 return RegisterNativesImpl(env); |
| 285 } |
| 286 |
| 287 } // namespace NativeCallbacks |
| 288 |
| 289 #endif // com_google_vr_internal_controller_NativeCallbacks_JNI |
OLD | NEW |