зеркало из https://github.com/mozilla/gecko-dev.git
Bug 703564 - Improve the crash reporter. r=mfinkle
This commit is contained in:
Родитель
0a21fd4aa5
Коммит
dc43ba31fb
|
@ -0,0 +1,25 @@
|
|||
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.widget.EditText;
|
||||
|
||||
public class ClickableWhenDisabledEditText extends EditText {
|
||||
public ClickableWhenDisabledEditText(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if (!isEnabled() && event.getAction() == MotionEvent.ACTION_UP) {
|
||||
return performClick();
|
||||
}
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
}
|
|
@ -22,16 +22,20 @@ import java.nio.channels.FileChannel;
|
|||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
|
||||
public class CrashReporter extends Activity
|
||||
{
|
||||
|
@ -108,8 +112,6 @@ public class CrashReporter extends Activity
|
|||
mProgressDialog = new ProgressDialog(this);
|
||||
mProgressDialog.setMessage(getString(R.string.sending_crash_report));
|
||||
|
||||
final Button restartButton = (Button) findViewById(R.id.restart);
|
||||
final Button closeButton = (Button) findViewById(R.id.close);
|
||||
String passedMinidumpPath = getIntent().getStringExtra(PASSED_MINI_DUMP_KEY);
|
||||
File passedMinidumpFile = new File(passedMinidumpPath);
|
||||
File pendingDir = new File(getFilesDir(), PENDING_SUFFIX);
|
||||
|
@ -132,6 +134,66 @@ public class CrashReporter extends Activity
|
|||
editor.putBoolean(GeckoApp.PREFS_WAS_STOPPED, true);
|
||||
editor.putBoolean(GeckoApp.PREFS_CRASHED, true);
|
||||
editor.commit();
|
||||
|
||||
final CheckBox allowContactCheckBox = (CheckBox) findViewById(R.id.allow_contact);
|
||||
final CheckBox includeUrlCheckBox = (CheckBox) findViewById(R.id.include_url);
|
||||
final CheckBox sendReportCheckBox = (CheckBox) findViewById(R.id.send_report);
|
||||
final EditText commentsEditText = (EditText) findViewById(R.id.comment);
|
||||
final EditText emailEditText = (EditText) findViewById(R.id.email);
|
||||
|
||||
sendReportCheckBox.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton checkbox, boolean isChecked) {
|
||||
commentsEditText.setEnabled(isChecked);
|
||||
commentsEditText.requestFocus();
|
||||
|
||||
includeUrlCheckBox.setEnabled(isChecked);
|
||||
allowContactCheckBox.setEnabled(isChecked);
|
||||
emailEditText.setEnabled(isChecked && allowContactCheckBox.isChecked());
|
||||
}
|
||||
});
|
||||
|
||||
allowContactCheckBox.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton checkbox, boolean isChecked) {
|
||||
// We need to check isEnabled() here because this listener is
|
||||
// fired on rotation -- even when the checkbox is disabled.
|
||||
emailEditText.setEnabled(checkbox.isEnabled() && isChecked);
|
||||
emailEditText.requestFocus();
|
||||
}
|
||||
});
|
||||
|
||||
emailEditText.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// Even if the email EditText is disabled, allow it to be
|
||||
// clicked and focused.
|
||||
if (sendReportCheckBox.isChecked() && !v.isEnabled()) {
|
||||
allowContactCheckBox.setChecked(true);
|
||||
v.setEnabled(true);
|
||||
v.requestFocus();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setMessage(R.string.crash_closing_alert);
|
||||
builder.setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builder.setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
CrashReporter.this.finish();
|
||||
}
|
||||
});
|
||||
builder.show();
|
||||
}
|
||||
|
||||
private void backgroundSendReport() {
|
||||
|
@ -304,6 +366,16 @@ public class CrashReporter extends Activity
|
|||
sendPart(os, boundary, "Android_Logcat", readLogcat());
|
||||
}
|
||||
|
||||
String comment = ((EditText) findViewById(R.id.comment)).getText().toString();
|
||||
if (!TextUtils.isEmpty(comment)) {
|
||||
sendPart(os, boundary, "Comments", comment);
|
||||
}
|
||||
|
||||
if (((CheckBox) findViewById(R.id.allow_contact)).isChecked()) {
|
||||
String email = ((EditText) findViewById(R.id.email)).getText().toString();
|
||||
sendPart(os, boundary, "Email", email);
|
||||
}
|
||||
|
||||
sendFile(os, boundary, MINI_DUMP_PATH_KEY, minidumpFile);
|
||||
os.write(("\r\n--" + boundary + "--\r\n").getBytes());
|
||||
os.flush();
|
||||
|
|
|
@ -69,6 +69,7 @@ FENNEC_JAVA_FILES = \
|
|||
CameraVideoResultHandler.java \
|
||||
CanvasDelegate.java \
|
||||
CheckableLinearLayout.java \
|
||||
ClickableWhenDisabledEditText.java \
|
||||
SyncPreference.java \
|
||||
db/BrowserDB.java \
|
||||
db/LocalBrowserDB.java \
|
||||
|
@ -1044,6 +1045,7 @@ MOZ_ANDROID_DRAWABLES += \
|
|||
mobile/android/base/resources/drawable/tab_thumbnail.xml \
|
||||
mobile/android/base/resources/drawable/tabs_level.xml \
|
||||
mobile/android/base/resources/drawable/tabs_panel_indicator.xml \
|
||||
mobile/android/base/resources/drawable/textbox_bg.xml \
|
||||
mobile/android/base/resources/drawable/webapp_titlebar_bg.xml \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -14,15 +14,18 @@
|
|||
<!ENTITY awesomebar_history_title "History">
|
||||
|
||||
<!ENTITY crash_reporter_title "&brandShortName; Crash Reporter">
|
||||
<!ENTITY crash_message "&brandShortName; has crashed. Your tabs should be listed on the &brandShortName; Start page when you restart.">
|
||||
<!ENTITY crash_help_message "Please help us fix this problem!">
|
||||
<!ENTITY crash_send_report_message "Send Mozilla a crash report">
|
||||
<!ENTITY crash_include_url "Include page address">
|
||||
<!ENTITY crash_message2 "&brandShortName; had a problem and crashed. Your tabs should be listed on the &brandShortName; Start page when you restart.">
|
||||
<!ENTITY crash_send_report_message2 "Tell Mozilla about this crash so they can fix it">
|
||||
<!ENTITY crash_include_url2 "Include the address of the page I was on">
|
||||
<!ENTITY crash_sorry "We\'re sorry">
|
||||
<!ENTITY crash_comment "Add a comment (comments are publicly visible)">
|
||||
<!ENTITY crash_allow_contact "Allow Mozilla to contact me about this report">
|
||||
<!ENTITY crash_email "Your email">
|
||||
<!ENTITY crash_closing_alert "Exit without sending a crash report?">
|
||||
<!ENTITY sending_crash_report "Sending crash report\u2026">
|
||||
<!ENTITY crash_close_label "Close">
|
||||
<!ENTITY crash_restart_label "Restart &brandShortName;">
|
||||
<!ENTITY sending_crash_report "Sending crash report\u2026">
|
||||
<!ENTITY exit_label "Exit">
|
||||
<!ENTITY continue_label "Continue">
|
||||
|
||||
<!ENTITY launcher_shortcuts_title "&brandShortName; Web Apps">
|
||||
<!ENTITY launcher_shortcuts_empty "No web apps were found">
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_enabled="true">
|
||||
<shape>
|
||||
<solid android:color="@color/textbox_background" />
|
||||
<stroke android:width="1dp" android:color="@color/textbox_stroke" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:state_enabled="false">
|
||||
<shape>
|
||||
<solid android:color="@color/textbox_background_disabled" />
|
||||
<stroke android:width="1dp" android:color="@color/textbox_stroke_disabled" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</selector>
|
|
@ -5,61 +5,118 @@
|
|||
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
android:layout_height="fill_parent"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dip">
|
||||
android:background="@color/background_normal">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dip"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/crash_message"/>
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dip"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/crash_help_message"/>
|
||||
|
||||
<CheckBox android:id="@+id/send_report"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/crash_send_report_message"/>
|
||||
|
||||
<CheckBox android:id="@+id/include_url"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/crash_include_url"/>
|
||||
<LinearLayout android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dip"
|
||||
android:textSize="30sp"
|
||||
android:textColor="#000"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:text="@string/crash_sorry"/>
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dip"
|
||||
android:textAppearance="@style/TextAppearance"
|
||||
android:text="@string/crash_message2"/>
|
||||
|
||||
<CheckBox android:id="@+id/send_report"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:textColor="@color/primary_text"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:text="@string/crash_send_report_message2"/>
|
||||
|
||||
<EditText android:id="@+id/comment"
|
||||
style="@style/CrashReporter.EditText"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:inputType="textMultiLine"
|
||||
android:lines="5"
|
||||
android:gravity="top"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:hint="@string/crash_comment" />
|
||||
|
||||
<CheckBox android:id="@+id/include_url"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/primary_text"
|
||||
android:textAppearance="@style/TextAppearance"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:text="@string/crash_include_url2"/>
|
||||
|
||||
<CheckBox android:id="@+id/allow_contact"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/primary_text"
|
||||
android:textAppearance="@style/TextAppearance"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:text="@string/crash_allow_contact"/>
|
||||
|
||||
<org.mozilla.gecko.ClickableWhenDisabledEditText
|
||||
android:id="@+id/email"
|
||||
style="@style/CrashReporter.EditText"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:inputType="textEmailAddress"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:enabled="false"
|
||||
android:clickable="true"
|
||||
android:hint="@string/crash_email" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View android:layout_width="fill_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#999" />
|
||||
|
||||
<LinearLayout android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dip"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
android:layout_gravity="bottom">
|
||||
|
||||
<Button android:id="@+id/close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10px"
|
||||
android:minWidth="120sp"
|
||||
android:layout_weight="1.0"
|
||||
android:onClick="onCloseClick"
|
||||
android:text="@string/crash_close_label"/>
|
||||
android:text="@string/crash_close_label"
|
||||
android:textAppearance="?android:attr/textAppearance"
|
||||
android:background="@drawable/action_bar_button"/>
|
||||
|
||||
<View android:layout_width="1dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="#999" />
|
||||
|
||||
<Button android:id="@+id/restart"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10px"
|
||||
android:minWidth="120sp"
|
||||
android:layout_weight="1.0"
|
||||
android:onClick="onRestartClick"
|
||||
android:text="@string/crash_restart_label"/>
|
||||
|
||||
android:text="@string/crash_restart_label"
|
||||
android:textAppearance="?android:attr/textAppearance"
|
||||
android:background="@drawable/action_bar_button"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -77,5 +77,11 @@
|
|||
<color name="tab_row_pressed">#4D000000</color>
|
||||
<color name="abouthome_topsite_pin">#55000000</color>
|
||||
<color name="dialogtitle_textcolor">#ffffff</color>
|
||||
|
||||
<color name="textbox_background">#FFF</color>
|
||||
<color name="textbox_background_disabled">#DDD</color>
|
||||
<color name="textbox_stroke">#000</color>
|
||||
<color name="textbox_stroke_disabled">#666</color>
|
||||
|
||||
</resources>
|
||||
|
||||
|
|
|
@ -420,4 +420,12 @@
|
|||
|
||||
<style name="GeckoDialogTitle.SubTitle" />
|
||||
|
||||
<style name="CrashReporter" />
|
||||
|
||||
<style name="CrashReporter.EditText">
|
||||
<item name="android:background">@drawable/textbox_bg</item>
|
||||
<item name="android:padding">10dp</item>
|
||||
<item name="android:textAppearance">@style/TextAppearance</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -28,15 +28,18 @@
|
|||
<string name="awesomebar_history_title">&awesomebar_history_title;</string>
|
||||
|
||||
<string name="crash_reporter_title">&crash_reporter_title;</string>
|
||||
<string name="crash_message">&crash_message;</string>
|
||||
<string name="crash_help_message">&crash_help_message;</string>
|
||||
<string name="crash_send_report_message">&crash_send_report_message;</string>
|
||||
<string name="crash_include_url">&crash_include_url;</string>
|
||||
<string name="crash_message2">&crash_message2;</string>
|
||||
<string name="crash_send_report_message2">&crash_send_report_message2;</string>
|
||||
<string name="crash_include_url2">&crash_include_url2;</string>
|
||||
<string name="crash_sorry">&crash_sorry;</string>
|
||||
<string name="crash_comment">&crash_comment;</string>
|
||||
<string name="crash_allow_contact">&crash_allow_contact;</string>
|
||||
<string name="crash_email">&crash_email;</string>
|
||||
<string name="crash_closing_alert">&crash_closing_alert;</string>
|
||||
<string name="sending_crash_report">&sending_crash_report;</string>
|
||||
<string name="crash_close_label">&crash_close_label;</string>
|
||||
<string name="crash_restart_label">&crash_restart_label;</string>
|
||||
<string name="sending_crash_report">&sending_crash_report;</string>
|
||||
<string name="exit_label">&exit_label;</string>
|
||||
<string name="continue_label">&continue_label;</string>
|
||||
|
||||
<string name="launcher_shortcuts_title">&launcher_shortcuts_title;</string>
|
||||
<string name="launcher_shortcuts_empty">&launcher_shortcuts_empty;</string>
|
||||
|
|
Загрузка…
Ссылка в новой задаче