Skip to content

Commit 260324f

Browse files
romtsnmarkushi
andauthored
fix(replay): Fix crash on devices with the Unisoc/Spreadtrum T606 chipset (#4477)
* fix(replay): Do not capture replay for cached events * Changelog * Formatting * Wording * Still caputre replay for outbox events * fix(replay): Fix crash on devices with the Unisoc/Spreadtrum T606 chipset * typo * Changelog * Address PR feedback (#4481) * Address PR feeback * Cleanup --------- Co-authored-by: Markus Hintersteiner <[email protected]>
1 parent 68feef2 commit 260324f

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- Session Replay: Do not capture current replay for cached events from the past ([#4474](https://github.com/getsentry/sentry-java/pull/4474))
1111
- Session Replay: Correctly capture Dialogs and non full-sized windows ([#4354](https://github.com/getsentry/sentry-java/pull/4354))
1212
- Session Replay: Fix inconsistent `segment_id` ([#4471](https://github.com/getsentry/sentry-java/pull/4471))
13+
- Session Replay: Fix crash on devices with the Unisoc/Spreadtrum T606 chipset ([#4477](https://github.com/getsentry/sentry-java/pull/4477))
1314

1415
## 8.13.2
1516

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package io.sentry.android.replay.util
2+
3+
import android.os.Build
4+
5+
internal object SystemProperties {
6+
enum class Property {
7+
SOC_MODEL,
8+
SOC_MANUFACTURER
9+
}
10+
11+
fun get(key: Property, defaultValue: String = ""): String {
12+
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
13+
when (key) {
14+
Property.SOC_MODEL -> Build.SOC_MODEL
15+
Property.SOC_MANUFACTURER -> Build.SOC_MANUFACTURER
16+
}
17+
} else {
18+
defaultValue
19+
}
20+
}
21+
}

sentry-android-replay/src/main/java/io/sentry/android/replay/video/SimpleVideoEncoder.kt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import android.os.Build
3939
import android.view.Surface
4040
import io.sentry.SentryLevel.DEBUG
4141
import io.sentry.SentryOptions
42+
import io.sentry.android.replay.util.SystemProperties
4243
import java.io.File
4344
import java.nio.ByteBuffer
4445
import kotlin.LazyThreadSafetyMode.NONE
@@ -155,11 +156,20 @@ internal class SimpleVideoEncoder(
155156
}
156157

157158
fun encode(image: Bitmap) {
158-
// it seems that Xiaomi devices have problems with hardware canvas, so we have to use
159-
// lockCanvas instead https://stackoverflow.com/a/73520742
159+
/** it seems that Xiaomi devices have problems with hardware canvas, so we have to use
160+
* lockCanvas instead https://stackoverflow.com/a/73520742
161+
* ---
162+
* Same for Motorola devices.
163+
* ---
164+
* As for the T606, it's a Spreadtrum/Unisoc chipset and can be spread across various
165+
* devices, so we have to check the SOC_MODEL property, as the manufacturer name might have
166+
* changed.
167+
* https://github.com/getsentry/sentry-android-gradle-plugin/issues/861#issuecomment-2867021256
168+
*/
160169
val canvas = if (
161170
Build.MANUFACTURER.contains("xiaomi", ignoreCase = true) ||
162-
Build.MANUFACTURER.contains("motorola", ignoreCase = true)
171+
Build.MANUFACTURER.contains("motorola", ignoreCase = true) ||
172+
SystemProperties.get(SystemProperties.Property.SOC_MODEL).equals("T606", ignoreCase = true)
163173
) {
164174
surface?.lockCanvas(null)
165175
} else {

0 commit comments

Comments
 (0)