Bug 1570789 - Remove the unused field from GeckoView/Fennec crash reports r=nalexander,agi

Differential Revision: https://phabricator.services.mozilla.com/D40331

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Gabriele Svelto 2019-08-02 08:26:05 +00:00
parent 35ea958caa
commit 50f416564f
9 changed files with 17 additions and 45 deletions

View File

@ -64,7 +64,6 @@ public class CrashReporterActivity extends AppCompatActivity
private static final String LOGTAG = "GeckoCrashReporter";
private static final String PASSED_MINI_DUMP_KEY = "minidumpPath";
private static final String PASSED_MINI_DUMP_SUCCESS_KEY = "minidumpSuccess";
private static final String MINI_DUMP_PATH_KEY = "upload_file_minidump";
private static final String PAGE_URL_KEY = "URL";
private static final String SERVER_URL_KEY = "ServerURL";
@ -88,7 +87,6 @@ public class CrashReporterActivity extends AppCompatActivity
private File mPendingMinidumpFile;
private File mPendingExtrasFile;
private HashMap<String, String> mExtrasStringMap;
private boolean mMinidumpSucceeded;
private boolean moveFile(File inFile, File outFile) {
Log.i(LOGTAG, "moving " + inFile + " to " + outFile);
@ -148,10 +146,6 @@ public class CrashReporterActivity extends AppCompatActivity
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setMessage(getString(R.string.sending_crash_report));
mMinidumpSucceeded = getIntent().getBooleanExtra(PASSED_MINI_DUMP_SUCCESS_KEY, false);
if (!mMinidumpSucceeded) {
Log.i(LOGTAG, "Failed to get minidump.");
}
String passedMinidumpPath = getIntent().getStringExtra(PASSED_MINI_DUMP_KEY);
File passedMinidumpFile = new File(passedMinidumpPath);
File pendingDir = new File(getFilesDir(), PENDING_SUFFIX);
@ -539,7 +533,6 @@ public class CrashReporterActivity extends AppCompatActivity
sendPart(os, boundary, "Email", email);
}
sendPart(os, boundary, PASSED_MINI_DUMP_SUCCESS_KEY, mMinidumpSucceeded ? "True" : "False");
sendFile(os, boundary, MINI_DUMP_PATH_KEY, minidumpFile);
os.write(("\r\n--" + boundary + "--\r\n").getBytes());
os.flush();

View File

@ -189,8 +189,8 @@ package org.mozilla.geckoview {
ctor public CrashReporter();
method @AnyThread @NonNull public static GeckoResult<String> sendCrashReport(@NonNull Context, @NonNull Intent, @NonNull String);
method @AnyThread @NonNull public static GeckoResult<String> sendCrashReport(@NonNull Context, @NonNull Bundle, @NonNull String);
method @AnyThread @NonNull public static GeckoResult<String> sendCrashReport(@NonNull Context, @NonNull File, @NonNull File, boolean, @NonNull String);
method @AnyThread @NonNull public static GeckoResult<String> sendCrashReport(@NonNull Context, @NonNull File, @NonNull Map<String,String>, boolean, @NonNull String);
method @AnyThread @NonNull public static GeckoResult<String> sendCrashReport(@NonNull Context, @NonNull File, @NonNull File, @NonNull String);
method @AnyThread @NonNull public static GeckoResult<String> sendCrashReport(@NonNull Context, @NonNull File, @NonNull Map<String,String>, @NonNull String);
}
@UiThread public final class DynamicToolbarAnimator {
@ -300,7 +300,6 @@ package org.mozilla.geckoview {
field public static final String EXTRA_CRASH_FATAL = "fatal";
field public static final String EXTRA_EXTRAS_PATH = "extrasPath";
field public static final String EXTRA_MINIDUMP_PATH = "minidumpPath";
field public static final String EXTRA_MINIDUMP_SUCCESS = "minidumpSuccess";
}
public static interface GeckoRuntime.Delegate {

View File

@ -48,9 +48,6 @@ class CrashTest {
assertThat("Extras file should exist",
File(intent.getStringExtra(GeckoRuntime.EXTRA_EXTRAS_PATH)).exists(),
equalTo(true))
assertThat("Dump should be succcesful",
intent.getBooleanExtra(GeckoRuntime.EXTRA_MINIDUMP_SUCCESS, false),
equalTo(true))
assertThat("Fatality should match",
intent.getBooleanExtra(GeckoRuntime.EXTRA_CRASH_FATAL, !fatal), equalTo(fatal))

View File

@ -315,7 +315,6 @@ public class CrashHandler implements Thread.UncaughtExceptionHandler {
intent.putExtra(GeckoRuntime.EXTRA_MINIDUMP_PATH, dumpFile);
intent.putExtra(GeckoRuntime.EXTRA_EXTRAS_PATH, extraFile);
intent.putExtra(GeckoRuntime.EXTRA_CRASH_FATAL, true);
intent.putExtra(GeckoRuntime.EXTRA_MINIDUMP_SUCCESS, true);
intent.setClass(context, handlerService);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
@ -335,7 +334,6 @@ public class CrashHandler implements Thread.UncaughtExceptionHandler {
"-n", getAppPackageName() + '/' + handlerService.getName(),
"--es", GeckoRuntime.EXTRA_MINIDUMP_PATH, dumpFile,
"--es", GeckoRuntime.EXTRA_EXTRAS_PATH, extraFile,
"--ez", GeckoRuntime.EXTRA_MINIDUMP_SUCCESS, "true",
"--ez", GeckoRuntime.EXTRA_CRASH_FATAL, "true");
} else {
final String startServiceCommand;
@ -353,7 +351,6 @@ public class CrashHandler implements Thread.UncaughtExceptionHandler {
"-n", getAppPackageName() + '/' + handlerService.getName(),
"--es", GeckoRuntime.EXTRA_MINIDUMP_PATH, dumpFile,
"--es", GeckoRuntime.EXTRA_EXTRAS_PATH, extraFile,
"--ez", GeckoRuntime.EXTRA_MINIDUMP_SUCCESS, "true",
"--ez", GeckoRuntime.EXTRA_CRASH_FATAL, "true");
}

View File

@ -39,7 +39,6 @@ import java.util.zip.GZIPOutputStream;
public class CrashReporter {
private static final String LOGTAG = "GeckoCrashReporter";
private static final String MINI_DUMP_PATH_KEY = "upload_file_minidump";
private static final String MINI_DUMP_SUCCESS_KEY = "minidumpSuccess";
private static final String PAGE_URL_KEY = "URL";
private static final String NOTES_KEY = "Notes";
private static final String SERVER_URL_KEY = "ServerURL";
@ -103,9 +102,8 @@ public class CrashReporter {
throws IOException, URISyntaxException {
final File dumpFile = new File(intentExtras.getString(GeckoRuntime.EXTRA_MINIDUMP_PATH));
final File extrasFile = new File(intentExtras.getString(GeckoRuntime.EXTRA_EXTRAS_PATH));
final boolean success = intentExtras.getBoolean(GeckoRuntime.EXTRA_MINIDUMP_SUCCESS, false);
return sendCrashReport(context, dumpFile, extrasFile, success, appName);
return sendCrashReport(context, dumpFile, extrasFile, appName);
}
/**
@ -119,7 +117,6 @@ public class CrashReporter {
* @param context The current {@link Context}
* @param minidumpFile A {@link File} referring to the minidump.
* @param extrasFile A {@link File} referring to the extras file.
* @param success A boolean indicating whether the dump was successfully generated.
* @param appName A human-readable app name.
* @throws IOException This can be thrown if there was a networking error while sending the report.
* @throws URISyntaxException This can be thrown if the crash server URI from the extra data was invalid.
@ -131,7 +128,6 @@ public class CrashReporter {
public static @NonNull GeckoResult<String> sendCrashReport(@NonNull final Context context,
@NonNull final File minidumpFile,
@NonNull final File extrasFile,
final boolean success,
@NonNull final String appName)
throws IOException, URISyntaxException {
// Compute the minidump hash and generate the stack traces
@ -140,7 +136,7 @@ public class CrashReporter {
// Extract the annotations from the .extra file
HashMap<String, String> extrasMap = readStringsFromFile(extrasFile.getPath());
return sendCrashReport(context, minidumpFile, extrasMap, success, appName);
return sendCrashReport(context, minidumpFile, extrasMap, appName);
}
/**
@ -150,7 +146,6 @@ public class CrashReporter {
* @param context The current {@link Context}
* @param minidumpFile A {@link File} referring to the minidump.
* @param extras A {@link HashMap} with the parsed key-value pairs from the extras file.
* @param success A boolean indicating whether the dump was successfully generated.
* @param appName A human-readable app name.
* @throws IOException This can be thrown if there was a networking error while sending the report.
* @throws URISyntaxException This can be thrown if the crash server URI from the extra data was invalid.
@ -161,7 +156,7 @@ public class CrashReporter {
@AnyThread
public static @NonNull GeckoResult<String> sendCrashReport(
@NonNull final Context context, @NonNull final File minidumpFile,
@NonNull final Map<String, String> extras, final boolean success,
@NonNull final Map<String, String> extras,
@NonNull final String appName) throws IOException, URISyntaxException {
Log.d(LOGTAG, "Sending crash report: " + minidumpFile.getPath());
@ -219,7 +214,6 @@ public class CrashReporter {
Log.e(LOGTAG, "Exception while sending SDK version 8 keys", ex);
}
sendPart(os, boundary, "Android_Version", Build.VERSION.SDK_INT + " (" + Build.VERSION.CODENAME + ")");
sendPart(os, boundary, MINI_DUMP_SUCCESS_KEY, success ? "True" : "False");
sendFile(os, boundary, MINI_DUMP_PATH_KEY, minidumpFile);
os.write(("\r\n--" + boundary + "--\r\n").getBytes());
os.flush();

View File

@ -82,14 +82,6 @@ public final class GeckoRuntime implements Parcelable {
*/
public static final String EXTRA_EXTRAS_PATH = "extrasPath";
/**
* This is a key for extra data sent with {@link #ACTION_CRASHED}. The value is
* a boolean indicating whether or not the crash dump was succcessfully
* retrieved. If this is false, the dump file referred to in
* {@link #EXTRA_MINIDUMP_PATH} may be corrupted or incomplete.
*/
public static final String EXTRA_MINIDUMP_SUCCESS = "minidumpSuccess";
/**
* This is a key for extra data sent with {@link #ACTION_CRASHED}. The value is
* a boolean indicating whether or not the crash was fatal or not. If true, the
@ -208,7 +200,6 @@ public final class GeckoRuntime implements Parcelable {
context, crashHandler);
i.putExtra(EXTRA_MINIDUMP_PATH, message.getString(EXTRA_MINIDUMP_PATH));
i.putExtra(EXTRA_EXTRAS_PATH, message.getString(EXTRA_EXTRAS_PATH));
i.putExtra(EXTRA_MINIDUMP_SUCCESS, true);
i.putExtra(EXTRA_CRASH_FATAL, message.getBoolean(EXTRA_CRASH_FATAL, true));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {

View File

@ -10,6 +10,13 @@ exclude: true
## v70
- Removed the obsolete `success` parameter from
[`CrashReporter#sendCrashReport`][70.3] and
[`CrashReporter#sendCrashReport`][70.4].
[70.3]: ../CrashReporter.html#sendCrashReport-android.content.Context-java.io.File-java.io.File-java.lang.String-
[70.4]: ../CrashReporter.html#sendCrashReport-android.content.Context-java.io.File-java.util.Map-java.lang.String-
- Added API for session context assignment
[`GeckoSessionSettings.Builder.contextId`][70.1] and deletion of data
related to a session context
@ -374,4 +381,4 @@ exclude: true
[65.24]: ../CrashReporter.html#sendCrashReport-android.content.Context-android.os.Bundle-java.lang.String-
[65.25]: ../GeckoResult.html
[api-version]: ce03a46188d89b6d2ed5ebc58bdcd640eda216c9
[api-version]: a378cc7122deed44920fd8f3aad8627ed7a7960d

View File

@ -45,8 +45,6 @@ public class ExampleCrashHandler extends Service {
mCrashIntent.getStringExtra(GeckoRuntime.EXTRA_MINIDUMP_PATH));
Log.d(LOGTAG, "Extras File: " +
mCrashIntent.getStringExtra(GeckoRuntime.EXTRA_EXTRAS_PATH));
Log.d(LOGTAG, "Dump Success: " +
mCrashIntent.getBooleanExtra(GeckoRuntime.EXTRA_MINIDUMP_SUCCESS, false));
Log.d(LOGTAG, "Fatal: " +
mCrashIntent.getBooleanExtra(GeckoRuntime.EXTRA_CRASH_FATAL, false));

View File

@ -874,11 +874,10 @@ static bool LaunchProgram(const XP_CHAR* aProgramPath,
*
* @param aProgramPath The path of the program to be launched
* @param aMinidumpPath The path to the crash minidump file
* @param aSucceeded True if the minidump was obtained successfully
*/
static bool LaunchCrashHandlerService(XP_CHAR* aProgramPath,
XP_CHAR* aMinidumpPath, bool aSucceeded) {
XP_CHAR* aMinidumpPath) {
static XP_CHAR extrasPath[XP_PATH_MAX];
size_t size = XP_PATH_MAX;
@ -896,15 +895,13 @@ static bool LaunchCrashHandlerService(XP_CHAR* aProgramPath,
"/system/bin/am", "/system/bin/am", androidStartServiceCommand,
"--user", androidUserSerial, "-a", "org.mozilla.gecko.ACTION_CRASHED",
"-n", aProgramPath, "--es", "minidumpPath", aMinidumpPath, "--es",
"extrasPath", extrasPath, "--ez", "minidumpSuccess",
aSucceeded ? "true" : "false", "--ez", "fatal", "true", (char*)0);
"extrasPath", extrasPath, "--ez", "fatal", "true", (char*)0);
} else {
Unused << execlp(
"/system/bin/am", "/system/bin/am", androidStartServiceCommand, "-a",
"org.mozilla.gecko.ACTION_CRASHED", "-n", aProgramPath, "--es",
"minidumpPath", aMinidumpPath, "--es", "extrasPath", extrasPath,
"--ez", "minidumpSuccess", aSucceeded ? "true" : "false", "--ez",
"fatal", "true", (char*)0);
"--ez", "fatal", "true", (char*)0);
}
_exit(1);
@ -1185,8 +1182,7 @@ bool MinidumpCallback(
}
#if defined(MOZ_WIDGET_ANDROID) // Android
returnValue =
LaunchCrashHandlerService(crashReporterPath, minidumpPath, succeeded);
returnValue = LaunchCrashHandlerService(crashReporterPath, minidumpPath);
#else // Windows, Mac, Linux, etc...
returnValue = LaunchProgram(crashReporterPath, minidumpPath);
# ifdef XP_WIN