Skip to content

Commit dc580bb

Browse files
committed
Update
1 parent ab8fd7f commit dc580bb

File tree

1 file changed

+0
-106
lines changed

1 file changed

+0
-106
lines changed

packages/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -288,112 +288,6 @@ class SentryFlutterPlugin :
288288
@JvmStatic
289289
fun privateSentryGetReplayIntegration(): ReplayIntegration? = replay
290290

291-
@Suppress("unused") // Used by native/jni bindings
292-
@JvmStatic
293-
fun getDisplayRefreshRate(): Int? {
294-
var refreshRate: Int? = null
295-
296-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
297-
val display = activity?.get()?.display
298-
if (display != null) {
299-
refreshRate = display.refreshRate.toInt()
300-
}
301-
} else {
302-
val display =
303-
activity
304-
?.get()
305-
?.window
306-
?.windowManager
307-
?.defaultDisplay
308-
if (display != null) {
309-
refreshRate = display.refreshRate.toInt()
310-
}
311-
}
312-
313-
return refreshRate
314-
}
315-
316-
@Suppress("unused", "ReturnCount", "TooGenericExceptionCaught") // Used by native/jni bindings
317-
@JvmStatic
318-
fun fetchNativeAppStartAsBytes(): ByteArray? {
319-
if (!sentryFlutter.autoPerformanceTracingEnabled) {
320-
return null
321-
}
322-
323-
val appStartMetrics = AppStartMetrics.getInstance()
324-
325-
if (!appStartMetrics.isAppLaunchedInForeground ||
326-
appStartMetrics.appStartTimeSpan.durationMs > APP_START_MAX_DURATION_MS
327-
) {
328-
Log.w(
329-
"Sentry",
330-
"Invalid app start data: app not launched in foreground or app start took too long (>60s)",
331-
)
332-
return null
333-
}
334-
335-
val appStartTimeSpan = appStartMetrics.appStartTimeSpan
336-
val appStartTime = appStartTimeSpan.startTimestamp
337-
val isColdStart = appStartMetrics.appStartType == AppStartMetrics.AppStartType.COLD
338-
339-
if (appStartTime == null) {
340-
Log.w("Sentry", "App start won't be sent due to missing appStartTime")
341-
return null
342-
}
343-
344-
val appStartTimeMillis = DateUtils.nanosToMillis(appStartTime.nanoTimestamp().toDouble())
345-
val item =
346-
mutableMapOf<String, Any?>(
347-
"pluginRegistrationTime" to pluginRegistrationTime,
348-
"appStartTime" to appStartTimeMillis,
349-
"isColdStart" to isColdStart,
350-
)
351-
352-
val androidNativeSpans = mutableMapOf<String, Any?>()
353-
354-
val processInitSpan =
355-
TimeSpan().apply {
356-
description = "Process Initialization"
357-
setStartUnixTimeMs(appStartTimeSpan.startTimestampMs)
358-
setStartedAt(appStartTimeSpan.startUptimeMs)
359-
setStoppedAt(appStartMetrics.classLoadedUptimeMs)
360-
}
361-
addTimeSpanToMap(processInitSpan, androidNativeSpans)
362-
363-
val applicationOnCreateSpan = appStartMetrics.applicationOnCreateTimeSpan
364-
addTimeSpanToMap(applicationOnCreateSpan, androidNativeSpans)
365-
366-
val contentProviderSpans = appStartMetrics.contentProviderOnCreateTimeSpans
367-
contentProviderSpans.forEach { span ->
368-
addTimeSpanToMap(span, androidNativeSpans)
369-
}
370-
371-
appStartMetrics.activityLifecycleTimeSpans.forEach { span ->
372-
addTimeSpanToMap(span.onCreate, androidNativeSpans)
373-
addTimeSpanToMap(span.onStart, androidNativeSpans)
374-
}
375-
376-
item["nativeSpanTimes"] = androidNativeSpans
377-
378-
val json = JSONObject(item).toString()
379-
return json.toByteArray(Charsets.UTF_8)
380-
}
381-
382-
private fun addTimeSpanToMap(
383-
span: TimeSpan,
384-
map: MutableMap<String, Any?>,
385-
) {
386-
if (span.startTimestamp == null) return
387-
388-
span.description?.let { description ->
389-
map[description] =
390-
mapOf<String, Any?>(
391-
"startTimestampMsSinceEpoch" to span.startTimestampMs,
392-
"stopTimestampMsSinceEpoch" to span.projectedStopTimestampMs,
393-
)
394-
}
395-
}
396-
397291
@JvmStatic
398292
fun crash() {
399293
val exception = RuntimeException("FlutterSentry Native Integration: Sample RuntimeException")

0 commit comments

Comments
 (0)