Skip to content

Commit 3a7920a

Browse files
authored
Merge branch 'main' into feat/support_16kb_page_size
2 parents 726c08e + 28a11a7 commit 3a7920a

File tree

14 files changed

+182
-46
lines changed

14 files changed

+182
-46
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
gradle-home-cache-cleanup: true
4242

4343
- name: Initialize CodeQL
44-
uses: github/codeql-action/init@c36620d31ac7c881962c3d9dd939c40ec9434f2b # pin@v2
44+
uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd # pin@v2
4545
with:
4646
languages: ${{ matrix.language }}
4747

@@ -55,4 +55,4 @@ jobs:
5555
./gradlew buildForCodeQL
5656
5757
- name: Perform CodeQL Analysis
58-
uses: github/codeql-action/analyze@c36620d31ac7c881962c3d9dd939c40ec9434f2b # pin@v2
58+
uses: github/codeql-action/analyze@662472033e021d55d94146f66f6058822b0b39fd # pin@v2

.github/workflows/integration-tests-ui-critical.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ env:
1919

2020
jobs:
2121
build:
22-
name: Build sentry-uitest-android-critical
22+
name: Build
2323
runs-on: ubuntu-latest
2424
steps:
2525
- name: Checkout code
@@ -47,9 +47,30 @@ jobs:
4747
retention-days: 1
4848

4949
run-maestro-tests:
50-
name: Run Maestro Tests
50+
name: Run Tests for API Level ${{ matrix.api-level }}
5151
needs: build
5252
runs-on: ubuntu-latest
53+
strategy:
54+
# we want that the matrix keeps running, default is to cancel them if it fails.
55+
fail-fast: false
56+
matrix:
57+
include:
58+
- api-level: 30 # Android 11
59+
target: aosp_atd
60+
channel: canary # Necessary for ATDs
61+
arch: x86_64
62+
- api-level: 31 # Android 12
63+
target: aosp_atd
64+
channel: canary # Necessary for ATDs
65+
arch: x86_64
66+
- api-level: 33 # Android 13
67+
target: aosp_atd
68+
channel: canary # Necessary for ATDs
69+
arch: x86_64
70+
- api-level: 34 # Android 14
71+
target: aosp_atd
72+
channel: canary # Necessary for ATDs
73+
arch: x86_64
5374
steps:
5475
- name: Checkout code
5576
uses: actions/checkout@v4
@@ -76,14 +97,15 @@ jobs:
7697
version: ${{env.MAESTRO_VERSION}}
7798

7899
- name: Run tests
79-
uses: reactivecircus/android-emulator-runner@f0d1ed2dcad93c7479e8b2f2226c83af54494915 # pin@v2.32.0
100+
uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # pin@v2.33.0
80101
with:
81-
api-level: 30
102+
api-level: ${{ matrix.api-level }}
82103
force-avd-creation: false
83104
disable-animations: true
84105
disable-spellchecker: true
85-
target: 'aosp_atd'
86-
channel: canary # Necessary for ATDs
106+
target: ${{ matrix.target }}
107+
channel: ${{ matrix.channel }}
108+
arch: ${{ matrix.arch }}
87109
emulator-options: >
88110
-no-window
89111
-no-snapshot-save

.sauce/sentry-uitest-android-benchmark.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ suites:
3333
useTestOrchestrator: true
3434
devices:
3535
- id: Samsung_Galaxy_S10_Plus_11_real_us # Samsung Galaxy S10+ - api 30 (11) - high end
36-
- id: Samsung_Galaxy_A71_5G_real_us # Samsung Galaxy A71 5G - api 30 (11) - mid end
36+
- id: Google_Pixel_4a_real_us # Google Pixel 4a - api 30 (11) - mid end
3737
- id: Google_Pixel_3a_real # Google Pixel 3a - api 30 (11) - low end
3838

3939
- name: "Android 10 (api 29)"
@@ -42,7 +42,7 @@ suites:
4242
useTestOrchestrator: true
4343
devices:
4444
- id: Google_Pixel_3a_XL_real # Google Pixel 3a XL - api 29 (10)
45-
- id: Motorola_Moto_G_Power_real_us # Motorola Moto G Power - api 29 (10)
45+
- id: OnePlus_6T_real # OnePlus 6T - api 29 (10)
4646

4747
# At the time of writing (July, 4, 2022), the market share per android version is:
4848
# 12.0 = 17.54%, 11.0 = 31.65%, 10.0 = 21.92%

CHANGELOG.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
# Changelog
22

3-
## 7.17.0-alpha.1
3+
## Unreleased
44

55
### Features
66

7+
- Use a separate `Random` instance per thread to improve SDK performance ([#3835](https://github.com/getsentry/sentry-java/pull/3835))
78
- Android 15: Add support for 16KB page sizes ([#3620](https://github.com/getsentry/sentry-java/pull/3620))
89
- See https://developer.android.com/guide/practices/page-sizes for more details
910

11+
### Fixes
12+
13+
- Accept manifest integer values when requiring floating values ([#3823](https://github.com/getsentry/sentry-java/pull/3823))
14+
15+
### Dependencies
16+
17+
- Bump Native SDK from v0.7.2 to v0.7.8 ([#3620](https://github.com/getsentry/sentry-java/pull/3620))
18+
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#078)
19+
- [diff](https://github.com/getsentry/sentry-native/compare/0.7.2...0.7.8)
20+
1021
## 7.16.0
1122

1223
### Features
@@ -27,12 +38,9 @@
2738
- Load lazy fields on init in the background ([#3803](https://github.com/getsentry/sentry-java/pull/3803))
2839
- Replace setOf with HashSet.add ([#3801](https://github.com/getsentry/sentry-java/pull/3801))
2940

30-
### Dependencies
31-
32-
- Bump Native SDK from v0.7.2 to v0.7.8 ([#3620](https://github.com/getsentry/sentry-java/pull/3620))
33-
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#078)
34-
- [diff](https://github.com/getsentry/sentry-native/compare/0.7.2...0.7.8)
41+
### Breaking changes
3542

43+
- 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.
3644

3745
## 7.16.0-alpha.1
3846

buildSrc/src/main/java/Config.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,18 +177,17 @@ object Config {
177177
}
178178

179179
object TestLibs {
180-
private val androidxTestVersion = "1.5.0"
181180
private val espressoVersion = "3.5.0"
182181

183182
val androidJUnitRunner = "androidx.test.runner.AndroidJUnitRunner"
184183
val kotlinTestJunit = "org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion"
185-
val androidxCore = "androidx.test:core:$androidxTestVersion"
186-
val androidxRunner = "androidx.test:runner:$androidxTestVersion"
187-
val androidxTestCoreKtx = "androidx.test:core-ktx:$androidxTestVersion"
188-
val androidxTestRules = "androidx.test:rules:$androidxTestVersion"
184+
val androidxCore = "androidx.test:core:1.6.1"
185+
val androidxRunner = "androidx.test:runner:1.6.2"
186+
val androidxTestCoreKtx = "androidx.test:core-ktx:1.6.1"
187+
val androidxTestRules = "androidx.test:rules:1.6.1"
189188
val espressoCore = "androidx.test.espresso:espresso-core:$espressoVersion"
190189
val espressoIdlingResource = "androidx.test.espresso:espresso-idling-resource:$espressoVersion"
191-
val androidxTestOrchestrator = "androidx.test:orchestrator:1.4.2"
190+
val androidxTestOrchestrator = "androidx.test:orchestrator:1.5.0"
192191
val androidxJunit = "androidx.test.ext:junit:1.1.5"
193192
val androidxCoreKtx = "androidx.core:core-ktx:1.7.0"
194193
val robolectric = "org.robolectric:robolectric:4.10.3"

sentry-android-core/src/main/java/io/sentry/android/core/AnrV2EventProcessor.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
import io.sentry.protocol.SentryTransaction;
5555
import io.sentry.protocol.User;
5656
import io.sentry.util.HintUtils;
57-
import io.sentry.util.Random;
57+
import io.sentry.util.SentryRandom;
5858
import java.io.File;
5959
import java.util.ArrayList;
6060
import java.util.Arrays;
@@ -83,24 +83,13 @@ public final class AnrV2EventProcessor implements BackfillingEventProcessor {
8383

8484
private final @NotNull SentryExceptionFactory sentryExceptionFactory;
8585

86-
private final @Nullable Random random;
87-
8886
public AnrV2EventProcessor(
8987
final @NotNull Context context,
9088
final @NotNull SentryAndroidOptions options,
9189
final @NotNull BuildInfoProvider buildInfoProvider) {
92-
this(context, options, buildInfoProvider, null);
93-
}
94-
95-
AnrV2EventProcessor(
96-
final @NotNull Context context,
97-
final @NotNull SentryAndroidOptions options,
98-
final @NotNull BuildInfoProvider buildInfoProvider,
99-
final @Nullable Random random) {
10090
this.context = ContextUtils.getApplicationContext(context);
10191
this.options = options;
10292
this.buildInfoProvider = buildInfoProvider;
103-
this.random = random;
10493

10594
final SentryStackTraceFactory sentryStackTraceFactory =
10695
new SentryStackTraceFactory(this.options);
@@ -180,9 +169,8 @@ private boolean sampleReplay(final @NotNull SentryEvent event) {
180169

181170
try {
182171
// we have to sample here with the old sample rate, because it may change between app launches
183-
final @NotNull Random random = this.random != null ? this.random : new Random();
184172
final double replayErrorSampleRateDouble = Double.parseDouble(replayErrorSampleRate);
185-
if (replayErrorSampleRateDouble < random.nextDouble()) {
173+
if (replayErrorSampleRateDouble < SentryRandom.current().nextDouble()) {
186174
options
187175
.getLogger()
188176
.log(

sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ private static boolean readBool(
492492
private static @NotNull Double readDouble(
493493
final @NotNull Bundle metadata, final @NotNull ILogger logger, final @NotNull String key) {
494494
// manifest meta-data only reads float
495-
final Double value = ((Float) metadata.getFloat(key, -1)).doubleValue();
495+
final Double value = ((Number) metadata.getFloat(key, metadata.getInt(key, -1))).doubleValue();
496496
logger.log(SentryLevel.DEBUG, key + " read: " + value);
497497
return value;
498498
}

sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,4 +1515,29 @@ class ManifestMetadataReaderTest {
15151515
assertTrue(fixture.options.experimental.sessionReplay.maskViewClasses.contains(SentryReplayOptions.IMAGE_VIEW_CLASS_NAME))
15161516
assertTrue(fixture.options.experimental.sessionReplay.maskViewClasses.contains(SentryReplayOptions.TEXT_VIEW_CLASS_NAME))
15171517
}
1518+
1519+
@Test
1520+
fun `applyMetadata reads integers even when expecting floats`() {
1521+
// Arrange
1522+
val expectedSampleRate: Int = 1
1523+
1524+
val bundle = bundleOf(
1525+
ManifestMetadataReader.SAMPLE_RATE to expectedSampleRate,
1526+
ManifestMetadataReader.TRACES_SAMPLE_RATE to expectedSampleRate,
1527+
ManifestMetadataReader.PROFILES_SAMPLE_RATE to expectedSampleRate,
1528+
ManifestMetadataReader.REPLAYS_SESSION_SAMPLE_RATE to expectedSampleRate,
1529+
ManifestMetadataReader.REPLAYS_ERROR_SAMPLE_RATE to expectedSampleRate
1530+
)
1531+
val context = fixture.getContext(metaData = bundle)
1532+
1533+
// Act
1534+
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)
1535+
1536+
// Assert
1537+
assertEquals(expectedSampleRate.toDouble(), fixture.options.sampleRate)
1538+
assertEquals(expectedSampleRate.toDouble(), fixture.options.tracesSampleRate)
1539+
assertEquals(expectedSampleRate.toDouble(), fixture.options.profilesSampleRate)
1540+
assertEquals(expectedSampleRate.toDouble(), fixture.options.experimental.sessionReplay.sessionSampleRate)
1541+
assertEquals(expectedSampleRate.toDouble(), fixture.options.experimental.sessionReplay.onErrorSampleRate)
1542+
}
15181543
}

sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
<!-- <meta-data android:name="io.sentry.traces.sample-rate" android:value="0.8" /> -->
115115

116116
<!-- how to enable profiling when starting transactions -->
117-
<meta-data android:name="io.sentry.traces.profiling.sample-rate" android:value="1.0" />
117+
<meta-data android:name="io.sentry.traces.profiling.sample-rate" android:value="1" />
118118

119119
<!-- how to enable app start profiling -->
120120
<meta-data android:name="io.sentry.traces.profiling.enable-app-start" android:value="true" />
@@ -165,7 +165,7 @@
165165

166166
<meta-data android:name="io.sentry.enable-metrics" android:value="true" />
167167

168-
<meta-data android:name="io.sentry.session-replay.session-sample-rate" android:value="1.0" />
168+
<meta-data android:name="io.sentry.session-replay.session-sample-rate" android:value="1" />
169169
<meta-data android:name="io.sentry.session-replay.mask-all-text" android:value="true" />
170170
</application>
171171
</manifest>

sentry/api/sentry.api

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5829,6 +5829,11 @@ public final class io/sentry/util/SampleRateUtils {
58295829
public static fun isValidTracesSampleRate (Ljava/lang/Double;Z)Z
58305830
}
58315831

5832+
public final class io/sentry/util/SentryRandom {
5833+
public fun <init> ()V
5834+
public static fun current ()Lio/sentry/util/Random;
5835+
}
5836+
58325837
public final class io/sentry/util/StringUtils {
58335838
public static fun byteCountToString (J)Ljava/lang/String;
58345839
public static fun calculateStringHash (Ljava/lang/String;Lio/sentry/ILogger;)Ljava/lang/String;

0 commit comments

Comments
 (0)