@@ -2,7 +2,7 @@ package io.sentry.flutter
22
33import android.app.Activity
44import android.content.Context
5- import android.content.res.Configuration;
5+ import android.content.res.Configuration
66import android.os.Build
77import android.os.Looper
88import android.util.Log
@@ -40,19 +40,23 @@ import kotlin.math.roundToInt
4040
4141private const val APP_START_MAX_DURATION_MS = 60000
4242
43- class SentryFlutterPlugin : FlutterPlugin , MethodCallHandler , ActivityAware {
43+ class SentryFlutterPlugin :
44+ FlutterPlugin ,
45+ MethodCallHandler ,
46+ ActivityAware {
4447 private lateinit var channel: MethodChannel
4548 private lateinit var context: Context
4649 private lateinit var sentryFlutter: SentryFlutter
4750 private lateinit var replay: ReplayIntegration
48- private var replayConfig = ScreenshotRecorderConfig (
49- recordingWidth = 0 ,
50- recordingHeight = 0 ,
51- scaleFactorX = 1.0f ,
52- scaleFactorY = 1.0f ,
53- frameRate = 0 ,
54- bitRate = 0
55- )
51+ private var replayConfig =
52+ ScreenshotRecorderConfig (
53+ recordingWidth = 0 ,
54+ recordingHeight = 0 ,
55+ scaleFactorX = 1.0f ,
56+ scaleFactorY = 1.0f ,
57+ frameRate = 0 ,
58+ bitRate = 0 ,
59+ )
5660
5761 private var activity: WeakReference <Activity >? = null
5862 private var framesTracker: ActivityFramesTracker ? = null
@@ -167,7 +171,12 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
167171 recorderConfigProvider = {
168172 Log .i(
169173 " Sentry" ,
170- " Replay configuration requested. Returning: %dx%d at %d FPS, %d BPS" .format(replayConfig.recordingWidth, replayConfig.recordingHeight, replayConfig.frameRate, replayConfig.bitRate)
174+ " Replay configuration requested. Returning: %dx%d at %d FPS, %d BPS" .format(
175+ replayConfig.recordingWidth,
176+ replayConfig.recordingHeight,
177+ replayConfig.frameRate,
178+ replayConfig.bitRate,
179+ ),
171180 )
172181 replayConfig
173182 },
@@ -567,12 +576,12 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
567576 }
568577
569578 private fun Double.adjustReplaySizeToBlockSize (): Double {
570- val remainder = this % 16
571- return if (remainder <= 8 ) {
572- this - remainder
573- } else {
574- this + (16 - remainder)
575- }
579+ val remainder = this % 16
580+ return if (remainder <= 8 ) {
581+ this - remainder
582+ } else {
583+ this + (16 - remainder)
584+ }
576585 }
577586 }
578587
@@ -605,7 +614,10 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
605614 result.success(" " )
606615 }
607616
608- private fun setReplayConfig (call : MethodCall , result : Result ) {
617+ private fun setReplayConfig (
618+ call : MethodCall ,
619+ result : Result ,
620+ ) {
609621 // Since codec block size is 16, so we have to adjust the width and height to it,
610622 // otherwise the codec might fail to configure on some devices, see
611623 // https://cs.android.com/android/platform/superproject/+/master:frameworks/base/media/java/android/media/MediaCodecInfo.java;l=1999-2001
@@ -622,17 +634,23 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
622634 height = newHeight
623635 }
624636
625- replayConfig = ScreenshotRecorderConfig (
626- recordingWidth = width.roundToInt(),
627- recordingHeight = height.roundToInt(),
628- scaleFactorX = 1.0f ,
629- scaleFactorY = 1.0f ,
630- frameRate = call.argument(" frameRate" ) as ? Int ? : 0 ,
631- bitRate = call.argument(" bitRate" ) as ? Int ? : 0
632- )
637+ replayConfig =
638+ ScreenshotRecorderConfig (
639+ recordingWidth = width.roundToInt(),
640+ recordingHeight = height.roundToInt(),
641+ scaleFactorX = 1.0f ,
642+ scaleFactorY = 1.0f ,
643+ frameRate = call.argument(" frameRate" ) as ? Int ? : 0 ,
644+ bitRate = call.argument(" bitRate" ) as ? Int ? : 0 ,
645+ )
633646 Log .i(
634647 " Sentry" ,
635- " Configuring replay: %dx%d at %d FPS, %d BPS" .format(replayConfig.recordingWidth, replayConfig.recordingHeight, replayConfig.frameRate, replayConfig.bitRate)
648+ " Configuring replay: %dx%d at %d FPS, %d BPS" .format(
649+ replayConfig.recordingWidth,
650+ replayConfig.recordingHeight,
651+ replayConfig.frameRate,
652+ replayConfig.bitRate,
653+ ),
636654 )
637655 replay.onConfigurationChanged(Configuration ())
638656 result.success(" " )
0 commit comments