How to determine if a Firebase user is signed in using email and password authentication

The provider ID for email+password is password. So:

for (UserInfo user: FirebaseAuth.getInstance().getCurrentUser().getProviderData()) {
    if (user.getProviderId().equals("password")) {
        System.out.println("User is signed in with email/password");
    }
}

Below is what works for me:

user.getProvider() returns firebase

user.getProviderData() returns some Id.

The list returned by user.getProviders() returns the login account type

Here's what I did:

@Override
    protected void onStart() {
        super.onStart();
        // Check if user is signed in (non-null) and update UI accordingly.

        FirebaseUser currentUser = mAuth.getCurrentUser();
        if (currentUser == null)
            return;

        for (int i = 0; i < currentUser.getProviders().size(); i++) {
            if (!currentUser.getProviders().get(i).equals("google.com") && !currentUser.getProviders().get(i).equals("facebook.com")) {
               //User signed in with a custom account
               //Todo: call server DB or perform some task

            } else
               updateUI(currentUser);
        }

       // Todo: Complete login activity and switch to the main activity
}