Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SecurityException on Samsung Galaxy S8 devices

A specific userbase of our Android app experiences the following crash according to Crashlytics.

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.bundle.id/com.bundle.id.MainActivity}: java.lang.SecurityException: uid 10346 cannot get secrets for accounts of type: com.osp.app.signin
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2955)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3030)
       at android.app.ActivityThread.-wrap11(Unknown Source)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6938)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

We have googled, searched, tried to reproduce without any success. According to Crashlytics it only happens on the Samsung Galaxy S8 devices.

We have tested with one but it worked just fine. Has anyone seen this error before or knows what can cause this? It is really frustrating.

like image 808
Reshad Avatar asked Oct 28 '25 09:10

Reshad


1 Answers

Not sure what OP's issue was, but I was running into the same crash, and it turns out the issue is that I was getting the Account object from addOnAccountsUpdatedListener. On most devices, the list you get from that API is filtered by your accountType. On some Samsung devices, it also includes the Samsung account on your phone, if one is set. Workaround:

    accountManager.addOnAccountsUpdatedListener({ accounts ->
      // Samsung is great: it sends us updates on Samsung accounts even though the accountType
      // doesn't match.
      val ourUpdatedAccounts = accounts.filter { account -> account.type == myAccountType }
      // do something with ourUpdatedAccounts
    }, Handler(), false)
like image 145
Eric Avatar answered Oct 29 '25 22:10

Eric



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!