Skip to content

Commit

Permalink
Fix implicit intent
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftrot committed Mar 7, 2023
1 parent 97fe6ba commit 1710eb3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
20 changes: 10 additions & 10 deletions term/src/main/java/jackpal/androidterm/RemoteInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@
import androidx.preference.PreferenceManager;

import java.io.File;
import java.io.IOException;
import java.util.UUID;

import jackpal.androidterm.emulatorview.TermSession;
import jackpal.androidterm.emulatorview.compat.ClipboardManagerCompat;
import jackpal.androidterm.emulatorview.compat.ClipboardManagerCompatFactory;
import jackpal.androidterm.util.SessionList;
Expand Down Expand Up @@ -428,7 +426,6 @@ public static String quoteForBash(String s) {
}

protected String openNewWindow(String iInitialCommand) {
TermService service = getTermService();
Term.restoreSyncFileObserver(this);

String initialCommand = getInitialCommand();
Expand All @@ -441,13 +438,8 @@ protected String openNewWindow(String iInitialCommand) {
}

try {
TermSession session = Term.createTermSession(this, mSettings, initialCommand);

session.setFinishCallback(service);
service.getSessions().add(session);

mInitialCommand = initialCommand;
String handle = UUID.randomUUID().toString();
((GenericTermSession) session).setHandle(handle);

Intent intent = new Intent(PRIVACT_OPEN_NEW_WINDOW);
intent.addCategory(Intent.CATEGORY_DEFAULT);
Expand All @@ -457,11 +449,19 @@ protected String openNewWindow(String iInitialCommand) {
startActivity(intent);

return handle;
} catch (IOException e) {
} catch (Exception e) {
return null;
}
}

static private String mInitialCommand = null;
static public String getInitialCommand(String initialCommand) {
if (mInitialCommand == null) return initialCommand;
initialCommand = mInitialCommand;
mInitialCommand = null;
return initialCommand;
}

private boolean mReplace = false;

private String getInitialCommand() {
Expand Down
1 change: 1 addition & 0 deletions term/src/main/java/jackpal/androidterm/Term.java
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,7 @@ private TermSession createTermSession() throws IOException {
private String getInitialCommand() {
String cmd = mSettings.getInitialCommand();
cmd = mTermService.getInitialCommand(cmd, (mFirst && mTermService.getSessions().size() == 0));
cmd = RemoteInterface.getInitialCommand(cmd);
boolean doInstall = TermVimInstaller.doInstallVim;
if (FLAVOR_TERMINAL) {
doInstall = !TermVimInstaller.getTermInstallStatus(this);
Expand Down

0 comments on commit 1710eb3

Please sign in to comment.