Index: remoting/android/java/src/org/chromium/chromoting/Chromoting.java |
diff --git a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java |
index 800be2e323e043b80d7705411ddc1359ec91d527..4a84472500a7378440ae4c6e7e380cc77d1955ef 100644 |
--- a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java |
+++ b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java |
@@ -36,6 +36,7 @@ import org.chromium.chromoting.accountswitcher.AccountSwitcher; |
import org.chromium.chromoting.accountswitcher.AccountSwitcherFactory; |
import org.chromium.chromoting.help.HelpContext; |
import org.chromium.chromoting.help.HelpSingleton; |
+import org.chromium.chromoting.jni.Client; |
import org.chromium.chromoting.jni.ConnectionListener; |
import org.chromium.chromoting.jni.JniInterface; |
@@ -335,8 +336,10 @@ public class Chromoting extends AppCompatActivity implements ConnectionListener, |
@Override |
public void onDestroy() { |
super.onDestroy(); |
- JniInterface.disconnectFromHost(); |
mAccountSwitcher.destroy(); |
+ if (Client.getClient() != null) { |
+ Client.getClient().destroy(); |
Sergey Ulanov
2016/01/30 01:03:23
keep the Client object created in connectToHost()
Lambros
2016/02/03 22:57:43
I'm not sure we should be disconnecting anyway in
|
+ } |
} |
/** Called when a child Activity exits and sends a result back to this Activity. */ |
@@ -430,6 +433,11 @@ public class Chromoting extends AppCompatActivity implements ConnectionListener, |
} |
private void connectToHost(HostInfo host) { |
+ if (Client.getClient() != null) { |
+ Client.getClient().destroy(); |
+ } |
+ |
+ final Client client = new Client(); |
mProgressIndicator = ProgressDialog.show( |
this, |
host.name, |
@@ -439,11 +447,11 @@ public class Chromoting extends AppCompatActivity implements ConnectionListener, |
new DialogInterface.OnCancelListener() { |
@Override |
public void onCancel(DialogInterface dialog) { |
- JniInterface.disconnectFromHost(); |
+ client.destroy(); |
} |
}); |
- SessionConnector connector = new SessionConnector(this, this, mHostListLoader); |
- mAuthenticator = new SessionAuthenticator(this, host); |
+ SessionConnector connector = new SessionConnector(client, this, this, mHostListLoader); |
+ mAuthenticator = new SessionAuthenticator(this, client, host); |
connector.connectToHost(mAccount, mToken, host, mAuthenticator); |
} |