forked from upstream-mirrors/OpenTracks
Review suggestions
This commit is contained in:
@@ -15,10 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
package com.google.android.apps.mytracks.io;
|
package com.google.android.apps.mytracks.io;
|
||||||
|
|
||||||
|
import static com.google.android.apps.mytracks.Constants.ACCOUNT_TYPE;
|
||||||
import static com.google.android.apps.mytracks.Constants.TAG;
|
import static com.google.android.apps.mytracks.Constants.TAG;
|
||||||
|
|
||||||
import com.google.android.apps.mytracks.AccountChooser;
|
import com.google.android.apps.mytracks.AccountChooser;
|
||||||
import com.google.android.apps.mytracks.Constants;
|
|
||||||
|
|
||||||
import android.accounts.Account;
|
import android.accounts.Account;
|
||||||
import android.accounts.AccountManager;
|
import android.accounts.AccountManager;
|
||||||
@@ -109,13 +109,13 @@ public class ModernAuthManager implements AuthManager {
|
|||||||
try {
|
try {
|
||||||
authToken = future.getResult().getString(
|
authToken = future.getResult().getString(
|
||||||
AccountManager.KEY_AUTHTOKEN);
|
AccountManager.KEY_AUTHTOKEN);
|
||||||
Log.i(Constants.TAG, "Got auth token");
|
Log.i(TAG, "Got auth token");
|
||||||
} catch (OperationCanceledException e) {
|
} catch (OperationCanceledException e) {
|
||||||
Log.e(Constants.TAG, "Auth token operation Canceled", e);
|
Log.e(TAG, "Auth token operation Canceled", e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(Constants.TAG, "Auth token IO exception", e);
|
Log.e(TAG, "Auth token IO exception", e);
|
||||||
} catch (AuthenticatorException e) {
|
} catch (AuthenticatorException e) {
|
||||||
Log.e(Constants.TAG, "Authentication Failed", e);
|
Log.e(TAG, "Authentication Failed", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
runAuthCallback();
|
runAuthCallback();
|
||||||
@@ -142,7 +142,7 @@ public class ModernAuthManager implements AuthManager {
|
|||||||
public void authResult(int resultCode, Intent results) {
|
public void authResult(int resultCode, Intent results) {
|
||||||
boolean retry = false;
|
boolean retry = false;
|
||||||
if (results == null) {
|
if (results == null) {
|
||||||
Log.e(Constants.TAG, "No auth token!!");
|
Log.e(TAG, "No auth token!!");
|
||||||
} else {
|
} else {
|
||||||
authToken = results.getStringExtra(AccountManager.KEY_AUTHTOKEN);
|
authToken = results.getStringExtra(AccountManager.KEY_AUTHTOKEN);
|
||||||
retry = results.getBooleanExtra("retry", false);
|
retry = results.getBooleanExtra("retry", false);
|
||||||
@@ -181,8 +181,7 @@ public class ModernAuthManager implements AuthManager {
|
|||||||
|
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
accountManager.invalidateAuthToken(Constants.ACCOUNT_TYPE,
|
accountManager.invalidateAuthToken(ACCOUNT_TYPE, authToken);
|
||||||
authToken);
|
|
||||||
authToken = null;
|
authToken = null;
|
||||||
|
|
||||||
AccountChooser accountChooser = new AccountChooser();
|
AccountChooser accountChooser = new AccountChooser();
|
||||||
|
|||||||
Reference in New Issue
Block a user