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

Unified Diff: components/crash/content/app/breakpad_linux.cc

Issue 2556523002: Add package field to Android crash reports (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/crash/content/app/breakpad_linux.cc
diff --git a/components/crash/content/app/breakpad_linux.cc b/components/crash/content/app/breakpad_linux.cc
index 9ebc33f4f01ce975604b921303e43c3af59a04cb..dbec1e0a5d79dd3cb99cb8a57bd51689df83403e 100644
--- a/components/crash/content/app/breakpad_linux.cc
+++ b/components/crash/content/app/breakpad_linux.cc
@@ -58,6 +58,7 @@
#include "base/android/build_info.h"
#include "base/android/path_utils.h"
#include "base/debug/leak_annotations.h"
+#include "base/strings/stringprintf.h"
#endif
#include "third_party/lss/linux_syscall_support.h"
@@ -142,6 +143,15 @@ class MicrodumpInfo {
base::LazyInstance<MicrodumpInfo> g_microdump_info =
LAZY_INSTANCE_INITIALIZER;
+// Creates the value for the "package" field, which is in the format:
+// $PACKAGE_NAME v$VERSION_CODE ($VERSION_NAME)
+std::string format_android_package(
Lei Zhang 2016/12/08 06:53:50 nit: FormatAndroidPackage() ?
agrieve 2016/12/13 18:47:45 Done.
+ base::android::BuildInfo* android_build_info) {
+ return base::StringPrintf("%s v%s (%s)",
Lei Zhang 2016/12/08 06:53:50 This file has "WARNING: this code runs in a compro
agrieve 2016/12/13 18:47:45 Aha, great info! Put it on the stack.
+ android_build_info->package_name(),
+ android_build_info->package_version_code(),
+ android_build_info->package_version_name());
+}
#endif
CrashKeyStorage* g_crash_keys = nullptr;
@@ -1610,6 +1620,7 @@ void HandleCrashDump(const BreakpadInfo& info) {
static const char model[] = "model";
static const char brand[] = "brand";
static const char exception_info[] = "exception_info";
+ static const char package[] = "package";
base::android::BuildInfo* android_build_info =
base::android::BuildInfo::GetInstance();
@@ -1628,6 +1639,9 @@ void HandleCrashDump(const BreakpadInfo& info) {
writer.AddPairString(gms_core_version,
android_build_info->gms_version_code());
writer.AddBoundary();
+ std::string android_package = format_android_package(android_build_info);
+ writer.AddPairString(package, android_package.c_str());
+ writer.AddBoundary();
if (android_build_info->java_exception_info() != nullptr) {
writer.AddPairString(exception_info,
android_build_info->java_exception_info());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698