decord/source/modules/jank_stats/native/JankStatsManager.android.tsx
github-actions 777dc50a28 chore: update source for alpha 346.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4790.js (118.4 MB)
2026-09-10 19:12:31 +00:00

97 lines
3.4 KiB
TypeScript

// Module ID: 17503
// Function ID: 17504
// Name: JankStatsManager
// Dependencies: [1074, 7170, 17504, 1242, 7527, 2]
// Module 17503 (JankStatsManager)
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1242 */;
import TTIAnalyticsUtils from "TTIAnalyticsUtils" /* 7527 */;
import NativeJankStatsModuleDefault from "NativeJankStatsModule" /* 17504 */;
import Constants from "Constants" /* 1074 */;
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 7170 */;
import size from "module_2" /* 2 */;
({ AppStates: c3, AnalyticEvents: closure_4 } = Constants);
class JankStatsManager extends tmp3 {
constructor() {
applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
closure_0 = applyArgumentsResult;
applyArgumentsResult._timeoutId = null;
applyArgumentsResult._isScheduledReportSent = false;
applyArgumentsResult._isStartup = true;
applyArgumentsResult.actions = {
APP_STATE_UPDATE(arg0) {
applyArgumentsResult.handleAppStateUpdate(arg0);
},
CONNECTION_OPEN_SUPPLEMENTAL() {
const result = applyArgumentsResult.handleConnectionOpenSupplemental();
}
};
return applyArgumentsResult;
}
}
const prototype = JankStatsManager.prototype;
prototype["handleAppStateUpdate"] = function handleAppStateUpdate(state) {
const self = this;
state = state.state;
if (state === constants.ACTIVE) {
if (!self._isStartup) {
self.scheduleReport();
}
}
if (!tmp3) {
const _clearTimeout = clearTimeout;
clearTimeout(self._timeoutId);
self._timeoutId = null;
self.sendReport("background");
}
};
prototype["handleConnectionOpenSupplemental"] = function handleConnectionOpenSupplemental() {
const self = this;
const timerId = setTimeout(() => {
self.sendReport("startup");
self._isStartup = false;
self.scheduleReport();
}, 0);
};
prototype["scheduleReport"] = function scheduleReport() {
const self = this;
if (null == this._timeoutId) {
self._isScheduledReportSent = false;
const _setTimeout = setTimeout;
self._timeoutId = setTimeout(() => {
self._timeoutId = null;
self.sendReport("timer");
self._isScheduledReportSent = true;
const obj = NativeJankStatsModuleDefault;
if (obj != null) {
obj.stopTracking();
}
}, 300000);
}
};
prototype["sendReport"] = function sendReport(background) {
const obj = NativeJankStatsModuleDefault;
let report;
if (obj != null) {
report = obj.requestReport();
}
let tmp4 = null == report;
if (!tmp4) {
tmp4 = 0 === report.totalFrameCount && 0 === report.frameMetricsTotalFrameCount;
const tmp5 = 0 === report.totalFrameCount && 0 === report.frameMetricsTotalFrameCount;
}
if (!tmp4) {
const obj2 = {};
const tmpResult = AnalyticsUtilsDefault;
const merged = Object.assign(TTIAnalyticsUtils.getDeviceMetadata());
obj2.version = 2;
({ totalFrameCount: obj3.total_frame_count, jankFrameCount: obj3.jank_frame_count, frameMetricsTotalFrameCount: obj3.frame_metrics_total_frame_count, frameMetricsJankFrameCount: obj3.frame_metrics_jank_frame_count } = report);
obj2.trigger = background;
tmpResult.track(constants2.ANDROID_JANK_STATS, obj2);
}
};
const jankStatsManager = new JankStatsManager();
let result = size.fileFinishedImporting("modules/jank_stats/native/JankStatsManager.android.tsx");
export default jankStatsManager;