File: JniConstants.h

package info (click to toggle)
android-platform-libnativehelper 10.0.0%2Br36-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 480 kB
  • sloc: cpp: 3,177; ansic: 1,245; makefile: 28; xml: 11
file content (83 lines) | stat: -rw-r--r-- 3,049 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
 * Copyright 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#include "jni.h"

struct JniConstants {
    // Global reference to java.io.FileDescriptor.
    static jclass GetFileDescriptorClass(JNIEnv* env);

    // java.io.FileDescriptor.descriptor.
    static jfieldID GetFileDescriptorDescriptorField(JNIEnv* env);

    // java.io.FileDescriptor.ownerId.
    static jfieldID GetFileDescriptorOwnerIdField(JNIEnv* env);

    // void java.io.FileDescriptor.<init>().
    static jmethodID GetFileDescriptorInitMethod(JNIEnv* env);

    // Global reference to java.nio.NIOAccess.
    static jclass GetNioAccessClass(JNIEnv* env);

    // Object java.nio.NIOAccess.getBaseArray(Buffer);
    static jmethodID GetNioAccessGetBaseArrayMethod(JNIEnv* env);

    // int java.nio.NIOAccess.getBaseArrayOffset(Buffer);
    static jmethodID GetNioAccessGetBaseArrayOffsetMethod(JNIEnv* env);

    // Global reference to java.nio.Buffer.
    static jclass GetNioBufferClass(JNIEnv* env);

    // long java.nio.Buffer.address
    static jfieldID GetNioBufferAddressField(JNIEnv* env);

    // int java.nio.Buffer._elementSizeShift
    static jfieldID GetNioBufferElementSizeShiftField(JNIEnv* env);

    // int java.nio.Buffer.limit;
    static jfieldID GetNioBufferLimitField(JNIEnv* env);

    // int java.nio.Buffer.position;
    static jfieldID GetNioBufferPositionField(JNIEnv* env);

    // Object java.nio.Buffer.array()
    static jmethodID GetNioBufferArrayMethod(JNIEnv* env);

    // int java.nio.Buffer.arrayOffset()
    static jmethodID GetNioBufferArrayOffsetMethod(JNIEnv* env);

    // Global reference to java.lang.ref.Reference.
    static jclass GetReferenceClass(JNIEnv* env);

    // Object java.lang.ref.Reference.get()
    static jmethodID GetReferenceGetMethod(JNIEnv* env);

    // Global reference to java.lang.String.
    static jclass GetStringClass(JNIEnv* env);

    // Ensure class constants are initialized before use. Field and method
    // constants are lazily initialized via getters.
    static void EnsureClassReferencesInitialized(JNIEnv* env);

    // Ensure any cached heap objects from previous VM instances are
    // invalidated. There is no notification here that a VM is destroyed so this
    // method must be called when a new VM is created (and calls from any
    // earlier VM's are completed). The caching of heap objects in this class is
    // one reason why there is a limit of VM instance per process.
    static void Uninitialize();
};