firebase / FirebaseUI-Android

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

Custom Auth UI RuntimeException crash for display list canvas on certain Samsung devices (starqltesq) #1573

Open MrAndrew opened 5 years ago

MrAndrew commented 5 years ago

Step 1: Are you in the right place?

I think so. Feel free to correct me if I'm wrong, but it's not a technical question as I am not asking how to use the code. I don't need to troubleshoot my application, as it is working correctly on all other devices. This isn't a general discussion and I don't need support specifically for my application. (Unless it turns out no one else can reproduce this bug I suppose..)

Step 2: Describe your environment

Step 3: Describe the problem:

My app has a splash screen that simply checks if the user is logged in or not and sends them to the app if so, starts AuthUI for sign in prompt if not. Works on all tested devices virtual to real, only seeing this error on two Samsung devices listed above on release version. I have limited knowledge as full crash reporting software is set up after user sign in.

I strongly believe the bug to be related to drawing the Firebase Auth UI screen. My reasoning for this will be clear below.

I know the splash screen is drawing correctly as users report seeing the graphic it is supposed to display before the crash. I also know that these first time users will automatically cause the Firebase Auth UI to load after this graphic is displayed as the main activity simply shows a graphic while checking for user auth. If exists, the user continues to the application. If not, the user is shown the custom FirebaseUI login screen. (Or at least is supposed to..)

Steps to reproduce:

NOTE: I don't have access to a physical galaxy S9/Note9 to reproduce on my own for more details. Other Samsung devices work and other devices running Android 8.1 work. (but not s9/note9 + Android 8.1 according to user and crash reports)

  1. Create an app with a main activity that simply checks for user auth. If exists, send them to a new activity. If not, call
startActivityForResult(
     AuthUI.getInstance()
          .createSignInIntentBuilder()
         .setAvailableProviders(Arrays.asList(
              new AuthUI.IdpConfig.GoogleBuilder().build(),
              new AuthUI.IdpConfig.EmailBuilder().build(),
              new AuthUI.IdpConfig.AnonymousBuilder().build()))
         .setLogo(R.drawable.MY_APP_LOGO)
         .setTheme(R.style.MY_APP_THEME)
         .setTosAndPrivacyPolicyUrls(getString(R.string.TOS_URL),
              getString(R.string.PP_URL))
          .setIsSmartLockEnabled(!BuildConfig.DEBUG, true) //for debug
          .build(), RC_SIGN_IN);
  1. Build release version, release to play store, download and run on Samsung Galaxy S9/Note9 with Android 8.1
  2. See crash report.

Observed Results:

*Crash reports on Google Play Console show

java.lang.RuntimeException: 
  at android.view.DisplayListCanvas.throwIfCannotDraw (DisplayListCanvas.java:229)
  at android.view.RecordingCanvas.drawBitmap (RecordingCanvas.java:97)
  at android.graphics.drawable.BitmapDrawable.draw (BitmapDrawable.java:529)
  at android.graphics.drawable.LayerDrawable.draw (LayerDrawable.java:1016)
  at android.view.View.getDrawableRenderNode (View.java:20741)
  at android.view.View.drawBackground (View.java:20677)
  at android.view.View.draw (View.java:20457)
  at com.android.internal.policy.DecorView.draw (DecorView.java:996)
  at android.view.View.updateDisplayListIfDirty (View.java:19411)
  at android.view.ThreadedRenderer.updateViewTreeDisplayList (ThreadedRenderer.java:719)
  at android.view.ThreadedRenderer.updateRootDisplayList (ThreadedRenderer.java:725)
  at android.view.ThreadedRenderer.draw (ThreadedRenderer.java:833)
  at android.view.ViewRootImpl.draw (ViewRootImpl.java:3567)
  at android.view.ViewRootImpl.performDraw (ViewRootImpl.java:3354)
  at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2889)
  at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1843)
  at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:7978)
  at android.view.Choreographer$CallbackRecord.run (Choreographer.java:911)
  at android.view.Choreographer.doCallbacks (Choreographer.java:723)
  at android.view.Choreographer.doFrame (Choreographer.java:658)
  at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:897)
  at android.os.Handler.handleCallback (Handler.java:790)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:7002)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:441)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1408)```

for Samsung S9/Note9 running Android 8.1

Expected Results:

Relevant Code:

  // MY FIREBASE AUTH UI CODE:
startActivityForResult(
     AuthUI.getInstance()
          .createSignInIntentBuilder()
         .setAvailableProviders(Arrays.asList(
              new AuthUI.IdpConfig.GoogleBuilder().build(),
              new AuthUI.IdpConfig.EmailBuilder().build(),
              new AuthUI.IdpConfig.AnonymousBuilder().build()))
         .setLogo(R.drawable.MY_APP_LOGO)
         .setTheme(R.style.MY_APP_THEME)
         .setTosAndPrivacyPolicyUrls(getString(R.string.TOS_URL),
              getString(R.string.PP_URL))
          .setIsSmartLockEnabled(!BuildConfig.DEBUG, true) //for debug
          .build(), RC_SIGN_IN);
<!-- MY APPTHEME, IN CASE OF POSSIBLE RELEVANCE. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@android:color/black</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="android:colorBackground">@color/light_gray_color</item>
        <item name="windowNoTitle">true</item>
        <!-- enable window activity transitions -->
        <item name="android:windowActivityTransitions">true</item>
        <!-- enable window content transitions -->
        <item name="android:windowContentTransitions">true</item>
        <!--shared element transitions -->
        <item name="android:windowSharedElementEnterTransition">@xml/standard_easing_transition</item>

        <item name="actionOverflowButtonStyle">@style/DotsButtonStyle</item>
        <item name="drawerArrowStyle">@style/DrawerLinesStyle</item>
    </style>
samtstern commented 5 years ago

@MrAndrew7of9 thanks for the detailed bug report. This sounds like it's going to be very hard to reproduce and/or fix so I want to preemptively ask for your patience.

A few questions:

MrAndrew commented 5 years ago

Of course. I know this is no easy task.

To answer your questions, to my knowledge it is NOT 100% of the devices, but I don't know for sure. (This only popped up when I released the app to beta, I don't have the device in question. One user claimed the S9+ didn't have the problem, but his S9 did.) The robo tests in the Firebase lab all pass for all the Samsung devices, emulated and real. I wasn't able to reproduce the error, but I did get the errors from the play store console listed under crashes.

I'm currently reaching out to known effected users for more information. If I get any I will update you. I don't see any webview code in this repo, but saw reports of other projects that crashed due to a driver issue with rendering WebView objects. Does the Auth UI render and WebView content, for instance the hyperlinks to the legal documents? Or are those spannable and clickable text?

On Wed, Jan 23, 2019 at 2:59 AM Sam Stern notifications@github.com wrote:

@MrAndrew7of9 https://github.com/MrAndrew7of9 thanks for the detailed bug report. This sounds like it's going to be very hard to reproduce and/or fix so I want to preemptively ask for your patience.

A few questions:

  • Does this crash on 100% of S9/Note9 devices on Android 8.1+ or only a subset?
  • The Galaxy Note 9 is available at API 27 (Android 8.1) on Firebase Test Lab, could you try to reproduce the crash on there so you can get a better sense of what is going on?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/firebase/FirebaseUI-Android/issues/1573#issuecomment-456520746, or mute the thread https://github.com/notifications/unsubscribe-auth/AWMrmI6byjzg5RbDPtE3XiDbJXoaIdMDks5vF1-QgaJpZM4aKLnB .

samtstern commented 5 years ago

@MrAndrew7of9 thanks for the details. We don't use any WebViews directly in AuthUI but we do launch into Chrome Custom Tabs if you click into the Terms of Service or Privacy Policy.

MrAndrew commented 5 years ago

Yea I realize the links open into that, but as far as I know the app was crashing as it was loading the UI view. I'll be triple checking the start-up logic and possible scenarios, such as it auto-loading from smart-lock, but that shouldn't happen on a first install.... should it? The devices I've seen these crashes for are Galaxy S9 (crownqltesq) and Galaxy S9 (starqltesq) listed in the play console.

The log outputs are identical to what I listed in the original post. So nothing specific to UI or any of my Code, which is the hard part of figuring this out. I'm doing my best to gather more information about this. Thanks so much for your help so far.

-Andrew

On Thu, Jan 24, 2019 at 11:59 PM Sam Stern notifications@github.com wrote:

@MrAndrew7of9 https://github.com/MrAndrew7of9 thanks for the details. We don't use any WebViews directly in AuthUI but we do launch into Chrome Custom Tabs if you click into the Terms of Service or Privacy Policy.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/firebase/FirebaseUI-Android/issues/1573#issuecomment-457249971, or mute the thread https://github.com/notifications/unsubscribe-auth/AWMrmDGmSnFQzBiWNfY94CfYaJ7mijjpks5vGdhSgaJpZM4aKLnB .

samtstern commented 5 years ago

@MrAndrew7of9 thanks for doing all this testing. I'll try to look into this deeper when I have time to really dig in.

MrAndrew commented 5 years ago

Thanks for the reply. I confirmed that the users see the splash screen, so I know it's not that drawable resource that is causing the issue. This makes me believe it lies in setting the logo in the FirebaseUI with .setLogo(R.drawable.MY_LOGO). I appreciate your attention to this matter.

On Sat, Jan 26, 2019 at 8:16 AM Sam Stern notifications@github.com wrote:

@MrAndrew7of9 https://github.com/MrAndrew7of9 thanks for doing all this testing. I'll try to look into this deeper when I have time to really dig in.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/firebase/FirebaseUI-Android/issues/1573#issuecomment-457778557, or mute the thread https://github.com/notifications/unsubscribe-auth/AWMrmKO4-ehLjH4ZV53nHiQ3wRra7syaks5vG55DgaJpZM4aKLnB .

danijorda1 commented 2 years ago

Hi, I am also getting this error in devices that have Dark Mode on From my point of view this is not related to particular devices but devices that have Dark Mode on.

Any news on this error?

danijorda1 commented 2 years ago

btw, having Dark Mode On and removing the Splash screen works fine.

So you can reproduce this issue on your side, please follow the below steps:


public class MainActivity extends AppCompatActivity { FirebaseAuth auth = FirebaseAuth.getInstance(); FirebaseFirestore db = FirebaseFirestore.getInstance(); @Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_LottoBank);

Firebase auth UI is using the same overwritten Theme:


       startActivityForResult(
                AuthUI.getInstance()
                        .createSignInIntentBuilder()
                        .setTheme(R.style.Theme_LottoBank)
                        .setLogo(R.drawable.logopng)

Can you please check if you reproduce the issue? Thanks.