blob: d56e4c51124dd3c3861735a8feefa5847b625f24 [file] [log] [blame]
Tim Murray12f511e2018-10-22 15:26:08 -07001/*
2 * Copyright (C) 2018 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 "jni.h"
18#include "GraphicsJNI.h"
19#include <nativehelper/JNIHelp.h>
20
21#include <minikin/Layout.h>
22#include <renderthread/RenderProxy.h>
23
24#include "core_jni_helpers.h"
25#include <unistd.h>
26
27namespace android {
28
29static void android_app_ActivityThread_purgePendingResources(JNIEnv* env, jobject clazz) {
30 // Don't care about return values.
31 mallopt(M_PURGE, 0);
32}
33
34static void
35android_app_ActivityThread_dumpGraphics(JNIEnv* env, jobject clazz, jobject javaFileDescriptor) {
36 int fd = jniGetFDFromFileDescriptor(env, javaFileDescriptor);
37 android::uirenderer::renderthread::RenderProxy::dumpGraphicsMemory(fd);
38 minikin::Layout::dumpMinikinStats(fd);
39}
40
41
42static JNINativeMethod gActivityThreadMethods[] = {
43 // ------------ Regular JNI ------------------
44 { "nPurgePendingResources", "()V",
45 (void*) android_app_ActivityThread_purgePendingResources },
46 { "nDumpGraphicsInfo", "(Ljava/io/FileDescriptor;)V",
47 (void*) android_app_ActivityThread_dumpGraphics }
48};
49
50int register_android_app_ActivityThread(JNIEnv* env) {
51 return RegisterMethodsOrDie(env, "android/app/ActivityThread",
52 gActivityThreadMethods, NELEM(gActivityThreadMethods));
53}
54
55};