blob: f749488f39b0e0bba9761d4ef85ad137ea98d4a2 [file] [log] [blame]
Jesse Hallb12249b2016-12-12 12:53:02 -08001/*
2 * Copyright 2016 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#define LOG_TAG "GraphicsEnvironment"
18
Jiyong Park354ac4992017-05-08 13:29:35 +090019#include <graphicsenv/GraphicsEnv.h>
Jesse Hallb12249b2016-12-12 12:53:02 -080020#include <nativehelper/ScopedUtfChars.h>
21#include "core_jni_helpers.h"
22
23namespace {
24
25void setDriverPath(JNIEnv* env, jobject clazz, jstring path) {
26 ScopedUtfChars pathChars(env, path);
27 android::GraphicsEnv::getInstance().setDriverPath(pathChars.c_str());
28}
29
30const JNINativeMethod g_methods[] = {
31 { "setDriverPath", "(Ljava/lang/String;)V", reinterpret_cast<void*>(setDriverPath) },
32};
33
34const char* const kGraphicsEnvironmentName = "android/os/GraphicsEnvironment";
35
36} // anonymous namespace
37
38namespace android {
39
40int register_android_os_GraphicsEnvironment(JNIEnv* env) {
41 return RegisterMethodsOrDie(env, kGraphicsEnvironmentName, g_methods, NELEM(g_methods));
42}
43
44} // namespace android