Minamp 1.1

- Run network/TLS work on 256 KB-stack threads (net/Threads.java): Android 2.x's
  ~16 KB default stack overflowed during the bundled TLS handshake
- Close pooled TLS connections off the caller thread
- Try several Plex music-transcoder URL variants until the server accepts one,
  and remember the one that worked
- Accept pasted server URLs with paths; default to 443 for https
- Catch fatal errors and save a crash report (shown on next launch and written
  to Minamp-error.txt on the SD card)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xockoandClaude Opus 5.5 committed 2026-10-14 19:59:58 +02:00
1 parent 948d1198ad
commit 0a2ac901bd
16 files changed
+417 -80

No files matched your search

+27 -6
View File
@@ -3,7 +3,6 @@ package com.minamp;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import android.app.Activity;
import android.app.AlertDialog;
@@ -25,7 +24,7 @@ import com.minamp.plex.Server;
/** Shared bits: background tasks, mini player, item actions, settings menu. */
public abstract class BaseActivity extends Activity implements PlayerService.Listener, PlayQueue.Listener {
private static final ExecutorService POOL = Executors.newFixedThreadPool(2);
private static final ExecutorService POOL = com.minamp.net.Threads.pool("task", 2);
protected App app;
protected boolean destroyed;
@@ -54,15 +53,18 @@ public abstract class BaseActivity extends Activity implements PlayerService.Lis
app.handler.post(new Runnable() { public void run() { if (!destroyed) t.done(r); } });
} catch (final Exception e) {
app.handler.post(new Runnable() { public void run() { if (!destroyed) t.fail(e); } });
} catch (final OutOfMemoryError e) {
app.images.clearMemory();
app.handler.post(new Runnable() { public void run() { if (!destroyed) t.fail(new Exception("Out of memory")); } });
} catch (final Throwable e) {
// Errors (out of memory, stack overflow, a class the old VM can't load) must not kill the app
if (e instanceof OutOfMemoryError) app.images.clearMemory();
App.logError("task", e);
final Exception wrapped = new Exception(com.minamp.net.Threads.describe(e));
app.handler.post(new Runnable() { public void run() { if (!destroyed) t.fail(wrapped); } });
}
}
});
}
protected void toast(String s) { Toast.makeText(this, s, Toast.LENGTH_SHORT).show(); }
protected void toast(String s) { Toast.makeText(this, s, s != null && s.length() > 40 ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT).show(); }
protected static String msg(Exception e) { return PlayerService.message(e); }
@@ -74,6 +76,25 @@ public abstract class BaseActivity extends Activity implements PlayerService.Lis
app = App.get();
}
/** If the last run hit an error, show it so it can be reported (also saved as Minamp-error.txt on the SD card). */
protected void showCrashReportIfAny() {
final String report = app.takeCrashReport();
if (report == null) return;
android.widget.ScrollView sv = new android.widget.ScrollView(this);
TextView tv = new TextView(this);
tv.setText(report);
tv.setTextSize(10);
tv.setTextColor(0xFFDDDDDD);
int p = Ui.dp(this, 8);
tv.setPadding(p, p, p, p);
sv.addView(tv);
new AlertDialog.Builder(this)
.setTitle("Minamp hit an error last time")
.setView(sv)
.setPositiveButton("OK", null)
.show();
}
@Override
protected void onResume() {
super.onResume();