Index: base/sys_info_android.cc |
diff --git a/base/sys_info_android.cc b/base/sys_info_android.cc |
index cb25cdc51a3817c7fb2e9fc5a96781164ac0c6b8..bc0e3fa80dafb2e2345a87b786b817ea5a210a44 100644 |
--- a/base/sys_info_android.cc |
+++ b/base/sys_info_android.cc |
@@ -9,6 +9,7 @@ |
#include <stdint.h> |
#include <sys/system_properties.h> |
+#include "base/android/jni_android.h" |
#include "base/android/sys_utils.h" |
#include "base/lazy_instance.h" |
#include "base/logging.h" |
@@ -215,6 +216,17 @@ static base::LazyInstance< |
g_lazy_low_end_device = LAZY_INSTANCE_INITIALIZER; |
bool SysInfo::IsLowEndDevice() { |
+ // This code might be used in some environments |
+ // which might not have a Java environment. |
+ // Note that we need to call the Java version here. |
+ // There exists a complete native implementation in |
+ // sys_info.cc but calling that here would mean that |
+ // the Java code and the native code would call different |
+ // implementations which could give different results. |
+ // Also the Java code cannot depend on the native code |
+ // since it might not be loaded yet. |
+ if (!base::android::IsVMInitialized()) |
+ return false; |
return g_lazy_low_end_device.Get().value(); |
} |