Source:
private void acquireTokenAfterValidation(final Activity activity, final AuthenticationRequest request, final AuthenticationCallback<AuthenticationResult> externalCall) { Logger.v(TAG, "Token request is started"); AuthenticationResult cachedItem = getItemFromCache(request); if (request.getPrompt() != PromptBehavior.Always && isValidCache(cachedItem)) { Logger.v(TAG, "Token is returned from cache"); externalCall.onSuccess(cachedItem); return; } Logger.v(TAG, "Checking refresh tokens"); RefreshItem refreshItem = getRefreshToken(request); if (request.getPrompt() != PromptBehavior.Always && refreshItem != null && !StringExtensions.IsNullOrBlank(refreshItem.mRefreshToken)) { Logger.v(TAG, "Refresh token is available and it will attempt to refresh token"); refreshToken(activity, request, refreshItem, true, externalCall); } else { Logger.v(TAG, "Refresh token is not available"); if (request.getPrompt() != PromptBehavior.Never) { mAuthorizationCallback = externalCall; request.setRequestId(externalCall.hashCode()); Logger.v(TAG, "Starting Authentication Activity with callback:" + externalCall.hashCode()); putWaitingRequest(externalCall.hashCode(), new AuthenticationRequestState( externalCall.hashCode(), request, externalCall)); if (!startAuthenticationActivity(activity, request)) { mAuthorizationCallback.onError(new AuthenticationException( ADALError.DEVELOPER_ACTIVITY_IS_NOT_RESOLVED)); } } else { Logger.e(TAG, "Prompt is not allowed and failed to get token:" + externalCall.hashCode(), "", ADALError.AUTH_REFRESH_FAILED_PROMPT_NOT_ALLOWED); externalCall.onError(new AuthenticationException( ADALError.AUTH_REFRESH_FAILED_PROMPT_NOT_ALLOWED)); } } }

Target:
private void acquireTokenAfterValidation(final Activity activity, final AuthenticationRequest request, final AuthenticationCallback<AuthenticationResult> externalCall) { Logger.v(TAG, "Token request started"); AuthenticationResult cachedItem = getItemFromCache(request); if (request.getPrompt() != PromptBehavior.Always && isValidCache(cachedItem)) { Logger.v(TAG, "Token is returned from cache"); externalCall.onSuccess(cachedItem); return; } Logger.v(TAG, "Checking refresh tokens"); RefreshItem refreshItem = getRefreshToken(request); if (request.getPrompt() != PromptBehavior.Always && refreshItem != null && !StringExtensions.IsNullOrBlank(refreshItem.mRefreshToken)) { Logger.v(TAG, "Refresh token is available and it will attempt to refresh token"); refreshToken(activity, request, refreshItem, true, externalCall); } else { Logger.v(TAG, "Refresh token is not available"); if (request.getPrompt() != PromptBehavior.Never) { mAuthorizationCallback = externalCall; request.setRequestId(externalCall.hashCode()); Logger.v(TAG, "Starting Authentication Activity with callback:" + externalCall.hashCode()); putWaitingRequest(externalCall.hashCode(), new AuthenticationRequestState( externalCall.hashCode(), request, externalCall)); if (!startAuthenticationActivity(activity, request)) { mAuthorizationCallback.onError(new AuthenticationException( ADALError.DEVELOPER_ACTIVITY_IS_NOT_RESOLVED)); } } else { Logger.e(TAG, "Prompt is not allowed and failed to get token:" + externalCall.hashCode(), "", ADALError.AUTH_REFRESH_FAILED_PROMPT_NOT_ALLOWED); externalCall.onError(new AuthenticationException( ADALError.AUTH_REFRESH_FAILED_PROMPT_NOT_ALLOWED)); } } }