1
0
mirror of git://f0xx.org/android_cast synced 2026-07-29 07:39:15 +03:00

Add gzip-aware crash upload and OTA staging build/deploy tooling.

This restores the interrupted stash work on a dedicated feature branch, including backend decoding support, Dockerized build scripts, and staging channel artifacts for end-to-end OTA validation.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Anton Afanasyeu
2026-06-02 16:08:46 +02:00
parent 9f9d617730
commit 097c0790b8
18 changed files with 258 additions and 11 deletions

View File

@@ -19,6 +19,7 @@ import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.zip.GZIPOutputStream;
/** POST crash JSON to the PHP receiver. */
public final class CrashUploadClient {
@@ -27,6 +28,14 @@ public final class CrashUploadClient {
private CrashUploadClient() {}
private static byte[] gzip(byte[] plain) throws java.io.IOException {
ByteArrayOutputStream buf = new ByteArrayOutputStream(Math.max(256, plain.length / 4));
try (GZIPOutputStream gz = new GZIPOutputStream(buf)) {
gz.write(plain);
}
return buf.toByteArray();
}
public static boolean upload(String uploadUrl, JSONObject report) {
if (uploadUrl == null || uploadUrl.isEmpty() || report == null) {
return false;
@@ -40,7 +49,9 @@ public final class CrashUploadClient {
conn.setDoOutput(true);
conn.setRequestProperty("Content-Type", "application/json; charset=utf-8");
conn.setRequestProperty("Accept", "application/json");
byte[] body = report.toString().getBytes(StandardCharsets.UTF_8);
conn.setRequestProperty("Content-Encoding", "gzip");
byte[] json = report.toString().getBytes(StandardCharsets.UTF_8);
byte[] body = gzip(json);
try (OutputStream out = conn.getOutputStream()) {
out.write(body);
}