Skip to content

Commit fcc8e12

Browse files
committed
fix multiple sessions starting at view changes
1 parent b30f68b commit fcc8e12

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

termux-app/terminal-term/src/main/java/com/termux/app/TermuxActivity.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,17 @@ public View getView(int position, View convertView, @NonNull ViewGroup parent) {
517517

518518
if (mTermService == null) return; // Activity might have been destroyed.
519519
try {
520-
addNewSession(false, null);
520+
if (mListViewAdapter.getCount() == 0) {
521+
Log.i( EmulatorDebug.LOG_TAG,"Adding new session: onServiceConnected: "+componentName.flattenToShortString()+", "+service.toString());
522+
523+
addNewSession(false, null);
524+
} else {
525+
// activate the first session
526+
TerminalSession activatedSession = mListViewAdapter.getItem(0);
527+
switchToSession(activatedSession);
528+
getDrawer().closeDrawers();
529+
530+
}
521531
} catch (WindowManager.BadTokenException e) {
522532
// Activity finished - ignore.
523533
}

0 commit comments

Comments
 (0)