// Metro module 16235 (f16236). import { AnalyticEvents, AppStates } from "../../../Constants"; import AutomaticLifecycleManager from "../../../lib/AutomaticLifecycleManager"; import Module16236 from "../../../_bundle/Module16236"; import AnalyticsUtils from "../../../utils/AnalyticsUtils"; import { getDeviceMetadata } from "../../tti_analytics/native/TTIAnalyticsUtils"; class JankStatsManager extends AutomaticLifecycleManager { _timeoutId = null; _isScheduledReportSent = false; _isStartup = true; actions = { APP_STATE_UPDATE: (a0) => { this.handleAppStateUpdate(a0); }, CONNECTION_OPEN_SUPPLEMENTAL: () => { this.handleConnectionOpenSupplemental(); } }; handleAppStateUpdate({ state }) { if (state === AppStates.ACTIVE && !this._isStartup) { this.scheduleReport(); } else if (!(state !== AppStates.BACKGROUND || this._isScheduledReportSent)) { clearTimeout(this._timeoutId); this._timeoutId = null; this.sendReport("background"); } } handleConnectionOpenSupplemental() { setTimeout(() => { this.sendReport("startup"); this._isStartup = false; this.scheduleReport(); }, 0); } scheduleReport() { if (this._timeoutId == null) { this._isScheduledReportSent = false; this._timeoutId = setTimeout(() => { this._timeoutId = null; this.sendReport("timer"); this._isScheduledReportSent = true; if (Module16236 != null) { Module16236.stopTracking(); } }, 300000); } } sendReport(a0) { const r10 = Module16236 == null ? void 0 : Module16236.requestReport(); if (!(r10 == null || r10.totalFrameCount === 0 && r10.frameMetricsTotalFrameCount === 0)) { AnalyticsUtils.track(AnalyticEvents.ANDROID_JANK_STATS, { ...getDeviceMetadata(), version: 2, total_frame_count: r10.totalFrameCount, jank_frame_count: r10.jankFrameCount, frame_metrics_total_frame_count: r10.frameMetricsTotalFrameCount, frame_metrics_jank_frame_count: r10.frameMetricsJankFrameCount, trigger: a0 }); } } } const jankStatsManager = new JankStatsManager(); export default jankStatsManager;