Skip to content

Avoid Process.myProcessName() on Android 13 #6720

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions firebase-crashlytics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Unreleased
* [fixed] Fixed NoSuchMethodError when getting process info on Android 13 [#6720]

# 19.4.1
* [changed] Updated `firebase-sessions` dependency to v2.0.9


## Kotlin
The Kotlin extensions library transitively includes the updated
`firebase-crashlytics` library. The Kotlin extensions library has no additional
updates.

# 19.4.0
* [feature] Added an overload for `recordException` that allows logging additional custom
keys to the non fatal event [#3551]
Expand Down Expand Up @@ -324,10 +333,10 @@ updates.

# 18.2.10
* [fixed] Fixed a bug that could prevent unhandled exceptions from being
propogated to the default handler when the network is unavailable.
propagated to the default handler when the network is unavailable.
* [changed] Internal changes to support on-demand fatal crash reporting for
Flutter apps.
* [fixed] Fixed a bug that prevented [crashlytics] from initalizing on some
* [fixed] Fixed a bug that prevented [crashlytics] from initializing on some
devices in some cases. (#3269)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import com.google.firebase.crashlytics.internal.model.CrashlyticsReport.Session.
* @hide
*/
internal object ProcessDetailsProvider {
// TODO(mrober): Merge this with [com.google.firebase.sessions.ProcessDetailsProvider].

/** Gets the details for all of this app's running processes. */
fun getAppProcessDetails(context: Context): List<ProcessDetails> {
val appUid = context.applicationInfo.uid
Expand Down Expand Up @@ -70,7 +72,7 @@ internal object ProcessDetailsProvider {
processName: String,
pid: Int = 0,
importance: Int = 0,
isDefaultProcess: Boolean = false
isDefaultProcess: Boolean = false,
) =
ProcessDetails.builder()
.setProcessName(processName)
Expand All @@ -81,7 +83,7 @@ internal object ProcessDetailsProvider {

/** Gets the app's current process name. If the API is not available, returns an empty string. */
private fun getProcessName(): String =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU) {
Process.myProcessName()
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
Application.getProcessName() ?: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ internal object ProcessDetailsProvider {

/** Gets the app's current process name. If it could not be found, returns an empty string. */
internal fun getProcessName(): String {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU) {
return Process.myProcessName()
}

Expand Down
Loading