@@ -172,13 +172,6 @@ private static int getVulkanVersion(PackageManager pm) {
172172 return 0 ;
173173 }
174174
175- /**
176- * Check whether application is debuggable
177- */
178- private static boolean isDebuggable (Context context ) {
179- return (context .getApplicationInfo ().flags & ApplicationInfo .FLAG_DEBUGGABLE ) > 0 ;
180- }
181-
182175 /**
183176 * Store the layer paths available to the loader.
184177 */
@@ -233,7 +226,7 @@ private void setupGpuLayers(
233226 // 2. ENABLE_GPU_DEBUG_LAYERS is true
234227 // 3. Package name is equal to GPU_DEBUG_APP
235228
236- if (isDebuggable (context ) || ( getCanLoadSystemLibraries () == 1 )) {
229+ if (isDebuggable ()) {
237230
238231 final int enable = coreSettings .getInt (Settings .Global .ENABLE_GPU_DEBUG_LAYERS , 0 );
239232
@@ -414,9 +407,7 @@ private String getAnglePackageName(PackageManager pm) {
414407 * Check for ANGLE debug package, but only for apps that can load them (dumpable)
415408 */
416409 private String getAngleDebugPackage (Context context , Bundle coreSettings ) {
417- final boolean appIsDebuggable = isDebuggable (context );
418- final boolean deviceIsDebuggable = getCanLoadSystemLibraries () == 1 ;
419- if (appIsDebuggable || deviceIsDebuggable ) {
410+ if (isDebuggable ()) {
420411 String debugPackage ;
421412
422413 if (coreSettings != null ) {
@@ -451,12 +442,8 @@ private static boolean setupAngleWithTempRulesFile(Context context,
451442 * - devices that are running a userdebug build (ro.debuggable) or can inject libraries for
452443 * debugging (PR_SET_DUMPABLE).
453444 */
454- final boolean appIsDebuggable = isDebuggable (context );
455- final boolean deviceIsDebuggable = getCanLoadSystemLibraries () == 1 ;
456- if (!(appIsDebuggable || deviceIsDebuggable )) {
457- Log .v (TAG , "Skipping loading temporary rules file: "
458- + "appIsDebuggable = " + appIsDebuggable + ", "
459- + "adbRootEnabled = " + deviceIsDebuggable );
445+ if (!isDebuggable ()) {
446+ Log .v (TAG , "Skipping loading temporary rules file" );
460447 return false ;
461448 }
462449
@@ -725,7 +712,7 @@ private static String chooseDriverInternal(
725712
726713 final boolean enablePrereleaseDriver =
727714 (ai .metaData != null && ai .metaData .getBoolean (METADATA_DEVELOPER_DRIVER_ENABLE ))
728- || getCanLoadSystemLibraries () == 1 ;
715+ || isDebuggable () ;
729716
730717 // Priority for Game Driver settings global on confliction (Higher priority comes first):
731718 // 1. GAME_DRIVER_ALL_APPS
@@ -901,7 +888,7 @@ private static String getSphalLibraries(Context context, String driverPackageNam
901888 return "" ;
902889 }
903890
904- private static native int getCanLoadSystemLibraries ();
891+ private static native boolean isDebuggable ();
905892 private static native void setLayerPaths (ClassLoader classLoader , String layerPaths );
906893 private static native void setDebugLayers (String layers );
907894 private static native void setDebugLayersGLES (String layers );
0 commit comments