Permalink
Browse files

Add debugging code

Add a number of tests to try and track down the situation that causes
a message to be sent to the wrong recipient. Bug 3057952

Change-Id: I2da3e91dcb039e87c3222e48026b859d1644793e
  • Loading branch information...
Tom Taylor
Tom Taylor committed Oct 5, 2010
1 parent 7c0f21f commit b6e4518a7b3740e48fd03f3803cc8696f15bbcc7
View
@@ -756,5 +756,12 @@
<!-- Brief small label shown to right of message when it is being sent. -->
<string name="sending_message">Sending\u2026</string>
+ <!-- For debugging: Dialog box title indicating there's a situation where data has unexpectedly
+ changed -->
+ <string name="error_state">Inconsistent state</string>
+ <!-- For debugging: Dialog box text indicating there's a situation where data has unexpectedly
+ changed -->
+ <string name="error_state_text">The state of threads and recipients is inconsistent. Please capture a bug report and send it to android-sms-bugs@google.com</string>
+
</resources>
@@ -16,6 +16,11 @@
package com.android.mms;
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnClickListener;
import android.util.Log;
public class LogTag {
@@ -24,6 +29,7 @@
public static final String TRANSACTION = "Mms:transaction";
public static final String APP = "Mms:app";
public static final String THREAD_CACHE = "Mms:threadcache";
+ public static final boolean SEVERE_WARNING = true; // TODO: turn off before shipping
private static String prettyArray(String[] array) {
if (array.length == 0) {
@@ -64,4 +70,24 @@ public static void warn(String format, Object... args) {
public static void error(String format, Object... args) {
Log.e(TAG, logFormat(format, args));
}
+
+ public static void showWarningDialog(final String msg, final Activity activity) {
+ Log.e(TAG, "WARNING!!!! " + msg);
+
+ activity.runOnUiThread(new Runnable() {
+ public void run() {
+ new AlertDialog.Builder(activity)
+ .setIcon(android.R.drawable.ic_dialog_alert)
+ .setTitle(R.string.error_state)
+ .setMessage(msg + "\n\n" + activity.getString(R.string.error_state_text))
+ .setPositiveButton(R.string.yes, new OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ }
+ })
+ .show();
+ }
+ });
+ }
+
}
Oops, something went wrong.

0 comments on commit b6e4518

Please sign in to comment.