/** Sign out and disconnect from the APIs. */ public void signOut() { if (mState == STATE_DISCONNECTED) { // nothing to do debugLog("signOut: state was already DISCONNECTED, ignoring."); return; } // for the PlusClient, "signing out" means clearing the default account and // then disconnecting if (mPlusClient != null && mPlusClient.isConnected()) { debugLog("Clearing default account on PlusClient."); mPlusClient.clearDefaultAccount(); } // For the games client, signing out means calling signOut and disconnecting if (mGamesClient != null && mGamesClient.isConnected()) { debugLog("Signing out from GamesClient."); mGamesClient.signOut(); } // Ready to disconnect debugLog("Proceeding with disconnection."); killConnections(); }
void connectCurrentClient() { if (mState == STATE_DISCONNECTED) { // we got disconnected during the connection process, so abort logWarn("GameHelper got disconnected during connection process. Aborting."); return; } if (!checkState(TYPE_GAMEHELPER_BUG, "connectCurrentClient", "connectCurrentClient " + "should only get called when connecting.", STATE_CONNECTING)) { return; } switch (mClientCurrentlyConnecting) { case CLIENT_GAMES: mGamesClient.connect(); break; case CLIENT_APPSTATE: mAppStateClient.connect(); break; case CLIENT_PLUS: mPlusClient.connect(); break; } }
void killConnections() { if (!checkState(TYPE_GAMEHELPER_BUG, "killConnections", "killConnections() should only " + "get called while connected or connecting.", STATE_CONNECTED, STATE_CONNECTING)) { return; } debugLog("killConnections: killing connections."); mConnectionResult = null; mSignInFailureReason = null; if (mGamesClient != null && mGamesClient.isConnected()) { debugLog("Disconnecting GamesClient."); mGamesClient.disconnect(); } if (mPlusClient != null && mPlusClient.isConnected()) { debugLog("Disconnecting PlusClient."); mPlusClient.disconnect(); } if (mAppStateClient != null && mAppStateClient.isConnected()) { debugLog("Disconnecting AppStateClient."); mAppStateClient.disconnect(); } mConnectedClients = CLIENT_NONE; debugLog("killConnections: all clients disconnected."); setState(STATE_DISCONNECTED); }
mConnectedClients |= CLIENT_GAMES; if (mPlusClient != null && mPlusClient.isConnected() && (0 == (mConnectedClients & CLIENT_PLUS))) { logWarn("PlusClient was already connected. Fixing.");
&& mPlusClient.isConnected()) {