Merge "GpuStats: send a hint of activity launch to GraphicsEnvironment" into qt-dev

This commit is contained in:
Yiwei Zhang
2019-05-09 23:45:47 +00:00
committed by Android (Google) Code Review
3 changed files with 14 additions and 0 deletions

View File

@@ -3393,6 +3393,9 @@ public final class ActivityThread extends ClientTransactionHandler {
}
WindowManagerGlobal.initialize();
// Hint the GraphicsEnvironment that an activity is launching on the process.
GraphicsEnvironment.hintActivityLaunch();
final Activity a = performLaunchActivity(r, customIntent);
if (a != null) {

View File

@@ -107,6 +107,12 @@ public class GraphicsEnvironment {
Trace.traceEnd(Trace.TRACE_TAG_GRAPHICS);
}
/**
* Hint for GraphicsEnvironment that an activity is launching on the process.
* Then the app process is allowed to send stats to GpuStats module.
*/
public static native void hintActivityLaunch();
/**
* Allow to query whether an application will use Game Driver.
*/

View File

@@ -85,6 +85,10 @@ void setDebugLayersGLES_native(JNIEnv* env, jobject clazz, jstring layers) {
}
}
void hintActivityLaunch_native(JNIEnv* env, jobject clazz) {
android::GraphicsEnv::getInstance().hintActivityLaunch();
}
const JNINativeMethod g_methods[] = {
{ "getCanLoadSystemLibraries", "()I", reinterpret_cast<void*>(getCanLoadSystemLibraries_native) },
{ "setDriverPathAndSphalLibraries", "(Ljava/lang/String;Ljava/lang/String;)V", reinterpret_cast<void*>(setDriverPathAndSphalLibraries_native) },
@@ -94,6 +98,7 @@ const JNINativeMethod g_methods[] = {
{ "setLayerPaths", "(Ljava/lang/ClassLoader;Ljava/lang/String;)V", reinterpret_cast<void*>(setLayerPaths_native) },
{ "setDebugLayers", "(Ljava/lang/String;)V", reinterpret_cast<void*>(setDebugLayers_native) },
{ "setDebugLayersGLES", "(Ljava/lang/String;)V", reinterpret_cast<void*>(setDebugLayersGLES_native) },
{ "hintActivityLaunch", "()V", reinterpret_cast<void*>(hintActivityLaunch_native) },
};
const char* const kGraphicsEnvironmentName = "android/os/GraphicsEnvironment";