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/android/build_info.h" | 5 #include "base/android/build_info.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 #ifndef NDEBUG | 40 #ifndef NDEBUG |
41 static const bool kAllowedToAccessOnNonjoinableThread = true; | 41 static const bool kAllowedToAccessOnNonjoinableThread = true; |
42 #endif | 42 #endif |
43 }; | 43 }; |
44 | 44 |
45 BuildInfo::BuildInfo(JNIEnv* env) | 45 BuildInfo::BuildInfo(JNIEnv* env) |
46 : device_(StrDupJString(Java_BuildInfo_getDevice(env))), | 46 : device_(StrDupJString(Java_BuildInfo_getDevice(env))), |
47 manufacturer_(StrDupJString(Java_BuildInfo_getDeviceManufacturer(env))), | 47 manufacturer_(StrDupJString(Java_BuildInfo_getDeviceManufacturer(env))), |
48 model_(StrDupJString(Java_BuildInfo_getDeviceModel(env))), | 48 model_(StrDupJString(Java_BuildInfo_getDeviceModel(env))), |
49 brand_(StrDupJString(Java_BuildInfo_getBrand(env))), | 49 brand_(StrDupJString(Java_BuildInfo_getBrand(env))), |
50 android_build_id_(StrDupJString(Java_BuildInfo_getAndroidBuildId(env))), | 50 build_id_(StrDupJString(Java_BuildInfo_getBuildId(env))), |
51 android_build_fp_(StrDupJString( | 51 build_fp_(StrDupJString(Java_BuildInfo_getBuildFingerprint(env))), |
52 Java_BuildInfo_getAndroidBuildFingerprint(env))), | |
53 package_version_code_(StrDupJString(Java_BuildInfo_getPackageVersionCode( | 52 package_version_code_(StrDupJString(Java_BuildInfo_getPackageVersionCode( |
54 env, GetApplicationContext()))), | 53 env, GetApplicationContext()))), |
55 package_version_name_(StrDupJString(Java_BuildInfo_getPackageVersionName( | 54 package_version_name_(StrDupJString(Java_BuildInfo_getPackageVersionName( |
56 env, GetApplicationContext()))), | 55 env, GetApplicationContext()))), |
57 package_label_(StrDupJString(Java_BuildInfo_getPackageLabel( | 56 package_label_(StrDupJString(Java_BuildInfo_getPackageLabel( |
58 env, GetApplicationContext()))), | 57 env, GetApplicationContext()))), |
59 package_name_(StrDupJString(Java_BuildInfo_getPackageName( | 58 package_name_(StrDupJString(Java_BuildInfo_getPackageName( |
60 env, GetApplicationContext()))), | 59 env, GetApplicationContext()))), |
61 build_type_(StrDupJString(Java_BuildInfo_getBuildType(env))), | 60 build_type_(StrDupJString(Java_BuildInfo_getBuildType(env))), |
| 61 build_version_release_(StrDupJString( |
| 62 Java_BuildInfo_getBuildVersionRelease(env))), |
| 63 build_version_codename_(StrDupJString( |
| 64 Java_BuildInfo_getBuildVersionCodename(env))), |
62 sdk_int_(Java_BuildInfo_getSdkInt(env)), | 65 sdk_int_(Java_BuildInfo_getSdkInt(env)), |
| 66 large_memory_class_(Java_BuildInfo_getLargeMemoryClass( |
| 67 env, GetApplicationContext())), |
63 has_language_apk_splits_(Java_BuildInfo_hasLanguageApkSplits( | 68 has_language_apk_splits_(Java_BuildInfo_hasLanguageApkSplits( |
64 env, GetApplicationContext())), | 69 env, GetApplicationContext())), |
65 java_exception_info_(NULL) { | 70 java_exception_info_(NULL) { |
66 } | 71 } |
67 | 72 |
68 // static | 73 // static |
69 BuildInfo* BuildInfo::GetInstance() { | 74 BuildInfo* BuildInfo::GetInstance() { |
70 return Singleton<BuildInfo, BuildInfoSingletonTraits >::get(); | 75 return Singleton<BuildInfo, BuildInfoSingletonTraits >::get(); |
71 } | 76 } |
72 | 77 |
73 void BuildInfo::SetJavaExceptionInfo(const std::string& info) { | 78 void BuildInfo::SetJavaExceptionInfo(const std::string& info) { |
74 DCHECK(!java_exception_info_) << "info should be set only once."; | 79 DCHECK(!java_exception_info_) << "info should be set only once."; |
75 java_exception_info_ = strndup(info.c_str(), 4096); | 80 java_exception_info_ = strndup(info.c_str(), 4096); |
76 } | 81 } |
77 | 82 |
78 void BuildInfo::ClearJavaExceptionInfo() { | 83 void BuildInfo::ClearJavaExceptionInfo() { |
79 delete java_exception_info_; | 84 delete java_exception_info_; |
80 java_exception_info_ = nullptr; | 85 java_exception_info_ = nullptr; |
81 } | 86 } |
82 | 87 |
83 // static | 88 // static |
84 bool BuildInfo::RegisterBindings(JNIEnv* env) { | 89 bool BuildInfo::RegisterBindings(JNIEnv* env) { |
85 return RegisterNativesImpl(env); | 90 return RegisterNativesImpl(env); |
86 } | 91 } |
87 | 92 |
88 } // namespace android | 93 } // namespace android |
89 } // namespace base | 94 } // namespace base |
OLD | NEW |