AndroidDeadException - Knox, Samsung mostly Android 12

378 views Asked by At

We released an update of our app and got a near immediate set of AndroidDeadException crashes reported which continue to the present. These type of exceptions are not producing a lot of info, though we have tried to instrument the code to do that.

To date these crashes are 1) all involve Samsung Knox, 2) (duh) all Samsung devices, 3) a wide variety of Samsung devices (Galaxy S/A/Flip/Fold series), 4) 95% of crashes are occurring on Android 12 devices.

Our update was significant/larger and extended our existing app features to work profiles (Android For Work/Android Enterprise). The relevant part of the code is looking to get a list of apps on the device within a given profile and things break down with the bolded (**) line:

  override fun getAllUserProfileApps(): List<LauncherActivityInfo> {
    launcherActivityInfoCache = userCache.userProfiles.flatMap { userHandle ->
      **launcherApps.getActivityList(null, userHandle).also** { list ->
        if (BuildConfig.DEBUG) {
          list.joinToString("\n") { it.logToString() }
        }
      }
    }
    return launcherActivityInfoCache
  }

It's possibly too much to expect there is someone who has seen this exact thing and while we'd love that...it might be enough to know how to instrument this so we can get a better look and start to hunt it down, kill it.

A few strange things: as many crashes as we have gotten, not one user has contacted us, in any way, to complain; the crash report log often (but not always) shows/refers to our notification listener.

Here is the error as it comes to us in Crashlytics:

**KnoxHelper.java line 150
com.samsung.android.knox.KnoxHelper.getActivityList**

Stack Traces:

Fatal Exception: java.lang.RuntimeException
android.os.DeadSystemException

com.samsung.android.knox.KnoxHelper.getActivityList (KnoxHelper.java:150)
android.content.pm.LauncherApps.getActivityList (LauncherApps.java:732)
com.our.app.interactors.utils.AppsInstalledHelperImpl.getAllUserProfileApps (AppsInstalledHelper.kt:148)
com.our.app.interactors.SyncAllAppInfo$invoke$2.invokeSuspend (SyncAllAppInfo.kt:42)
com.our.app.interactors.SyncAllAppInfo$invoke$2.invoke (Unknown Source:8)
our.app.interactors.SyncAllAppInfo$invoke$2.invoke (Unknown Source:4)
kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn (Undispatched.kt:89)
kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext (Builders.common.kt:165)
kotlinx.coroutines.BuildersKt.withContext (Unknown Source:1)
com.our.app.interactors.SyncAllAppInfo.invoke (SyncAllAppInfo.kt:40)
com.our.app.LauncherAppsCallback$onPackageChanged$1.invokeSuspend (LauncherAppsCallback.kt:106)
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:106)
kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely (CoroutineScheduler.kt:571)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask (CoroutineScheduler.kt:750)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker (CoroutineScheduler.kt:678)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run (CoroutineScheduler.kt:665)


Caused by android.os.DeadSystemException

com.samsung.android.knox.KnoxHelper.getActivityList (KnoxHelper.java:150)
android.content.pm.LauncherApps.getActivityList (LauncherApps.java:732)
com.our.app.interactors.utils.AppsInstalledHelperImpl.getAllUserProfileApps (AppsInstalledHelper.kt:148)
com.our.app.interactors.SyncAllAppInfo$invoke$2.invokeSuspend (SyncAllAppInfo.kt:42)
com.our.app.interactors.SyncAllAppInfo$invoke$2.invoke (Unknown Source:8)
com.our.app.interactors.SyncAllAppInfo$invoke$2.invoke (Unknown Source:4)
kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn (Undispatched.kt:89)
kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext (Builders.common.kt:165)
kotlinx.coroutines.BuildersKt.withContext (Unknown Source:1)
com.our.app.interactors.SyncAllAppInfo.invoke (SyncAllAppInfo.kt:40)
com.our.app.LauncherAppsCallback$onPackageChanged$1.invokeSuspend (LauncherAppsCallback.kt:106)
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:106)
kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely (CoroutineScheduler.kt:571)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask (CoroutineScheduler.kt:750)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker (CoroutineScheduler.kt:678)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run (CoroutineScheduler.kt:665)
0

There are 0 answers