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 30 matching lines...) Expand all Loading... |
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 android_build_id_(StrDupJString(Java_BuildInfo_getAndroidBuildId(env))), |
51 android_build_fp_(StrDupJString( | 51 android_build_fp_( |
52 Java_BuildInfo_getAndroidBuildFingerprint(env))), | 52 StrDupJString(Java_BuildInfo_getAndroidBuildFingerprint(env))), |
53 package_version_code_(StrDupJString(Java_BuildInfo_getPackageVersionCode( | 53 package_version_code_(StrDupJString( |
54 env, GetApplicationContext()))), | 54 Java_BuildInfo_getPackageVersionCode(env, GetApplicationContext()))), |
55 package_version_name_(StrDupJString(Java_BuildInfo_getPackageVersionName( | 55 package_version_name_(StrDupJString( |
56 env, GetApplicationContext()))), | 56 Java_BuildInfo_getPackageVersionName(env, GetApplicationContext()))), |
57 package_label_(StrDupJString(Java_BuildInfo_getPackageLabel( | 57 package_label_(StrDupJString( |
58 env, GetApplicationContext()))), | 58 Java_BuildInfo_getPackageLabel(env, GetApplicationContext()))), |
59 package_name_(StrDupJString(Java_BuildInfo_getPackageName( | 59 package_name_(StrDupJString( |
60 env, GetApplicationContext()))), | 60 Java_BuildInfo_getPackageName(env, GetApplicationContext()))), |
61 build_type_(StrDupJString(Java_BuildInfo_getBuildType(env))), | 61 build_type_(StrDupJString(Java_BuildInfo_getBuildType(env))), |
62 sdk_int_(Java_BuildInfo_getSdkInt(env)), | 62 sdk_int_(Java_BuildInfo_getSdkInt(env)), |
63 java_exception_info_(NULL) { | 63 has_language_apk_splits_( |
64 } | 64 Java_BuildInfo_hasLanguageApkSplits(env, GetApplicationContext())), |
| 65 java_exception_info_(NULL) {} |
65 | 66 |
66 // static | 67 // static |
67 BuildInfo* BuildInfo::GetInstance() { | 68 BuildInfo* BuildInfo::GetInstance() { |
68 return Singleton<BuildInfo, BuildInfoSingletonTraits >::get(); | 69 return Singleton<BuildInfo, BuildInfoSingletonTraits >::get(); |
69 } | 70 } |
70 | 71 |
71 void BuildInfo::SetJavaExceptionInfo(const std::string& info) { | 72 void BuildInfo::SetJavaExceptionInfo(const std::string& info) { |
72 DCHECK(!java_exception_info_) << "info should be set only once."; | 73 DCHECK(!java_exception_info_) << "info should be set only once."; |
73 java_exception_info_ = strndup(info.c_str(), 4096); | 74 java_exception_info_ = strndup(info.c_str(), 4096); |
74 } | 75 } |
75 | 76 |
76 void BuildInfo::ClearJavaExceptionInfo() { | 77 void BuildInfo::ClearJavaExceptionInfo() { |
77 delete java_exception_info_; | 78 delete java_exception_info_; |
78 java_exception_info_ = nullptr; | 79 java_exception_info_ = nullptr; |
79 } | 80 } |
80 | 81 |
81 // static | 82 // static |
82 bool BuildInfo::RegisterBindings(JNIEnv* env) { | 83 bool BuildInfo::RegisterBindings(JNIEnv* env) { |
83 return RegisterNativesImpl(env); | 84 return RegisterNativesImpl(env); |
84 } | 85 } |
85 | 86 |
86 } // namespace android | 87 } // namespace android |
87 } // namespace base | 88 } // namespace base |
OLD | NEW |