From 17fb5966cb9dc6cc65152cfc2faa15e08e6d1450 Mon Sep 17 00:00:00 2001 From: Marc Hittinger Date: Wed, 5 Apr 2017 15:34:38 -0700 Subject: [PATCH] Add debug property to enable low_ram mode. Create debug.force_low_ram debug property to enable low_ram mode for testing on devices, instead of depending only on ro.config.low_ram. Test: Manual testing of enabling/disabling low_ram mode. Change-Id: I5410825ff91bc897013c24c892ade8a245ff6d18 --- core/java/android/app/ActivityManager.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index aede1bb67f80d..0aa291b4e8517 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -30,6 +30,7 @@ import android.graphics.GraphicBuffer; import android.graphics.Matrix; import android.graphics.Point; import android.os.BatteryStats; +import android.os.Build; import android.os.IBinder; import android.os.ParcelFileDescriptor; @@ -600,6 +601,9 @@ public class ActivityManager { */ public static final int COMPAT_MODE_TOGGLE = 2; + private static final boolean DEVELOPMENT_FORCE_LOW_RAM = + SystemProperties.getBoolean("debug.force_low_ram", false); + /** @hide */ public static class StackId { /** Invalid stack ID. */ @@ -1055,7 +1059,8 @@ public class ActivityManager { /** @hide */ public static boolean isLowRamDeviceStatic() { - return RoSystemProperties.CONFIG_LOW_RAM; + return RoSystemProperties.CONFIG_LOW_RAM || + (Build.IS_DEBUGGABLE && DEVELOPMENT_FORCE_LOW_RAM); } /**