Added operations to debug info

pull/146/head
M66B 6 years ago
parent 3505ea6b8f
commit abd7fecb70

@ -898,11 +898,51 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
}
}
// Attach operations
{
EntityAttachment ops = new EntityAttachment();
ops.message = draft.id;
ops.sequence = 2;
ops.name = "operations.txt";
ops.type = "text/plain";
ops.size = null;
ops.progress = 0;
ops.id = db.attachment().insertAttachment(ops);
OutputStream os = null;
File file = EntityAttachment.getFile(context, ops.id);
try {
os = new BufferedOutputStream(new FileOutputStream(file));
int size = 0;
DateFormat DF = SimpleDateFormat.getTimeInstance();
for (EntityOperation op : db.operation().getOperations()) {
String line = String.format("%s %d %s %s %s\r\n",
DF.format(op.created),
op.message,
op.name,
op.args,
op.error);
byte[] bytes = line.getBytes();
os.write(bytes);
size += bytes.length;
}
ops.size = size;
ops.progress = null;
ops.available = true;
db.attachment().updateAttachment(ops);
} finally {
if (os != null)
os.close();
}
}
// Attach logcat
{
EntityAttachment logcat = new EntityAttachment();
logcat.message = draft.id;
logcat.sequence = 2;
logcat.sequence = 3;
logcat.name = "logcat.txt";
logcat.type = "text/plain";
logcat.size = null;

@ -37,6 +37,9 @@ public interface DaoOperation {
@Query("SELECT * FROM operation ORDER BY id")
LiveData<List<EntityOperation>> liveOperations();
@Query("SELECT * FROM operation ORDER BY id")
List<EntityOperation> getOperations();
@Query("SELECT COUNT(id) FROM operation WHERE folder = :folder")
int getOperationCount(long folder);

Loading…
Cancel
Save