Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/components/terminal/terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,9 @@ export default class TerminalComponent {

const terminalValues = values.terminalSettings;

Executor.setProotDebug(terminalValues.prootDebug);
Executor.BackgroundExecutor.setProotDebug(terminalValues.prootDebug);

await Terminal.startAxs(
false,
() => {},
Expand Down
1 change: 1 addition & 0 deletions src/components/terminal/terminalDefaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const DEFAULT_TERMINAL_SETTINGS = {
fontLigatures: false,
confirmTabClose: true,
failsafeMode: false,
prootDebug: false,
// Touch selection settings
touchSelectionTapHoldDuration: 600,
touchSelectionMoveThreshold: 8,
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/terminal/src/android/BackgroundExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
case "loadLibrary":
loadLibrary(args.getString(0), callbackContext);
return true;
case "setProotDebug":
ProcessManager.prootDebug = args.getBoolean(0);
callbackContext.success("PRoot debug " + (ProcessManager.prootDebug ? "enabled" : "disabled"));
return true;
default:
callbackContext.error("Unknown action: " + action);
return false;
Expand Down
7 changes: 7 additions & 0 deletions src/plugins/terminal/src/android/Executor.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,13 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
return true;
}

if (action.equals("setProotDebug")) {
boolean enabled = args.getBoolean(0);
ProcessManager.prootDebug = enabled;
callbackContext.success("PRoot debug " + (enabled ? "enabled" : "disabled"));
return true;
}

if (action.equals("listProcesses")) {
if (!isServiceBound || serviceMessenger == null) {
callbackContext.success(new org.json.JSONArray());
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/terminal/src/android/ProcessManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
public class ProcessManager {

private final Context context;
public static boolean prootDebug = false;

public ProcessManager(Context context) {
this.context = context;
Expand Down Expand Up @@ -90,6 +91,10 @@ private void setupEnvironment(Map<String, String> env) {
env.put("ANDROID_TZ", tz.getID());

env.put("FDROID", String.valueOf(isFdroidBuild()));

if (prootDebug) {
env.put("PROOT_VERBOSE", "2");
}
}

/**
Expand Down
6 changes: 6 additions & 0 deletions src/plugins/terminal/www/Executor.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,12 @@ class Executor {
exec(resolve, reject, this.ExecutorType, "loadLibrary", [path]);
});
}

setProotDebug(enabled) {
return new Promise((resolve, reject) => {
exec(resolve, reject, this.ExecutorType, "setProotDebug", [enabled]);
});
}
}

//backward compatibility
Expand Down
21 changes: 21 additions & 0 deletions src/settings/terminalSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export default function terminalSettings() {

const terminalValues = values.terminalSettings;

Executor.setProotDebug(terminalValues.prootDebug);
Executor.BackgroundExecutor.setProotDebug(terminalValues.prootDebug);

const items = [
{
key: "all_file_access",
Expand Down Expand Up @@ -232,6 +235,13 @@ export default function terminalSettings() {
info: strings["terminal:failsafe-info"],
category: categories.maintenance,
},
{
key: "prootDebug",
text: "PRoot Debug",
checkbox: terminalValues.prootDebug,
info: "Enable verbose PRoot logging (PROOT_VERBOSE=2). Useful for debugging sandbox issues.",
category: categories.maintenance,
},
{
key: "backup",
text: strings.backup,
Expand Down Expand Up @@ -315,6 +325,17 @@ export default function terminalSettings() {
}
return;

case "prootDebug":
appSettings.update({
terminalSettings: {
...values.terminalSettings,
[key]: value,
},
});
Executor.setProotDebug(value);
Executor.BackgroundExecutor.setProotDebug(value);
Comment thread
RohitKushvaha01 marked this conversation as resolved.
break;

default:
appSettings.update({
terminalSettings: {
Expand Down