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 f53926c37c75c294b40accc15849d6382199a722..a10a17f43925f270b5305a27a3ee3f23d1865f13 100644 |
--- a/remoting/android/java/src/org/chromium/chromoting/Chromoting.java |
+++ b/remoting/android/java/src/org/chromium/chromoting/Chromoting.java |
@@ -36,7 +36,6 @@ |
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; |
@@ -117,9 +116,6 @@ |
private ActionBarDrawerToggle mDrawerToggle; |
private AccountSwitcher mAccountSwitcher; |
- |
- /** The currently-connected Client, if any. */ |
- private Client mClient; |
/** Shows a warning explaining that a Google account is required, then closes the activity. */ |
private void showNoAccountsDialog() { |
@@ -353,14 +349,8 @@ |
@Override |
public void onDestroy() { |
super.onDestroy(); |
+ JniInterface.disconnectFromHost(); |
mAccountSwitcher.destroy(); |
- |
- // TODO(lambroslambrou): Determine whether we really need to tear down the connection here, |
- // so we can remove this code. |
- if (mClient != null) { |
- mClient.destroy(); |
- mClient = null; |
- } |
} |
/** Called when a child Activity exits and sends a result back to this Activity. */ |
@@ -454,11 +444,6 @@ |
} |
private void connectToHost(HostInfo host) { |
- if (mClient != null) { |
- mClient.destroy(); |
- } |
- |
- mClient = new Client(); |
mProgressIndicator = ProgressDialog.show( |
this, |
host.name, |
@@ -468,15 +453,11 @@ |
new DialogInterface.OnCancelListener() { |
@Override |
public void onCancel(DialogInterface dialog) { |
- if (mClient != null) { |
- mClient.destroy(); |
- mClient = null; |
- } |
+ JniInterface.disconnectFromHost(); |
} |
}); |
- |
- SessionConnector connector = new SessionConnector(mClient, this, this, mHostListLoader); |
- mAuthenticator = new SessionAuthenticator(this, mClient, host); |
+ SessionConnector connector = new SessionConnector(this, this, mHostListLoader); |
+ mAuthenticator = new SessionAuthenticator(this, host); |
connector.connectToHost(mAccount, mToken, host, mAuthenticator, |
getPreferences(MODE_PRIVATE).getString(PREFERENCE_EXPERIMENTAL_FLAGS, "")); |
} |