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

Side by Side Diff: android/java/src/org/chromium/base/SysUtils.java

Issue 2045303002: Update to Chromium //base at Chromium commit 3e81715e6d3a4324362635aea46ce1f1a163cca1. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/domokit/base@master
Patch Set: Created 4 years, 6 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.base; 5 package org.chromium.base;
6 6
7 import android.annotation.TargetApi; 7 import android.annotation.TargetApi;
8 import android.app.ActivityManager; 8 import android.app.ActivityManager;
9 import android.content.Context; 9 import android.content.Context;
10 import android.os.Build; 10 import android.os.Build;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 @TargetApi(Build.VERSION_CODES.KITKAT) 109 @TargetApi(Build.VERSION_CODES.KITKAT)
110 private static boolean detectLowEndDevice() { 110 private static boolean detectLowEndDevice() {
111 assert CommandLine.isInitialized(); 111 assert CommandLine.isInitialized();
112 if (CommandLine.getInstance().hasSwitch(BaseSwitches.ENABLE_LOW_END_DEVI CE_MODE)) { 112 if (CommandLine.getInstance().hasSwitch(BaseSwitches.ENABLE_LOW_END_DEVI CE_MODE)) {
113 return true; 113 return true;
114 } 114 }
115 if (CommandLine.getInstance().hasSwitch(BaseSwitches.DISABLE_LOW_END_DEV ICE_MODE)) { 115 if (CommandLine.getInstance().hasSwitch(BaseSwitches.DISABLE_LOW_END_DEV ICE_MODE)) {
116 return false; 116 return false;
117 } 117 }
118 // Any pre-KitKat device cannot be considered 'low-end'.
119 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
120 return false;
121 }
122 118
123 Context context = ApplicationStatus.getApplicationContext(); 119 Context context = ApplicationStatus.getApplicationContext();
124 if (context != null) { 120 // Only KitKat and later devices have isLowRamDevice() call available.
121 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && context != nu ll) {
125 ActivityManager activityManager = (ActivityManager) 122 ActivityManager activityManager = (ActivityManager)
126 context.getSystemService(Context.ACTIVITY_SERVICE); 123 context.getSystemService(Context.ACTIVITY_SERVICE);
127 if (activityManager.isLowRamDevice()) { 124 if (activityManager.isLowRamDevice()) {
128 return true; 125 return true;
129 } 126 }
130 } else { 127 } else {
131 Log.e(TAG, "ApplicationContext is null in ApplicationStatus"); 128 Log.e(TAG, "ApplicationContext is null in ApplicationStatus");
132 } 129 }
133 130
134 int ramSizeMB = amountOfPhysicalMemoryMB(); 131 int ramSizeMB = amountOfPhysicalMemoryMB();
135 if (ramSizeMB <= 0) { 132 if (ramSizeMB <= 0) {
136 return false; 133 return false;
137 } 134 }
138 135
139 return ramSizeMB <= ANDROID_LOW_MEMORY_DEVICE_THRESHOLD_MB; 136 return ramSizeMB <= ANDROID_LOW_MEMORY_DEVICE_THRESHOLD_MB;
140 } 137 }
141 } 138 }
OLDNEW
« no previous file with comments | « android/java/src/org/chromium/base/CommandLine.java ('k') | android/java/src/org/chromium/base/WindowCallbackWrapper.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698