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 of the same format as file that generated by
6 //     base/android/jni_generator/jni_generator.py
7 // For
8 //     com/google/vr/ndk/base/GvrApi
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. Removed external functions that don't have implementation in shim file.
15 // 5. Changed RectF, Point, and PoseTracker to correct package name.
16 // 6. Added function RegisterGvrApiNatives at the end of this file.
17 
18 #ifndef com_google_vr_ndk_base_GvrApi_JNI
19 #define com_google_vr_ndk_base_GvrApi_JNI
20 
21 #include "base/android/jni_android.h"
22 // ----------------------------------------------------------------------------
23 // Native JNI methods
24 // ----------------------------------------------------------------------------
25 #include <jni.h>
26 #include <atomic>
27 #include <type_traits>
28 
29 #include "base/android/jni_generator/jni_generator_helper.h"
30 #include "base/android/jni_int_wrapper.h"
31 
32 // Step 1: forward declarations.
33 namespace {
34 const char kGvrApiClassPath[] = "com/google/vr/ndk/base/GvrApi";
35 // Leaking this jclass as we cannot use LazyInstance from some threads.
36 std::atomic<jclass> g_GvrApi_clazz __attribute__((unused)) (nullptr);
37 #define GvrApi_clazz(env) \
38   base::android::LazyGetClass(env, kGvrApiClassPath, &g_GvrApi_clazz)
39 
40 }  // namespace
41 
42 namespace GvrApi {
43 // Step 2: method stubs.
44 
45 JNI_GENERATOR_EXPORT jlong
46 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportListCreate(
47     JNIEnv* env,
48     jobject jcaller,
49     jlong nativeGvrContext);
50 
51 JNI_GENERATOR_EXPORT void
52 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportListDestroy(
53     JNIEnv* env,
54     jclass jcaller,
55     jlong nativeBufferViewportList);
56 
57 JNI_GENERATOR_EXPORT jint
58 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportListGetSize(
59     JNIEnv* env,
60     jclass jcaller,
61     jlong nativeBufferViewportList);
62 
63 JNI_GENERATOR_EXPORT void
64 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportListGetItem(
65     JNIEnv* env,
66     jclass jcaller,
67     jlong nativeBufferViewportList,
68     jint index,
69     jlong nativeBufferViewport);
70 
71 JNI_GENERATOR_EXPORT void
72 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportListSetItem(
73     JNIEnv* env,
74     jclass jcaller,
75     jlong nativeBufferViewportList,
76     jint index,
77     jlong nativeBufferViewport);
78 
79 JNI_GENERATOR_EXPORT jlong
80 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportCreate(
81     JNIEnv* env,
82     jclass jcaller,
83     jlong nativeGvrContext);
84 
85 JNI_GENERATOR_EXPORT void
86 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportDestroy(
87     JNIEnv* env,
88     jclass jcaller,
89     jlong nativeBufferViewport);
90 
91 JNI_GENERATOR_EXPORT void
92 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportGetSourceUv(
93     JNIEnv* env,
94     jclass jcaller,
95     jlong nativeBufferViewport,
96     jobject out);
97 
98 JNI_GENERATOR_EXPORT void
99 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportSetSourceUv(
100     JNIEnv* env,
101     jclass jcaller,
102     jlong nativeBufferViewport,
103     jfloat left,
104     jfloat top,
105     jfloat right,
106     jfloat bottom);
107 
108 JNI_GENERATOR_EXPORT void
109 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportGetSourceFov(
110     JNIEnv* env,
111     jclass jcaller,
112     jlong nativeBufferViewport,
113     jobject out);
114 
115 JNI_GENERATOR_EXPORT void
116 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportSetSourceFov(
117     JNIEnv* env,
118     jclass jcaller,
119     jlong nativeBufferViewport,
120     jfloat left,
121     jfloat top,
122     jfloat right,
123     jfloat bottom);
124 
125 JNI_GENERATOR_EXPORT void
126 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportGetTransform(
127     JNIEnv* env,
128     jclass jcaller,
129     jlong nativeBufferViewport,
130     jfloatArray matrix);
131 
132 JNI_GENERATOR_EXPORT void
133 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportSetTransform(
134     JNIEnv* env,
135     jclass jcaller,
136     jlong nativeBufferViewport,
137     jfloatArray matrix);
138 
139 JNI_GENERATOR_EXPORT jboolean
140 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportEqual(JNIEnv* env,
141                                                              jclass jcaller,
142                                                              jlong nativeA,
143                                                              jlong nativeB);
144 
145 JNI_GENERATOR_EXPORT jint
146 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportGetTargetEye(
147     JNIEnv* env,
148     jclass jcaller,
149     jlong nativeBufferViewport);
150 
151 JNI_GENERATOR_EXPORT void
152 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportSetTargetEye(
153     JNIEnv* env,
154     jclass jcaller,
155     jlong nativeBufferViewport,
156     jint eye);
157 
158 JNI_GENERATOR_EXPORT jint
159 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportGetSourceBufferIndex(
160     JNIEnv* env,
161     jclass jcaller,
162     jlong nativeBufferViewport);
163 
164 JNI_GENERATOR_EXPORT void
165 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportSetSourceBufferIndex(
166     JNIEnv* env,
167     jclass jcaller,
168     jlong nativeBufferViewport,
169     jint index);
170 
171 JNI_GENERATOR_EXPORT jint
172 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportGetExternalSurfaceId(
173     JNIEnv* env,
174     jclass jcaller,
175     jlong nativeBufferViewport);
176 
177 JNI_GENERATOR_EXPORT void
178 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportSetExternalSurfaceId(
179     JNIEnv* env,
180     jclass jcaller,
181     jlong nativeBufferViewport,
182     jint id);
183 
184 JNI_GENERATOR_EXPORT void
185 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportSetExternalSurface(
186     JNIEnv* env,
187     jclass jcaller,
188     jlong nativeBufferViewport,
189     jlong nativeExternalSurface);
190 
191 JNI_GENERATOR_EXPORT jint
192 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportGetReprojection(
193     JNIEnv* env,
194     jclass jcaller,
195     jlong nativeBufferViewport);
196 
197 JNI_GENERATOR_EXPORT void
198 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportSetReprojection(
199     JNIEnv* env,
200     jclass jcaller,
201     jlong nativeBufferViewport,
202     jint reprojection);
203 
204 JNI_GENERATOR_EXPORT void
205 Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportSetSourceLayer(
206     JNIEnv* env,
207     jclass jcaller,
208     jlong nativeBufferViewport,
209     jint layerIndex);
210 
211 JNI_GENERATOR_EXPORT jlong
212 Java_com_google_vr_ndk_base_GvrApi_nativeBufferSpecCreate(
213     JNIEnv* env,
214     jclass jcaller,
215     jlong nativeGvrContext);
216 
217 JNI_GENERATOR_EXPORT void
218 Java_com_google_vr_ndk_base_GvrApi_nativeBufferSpecDestroy(
219     JNIEnv* env,
220     jclass jcaller,
221     jlong nativeBufferSpec);
222 
223 JNI_GENERATOR_EXPORT void
224 Java_com_google_vr_ndk_base_GvrApi_nativeBufferSpecGetSize(
225     JNIEnv* env,
226     jclass jcaller,
227     jlong nativeBufferSpec,
228     jobject size);
229 
230 JNI_GENERATOR_EXPORT void
231 Java_com_google_vr_ndk_base_GvrApi_nativeBufferSpecSetSize(
232     JNIEnv* env,
233     jclass jcaller,
234     jlong nativeBufferSpec,
235     jint width,
236     jint height);
237 
238 JNI_GENERATOR_EXPORT void
239 Java_com_google_vr_ndk_base_GvrApi_nativeBufferSpecSetColorFormat(
240     JNIEnv* env,
241     jclass jcaller,
242     jlong nativeBufferSpec,
243     jint format);
244 
245 JNI_GENERATOR_EXPORT void
246 Java_com_google_vr_ndk_base_GvrApi_nativeBufferSpecSetDepthStencilFormat(
247     JNIEnv* env,
248     jclass jcaller,
249     jlong nativeBufferSpec,
250     jint format);
251 
252 JNI_GENERATOR_EXPORT void
253 Java_com_google_vr_ndk_base_GvrApi_nativeBufferSpecSetMultiviewLayers(
254     JNIEnv* env,
255     jclass jcaller,
256     jlong nativeBufferSpec,
257     jint numLayers);
258 
259 JNI_GENERATOR_EXPORT jint
260 Java_com_google_vr_ndk_base_GvrApi_nativeBufferSpecGetSamples(
261     JNIEnv* env,
262     jclass jcaller,
263     jlong nativeBufferSpec);
264 
265 JNI_GENERATOR_EXPORT void
266 Java_com_google_vr_ndk_base_GvrApi_nativeBufferSpecSetSamples(
267     JNIEnv* env,
268     jclass jcaller,
269     jlong nativeBufferSpec,
270     jint samples);
271 
272 JNI_GENERATOR_EXPORT jlong
273 Java_com_google_vr_ndk_base_GvrApi_nativeExternalSurfaceCreateWithListeners(
274     JNIEnv* env,
275     jclass jcaller,
276     jlong nativeGvrContext,
277     jobject surfaceListener,
278     jobject frameListener,
279     jobject handler);
280 
281 JNI_GENERATOR_EXPORT void
282 Java_com_google_vr_ndk_base_GvrApi_nativeExternalSurfaceDestroy(
283     JNIEnv* env,
284     jclass jcaller,
285     jlong nativeBufferSpec);
286 
287 JNI_GENERATOR_EXPORT jint
288 Java_com_google_vr_ndk_base_GvrApi_nativeExternalSurfaceGetId(
289     JNIEnv* env,
290     jclass jcaller,
291     jlong nativeBufferSpec);
292 
293 JNI_GENERATOR_EXPORT jobject
294 Java_com_google_vr_ndk_base_GvrApi_nativeExternalSurfaceGetSurface(
295     JNIEnv* env,
296     jclass jcaller,
297     jlong nativeBufferSpec);
298 
299 JNI_GENERATOR_EXPORT jlong
300 Java_com_google_vr_ndk_base_GvrApi_nativeSwapChainCreate(JNIEnv* env,
301                                                          jclass jcaller,
302                                                          jlong nativeContext,
303                                                          jlongArray specs);
304 
305 JNI_GENERATOR_EXPORT void
306 Java_com_google_vr_ndk_base_GvrApi_nativeSwapChainDestroy(JNIEnv* env,
307                                                           jclass jcaller,
308                                                           jlong nativeContext);
309 
310 JNI_GENERATOR_EXPORT jint
311 Java_com_google_vr_ndk_base_GvrApi_nativeSwapChainGetBufferCount(
312     JNIEnv* env,
313     jclass jcaller,
314     jlong nativeSwapChain);
315 
316 JNI_GENERATOR_EXPORT void
317 Java_com_google_vr_ndk_base_GvrApi_nativeSwapChainGetBufferSize(
318     JNIEnv* env,
319     jclass jcaller,
320     jlong nativeSwapChain,
321     jint bufferIndex,
322     jobject size);
323 
324 JNI_GENERATOR_EXPORT void
325 Java_com_google_vr_ndk_base_GvrApi_nativeSwapChainResizeBuffer(
326     JNIEnv* env,
327     jclass jcaller,
328     jlong nativeSwapChain,
329     jint bufferIndex,
330     jint width,
331     jint height);
332 
333 JNI_GENERATOR_EXPORT jlong
334 Java_com_google_vr_ndk_base_GvrApi_nativeSwapChainAcquireFrame(
335     JNIEnv* env,
336     jclass jcaller,
337     jlong nativeSwapChain);
338 
339 JNI_GENERATOR_EXPORT void
340 Java_com_google_vr_ndk_base_GvrApi_nativeFrameBindBuffer(JNIEnv* env,
341                                                          jclass jcaller,
342                                                          jlong nativeFrame,
343                                                          jint bufferIndex);
344 
345 JNI_GENERATOR_EXPORT void Java_com_google_vr_ndk_base_GvrApi_nativeFrameUnbind(
346     JNIEnv* env,
347     jclass jcaller,
348     jlong nativeFrame);
349 
350 JNI_GENERATOR_EXPORT jint
351 Java_com_google_vr_ndk_base_GvrApi_nativeFrameGetFramebufferObject(
352     JNIEnv* env,
353     jclass jcaller,
354     jlong nativeFrame,
355     jint bufferIndex);
356 
357 JNI_GENERATOR_EXPORT void
358 Java_com_google_vr_ndk_base_GvrApi_nativeFrameGetBufferSize(JNIEnv* env,
359                                                             jclass jcaller,
360                                                             jlong nativeFrame,
361                                                             jint bufferIndex,
362                                                             jobject size);
363 
364 JNI_GENERATOR_EXPORT void Java_com_google_vr_ndk_base_GvrApi_nativeFrameSubmit(
365     JNIEnv* env,
366     jclass jcaller,
367     jlong nativeFrame,
368     jlong nativeBufferViewportList,
369     jfloatArray headSpaceFromStartSpace);
370 
371 JNI_GENERATOR_EXPORT jboolean
372 Java_com_google_vr_ndk_base_GvrApi_nativeUsingDynamicLibrary(JNIEnv* env,
373                                                              jclass jcaller);
374 
375 JNI_GENERATOR_EXPORT jboolean
376 Java_com_google_vr_ndk_base_GvrApi_nativeUsingShimLibrary(JNIEnv* env,
377                                                           jclass jcaller);
378 
379 JNI_GENERATOR_EXPORT void
380 Java_com_google_vr_ndk_base_GvrApi_nativeSetApplicationState(JNIEnv* env,
381                                                              jclass jcaller,
382                                                              jclass classLoader,
383                                                              jobject context);
384 
385 JNI_GENERATOR_EXPORT void
386 Java_com_google_vr_ndk_base_GvrApi_nativeSetDynamicLibraryLoadingEnabled(
387     JNIEnv* env,
388     jclass jcaller,
389     jboolean enabled);
390 
391 JNI_GENERATOR_EXPORT jlong Java_com_google_vr_ndk_base_GvrApi_nativeCreate(
392     JNIEnv* env,
393     jobject jcaller,
394     jclass classLoader,
395     jobject context,
396     jlong synchronizer,
397     jint widthPixels,
398     jint heightPixels,
399     jfloat xDpi,
400     jfloat yDpi,
401     jobject optionalPoseTrackingForTesting);
402 
403 JNI_GENERATOR_EXPORT void
404 Java_com_google_vr_ndk_base_GvrApi_nativeRequestContextSharing(
405     JNIEnv* env,
406     jobject jcaller,
407     jlong nativeGvrContext,
408     jobject eglListener);
409 
410 JNI_GENERATOR_EXPORT jint
411 Java_com_google_vr_ndk_base_GvrApi_nativeGetError(JNIEnv* env,
412                                                   jobject jcaller,
413                                                   jlong nativeGvrContext);
414 
415 JNI_GENERATOR_EXPORT jint
416 Java_com_google_vr_ndk_base_GvrApi_nativeClearError(JNIEnv* env,
417                                                     jobject jcaller,
418                                                     jlong nativeGvrContext);
419 
420 JNI_GENERATOR_EXPORT jstring
421 Java_com_google_vr_ndk_base_GvrApi_nativeGetErrorString(JNIEnv* env,
422                                                         jclass jcaller,
423                                                         jint errorCode);
424 
425 JNI_GENERATOR_EXPORT jlong
426 Java_com_google_vr_ndk_base_GvrApi_nativeGetUserPrefs(JNIEnv* env,
427                                                       jobject jcaller,
428                                                       jlong nativeGvrContext);
429 
430 JNI_GENERATOR_EXPORT jint
431 Java_com_google_vr_ndk_base_GvrApi_nativeUserPrefsGetControllerHandedness(
432     JNIEnv* env,
433     jclass jcaller,
434     jlong nativeUserPrefs);
435 
436 JNI_GENERATOR_EXPORT void Java_com_google_vr_ndk_base_GvrApi_nativePause(
437     JNIEnv* env,
438     jobject jcaller,
439     jlong nativeGvrContext);
440 
441 JNI_GENERATOR_EXPORT void Java_com_google_vr_ndk_base_GvrApi_nativeResume(
442     JNIEnv* env,
443     jobject jcaller,
444     jlong nativeGvrContext);
445 
446 JNI_GENERATOR_EXPORT void
447 Java_com_google_vr_ndk_base_GvrApi_nativeReleaseGvrContext(
448     JNIEnv* env,
449     jobject jcaller,
450     jlong nativeGvrContext);
451 
452 JNI_GENERATOR_EXPORT void Java_com_google_vr_ndk_base_GvrApi_nativeInitializeGl(
453     JNIEnv* env,
454     jobject jcaller,
455     jlong nativeGvrContext);
456 
457 JNI_GENERATOR_EXPORT void
458 Java_com_google_vr_ndk_base_GvrApi_nativeOnSurfaceCreatedReprojectionThread(
459     JNIEnv* env,
460     jobject jcaller,
461     jlong nativeGvrContext);
462 
463 JNI_GENERATOR_EXPORT void
464 Java_com_google_vr_ndk_base_GvrApi_nativeOnSurfaceChangedReprojectionThread(
465     JNIEnv* env,
466     jobject jcaller,
467     jlong nativeGvrContext);
468 
469 JNI_GENERATOR_EXPORT void
470 Java_com_google_vr_ndk_base_GvrApi_nativeGetRecommendedBufferViewports(
471     JNIEnv* env,
472     jobject jcaller,
473     jlong nativeGvrContext,
474     jlong nativeBufferViewportList);
475 
476 JNI_GENERATOR_EXPORT void
477 Java_com_google_vr_ndk_base_GvrApi_nativeGetScreenBufferViewports(
478     JNIEnv* env,
479     jobject jcaller,
480     jlong nativeGvrContext,
481     jlong nativeBufferViewportList);
482 
483 JNI_GENERATOR_EXPORT void
484 Java_com_google_vr_ndk_base_GvrApi_nativeGetMaximumEffectiveRenderTargetSize(
485     JNIEnv* env,
486     jobject jcaller,
487     jlong nativeGvrContext,
488     jobject size);
489 
490 JNI_GENERATOR_EXPORT void
491 Java_com_google_vr_ndk_base_GvrApi_nativeGetScreenTargetSize(
492     JNIEnv* env,
493     jobject jcaller,
494     jlong nativeGvrContext,
495     jobject size);
496 
497 JNI_GENERATOR_EXPORT void
498 Java_com_google_vr_ndk_base_GvrApi_nativeDistortToScreen(
499     JNIEnv* env,
500     jobject jcaller,
501     jlong nativeGvrContext,
502     jint textureId,
503     jlong nativeBufferViewportList,
504     jfloatArray headSpaceFromStartSpace,
505     jlong timeNs);
506 
507 JNI_GENERATOR_EXPORT void
508 Java_com_google_vr_ndk_base_GvrApi_nativeSetDefaultFramebufferActive(
509     JNIEnv* env,
510     jobject jcaller,
511     jlong nativeGvrContext);
512 
513 JNI_GENERATOR_EXPORT jobject
514 Java_com_google_vr_ndk_base_GvrApi_nativeRenderReprojectionThread(
515     JNIEnv* env,
516     jobject jcaller,
517     jlong nativeGvrContext);
518 
519 JNI_GENERATOR_EXPORT void
520 Java_com_google_vr_ndk_base_GvrApi_nativeOnPauseReprojectionThread(
521     JNIEnv* env,
522     jobject jcaller,
523     jlong nativeGvrContext);
524 
525 JNI_GENERATOR_EXPORT void
526 Java_com_google_vr_ndk_base_GvrApi_nativeGetHeadSpaceFromStartSpaceRotation(
527     JNIEnv* env,
528     jobject jcaller,
529     jlong nativeGvrContext,
530     jfloatArray outRotation,
531     jlong timeNs);
532 
533 JNI_GENERATOR_EXPORT void
534 Java_com_google_vr_ndk_base_GvrApi_nativeGetHeadSpaceFromStartSpaceTransform(
535     JNIEnv* env,
536     jobject jcaller,
537     jlong nativeGvrContext,
538     jfloatArray outTransform,
539     jlong timeNs);
540 
541 JNI_GENERATOR_EXPORT void
542 Java_com_google_vr_ndk_base_GvrApi_nativeSetIgnoreManualPauseResumeTracker(
543     JNIEnv* env,
544     jobject jcaller,
545     jlong nativeGvrContext,
546     jboolean shouldIgnore);
547 
548 JNI_GENERATOR_EXPORT void
549 Java_com_google_vr_ndk_base_GvrApi_nativePauseTracking(JNIEnv* env,
550                                                        jobject jcaller,
551                                                        jlong nativeGvrContext);
552 
553 JNI_GENERATOR_EXPORT jbyteArray
554 Java_com_google_vr_ndk_base_GvrApi_nativePauseTrackingGetState(
555     JNIEnv* env,
556     jobject jcaller,
557     jlong nativeGvrContext);
558 
559 JNI_GENERATOR_EXPORT void
560 Java_com_google_vr_ndk_base_GvrApi_nativeResumeTracking(JNIEnv* env,
561                                                         jobject jcaller,
562                                                         jlong nativeGvrContext);
563 
564 JNI_GENERATOR_EXPORT void
565 Java_com_google_vr_ndk_base_GvrApi_nativeResumeTrackingSetState(
566     JNIEnv* env,
567     jobject jcaller,
568     jlong nativeGvrContext,
569     jbyteArray trackerStateBytes);
570 
571 JNI_GENERATOR_EXPORT void
572 Java_com_google_vr_ndk_base_GvrApi_nativeResetTracking(JNIEnv* env,
573                                                        jobject jcaller,
574                                                        jlong nativeGvrContext);
575 
576 JNI_GENERATOR_EXPORT void
577 Java_com_google_vr_ndk_base_GvrApi_nativeRecenterTracking(
578     JNIEnv* env,
579     jobject jcaller,
580     jlong nativeGvrContext);
581 
582 JNI_GENERATOR_EXPORT void
583 Java_com_google_vr_ndk_base_GvrApi_nativeGetEyeFromHeadMatrix(
584     JNIEnv* env,
585     jobject jcaller,
586     jlong nativeGvrContext,
587     jint eye,
588     jfloatArray out);
589 
590 JNI_GENERATOR_EXPORT jintArray
591 Java_com_google_vr_ndk_base_GvrApi_nativeGetWindowBounds(
592     JNIEnv* env,
593     jobject jcaller,
594     jlong nativeGvrContext);
595 
596 JNI_GENERATOR_EXPORT jfloatArray
597 Java_com_google_vr_ndk_base_GvrApi_nativeComputeDistortedPoint(
598     JNIEnv* env,
599     jobject jcaller,
600     jlong nativeGvrContext,
601     jint eyeType,
602     jfloatArray uvIn);
603 
604 JNI_GENERATOR_EXPORT jboolean
605 Java_com_google_vr_ndk_base_GvrApi_nativeSetDefaultViewerProfile(
606     JNIEnv* env,
607     jobject jcaller,
608     jlong nativeGvrContext,
609     jstring viewerProfileUri);
610 
611 JNI_GENERATOR_EXPORT jstring
612 Java_com_google_vr_ndk_base_GvrApi_nativeGetViewerVendor(
613     JNIEnv* env,
614     jobject jcaller,
615     jlong nativeGvrContext);
616 
617 JNI_GENERATOR_EXPORT jstring
618 Java_com_google_vr_ndk_base_GvrApi_nativeGetViewerModel(JNIEnv* env,
619                                                         jobject jcaller,
620                                                         jlong nativeGvrContext);
621 
622 JNI_GENERATOR_EXPORT jint
623 Java_com_google_vr_ndk_base_GvrApi_nativeGetViewerType(JNIEnv* env,
624                                                        jobject jcaller,
625                                                        jlong nativeGvrContext);
626 
627 JNI_GENERATOR_EXPORT jboolean
628 Java_com_google_vr_ndk_base_GvrApi_nativeSetAsyncReprojectionEnabled(
629     JNIEnv* env,
630     jobject jcaller,
631     jlong nativeGvrContext,
632     jboolean enabled);
633 
634 JNI_GENERATOR_EXPORT jboolean
635 Java_com_google_vr_ndk_base_GvrApi_nativeGetAsyncReprojectionEnabled(
636     JNIEnv* env,
637     jobject jcaller,
638     jlong nativeGvrContext);
639 
640 JNI_GENERATOR_EXPORT jboolean
641 Java_com_google_vr_ndk_base_GvrApi_nativeIsFeatureSupported(
642     JNIEnv* env,
643     jobject jcaller,
644     jlong nativeGvrContext,
645     jint feature);
646 
647 JNI_GENERATOR_EXPORT void
648 Java_com_google_vr_ndk_base_GvrApi_nativeReconnectSensors(
649     JNIEnv* env,
650     jobject jcaller,
651     jlong nativeGvrContext);
652 
653 JNI_GENERATOR_EXPORT void
654 Java_com_google_vr_ndk_base_GvrApi_nativeSetIdleListener(JNIEnv* env,
655                                                          jobject jcaller,
656                                                          jlong nativeGvrContext,
657                                                          jobject idleListener);
658 
659 JNI_GENERATOR_EXPORT jboolean
660 Java_com_google_vr_ndk_base_GvrApi_nativeSetViewerParams(
661     JNIEnv* env,
662     jobject jcaller,
663     jlong nativeGvrContext,
664     jbyteArray serializedViewerParams);
665 
666 JNI_GENERATOR_EXPORT void
667 Java_com_google_vr_ndk_base_GvrApi_nativeSetDisplayMetrics(
668     JNIEnv* env,
669     jobject jcaller,
670     jlong nativeGvrContext,
671     jint widthPixels,
672     jint heightPixels,
673     jfloat xDpi,
674     jfloat yDpi);
675 
676 JNI_GENERATOR_EXPORT jfloat
677 Java_com_google_vr_ndk_base_GvrApi_nativeGetBorderSizeMeters(
678     JNIEnv* env,
679     jobject jcaller,
680     jlong nativeGvrContext);
681 
682 JNI_GENERATOR_EXPORT void
683 Java_com_google_vr_ndk_base_GvrApi_nativeSetSurfaceSize(
684     JNIEnv* env,
685     jobject jcaller,
686     jlong nativeGvrContext,
687     jint surfaceWidthPixels,
688     jint surfaceHeightPixels);
689 
690 JNI_GENERATOR_EXPORT void
691 Java_com_google_vr_ndk_base_GvrApi_nativeSetLensOffset(JNIEnv* env,
692                                                        jobject jcaller,
693                                                        jlong nativeGvrContext,
694                                                        jfloat x,
695                                                        jfloat y,
696                                                        jfloat rotation);
697 
698 JNI_GENERATOR_EXPORT void
699 Java_com_google_vr_ndk_base_GvrApi_nativeDumpDebugData(JNIEnv* env,
700                                                        jobject jcaller,
701                                                        jlong nativeGvrContext);
702 
703 JNI_GENERATOR_EXPORT jboolean
704 Java_com_google_vr_ndk_base_GvrApi_nativeUsingVrDisplayService(
705     JNIEnv* env,
706     jobject jcaller,
707     jlong nativeGvrContext);
708 
709 JNI_GENERATOR_EXPORT jlong
710 Java_com_google_vr_ndk_base_GvrApi_nativeCreateEvent(JNIEnv* env, jclass clazz);
711 
712 JNI_GENERATOR_EXPORT jlong
713 Java_com_google_vr_ndk_base_GvrApi_nativeCreateValue(JNIEnv* env, jclass clazz);
714 
715 JNI_GENERATOR_EXPORT void Java_com_google_vr_ndk_base_GvrApi_nativeDestroyEvent(
716     JNIEnv* env,
717     jclass clazz,
718     jlong native_object);
719 
720 JNI_GENERATOR_EXPORT void Java_com_google_vr_ndk_base_GvrApi_nativeDestroyValue(
721     JNIEnv* env,
722     jclass clazz,
723     jlong native_object);
724 
725 JNI_GENERATOR_EXPORT jlong
726 Java_com_google_vr_ndk_base_GvrApi_nativeGetCurrentProperties(
727     JNIEnv* env,
728     jobject object,
729     jlong native_object);
730 
731 JNI_GENERATOR_EXPORT jlong
732 Java_com_google_vr_ndk_base_GvrApi_nativeGetEventFlags(JNIEnv* env,
733                                                        jclass clazz,
734                                                        jlong native_object);
735 
736 JNI_GENERATOR_EXPORT jlong
737 Java_com_google_vr_ndk_base_GvrApi_nativeGetEventTimestamp(JNIEnv* env,
738                                                            jclass clazz,
739                                                            jlong native_object);
740 
741 JNI_GENERATOR_EXPORT jint
742 Java_com_google_vr_ndk_base_GvrApi_nativeGetEventType(JNIEnv* env,
743                                                       jclass clazz,
744                                                       jlong native_object);
745 
746 JNI_GENERATOR_EXPORT jboolean
747 Java_com_google_vr_ndk_base_GvrApi_nativeGetProperty(JNIEnv* env,
748                                                      jclass clazz,
749                                                      jlong native_properties,
750                                                      jint property_key,
751                                                      jlong native_value);
752 
753 JNI_GENERATOR_EXPORT jlong
754 Java_com_google_vr_ndk_base_GvrApi_nativeGetRecenterEventFlags(
755     JNIEnv* env,
756     jclass clazz,
757     jlong native_object);
758 
759 JNI_GENERATOR_EXPORT void
760 Java_com_google_vr_ndk_base_GvrApi_nativeGetRecenterEventStartSpaceFromTrackingSpaceTransform(
761     JNIEnv* env,
762     jclass clazz,
763     jlong native_object,
764     jfloatArray rotation_out_array);
765 
766 JNI_GENERATOR_EXPORT jint
767 Java_com_google_vr_ndk_base_GvrApi_nativeGetRecenterEventType(
768     JNIEnv* env,
769     jclass clazz,
770     jlong native_object);
771 
772 JNI_GENERATOR_EXPORT jboolean
773 Java_com_google_vr_ndk_base_GvrApi_nativePollEvent(JNIEnv* env,
774                                                    jobject object,
775                                                    jlong native_object,
776                                                    jlong event_out);
777 
778 JNI_GENERATOR_EXPORT jlong
779 Java_com_google_vr_ndk_base_GvrApi_nativeValueAsFlags(JNIEnv* env,
780                                                       jclass clazz,
781                                                       jlong native_object);
782 
783 JNI_GENERATOR_EXPORT jfloat
784 Java_com_google_vr_ndk_base_GvrApi_nativeValueAsFloat(JNIEnv* env,
785                                                       jclass clazz,
786                                                       jlong native_object);
787 
788 JNI_GENERATOR_EXPORT jint
789 Java_com_google_vr_ndk_base_GvrApi_nativeValueAsInt(JNIEnv* env,
790                                                     jclass clazz,
791                                                     jlong native_object);
792 
793 JNI_GENERATOR_EXPORT void Java_com_google_vr_ndk_base_GvrApi_nativeValueAsMat4f(
794     JNIEnv* env,
795     jclass clazz,
796     jlong native_object,
797     jfloatArray mat4_out_array);
798 
799 JNI_GENERATOR_EXPORT jlong
800 Java_com_google_vr_ndk_base_GvrApi_nativeValueGetFlags(JNIEnv* env,
801                                                        jclass clazz,
802                                                        jlong native_object);
803 
804 // Step 3: RegisterNatives.
805 
806 static const JNINativeMethod kMethodsGvrApi[] = {
807     {"nativeBufferViewportListCreate",
808      "("
809      "J"
810      ")"
811      "J",
812      reinterpret_cast<void*>(
813          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportListCreate)},
814     {"nativeBufferViewportListDestroy",
815      "("
816      "J"
817      ")"
818      "V",
819      reinterpret_cast<void*>(
820          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportListDestroy)},
821     {"nativeBufferViewportListGetSize",
822      "("
823      "J"
824      ")"
825      "I",
826      reinterpret_cast<void*>(
827          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportListGetSize)},
828     {"nativeBufferViewportListGetItem",
829      "("
830      "J"
831      "I"
832      "J"
833      ")"
834      "V",
835      reinterpret_cast<void*>(
836          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportListGetItem)},
837     {"nativeBufferViewportListSetItem",
838      "("
839      "J"
840      "I"
841      "J"
842      ")"
843      "V",
844      reinterpret_cast<void*>(
845          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportListSetItem)},
846     {"nativeBufferViewportCreate",
847      "("
848      "J"
849      ")"
850      "J",
851      reinterpret_cast<void*>(
852          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportCreate)},
853     {"nativeBufferViewportDestroy",
854      "("
855      "J"
856      ")"
857      "V",
858      reinterpret_cast<void*>(
859          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportDestroy)},
860     {"nativeBufferViewportGetSourceUv",
861      "("
862      "J"
863      "Landroid/graphics/RectF;"
864      ")"
865      "V",
866      reinterpret_cast<void*>(
867          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportGetSourceUv)},
868     {"nativeBufferViewportSetSourceUv",
869      "("
870      "J"
871      "F"
872      "F"
873      "F"
874      "F"
875      ")"
876      "V",
877      reinterpret_cast<void*>(
878          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportSetSourceUv)},
879     {"nativeBufferViewportGetSourceFov",
880      "("
881      "J"
882      "Landroid/graphics/RectF;"
883      ")"
884      "V",
885      reinterpret_cast<void*>(
886          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportGetSourceFov)},
887     {"nativeBufferViewportSetSourceFov",
888      "("
889      "J"
890      "F"
891      "F"
892      "F"
893      "F"
894      ")"
895      "V",
896      reinterpret_cast<void*>(
897          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportSetSourceFov)},
898     {"nativeBufferViewportGetTransform",
899      "("
900      "J"
901      "[F"
902      ")"
903      "V",
904      reinterpret_cast<void*>(
905          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportGetTransform)},
906     {"nativeBufferViewportSetTransform",
907      "("
908      "J"
909      "[F"
910      ")"
911      "V",
912      reinterpret_cast<void*>(
913          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportSetTransform)},
914     {"nativeBufferViewportEqual",
915      "("
916      "J"
917      "J"
918      ")"
919      "Z",
920      reinterpret_cast<void*>(
921          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportEqual)},
922     {"nativeBufferViewportGetTargetEye",
923      "("
924      "J"
925      ")"
926      "I",
927      reinterpret_cast<void*>(
928          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportGetTargetEye)},
929     {"nativeBufferViewportSetTargetEye",
930      "("
931      "J"
932      "I"
933      ")"
934      "V",
935      reinterpret_cast<void*>(
936          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportSetTargetEye)},
937     {"nativeBufferViewportGetSourceBufferIndex",
938      "("
939      "J"
940      ")"
941      "I",
942      reinterpret_cast<void*>(
943          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportGetSourceBufferIndex)},
944     {"nativeBufferViewportSetSourceBufferIndex",
945      "("
946      "J"
947      "I"
948      ")"
949      "V",
950      reinterpret_cast<void*>(
951          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportSetSourceBufferIndex)},
952     {"nativeBufferViewportGetExternalSurfaceId",
953      "("
954      "J"
955      ")"
956      "I",
957      reinterpret_cast<void*>(
958          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportGetExternalSurfaceId)},
959     {"nativeBufferViewportSetExternalSurfaceId",
960      "("
961      "J"
962      "I"
963      ")"
964      "V",
965      reinterpret_cast<void*>(
966          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportSetExternalSurfaceId)},
967     {"nativeBufferViewportSetExternalSurface",
968      "("
969      "J"
970      "J"
971      ")"
972      "V",
973      reinterpret_cast<void*>(
974          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportSetExternalSurface)},
975     {"nativeBufferViewportGetReprojection",
976      "("
977      "J"
978      ")"
979      "I",
980      reinterpret_cast<void*>(
981          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportGetReprojection)},
982     {"nativeBufferViewportSetReprojection",
983      "("
984      "J"
985      "I"
986      ")"
987      "V",
988      reinterpret_cast<void*>(
989          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportSetReprojection)},
990     {"nativeBufferViewportSetSourceLayer",
991      "("
992      "J"
993      "I"
994      ")"
995      "V",
996      reinterpret_cast<void*>(
997          Java_com_google_vr_ndk_base_GvrApi_nativeBufferViewportSetSourceLayer)},
998     {"nativeBufferSpecCreate",
999      "("
1000      "J"
1001      ")"
1002      "J",
1003      reinterpret_cast<void*>(
1004          Java_com_google_vr_ndk_base_GvrApi_nativeBufferSpecCreate)},
1005     {"nativeBufferSpecDestroy",
1006      "("
1007      "J"
1008      ")"
1009      "V",
1010      reinterpret_cast<void*>(
1011          Java_com_google_vr_ndk_base_GvrApi_nativeBufferSpecDestroy)},
1012     {"nativeBufferSpecGetSize",
1013      "("
1014      "J"
1015      "Landroid/graphics/Point;"
1016      ")"
1017      "V",
1018      reinterpret_cast<void*>(
1019          Java_com_google_vr_ndk_base_GvrApi_nativeBufferSpecGetSize)},
1020     {"nativeBufferSpecSetSize",
1021      "("
1022      "J"
1023      "I"
1024      "I"
1025      ")"
1026      "V",
1027      reinterpret_cast<void*>(
1028          Java_com_google_vr_ndk_base_GvrApi_nativeBufferSpecSetSize)},
1029     {"nativeBufferSpecSetColorFormat",
1030      "("
1031      "J"
1032      "I"
1033      ")"
1034      "V",
1035      reinterpret_cast<void*>(
1036          Java_com_google_vr_ndk_base_GvrApi_nativeBufferSpecSetColorFormat)},
1037     {"nativeBufferSpecSetDepthStencilFormat",
1038      "("
1039      "J"
1040      "I"
1041      ")"
1042      "V",
1043      reinterpret_cast<void*>(
1044          Java_com_google_vr_ndk_base_GvrApi_nativeBufferSpecSetDepthStencilFormat)},
1045     {"nativeBufferSpecSetMultiviewLayers",
1046      "("
1047      "J"
1048      "I"
1049      ")"
1050      "V",
1051      reinterpret_cast<void*>(
1052          Java_com_google_vr_ndk_base_GvrApi_nativeBufferSpecSetMultiviewLayers)},
1053     {"nativeBufferSpecGetSamples",
1054      "("
1055      "J"
1056      ")"
1057      "I",
1058      reinterpret_cast<void*>(
1059          Java_com_google_vr_ndk_base_GvrApi_nativeBufferSpecGetSamples)},
1060     {"nativeBufferSpecSetSamples",
1061      "("
1062      "J"
1063      "I"
1064      ")"
1065      "V",
1066      reinterpret_cast<void*>(
1067          Java_com_google_vr_ndk_base_GvrApi_nativeBufferSpecSetSamples)},
1068     {"nativeExternalSurfaceCreateWithListeners",
1069      "("
1070      "J"
1071      "Ljava/lang/Runnable;"
1072      "Ljava/lang/Runnable;"
1073      "Landroid/os/Handler;"
1074      ")"
1075      "J",
1076      reinterpret_cast<void*>(
1077          Java_com_google_vr_ndk_base_GvrApi_nativeExternalSurfaceCreateWithListeners)},
1078     {"nativeExternalSurfaceDestroy",
1079      "("
1080      "J"
1081      ")"
1082      "V",
1083      reinterpret_cast<void*>(
1084          Java_com_google_vr_ndk_base_GvrApi_nativeExternalSurfaceDestroy)},
1085     {"nativeExternalSurfaceGetId",
1086      "("
1087      "J"
1088      ")"
1089      "I",
1090      reinterpret_cast<void*>(
1091          Java_com_google_vr_ndk_base_GvrApi_nativeExternalSurfaceGetId)},
1092     {"nativeExternalSurfaceGetSurface",
1093      "("
1094      "J"
1095      ")"
1096      "Landroid/view/Surface;",
1097      reinterpret_cast<void*>(
1098          Java_com_google_vr_ndk_base_GvrApi_nativeExternalSurfaceGetSurface)},
1099     {"nativeSwapChainCreate",
1100      "("
1101      "J"
1102      "[J"
1103      ")"
1104      "J",
1105      reinterpret_cast<void*>(
1106          Java_com_google_vr_ndk_base_GvrApi_nativeSwapChainCreate)},
1107     {"nativeSwapChainDestroy",
1108      "("
1109      "J"
1110      ")"
1111      "V",
1112      reinterpret_cast<void*>(
1113          Java_com_google_vr_ndk_base_GvrApi_nativeSwapChainDestroy)},
1114     {"nativeSwapChainGetBufferCount",
1115      "("
1116      "J"
1117      ")"
1118      "I",
1119      reinterpret_cast<void*>(
1120          Java_com_google_vr_ndk_base_GvrApi_nativeSwapChainGetBufferCount)},
1121     {"nativeSwapChainGetBufferSize",
1122      "("
1123      "J"
1124      "I"
1125      "Landroid/graphics/Point;"
1126      ")"
1127      "V",
1128      reinterpret_cast<void*>(
1129          Java_com_google_vr_ndk_base_GvrApi_nativeSwapChainGetBufferSize)},
1130     {"nativeSwapChainResizeBuffer",
1131      "("
1132      "J"
1133      "I"
1134      "I"
1135      "I"
1136      ")"
1137      "V",
1138      reinterpret_cast<void*>(
1139          Java_com_google_vr_ndk_base_GvrApi_nativeSwapChainResizeBuffer)},
1140     {"nativeSwapChainAcquireFrame",
1141      "("
1142      "J"
1143      ")"
1144      "J",
1145      reinterpret_cast<void*>(
1146          Java_com_google_vr_ndk_base_GvrApi_nativeSwapChainAcquireFrame)},
1147     {"nativeFrameBindBuffer",
1148      "("
1149      "J"
1150      "I"
1151      ")"
1152      "V",
1153      reinterpret_cast<void*>(
1154          Java_com_google_vr_ndk_base_GvrApi_nativeFrameBindBuffer)},
1155     {"nativeFrameUnbind",
1156      "("
1157      "J"
1158      ")"
1159      "V",
1160      reinterpret_cast<void*>(
1161          Java_com_google_vr_ndk_base_GvrApi_nativeFrameUnbind)},
1162     {"nativeFrameGetFramebufferObject",
1163      "("
1164      "J"
1165      "I"
1166      ")"
1167      "I",
1168      reinterpret_cast<void*>(
1169          Java_com_google_vr_ndk_base_GvrApi_nativeFrameGetFramebufferObject)},
1170     {"nativeFrameGetBufferSize",
1171      "("
1172      "J"
1173      "I"
1174      "Landroid/graphics/Point;"
1175      ")"
1176      "V",
1177      reinterpret_cast<void*>(
1178          Java_com_google_vr_ndk_base_GvrApi_nativeFrameGetBufferSize)},
1179     {"nativeFrameSubmit",
1180      "("
1181      "J"
1182      "J"
1183      "[F"
1184      ")"
1185      "V",
1186      reinterpret_cast<void*>(
1187          Java_com_google_vr_ndk_base_GvrApi_nativeFrameSubmit)},
1188     {"nativeUsingDynamicLibrary",
1189      "("
1190      ")"
1191      "Z",
1192      reinterpret_cast<void*>(
1193          Java_com_google_vr_ndk_base_GvrApi_nativeUsingDynamicLibrary)},
1194     {"nativeUsingShimLibrary",
1195      "("
1196      ")"
1197      "Z",
1198      reinterpret_cast<void*>(
1199          Java_com_google_vr_ndk_base_GvrApi_nativeUsingShimLibrary)},
1200     {"nativeSetApplicationState",
1201      "("
1202      "Ljava/lang/ClassLoader;"
1203      "Landroid/content/Context;"
1204      ")"
1205      "V",
1206      reinterpret_cast<void*>(
1207          Java_com_google_vr_ndk_base_GvrApi_nativeSetApplicationState)},
1208     {"nativeSetDynamicLibraryLoadingEnabled",
1209      "("
1210      "Z"
1211      ")"
1212      "V",
1213      reinterpret_cast<void*>(
1214          Java_com_google_vr_ndk_base_GvrApi_nativeSetDynamicLibraryLoadingEnabled)},
1215     {"nativeCreate",
1216      "("
1217      "Ljava/lang/ClassLoader;"
1218      "Landroid/content/Context;"
1219      "J"
1220      "I"
1221      "I"
1222      "F"
1223      "F"
1224      "Lcom/google/vr/ndk/base/GvrApi$PoseTracker;"
1225      ")"
1226      "J",
1227      reinterpret_cast<void*>(Java_com_google_vr_ndk_base_GvrApi_nativeCreate)},
1228     {"nativeRequestContextSharing",
1229      "("
1230      "J"
1231      "Lcom/google/vr/cardboard/EglReadyListener;"
1232      ")"
1233      "V",
1234      reinterpret_cast<void*>(
1235          Java_com_google_vr_ndk_base_GvrApi_nativeRequestContextSharing)},
1236     {"nativeGetError",
1237      "("
1238      "J"
1239      ")"
1240      "I",
1241      reinterpret_cast<void*>(
1242          Java_com_google_vr_ndk_base_GvrApi_nativeGetError)},
1243     {"nativeClearError",
1244      "("
1245      "J"
1246      ")"
1247      "I",
1248      reinterpret_cast<void*>(
1249          Java_com_google_vr_ndk_base_GvrApi_nativeClearError)},
1250     {"nativeGetErrorString",
1251      "("
1252      "I"
1253      ")"
1254      "Ljava/lang/String;",
1255      reinterpret_cast<void*>(
1256          Java_com_google_vr_ndk_base_GvrApi_nativeGetErrorString)},
1257     {"nativeGetUserPrefs",
1258      "("
1259      "J"
1260      ")"
1261      "J",
1262      reinterpret_cast<void*>(
1263          Java_com_google_vr_ndk_base_GvrApi_nativeGetUserPrefs)},
1264     {"nativeUserPrefsGetControllerHandedness",
1265      "("
1266      "J"
1267      ")"
1268      "I",
1269      reinterpret_cast<void*>(
1270          Java_com_google_vr_ndk_base_GvrApi_nativeUserPrefsGetControllerHandedness)},
1271     {"nativePause",
1272      "("
1273      "J"
1274      ")"
1275      "V",
1276      reinterpret_cast<void*>(Java_com_google_vr_ndk_base_GvrApi_nativePause)},
1277     {"nativeResume",
1278      "("
1279      "J"
1280      ")"
1281      "V",
1282      reinterpret_cast<void*>(Java_com_google_vr_ndk_base_GvrApi_nativeResume)},
1283     {"nativeReleaseGvrContext",
1284      "("
1285      "J"
1286      ")"
1287      "V",
1288      reinterpret_cast<void*>(
1289          Java_com_google_vr_ndk_base_GvrApi_nativeReleaseGvrContext)},
1290     {"nativeInitializeGl",
1291      "("
1292      "J"
1293      ")"
1294      "V",
1295      reinterpret_cast<void*>(
1296          Java_com_google_vr_ndk_base_GvrApi_nativeInitializeGl)},
1297     {"nativeOnSurfaceCreatedReprojectionThread",
1298      "("
1299      "J"
1300      ")"
1301      "V",
1302      reinterpret_cast<void*>(
1303          Java_com_google_vr_ndk_base_GvrApi_nativeOnSurfaceCreatedReprojectionThread)},
1304     {"nativeOnSurfaceChangedReprojectionThread",
1305      "("
1306      "J"
1307      ")"
1308      "V",
1309      reinterpret_cast<void*>(
1310          Java_com_google_vr_ndk_base_GvrApi_nativeOnSurfaceChangedReprojectionThread)},
1311     {"nativeGetRecommendedBufferViewports",
1312      "("
1313      "J"
1314      "J"
1315      ")"
1316      "V",
1317      reinterpret_cast<void*>(
1318          Java_com_google_vr_ndk_base_GvrApi_nativeGetRecommendedBufferViewports)},
1319     {"nativeGetScreenBufferViewports",
1320      "("
1321      "J"
1322      "J"
1323      ")"
1324      "V",
1325      reinterpret_cast<void*>(
1326          Java_com_google_vr_ndk_base_GvrApi_nativeGetScreenBufferViewports)},
1327     {"nativeGetMaximumEffectiveRenderTargetSize",
1328      "("
1329      "J"
1330      "Landroid/graphics/Point;"
1331      ")"
1332      "V",
1333      reinterpret_cast<void*>(
1334          Java_com_google_vr_ndk_base_GvrApi_nativeGetMaximumEffectiveRenderTargetSize)},
1335     {"nativeGetScreenTargetSize",
1336      "("
1337      "J"
1338      "Landroid/graphics/Point;"
1339      ")"
1340      "V",
1341      reinterpret_cast<void*>(
1342          Java_com_google_vr_ndk_base_GvrApi_nativeGetScreenTargetSize)},
1343     {"nativeDistortToScreen",
1344      "("
1345      "J"
1346      "I"
1347      "J"
1348      "[F"
1349      "J"
1350      ")"
1351      "V",
1352      reinterpret_cast<void*>(
1353          Java_com_google_vr_ndk_base_GvrApi_nativeDistortToScreen)},
1354     {"nativeSetDefaultFramebufferActive",
1355      "("
1356      "J"
1357      ")"
1358      "V",
1359      reinterpret_cast<void*>(
1360          Java_com_google_vr_ndk_base_GvrApi_nativeSetDefaultFramebufferActive)},
1361     {"nativeRenderReprojectionThread",
1362      "("
1363      "J"
1364      ")"
1365      "Landroid/graphics/Point;",
1366      reinterpret_cast<void*>(
1367          Java_com_google_vr_ndk_base_GvrApi_nativeRenderReprojectionThread)},
1368     {"nativeOnPauseReprojectionThread",
1369      "("
1370      "J"
1371      ")"
1372      "V",
1373      reinterpret_cast<void*>(
1374          Java_com_google_vr_ndk_base_GvrApi_nativeOnPauseReprojectionThread)},
1375     {"nativeGetHeadSpaceFromStartSpaceRotation",
1376      "("
1377      "J"
1378      "[F"
1379      "J"
1380      ")"
1381      "V",
1382      reinterpret_cast<void*>(
1383          Java_com_google_vr_ndk_base_GvrApi_nativeGetHeadSpaceFromStartSpaceRotation)},
1384     {"nativeGetHeadSpaceFromStartSpaceTransform",
1385      "("
1386      "J"
1387      "[F"
1388      "J"
1389      ")"
1390      "V",
1391      reinterpret_cast<void*>(
1392          Java_com_google_vr_ndk_base_GvrApi_nativeGetHeadSpaceFromStartSpaceTransform)},
1393     {"nativeSetIgnoreManualPauseResumeTracker",
1394      "("
1395      "J"
1396      "Z"
1397      ")"
1398      "V",
1399      reinterpret_cast<void*>(
1400          Java_com_google_vr_ndk_base_GvrApi_nativeSetIgnoreManualPauseResumeTracker)},
1401     {"nativePauseTracking",
1402      "("
1403      "J"
1404      ")"
1405      "V",
1406      reinterpret_cast<void*>(
1407          Java_com_google_vr_ndk_base_GvrApi_nativePauseTracking)},
1408     {"nativePauseTrackingGetState",
1409      "("
1410      "J"
1411      ")"
1412      "[B",
1413      reinterpret_cast<void*>(
1414          Java_com_google_vr_ndk_base_GvrApi_nativePauseTrackingGetState)},
1415     {"nativeResumeTracking",
1416      "("
1417      "J"
1418      ")"
1419      "V",
1420      reinterpret_cast<void*>(
1421          Java_com_google_vr_ndk_base_GvrApi_nativeResumeTracking)},
1422     {"nativeResumeTrackingSetState",
1423      "("
1424      "J"
1425      "[B"
1426      ")"
1427      "V",
1428      reinterpret_cast<void*>(
1429          Java_com_google_vr_ndk_base_GvrApi_nativeResumeTrackingSetState)},
1430     {"nativeResetTracking",
1431      "("
1432      "J"
1433      ")"
1434      "V",
1435      reinterpret_cast<void*>(
1436          Java_com_google_vr_ndk_base_GvrApi_nativeResetTracking)},
1437     {"nativeRecenterTracking",
1438      "("
1439      "J"
1440      ")"
1441      "V",
1442      reinterpret_cast<void*>(
1443          Java_com_google_vr_ndk_base_GvrApi_nativeRecenterTracking)},
1444     {"nativeGetEyeFromHeadMatrix",
1445      "("
1446      "J"
1447      "I"
1448      "[F"
1449      ")"
1450      "V",
1451      reinterpret_cast<void*>(
1452          Java_com_google_vr_ndk_base_GvrApi_nativeGetEyeFromHeadMatrix)},
1453     {"nativeGetWindowBounds",
1454      "("
1455      "J"
1456      ")"
1457      "[I",
1458      reinterpret_cast<void*>(
1459          Java_com_google_vr_ndk_base_GvrApi_nativeGetWindowBounds)},
1460     {"nativeComputeDistortedPoint",
1461      "("
1462      "J"
1463      "I"
1464      "[F"
1465      ")"
1466      "[F",
1467      reinterpret_cast<void*>(
1468          Java_com_google_vr_ndk_base_GvrApi_nativeComputeDistortedPoint)},
1469     {"nativeSetDefaultViewerProfile",
1470      "("
1471      "J"
1472      "Ljava/lang/String;"
1473      ")"
1474      "Z",
1475      reinterpret_cast<void*>(
1476          Java_com_google_vr_ndk_base_GvrApi_nativeSetDefaultViewerProfile)},
1477     {"nativeGetViewerVendor",
1478      "("
1479      "J"
1480      ")"
1481      "Ljava/lang/String;",
1482      reinterpret_cast<void*>(
1483          Java_com_google_vr_ndk_base_GvrApi_nativeGetViewerVendor)},
1484     {"nativeGetViewerModel",
1485      "("
1486      "J"
1487      ")"
1488      "Ljava/lang/String;",
1489      reinterpret_cast<void*>(
1490          Java_com_google_vr_ndk_base_GvrApi_nativeGetViewerModel)},
1491     {"nativeGetViewerType",
1492      "("
1493      "J"
1494      ")"
1495      "I",
1496      reinterpret_cast<void*>(
1497          Java_com_google_vr_ndk_base_GvrApi_nativeGetViewerType)},
1498     {"nativeSetAsyncReprojectionEnabled",
1499      "("
1500      "J"
1501      "Z"
1502      ")"
1503      "Z",
1504      reinterpret_cast<void*>(
1505          Java_com_google_vr_ndk_base_GvrApi_nativeSetAsyncReprojectionEnabled)},
1506     {"nativeGetAsyncReprojectionEnabled",
1507      "("
1508      "J"
1509      ")"
1510      "Z",
1511      reinterpret_cast<void*>(
1512          Java_com_google_vr_ndk_base_GvrApi_nativeGetAsyncReprojectionEnabled)},
1513     {"nativeIsFeatureSupported",
1514      "("
1515      "J"
1516      "I"
1517      ")"
1518      "Z",
1519      reinterpret_cast<void*>(
1520          Java_com_google_vr_ndk_base_GvrApi_nativeIsFeatureSupported)},
1521     {"nativeReconnectSensors",
1522      "("
1523      "J"
1524      ")"
1525      "V",
1526      reinterpret_cast<void*>(
1527          Java_com_google_vr_ndk_base_GvrApi_nativeReconnectSensors)},
1528     {"nativeSetIdleListener",
1529      "("
1530      "J"
1531      "Lcom/google/vr/ndk/base/GvrApi$IdleListener;"
1532      ")"
1533      "V",
1534      reinterpret_cast<void*>(
1535          Java_com_google_vr_ndk_base_GvrApi_nativeSetIdleListener)},
1536     {"nativeSetViewerParams",
1537      "("
1538      "J"
1539      "[B"
1540      ")"
1541      "Z",
1542      reinterpret_cast<void*>(
1543          Java_com_google_vr_ndk_base_GvrApi_nativeSetViewerParams)},
1544     {"nativeSetDisplayMetrics",
1545      "("
1546      "J"
1547      "I"
1548      "I"
1549      "F"
1550      "F"
1551      ")"
1552      "V",
1553      reinterpret_cast<void*>(
1554          Java_com_google_vr_ndk_base_GvrApi_nativeSetDisplayMetrics)},
1555     {"nativeGetBorderSizeMeters",
1556      "("
1557      "J"
1558      ")"
1559      "F",
1560      reinterpret_cast<void*>(
1561          Java_com_google_vr_ndk_base_GvrApi_nativeGetBorderSizeMeters)},
1562     {"nativeSetSurfaceSize",
1563      "("
1564      "J"
1565      "I"
1566      "I"
1567      ")"
1568      "V",
1569      reinterpret_cast<void*>(
1570          Java_com_google_vr_ndk_base_GvrApi_nativeSetSurfaceSize)},
1571     {"nativeSetLensOffset",
1572      "("
1573      "J"
1574      "F"
1575      "F"
1576      "F"
1577      ")"
1578      "V",
1579      reinterpret_cast<void*>(
1580          Java_com_google_vr_ndk_base_GvrApi_nativeSetLensOffset)},
1581     {"nativeDumpDebugData",
1582      "("
1583      "J"
1584      ")"
1585      "V",
1586      reinterpret_cast<void*>(
1587          Java_com_google_vr_ndk_base_GvrApi_nativeDumpDebugData)},
1588     {"nativeUsingVrDisplayService",
1589      "("
1590      "J"
1591      ")"
1592      "Z",
1593      reinterpret_cast<void*>(
1594          Java_com_google_vr_ndk_base_GvrApi_nativeUsingVrDisplayService)},
1595     {"nativeCreateEvent",
1596      "("
1597      ")"
1598      "J",
1599      reinterpret_cast<void*>(
1600          Java_com_google_vr_ndk_base_GvrApi_nativeCreateEvent)},
1601     {"nativeCreateValue",
1602      "("
1603      ")"
1604      "J",
1605      reinterpret_cast<void*>(
1606          Java_com_google_vr_ndk_base_GvrApi_nativeCreateValue)},
1607     {"nativeDestroyEvent",
1608      "("
1609      "J"
1610      ")"
1611      "V",
1612      reinterpret_cast<void*>(
1613          Java_com_google_vr_ndk_base_GvrApi_nativeDestroyEvent)},
1614     {"nativeDestroyValue",
1615      "("
1616      "J"
1617      ")"
1618      "V",
1619      reinterpret_cast<void*>(
1620          Java_com_google_vr_ndk_base_GvrApi_nativeDestroyValue)},
1621     {"nativeGetCurrentProperties",
1622      "("
1623      "J"
1624      ")"
1625      "J",
1626      reinterpret_cast<void*>(
1627          Java_com_google_vr_ndk_base_GvrApi_nativeGetCurrentProperties)},
1628     {"nativeGetEventFlags",
1629      "("
1630      "J"
1631      ")"
1632      "J",
1633      reinterpret_cast<void*>(
1634          Java_com_google_vr_ndk_base_GvrApi_nativeGetEventFlags)},
1635     {"nativeGetEventTimestamp",
1636      "("
1637      "J"
1638      ")"
1639      "J",
1640      reinterpret_cast<void*>(
1641          Java_com_google_vr_ndk_base_GvrApi_nativeGetEventTimestamp)},
1642     {"nativeGetEventType",
1643      "("
1644      "J"
1645      ")"
1646      "I",
1647      reinterpret_cast<void*>(
1648          Java_com_google_vr_ndk_base_GvrApi_nativeGetEventType)},
1649     {"nativeGetProperty",
1650      "("
1651      "J"
1652      "I"
1653      "J"
1654      ")"
1655      "Z",
1656      reinterpret_cast<void*>(
1657          Java_com_google_vr_ndk_base_GvrApi_nativeGetProperty)},
1658     {"nativeGetRecenterEventFlags",
1659      "("
1660      "J"
1661      ")"
1662      "J",
1663      reinterpret_cast<void*>(
1664          Java_com_google_vr_ndk_base_GvrApi_nativeGetRecenterEventFlags)},
1665     {"nativeGetRecenterEventStartSpaceFromTrackingSpaceTransform",
1666      "("
1667      "J"
1668      "[F"
1669      ")"
1670      "V",
1671      reinterpret_cast<void*>(
1672          Java_com_google_vr_ndk_base_GvrApi_nativeGetRecenterEventStartSpaceFromTrackingSpaceTransform)},
1673     {"nativeGetRecenterEventType",
1674      "("
1675      "J"
1676      ")"
1677      "I",
1678      reinterpret_cast<void*>(
1679          Java_com_google_vr_ndk_base_GvrApi_nativeGetRecenterEventType)},
1680     {"nativePollEvent",
1681      "("
1682      "J"
1683      "J"
1684      ")"
1685      "Z",
1686      reinterpret_cast<void*>(
1687          Java_com_google_vr_ndk_base_GvrApi_nativePollEvent)},
1688     {"nativeValueAsFlags",
1689      "("
1690      "J"
1691      ")"
1692      "J",
1693      reinterpret_cast<void*>(
1694          Java_com_google_vr_ndk_base_GvrApi_nativeValueAsFlags)},
1695     {"nativeValueAsFloat",
1696      "("
1697      "J"
1698      ")"
1699      "F",
1700      reinterpret_cast<void*>(
1701          Java_com_google_vr_ndk_base_GvrApi_nativeValueAsFloat)},
1702     {"nativeValueAsInt",
1703      "("
1704      "J"
1705      ")"
1706      "I",
1707      reinterpret_cast<void*>(
1708          Java_com_google_vr_ndk_base_GvrApi_nativeValueAsInt)},
1709     {"nativeValueAsMat4f",
1710      "("
1711      "J"
1712      "[F"
1713      ")"
1714      "V",
1715      reinterpret_cast<void*>(
1716          Java_com_google_vr_ndk_base_GvrApi_nativeValueAsMat4f)},
1717     {"nativeValueGetFlags",
1718      "("
1719      "J"
1720      ")"
1721      "J",
1722      reinterpret_cast<void*>(
1723          Java_com_google_vr_ndk_base_GvrApi_nativeValueGetFlags)},
1724 };
1725 
RegisterNativesImpl(JNIEnv * env)1726 static bool RegisterNativesImpl(JNIEnv* env) {
1727   if (base::android::IsSelectiveJniRegistrationEnabled(env))
1728     return true;
1729 
1730   const int kMethodsGvrApiSize = std::extent<decltype(kMethodsGvrApi)>();
1731 
1732   if (env->RegisterNatives(GvrApi_clazz(env), kMethodsGvrApi,
1733                            kMethodsGvrApiSize) < 0) {
1734     jni_generator::HandleRegistrationError(env, GvrApi_clazz(env), __FILE__);
1735     return false;
1736   }
1737 
1738   return true;
1739 }
1740 
RegisterGvrApiNatives(JNIEnv * env)1741 static bool RegisterGvrApiNatives(JNIEnv* env) {
1742   return RegisterNativesImpl(env);
1743 }
1744 
1745 }  // namespace GvrApi
1746 
1747 #endif  // com_google_vr_ndk_base_GvrApi_JNI
1748