From 5e11e5e6cc38242dbf6a6709b1cfc563d3c8dc31 Mon Sep 17 00:00:00 2001 From: Luis Hector Chavez Date: Fri, 23 Mar 2018 14:37:01 -0700 Subject: [PATCH] Also allow avoiding gfx acceleration at runtime This change adds a way to make ActivityManager#isHighEndGfx() return false at runtime by inspecting the value of ro.config.avoid_gfx_accel. This is useful for running Android on Chrome OS devices, since a single image can be made to run in both physical hardware and an emulator. Bug: 65602168 Test: Added `ro.config.avoid_gfx_accel`, isHighEndGfx() returned false. Change-Id: I1599ad9b385f9ef43f923886e6d5358ae07632e0 --- core/java/android/app/ActivityManager.java | 6 ++++-- core/java/com/android/internal/os/RoSystemProperties.java | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index a18ba718ecef3..ea516e20937c8 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -959,8 +959,10 @@ public class ActivityManager { * @hide */ static public boolean isHighEndGfx() { - return !isLowRamDeviceStatic() && - !Resources.getSystem().getBoolean(com.android.internal.R.bool.config_avoidGfxAccel); + return !isLowRamDeviceStatic() + && !RoSystemProperties.CONFIG_AVOID_GFX_ACCEL + && !Resources.getSystem() + .getBoolean(com.android.internal.R.bool.config_avoidGfxAccel); } /** diff --git a/core/java/com/android/internal/os/RoSystemProperties.java b/core/java/com/android/internal/os/RoSystemProperties.java index 89a4e17aa9767..dc660a452c3be 100644 --- a/core/java/com/android/internal/os/RoSystemProperties.java +++ b/core/java/com/android/internal/os/RoSystemProperties.java @@ -31,6 +31,8 @@ public class RoSystemProperties { SystemProperties.get("ro.control_privapp_permissions"); // ------ ro.config.* -------- // + public static final boolean CONFIG_AVOID_GFX_ACCEL = + SystemProperties.getBoolean("ro.config.avoid_gfx_accel", false); public static final boolean CONFIG_LOW_RAM = SystemProperties.getBoolean("ro.config.low_ram", false); public static final boolean CONFIG_SMALL_BATTERY =