Skip to content

Commit

Permalink
Added: Init TermuxShellEnvironment at app startup
Browse files Browse the repository at this point in the history
This will currently cache `TermuxAppShellEnvironment` so that its not regenerated for each shell started since it contains some slightly expensive operations.
  • Loading branch information
agnostic-apollo committed Jun 11, 2022
1 parent 150b1ff commit f76c20d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/src/main/java/com/termux/app/TermuxApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public void onCreate() {
}

TermuxAmSocketServer.setupTermuxAmSocketServer(context);

// Init TermuxShellEnvironment constants and caches after everything has been setup including termux-am-socket server
TermuxShellEnvironment.init(this);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ public TermuxShellEnvironment() {
shellCommandShellEnvironment = new TermuxShellCommandShellEnvironment();
}

/** Init {@link TermuxShellEnvironment} constants and caches. */
public synchronized static void init(@NonNull Context currentPackageContext) {
TermuxAppShellEnvironment.setTermuxAppEnvironment(currentPackageContext);
}

/** Get shell environment for Termux. */
@NonNull
@Override
Expand Down

0 comments on commit f76c20d

Please sign in to comment.