Какова логика внутри CurrentAccessTokenExpirationBroadcastReceiver? - PullRequest
0 голосов
/ 10 декабря 2018

Просмотр кода CurrentAccessTokenExpirationBroadcastReceiver .

/**
 * This class is notified when the current {@link AccessToken} has expired.
 */
public final class CurrentAccessTokenExpirationBroadcastReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        if (AccessTokenManager.ACTION_CURRENT_ACCESS_TOKEN_CHANGED.equals(intent.getAction())) {
            AccessTokenManager.getInstance().currentAccessTokenChanged();
        }
    }
}

AccessTokenManager.getInstance().currentAccessTokenChanged(); просто отправит намерение снова проснуться CurrentAccessTokenExpirationBroadcastReceiver, это бесконечный цикл?

void currentAccessTokenChanged() {
    sendCurrentAccessTokenChangedBroadcastIntent(
            this.currentAccessToken,
            this.currentAccessToken);
}

private void sendCurrentAccessTokenChangedBroadcastIntent(AccessToken oldAccessToken,
                                                           AccessToken currentAccessToken) {
    Intent intent = new Intent(
            FacebookSdk.getApplicationContext(),
            CurrentAccessTokenExpirationBroadcastReceiver.class);
    intent.setAction(ACTION_CURRENT_ACCESS_TOKEN_CHANGED);

    intent.putExtra(EXTRA_OLD_ACCESS_TOKEN, oldAccessToken);
    intent.putExtra(EXTRA_NEW_ACCESS_TOKEN, currentAccessToken);
    localBroadcastManager.sendBroadcast(intent);
}
...