aboutsummaryrefslogtreecommitdiffstats
path: root/app/src
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2015-04-16 07:52:18 -0700
committerKenny Root <kenny@the-b.org>2015-04-16 07:52:18 -0700
commit514a73bde9ec1c68d6e6ff65923fe05781676605 (patch)
tree488bc0ff40a9f8450653feefd24aa63eab81674d /app/src
parent5554bf422a49630e1462ca51bb0450e668f7ae0b (diff)
parentc37f46e75e25cb2b6161fd4972e1e4150889dcdc (diff)
downloadconnectbot-514a73bde9ec1c68d6e6ff65923fe05781676605.tar.gz
connectbot-514a73bde9ec1c68d6e6ff65923fe05781676605.tar.bz2
connectbot-514a73bde9ec1c68d6e6ff65923fe05781676605.zip
Merge branch 'master' into gradle-conversion
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/org/connectbot/service/TerminalManager.java26
1 files changed, 11 insertions, 15 deletions
diff --git a/app/src/main/java/org/connectbot/service/TerminalManager.java b/app/src/main/java/org/connectbot/service/TerminalManager.java
index 928c5f5..3bf9841 100644
--- a/app/src/main/java/org/connectbot/service/TerminalManager.java
+++ b/app/src/main/java/org/connectbot/service/TerminalManager.java
@@ -476,16 +476,18 @@ public class TerminalManager extends Service implements BridgeDisconnectedListen
@Override
public IBinder onBind(Intent intent) {
- Log.i(TAG, "Someone bound to TerminalManager");
-
+ Log.i(TAG, "Someone bound to TerminalManager with " + bridges.size() + " bridges active");
+ keepServiceAlive();
setResizeAllowed(true);
+ return binder;
+ }
+ /**
+ * Make sure we stay running to maintain the bridges. Later {@link #stopNow} should be called to stop the service.
+ */
+ private void keepServiceAlive() {
stopIdleTimer();
-
- // Make sure we stay running to maintain the bridges
startService(new Intent(this, TerminalManager.class));
-
- return binder;
}
@Override
@@ -500,17 +502,14 @@ public class TerminalManager extends Service implements BridgeDisconnectedListen
@Override
public void onRebind(Intent intent) {
super.onRebind(intent);
-
+ Log.i(TAG, "Someone rebound to TerminalManager with " + bridges.size() + " bridges active");
+ keepServiceAlive();
setResizeAllowed(true);
-
- Log.i(TAG, "Someone rebound to TerminalManager");
-
- stopIdleTimer();
}
@Override
public boolean onUnbind(Intent intent) {
- Log.i(TAG, "Someone unbound from TerminalManager");
+ Log.i(TAG, "Someone unbound from TerminalManager with " + bridges.size() + " bridges active");
setResizeAllowed(true);
@@ -522,9 +521,6 @@ public class TerminalManager extends Service implements BridgeDisconnectedListen
}
private class IdleTask extends TimerTask {
- /* (non-Javadoc)
- * @see java.util.TimerTask#run()
- */
@Override
public void run() {
Log.d(TAG, String.format("Stopping service after timeout of ~%d seconds", IDLE_TIMEOUT / 1000));