• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 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 #include <dlfcn.h>
18 #include <jni.h>
19 #include <utils/Log.h>
20 
21 #define ARRAY_SIZE(x) (sizeof((x)) / (sizeof(((x)[0]))))
22 #define TAG "VtsAngleLocationTest"
23 
24 #if defined(__LP64__) || defined(_LP64)
25 #define SYSTEM_LIB_PATH "/system/lib64"
26 #else
27 #define SYSTEM_LIB_PATH "/system/lib"
28 #endif
29 
native_testAngleLocation(JNIEnv *,jobject)30 jboolean native_testAngleLocation(JNIEnv*, jobject) {
31   if (access(SYSTEM_LIB_PATH "/libEGL_angle.so", R_OK) != 0) {
32     __android_log_print(ANDROID_LOG_ERROR, TAG,
33                         SYSTEM_LIB_PATH "/libEGL_angle.so not found");
34     return JNI_FALSE;
35   }
36   if (access(SYSTEM_LIB_PATH "/libGLESv1_CM_angle.so", R_OK) != 0) {
37     __android_log_print(ANDROID_LOG_ERROR, TAG,
38                         SYSTEM_LIB_PATH "/libGLESv1_CM_angle.so not found");
39     return JNI_FALSE;
40   }
41   if (access(SYSTEM_LIB_PATH "/libGLESv2_angle.so", R_OK) != 0) {
42     __android_log_print(ANDROID_LOG_ERROR, TAG,
43                         SYSTEM_LIB_PATH "/libGLESv2_angle.so not found");
44     return JNI_FALSE;
45   }
46   return JNI_TRUE;
47 }
48 
49 static const JNINativeMethod gVtsAngleLocationTestMethods[] = {
native_testAngleLocation()50     {"native_testAngleLocation", "()Z", (void*)native_testAngleLocation},
51 };
52 
register_com_google_android_vts_angle_VtsAngleLocationTest(JNIEnv * env)53 int register_com_google_android_vts_angle_VtsAngleLocationTest(JNIEnv* env) {
54   jclass clazz =
55       env->FindClass("com/google/android/vts/angle/testapp/VtsAngleTestCase");
56   int ret = env->RegisterNatives(clazz, gVtsAngleLocationTestMethods,
57                                  ARRAY_SIZE(gVtsAngleLocationTestMethods));
58   env->DeleteLocalRef(clazz);
59   return ret;
60 }
61