firebase / FirebaseUI-Android

Optimized UI components for Firebase
https://firebaseopensource.com/projects/firebase/firebaseui-android/
Apache License 2.0
4.63k stars 1.84k forks source link

Overlay view not hidden when pressing back button during Google Sign In Process after device rotation #1950

Open ZOlbrys opened 3 years ago

ZOlbrys commented 3 years ago

Welcome to FirebaseUI and thanks for submitting an issue!

Please take a look at open issues, as well as resolved issues, to see if your issue is either already being addressed, or has been solved by someone else.

If not, please feel free to fill in the following info so we can help faster!

Step 1: Are you in the right place?

Step 2: Describe your environment

Step 3: Describe the problem:

When rotating the device while logging into Google, if you press back to cancel the sign in, the loading overlay view does not get dismissed and the login provider buttons are not enabled.

Steps to reproduce:

  1. Start firebase auth UI activity
  2. Select Google sign in provider button (Google sign in activity is displayed)
  3. Rotate the device
  4. Select Add another account view (Add new account activity is displayed)
  5. Press back to return out of the add new account activity
  6. Press back to cancel out of the Google sign in activity

Observed Results:

The user is unable to select any provider buttons/ do anything other than press back again to close the AuthMethodPickerActivity activity.

Expected Results:

The user should be able to interact with the provider buttons/sign in as desired.

Relevant Code:

The AuthMethodPickerActivity does not have onActivityResult called in this case. If you do not rotate, it does get called, so I suspect the issue is in the missing communication when we have the rotation occur.

laurentiu-git commented 3 years ago

Hey @samtstern, I have looked into this issue and I have found out that for Android 11 the issue doesn't appear.

If the rotation has occurred in this page and the user press the back button from the same page to get back to the AuthMethodPickerActivity, onCreate will be called in AuthMethodPickerActivity. The same won't happen for Android 8.1, the onCreate method won't be called.

There is also one interesting part for Android 8.1, if you start the activity in either portrait or landscape and then rotate the screen(the opposite of the one used) on this page then press the back button to get to this activity then rotate to the initial orientation and then press the back button to close the dialog, the issue won't appear because onActivityForResult gets called.

Would you have any suggestions what the issue could be ?

samtstern commented 3 years ago

@laurentiu-git truthfully I have no idea at all, but thank you for the investigation! The "add account" flow has always been a source of bugs for us. I think it's a pretty deep system change (since Google accounts are so deeply integrated in Android) that's unlike any of our other sign-in flows.

laurentiu-git commented 3 years ago

@samtstern the same issue happens even if the dialog for "add account" doesn't appear(when the user doesn't have a google account connected to the android), it directly redirects the user to sign in and if after that the user does the same steps, then the AuthMethodPickerActivity will be a grayed out layout even if the dialog is not present, since it was not present before.
But well it is true that it has the same flow.

laurentiu-git commented 3 years ago

@samtstern I've looked a bit more into this issue and it appears that on android oreo there were some changes made on screen rotation and before oreo, for example nougat, the issue doesn't reproduce and for newer versions, they've done some changes on screen rotation for the version pie and there are no issues(at least not in pie and r).

samtstern commented 3 years ago

@laurentiu-git thanks for the explanations! If you have any ideas of what we should do in FirebaseUI to address this, let me know.

laurentiu-git commented 3 years ago

@samtstern I've tried to see if with the new activity result APIs introduced in AndroidX we would get a call for the onActivityResult from ActivityResultCallback, but it behaves as before, so I am out of ideas on what else I could try.