Chromium Code Reviews| Index: base/android/java/src/org/chromium/base/SysUtils.java |
| diff --git a/base/android/java/src/org/chromium/base/SysUtils.java b/base/android/java/src/org/chromium/base/SysUtils.java |
| index 6c2ef5f19665dbc0c54ab44dc6d66a6da0fafa3a..0b39c0ef8f7809177d9681ff4b99febd90f379c5 100644 |
| --- a/base/android/java/src/org/chromium/base/SysUtils.java |
| +++ b/base/android/java/src/org/chromium/base/SysUtils.java |
| @@ -15,6 +15,9 @@ import android.content.Context; |
| import android.os.Build; |
| import android.util.Log; |
| +import org.chromium.base.BaseSwitches; |
| +import org.chromium.base.CommandLine; |
| + |
| /** |
| * Exposes system related information about the current device. |
| */ |
| @@ -98,10 +101,23 @@ public class SysUtils { |
| */ |
| @CalledByNative |
| public static boolean isLowEndDevice() { |
| - if (Build.VERSION.SDK_INT <= ANDROID_LOW_MEMORY_ANDROID_SDK_THRESHOLD) { |
| - return false; |
| - } |
| - if (sLowEndDevice == null) { |
| + while (sLowEndDevice == null) { |
|
bulach
2013/11/20 16:31:12
not quite sure why use a loop here?
jdduke (slow)
2013/11/20 18:16:34
Only for ease of breaking upon |sLowEndDevice| ini
|
| + if (CommandLine.isInitialized()) { |
| + if (CommandLine.getInstance().hasSwitch(BaseSwitches.ENABLE_LOW_END_DEVICE_MODE)) { |
| + sLowEndDevice = true; |
| + break; |
| + } |
| + if (CommandLine.getInstance().hasSwitch(BaseSwitches.DISABLE_LOW_END_DEVICE_MODE)) { |
| + sLowEndDevice = false; |
| + break; |
| + } |
| + } |
| + |
| + if (Build.VERSION.SDK_INT <= ANDROID_LOW_MEMORY_ANDROID_SDK_THRESHOLD) { |
| + sLowEndDevice = false; |
| + break; |
| + } |
| + |
| int ramSizeKB = amountOfPhysicalMemoryKB(); |
| sLowEndDevice = (ramSizeKB > 0 && |
| ramSizeKB / 1024 < ANDROID_LOW_MEMORY_DEVICE_THRESHOLD_MB); |