AccountManagerHelper accountManagerHelper = AccountManagerHelper.get(context);
accountManagerHelper.getAuthTokenFromForeground(
- null, account, oauth2Scope, new AccountManagerHelper.GetAuthTokenCallback() {
- @Override
- public void tokenAvailable(String token) {
- nativeOAuth2TokenFetched(
- token, token != null, nativeCallback);
- }
- });
+ null, account, oauth2Scope, new AccountManagerHelper.GetAuthTokenCallback() {
+ @Override
+ public void tokenAvailable(String token) {
+ nativeOAuth2TokenFetched(token, token != null, nativeCallback);
+ }
+ });
}
/**
* @param scope The scope to get an auth token for (without Android-style 'oauth2:' prefix).
* @param callback called on successful and unsuccessful fetching of auth token.
*/
- public static void getOAuth2AccessToken(Context context, @Nullable Activity activity,
- Account account, String scope,
- AccountManagerHelper.GetAuthTokenCallback callback) {
+ public static void getOAuth2AccessToken(
+ Context context, @Nullable Activity activity, Account account, String scope,
+ AccountManagerHelper.GetAuthTokenCallback callback) {
String oauth2Scope = OAUTH2_SCOPE_PREFIX + scope;
AccountManagerHelper.get(context).getAuthTokenFromForeground(
activity, account, oauth2Scope, callback);
if (semaphore.tryAcquire(timeout, unit)) {
return result.get();
} else {
- Log.d(TAG, "Failed to retrieve auth token within timeout (" +
- timeout + " + " + unit.name() + ")");
+ Log.d(TAG, "Failed to retrieve auth token within timeout ("
+ + timeout + " + " + unit.name() + ")");
return null;
}
} catch (InterruptedException e) {
@CalledByNative
private static void saveStoredAccounts(Context context, String[] accounts) {
Set<String> set = new HashSet<String>(Arrays.asList(accounts));
- PreferenceManager.getDefaultSharedPreferences(context).edit().
- putStringSet(STORED_ACCOUNTS_KEY, set).apply();
+ PreferenceManager.getDefaultSharedPreferences(context).edit()
+ .putStringSet(STORED_ACCOUNTS_KEY, set).apply();
}
private static native Object nativeGetForProfile(Profile profile);