Source:
public void startSignIn(@NonNull final IdpResponse response) { if (!response.isSuccessful()) { setResult(Resource.<IdpResponse>forFailure(response.getError())); return; } if (!AuthUI.SOCIAL_PROVIDERS.contains(response.getProviderType())) { throw new IllegalStateException( "This handler cannot be used with email or phone providers"); } setResult(Resource.<IdpResponse>forLoading()); final AuthCredential credential = ProviderUtils.getAuthCredential(response); AuthOperationManager.getInstance().signInAndLinkWithCredential( getAuth(), getArguments(), credential) .continueWithTask(new ProfileMerger(response)) .addOnSuccessListener(new OnSuccessListener<AuthResult>() { @Override public void onSuccess(AuthResult result) { handleSuccess(response, result); } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { if (e instanceof FirebaseAuthUserCollisionException) { final String email = response.getEmail(); if (email == null) { setResult(Resource.<IdpResponse>forFailure(e)); return; } ProviderUtils.fetchSortedProviders(getAuth(), getArguments(), email) .addOnSuccessListener(new OnSuccessListener<List<String>>() { @Override public void onSuccess(List<String> providers) { if (providers.contains(response.getProviderType())) { handleMergeFailure(credential); } else { if (providers.isEmpty()) { setResult(Resource.<IdpResponse>forFailure( new FirebaseUiException( ErrorCodes.DEVELOPER_ERROR, "No supported providers."))); } else { startWelcomeBackFlowForLinking( providers.get(0), response); } } } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { setResult(Resource.<IdpResponse>forFailure( e)); } }); } } }); }

Target:
public void startSignIn(@NonNull final IdpResponse response) { if (!response.isSuccessful()) { setResult(Resource.<IdpResponse>forFailure(response.getError())); return; } if (!AuthUI.SOCIAL_PROVIDERS.contains(response.getProviderType())) { throw new IllegalStateException( "This handler cannot be used with email or phone providers"); } setResult(Resource.<IdpResponse>forLoading()); final AuthCredential credential = ProviderUtils.getAuthCredential(response); AuthOperationManager.getInstance().signInAndLinkWithCredential( getAuth(), getArguments(), credential) .continueWithTask(new ProfileMerger(response)) .addOnSuccessListener(new OnSuccessListener<AuthResult>() { @Override public void onSuccess(AuthResult result) { handleSuccess(response, result); } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { if (e instanceof FirebaseAuthUserCollisionException) { final String email = response.getEmail(); if (email == null) { setResult(Resource.<IdpResponse>forFailure(e)); return; } ProviderUtils.fetchSortedProviders(getAuth(), getArguments(), email) .addOnSuccessListener(new OnSuccessListener<List<String>>() { @Override public void onSuccess(List<String> providers) { if (providers.contains(response.getProviderType())) { handleMergeFailure(credential); } else if (providers.isEmpty()) { setResult(Resource.<IdpResponse>forFailure( new FirebaseUiException( ErrorCodes.DEVELOPER_ERROR, "No supported providers."))); } else { startWelcomeBackFlowForLinking( providers.get(0), response); } } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { setResult(Resource.<IdpResponse>forFailure( e)); } }); } } }); }