Skip to content

Commit 1fc756d

Browse files
Dianne HackbornAndroid (Google) Code Review
authored andcommitted
Merge "New API to determine if device has lots of RAM."
2 parents b26db26 + 49d228b commit 1fc756d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

core/java/android/app/ActivityManager.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,24 @@ static public boolean isHighEndGfx(Display display) {
234234
return false;
235235
}
236236

237+
/**
238+
* Use to decide whether the running device can be considered a "large
239+
* RAM" device. Exactly what memory limit large RAM is will vary, but
240+
* it essentially means there is plenty of RAM to have lots of background
241+
* processes running under decent loads.
242+
* @hide
243+
*/
244+
static public boolean isLargeRAM() {
245+
MemInfoReader reader = new MemInfoReader();
246+
reader.readMemInfo();
247+
if (reader.getTotalSize() >= (640*1024*1024)) {
248+
// Currently 640MB RAM available to the kernel is the point at
249+
// which we have plenty of RAM to spare.
250+
return true;
251+
}
252+
return false;
253+
}
254+
237255
/**
238256
* Information you can retrieve about tasks that the user has most recently
239257
* started or visited.

0 commit comments

Comments
 (0)