• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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 "GameManagerService"
18 
19 #include <android/log.h>
20 #include <gui/SurfaceComposerClient.h>
21 #include <log/log.h>
22 #include <nativehelper/JNIHelp.h>
23 
24 #include "jni.h"
25 
26 namespace android {
27 
android_server_app_GameManagerService_nativeSetGameModeFrameRateOverride(JNIEnv * env,jclass clazz,jint uid,jfloat frameRate)28 static void android_server_app_GameManagerService_nativeSetGameModeFrameRateOverride(
29         JNIEnv* env, jclass clazz, jint uid, jfloat frameRate) {
30     SurfaceComposerClient::setGameModeFrameRateOverride(uid, frameRate);
31 }
32 
android_server_app_GameManagerService_nativeSetGameDefaultFrameRateOverride(JNIEnv * env,jclass clazz,jint uid,jfloat frameRate)33 static void android_server_app_GameManagerService_nativeSetGameDefaultFrameRateOverride(
34         JNIEnv* env, jclass clazz, jint uid, jfloat frameRate) {
35     SurfaceComposerClient::setGameDefaultFrameRateOverride(uid, frameRate);
36 }
37 
38 static const JNINativeMethod gMethods[] = {
nativeSetGameModeFrameRateOverride(IF)39         {"nativeSetGameModeFrameRateOverride", "(IF)V",
40          (void*)android_server_app_GameManagerService_nativeSetGameModeFrameRateOverride},
nativeSetGameDefaultFrameRateOverride(IF)41         {"nativeSetGameDefaultFrameRateOverride", "(IF)V",
42          (void*)android_server_app_GameManagerService_nativeSetGameDefaultFrameRateOverride},
43 };
44 
register_android_server_app_GameManagerService(JNIEnv * env)45 int register_android_server_app_GameManagerService(JNIEnv* env) {
46     return jniRegisterNativeMethods(env, "com/android/server/app/GameManagerService", gMethods,
47                                     NELEM(gMethods));
48 }
49 
50 }; // namespace android