summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2020-01-31 18:37:58 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2020-01-31 18:37:58 +0000
commitdc9e5ee91f254605b30619eceef14bb144d8d34d (patch)
tree057f43beaeda7dd09cc1002311e3a0e2585c8e2a
parent35747b6023d2bdd4de5c2f9324ff262b4586c668 (diff)
parente10e0fffcf25e76e42d8c82fae9bc30871982a41 (diff)
Merge "GraphicsEnv: refactor to unify the debuggable logic" into qt-qpr1-dev am: e10e0fffcf
Change-Id: I15a25d43561f3176efaad4c92c928ea5d4223066
-rw-r--r--core/java/android/os/GraphicsEnvironment.java25
-rw-r--r--core/jni/android_os_GraphicsEnvironment.cpp6
2 files changed, 9 insertions, 22 deletions
diff --git a/core/java/android/os/GraphicsEnvironment.java b/core/java/android/os/GraphicsEnvironment.java
index 7a70e93b69d5..31cdf42e3a06 100644
--- a/core/java/android/os/GraphicsEnvironment.java
+++ b/core/java/android/os/GraphicsEnvironment.java
@@ -173,13 +173,6 @@ public class GraphicsEnvironment {
}
/**
- * Check whether application is debuggable
- */
- private static boolean isDebuggable(Context context) {
- return (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) > 0;
- }
-
- /**
* Store the layer paths available to the loader.
*/
public void setLayerPaths(ClassLoader classLoader,
@@ -233,7 +226,7 @@ public class GraphicsEnvironment {
// 2. ENABLE_GPU_DEBUG_LAYERS is true
// 3. Package name is equal to GPU_DEBUG_APP
- if (isDebuggable(context) || (getCanLoadSystemLibraries() == 1)) {
+ if (isDebuggable()) {
final int enable = coreSettings.getInt(Settings.Global.ENABLE_GPU_DEBUG_LAYERS, 0);
@@ -414,9 +407,7 @@ public class GraphicsEnvironment {
* Check for ANGLE debug package, but only for apps that can load them (dumpable)
*/
private String getAngleDebugPackage(Context context, Bundle coreSettings) {
- final boolean appIsDebuggable = isDebuggable(context);
- final boolean deviceIsDebuggable = getCanLoadSystemLibraries() == 1;
- if (appIsDebuggable || deviceIsDebuggable) {
+ if (isDebuggable()) {
String debugPackage;
if (coreSettings != null) {
@@ -451,12 +442,8 @@ public class GraphicsEnvironment {
* - devices that are running a userdebug build (ro.debuggable) or can inject libraries for
* debugging (PR_SET_DUMPABLE).
*/
- final boolean appIsDebuggable = isDebuggable(context);
- final boolean deviceIsDebuggable = getCanLoadSystemLibraries() == 1;
- if (!(appIsDebuggable || deviceIsDebuggable)) {
- Log.v(TAG, "Skipping loading temporary rules file: "
- + "appIsDebuggable = " + appIsDebuggable + ", "
- + "adbRootEnabled = " + deviceIsDebuggable);
+ if (!isDebuggable()) {
+ Log.v(TAG, "Skipping loading temporary rules file");
return false;
}
@@ -725,7 +712,7 @@ public class GraphicsEnvironment {
final boolean enablePrereleaseDriver =
(ai.metaData != null && ai.metaData.getBoolean(METADATA_DEVELOPER_DRIVER_ENABLE))
- || getCanLoadSystemLibraries() == 1;
+ || isDebuggable();
// Priority for Game Driver settings global on confliction (Higher priority comes first):
// 1. GAME_DRIVER_ALL_APPS
@@ -901,7 +888,7 @@ public class GraphicsEnvironment {
return "";
}
- private static native int getCanLoadSystemLibraries();
+ private static native boolean isDebuggable();
private static native void setLayerPaths(ClassLoader classLoader, String layerPaths);
private static native void setDebugLayers(String layers);
private static native void setDebugLayersGLES(String layers);
diff --git a/core/jni/android_os_GraphicsEnvironment.cpp b/core/jni/android_os_GraphicsEnvironment.cpp
index be9aee410d40..9ae1a9794395 100644
--- a/core/jni/android_os_GraphicsEnvironment.cpp
+++ b/core/jni/android_os_GraphicsEnvironment.cpp
@@ -23,8 +23,8 @@
namespace {
-int getCanLoadSystemLibraries_native() {
- return android::GraphicsEnv::getInstance().getCanLoadSystemLibraries();
+bool isDebuggable_native() {
+ return android::GraphicsEnv::getInstance().isDebuggable();
}
void setDriverPathAndSphalLibraries_native(JNIEnv* env, jobject clazz, jstring path,
@@ -90,7 +90,7 @@ void hintActivityLaunch_native(JNIEnv* env, jobject clazz) {
}
const JNINativeMethod g_methods[] = {
- { "getCanLoadSystemLibraries", "()I", reinterpret_cast<void*>(getCanLoadSystemLibraries_native) },
+ { "isDebuggable", "()Z", reinterpret_cast<void*>(isDebuggable_native) },
{ "setDriverPathAndSphalLibraries", "(Ljava/lang/String;Ljava/lang/String;)V", reinterpret_cast<void*>(setDriverPathAndSphalLibraries_native) },
{ "setGpuStats", "(Ljava/lang/String;Ljava/lang/String;JJLjava/lang/String;I)V", reinterpret_cast<void*>(setGpuStats_native) },
{ "setAngleInfo", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/io/FileDescriptor;JJ)V", reinterpret_cast<void*>(setAngleInfo_native) },