Source:
private AuthenticationResult localFlow(CallbackHandler callbackHandle, final IWindowComponent activity, final boolean useDialog, final AuthenticationRequest request) { AuthenticationResult authResult = null; if (!promptUser(request.getPrompt())) { try { final AcquireTokenSilentHandler acquireTokenSilentHandler = new AcquireTokenSilentHandler(mContext, request, mTokenCacheAccessor); authResult = acquireTokenSilentHandler.getAccessToken(); } catch (final AuthenticationException authenticationException) { addLogEventForRequestFailureWithCause(InstrumentationIDs.REFRESH_TOKEN_REQUEST_FAILED, request, authenticationException); callbackHandle.onError(authenticationException); return null; } if (isAccessTokenReturned(authResult)) { callbackHandle.onSuccess(authResult); ClientAnalytics.logEvent( InstrumentationIDs.REFRESH_TOKEN_REQUEST_SUCCEEDED, new InstrumentationPropertiesBuilder(request, authResult).build()); return authResult; } } if (!isAccessTokenReturned(authResult)) { Logger.v(TAG, "No token returned for silent flow or promptbehavior is set to alwasys."); ClientAnalytics.logEvent( InstrumentationIDs.AUTH_TOKEN_NOT_RETURNED, new InstrumentationPropertiesBuilder(request, authResult).build()); if (!request.isSilent() && (activity != null || useDialog)) { acquireTokenInteractively(callbackHandle, activity, request, useDialog); } else { final String errorInfo = authResult == null ? "" : authResult.getErrorLogInfo(); Logger.e(TAG, "Prompt is not allowed and failed to get token:", request.getLogInfo() + " " + errorInfo, ADALError.AUTH_REFRESH_FAILED_PROMPT_NOT_ALLOWED); callbackHandle.onError(new AuthenticationException( ADALError.AUTH_REFRESH_FAILED_PROMPT_NOT_ALLOWED, request.getLogInfo() + " " + errorInfo)); } } return null; }

Target:
private AuthenticationResult localFlow(CallbackHandler callbackHandle, final IWindowComponent activity, final boolean useDialog, final AuthenticationRequest request) { AuthenticationResult authResult = null; if (!promptUser(request.getPrompt())) { try { final AcquireTokenSilentHandler acquireTokenSilentHandler = new AcquireTokenSilentHandler(mContext, request, mTokenCacheAccessor); authResult = acquireTokenSilentHandler.getAccessToken(); } catch (final AuthenticationException authenticationException) { ClientAnalytics.logEvent(new RefreshTokenEvent( new InstrumentationPropertiesBuilder(request, authenticationException), InstrumentationIDs.EVENT_RESULT_FAIL)); callbackHandle.onError(authenticationException); return null; } if (isAccessTokenReturned(authResult)) { callbackHandle.onSuccess(authResult); ClientAnalytics.logEvent(new RefreshTokenEvent( new InstrumentationPropertiesBuilder(request, authResult), InstrumentationIDs.EVENT_RESULT_SUCCESS)); return authResult; } } if (!isAccessTokenReturned(authResult)) { final String authFailedMessage = "No token returned for silent flow or promptbehavior is set to always."; Logger.v(TAG, authFailedMessage); InstrumentationPropertiesBuilder propertiesBuilder = new InstrumentationPropertiesBuilder(request, authResult) .add(InstrumentationIDs.ERROR_CLASS, authResult == null ? InstrumentationIDs.AUTH_RESULT_EMPTY : InstrumentationIDs.AUTH_TOKEN_NOT_RETURNED); ClientAnalytics.logEvent(new RefreshTokenEvent(propertiesBuilder, InstrumentationIDs.EVENT_RESULT_FAIL)); if (!request.isSilent() && (activity != null || useDialog)) { acquireTokenInteractively(callbackHandle, activity, request, useDialog); } else { final String errorInfo = authResult == null ? "" : authResult.getErrorLogInfo(); Logger.e(TAG, "Prompt is not allowed and failed to get token:", request.getLogInfo() + " " + errorInfo, ADALError.AUTH_REFRESH_FAILED_PROMPT_NOT_ALLOWED); callbackHandle.onError(new AuthenticationException( ADALError.AUTH_REFRESH_FAILED_PROMPT_NOT_ALLOWED, request.getLogInfo() + " " + errorInfo)); } } return null; }