Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1076)

Side by Side Diff: base/android/build_info.cc

Issue 9838033: Upstream native crash handling changes for Android. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Revert of Revert with fixes. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/android/build_info.h ('k') | base/android/java/org/chromium/base/BuildInfo.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/android/build_info.h"
6
7 #include <string>
8
9 #include "base/android/jni_android.h"
10 #include "base/android/jni_string.h"
11 #include "base/android/scoped_java_ref.h"
12 #include "base/logging.h"
13 #include "base/memory/singleton.h"
14 #include "jni/build_info_jni.h"
15
16 namespace base {
17 namespace android {
18
19 BuildInfo::BuildInfo() {
20
21 JNIEnv* env = AttachCurrentThread();
22
23 // The const char* pointers initialized below will be owned by the
24 // resultant BuildInfo.
25 std::string device_str =
26 ConvertJavaStringToUTF8(Java_BuildInfo_getDevice(env));
27 device_ = strdup(device_str.c_str());
28
29 std::string model_str =
30 ConvertJavaStringToUTF8(Java_BuildInfo_getDeviceModel(env));
31 model_ = strdup(model_str.c_str());
32
33 std::string brand_str =
34 ConvertJavaStringToUTF8(Java_BuildInfo_getBrand(env));
35 brand_ = strdup(brand_str.c_str());
36
37 std::string android_build_id_str =
38 ConvertJavaStringToUTF8(Java_BuildInfo_getAndroidBuildId(env));
39 android_build_id_ = strdup(android_build_id_str.c_str());
40
41 std::string android_build_fp_str =
42 ConvertJavaStringToUTF8(Java_BuildInfo_getAndroidBuildFingerprint(env));
43 android_build_fp_ = strdup(android_build_fp_str.c_str());
44
45 jobject app_context = GetApplicationContext();
46 std::string package_version_code_str =
47 ConvertJavaStringToUTF8(Java_BuildInfo_getPackageVersionCode(
48 env, app_context));
49 package_version_code_ = strdup(package_version_code_str.c_str());
50
51 std::string package_version_name_str =
52 ConvertJavaStringToUTF8(
53 Java_BuildInfo_getPackageVersionName(env, app_context));
54 package_version_name_ = strdup(package_version_name_str.c_str());
55
56 }
57
58 // static
59 BuildInfo* BuildInfo::GetInstance() {
60 return Singleton<BuildInfo, LeakySingletonTraits<BuildInfo> >::get();
61 }
62
63 bool RegisterBuildInfo(JNIEnv* env) {
64 return RegisterNativesImpl(env);
65 }
66
67 } // namespace android
68 } // namespace base
OLDNEW
« no previous file with comments | « base/android/build_info.h ('k') | base/android/java/org/chromium/base/BuildInfo.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698