diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 7ae4f25c65..68855cbd8d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -41,7 +41,7 @@ jobs: gradle-home-cache-cleanup: true - name: Initialize CodeQL - uses: github/codeql-action/init@c36620d31ac7c881962c3d9dd939c40ec9434f2b # pin@v2 + uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd # pin@v2 with: languages: ${{ matrix.language }} @@ -55,4 +55,4 @@ jobs: ./gradlew buildForCodeQL - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@c36620d31ac7c881962c3d9dd939c40ec9434f2b # pin@v2 + uses: github/codeql-action/analyze@662472033e021d55d94146f66f6058822b0b39fd # pin@v2 diff --git a/.github/workflows/integration-tests-ui-critical.yml b/.github/workflows/integration-tests-ui-critical.yml index ec9a59ac17..c65651a191 100644 --- a/.github/workflows/integration-tests-ui-critical.yml +++ b/.github/workflows/integration-tests-ui-critical.yml @@ -124,7 +124,7 @@ jobs: version: ${{env.MAESTRO_VERSION}} - name: Run tests - uses: reactivecircus/android-emulator-runner@f0d1ed2dcad93c7479e8b2f2226c83af54494915 # pin@v2.32.0 + uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # pin@v2.33.0 with: api-level: ${{ matrix.api-level }} force-avd-creation: false diff --git a/.sauce/sentry-uitest-android-benchmark.yml b/.sauce/sentry-uitest-android-benchmark.yml index 6b8120cfa7..48737b5fa5 100644 --- a/.sauce/sentry-uitest-android-benchmark.yml +++ b/.sauce/sentry-uitest-android-benchmark.yml @@ -33,7 +33,7 @@ suites: useTestOrchestrator: true devices: - id: Samsung_Galaxy_S10_Plus_11_real_us # Samsung Galaxy S10+ - api 30 (11) - high end - - id: Samsung_Galaxy_A71_5G_real_us # Samsung Galaxy A71 5G - api 30 (11) - mid end + - id: Google_Pixel_4a_real_us # Google Pixel 4a - api 30 (11) - mid end - id: Google_Pixel_3a_real # Google Pixel 3a - api 30 (11) - low end - name: "Android 10 (api 29)" @@ -42,7 +42,7 @@ suites: useTestOrchestrator: true devices: - id: Google_Pixel_3a_XL_real # Google Pixel 3a XL - api 29 (10) - - id: Motorola_Moto_G_Power_real_us # Motorola Moto G Power - api 29 (10) + - id: OnePlus_6T_real # OnePlus 6T - api 29 (10) # At the time of writing (July, 4, 2022), the market share per android version is: # 12.0 = 17.54%, 11.0 = 31.65%, 10.0 = 21.92% diff --git a/CHANGELOG.md b/CHANGELOG.md index c6d8bdfc83..813e9e65bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixes + +- Accept manifest integer values when requiring floating values ([#3823](https://github.com/getsentry/sentry-java/pull/3823)) + ## 7.16.0 ### Features @@ -20,6 +26,10 @@ - Load lazy fields on init in the background ([#3803](https://github.com/getsentry/sentry-java/pull/3803)) - Replace setOf with HashSet.add ([#3801](https://github.com/getsentry/sentry-java/pull/3801)) +### Breaking changes + +- The method `addIntegrationToSdkVersion(Ljava/lang/Class;)V` has been removed from the core (`io.sentry:sentry`) package. Please make sure all of the packages (e.g. `io.sentry:sentry-android-core`, `io.sentry:sentry-android-fragment`, `io.sentry:sentry-okhttp` and others) are all aligned and using the same version to prevent the `NoSuchMethodError` exception. + ## 7.16.0-alpha.1 ### Features diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt index 94fb281c52..e2112732bd 100644 --- a/buildSrc/src/main/java/Config.kt +++ b/buildSrc/src/main/java/Config.kt @@ -177,18 +177,17 @@ object Config { } object TestLibs { - private val androidxTestVersion = "1.5.0" private val espressoVersion = "3.5.0" val androidJUnitRunner = "androidx.test.runner.AndroidJUnitRunner" val kotlinTestJunit = "org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion" - val androidxCore = "androidx.test:core:$androidxTestVersion" - val androidxRunner = "androidx.test:runner:$androidxTestVersion" - val androidxTestCoreKtx = "androidx.test:core-ktx:$androidxTestVersion" - val androidxTestRules = "androidx.test:rules:$androidxTestVersion" + val androidxCore = "androidx.test:core:1.6.1" + val androidxRunner = "androidx.test:runner:1.6.2" + val androidxTestCoreKtx = "androidx.test:core-ktx:1.6.1" + val androidxTestRules = "androidx.test:rules:1.6.1" val espressoCore = "androidx.test.espresso:espresso-core:$espressoVersion" val espressoIdlingResource = "androidx.test.espresso:espresso-idling-resource:$espressoVersion" - val androidxTestOrchestrator = "androidx.test:orchestrator:1.4.2" + val androidxTestOrchestrator = "androidx.test:orchestrator:1.5.0" val androidxJunit = "androidx.test.ext:junit:1.1.5" val androidxCoreKtx = "androidx.core:core-ktx:1.7.0" val robolectric = "org.robolectric:robolectric:4.10.3" diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java index babcfdfc98..adfd4f22ad 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java @@ -492,7 +492,7 @@ private static boolean readBool( private static @NotNull Double readDouble( final @NotNull Bundle metadata, final @NotNull ILogger logger, final @NotNull String key) { // manifest meta-data only reads float - final Double value = ((Float) metadata.getFloat(key, -1)).doubleValue(); + final Double value = ((Number) metadata.getFloat(key, metadata.getInt(key, -1))).doubleValue(); logger.log(SentryLevel.DEBUG, key + " read: " + value); return value; } diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt index 25b2e0191c..17f0f3950b 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt @@ -1515,4 +1515,29 @@ class ManifestMetadataReaderTest { assertTrue(fixture.options.experimental.sessionReplay.maskViewClasses.contains(SentryReplayOptions.IMAGE_VIEW_CLASS_NAME)) assertTrue(fixture.options.experimental.sessionReplay.maskViewClasses.contains(SentryReplayOptions.TEXT_VIEW_CLASS_NAME)) } + + @Test + fun `applyMetadata reads integers even when expecting floats`() { + // Arrange + val expectedSampleRate: Int = 1 + + val bundle = bundleOf( + ManifestMetadataReader.SAMPLE_RATE to expectedSampleRate, + ManifestMetadataReader.TRACES_SAMPLE_RATE to expectedSampleRate, + ManifestMetadataReader.PROFILES_SAMPLE_RATE to expectedSampleRate, + ManifestMetadataReader.REPLAYS_SESSION_SAMPLE_RATE to expectedSampleRate, + ManifestMetadataReader.REPLAYS_ERROR_SAMPLE_RATE to expectedSampleRate + ) + val context = fixture.getContext(metaData = bundle) + + // Act + ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) + + // Assert + assertEquals(expectedSampleRate.toDouble(), fixture.options.sampleRate) + assertEquals(expectedSampleRate.toDouble(), fixture.options.tracesSampleRate) + assertEquals(expectedSampleRate.toDouble(), fixture.options.profilesSampleRate) + assertEquals(expectedSampleRate.toDouble(), fixture.options.experimental.sessionReplay.sessionSampleRate) + assertEquals(expectedSampleRate.toDouble(), fixture.options.experimental.sessionReplay.onErrorSampleRate) + } } diff --git a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml index 058ad3710c..2327573a43 100644 --- a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml +++ b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml @@ -114,7 +114,7 @@ - + @@ -165,7 +165,7 @@ - +