mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 06:15:58 +00:00
Logs: the app's own log, the crash buffer, audio and the network
Closes the four gaps that were left after the session folder: everything the app itself decided was reaching logcat and nowhere a user can get at, sound had no record at all, the network had none either, and a session the system killed left its only trace in a buffer nobody was reading. app.log mirrors this process's logcat for the length of the session - which driver was chosen and why, the audio line, a rival client stopped, a helper missing, the exit status. An app may always read back its own entries, so this needs no permission; where a ROM refuses, the file says so rather than being absent and looking like silence. crash.log is Android's crash buffer at teardown. proot once died before main over a missing library and said so there and in no other log, and a session the OS kills for spawning children says it there too. audio.log takes the PulseAudio daemon's output and the relay helper's, both of which went to logcat only. The 17.0-module failure that cost the microphone a whole round of builds would have been one line in this file. network.txt records the transport, whether the link validated, the address families, the DNS the system offered and the resolv.conf the runtime was actually given - never the network's name, which is identifying. It also states plainly that the client's own "wifi is off" is cosmetic, since that reading has now cost two people an afternoon. Left out on purpose: a Vulkan dump. It needs a new native entry point for information wayland.log already carries on its first lines.
This commit is contained in:
1 parent
0dcbf64aa5
commit
4041849791
6 files changed
+291
-2
No files matched your search
@@ -34,6 +34,8 @@ public class DirectAudioRelayComponent extends EnvironmentComponent {
|
||||
public static final String BINARY = "libdirectaudiorelay.so";
|
||||
|
||||
private final File socketPath;
|
||||
/** Shared with PulseAudioComponent: one audio.log per session, appended by both. */
|
||||
private File logFile;
|
||||
/** Null when the microphone was not asked for; the helper then opens no input stream. */
|
||||
private final File micFifoPath;
|
||||
private int pid = -1;
|
||||
@@ -43,6 +45,11 @@ public class DirectAudioRelayComponent extends EnvironmentComponent {
|
||||
this.micFifoPath = micFifoPath;
|
||||
}
|
||||
|
||||
/** Send the helper's output to this file as well as logcat. Set before {@link #start()}. */
|
||||
public void setLogFile(File file) {
|
||||
this.logFile = file;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
stop();
|
||||
@@ -91,7 +98,24 @@ public class DirectAudioRelayComponent extends EnvironmentComponent {
|
||||
}
|
||||
ArrayList<String> env = new ArrayList<>();
|
||||
env.add("HOME=" + context.getFilesDir());
|
||||
pid = ProcessHelper.exec(command.toString(), env.toArray(new String[0]), context.getFilesDir());
|
||||
java.io.PrintWriter out = null;
|
||||
if (logFile != null) {
|
||||
try {
|
||||
out = new java.io.PrintWriter(new java.io.FileWriter(logFile, true));
|
||||
out.println("== DirectAudio relay helper starting"
|
||||
+ (micFifoPath != null ? " with the microphone" : " (no microphone)"));
|
||||
out.flush();
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "could not open " + logFile, e);
|
||||
}
|
||||
}
|
||||
final java.io.PrintWriter log = out;
|
||||
pid = ProcessHelper.exec(command.toString(), env.toArray(new String[0]),
|
||||
context.getFilesDir(), null,
|
||||
line -> {
|
||||
Log.i(TAG, line);
|
||||
if (log != null) synchronized (log) { log.println(line); log.flush(); }
|
||||
});
|
||||
Log.i(TAG, "started pid=" + pid + " socket=" + socketPath
|
||||
+ (micFifoPath != null ? " mic=" + micFifoPath : " (no microphone)"));
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@ public class PulseAudioComponent extends EnvironmentComponent {
|
||||
private static final String BUNDLE_STAMP = "2026-09-21-pa13-pipe-modules";
|
||||
|
||||
private final File workingDir;
|
||||
/** Where the daemon's own output is kept for this session, or null for logcat only. */
|
||||
private File logFile;
|
||||
/**
|
||||
* A named pipe carrying microphone audio, or null for no microphone. The bundle ships
|
||||
* module-aaudio-sink but no matching source, and the daemon runs where Android permits
|
||||
@@ -53,6 +55,11 @@ public class PulseAudioComponent extends EnvironmentComponent {
|
||||
this.micFifoPath = micFifoPath;
|
||||
}
|
||||
|
||||
/** Send the daemon's output to this file as well as logcat. Set before {@link #start()}. */
|
||||
public void setLogFile(File file) {
|
||||
this.logFile = file;
|
||||
}
|
||||
|
||||
public File socket() {
|
||||
return new File(workingDir, SOCKET_NAME);
|
||||
}
|
||||
@@ -125,8 +132,15 @@ public class PulseAudioComponent extends EnvironmentComponent {
|
||||
String command = workingDir.getAbsolutePath() + "/libpulseaudio.so"
|
||||
+ " --system=false --disable-shm=true --fail=false"
|
||||
+ " -n --file=default.pa --daemonize=false --use-pid-file=false --exit-idle-time=-1";
|
||||
// A module that refuses to load, a pipe that could not be made, the daemon exiting at
|
||||
// startup: all of it used to reach logcat and nothing else, so a user's folder said nothing
|
||||
// at all about sound. Four separate faults hid behind "no input device" in one night.
|
||||
final java.io.PrintWriter out = openLog();
|
||||
pid = ProcessHelper.exec(command, env.toArray(new String[0]), workingDir, null,
|
||||
line -> Log.i(TAG, line));
|
||||
line -> {
|
||||
Log.i(TAG, line);
|
||||
if (out != null) synchronized (out) { out.println(line); out.flush(); }
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -137,6 +151,20 @@ public class PulseAudioComponent extends EnvironmentComponent {
|
||||
}
|
||||
}
|
||||
|
||||
/** The session's audio log, appended to by both the daemon and the relay helper. */
|
||||
private java.io.PrintWriter openLog() {
|
||||
if (logFile == null) return null;
|
||||
try {
|
||||
java.io.PrintWriter w = new java.io.PrintWriter(new java.io.FileWriter(logFile, true));
|
||||
w.println("== PulseAudio daemon starting" + (micFifoPath != null ? " with a microphone source" : ""));
|
||||
w.flush();
|
||||
return w;
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "could not open " + logFile, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void copyFromLibraryDir() {
|
||||
String[] libs = {"libltdl.so", "libpulseaudio.so", "libpulse.so",
|
||||
"libpulsecommon-13.0.so", "libpulsecore-13.0.so", "libsndfile.so", "libffi.so"};
|
||||
|
||||
Reference in new issue
Block a user