mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Added more info to startup listener, also log 3 previous startup reasons
This commit is contained in:
parent
85aa50d8d8
commit
8e76c60a38
1 changed files with 30 additions and 6 deletions
|
|
@ -39,15 +39,39 @@ class Api35Compatibility {
|
|||
Executors.newSingleThreadExecutor()
|
||||
) { info ->
|
||||
Log.i("==== Current startup information dump ====")
|
||||
logAppStartupInfo(info)
|
||||
}
|
||||
|
||||
Log.i("==== Fetching last three startup reasons if available ====")
|
||||
val lastStartupInfo = activityManager.getHistoricalProcessStartReasons(3)
|
||||
for (info in lastStartupInfo) {
|
||||
Log.i("==== Previous startup information dump ====")
|
||||
logAppStartupInfo(info)
|
||||
}
|
||||
} catch (iae: IllegalArgumentException) {
|
||||
Log.e("$TAG Can't add application start info completion listener: $iae")
|
||||
}
|
||||
}
|
||||
|
||||
private fun logAppStartupInfo(info: ApplicationStartInfo) {
|
||||
Log.i("TYPE = ${startupTypeToString(info.startType)}")
|
||||
Log.i("STATE = ${startupStateToString(info.startupState)}")
|
||||
Log.i("REASON = ${startupReasonToString(info.reason)}")
|
||||
Log.i("START COMPONENT = ${startComponentToString(info.launchMode)}")
|
||||
Log.i("INTENT = ${info.intent}")
|
||||
Log.i("FORCE STOPPED = ${if (info.wasForceStopped()) "yes" else "no"}")
|
||||
Log.i("PROCESS NAME = ${info.processName}")
|
||||
Log.i("=========================================")
|
||||
}
|
||||
} catch (iae: IllegalArgumentException) {
|
||||
Log.e("$TAG Can't add application start info completion listener: $iae")
|
||||
|
||||
private fun startComponentToString(component: Int): String {
|
||||
return when (component) {
|
||||
ApplicationStartInfo.START_COMPONENT_ACTIVITY -> "Activity"
|
||||
ApplicationStartInfo.START_COMPONENT_BROADCAST -> "Broadcast"
|
||||
ApplicationStartInfo.START_COMPONENT_CONTENT_PROVIDER -> "Content Provider"
|
||||
ApplicationStartInfo.START_COMPONENT_SERVICE -> "Service"
|
||||
ApplicationStartInfo.START_COMPONENT_OTHER -> "Other"
|
||||
else -> "Unexpected ($component)"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue