From 6c080ab4d6284635acdd9d1449bd36622fec99c1 Mon Sep 17 00:00:00 2001 From: Markus Hintersteiner Date: Mon, 2 Dec 2024 11:44:12 +0100 Subject: [PATCH] Cherry-pick all changes since 7.18.0 (#3944) * Switch to 3 devices (Android 11, 13, 14), Increase timeout (#3897) Co-authored-by: Stefano * Bump github/codeql-action from 3.27.0 to 3.27.5 (#3923) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.27.0 to 3.27.5. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/662472033e021d55d94146f66f6058822b0b39fd...f09c1c0a94de965c15400f5634aa42fac8fb8f88) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump codecov/codecov-action from 4.6.0 to 5.0.7 (#3922) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.6.0 to 5.0.7. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238...015f24e6818733317a2da2edd6290ab26238649a) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump gradle/actions (#3924) Bumps [gradle/actions](https://github.com/gradle/actions) from 707359876a764dbcdb9da0b0ed08291818310c3d to 4ba34e96c5f6493e99d0696180a9a8d431577ba9. - [Release notes](https://github.com/gradle/actions/releases) - [Commits](https://github.com/gradle/actions/compare/707359876a764dbcdb9da0b0ed08291818310c3d...4ba34e96c5f6493e99d0696180a9a8d431577ba9) --- updated-dependencies: - dependency-name: gradle/actions dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump JamesIves/github-pages-deploy-action from 4.6.8 to 4.6.9 (#3868) Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.6.8 to 4.6.9. - [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases) - [Commits](https://github.com/jamesives/github-pages-deploy-action/compare/881db5376404c5c8d621010bcbec0310b58d5e29...62fec3add6773ec5dbbf18d2ee4260911aa35cf4) --- updated-dependencies: - dependency-name: JamesIves/github-pages-deploy-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore: Update PR template (#3909) Remove I reviewed the code and add updating the wizard because we often forget to update it. * Fix testTag not working for Jetpack Compose gesture detection (#3878) * Fix testTag not working in new versions of Jetpack Compose * Ensure field is accessible * Update changelog * Fix use getDeclaredField instead of getField * add talk on session replay to readme (#3928) #skip-changelog --------- Signed-off-by: dependabot[bot] Co-authored-by: Stefano Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Philipp Hofmann Co-authored-by: Bruno Garcia --- .github/pull_request_template.md | 2 +- .github/workflows/agp-matrix.yml | 2 +- .github/workflows/build.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 6 +++--- .../workflows/enforce-license-compliance.yml | 2 +- .github/workflows/generate-javadocs.yml | 4 ++-- .../integration-tests-benchmarks.yml | 4 ++-- .../integration-tests-ui-critical.yml | 2 +- .github/workflows/integration-tests-ui.yml | 4 ++-- .github/workflows/release-build.yml | 2 +- .github/workflows/system-tests-backend.yml | 2 +- .sauce/sentry-uitest-android-ui.yml | 20 ++++++------------- CHANGELOG.md | 4 ++++ README.md | 1 + .../gestures/ComposeGestureTargetLocator.java | 19 +++++++++++++++++- sentry-compose/proguard-rules.pro | 1 + 16 files changed, 47 insertions(+), 32 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 459ff3e14c..ba7891ff9a 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -13,10 +13,10 @@ ## :pencil: Checklist -- [ ] I reviewed the submitted code. - [ ] I added tests to verify the changes. - [ ] No new PII added or SDK only sends newly added PII if `sendDefaultPII` is enabled. - [ ] I updated the docs if needed. +- [ ] I updated the wizard if needed. - [ ] Review from the native team if needed. - [ ] No breaking change or entry added to the changelog. - [ ] No breaking change for hybrid SDKs or communicated to hybrid SDKs. diff --git a/.github/workflows/agp-matrix.yml b/.github/workflows/agp-matrix.yml index b93bc364ac..964107ecd5 100644 --- a/.github/workflows/agp-matrix.yml +++ b/.github/workflows/agp-matrix.yml @@ -38,7 +38,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@707359876a764dbcdb9da0b0ed08291818310c3d # pin@v3 + uses: gradle/actions/setup-gradle@4ba34e96c5f6493e99d0696180a9a8d431577ba9 # pin@v3 with: gradle-home-cache-cleanup: true diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5988e27888..f6904bd2d9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,7 +27,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@707359876a764dbcdb9da0b0ed08291818310c3d # pin@v3 + uses: gradle/actions/setup-gradle@4ba34e96c5f6493e99d0696180a9a8d431577ba9 # pin@v3 with: gradle-home-cache-cleanup: true @@ -35,7 +35,7 @@ jobs: run: make preMerge - name: Upload coverage to Codecov - uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # pin@v4 + uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # pin@v4 with: name: sentry-java fail_ci_if_error: false diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 771b5274a6..85ea055e77 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,12 +34,12 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@707359876a764dbcdb9da0b0ed08291818310c3d # pin@v3 + uses: gradle/actions/setup-gradle@4ba34e96c5f6493e99d0696180a9a8d431577ba9 # pin@v3 with: gradle-home-cache-cleanup: true - name: Initialize CodeQL - uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd # pin@v2 + uses: github/codeql-action/init@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # pin@v2 with: languages: ${{ matrix.language }} @@ -48,4 +48,4 @@ jobs: ./gradlew buildForCodeQL - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@662472033e021d55d94146f66f6058822b0b39fd # pin@v2 + uses: github/codeql-action/analyze@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # pin@v2 diff --git a/.github/workflows/enforce-license-compliance.yml b/.github/workflows/enforce-license-compliance.yml index c4a22a909b..d97e4614b7 100644 --- a/.github/workflows/enforce-license-compliance.yml +++ b/.github/workflows/enforce-license-compliance.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Setup Gradle - uses: gradle/actions/setup-gradle@707359876a764dbcdb9da0b0ed08291818310c3d # pin@v3 + uses: gradle/actions/setup-gradle@4ba34e96c5f6493e99d0696180a9a8d431577ba9 # pin@v3 with: gradle-home-cache-cleanup: true diff --git a/.github/workflows/generate-javadocs.yml b/.github/workflows/generate-javadocs.yml index 5d358bdf50..26fc5b01a5 100644 --- a/.github/workflows/generate-javadocs.yml +++ b/.github/workflows/generate-javadocs.yml @@ -20,7 +20,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@707359876a764dbcdb9da0b0ed08291818310c3d # pin@v3 + uses: gradle/actions/setup-gradle@4ba34e96c5f6493e99d0696180a9a8d431577ba9 # pin@v3 with: gradle-home-cache-cleanup: true @@ -28,7 +28,7 @@ jobs: run: | ./gradlew aggregateJavadocs - name: Deploy - uses: JamesIves/github-pages-deploy-action@881db5376404c5c8d621010bcbec0310b58d5e29 # pin@4.6.8 + uses: JamesIves/github-pages-deploy-action@62fec3add6773ec5dbbf18d2ee4260911aa35cf4 # pin@4.6.9 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} BRANCH: gh-pages diff --git a/.github/workflows/integration-tests-benchmarks.yml b/.github/workflows/integration-tests-benchmarks.yml index 34eea1733c..b9ad44ec1e 100644 --- a/.github/workflows/integration-tests-benchmarks.yml +++ b/.github/workflows/integration-tests-benchmarks.yml @@ -37,7 +37,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@707359876a764dbcdb9da0b0ed08291818310c3d # pin@v3 + uses: gradle/actions/setup-gradle@4ba34e96c5f6493e99d0696180a9a8d431577ba9 # pin@v3 with: gradle-home-cache-cleanup: true @@ -86,7 +86,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@707359876a764dbcdb9da0b0ed08291818310c3d # pin@v3 + uses: gradle/actions/setup-gradle@4ba34e96c5f6493e99d0696180a9a8d431577ba9 # pin@v3 with: gradle-home-cache-cleanup: true diff --git a/.github/workflows/integration-tests-ui-critical.yml b/.github/workflows/integration-tests-ui-critical.yml index a28400e50f..84f3b0e80e 100644 --- a/.github/workflows/integration-tests-ui-critical.yml +++ b/.github/workflows/integration-tests-ui-critical.yml @@ -32,7 +32,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@707359876a764dbcdb9da0b0ed08291818310c3d # pin@v3 + uses: gradle/actions/setup-gradle@4ba34e96c5f6493e99d0696180a9a8d431577ba9 # pin@v3 with: gradle-home-cache-cleanup: true diff --git a/.github/workflows/integration-tests-ui.yml b/.github/workflows/integration-tests-ui.yml index 059e3c7424..dc9cdc04a1 100644 --- a/.github/workflows/integration-tests-ui.yml +++ b/.github/workflows/integration-tests-ui.yml @@ -32,7 +32,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@707359876a764dbcdb9da0b0ed08291818310c3d # pin@v3 + uses: gradle/actions/setup-gradle@4ba34e96c5f6493e99d0696180a9a8d431577ba9 # pin@v3 with: gradle-home-cache-cleanup: true @@ -42,7 +42,7 @@ jobs: run: make assembleUiTests - name: Install SauceLabs CLI - uses: saucelabs/saucectl-run-action@39e4f0666ca8ecb4b60847213c6e0fbd6a0c2bd8 # pin@v3 + uses: saucelabs/saucectl-run-action@39e4f0666ca8ecb4b60847213c6e0fbd6a0c2bd8 # pin@v4.3.0 env: GITHUB_TOKEN: ${{ github.token }} with: diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index c625efa8eb..a4d9e7befa 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -26,7 +26,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@707359876a764dbcdb9da0b0ed08291818310c3d # pin@v3 + uses: gradle/actions/setup-gradle@4ba34e96c5f6493e99d0696180a9a8d431577ba9 # pin@v3 with: gradle-home-cache-cleanup: true diff --git a/.github/workflows/system-tests-backend.yml b/.github/workflows/system-tests-backend.yml index ef5e40cf1e..40bb5c92dd 100644 --- a/.github/workflows/system-tests-backend.yml +++ b/.github/workflows/system-tests-backend.yml @@ -56,7 +56,7 @@ jobs: java-version: '17' - name: Setup Gradle - uses: gradle/actions/setup-gradle@707359876a764dbcdb9da0b0ed08291818310c3d # pin@v3 + uses: gradle/actions/setup-gradle@4ba34e96c5f6493e99d0696180a9a8d431577ba9 # pin@v3 with: gradle-home-cache-cleanup: true diff --git a/.sauce/sentry-uitest-android-ui.yml b/.sauce/sentry-uitest-android-ui.yml index b25b404cdf..5cec16cf7c 100644 --- a/.sauce/sentry-uitest-android-ui.yml +++ b/.sauce/sentry-uitest-android-ui.yml @@ -11,30 +11,30 @@ sauce: - android defaults: - timeout: 40m + timeout: 45m espresso: app: ./sentry-android-integration-tests/sentry-uitest-android/build/outputs/apk/release/sentry-uitest-android-release.apk testApp: ./sentry-android-integration-tests/sentry-uitest-android/build/outputs/apk/androidTest/release/sentry-uitest-android-release-androidTest.apk suites: - - name: "Android 13 Ui test (api 33)" + - name: "Android 14 Ui test (api 34)" testOptions: clearPackageData: true useTestOrchestrator: true devices: - name: ".*" - platformVersion: "13" + platformVersion: "14" - - name: "Android 12 Ui test (api 31)" + - name: "Android 13 Ui test (api 33)" testOptions: clearPackageData: true useTestOrchestrator: true devices: - name: ".*" - platformVersion: "12" + platformVersion: "13" - - name: "Android 11 Ui test (api 30)" + - name: "Android 11 Ui test (api 31)" testOptions: clearPackageData: true useTestOrchestrator: true @@ -42,14 +42,6 @@ suites: - name: ".*" platformVersion: "11" - - name: "Android 10 Ui test (api 29)" - testOptions: - clearPackageData: true - useTestOrchestrator: true - devices: - - name: ".*" - platformVersion: "10" - # Controls what artifacts to fetch when the suite on Sauce Cloud has finished. artifacts: download: diff --git a/CHANGELOG.md b/CHANGELOG.md index c4f71deb2b..24b25416ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ - Bump OpenTelemetry to 1.44.1, OpenTelemetry Java Agent to 2.10.0 and Semantic Conventions to 1.28.0 ([#3935](https://github.com/getsentry/sentry-java/pull/3935)) +### Fixes + +- Fix testTag not working for Jetpack Compose user interaction tracking ([#3878](https://github.com/getsentry/sentry-java/pull/3878)) + ## 8.0.0-beta.3 ### Features diff --git a/README.md b/README.md index 6e60edda9d..50c281cdfa 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ This repo uses the following ways to release SDK updates: # Useful links and docs +* A deep dive into how we built [Session Replay for Android](https://www.droidcon.com/2024/11/22/rewind-and-resolve-a-deep-dive-into-building-session-replay-for-android/) at Droidcon London 2024. * Current Javadocs [generated from source code](https://getsentry.github.io/sentry-java/). * Java SDK version 1.x [can still be found here](https://docs.sentry.io/clients/java/). * Migration page from [sentry-android 1.x and 2.x to sentry-android 4.x](https://docs.sentry.io/platforms/android/migration/). diff --git a/sentry-compose-helper/src/jvmMain/java/io/sentry/compose/gestures/ComposeGestureTargetLocator.java b/sentry-compose-helper/src/jvmMain/java/io/sentry/compose/gestures/ComposeGestureTargetLocator.java index 2d9e5a6bc9..bd056aeb91 100644 --- a/sentry-compose-helper/src/jvmMain/java/io/sentry/compose/gestures/ComposeGestureTargetLocator.java +++ b/sentry-compose-helper/src/jvmMain/java/io/sentry/compose/gestures/ComposeGestureTargetLocator.java @@ -1,5 +1,6 @@ package io.sentry.compose.gestures; +import androidx.compose.ui.Modifier; import androidx.compose.ui.geometry.Rect; import androidx.compose.ui.layout.ModifierInfo; import androidx.compose.ui.node.LayoutNode; @@ -15,6 +16,7 @@ import io.sentry.internal.gestures.GestureTargetLocator; import io.sentry.internal.gestures.UiElement; import io.sentry.util.AutoClosableReentrantLock; +import java.lang.reflect.Field; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -93,13 +95,28 @@ public ComposeGestureTargetLocator(final @NotNull ILogger logger) { } } } else { + final @NotNull Modifier modifier = modifierInfo.getModifier(); // Newer Jetpack Compose 1.5 uses Node modifiers for clicks/scrolls - final @Nullable String type = modifierInfo.getModifier().getClass().getCanonicalName(); + final @Nullable String type = modifier.getClass().getCanonicalName(); if ("androidx.compose.foundation.ClickableElement".equals(type) || "androidx.compose.foundation.CombinedClickableElement".equals(type)) { isClickable = true; } else if ("androidx.compose.foundation.ScrollingLayoutElement".equals(type)) { isScrollable = true; + } else if ("androidx.compose.ui.platform.TestTagElement".equals(type)) { + // Newer Jetpack Compose uses TestTagElement as node elements + // See + // https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/TestTag.kt;l=34;drc=dcaa116fbfda77e64a319e1668056ce3b032469f + try { + final Field tagField = modifier.getClass().getDeclaredField("tag"); + tagField.setAccessible(true); + final @Nullable Object value = tagField.get(modifier); + if (value instanceof String) { + lastKnownTag = (String) value; + } + } catch (Throwable e) { + // ignored + } } } } diff --git a/sentry-compose/proguard-rules.pro b/sentry-compose/proguard-rules.pro index 80580b28fd..372d2db1db 100644 --- a/sentry-compose/proguard-rules.pro +++ b/sentry-compose/proguard-rules.pro @@ -12,6 +12,7 @@ -keepnames class androidx.compose.foundation.ClickableElement -keepnames class androidx.compose.foundation.CombinedClickableElement -keepnames class androidx.compose.foundation.ScrollingLayoutElement +-keepnames class androidx.compose.ui.platform.TestTagElement { *; } # R8 will warn about missing classes if people don't have androidx.compose-navigation on their # classpath, but this is fine, these classes are used in an internal class which is only used when