Simple Cache: Enable by default on Android developer builds
[chromium-blink-merge.git] / base / android / sys_utils.cc
blob2a7db192bfb2e62c7f36593dc93310185b291e14
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
3 // found in the LICENSE file.
5 #include "base/android/sys_utils.h"
7 #include "base/android/build_info.h"
8 #include "base/sys_info.h"
9 #include "jni/SysUtils_jni.h"
11 // Any device that reports a physical RAM size less than this, in megabytes
12 // is considered 'low-end'. IMPORTANT: Read the LinkerLowMemoryThresholdTest
13 // comments in build/android/pylib/linker/test_case.py before modifying this
14 // value.
15 #define ANDROID_LOW_MEMORY_DEVICE_THRESHOLD_MB 512
17 const int64 kLowEndMemoryThreshold =
18 1024 * 1024 * ANDROID_LOW_MEMORY_DEVICE_THRESHOLD_MB;
20 // Only support low end device changes on builds greater than JB MR2.
21 const int kLowEndSdkIntThreshold = 18;
23 // Defined and called by JNI
24 static jboolean IsLowEndDevice(JNIEnv* env, jclass clazz) {
25 return base::android::SysUtils::IsLowEndDevice();
28 namespace base {
29 namespace android {
31 bool SysUtils::Register(JNIEnv* env) {
32 return RegisterNativesImpl(env);
35 bool SysUtils::IsLowEndDevice() {
36 return SysInfo::AmountOfPhysicalMemory() <= kLowEndMemoryThreshold &&
37 BuildInfo::GetInstance()->sdk_int() > kLowEndSdkIntThreshold;
40 SysUtils::SysUtils() { }
42 } // namespace android
43 } // namespace base