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
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();
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