|
|
@ -601,19 +601,18 @@ public class Log {
|
|
|
|
attachment.progress = 0;
|
|
|
|
attachment.progress = 0;
|
|
|
|
attachment.id = db.attachment().insertAttachment(attachment);
|
|
|
|
attachment.id = db.attachment().insertAttachment(attachment);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long size = 0;
|
|
|
|
File file = attachment.getFile(context);
|
|
|
|
File file = attachment.getFile(context);
|
|
|
|
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
|
|
|
|
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
|
|
|
|
|
|
|
|
|
|
|
|
long size = 0;
|
|
|
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, ?> settings = prefs.getAll();
|
|
|
|
Map<String, ?> settings = prefs.getAll();
|
|
|
|
for (String key : settings.keySet())
|
|
|
|
for (String key : settings.keySet())
|
|
|
|
size += write(os, key + "=" + settings.get(key) + "\r\n");
|
|
|
|
size += write(os, key + "=" + settings.get(key) + "\r\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
db.attachment().setDownloaded(attachment.id, size);
|
|
|
|
db.attachment().setDownloaded(attachment.id, size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void attachAccounts(Context context, long id, int sequence) throws IOException {
|
|
|
|
private static void attachAccounts(Context context, long id, int sequence) throws IOException {
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
@ -628,11 +627,9 @@ public class Log {
|
|
|
|
attachment.progress = 0;
|
|
|
|
attachment.progress = 0;
|
|
|
|
attachment.id = db.attachment().insertAttachment(attachment);
|
|
|
|
attachment.id = db.attachment().insertAttachment(attachment);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long size = 0;
|
|
|
|
File file = attachment.getFile(context);
|
|
|
|
File file = attachment.getFile(context);
|
|
|
|
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
|
|
|
|
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
|
|
|
|
|
|
|
|
|
|
|
|
long size = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<EntityAccount> accounts = db.account().getAccounts();
|
|
|
|
List<EntityAccount> accounts = db.account().getAccounts();
|
|
|
|
for (EntityAccount account : accounts)
|
|
|
|
for (EntityAccount account : accounts)
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -656,10 +653,10 @@ public class Log {
|
|
|
|
} catch (JSONException ex) {
|
|
|
|
} catch (JSONException ex) {
|
|
|
|
size += write(os, ex.toString() + "\r\n");
|
|
|
|
size += write(os, ex.toString() + "\r\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
db.attachment().setDownloaded(attachment.id, size);
|
|
|
|
db.attachment().setDownloaded(attachment.id, size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void attachNetworkInfo(Context context, long id, int sequence) throws IOException {
|
|
|
|
private static void attachNetworkInfo(Context context, long id, int sequence) throws IOException {
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
@ -674,10 +671,9 @@ public class Log {
|
|
|
|
attachment.progress = 0;
|
|
|
|
attachment.progress = 0;
|
|
|
|
attachment.id = db.attachment().insertAttachment(attachment);
|
|
|
|
attachment.id = db.attachment().insertAttachment(attachment);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long size = 0;
|
|
|
|
File file = attachment.getFile(context);
|
|
|
|
File file = attachment.getFile(context);
|
|
|
|
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
|
|
|
|
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
|
|
|
|
|
|
|
|
|
|
|
|
long size = 0;
|
|
|
|
|
|
|
|
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
|
|
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
|
|
|
|
|
|
|
|
|
|
Network active = null;
|
|
|
|
Network active = null;
|
|
|
@ -688,10 +684,10 @@ public class Log {
|
|
|
|
NetworkCapabilities caps = cm.getNetworkCapabilities(network);
|
|
|
|
NetworkCapabilities caps = cm.getNetworkCapabilities(network);
|
|
|
|
size += write(os, (network.equals(active) ? "active=" : "network=") + network + " capabilities=" + caps + "\r\n\r\n");
|
|
|
|
size += write(os, (network.equals(active) ? "active=" : "network=") + network + " capabilities=" + caps + "\r\n\r\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
db.attachment().setDownloaded(attachment.id, size);
|
|
|
|
db.attachment().setDownloaded(attachment.id, size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void attachLog(Context context, long id, int sequence) throws IOException {
|
|
|
|
private static void attachLog(Context context, long id, int sequence) throws IOException {
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
@ -706,19 +702,18 @@ public class Log {
|
|
|
|
attachment.progress = 0;
|
|
|
|
attachment.progress = 0;
|
|
|
|
attachment.id = db.attachment().insertAttachment(attachment);
|
|
|
|
attachment.id = db.attachment().insertAttachment(attachment);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long size = 0;
|
|
|
|
File file = attachment.getFile(context);
|
|
|
|
File file = attachment.getFile(context);
|
|
|
|
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
|
|
|
|
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
|
|
|
|
|
|
|
|
|
|
|
|
long size = 0;
|
|
|
|
|
|
|
|
long from = new Date().getTime() - 24 * 3600 * 1000L;
|
|
|
|
long from = new Date().getTime() - 24 * 3600 * 1000L;
|
|
|
|
DateFormat TF = Helper.getTimeInstance(context);
|
|
|
|
DateFormat TF = Helper.getTimeInstance(context);
|
|
|
|
|
|
|
|
|
|
|
|
for (EntityLog entry : db.log().getLogs(from))
|
|
|
|
for (EntityLog entry : db.log().getLogs(from))
|
|
|
|
size += write(os, String.format("%s %s\r\n", TF.format(entry.time), entry.data));
|
|
|
|
size += write(os, String.format("%s %s\r\n", TF.format(entry.time), entry.data));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
db.attachment().setDownloaded(attachment.id, size);
|
|
|
|
db.attachment().setDownloaded(attachment.id, size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void attachOperations(Context context, long id, int sequence) throws IOException {
|
|
|
|
private static void attachOperations(Context context, long id, int sequence) throws IOException {
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
@ -733,10 +728,9 @@ public class Log {
|
|
|
|
attachment.progress = 0;
|
|
|
|
attachment.progress = 0;
|
|
|
|
attachment.id = db.attachment().insertAttachment(attachment);
|
|
|
|
attachment.id = db.attachment().insertAttachment(attachment);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long size = 0;
|
|
|
|
File file = attachment.getFile(context);
|
|
|
|
File file = attachment.getFile(context);
|
|
|
|
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
|
|
|
|
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
|
|
|
|
|
|
|
|
|
|
|
|
long size = 0;
|
|
|
|
|
|
|
|
DateFormat TF = Helper.getTimeInstance(context);
|
|
|
|
DateFormat TF = Helper.getTimeInstance(context);
|
|
|
|
|
|
|
|
|
|
|
|
for (EntityOperation op : db.operation().getOperations())
|
|
|
|
for (EntityOperation op : db.operation().getOperations())
|
|
|
@ -746,10 +740,10 @@ public class Log {
|
|
|
|
op.name,
|
|
|
|
op.name,
|
|
|
|
op.args,
|
|
|
|
op.args,
|
|
|
|
op.error));
|
|
|
|
op.error));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
db.attachment().setDownloaded(attachment.id, size);
|
|
|
|
db.attachment().setDownloaded(attachment.id, size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void attachLogcat(Context context, long id, int sequence) throws IOException {
|
|
|
|
private static void attachLogcat(Context context, long id, int sequence) throws IOException {
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
@ -767,7 +761,6 @@ public class Log {
|
|
|
|
Process proc = null;
|
|
|
|
Process proc = null;
|
|
|
|
File file = attachment.getFile(context);
|
|
|
|
File file = attachment.getFile(context);
|
|
|
|
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
|
|
|
|
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
|
|
|
|
|
|
|
|
|
|
|
|
String[] cmd = new String[]{"logcat",
|
|
|
|
String[] cmd = new String[]{"logcat",
|
|
|
|
"-d",
|
|
|
|
"-d",
|
|
|
|
"-v", "threadtime",
|
|
|
|
"-v", "threadtime",
|
|
|
@ -782,7 +775,6 @@ public class Log {
|
|
|
|
size += write(os, line + "\r\n");
|
|
|
|
size += write(os, line + "\r\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
db.attachment().setDownloaded(attachment.id, size);
|
|
|
|
db.attachment().setDownloaded(attachment.id, size);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
if (proc != null)
|
|
|
|
if (proc != null)
|
|
|
|