Commit a588c095 authored by cjhopman@chromium.org's avatar cjhopman@chromium.org

[Android] Disable tombstones for renderer crashes on JB MR2+

Starting with JB MR2, a crashing service triggers a dialog. This is an
awful user experience when a Chrome renderer crashes. The system service
that triggers the dialog also prints the stacktrace to the log and
creates a tombstone.

For now, disable the tombstone and dialog on JB MR2+ "user" builds (or
rather, non-"userdebug", non-"eng" builds).

BUG=273706
TEST=navigate to "about:crash". If on JB MR2+ "user" build, no system
dialog should be shown. Otherwise, dialog should be shown.

Review URL: https://codereview.chromium.org/113873006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251183 0039d316-1c4b-4281-b951-d872f2087c98
parent 52b862ec
...@@ -55,6 +55,7 @@ BuildInfo::BuildInfo(JNIEnv* env) ...@@ -55,6 +55,7 @@ BuildInfo::BuildInfo(JNIEnv* env)
env, GetApplicationContext()))), env, GetApplicationContext()))),
package_name_(StrDupJString(Java_BuildInfo_getPackageName( package_name_(StrDupJString(Java_BuildInfo_getPackageName(
env, GetApplicationContext()))), env, GetApplicationContext()))),
build_type_(StrDupJString(Java_BuildInfo_getBuildType(env))),
sdk_int_(Java_BuildInfo_getSdkInt(env)), sdk_int_(Java_BuildInfo_getSdkInt(env)),
java_exception_info_(NULL) { java_exception_info_(NULL) {
} }
......
...@@ -72,6 +72,10 @@ class BASE_EXPORT BuildInfo { ...@@ -72,6 +72,10 @@ class BASE_EXPORT BuildInfo {
return package_name_; return package_name_;
} }
const char* build_type() const {
return build_type_;
}
int sdk_int() const { int sdk_int() const {
return sdk_int_; return sdk_int_;
} }
...@@ -102,6 +106,7 @@ class BASE_EXPORT BuildInfo { ...@@ -102,6 +106,7 @@ class BASE_EXPORT BuildInfo {
const char* const package_version_name_; const char* const package_version_name_;
const char* const package_label_; const char* const package_label_;
const char* const package_name_; const char* const package_name_;
const char* const build_type_;
const int sdk_int_; const int sdk_int_;
// This is set via set_java_exception_info, not at constructor time. // This is set via set_java_exception_info, not at constructor time.
const char* java_exception_info_; const char* java_exception_info_;
......
...@@ -108,6 +108,11 @@ public class BuildInfo { ...@@ -108,6 +108,11 @@ public class BuildInfo {
return packageName != null ? packageName : ""; return packageName != null ? packageName : "";
} }
@CalledByNative
public static String getBuildType() {
return Build.TYPE;
}
@CalledByNative @CalledByNative
public static int getSdkInt() { public static int getSdkInt() {
return Build.VERSION.SDK_INT; return Build.VERSION.SDK_INT;
......
...@@ -702,7 +702,27 @@ bool CrashDoneInProcessNoUpload( ...@@ -702,7 +702,27 @@ bool CrashDoneInProcessNoUpload(
info.pid = g_pid; info.pid = g_pid;
info.crash_keys = g_crash_keys; info.crash_keys = g_crash_keys;
HandleCrashDump(info); HandleCrashDump(info);
return FinalizeCrashDoneAndroid(); bool finalize_result = FinalizeCrashDoneAndroid();
base::android::BuildInfo* android_build_info =
base::android::BuildInfo::GetInstance();
if (android_build_info->sdk_int() >= 18 &&
strcmp(android_build_info->build_type(), "eng") != 0 &&
strcmp(android_build_info->build_type(), "userdebug") != 0) {
// On JB MR2 and later, the system crash handler displays a dialog. For
// renderer crashes, this is a bad user experience and so this is disabled
// for user builds of Android.
// TODO(cjhopman): There should be some way to recover the crash stack from
// non-uploading user clients. See http://crbug.com/273706.
__android_log_write(ANDROID_LOG_WARN,
kGoogleBreakpad,
"Tombstones are disabled on JB MR2+ user builds.");
__android_log_write(ANDROID_LOG_WARN,
kGoogleBreakpad,
"### ### ### ### ### ### ### ### ### ### ### ### ###");
return true;
} else {
return finalize_result;
}
} }
void EnableNonBrowserCrashDumping(const std::string& process_type, void EnableNonBrowserCrashDumping(const std::string& process_type,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment