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

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

Issue 2933503002: Add IsCurrentlyLowMemory (Closed)
Patch Set: added comment Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/android/sys_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e86bd4592ec5252808621cab99fcd08368a09a0c..5979ca40008847682a29fa20bec60830bd13033d 100644
--- a/base/android/java/src/org/chromium/base/SysUtils.java
+++ b/base/android/java/src/org/chromium/base/SysUtils.java
@@ -4,6 +4,7 @@
package org.chromium.base;
+import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
@@ -103,6 +104,19 @@ public class SysUtils {
return sLowEndDevice.booleanValue();
}
+ /**
+ * @return Whether or not the system has low available memory.
+ */
+ @CalledByNative
+ private static boolean isCurrentlyLowMemory() {
+ ActivityManager am =
+ (ActivityManager) ContextUtils.getApplicationContext().getSystemService(
+ Context.ACTIVITY_SERVICE);
+ ActivityManager.MemoryInfo info = new ActivityManager.MemoryInfo();
+ am.getMemoryInfo(info);
+ return info.lowMemory;
+ }
+
/**
* Resets the cached value, if any.
*/
« no previous file with comments | « no previous file | base/android/sys_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698