Hook up stacktraces to leak notification

Summary: Transfer it from the device, reformat the notification to make use of it.

Reviewed By: danielbuechele

Differential Revision: D15779267

fbshipit-source-id: 747dc7f895528618ff6a07c15b7f72bf6a1adde9
This commit is contained in:
Pascal Hartig
2019-06-13 11:15:01 -07:00
committed by Facebook Github Bot
parent 6168b3c604
commit 71575ce7cf
4 changed files with 38 additions and 3 deletions

View File

@@ -39,6 +39,8 @@ import com.facebook.imagepipeline.image.CloseableBitmap;
import com.facebook.imagepipeline.image.CloseableImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -521,6 +523,16 @@ public class FrescoFlipperPlugin extends BufferingFlipperPlugin
new FlipperObject.Builder()
.put("identityHashCode", System.identityHashCode(reference))
.put("className", reference.get().getClass().getName());
if (stacktrace != null) {
builder.put("stacktrace", getStackTraceString(stacktrace));
}
send(FRESCO_CLOSEABLE_REFERENCE_LEAK_EVENT, builder.build());
}
public static String getStackTraceString(Throwable tr) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
tr.printStackTrace(pw);
return sw.toString();
}
}