diff --git a/CHANGELOG.md b/CHANGELOG.md index 661d04a9..08808679 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ ## Next - feat: add emulator detection property to static context ([#154](https://github.com/PostHog/posthog-android/pull/154)) -- fix: ensure activity name is used when activity label is not defined ([#153](https://github.com/PostHog/posthog-android/pull/153)) +- fix: ensure activity name is used when activity label is not defined ([#153](https://github.com/PostHog/posthog-android/pull/153)) and ([#156](https://github.com/PostHog/posthog-android/pull/156)) - recording: mask views with `contentDescription` setting and mask `WebView` if any masking is enabled ([#149](https://github.com/PostHog/posthog-android/pull/149)) ## 3.4.2 - 2024-06-28 diff --git a/posthog-android/src/main/java/com/posthog/android/internal/PostHogAndroidUtils.kt b/posthog-android/src/main/java/com/posthog/android/internal/PostHogAndroidUtils.kt index 909ac2ac..18139dea 100644 --- a/posthog-android/src/main/java/com/posthog/android/internal/PostHogAndroidUtils.kt +++ b/posthog-android/src/main/java/com/posthog/android/internal/PostHogAndroidUtils.kt @@ -130,7 +130,11 @@ internal fun Activity.activityLabelOrName(config: PostHogAndroidConfig): String? val applicationLabel = applicationInfo.loadLabel(packageManager).toString() if (activityLabel.isNotEmpty() && activityLabel != applicationLabel) { - activityLabel + if (activityLabel == activityInfo.name) { + activityLabel.substringAfterLast('.') + } else { + activityLabel + } } else { activityInfo.name.substringAfterLast('.') }