diff --git a/leakcanary-android/src/main/java/com/squareup/leakcanary/AndroidExcludedRefs.java b/leakcanary-android/src/main/java/com/squareup/leakcanary/AndroidExcludedRefs.java index 605e86dcbf..07fe8cdf17 100644 --- a/leakcanary-android/src/main/java/com/squareup/leakcanary/AndroidExcludedRefs.java +++ b/leakcanary-android/src/main/java/com/squareup/leakcanary/AndroidExcludedRefs.java @@ -384,6 +384,18 @@ public enum AndroidExcludedRefs { } }; + EDITTEXT_BLINK_MESSAGEQEUE { + @Override void add(ExludedRefs.Builder excluded) { + // The EditText Blink of the Cursor is implemented using a callback and Messages, which + // trigger the display of the Cursor. If an AlertDialog or DialogFragment that contains a + // blinking cursor is detached a message is posted with a delay after the + // dialog has been closed and as a result leaks the Activity. + // This can be fixed manually by calling setCursorEnabled(false) in the dismiss() method of + // the dialog + excluded.instanceField("android.widget.EditText", "mContext"); + } + } + /** * This returns the references in the leak path that should be ignored by all on Android. */