fix: improve firmware file reading method in RNodeFlasherActivity for better performance and reliability

This commit is contained in:
Ivan 2026-08-14 13:23:34 -05:00
parent 8e1cd80fa9
commit 85aa7eb43f
No known key found for this signature in database
2 changed files with 8 additions and 1 deletions

View file

@ -26,6 +26,7 @@ import androidx.core.content.ContextCompat;
import com.meshchatx.AppSettingsLauncher;
import com.meshchatx.R;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
@ -340,7 +341,13 @@ public final class RNodeFlasherActivity extends AppCompatActivity implements Usb
if (in == null) {
throw new IllegalStateException("Could not open firmware file");
}
bytes = in.readAllBytes();
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buf = new byte[8192];
int n;
while ((n = in.read(buf)) != -1) {
out.write(buf, 0, n);
}
bytes = out.toByteArray();
}
String rawName = uri.getLastPathSegment();
final String name = (rawName == null || rawName.isEmpty()) ? "firmware.zip" : rawName;

Binary file not shown.