| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/sys_info.h" | 5 #include "base/sys_info.h" |
| 6 | 6 |
| 7 #include <sys/system_properties.h> | 7 #include <sys/system_properties.h> |
| 8 | 8 |
| 9 #include "base/android/sys_utils.h" | 9 #include "base/android/sys_utils.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_piece.h" | 13 #include "base/strings/string_piece.h" |
| 14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "base/sys_info_internal.h" | 15 #include "base/sys_info_internal.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 // Default version of Android to fall back to when actual version numbers | 19 // Default version of Android to fall back to when actual version numbers |
| 20 // cannot be acquired. This is an obviously invalid version number. Code | 20 // cannot be acquired. Use the latest Android release with a higher bug fix |
| 21 // doing version comparison should treat it as so and fail all comparisons. | 21 // version to avoid unnecessarily comparison errors with the latest release. |
| 22 const int kDefaultAndroidMajorVersion = 0; | 22 // This should be manually kept up-to-date on each Android release. |
| 23 const int kDefaultAndroidMinorVersion = 0; | 23 const int kDefaultAndroidMajorVersion = 4; |
| 24 const int kDefaultAndroidBugfixVersion = 0; | 24 const int kDefaultAndroidMinorVersion = 4; |
| 25 const int kDefaultAndroidBugfixVersion = 99; |
| 25 | 26 |
| 26 // Parse out the OS version numbers from the system properties. | 27 // Parse out the OS version numbers from the system properties. |
| 27 void ParseOSVersionNumbers(const char* os_version_str, | 28 void ParseOSVersionNumbers(const char* os_version_str, |
| 28 int32 *major_version, | 29 int32 *major_version, |
| 29 int32 *minor_version, | 30 int32 *minor_version, |
| 30 int32 *bugfix_version) { | 31 int32 *bugfix_version) { |
| 31 if (os_version_str[0]) { | 32 if (os_version_str[0]) { |
| 32 // Try to parse out the version numbers from the string. | 33 // Try to parse out the version numbers from the string. |
| 33 int num_read = sscanf(os_version_str, "%d.%d.%d", major_version, | 34 int num_read = sscanf(os_version_str, "%d.%d.%d", major_version, |
| 34 minor_version, bugfix_version); | 35 minor_version, bugfix_version); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 base::internal::LazySysInfoValue<bool, | 170 base::internal::LazySysInfoValue<bool, |
| 170 android::SysUtils::IsLowEndDeviceFromJni> >::Leaky | 171 android::SysUtils::IsLowEndDeviceFromJni> >::Leaky |
| 171 g_lazy_low_end_device = LAZY_INSTANCE_INITIALIZER; | 172 g_lazy_low_end_device = LAZY_INSTANCE_INITIALIZER; |
| 172 | 173 |
| 173 bool SysInfo::IsLowEndDevice() { | 174 bool SysInfo::IsLowEndDevice() { |
| 174 return g_lazy_low_end_device.Get().value(); | 175 return g_lazy_low_end_device.Get().value(); |
| 175 } | 176 } |
| 176 | 177 |
| 177 | 178 |
| 178 } // namespace base | 179 } // namespace base |
| OLD | NEW |