// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/android/sys_utils.h"

#include "base/sys_info.h"
#include "jni/SysUtils_jni.h"

// Any device that reports a physical RAM size less than this, in megabytes
// is considered 'low-end'. IMPORTANT: Read the LinkerLowMemoryThresholdTest
// comments in build/android/pylib/linker/test_case.py before modifying this
// value.
#define ANDROID_LOW_MEMORY_DEVICE_THRESHOLD_MB 512

const int64 kLowEndMemoryThreshold =
    1024 * 1024 * ANDROID_LOW_MEMORY_DEVICE_THRESHOLD_MB;

// Defined and called by JNI
static jboolean IsLowEndDevice(JNIEnv* env, jclass clazz) {
  return base::android::SysUtils::IsLowEndDevice();
}

namespace base {
namespace android {

bool SysUtils::Register(JNIEnv* env) {
  return RegisterNativesImpl(env);
}

bool SysUtils::IsLowEndDevice() {
  return SysInfo::AmountOfPhysicalMemory() <= kLowEndMemoryThreshold;
}

SysUtils::SysUtils() { }

}  // namespace android
}  // namespace base

// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/android/sys_utils.h"

#include "base/android/build_info.h"
#include "base/sys_info.h"
#include "jni/SysUtils_jni.h"

// Any device that reports a physical RAM size less than this, in megabytes
// is considered 'low-end'. IMPORTANT: Read the LinkerLowMemoryThresholdTest
// comments in build/android/pylib/linker/test_case.py before modifying this
// value.
#define ANDROID_LOW_MEMORY_DEVICE_THRESHOLD_MB 512

const int64 kLowEndMemoryThreshold =
    1024 * 1024 * ANDROID_LOW_MEMORY_DEVICE_THRESHOLD_MB;

// Only support low end device changes on builds greater than JB MR2.
const int kLowEndSdkIntThreshold = 18;

// Defined and called by JNI
static jboolean IsLowEndDevice(JNIEnv* env, jclass clazz) {
  return base::android::SysUtils::IsLowEndDevice();
}

namespace base {
namespace android {

bool SysUtils::Register(JNIEnv* env) {
  return RegisterNativesImpl(env);
}

bool SysUtils::IsLowEndDevice() {
  return SysInfo::AmountOfPhysicalMemory() <= kLowEndMemoryThreshold &&
      BuildInfo::GetInstance()->sdk_int() > kLowEndSdkIntThreshold;
}

SysUtils::SysUtils() { }

}  // namespace android
}  // namespace base

Disable low memory device check for JB and lower
Disable low memory device check for JB and lower

Only switch to low memory device states for higher than JB.

BUG=310842
NOTRY=true

Review URL: https://codereview.chromium.org/38113005

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@230873 0039d316-1c4b-4281-b951-d872f2087c98
