Chromium Code Reviews| 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 <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <sys/system_properties.h> | 8 #include <sys/system_properties.h> |
| 9 | 9 |
| 10 #include "base/android/build_info.h" | |
| 10 #include "base/android/sys_utils.h" | 11 #include "base/android/sys_utils.h" |
| 11 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 12 #include "base/logging.h" | 13 #include "base/logging.h" |
| 13 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/string_piece.h" | 15 #include "base/strings/string_piece.h" |
| 15 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 16 #include "base/sys_info_internal.h" | 17 #include "base/sys_info_internal.h" |
| 17 | 18 |
| 18 #if (__ANDROID_API__ >= 21 /* 5.0 - Lollipop */) | 19 #if (__ANDROID_API__ >= 21 /* 5.0 - Lollipop */) |
| 19 | 20 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 } | 167 } |
| 167 | 168 |
| 168 std::string SysInfo::GetAndroidBuildID() { | 169 std::string SysInfo::GetAndroidBuildID() { |
| 169 char os_build_id_str[PROP_VALUE_MAX]; | 170 char os_build_id_str[PROP_VALUE_MAX]; |
| 170 __system_property_get("ro.build.id", os_build_id_str); | 171 __system_property_get("ro.build.id", os_build_id_str); |
| 171 return std::string(os_build_id_str); | 172 return std::string(os_build_id_str); |
| 172 } | 173 } |
| 173 | 174 |
| 174 std::string SysInfo::GetDeviceName() { | 175 std::string SysInfo::GetDeviceName() { |
| 175 char device_model_str[PROP_VALUE_MAX]; | 176 char device_model_str[PROP_VALUE_MAX]; |
| 176 __system_property_get("ro.product.model", device_model_str); | 177 __system_property_get("ro.product.model", device_model_str); |
|
jdduke (slow)
2015/07/10 19:16:05
Hmm, shouldn't this property correspond to base::a
gone
2015/07/10 20:58:11
Probably for historic reasons that may not make se
tdresser
2015/07/13 13:19:22
It doesn't look like we can get rid of |__system_p
| |
| 177 return std::string(device_model_str); | 178 return std::string(device_model_str); |
| 178 } | 179 } |
| 179 | 180 |
| 181 std::string SysInfo::HardwareModelName() { | |
| 182 return base::android::BuildInfo::GetInstance()->model(); | |
|
Nico
2015/07/10 19:52:22
This does 14 jni calls to fill out BuildInfo and t
jdduke (slow)
2015/07/10 20:01:14
The JNI calls are only made when the singleton is
| |
| 183 } | |
| 184 | |
| 180 std::string SysInfo::OperatingSystemVersion() { | 185 std::string SysInfo::OperatingSystemVersion() { |
| 181 int32 major, minor, bugfix; | 186 int32 major, minor, bugfix; |
| 182 OperatingSystemVersionNumbers(&major, &minor, &bugfix); | 187 OperatingSystemVersionNumbers(&major, &minor, &bugfix); |
| 183 return StringPrintf("%d.%d.%d", major, minor, bugfix); | 188 return StringPrintf("%d.%d.%d", major, minor, bugfix); |
| 184 } | 189 } |
| 185 | 190 |
| 186 void SysInfo::OperatingSystemVersionNumbers(int32* major_version, | 191 void SysInfo::OperatingSystemVersionNumbers(int32* major_version, |
| 187 int32* minor_version, | 192 int32* minor_version, |
| 188 int32* bugfix_version) { | 193 int32* bugfix_version) { |
| 189 // Read the version number string out from the properties. | 194 // Read the version number string out from the properties. |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 209 base::internal::LazySysInfoValue<bool, | 214 base::internal::LazySysInfoValue<bool, |
| 210 android::SysUtils::IsLowEndDeviceFromJni> >::Leaky | 215 android::SysUtils::IsLowEndDeviceFromJni> >::Leaky |
| 211 g_lazy_low_end_device = LAZY_INSTANCE_INITIALIZER; | 216 g_lazy_low_end_device = LAZY_INSTANCE_INITIALIZER; |
| 212 | 217 |
| 213 bool SysInfo::IsLowEndDevice() { | 218 bool SysInfo::IsLowEndDevice() { |
| 214 return g_lazy_low_end_device.Get().value(); | 219 return g_lazy_low_end_device.Get().value(); |
| 215 } | 220 } |
| 216 | 221 |
| 217 | 222 |
| 218 } // namespace base | 223 } // namespace base |
| OLD | NEW |