Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(466)

Unified Diff: base/android/java/src/org/chromium/base/SysUtils.java

Issue 62833002: [Android] Add a low-end device mode override flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698