From 03ea8610c213781b391aee727352bf44d53b4d6c Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Thu, 6 Feb 2025 21:17:29 +0100 Subject: [PATCH 01/24] add JNI and use in replay.onScreenshotRecorded --- .../io/sentry/flutter/SentryFlutterPlugin.kt | 25 +- flutter/ffi-jni.yaml | 18 + .../native/java/android_replay_recorder.dart | 13 +- flutter/lib/src/native/java/binding.dart | 2920 +++++++++++++++++ .../src/native/java/sentry_native_java.dart | 8 +- flutter/pubspec.yaml | 2 + 6 files changed, 2968 insertions(+), 18 deletions(-) create mode 100644 flutter/ffi-jni.yaml create mode 100644 flutter/lib/src/native/java/binding.dart diff --git a/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt b/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt index 3634d151bd..b97238aa2c 100644 --- a/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt +++ b/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt @@ -1,5 +1,6 @@ package io.sentry.flutter +import android.annotation.SuppressLint import android.app.Activity import android.content.Context import android.content.res.Configuration @@ -49,7 +50,6 @@ class SentryFlutterPlugin : private lateinit var channel: MethodChannel private lateinit var context: Context private lateinit var sentryFlutter: SentryFlutter - private lateinit var replay: ReplayIntegration // Note: initial config because we don't yet have the numbers of the actual Flutter widget. // See how SentryFlutterReplayRecorder.start() handles it. New settings will be set by setReplayConfig() method below. @@ -170,9 +170,9 @@ class SentryFlutterPlugin : if (cacheDirPath != null && isReplayEnabled) { replay = ReplayIntegration( - context, + context.applicationContext, dateProvider = CurrentDateProvider.getInstance(), - recorderProvider = { SentryFlutterReplayRecorder(channel, replay) }, + recorderProvider = { SentryFlutterReplayRecorder(channel, replay!!) }, recorderConfigProvider = { Log.i( "Sentry", @@ -187,8 +187,8 @@ class SentryFlutterPlugin : }, replayCacheProvider = null, ) - replay.breadcrumbConverter = SentryFlutterReplayBreadcrumbConverter() - options.addIntegration(replay) + replay!!.breadcrumbConverter = SentryFlutterReplayBreadcrumbConverter() + options.addIntegration(replay!!) options.setReplayController(replay) } else { options.setReplayController(null) @@ -517,8 +517,15 @@ class SentryFlutterPlugin : } companion object { + @SuppressLint("StaticFieldLeak") + private var replay: ReplayIntegration? = null + private const val NATIVE_CRASH_WAIT_TIME = 500L + @JvmStatic fun privateSentryGetReplayIntegration() : ReplayIntegration? { + return replay + } + private fun crash() { val exception = RuntimeException("FlutterSentry Native Integration: Sample RuntimeException") val mainThread = Looper.getMainLooper().thread @@ -561,7 +568,7 @@ class SentryFlutterPlugin : result.error("5", "Arguments are null", null) return } - replay.onScreenshotRecorded(File(path), timestamp) + replay!!.onScreenshotRecorded(File(path), timestamp) result.success("") } @@ -614,7 +621,7 @@ class SentryFlutterPlugin : replayConfig.bitRate, ), ) - replay.onConfigurationChanged(Configuration()) + replay!!.onConfigurationChanged(Configuration()) result.success("") } @@ -626,7 +633,7 @@ class SentryFlutterPlugin : result.error("5", "Arguments are null", null) return } - replay.captureReplay(isCrash) - result.success(replay.getReplayId().toString()) + replay!!.captureReplay(isCrash) + result.success(replay!!.getReplayId().toString()) } } diff --git a/flutter/ffi-jni.yaml b/flutter/ffi-jni.yaml new file mode 100644 index 0000000000..fae6184db2 --- /dev/null +++ b/flutter/ffi-jni.yaml @@ -0,0 +1,18 @@ +android_sdk_config: + add_gradle_deps: true + android_example: 'example/' + +# summarizer: +# backend: asm + +output: + dart: + path: lib/src/native/java/binding.dart + structure: single_file + +log_level: all + +classes: + - io.sentry.android.replay.ReplayIntegration + - io.sentry.flutter.SentryFlutterPlugin + - java.io.File diff --git a/flutter/lib/src/native/java/android_replay_recorder.dart b/flutter/lib/src/native/java/android_replay_recorder.dart index 2719558fef..61105c0d2e 100644 --- a/flutter/lib/src/native/java/android_replay_recorder.dart +++ b/flutter/lib/src/native/java/android_replay_recorder.dart @@ -1,17 +1,18 @@ +import 'package:jni/jni.dart'; import 'package:meta/meta.dart'; import '../../../sentry_flutter.dart'; import '../../replay/scheduled_recorder.dart'; import '../../screenshot/screenshot.dart'; -import '../sentry_safe_method_channel.dart'; +import 'binding.dart' as native; @internal class AndroidReplayRecorder extends ScheduledScreenshotRecorder { - final SentrySafeMethodChannel _channel; final String _cacheDir; + late final native.ReplayIntegration _nativeReplay; AndroidReplayRecorder( - super.config, super.options, this._channel, this._cacheDir) { + super.config, super.options, this._nativeReplay, this._cacheDir) { super.callback = _addReplayScreenshot; } @@ -31,10 +32,8 @@ class AndroidReplayRecorder extends ScheduledScreenshotRecorder { .file(filePath) .writeAsBytes(pngData.buffer.asUint8List(), flush: true); - await _channel.invokeMethod( - 'addReplayScreenshot', - {'path': filePath, 'timestamp': timestamp}, - ); + _nativeReplay.onScreenshotRecorded$1( + native.File(filePath.toJString()), timestamp); } catch (error, stackTrace) { options.logger( SentryLevel.error, diff --git a/flutter/lib/src/native/java/binding.dart b/flutter/lib/src/native/java/binding.dart new file mode 100644 index 0000000000..301d0b13df --- /dev/null +++ b/flutter/lib/src/native/java/binding.dart @@ -0,0 +1,2920 @@ +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: annotate_overrides +// ignore_for_file: argument_type_not_assignable +// ignore_for_file: camel_case_extensions +// ignore_for_file: camel_case_types +// ignore_for_file: constant_identifier_names +// ignore_for_file: doc_directive_unknown +// ignore_for_file: file_names +// ignore_for_file: inference_failure_on_untyped_parameter +// ignore_for_file: invalid_internal_annotation +// ignore_for_file: invalid_use_of_internal_member +// ignore_for_file: library_prefixes +// ignore_for_file: lines_longer_than_80_chars +// ignore_for_file: no_leading_underscores_for_library_prefixes +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: only_throw_errors +// ignore_for_file: overridden_fields +// ignore_for_file: prefer_double_quotes +// ignore_for_file: unintended_html_in_doc_comment +// ignore_for_file: unnecessary_cast +// ignore_for_file: unnecessary_non_null_assertion +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// ignore_for_file: unused_import +// ignore_for_file: unused_local_variable +// ignore_for_file: unused_shown_name +// ignore_for_file: use_super_parameters + +import 'dart:core' show Object, String, bool, double, int; +import 'dart:core' as core$_; + +import 'package:jni/_internal.dart' as jni$_; +import 'package:jni/jni.dart' as jni$_; + +/// from: `io.sentry.android.replay.ReplayIntegration` +class ReplayIntegration extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + ReplayIntegration.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + jni$_.JClass.forName(r'io/sentry/android/replay/ReplayIntegration'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $ReplayIntegration$NullableType(); + static const type = $ReplayIntegration$Type(); + static final _id_new$ = _class.constructorId( + r'(Landroid/content/Context;Lio/sentry/transport/ICurrentDateProvider;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V', + ); + + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public void (android.content.Context context, io.sentry.transport.ICurrentDateProvider iCurrentDateProvider, kotlin.jvm.functions.Function0 function0, kotlin.jvm.functions.Function1 function1, kotlin.jvm.functions.Function1 function11)` + /// The returned object must be released after use, by calling the [release] method. + factory ReplayIntegration( + jni$_.JObject context, + jni$_.JObject iCurrentDateProvider, + jni$_.JObject? function0, + jni$_.JObject? function1, + jni$_.JObject? function11, + ) { + final _$context = context.reference; + final _$iCurrentDateProvider = iCurrentDateProvider.reference; + final _$function0 = function0?.reference ?? jni$_.jNullReference; + final _$function1 = function1?.reference ?? jni$_.jNullReference; + final _$function11 = function11?.reference ?? jni$_.jNullReference; + return ReplayIntegration.fromReference(_new$( + _class.reference.pointer, + _id_new$ as jni$_.JMethodIDPtr, + _$context.pointer, + _$iCurrentDateProvider.pointer, + _$function0.pointer, + _$function1.pointer, + _$function11.pointer) + .reference); + } + + static final _id_new$1 = _class.constructorId( + r'(Landroid/content/Context;Lio/sentry/transport/ICurrentDateProvider;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;ILkotlin/jvm/internal/DefaultConstructorMarker;)V', + ); + + static final _new$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer + )>)>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + int, + jni$_.Pointer)>(); + + /// from: `synthetic public void (android.content.Context context, io.sentry.transport.ICurrentDateProvider iCurrentDateProvider, kotlin.jvm.functions.Function0 function0, kotlin.jvm.functions.Function1 function1, kotlin.jvm.functions.Function1 function11, int i, kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker)` + /// The returned object must be released after use, by calling the [release] method. + factory ReplayIntegration.new$1( + jni$_.JObject? context, + jni$_.JObject? iCurrentDateProvider, + jni$_.JObject? function0, + jni$_.JObject? function1, + jni$_.JObject? function11, + int i, + jni$_.JObject? defaultConstructorMarker, + ) { + final _$context = context?.reference ?? jni$_.jNullReference; + final _$iCurrentDateProvider = + iCurrentDateProvider?.reference ?? jni$_.jNullReference; + final _$function0 = function0?.reference ?? jni$_.jNullReference; + final _$function1 = function1?.reference ?? jni$_.jNullReference; + final _$function11 = function11?.reference ?? jni$_.jNullReference; + final _$defaultConstructorMarker = + defaultConstructorMarker?.reference ?? jni$_.jNullReference; + return ReplayIntegration.fromReference(_new$1( + _class.reference.pointer, + _id_new$1 as jni$_.JMethodIDPtr, + _$context.pointer, + _$iCurrentDateProvider.pointer, + _$function0.pointer, + _$function1.pointer, + _$function11.pointer, + i, + _$defaultConstructorMarker.pointer) + .reference); + } + + static final _id_new$2 = _class.constructorId( + r'(Landroid/content/Context;Lio/sentry/transport/ICurrentDateProvider;)V', + ); + + static final _new$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public void (android.content.Context context, io.sentry.transport.ICurrentDateProvider iCurrentDateProvider)` + /// The returned object must be released after use, by calling the [release] method. + factory ReplayIntegration.new$2( + jni$_.JObject context, + jni$_.JObject iCurrentDateProvider, + ) { + final _$context = context.reference; + final _$iCurrentDateProvider = iCurrentDateProvider.reference; + return ReplayIntegration.fromReference(_new$2( + _class.reference.pointer, + _id_new$2 as jni$_.JMethodIDPtr, + _$context.pointer, + _$iCurrentDateProvider.pointer) + .reference); + } + + static final _id_new$3 = _class.constructorId( + r'(Landroid/content/Context;Lio/sentry/transport/ICurrentDateProvider;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lio/sentry/android/replay/util/MainLooperHandler;Lkotlin/jvm/functions/Function0;)V', + ); + + static final _new$3 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public void (android.content.Context context, io.sentry.transport.ICurrentDateProvider iCurrentDateProvider, kotlin.jvm.functions.Function0 function0, kotlin.jvm.functions.Function1 function1, kotlin.jvm.functions.Function1 function11, kotlin.jvm.functions.Function1 function12, io.sentry.android.replay.util.MainLooperHandler mainLooperHandler, kotlin.jvm.functions.Function0 function01)` + /// The returned object must be released after use, by calling the [release] method. + factory ReplayIntegration.new$3( + jni$_.JObject context, + jni$_.JObject iCurrentDateProvider, + jni$_.JObject? function0, + jni$_.JObject? function1, + jni$_.JObject? function11, + jni$_.JObject? function12, + jni$_.JObject? mainLooperHandler, + jni$_.JObject? function01, + ) { + final _$context = context.reference; + final _$iCurrentDateProvider = iCurrentDateProvider.reference; + final _$function0 = function0?.reference ?? jni$_.jNullReference; + final _$function1 = function1?.reference ?? jni$_.jNullReference; + final _$function11 = function11?.reference ?? jni$_.jNullReference; + final _$function12 = function12?.reference ?? jni$_.jNullReference; + final _$mainLooperHandler = + mainLooperHandler?.reference ?? jni$_.jNullReference; + final _$function01 = function01?.reference ?? jni$_.jNullReference; + return ReplayIntegration.fromReference(_new$3( + _class.reference.pointer, + _id_new$3 as jni$_.JMethodIDPtr, + _$context.pointer, + _$iCurrentDateProvider.pointer, + _$function0.pointer, + _$function1.pointer, + _$function11.pointer, + _$function12.pointer, + _$mainLooperHandler.pointer, + _$function01.pointer) + .reference); + } + + static final _id_new$4 = _class.constructorId( + r'(Landroid/content/Context;Lio/sentry/transport/ICurrentDateProvider;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lio/sentry/android/replay/util/MainLooperHandler;Lkotlin/jvm/functions/Function0;ILkotlin/jvm/internal/DefaultConstructorMarker;)V', + ); + + static final _new$4 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer + )>)>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer, + int, + jni$_.Pointer)>(); + + /// from: `synthetic public void (android.content.Context context, io.sentry.transport.ICurrentDateProvider iCurrentDateProvider, kotlin.jvm.functions.Function0 function0, kotlin.jvm.functions.Function1 function1, kotlin.jvm.functions.Function1 function11, kotlin.jvm.functions.Function1 function12, io.sentry.android.replay.util.MainLooperHandler mainLooperHandler, kotlin.jvm.functions.Function0 function01, int i, kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker)` + /// The returned object must be released after use, by calling the [release] method. + factory ReplayIntegration.new$4( + jni$_.JObject? context, + jni$_.JObject? iCurrentDateProvider, + jni$_.JObject? function0, + jni$_.JObject? function1, + jni$_.JObject? function11, + jni$_.JObject? function12, + jni$_.JObject? mainLooperHandler, + jni$_.JObject? function01, + int i, + jni$_.JObject? defaultConstructorMarker, + ) { + final _$context = context?.reference ?? jni$_.jNullReference; + final _$iCurrentDateProvider = + iCurrentDateProvider?.reference ?? jni$_.jNullReference; + final _$function0 = function0?.reference ?? jni$_.jNullReference; + final _$function1 = function1?.reference ?? jni$_.jNullReference; + final _$function11 = function11?.reference ?? jni$_.jNullReference; + final _$function12 = function12?.reference ?? jni$_.jNullReference; + final _$mainLooperHandler = + mainLooperHandler?.reference ?? jni$_.jNullReference; + final _$function01 = function01?.reference ?? jni$_.jNullReference; + final _$defaultConstructorMarker = + defaultConstructorMarker?.reference ?? jni$_.jNullReference; + return ReplayIntegration.fromReference(_new$4( + _class.reference.pointer, + _id_new$4 as jni$_.JMethodIDPtr, + _$context.pointer, + _$iCurrentDateProvider.pointer, + _$function0.pointer, + _$function1.pointer, + _$function11.pointer, + _$function12.pointer, + _$mainLooperHandler.pointer, + _$function01.pointer, + i, + _$defaultConstructorMarker.pointer) + .reference); + } + + static final _id_getReplayCacheDir = _class.instanceMethodId( + r'getReplayCacheDir', + r'()Ljava/io/File;', + ); + + static final _getReplayCacheDir = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final java.io.File getReplayCacheDir()` + /// The returned object must be released after use, by calling the [release] method. + File? getReplayCacheDir() { + return _getReplayCacheDir( + reference.pointer, _id_getReplayCacheDir as jni$_.JMethodIDPtr) + .object(const $File$NullableType()); + } + + static final _id_register = _class.instanceMethodId( + r'register', + r'(Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V', + ); + + static final _register = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public void register(io.sentry.IScopes iScopes, io.sentry.SentryOptions sentryOptions)` + void register( + jni$_.JObject iScopes, + jni$_.JObject sentryOptions, + ) { + final _$iScopes = iScopes.reference; + final _$sentryOptions = sentryOptions.reference; + _register(reference.pointer, _id_register as jni$_.JMethodIDPtr, + _$iScopes.pointer, _$sentryOptions.pointer) + .check(); + } + + static final _id_isRecording = _class.instanceMethodId( + r'isRecording', + r'()Z', + ); + + static final _isRecording = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public boolean isRecording()` + bool isRecording() { + return _isRecording( + reference.pointer, _id_isRecording as jni$_.JMethodIDPtr) + .boolean; + } + + static final _id_start = _class.instanceMethodId( + r'start', + r'()V', + ); + + static final _start = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public void start()` + void start() { + _start(reference.pointer, _id_start as jni$_.JMethodIDPtr).check(); + } + + static final _id_resume = _class.instanceMethodId( + r'resume', + r'()V', + ); + + static final _resume = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public void resume()` + void resume() { + _resume(reference.pointer, _id_resume as jni$_.JMethodIDPtr).check(); + } + + static final _id_captureReplay = _class.instanceMethodId( + r'captureReplay', + r'(Ljava/lang/Boolean;)V', + ); + + static final _captureReplay = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public void captureReplay(java.lang.Boolean boolean)` + void captureReplay( + jni$_.JBoolean? boolean, + ) { + final _$boolean = boolean?.reference ?? jni$_.jNullReference; + _captureReplay(reference.pointer, _id_captureReplay as jni$_.JMethodIDPtr, + _$boolean.pointer) + .check(); + } + + static final _id_getReplayId = _class.instanceMethodId( + r'getReplayId', + r'()Lio/sentry/protocol/SentryId;', + ); + + static final _getReplayId = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public io.sentry.protocol.SentryId getReplayId()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject getReplayId() { + return _getReplayId( + reference.pointer, _id_getReplayId as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectType()); + } + + static final _id_setBreadcrumbConverter = _class.instanceMethodId( + r'setBreadcrumbConverter', + r'(Lio/sentry/ReplayBreadcrumbConverter;)V', + ); + + static final _setBreadcrumbConverter = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public void setBreadcrumbConverter(io.sentry.ReplayBreadcrumbConverter replayBreadcrumbConverter)` + void setBreadcrumbConverter( + jni$_.JObject replayBreadcrumbConverter, + ) { + final _$replayBreadcrumbConverter = replayBreadcrumbConverter.reference; + _setBreadcrumbConverter( + reference.pointer, + _id_setBreadcrumbConverter as jni$_.JMethodIDPtr, + _$replayBreadcrumbConverter.pointer) + .check(); + } + + static final _id_getBreadcrumbConverter = _class.instanceMethodId( + r'getBreadcrumbConverter', + r'()Lio/sentry/ReplayBreadcrumbConverter;', + ); + + static final _getBreadcrumbConverter = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public io.sentry.ReplayBreadcrumbConverter getBreadcrumbConverter()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject getBreadcrumbConverter() { + return _getBreadcrumbConverter( + reference.pointer, _id_getBreadcrumbConverter as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectType()); + } + + static final _id_pause = _class.instanceMethodId( + r'pause', + r'()V', + ); + + static final _pause = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public void pause()` + void pause() { + _pause(reference.pointer, _id_pause as jni$_.JMethodIDPtr).check(); + } + + static final _id_stop = _class.instanceMethodId( + r'stop', + r'()V', + ); + + static final _stop = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public void stop()` + void stop() { + _stop(reference.pointer, _id_stop as jni$_.JMethodIDPtr).check(); + } + + static final _id_onScreenshotRecorded = _class.instanceMethodId( + r'onScreenshotRecorded', + r'(Landroid/graphics/Bitmap;)V', + ); + + static final _onScreenshotRecorded = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public void onScreenshotRecorded(android.graphics.Bitmap bitmap)` + void onScreenshotRecorded( + jni$_.JObject bitmap, + ) { + final _$bitmap = bitmap.reference; + _onScreenshotRecorded(reference.pointer, + _id_onScreenshotRecorded as jni$_.JMethodIDPtr, _$bitmap.pointer) + .check(); + } + + static final _id_onScreenshotRecorded$1 = _class.instanceMethodId( + r'onScreenshotRecorded', + r'(Ljava/io/File;J)V', + ); + + static final _onScreenshotRecorded$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Pointer, jni$_.Int64)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int)>(); + + /// from: `public void onScreenshotRecorded(java.io.File file, long j)` + void onScreenshotRecorded$1( + File file, + int j, + ) { + final _$file = file.reference; + _onScreenshotRecorded$1(reference.pointer, + _id_onScreenshotRecorded$1 as jni$_.JMethodIDPtr, _$file.pointer, j) + .check(); + } + + static final _id_close = _class.instanceMethodId( + r'close', + r'()V', + ); + + static final _close = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public void close()` + void close() { + _close(reference.pointer, _id_close as jni$_.JMethodIDPtr).check(); + } + + static final _id_onConfigurationChanged = _class.instanceMethodId( + r'onConfigurationChanged', + r'(Landroid/content/res/Configuration;)V', + ); + + static final _onConfigurationChanged = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public void onConfigurationChanged(android.content.res.Configuration configuration)` + void onConfigurationChanged( + jni$_.JObject configuration, + ) { + final _$configuration = configuration.reference; + _onConfigurationChanged( + reference.pointer, + _id_onConfigurationChanged as jni$_.JMethodIDPtr, + _$configuration.pointer) + .check(); + } + + static final _id_onConnectionStatusChanged = _class.instanceMethodId( + r'onConnectionStatusChanged', + r'(Lio/sentry/IConnectionStatusProvider$ConnectionStatus;)V', + ); + + static final _onConnectionStatusChanged = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public void onConnectionStatusChanged(io.sentry.IConnectionStatusProvider$ConnectionStatus connectionStatus)` + void onConnectionStatusChanged( + jni$_.JObject connectionStatus, + ) { + final _$connectionStatus = connectionStatus.reference; + _onConnectionStatusChanged( + reference.pointer, + _id_onConnectionStatusChanged as jni$_.JMethodIDPtr, + _$connectionStatus.pointer) + .check(); + } + + static final _id_onRateLimitChanged = _class.instanceMethodId( + r'onRateLimitChanged', + r'(Lio/sentry/transport/RateLimiter;)V', + ); + + static final _onRateLimitChanged = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public void onRateLimitChanged(io.sentry.transport.RateLimiter rateLimiter)` + void onRateLimitChanged( + jni$_.JObject rateLimiter, + ) { + final _$rateLimiter = rateLimiter.reference; + _onRateLimitChanged(reference.pointer, + _id_onRateLimitChanged as jni$_.JMethodIDPtr, _$rateLimiter.pointer) + .check(); + } + + static final _id_onLowMemory = _class.instanceMethodId( + r'onLowMemory', + r'()V', + ); + + static final _onLowMemory = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public void onLowMemory()` + void onLowMemory() { + _onLowMemory(reference.pointer, _id_onLowMemory as jni$_.JMethodIDPtr) + .check(); + } + + static final _id_onTouchEvent = _class.instanceMethodId( + r'onTouchEvent', + r'(Landroid/view/MotionEvent;)V', + ); + + static final _onTouchEvent = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public void onTouchEvent(android.view.MotionEvent motionEvent)` + void onTouchEvent( + jni$_.JObject motionEvent, + ) { + final _$motionEvent = motionEvent.reference; + _onTouchEvent(reference.pointer, _id_onTouchEvent as jni$_.JMethodIDPtr, + _$motionEvent.pointer) + .check(); + } +} + +final class $ReplayIntegration$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $ReplayIntegration$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'Lio/sentry/android/replay/ReplayIntegration;'; + + @jni$_.internal + @core$_.override + ReplayIntegration? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : ReplayIntegration.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($ReplayIntegration$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($ReplayIntegration$NullableType) && + other is $ReplayIntegration$NullableType; + } +} + +final class $ReplayIntegration$Type extends jni$_.JObjType { + @jni$_.internal + const $ReplayIntegration$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Lio/sentry/android/replay/ReplayIntegration;'; + + @jni$_.internal + @core$_.override + ReplayIntegration fromReference(jni$_.JReference reference) => + ReplayIntegration.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $ReplayIntegration$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($ReplayIntegration$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($ReplayIntegration$Type) && + other is $ReplayIntegration$Type; + } +} + +/// from: `io.sentry.flutter.SentryFlutterPlugin$Companion` +class SentryFlutterPlugin$Companion extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + SentryFlutterPlugin$Companion.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + jni$_.JClass.forName(r'io/sentry/flutter/SentryFlutterPlugin$Companion'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $SentryFlutterPlugin$Companion$NullableType(); + static const type = $SentryFlutterPlugin$Companion$Type(); + static final _id_privateSentryGetReplayIntegration = _class.instanceMethodId( + r'privateSentryGetReplayIntegration', + r'()Lio/sentry/android/replay/ReplayIntegration;', + ); + + static final _privateSentryGetReplayIntegration = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public final io.sentry.android.replay.ReplayIntegration privateSentryGetReplayIntegration()` + /// The returned object must be released after use, by calling the [release] method. + ReplayIntegration? privateSentryGetReplayIntegration() { + return _privateSentryGetReplayIntegration(reference.pointer, + _id_privateSentryGetReplayIntegration as jni$_.JMethodIDPtr) + .object(const $ReplayIntegration$NullableType()); + } + + static final _id_new$ = _class.constructorId( + r'(Lkotlin/jvm/internal/DefaultConstructorMarker;)V', + ); + + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `synthetic public void (kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker)` + /// The returned object must be released after use, by calling the [release] method. + factory SentryFlutterPlugin$Companion( + jni$_.JObject? defaultConstructorMarker, + ) { + final _$defaultConstructorMarker = + defaultConstructorMarker?.reference ?? jni$_.jNullReference; + return SentryFlutterPlugin$Companion.fromReference(_new$( + _class.reference.pointer, + _id_new$ as jni$_.JMethodIDPtr, + _$defaultConstructorMarker.pointer) + .reference); + } +} + +final class $SentryFlutterPlugin$Companion$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $SentryFlutterPlugin$Companion$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'Lio/sentry/flutter/SentryFlutterPlugin$Companion;'; + + @jni$_.internal + @core$_.override + SentryFlutterPlugin$Companion? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : SentryFlutterPlugin$Companion.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($SentryFlutterPlugin$Companion$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($SentryFlutterPlugin$Companion$NullableType) && + other is $SentryFlutterPlugin$Companion$NullableType; + } +} + +final class $SentryFlutterPlugin$Companion$Type + extends jni$_.JObjType { + @jni$_.internal + const $SentryFlutterPlugin$Companion$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Lio/sentry/flutter/SentryFlutterPlugin$Companion;'; + + @jni$_.internal + @core$_.override + SentryFlutterPlugin$Companion fromReference(jni$_.JReference reference) => + SentryFlutterPlugin$Companion.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $SentryFlutterPlugin$Companion$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($SentryFlutterPlugin$Companion$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($SentryFlutterPlugin$Companion$Type) && + other is $SentryFlutterPlugin$Companion$Type; + } +} + +/// from: `io.sentry.flutter.SentryFlutterPlugin` +class SentryFlutterPlugin extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + SentryFlutterPlugin.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = + jni$_.JClass.forName(r'io/sentry/flutter/SentryFlutterPlugin'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $SentryFlutterPlugin$NullableType(); + static const type = $SentryFlutterPlugin$Type(); + static final _id_Companion = _class.staticFieldId( + r'Companion', + r'Lio/sentry/flutter/SentryFlutterPlugin$Companion;', + ); + + /// from: `static public final io.sentry.flutter.SentryFlutterPlugin$Companion Companion` + /// The returned object must be released after use, by calling the [release] method. + static SentryFlutterPlugin$Companion get Companion => + _id_Companion.get(_class, const $SentryFlutterPlugin$Companion$Type()); + + static final _id_new$ = _class.constructorId( + r'()V', + ); + + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public void ()` + /// The returned object must be released after use, by calling the [release] method. + factory SentryFlutterPlugin() { + return SentryFlutterPlugin.fromReference( + _new$(_class.reference.pointer, _id_new$ as jni$_.JMethodIDPtr) + .reference); + } + + static final _id_onAttachedToEngine = _class.instanceMethodId( + r'onAttachedToEngine', + r'(Lio/flutter/embedding/engine/plugins/FlutterPlugin$FlutterPluginBinding;)V', + ); + + static final _onAttachedToEngine = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public void onAttachedToEngine(io.flutter.embedding.engine.plugins.FlutterPlugin$FlutterPluginBinding flutterPluginBinding)` + void onAttachedToEngine( + jni$_.JObject flutterPluginBinding, + ) { + final _$flutterPluginBinding = flutterPluginBinding.reference; + _onAttachedToEngine( + reference.pointer, + _id_onAttachedToEngine as jni$_.JMethodIDPtr, + _$flutterPluginBinding.pointer) + .check(); + } + + static final _id_onMethodCall = _class.instanceMethodId( + r'onMethodCall', + r'(Lio/flutter/plugin/common/MethodCall;Lio/flutter/plugin/common/MethodChannel$Result;)V', + ); + + static final _onMethodCall = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public void onMethodCall(io.flutter.plugin.common.MethodCall methodCall, io.flutter.plugin.common.MethodChannel$Result result)` + void onMethodCall( + jni$_.JObject methodCall, + jni$_.JObject result, + ) { + final _$methodCall = methodCall.reference; + final _$result = result.reference; + _onMethodCall(reference.pointer, _id_onMethodCall as jni$_.JMethodIDPtr, + _$methodCall.pointer, _$result.pointer) + .check(); + } + + static final _id_onDetachedFromEngine = _class.instanceMethodId( + r'onDetachedFromEngine', + r'(Lio/flutter/embedding/engine/plugins/FlutterPlugin$FlutterPluginBinding;)V', + ); + + static final _onDetachedFromEngine = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public void onDetachedFromEngine(io.flutter.embedding.engine.plugins.FlutterPlugin$FlutterPluginBinding flutterPluginBinding)` + void onDetachedFromEngine( + jni$_.JObject flutterPluginBinding, + ) { + final _$flutterPluginBinding = flutterPluginBinding.reference; + _onDetachedFromEngine( + reference.pointer, + _id_onDetachedFromEngine as jni$_.JMethodIDPtr, + _$flutterPluginBinding.pointer) + .check(); + } + + static final _id_onAttachedToActivity = _class.instanceMethodId( + r'onAttachedToActivity', + r'(Lio/flutter/embedding/engine/plugins/activity/ActivityPluginBinding;)V', + ); + + static final _onAttachedToActivity = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public void onAttachedToActivity(io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding activityPluginBinding)` + void onAttachedToActivity( + jni$_.JObject activityPluginBinding, + ) { + final _$activityPluginBinding = activityPluginBinding.reference; + _onAttachedToActivity( + reference.pointer, + _id_onAttachedToActivity as jni$_.JMethodIDPtr, + _$activityPluginBinding.pointer) + .check(); + } + + static final _id_onDetachedFromActivity = _class.instanceMethodId( + r'onDetachedFromActivity', + r'()V', + ); + + static final _onDetachedFromActivity = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public void onDetachedFromActivity()` + void onDetachedFromActivity() { + _onDetachedFromActivity( + reference.pointer, _id_onDetachedFromActivity as jni$_.JMethodIDPtr) + .check(); + } + + static final _id_onReattachedToActivityForConfigChanges = + _class.instanceMethodId( + r'onReattachedToActivityForConfigChanges', + r'(Lio/flutter/embedding/engine/plugins/activity/ActivityPluginBinding;)V', + ); + + static final _onReattachedToActivityForConfigChanges = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public void onReattachedToActivityForConfigChanges(io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding activityPluginBinding)` + void onReattachedToActivityForConfigChanges( + jni$_.JObject activityPluginBinding, + ) { + final _$activityPluginBinding = activityPluginBinding.reference; + _onReattachedToActivityForConfigChanges( + reference.pointer, + _id_onReattachedToActivityForConfigChanges as jni$_.JMethodIDPtr, + _$activityPluginBinding.pointer) + .check(); + } + + static final _id_onDetachedFromActivityForConfigChanges = + _class.instanceMethodId( + r'onDetachedFromActivityForConfigChanges', + r'()V', + ); + + static final _onDetachedFromActivityForConfigChanges = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public void onDetachedFromActivityForConfigChanges()` + void onDetachedFromActivityForConfigChanges() { + _onDetachedFromActivityForConfigChanges(reference.pointer, + _id_onDetachedFromActivityForConfigChanges as jni$_.JMethodIDPtr) + .check(); + } + + static final _id_privateSentryGetReplayIntegration = _class.staticMethodId( + r'privateSentryGetReplayIntegration', + r'()Lio/sentry/android/replay/ReplayIntegration;', + ); + + static final _privateSentryGetReplayIntegration = + jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `static public final io.sentry.android.replay.ReplayIntegration privateSentryGetReplayIntegration()` + /// The returned object must be released after use, by calling the [release] method. + static ReplayIntegration? privateSentryGetReplayIntegration() { + return _privateSentryGetReplayIntegration(_class.reference.pointer, + _id_privateSentryGetReplayIntegration as jni$_.JMethodIDPtr) + .object(const $ReplayIntegration$NullableType()); + } +} + +final class $SentryFlutterPlugin$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $SentryFlutterPlugin$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'Lio/sentry/flutter/SentryFlutterPlugin;'; + + @jni$_.internal + @core$_.override + SentryFlutterPlugin? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : SentryFlutterPlugin.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($SentryFlutterPlugin$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($SentryFlutterPlugin$NullableType) && + other is $SentryFlutterPlugin$NullableType; + } +} + +final class $SentryFlutterPlugin$Type + extends jni$_.JObjType { + @jni$_.internal + const $SentryFlutterPlugin$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Lio/sentry/flutter/SentryFlutterPlugin;'; + + @jni$_.internal + @core$_.override + SentryFlutterPlugin fromReference(jni$_.JReference reference) => + SentryFlutterPlugin.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $SentryFlutterPlugin$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($SentryFlutterPlugin$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($SentryFlutterPlugin$Type) && + other is $SentryFlutterPlugin$Type; + } +} + +/// from: `java.io.File` +class File extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + File.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = jni$_.JClass.forName(r'java/io/File'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $File$NullableType(); + static const type = $File$Type(); + static final _id_pathSeparator = _class.staticFieldId( + r'pathSeparator', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String pathSeparator` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get pathSeparator => + _id_pathSeparator.get(_class, const jni$_.JStringNullableType()); + + static final _id_pathSeparatorChar = _class.staticFieldId( + r'pathSeparatorChar', + r'C', + ); + + /// from: `static public final char pathSeparatorChar` + static int get pathSeparatorChar => + _id_pathSeparatorChar.get(_class, const jni$_.jcharType()); + + static final _id_separator = _class.staticFieldId( + r'separator', + r'Ljava/lang/String;', + ); + + /// from: `static public final java.lang.String separator` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JString? get separator => + _id_separator.get(_class, const jni$_.JStringNullableType()); + + static final _id_separatorChar = _class.staticFieldId( + r'separatorChar', + r'C', + ); + + /// from: `static public final char separatorChar` + static int get separatorChar => + _id_separatorChar.get(_class, const jni$_.jcharType()); + + static final _id_new$ = _class.constructorId( + r'(Ljava/lang/String;)V', + ); + + static final _new$ = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public void (java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + factory File( + jni$_.JString? string, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + return File.fromReference(_new$(_class.reference.pointer, + _id_new$ as jni$_.JMethodIDPtr, _$string.pointer) + .reference); + } + + static final _id_new$1 = _class.constructorId( + r'(Ljava/lang/String;Ljava/lang/String;)V', + ); + + static final _new$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public void (java.lang.String string, java.lang.String string1)` + /// The returned object must be released after use, by calling the [release] method. + factory File.new$1( + jni$_.JString? string, + jni$_.JString? string1, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + final _$string1 = string1?.reference ?? jni$_.jNullReference; + return File.fromReference(_new$1( + _class.reference.pointer, + _id_new$1 as jni$_.JMethodIDPtr, + _$string.pointer, + _$string1.pointer) + .reference); + } + + static final _id_new$2 = _class.constructorId( + r'(Ljava/io/File;Ljava/lang/String;)V', + ); + + static final _new$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `public void (java.io.File file, java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + factory File.new$2( + File? file, + jni$_.JString? string, + ) { + final _$file = file?.reference ?? jni$_.jNullReference; + final _$string = string?.reference ?? jni$_.jNullReference; + return File.fromReference(_new$2(_class.reference.pointer, + _id_new$2 as jni$_.JMethodIDPtr, _$file.pointer, _$string.pointer) + .reference); + } + + static final _id_new$3 = _class.constructorId( + r'(Ljava/net/URI;)V', + ); + + static final _new$3 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_NewObject') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public void (java.net.URI uRI)` + /// The returned object must be released after use, by calling the [release] method. + factory File.new$3( + jni$_.JObject? uRI, + ) { + final _$uRI = uRI?.reference ?? jni$_.jNullReference; + return File.fromReference(_new$3(_class.reference.pointer, + _id_new$3 as jni$_.JMethodIDPtr, _$uRI.pointer) + .reference); + } + + static final _id_getName = _class.instanceMethodId( + r'getName', + r'()Ljava/lang/String;', + ); + + static final _getName = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String getName()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? getName() { + return _getName(reference.pointer, _id_getName as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); + } + + static final _id_getParent = _class.instanceMethodId( + r'getParent', + r'()Ljava/lang/String;', + ); + + static final _getParent = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String getParent()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? getParent() { + return _getParent(reference.pointer, _id_getParent as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); + } + + static final _id_getParentFile = _class.instanceMethodId( + r'getParentFile', + r'()Ljava/io/File;', + ); + + static final _getParentFile = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.io.File getParentFile()` + /// The returned object must be released after use, by calling the [release] method. + File? getParentFile() { + return _getParentFile( + reference.pointer, _id_getParentFile as jni$_.JMethodIDPtr) + .object(const $File$NullableType()); + } + + static final _id_getPath = _class.instanceMethodId( + r'getPath', + r'()Ljava/lang/String;', + ); + + static final _getPath = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String getPath()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? getPath() { + return _getPath(reference.pointer, _id_getPath as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); + } + + static final _id_isAbsolute = _class.instanceMethodId( + r'isAbsolute', + r'()Z', + ); + + static final _isAbsolute = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public boolean isAbsolute()` + bool isAbsolute() { + return _isAbsolute(reference.pointer, _id_isAbsolute as jni$_.JMethodIDPtr) + .boolean; + } + + static final _id_getAbsolutePath = _class.instanceMethodId( + r'getAbsolutePath', + r'()Ljava/lang/String;', + ); + + static final _getAbsolutePath = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String getAbsolutePath()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? getAbsolutePath() { + return _getAbsolutePath( + reference.pointer, _id_getAbsolutePath as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); + } + + static final _id_getAbsoluteFile = _class.instanceMethodId( + r'getAbsoluteFile', + r'()Ljava/io/File;', + ); + + static final _getAbsoluteFile = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.io.File getAbsoluteFile()` + /// The returned object must be released after use, by calling the [release] method. + File? getAbsoluteFile() { + return _getAbsoluteFile( + reference.pointer, _id_getAbsoluteFile as jni$_.JMethodIDPtr) + .object(const $File$NullableType()); + } + + static final _id_getCanonicalPath = _class.instanceMethodId( + r'getCanonicalPath', + r'()Ljava/lang/String;', + ); + + static final _getCanonicalPath = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String getCanonicalPath()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? getCanonicalPath() { + return _getCanonicalPath( + reference.pointer, _id_getCanonicalPath as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); + } + + static final _id_getCanonicalFile = _class.instanceMethodId( + r'getCanonicalFile', + r'()Ljava/io/File;', + ); + + static final _getCanonicalFile = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.io.File getCanonicalFile()` + /// The returned object must be released after use, by calling the [release] method. + File? getCanonicalFile() { + return _getCanonicalFile( + reference.pointer, _id_getCanonicalFile as jni$_.JMethodIDPtr) + .object(const $File$NullableType()); + } + + static final _id_toURL = _class.instanceMethodId( + r'toURL', + r'()Ljava/net/URL;', + ); + + static final _toURL = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.net.URL toURL()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? toURL() { + return _toURL(reference.pointer, _id_toURL as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); + } + + static final _id_toURI = _class.instanceMethodId( + r'toURI', + r'()Ljava/net/URI;', + ); + + static final _toURI = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.net.URI toURI()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? toURI() { + return _toURI(reference.pointer, _id_toURI as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); + } + + static final _id_canRead = _class.instanceMethodId( + r'canRead', + r'()Z', + ); + + static final _canRead = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public boolean canRead()` + bool canRead() { + return _canRead(reference.pointer, _id_canRead as jni$_.JMethodIDPtr) + .boolean; + } + + static final _id_canWrite = _class.instanceMethodId( + r'canWrite', + r'()Z', + ); + + static final _canWrite = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public boolean canWrite()` + bool canWrite() { + return _canWrite(reference.pointer, _id_canWrite as jni$_.JMethodIDPtr) + .boolean; + } + + static final _id_exists = _class.instanceMethodId( + r'exists', + r'()Z', + ); + + static final _exists = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public boolean exists()` + bool exists() { + return _exists(reference.pointer, _id_exists as jni$_.JMethodIDPtr).boolean; + } + + static final _id_isDirectory = _class.instanceMethodId( + r'isDirectory', + r'()Z', + ); + + static final _isDirectory = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public boolean isDirectory()` + bool isDirectory() { + return _isDirectory( + reference.pointer, _id_isDirectory as jni$_.JMethodIDPtr) + .boolean; + } + + static final _id_isFile = _class.instanceMethodId( + r'isFile', + r'()Z', + ); + + static final _isFile = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public boolean isFile()` + bool isFile() { + return _isFile(reference.pointer, _id_isFile as jni$_.JMethodIDPtr).boolean; + } + + static final _id_isHidden = _class.instanceMethodId( + r'isHidden', + r'()Z', + ); + + static final _isHidden = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public boolean isHidden()` + bool isHidden() { + return _isHidden(reference.pointer, _id_isHidden as jni$_.JMethodIDPtr) + .boolean; + } + + static final _id_lastModified = _class.instanceMethodId( + r'lastModified', + r'()J', + ); + + static final _lastModified = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public long lastModified()` + int lastModified() { + return _lastModified( + reference.pointer, _id_lastModified as jni$_.JMethodIDPtr) + .long; + } + + static final _id_length = _class.instanceMethodId( + r'length', + r'()J', + ); + + static final _length = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public long length()` + int length() { + return _length(reference.pointer, _id_length as jni$_.JMethodIDPtr).long; + } + + static final _id_createNewFile = _class.instanceMethodId( + r'createNewFile', + r'()Z', + ); + + static final _createNewFile = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public boolean createNewFile()` + bool createNewFile() { + return _createNewFile( + reference.pointer, _id_createNewFile as jni$_.JMethodIDPtr) + .boolean; + } + + static final _id_delete = _class.instanceMethodId( + r'delete', + r'()Z', + ); + + static final _delete = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public boolean delete()` + bool delete() { + return _delete(reference.pointer, _id_delete as jni$_.JMethodIDPtr).boolean; + } + + static final _id_deleteOnExit = _class.instanceMethodId( + r'deleteOnExit', + r'()V', + ); + + static final _deleteOnExit = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public void deleteOnExit()` + void deleteOnExit() { + _deleteOnExit(reference.pointer, _id_deleteOnExit as jni$_.JMethodIDPtr) + .check(); + } + + static final _id_list = _class.instanceMethodId( + r'list', + r'()[Ljava/lang/String;', + ); + + static final _list = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String[] list()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JArray? list() { + return _list(reference.pointer, _id_list as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JArrayNullableType( + jni$_.JStringNullableType())); + } + + static final _id_list$1 = _class.instanceMethodId( + r'list', + r'(Ljava/io/FilenameFilter;)[Ljava/lang/String;', + ); + + static final _list$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public java.lang.String[] list(java.io.FilenameFilter filenameFilter)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JArray? list$1( + jni$_.JObject? filenameFilter, + ) { + final _$filenameFilter = filenameFilter?.reference ?? jni$_.jNullReference; + return _list$1(reference.pointer, _id_list$1 as jni$_.JMethodIDPtr, + _$filenameFilter.pointer) + .object?>( + const jni$_.JArrayNullableType( + jni$_.JStringNullableType())); + } + + static final _id_listFiles = _class.instanceMethodId( + r'listFiles', + r'()[Ljava/io/File;', + ); + + static final _listFiles = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.io.File[] listFiles()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JArray? listFiles() { + return _listFiles(reference.pointer, _id_listFiles as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JArrayNullableType($File$NullableType())); + } + + static final _id_listFiles$1 = _class.instanceMethodId( + r'listFiles', + r'(Ljava/io/FilenameFilter;)[Ljava/io/File;', + ); + + static final _listFiles$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public java.io.File[] listFiles(java.io.FilenameFilter filenameFilter)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JArray? listFiles$1( + jni$_.JObject? filenameFilter, + ) { + final _$filenameFilter = filenameFilter?.reference ?? jni$_.jNullReference; + return _listFiles$1(reference.pointer, + _id_listFiles$1 as jni$_.JMethodIDPtr, _$filenameFilter.pointer) + .object?>( + const jni$_.JArrayNullableType($File$NullableType())); + } + + static final _id_listFiles$2 = _class.instanceMethodId( + r'listFiles', + r'(Ljava/io/FileFilter;)[Ljava/io/File;', + ); + + static final _listFiles$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public java.io.File[] listFiles(java.io.FileFilter fileFilter)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JArray? listFiles$2( + jni$_.JObject? fileFilter, + ) { + final _$fileFilter = fileFilter?.reference ?? jni$_.jNullReference; + return _listFiles$2(reference.pointer, + _id_listFiles$2 as jni$_.JMethodIDPtr, _$fileFilter.pointer) + .object?>( + const jni$_.JArrayNullableType($File$NullableType())); + } + + static final _id_mkdir = _class.instanceMethodId( + r'mkdir', + r'()Z', + ); + + static final _mkdir = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public boolean mkdir()` + bool mkdir() { + return _mkdir(reference.pointer, _id_mkdir as jni$_.JMethodIDPtr).boolean; + } + + static final _id_mkdirs = _class.instanceMethodId( + r'mkdirs', + r'()Z', + ); + + static final _mkdirs = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public boolean mkdirs()` + bool mkdirs() { + return _mkdirs(reference.pointer, _id_mkdirs as jni$_.JMethodIDPtr).boolean; + } + + static final _id_renameTo = _class.instanceMethodId( + r'renameTo', + r'(Ljava/io/File;)Z', + ); + + static final _renameTo = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public boolean renameTo(java.io.File file)` + bool renameTo( + File? file, + ) { + final _$file = file?.reference ?? jni$_.jNullReference; + return _renameTo(reference.pointer, _id_renameTo as jni$_.JMethodIDPtr, + _$file.pointer) + .boolean; + } + + static final _id_setLastModified = _class.instanceMethodId( + r'setLastModified', + r'(J)Z', + ); + + static final _setLastModified = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Int64,)>)>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public boolean setLastModified(long j)` + bool setLastModified( + int j, + ) { + return _setLastModified( + reference.pointer, _id_setLastModified as jni$_.JMethodIDPtr, j) + .boolean; + } + + static final _id_setReadOnly = _class.instanceMethodId( + r'setReadOnly', + r'()Z', + ); + + static final _setReadOnly = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public boolean setReadOnly()` + bool setReadOnly() { + return _setReadOnly( + reference.pointer, _id_setReadOnly as jni$_.JMethodIDPtr) + .boolean; + } + + static final _id_setWritable = _class.instanceMethodId( + r'setWritable', + r'(ZZ)Z', + ); + + static final _setWritable = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32, jni$_.Int32)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int, int)>(); + + /// from: `public boolean setWritable(boolean z, boolean z1)` + bool setWritable( + bool z, + bool z1, + ) { + return _setWritable(reference.pointer, + _id_setWritable as jni$_.JMethodIDPtr, z ? 1 : 0, z1 ? 1 : 0) + .boolean; + } + + static final _id_setWritable$1 = _class.instanceMethodId( + r'setWritable', + r'(Z)Z', + ); + + static final _setWritable$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public boolean setWritable(boolean z)` + bool setWritable$1( + bool z, + ) { + return _setWritable$1(reference.pointer, + _id_setWritable$1 as jni$_.JMethodIDPtr, z ? 1 : 0) + .boolean; + } + + static final _id_setReadable = _class.instanceMethodId( + r'setReadable', + r'(ZZ)Z', + ); + + static final _setReadable = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32, jni$_.Int32)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int, int)>(); + + /// from: `public boolean setReadable(boolean z, boolean z1)` + bool setReadable( + bool z, + bool z1, + ) { + return _setReadable(reference.pointer, + _id_setReadable as jni$_.JMethodIDPtr, z ? 1 : 0, z1 ? 1 : 0) + .boolean; + } + + static final _id_setReadable$1 = _class.instanceMethodId( + r'setReadable', + r'(Z)Z', + ); + + static final _setReadable$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public boolean setReadable(boolean z)` + bool setReadable$1( + bool z, + ) { + return _setReadable$1(reference.pointer, + _id_setReadable$1 as jni$_.JMethodIDPtr, z ? 1 : 0) + .boolean; + } + + static final _id_setExecutable = _class.instanceMethodId( + r'setExecutable', + r'(ZZ)Z', + ); + + static final _setExecutable = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32, jni$_.Int32)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int, int)>(); + + /// from: `public boolean setExecutable(boolean z, boolean z1)` + bool setExecutable( + bool z, + bool z1, + ) { + return _setExecutable(reference.pointer, + _id_setExecutable as jni$_.JMethodIDPtr, z ? 1 : 0, z1 ? 1 : 0) + .boolean; + } + + static final _id_setExecutable$1 = _class.instanceMethodId( + r'setExecutable', + r'(Z)Z', + ); + + static final _setExecutable$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public boolean setExecutable(boolean z)` + bool setExecutable$1( + bool z, + ) { + return _setExecutable$1(reference.pointer, + _id_setExecutable$1 as jni$_.JMethodIDPtr, z ? 1 : 0) + .boolean; + } + + static final _id_canExecute = _class.instanceMethodId( + r'canExecute', + r'()Z', + ); + + static final _canExecute = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public boolean canExecute()` + bool canExecute() { + return _canExecute(reference.pointer, _id_canExecute as jni$_.JMethodIDPtr) + .boolean; + } + + static final _id_listRoots = _class.staticMethodId( + r'listRoots', + r'()[Ljava/io/File;', + ); + + static final _listRoots = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `static public java.io.File[] listRoots()` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JArray? listRoots() { + return _listRoots( + _class.reference.pointer, _id_listRoots as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JArrayNullableType($File$NullableType())); + } + + static final _id_getTotalSpace = _class.instanceMethodId( + r'getTotalSpace', + r'()J', + ); + + static final _getTotalSpace = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public long getTotalSpace()` + int getTotalSpace() { + return _getTotalSpace( + reference.pointer, _id_getTotalSpace as jni$_.JMethodIDPtr) + .long; + } + + static final _id_getFreeSpace = _class.instanceMethodId( + r'getFreeSpace', + r'()J', + ); + + static final _getFreeSpace = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public long getFreeSpace()` + int getFreeSpace() { + return _getFreeSpace( + reference.pointer, _id_getFreeSpace as jni$_.JMethodIDPtr) + .long; + } + + static final _id_getUsableSpace = _class.instanceMethodId( + r'getUsableSpace', + r'()J', + ); + + static final _getUsableSpace = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public long getUsableSpace()` + int getUsableSpace() { + return _getUsableSpace( + reference.pointer, _id_getUsableSpace as jni$_.JMethodIDPtr) + .long; + } + + static final _id_createTempFile = _class.staticMethodId( + r'createTempFile', + r'(Ljava/lang/String;Ljava/lang/String;Ljava/io/File;)Ljava/io/File;', + ); + + static final _createTempFile = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `static public java.io.File createTempFile(java.lang.String string, java.lang.String string1, java.io.File file)` + /// The returned object must be released after use, by calling the [release] method. + static File? createTempFile( + jni$_.JString? string, + jni$_.JString? string1, + File? file, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + final _$string1 = string1?.reference ?? jni$_.jNullReference; + final _$file = file?.reference ?? jni$_.jNullReference; + return _createTempFile( + _class.reference.pointer, + _id_createTempFile as jni$_.JMethodIDPtr, + _$string.pointer, + _$string1.pointer, + _$file.pointer) + .object(const $File$NullableType()); + } + + static final _id_createTempFile$1 = _class.staticMethodId( + r'createTempFile', + r'(Ljava/lang/String;Ljava/lang/String;)Ljava/io/File;', + ); + + static final _createTempFile$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `static public java.io.File createTempFile(java.lang.String string, java.lang.String string1)` + /// The returned object must be released after use, by calling the [release] method. + static File? createTempFile$1( + jni$_.JString? string, + jni$_.JString? string1, + ) { + final _$string = string?.reference ?? jni$_.jNullReference; + final _$string1 = string1?.reference ?? jni$_.jNullReference; + return _createTempFile$1( + _class.reference.pointer, + _id_createTempFile$1 as jni$_.JMethodIDPtr, + _$string.pointer, + _$string1.pointer) + .object(const $File$NullableType()); + } + + static final _id_compareTo = _class.instanceMethodId( + r'compareTo', + r'(Ljava/io/File;)I', + ); + + static final _compareTo = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public int compareTo(java.io.File file)` + int compareTo( + File? file, + ) { + final _$file = file?.reference ?? jni$_.jNullReference; + return _compareTo(reference.pointer, _id_compareTo as jni$_.JMethodIDPtr, + _$file.pointer) + .integer; + } + + static final _id_equals = _class.instanceMethodId( + r'equals', + r'(Ljava/lang/Object;)Z', + ); + + static final _equals = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public boolean equals(java.lang.Object object)` + bool equals( + jni$_.JObject? object, + ) { + final _$object = object?.reference ?? jni$_.jNullReference; + return _equals(reference.pointer, _id_equals as jni$_.JMethodIDPtr, + _$object.pointer) + .boolean; + } + + static final _id_hashCode$1 = _class.instanceMethodId( + r'hashCode', + r'()I', + ); + + static final _hashCode$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public int hashCode()` + int hashCode$1() { + return _hashCode$1(reference.pointer, _id_hashCode$1 as jni$_.JMethodIDPtr) + .integer; + } + + static final _id_toString$1 = _class.instanceMethodId( + r'toString', + r'()Ljava/lang/String;', + ); + + static final _toString$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String toString()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JString? toString$1() { + return _toString$1(reference.pointer, _id_toString$1 as jni$_.JMethodIDPtr) + .object(const jni$_.JStringNullableType()); + } + + static final _id_toPath = _class.instanceMethodId( + r'toPath', + r'()Ljava/nio/file/Path;', + ); + + static final _toPath = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public java.nio.file.Path toPath()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? toPath() { + return _toPath(reference.pointer, _id_toPath as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); + } +} + +final class $File$NullableType extends jni$_.JObjType { + @jni$_.internal + const $File$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'Ljava/io/File;'; + + @jni$_.internal + @core$_.override + File? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : File.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($File$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($File$NullableType) && + other is $File$NullableType; + } +} + +final class $File$Type extends jni$_.JObjType { + @jni$_.internal + const $File$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Ljava/io/File;'; + + @jni$_.internal + @core$_.override + File fromReference(jni$_.JReference reference) => File.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => const $File$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($File$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($File$Type) && other is $File$Type; + } +} diff --git a/flutter/lib/src/native/java/sentry_native_java.dart b/flutter/lib/src/native/java/sentry_native_java.dart index 7aa47f2d73..60d537e372 100644 --- a/flutter/lib/src/native/java/sentry_native_java.dart +++ b/flutter/lib/src/native/java/sentry_native_java.dart @@ -4,6 +4,7 @@ import '../../../sentry_flutter.dart'; import '../../replay/scheduled_recorder_config.dart'; import '../sentry_native_channel.dart'; import 'android_replay_recorder.dart'; +import 'binding.dart' as native; @internal class SentryNativeJava extends SentryNativeChannel { @@ -29,8 +30,11 @@ class SentryNativeJava extends SentryNativeChannel { height: (call.arguments['height'] as num).toDouble(), frameRate: call.arguments['frameRate'] as int); - _replayRecorder = AndroidReplayRecorder( - config, options, channel, call.arguments['directory'] as String) + final nativeReplay = native.SentryFlutterPlugin$Companion(null) + .privateSentryGetReplayIntegration()!; + + _replayRecorder = AndroidReplayRecorder(config, options, + nativeReplay, call.arguments['directory'] as String) ..start(); hub.configureScope((s) { diff --git a/flutter/pubspec.yaml b/flutter/pubspec.yaml index d74dd4da63..c3df13d37c 100644 --- a/flutter/pubspec.yaml +++ b/flutter/pubspec.yaml @@ -29,6 +29,7 @@ dependencies: ffi: ^2.0.0 file: '>=6.1.4' collection: ^1.16.0 + jni: 0.14.0 dev_dependencies: build_runner: ^2.4.2 @@ -45,6 +46,7 @@ dev_dependencies: git: url: https://github.com/getsentry/ffigen ref: 6aa2c2642f507eab3df83373189170797a9fa5e7 + jnigen: 0.14.0 flutter: plugin: From 8719ce12c0a8523ea3b6af80861b1c724f33d389 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Thu, 6 Feb 2025 21:17:40 +0100 Subject: [PATCH 02/24] exlude bindings from coverage --- .github/actions/coverage/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/coverage/action.yml b/.github/actions/coverage/action.yml index 793488f143..9b8b53d539 100644 --- a/.github/actions/coverage/action.yml +++ b/.github/actions/coverage/action.yml @@ -33,4 +33,4 @@ runs: with: path: './${{ inputs.directory }}/coverage/lcov.info' min_coverage: ${{ inputs.min-coverage }} - exclude: 'lib/src/native/cocoa/binding.dart' + exclude: 'lib/src/native/**/binding.dart' From 2270862a92708659d0f9ad9dc0501d63aee4c4bc Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Fri, 7 Feb 2025 18:43:42 +0100 Subject: [PATCH 03/24] use jni bitmap --- .../io/sentry/flutter/SentryFlutterPlugin.kt | 18 +- .../flutter/SentryFlutterReplayRecorder.kt | 6 - flutter/ffi-jni.yaml | 2 +- .../native/java/android_replay_recorder.dart | 50 +- flutter/lib/src/native/java/binding.dart | 3002 ++++++++++++----- .../src/native/java/sentry_native_java.dart | 5 +- 6 files changed, 2122 insertions(+), 961 deletions(-) diff --git a/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt b/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt index b97238aa2c..7d3da481a0 100644 --- a/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt +++ b/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt @@ -103,7 +103,6 @@ class SentryFlutterPlugin : "displayRefreshRate" -> displayRefreshRate(result) "nativeCrash" -> crash() "setReplayConfig" -> setReplayConfig(call, result) - "addReplayScreenshot" -> addReplayScreenshot(call.argument("path"), call.argument("timestamp"), result) "captureReplay" -> captureReplay(call.argument("isCrash"), result) else -> result.notImplemented() } @@ -164,10 +163,8 @@ class SentryFlutterPlugin : private fun setupReplay(options: SentryAndroidOptions) { // Replace the default ReplayIntegration with a Flutter-specific recorder. options.integrations.removeAll { it is ReplayIntegration } - val cacheDirPath = options.cacheDirPath val replayOptions = options.sessionReplay - val isReplayEnabled = replayOptions.isSessionReplayEnabled || replayOptions.isSessionReplayForErrorsEnabled - if (cacheDirPath != null && isReplayEnabled) { + if (replayOptions.isSessionReplayEnabled || replayOptions.isSessionReplayForErrorsEnabled) { replay = ReplayIntegration( context.applicationContext, @@ -559,19 +556,6 @@ class SentryFlutterPlugin : result.success(serializedScope) } - private fun addReplayScreenshot( - path: String?, - timestamp: Long?, - result: Result, - ) { - if (path == null || timestamp == null) { - result.error("5", "Arguments are null", null) - return - } - replay!!.onScreenshotRecorded(File(path), timestamp) - result.success("") - } - private fun setReplayConfig( call: MethodCall, result: Result, diff --git a/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterReplayRecorder.kt b/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterReplayRecorder.kt index c49fc23482..fb86ed4440 100644 --- a/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterReplayRecorder.kt +++ b/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterReplayRecorder.kt @@ -19,17 +19,11 @@ internal class SentryFlutterReplayRecorder( return } - val cacheDirPath = integration.replayCacheDir?.absolutePath - if (cacheDirPath == null) { - Log.w("Sentry", "Replay cache directory is null, can't start replay recorder.") - return - } Handler(Looper.getMainLooper()).post { try { channel.invokeMethod( "ReplayRecorder.start", mapOf( - "directory" to cacheDirPath, "width" to recorderConfig.recordingWidth, "height" to recorderConfig.recordingHeight, "frameRate" to recorderConfig.frameRate, diff --git a/flutter/ffi-jni.yaml b/flutter/ffi-jni.yaml index fae6184db2..1e4969aa2a 100644 --- a/flutter/ffi-jni.yaml +++ b/flutter/ffi-jni.yaml @@ -15,4 +15,4 @@ log_level: all classes: - io.sentry.android.replay.ReplayIntegration - io.sentry.flutter.SentryFlutterPlugin - - java.io.File + - android.graphics.Bitmap diff --git a/flutter/lib/src/native/java/android_replay_recorder.dart b/flutter/lib/src/native/java/android_replay_recorder.dart index 61105c0d2e..875994a3c1 100644 --- a/flutter/lib/src/native/java/android_replay_recorder.dart +++ b/flutter/lib/src/native/java/android_replay_recorder.dart @@ -8,32 +8,52 @@ import 'binding.dart' as native; @internal class AndroidReplayRecorder extends ScheduledScreenshotRecorder { - final String _cacheDir; late final native.ReplayIntegration _nativeReplay; - AndroidReplayRecorder( - super.config, super.options, this._nativeReplay, this._cacheDir) { + AndroidReplayRecorder(super.config, super.options, this._nativeReplay) { super.callback = _addReplayScreenshot; } Future _addReplayScreenshot( Screenshot screenshot, bool isNewlyCaptured) async { - final timestamp = screenshot.timestamp.millisecondsSinceEpoch; - final filePath = "$_cacheDir/$timestamp.png"; + // TODO this is currently missing in native onScreenshotRecorded() + // final timestamp = screenshot.timestamp.millisecondsSinceEpoch; try { - final pngData = await screenshot.pngData; + final data = await screenshot.rawRgbaData; options.logger( SentryLevel.debug, - '$logName: saving ${isNewlyCaptured ? 'new' : 'repeated'} screenshot to' - ' $filePath (${screenshot.width}x${screenshot.height} pixels, ' - '${pngData.lengthInBytes} bytes)'); - await options.fileSystem - .file(filePath) - .writeAsBytes(pngData.buffer.asUint8List(), flush: true); - - _nativeReplay.onScreenshotRecorded$1( - native.File(filePath.toJString()), timestamp); + '$logName: captured screenshot (' + '${screenshot.width}x${screenshot.height} pixels, ' + '${data.lengthInBytes} bytes)'); + + using((arena) { + // https://developer.android.com/reference/android/graphics/Bitmap#createBitmap(int,%20int,%20android.graphics.Bitmap.Config) + final jBitmap = native.Bitmap.createBitmap$3( + screenshot.width, + screenshot.height, + native.Bitmap$Config.ARGB_8888, + )?..releasedBy(arena); + if (jBitmap == null) { + options.logger( + SentryLevel.warning, + '$logName: failed to create native Bitmap', + ); + return; + } + + // TODO this uses setAll() which is slow, change to memcpy or ideally use Uint8List directly. + final jBuffer = JByteBuffer.fromList(data.buffer.asUint8List()); + try { + jBitmap.copyPixelsFromBuffer(jBuffer); + } finally { + jBuffer.release(); + } + _nativeReplay.onScreenshotRecorded(jBitmap); + }); + + // _nativeReplay.onScreenshotRecorded$1( + // native.File(filePath.toJString()), timestamp); } catch (error, stackTrace) { options.logger( SentryLevel.error, diff --git a/flutter/lib/src/native/java/binding.dart b/flutter/lib/src/native/java/binding.dart index 301d0b13df..6e61ab5d11 100644 --- a/flutter/lib/src/native/java/binding.dart +++ b/flutter/lib/src/native/java/binding.dart @@ -371,10 +371,10 @@ class ReplayIntegration extends jni$_.JObject { /// from: `public final java.io.File getReplayCacheDir()` /// The returned object must be released after use, by calling the [release] method. - File? getReplayCacheDir() { + jni$_.JObject? getReplayCacheDir() { return _getReplayCacheDir( reference.pointer, _id_getReplayCacheDir as jni$_.JMethodIDPtr) - .object(const $File$NullableType()); + .object(const jni$_.JObjectNullableType()); } static final _id_register = _class.instanceMethodId( @@ -645,7 +645,7 @@ class ReplayIntegration extends jni$_.JObject { /// from: `public void onScreenshotRecorded(android.graphics.Bitmap bitmap)` void onScreenshotRecorded( - jni$_.JObject bitmap, + Bitmap bitmap, ) { final _$bitmap = bitmap.reference; _onScreenshotRecorded(reference.pointer, @@ -672,7 +672,7 @@ class ReplayIntegration extends jni$_.JObject { /// from: `public void onScreenshotRecorded(java.io.File file, long j)` void onScreenshotRecorded$1( - File file, + jni$_.JObject file, int j, ) { final _$file = file.reference; @@ -1416,481 +1416,1610 @@ final class $SentryFlutterPlugin$Type } } -/// from: `java.io.File` -class File extends jni$_.JObject { +/// from: `android.graphics.Bitmap$CompressFormat` +class Bitmap$CompressFormat extends jni$_.JObject { @jni$_.internal @core$_.override - final jni$_.JObjType $type; + final jni$_.JObjType $type; @jni$_.internal - File.fromReference( + Bitmap$CompressFormat.fromReference( jni$_.JReference reference, ) : $type = type, super.fromReference(reference); - static final _class = jni$_.JClass.forName(r'java/io/File'); + static final _class = + jni$_.JClass.forName(r'android/graphics/Bitmap$CompressFormat'); /// The type which includes information such as the signature of this class. - static const nullableType = $File$NullableType(); - static const type = $File$Type(); - static final _id_pathSeparator = _class.staticFieldId( - r'pathSeparator', - r'Ljava/lang/String;', + static const nullableType = $Bitmap$CompressFormat$NullableType(); + static const type = $Bitmap$CompressFormat$Type(); + static final _id_JPEG = _class.staticFieldId( + r'JPEG', + r'Landroid/graphics/Bitmap$CompressFormat;', ); - /// from: `static public final java.lang.String pathSeparator` + /// from: `static public final android.graphics.Bitmap$CompressFormat JPEG` /// The returned object must be released after use, by calling the [release] method. - static jni$_.JString? get pathSeparator => - _id_pathSeparator.get(_class, const jni$_.JStringNullableType()); - - static final _id_pathSeparatorChar = _class.staticFieldId( - r'pathSeparatorChar', - r'C', - ); + static Bitmap$CompressFormat get JPEG => + _id_JPEG.get(_class, const $Bitmap$CompressFormat$Type()); - /// from: `static public final char pathSeparatorChar` - static int get pathSeparatorChar => - _id_pathSeparatorChar.get(_class, const jni$_.jcharType()); - - static final _id_separator = _class.staticFieldId( - r'separator', - r'Ljava/lang/String;', + static final _id_PNG = _class.staticFieldId( + r'PNG', + r'Landroid/graphics/Bitmap$CompressFormat;', ); - /// from: `static public final java.lang.String separator` + /// from: `static public final android.graphics.Bitmap$CompressFormat PNG` /// The returned object must be released after use, by calling the [release] method. - static jni$_.JString? get separator => - _id_separator.get(_class, const jni$_.JStringNullableType()); + static Bitmap$CompressFormat get PNG => + _id_PNG.get(_class, const $Bitmap$CompressFormat$Type()); - static final _id_separatorChar = _class.staticFieldId( - r'separatorChar', - r'C', + static final _id_WEBP = _class.staticFieldId( + r'WEBP', + r'Landroid/graphics/Bitmap$CompressFormat;', ); - /// from: `static public final char separatorChar` - static int get separatorChar => - _id_separatorChar.get(_class, const jni$_.jcharType()); + /// from: `static public final android.graphics.Bitmap$CompressFormat WEBP` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap$CompressFormat get WEBP => + _id_WEBP.get(_class, const $Bitmap$CompressFormat$Type()); - static final _id_new$ = _class.constructorId( - r'(Ljava/lang/String;)V', + static final _id_WEBP_LOSSY = _class.staticFieldId( + r'WEBP_LOSSY', + r'Landroid/graphics/Bitmap$CompressFormat;', ); - static final _new$ = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - jni$_.VarArgs<(jni$_.Pointer,)>)>>( - 'globalEnv_NewObject') - .asFunction< - jni$_.JniResult Function(jni$_.Pointer, - jni$_.JMethodIDPtr, jni$_.Pointer)>(); - - /// from: `public void (java.lang.String string)` + /// from: `static public final android.graphics.Bitmap$CompressFormat WEBP_LOSSY` /// The returned object must be released after use, by calling the [release] method. - factory File( - jni$_.JString? string, - ) { - final _$string = string?.reference ?? jni$_.jNullReference; - return File.fromReference(_new$(_class.reference.pointer, - _id_new$ as jni$_.JMethodIDPtr, _$string.pointer) - .reference); - } + static Bitmap$CompressFormat get WEBP_LOSSY => + _id_WEBP_LOSSY.get(_class, const $Bitmap$CompressFormat$Type()); - static final _id_new$1 = _class.constructorId( - r'(Ljava/lang/String;Ljava/lang/String;)V', + static final _id_WEBP_LOSSLESS = _class.staticFieldId( + r'WEBP_LOSSLESS', + r'Landroid/graphics/Bitmap$CompressFormat;', ); - static final _new$1 = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - jni$_.VarArgs< - ( - jni$_.Pointer, - jni$_.Pointer - )>)>>('globalEnv_NewObject') - .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - jni$_.Pointer, - jni$_.Pointer)>(); - - /// from: `public void (java.lang.String string, java.lang.String string1)` + /// from: `static public final android.graphics.Bitmap$CompressFormat WEBP_LOSSLESS` /// The returned object must be released after use, by calling the [release] method. - factory File.new$1( - jni$_.JString? string, - jni$_.JString? string1, - ) { - final _$string = string?.reference ?? jni$_.jNullReference; - final _$string1 = string1?.reference ?? jni$_.jNullReference; - return File.fromReference(_new$1( - _class.reference.pointer, - _id_new$1 as jni$_.JMethodIDPtr, - _$string.pointer, - _$string1.pointer) - .reference); - } + static Bitmap$CompressFormat get WEBP_LOSSLESS => + _id_WEBP_LOSSLESS.get(_class, const $Bitmap$CompressFormat$Type()); - static final _id_new$2 = _class.constructorId( - r'(Ljava/io/File;Ljava/lang/String;)V', + static final _id_values = _class.staticMethodId( + r'values', + r'()[Landroid/graphics/Bitmap$CompressFormat;', ); - static final _new$2 = jni$_.ProtectedJniExtensions.lookup< + static final _values = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - jni$_.VarArgs< - ( - jni$_.Pointer, - jni$_.Pointer - )>)>>('globalEnv_NewObject') + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallStaticObjectMethod') .asFunction< jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - jni$_.Pointer, - jni$_.Pointer)>(); + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); - /// from: `public void (java.io.File file, java.lang.String string)` + /// from: `static public android.graphics.Bitmap$CompressFormat[] values()` /// The returned object must be released after use, by calling the [release] method. - factory File.new$2( - File? file, - jni$_.JString? string, - ) { - final _$file = file?.reference ?? jni$_.jNullReference; - final _$string = string?.reference ?? jni$_.jNullReference; - return File.fromReference(_new$2(_class.reference.pointer, - _id_new$2 as jni$_.JMethodIDPtr, _$file.pointer, _$string.pointer) - .reference); + static jni$_.JArray? values() { + return _values(_class.reference.pointer, _id_values as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JArrayNullableType( + $Bitmap$CompressFormat$NullableType())); } - static final _id_new$3 = _class.constructorId( - r'(Ljava/net/URI;)V', + static final _id_valueOf = _class.staticMethodId( + r'valueOf', + r'(Ljava/lang/String;)Landroid/graphics/Bitmap$CompressFormat;', ); - static final _new$3 = jni$_.ProtectedJniExtensions.lookup< + static final _valueOf = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, jni$_.VarArgs<(jni$_.Pointer,)>)>>( - 'globalEnv_NewObject') + 'globalEnv_CallStaticObjectMethod') .asFunction< jni$_.JniResult Function(jni$_.Pointer, jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public void (java.net.URI uRI)` + /// from: `static public android.graphics.Bitmap$CompressFormat valueOf(java.lang.String synthetic)` /// The returned object must be released after use, by calling the [release] method. - factory File.new$3( - jni$_.JObject? uRI, + static Bitmap$CompressFormat? valueOf( + jni$_.JString? synthetic, ) { - final _$uRI = uRI?.reference ?? jni$_.jNullReference; - return File.fromReference(_new$3(_class.reference.pointer, - _id_new$3 as jni$_.JMethodIDPtr, _$uRI.pointer) - .reference); + final _$synthetic = synthetic?.reference ?? jni$_.jNullReference; + return _valueOf(_class.reference.pointer, _id_valueOf as jni$_.JMethodIDPtr, + _$synthetic.pointer) + .object( + const $Bitmap$CompressFormat$NullableType()); } +} - static final _id_getName = _class.instanceMethodId( - r'getName', - r'()Ljava/lang/String;', - ); +final class $Bitmap$CompressFormat$NullableType + extends jni$_.JObjType { + @jni$_.internal + const $Bitmap$CompressFormat$NullableType(); - static final _getName = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>>('globalEnv_CallObjectMethod') - .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>(); + @jni$_.internal + @core$_.override + String get signature => r'Landroid/graphics/Bitmap$CompressFormat;'; - /// from: `public java.lang.String getName()` - /// The returned object must be released after use, by calling the [release] method. - jni$_.JString? getName() { - return _getName(reference.pointer, _id_getName as jni$_.JMethodIDPtr) - .object(const jni$_.JStringNullableType()); - } + @jni$_.internal + @core$_.override + Bitmap$CompressFormat? fromReference(jni$_.JReference reference) => + reference.isNull + ? null + : Bitmap$CompressFormat.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); - static final _id_getParent = _class.instanceMethodId( - r'getParent', - r'()Ljava/lang/String;', - ); + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; - static final _getParent = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>>('globalEnv_CallObjectMethod') - .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>(); + @jni$_.internal + @core$_.override + final superCount = 1; - /// from: `public java.lang.String getParent()` - /// The returned object must be released after use, by calling the [release] method. - jni$_.JString? getParent() { - return _getParent(reference.pointer, _id_getParent as jni$_.JMethodIDPtr) - .object(const jni$_.JStringNullableType()); + @core$_.override + int get hashCode => ($Bitmap$CompressFormat$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Bitmap$CompressFormat$NullableType) && + other is $Bitmap$CompressFormat$NullableType; } +} - static final _id_getParentFile = _class.instanceMethodId( - r'getParentFile', - r'()Ljava/io/File;', - ); +final class $Bitmap$CompressFormat$Type + extends jni$_.JObjType { + @jni$_.internal + const $Bitmap$CompressFormat$Type(); - static final _getParentFile = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>>('globalEnv_CallObjectMethod') - .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>(); + @jni$_.internal + @core$_.override + String get signature => r'Landroid/graphics/Bitmap$CompressFormat;'; - /// from: `public java.io.File getParentFile()` - /// The returned object must be released after use, by calling the [release] method. - File? getParentFile() { - return _getParentFile( - reference.pointer, _id_getParentFile as jni$_.JMethodIDPtr) - .object(const $File$NullableType()); - } + @jni$_.internal + @core$_.override + Bitmap$CompressFormat fromReference(jni$_.JReference reference) => + Bitmap$CompressFormat.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); - static final _id_getPath = _class.instanceMethodId( - r'getPath', - r'()Ljava/lang/String;', - ); + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $Bitmap$CompressFormat$NullableType(); - static final _getPath = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>>('globalEnv_CallObjectMethod') - .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>(); + @jni$_.internal + @core$_.override + final superCount = 1; - /// from: `public java.lang.String getPath()` - /// The returned object must be released after use, by calling the [release] method. - jni$_.JString? getPath() { - return _getPath(reference.pointer, _id_getPath as jni$_.JMethodIDPtr) - .object(const jni$_.JStringNullableType()); + @core$_.override + int get hashCode => ($Bitmap$CompressFormat$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Bitmap$CompressFormat$Type) && + other is $Bitmap$CompressFormat$Type; } +} - static final _id_isAbsolute = _class.instanceMethodId( - r'isAbsolute', - r'()Z', - ); +/// from: `android.graphics.Bitmap$Config` +class Bitmap$Config extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; - static final _isAbsolute = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>>('globalEnv_CallBooleanMethod') - .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>(); + @jni$_.internal + Bitmap$Config.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); - /// from: `public boolean isAbsolute()` - bool isAbsolute() { - return _isAbsolute(reference.pointer, _id_isAbsolute as jni$_.JMethodIDPtr) - .boolean; - } + static final _class = jni$_.JClass.forName(r'android/graphics/Bitmap$Config'); - static final _id_getAbsolutePath = _class.instanceMethodId( - r'getAbsolutePath', - r'()Ljava/lang/String;', + /// The type which includes information such as the signature of this class. + static const nullableType = $Bitmap$Config$NullableType(); + static const type = $Bitmap$Config$Type(); + static final _id_ALPHA_8 = _class.staticFieldId( + r'ALPHA_8', + r'Landroid/graphics/Bitmap$Config;', ); - static final _getAbsolutePath = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>>('globalEnv_CallObjectMethod') - .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>(); - - /// from: `public java.lang.String getAbsolutePath()` + /// from: `static public final android.graphics.Bitmap$Config ALPHA_8` /// The returned object must be released after use, by calling the [release] method. - jni$_.JString? getAbsolutePath() { - return _getAbsolutePath( - reference.pointer, _id_getAbsolutePath as jni$_.JMethodIDPtr) - .object(const jni$_.JStringNullableType()); - } + static Bitmap$Config get ALPHA_8 => + _id_ALPHA_8.get(_class, const $Bitmap$Config$Type()); - static final _id_getAbsoluteFile = _class.instanceMethodId( - r'getAbsoluteFile', - r'()Ljava/io/File;', + static final _id_RGB_565 = _class.staticFieldId( + r'RGB_565', + r'Landroid/graphics/Bitmap$Config;', ); - static final _getAbsoluteFile = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>>('globalEnv_CallObjectMethod') - .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>(); - - /// from: `public java.io.File getAbsoluteFile()` + /// from: `static public final android.graphics.Bitmap$Config RGB_565` /// The returned object must be released after use, by calling the [release] method. - File? getAbsoluteFile() { - return _getAbsoluteFile( - reference.pointer, _id_getAbsoluteFile as jni$_.JMethodIDPtr) - .object(const $File$NullableType()); - } + static Bitmap$Config get RGB_565 => + _id_RGB_565.get(_class, const $Bitmap$Config$Type()); - static final _id_getCanonicalPath = _class.instanceMethodId( - r'getCanonicalPath', - r'()Ljava/lang/String;', + static final _id_ARGB_4444 = _class.staticFieldId( + r'ARGB_4444', + r'Landroid/graphics/Bitmap$Config;', ); - static final _getCanonicalPath = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>>('globalEnv_CallObjectMethod') - .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>(); - - /// from: `public java.lang.String getCanonicalPath()` + /// from: `static public final android.graphics.Bitmap$Config ARGB_4444` /// The returned object must be released after use, by calling the [release] method. - jni$_.JString? getCanonicalPath() { - return _getCanonicalPath( - reference.pointer, _id_getCanonicalPath as jni$_.JMethodIDPtr) - .object(const jni$_.JStringNullableType()); - } + static Bitmap$Config get ARGB_4444 => + _id_ARGB_4444.get(_class, const $Bitmap$Config$Type()); - static final _id_getCanonicalFile = _class.instanceMethodId( - r'getCanonicalFile', - r'()Ljava/io/File;', + static final _id_ARGB_8888 = _class.staticFieldId( + r'ARGB_8888', + r'Landroid/graphics/Bitmap$Config;', ); - static final _getCanonicalFile = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>>('globalEnv_CallObjectMethod') - .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>(); + /// from: `static public final android.graphics.Bitmap$Config ARGB_8888` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap$Config get ARGB_8888 => + _id_ARGB_8888.get(_class, const $Bitmap$Config$Type()); - /// from: `public java.io.File getCanonicalFile()` + static final _id_RGBA_F16 = _class.staticFieldId( + r'RGBA_F16', + r'Landroid/graphics/Bitmap$Config;', + ); + + /// from: `static public final android.graphics.Bitmap$Config RGBA_F16` /// The returned object must be released after use, by calling the [release] method. - File? getCanonicalFile() { - return _getCanonicalFile( - reference.pointer, _id_getCanonicalFile as jni$_.JMethodIDPtr) - .object(const $File$NullableType()); - } + static Bitmap$Config get RGBA_F16 => + _id_RGBA_F16.get(_class, const $Bitmap$Config$Type()); - static final _id_toURL = _class.instanceMethodId( - r'toURL', - r'()Ljava/net/URL;', + static final _id_HARDWARE = _class.staticFieldId( + r'HARDWARE', + r'Landroid/graphics/Bitmap$Config;', ); - static final _toURL = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>>('globalEnv_CallObjectMethod') - .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>(); + /// from: `static public final android.graphics.Bitmap$Config HARDWARE` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap$Config get HARDWARE => + _id_HARDWARE.get(_class, const $Bitmap$Config$Type()); + + static final _id_RGBA_1010102 = _class.staticFieldId( + r'RGBA_1010102', + r'Landroid/graphics/Bitmap$Config;', + ); - /// from: `public java.net.URL toURL()` + /// from: `static public final android.graphics.Bitmap$Config RGBA_1010102` /// The returned object must be released after use, by calling the [release] method. - jni$_.JObject? toURL() { - return _toURL(reference.pointer, _id_toURL as jni$_.JMethodIDPtr) - .object(const jni$_.JObjectNullableType()); - } + static Bitmap$Config get RGBA_1010102 => + _id_RGBA_1010102.get(_class, const $Bitmap$Config$Type()); - static final _id_toURI = _class.instanceMethodId( - r'toURI', - r'()Ljava/net/URI;', + static final _id_values = _class.staticMethodId( + r'values', + r'()[Landroid/graphics/Bitmap$Config;', ); - static final _toURI = jni$_.ProtectedJniExtensions.lookup< + static final _values = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, - )>>('globalEnv_CallObjectMethod') + )>>('globalEnv_CallStaticObjectMethod') .asFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, )>(); - /// from: `public java.net.URI toURI()` + /// from: `static public android.graphics.Bitmap$Config[] values()` /// The returned object must be released after use, by calling the [release] method. - jni$_.JObject? toURI() { - return _toURI(reference.pointer, _id_toURI as jni$_.JMethodIDPtr) - .object(const jni$_.JObjectNullableType()); + static jni$_.JArray? values() { + return _values(_class.reference.pointer, _id_values as jni$_.JMethodIDPtr) + .object?>( + const jni$_.JArrayNullableType( + $Bitmap$Config$NullableType())); } - static final _id_canRead = _class.instanceMethodId( - r'canRead', - r'()Z', + static final _id_valueOf = _class.staticMethodId( + r'valueOf', + r'(Ljava/lang/String;)Landroid/graphics/Bitmap$Config;', ); - static final _canRead = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( + static final _valueOf = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `static public android.graphics.Bitmap$Config valueOf(java.lang.String synthetic)` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap$Config? valueOf( + jni$_.JString? synthetic, + ) { + final _$synthetic = synthetic?.reference ?? jni$_.jNullReference; + return _valueOf(_class.reference.pointer, _id_valueOf as jni$_.JMethodIDPtr, + _$synthetic.pointer) + .object(const $Bitmap$Config$NullableType()); + } +} + +final class $Bitmap$Config$NullableType extends jni$_.JObjType { + @jni$_.internal + const $Bitmap$Config$NullableType(); + + @jni$_.internal + @core$_.override + String get signature => r'Landroid/graphics/Bitmap$Config;'; + + @jni$_.internal + @core$_.override + Bitmap$Config? fromReference(jni$_.JReference reference) => reference.isNull + ? null + : Bitmap$Config.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => this; + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($Bitmap$Config$NullableType).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Bitmap$Config$NullableType) && + other is $Bitmap$Config$NullableType; + } +} + +final class $Bitmap$Config$Type extends jni$_.JObjType { + @jni$_.internal + const $Bitmap$Config$Type(); + + @jni$_.internal + @core$_.override + String get signature => r'Landroid/graphics/Bitmap$Config;'; + + @jni$_.internal + @core$_.override + Bitmap$Config fromReference(jni$_.JReference reference) => + Bitmap$Config.fromReference( + reference, + ); + @jni$_.internal + @core$_.override + jni$_.JObjType get superType => const jni$_.JObjectNullableType(); + + @jni$_.internal + @core$_.override + jni$_.JObjType get nullableType => + const $Bitmap$Config$NullableType(); + + @jni$_.internal + @core$_.override + final superCount = 1; + + @core$_.override + int get hashCode => ($Bitmap$Config$Type).hashCode; + + @core$_.override + bool operator ==(Object other) { + return other.runtimeType == ($Bitmap$Config$Type) && + other is $Bitmap$Config$Type; + } +} + +/// from: `android.graphics.Bitmap` +class Bitmap extends jni$_.JObject { + @jni$_.internal + @core$_.override + final jni$_.JObjType $type; + + @jni$_.internal + Bitmap.fromReference( + jni$_.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = jni$_.JClass.forName(r'android/graphics/Bitmap'); + + /// The type which includes information such as the signature of this class. + static const nullableType = $Bitmap$NullableType(); + static const type = $Bitmap$Type(); + static final _id_CREATOR = _class.staticFieldId( + r'CREATOR', + r'Landroid/os/Parcelable$Creator;', + ); + + /// from: `static public final android.os.Parcelable$Creator CREATOR` + /// The returned object must be released after use, by calling the [release] method. + static jni$_.JObject? get CREATOR => + _id_CREATOR.get(_class, const jni$_.JObjectNullableType()); + + /// from: `static public final int DENSITY_NONE` + static const DENSITY_NONE = 0; + static final _id_getDensity = _class.instanceMethodId( + r'getDensity', + r'()I', + ); + + static final _getDensity = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public int getDensity()` + int getDensity() { + return _getDensity(reference.pointer, _id_getDensity as jni$_.JMethodIDPtr) + .integer; + } + + static final _id_setDensity = _class.instanceMethodId( + r'setDensity', + r'(I)V', + ); + + static final _setDensity = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public void setDensity(int i)` + void setDensity( + int i, + ) { + _setDensity(reference.pointer, _id_setDensity as jni$_.JMethodIDPtr, i) + .check(); + } + + static final _id_reconfigure = _class.instanceMethodId( + r'reconfigure', + r'(IILandroid/graphics/Bitmap$Config;)V', + ); + + static final _reconfigure = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Int32, + jni$_.Int32, + jni$_.Pointer + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, int, int, jni$_.Pointer)>(); + + /// from: `public void reconfigure(int i, int i1, android.graphics.Bitmap$Config config)` + void reconfigure( + int i, + int i1, + Bitmap$Config? config, + ) { + final _$config = config?.reference ?? jni$_.jNullReference; + _reconfigure(reference.pointer, _id_reconfigure as jni$_.JMethodIDPtr, i, + i1, _$config.pointer) + .check(); + } + + static final _id_setWidth = _class.instanceMethodId( + r'setWidth', + r'(I)V', + ); + + static final _setWidth = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public void setWidth(int i)` + void setWidth( + int i, + ) { + _setWidth(reference.pointer, _id_setWidth as jni$_.JMethodIDPtr, i).check(); + } + + static final _id_setHeight = _class.instanceMethodId( + r'setHeight', + r'(I)V', + ); + + static final _setHeight = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public void setHeight(int i)` + void setHeight( + int i, + ) { + _setHeight(reference.pointer, _id_setHeight as jni$_.JMethodIDPtr, i) + .check(); + } + + static final _id_setConfig = _class.instanceMethodId( + r'setConfig', + r'(Landroid/graphics/Bitmap$Config;)V', + ); + + static final _setConfig = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public void setConfig(android.graphics.Bitmap$Config config)` + void setConfig( + Bitmap$Config? config, + ) { + final _$config = config?.reference ?? jni$_.jNullReference; + _setConfig(reference.pointer, _id_setConfig as jni$_.JMethodIDPtr, + _$config.pointer) + .check(); + } + + static final _id_recycle = _class.instanceMethodId( + r'recycle', + r'()V', + ); + + static final _recycle = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public void recycle()` + void recycle() { + _recycle(reference.pointer, _id_recycle as jni$_.JMethodIDPtr).check(); + } + + static final _id_isRecycled = _class.instanceMethodId( + r'isRecycled', + r'()Z', + ); + + static final _isRecycled = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public boolean isRecycled()` + bool isRecycled() { + return _isRecycled(reference.pointer, _id_isRecycled as jni$_.JMethodIDPtr) + .boolean; + } + + static final _id_getGenerationId = _class.instanceMethodId( + r'getGenerationId', + r'()I', + ); + + static final _getGenerationId = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public int getGenerationId()` + int getGenerationId() { + return _getGenerationId( + reference.pointer, _id_getGenerationId as jni$_.JMethodIDPtr) + .integer; + } + + static final _id_copyPixelsToBuffer = _class.instanceMethodId( + r'copyPixelsToBuffer', + r'(Ljava/nio/Buffer;)V', + ); + + static final _copyPixelsToBuffer = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public void copyPixelsToBuffer(java.nio.Buffer buffer)` + void copyPixelsToBuffer( + jni$_.JBuffer? buffer, + ) { + final _$buffer = buffer?.reference ?? jni$_.jNullReference; + _copyPixelsToBuffer(reference.pointer, + _id_copyPixelsToBuffer as jni$_.JMethodIDPtr, _$buffer.pointer) + .check(); + } + + static final _id_copyPixelsFromBuffer = _class.instanceMethodId( + r'copyPixelsFromBuffer', + r'(Ljava/nio/Buffer;)V', + ); + + static final _copyPixelsFromBuffer = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public void copyPixelsFromBuffer(java.nio.Buffer buffer)` + void copyPixelsFromBuffer( + jni$_.JBuffer? buffer, + ) { + final _$buffer = buffer?.reference ?? jni$_.jNullReference; + _copyPixelsFromBuffer(reference.pointer, + _id_copyPixelsFromBuffer as jni$_.JMethodIDPtr, _$buffer.pointer) + .check(); + } + + static final _id_copy = _class.instanceMethodId( + r'copy', + r'(Landroid/graphics/Bitmap$Config;Z)Landroid/graphics/Bitmap;', + ); + + static final _copy = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Pointer, jni$_.Int32)>)>>( + 'globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int)>(); + + /// from: `public android.graphics.Bitmap copy(android.graphics.Bitmap$Config config, boolean z)` + /// The returned object must be released after use, by calling the [release] method. + Bitmap? copy( + Bitmap$Config? config, + bool z, + ) { + final _$config = config?.reference ?? jni$_.jNullReference; + return _copy(reference.pointer, _id_copy as jni$_.JMethodIDPtr, + _$config.pointer, z ? 1 : 0) + .object(const $Bitmap$NullableType()); + } + + static final _id_asShared = _class.instanceMethodId( + r'asShared', + r'()Landroid/graphics/Bitmap;', + ); + + static final _asShared = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + )>(); + + /// from: `public android.graphics.Bitmap asShared()` + /// The returned object must be released after use, by calling the [release] method. + Bitmap? asShared() { + return _asShared(reference.pointer, _id_asShared as jni$_.JMethodIDPtr) + .object(const $Bitmap$NullableType()); + } + + static final _id_wrapHardwareBuffer = _class.staticMethodId( + r'wrapHardwareBuffer', + r'(Landroid/hardware/HardwareBuffer;Landroid/graphics/ColorSpace;)Landroid/graphics/Bitmap;', + ); + + static final _wrapHardwareBuffer = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer)>(); + + /// from: `static public android.graphics.Bitmap wrapHardwareBuffer(android.hardware.HardwareBuffer hardwareBuffer, android.graphics.ColorSpace colorSpace)` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap? wrapHardwareBuffer( + jni$_.JObject? hardwareBuffer, + jni$_.JObject? colorSpace, + ) { + final _$hardwareBuffer = hardwareBuffer?.reference ?? jni$_.jNullReference; + final _$colorSpace = colorSpace?.reference ?? jni$_.jNullReference; + return _wrapHardwareBuffer( + _class.reference.pointer, + _id_wrapHardwareBuffer as jni$_.JMethodIDPtr, + _$hardwareBuffer.pointer, + _$colorSpace.pointer) + .object(const $Bitmap$NullableType()); + } + + static final _id_createScaledBitmap = _class.staticMethodId( + r'createScaledBitmap', + r'(Landroid/graphics/Bitmap;IIZ)Landroid/graphics/Bitmap;', + ); + + static final _createScaledBitmap = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32 + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int, int, int)>(); + + /// from: `static public android.graphics.Bitmap createScaledBitmap(android.graphics.Bitmap bitmap, int i, int i1, boolean z)` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap? createScaledBitmap( + Bitmap? bitmap, + int i, + int i1, + bool z, + ) { + final _$bitmap = bitmap?.reference ?? jni$_.jNullReference; + return _createScaledBitmap( + _class.reference.pointer, + _id_createScaledBitmap as jni$_.JMethodIDPtr, + _$bitmap.pointer, + i, + i1, + z ? 1 : 0) + .object(const $Bitmap$NullableType()); + } + + static final _id_createBitmap = _class.staticMethodId( + r'createBitmap', + r'(Landroid/graphics/Bitmap;)Landroid/graphics/Bitmap;', + ); + + static final _createBitmap = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `static public android.graphics.Bitmap createBitmap(android.graphics.Bitmap bitmap)` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap? createBitmap( + Bitmap? bitmap, + ) { + final _$bitmap = bitmap?.reference ?? jni$_.jNullReference; + return _createBitmap(_class.reference.pointer, + _id_createBitmap as jni$_.JMethodIDPtr, _$bitmap.pointer) + .object(const $Bitmap$NullableType()); + } + + static final _id_createBitmap$1 = _class.staticMethodId( + r'createBitmap', + r'(Landroid/graphics/Bitmap;IIII)Landroid/graphics/Bitmap;', + ); + + static final _createBitmap$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32 + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + int, + int, + int, + int)>(); + + /// from: `static public android.graphics.Bitmap createBitmap(android.graphics.Bitmap bitmap, int i, int i1, int i2, int i3)` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap? createBitmap$1( + Bitmap? bitmap, + int i, + int i1, + int i2, + int i3, + ) { + final _$bitmap = bitmap?.reference ?? jni$_.jNullReference; + return _createBitmap$1( + _class.reference.pointer, + _id_createBitmap$1 as jni$_.JMethodIDPtr, + _$bitmap.pointer, + i, + i1, + i2, + i3) + .object(const $Bitmap$NullableType()); + } + + static final _id_createBitmap$2 = _class.staticMethodId( + r'createBitmap', + r'(Landroid/graphics/Bitmap;IIIILandroid/graphics/Matrix;Z)Landroid/graphics/Bitmap;', + ); + + static final _createBitmap$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Pointer, + jni$_.Int32 + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + int, + int, + int, + int, + jni$_.Pointer, + int)>(); + + /// from: `static public android.graphics.Bitmap createBitmap(android.graphics.Bitmap bitmap, int i, int i1, int i2, int i3, android.graphics.Matrix matrix, boolean z)` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap? createBitmap$2( + Bitmap? bitmap, + int i, + int i1, + int i2, + int i3, + jni$_.JObject? matrix, + bool z, + ) { + final _$bitmap = bitmap?.reference ?? jni$_.jNullReference; + final _$matrix = matrix?.reference ?? jni$_.jNullReference; + return _createBitmap$2( + _class.reference.pointer, + _id_createBitmap$2 as jni$_.JMethodIDPtr, + _$bitmap.pointer, + i, + i1, + i2, + i3, + _$matrix.pointer, + z ? 1 : 0) + .object(const $Bitmap$NullableType()); + } + + static final _id_createBitmap$3 = _class.staticMethodId( + r'createBitmap', + r'(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;', + ); + + static final _createBitmap$3 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Int32, + jni$_.Int32, + jni$_.Pointer + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, int, int, jni$_.Pointer)>(); + + /// from: `static public android.graphics.Bitmap createBitmap(int i, int i1, android.graphics.Bitmap$Config config)` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap? createBitmap$3( + int i, + int i1, + Bitmap$Config? config, + ) { + final _$config = config?.reference ?? jni$_.jNullReference; + return _createBitmap$3(_class.reference.pointer, + _id_createBitmap$3 as jni$_.JMethodIDPtr, i, i1, _$config.pointer) + .object(const $Bitmap$NullableType()); + } + + static final _id_createBitmap$4 = _class.staticMethodId( + r'createBitmap', + r'(Landroid/util/DisplayMetrics;IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;', + ); + + static final _createBitmap$4 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Pointer + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + int, + int, + jni$_.Pointer)>(); + + /// from: `static public android.graphics.Bitmap createBitmap(android.util.DisplayMetrics displayMetrics, int i, int i1, android.graphics.Bitmap$Config config)` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap? createBitmap$4( + jni$_.JObject? displayMetrics, + int i, + int i1, + Bitmap$Config? config, + ) { + final _$displayMetrics = displayMetrics?.reference ?? jni$_.jNullReference; + final _$config = config?.reference ?? jni$_.jNullReference; + return _createBitmap$4( + _class.reference.pointer, + _id_createBitmap$4 as jni$_.JMethodIDPtr, + _$displayMetrics.pointer, + i, + i1, + _$config.pointer) + .object(const $Bitmap$NullableType()); + } + + static final _id_createBitmap$5 = _class.staticMethodId( + r'createBitmap', + r'(IILandroid/graphics/Bitmap$Config;Z)Landroid/graphics/Bitmap;', + ); + + static final _createBitmap$5 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Int32, + jni$_.Int32, + jni$_.Pointer, + jni$_.Int32 + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, int, int, jni$_.Pointer, int)>(); + + /// from: `static public android.graphics.Bitmap createBitmap(int i, int i1, android.graphics.Bitmap$Config config, boolean z)` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap? createBitmap$5( + int i, + int i1, + Bitmap$Config? config, + bool z, + ) { + final _$config = config?.reference ?? jni$_.jNullReference; + return _createBitmap$5( + _class.reference.pointer, + _id_createBitmap$5 as jni$_.JMethodIDPtr, + i, + i1, + _$config.pointer, + z ? 1 : 0) + .object(const $Bitmap$NullableType()); + } + + static final _id_createBitmap$6 = _class.staticMethodId( + r'createBitmap', + r'(IILandroid/graphics/Bitmap$Config;ZLandroid/graphics/ColorSpace;)Landroid/graphics/Bitmap;', + ); + + static final _createBitmap$6 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Int32, + jni$_.Int32, + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + int, + int, + jni$_.Pointer, + int, + jni$_.Pointer)>(); + + /// from: `static public android.graphics.Bitmap createBitmap(int i, int i1, android.graphics.Bitmap$Config config, boolean z, android.graphics.ColorSpace colorSpace)` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap? createBitmap$6( + int i, + int i1, + Bitmap$Config? config, + bool z, + jni$_.JObject? colorSpace, + ) { + final _$config = config?.reference ?? jni$_.jNullReference; + final _$colorSpace = colorSpace?.reference ?? jni$_.jNullReference; + return _createBitmap$6( + _class.reference.pointer, + _id_createBitmap$6 as jni$_.JMethodIDPtr, + i, + i1, + _$config.pointer, + z ? 1 : 0, + _$colorSpace.pointer) + .object(const $Bitmap$NullableType()); + } + + static final _id_createBitmap$7 = _class.staticMethodId( + r'createBitmap', + r'(Landroid/util/DisplayMetrics;IILandroid/graphics/Bitmap$Config;Z)Landroid/graphics/Bitmap;', + ); + + static final _createBitmap$7 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Pointer, + jni$_.Int32 + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + int, + int, + jni$_.Pointer, + int)>(); + + /// from: `static public android.graphics.Bitmap createBitmap(android.util.DisplayMetrics displayMetrics, int i, int i1, android.graphics.Bitmap$Config config, boolean z)` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap? createBitmap$7( + jni$_.JObject? displayMetrics, + int i, + int i1, + Bitmap$Config? config, + bool z, + ) { + final _$displayMetrics = displayMetrics?.reference ?? jni$_.jNullReference; + final _$config = config?.reference ?? jni$_.jNullReference; + return _createBitmap$7( + _class.reference.pointer, + _id_createBitmap$7 as jni$_.JMethodIDPtr, + _$displayMetrics.pointer, + i, + i1, + _$config.pointer, + z ? 1 : 0) + .object(const $Bitmap$NullableType()); + } + + static final _id_createBitmap$8 = _class.staticMethodId( + r'createBitmap', + r'(Landroid/util/DisplayMetrics;IILandroid/graphics/Bitmap$Config;ZLandroid/graphics/ColorSpace;)Landroid/graphics/Bitmap;', + ); + + static final _createBitmap$8 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + int, + int, + jni$_.Pointer, + int, + jni$_.Pointer)>(); + + /// from: `static public android.graphics.Bitmap createBitmap(android.util.DisplayMetrics displayMetrics, int i, int i1, android.graphics.Bitmap$Config config, boolean z, android.graphics.ColorSpace colorSpace)` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap? createBitmap$8( + jni$_.JObject? displayMetrics, + int i, + int i1, + Bitmap$Config? config, + bool z, + jni$_.JObject? colorSpace, + ) { + final _$displayMetrics = displayMetrics?.reference ?? jni$_.jNullReference; + final _$config = config?.reference ?? jni$_.jNullReference; + final _$colorSpace = colorSpace?.reference ?? jni$_.jNullReference; + return _createBitmap$8( + _class.reference.pointer, + _id_createBitmap$8 as jni$_.JMethodIDPtr, + _$displayMetrics.pointer, + i, + i1, + _$config.pointer, + z ? 1 : 0, + _$colorSpace.pointer) + .object(const $Bitmap$NullableType()); + } + + static final _id_createBitmap$9 = _class.staticMethodId( + r'createBitmap', + r'([IIIIILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;', + ); + + static final _createBitmap$9 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Pointer + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + int, + int, + int, + int, + jni$_.Pointer)>(); + + /// from: `static public android.graphics.Bitmap createBitmap(int[] is, int i, int i1, int i2, int i3, android.graphics.Bitmap$Config config)` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap? createBitmap$9( + jni$_.JIntArray? is$, + int i, + int i1, + int i2, + int i3, + Bitmap$Config? config, + ) { + final _$is$ = is$?.reference ?? jni$_.jNullReference; + final _$config = config?.reference ?? jni$_.jNullReference; + return _createBitmap$9( + _class.reference.pointer, + _id_createBitmap$9 as jni$_.JMethodIDPtr, + _$is$.pointer, + i, + i1, + i2, + i3, + _$config.pointer) + .object(const $Bitmap$NullableType()); + } + + static final _id_createBitmap$10 = _class.staticMethodId( + r'createBitmap', + r'(Landroid/util/DisplayMetrics;[IIIIILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;', + ); + + static final _createBitmap$10 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Pointer + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + int, + int, + int, + int, + jni$_.Pointer)>(); + + /// from: `static public android.graphics.Bitmap createBitmap(android.util.DisplayMetrics displayMetrics, int[] is, int i, int i1, int i2, int i3, android.graphics.Bitmap$Config config)` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap? createBitmap$10( + jni$_.JObject? displayMetrics, + jni$_.JIntArray? is$, + int i, + int i1, + int i2, + int i3, + Bitmap$Config? config, + ) { + final _$displayMetrics = displayMetrics?.reference ?? jni$_.jNullReference; + final _$is$ = is$?.reference ?? jni$_.jNullReference; + final _$config = config?.reference ?? jni$_.jNullReference; + return _createBitmap$10( + _class.reference.pointer, + _id_createBitmap$10 as jni$_.JMethodIDPtr, + _$displayMetrics.pointer, + _$is$.pointer, + i, + i1, + i2, + i3, + _$config.pointer) + .object(const $Bitmap$NullableType()); + } + + static final _id_createBitmap$11 = _class.staticMethodId( + r'createBitmap', + r'([IIILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;', + ); + + static final _createBitmap$11 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Pointer + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + int, + int, + jni$_.Pointer)>(); + + /// from: `static public android.graphics.Bitmap createBitmap(int[] is, int i, int i1, android.graphics.Bitmap$Config config)` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap? createBitmap$11( + jni$_.JIntArray? is$, + int i, + int i1, + Bitmap$Config? config, + ) { + final _$is$ = is$?.reference ?? jni$_.jNullReference; + final _$config = config?.reference ?? jni$_.jNullReference; + return _createBitmap$11( + _class.reference.pointer, + _id_createBitmap$11 as jni$_.JMethodIDPtr, + _$is$.pointer, + i, + i1, + _$config.pointer) + .object(const $Bitmap$NullableType()); + } + + static final _id_createBitmap$12 = _class.staticMethodId( + r'createBitmap', + r'(Landroid/util/DisplayMetrics;[IIILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;', + ); + + static final _createBitmap$12 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Pointer + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + jni$_.Pointer, + int, + int, + jni$_.Pointer)>(); + + /// from: `static public android.graphics.Bitmap createBitmap(android.util.DisplayMetrics displayMetrics, int[] is, int i, int i1, android.graphics.Bitmap$Config config)` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap? createBitmap$12( + jni$_.JObject? displayMetrics, + jni$_.JIntArray? is$, + int i, + int i1, + Bitmap$Config? config, + ) { + final _$displayMetrics = displayMetrics?.reference ?? jni$_.jNullReference; + final _$is$ = is$?.reference ?? jni$_.jNullReference; + final _$config = config?.reference ?? jni$_.jNullReference; + return _createBitmap$12( + _class.reference.pointer, + _id_createBitmap$12 as jni$_.JMethodIDPtr, + _$displayMetrics.pointer, + _$is$.pointer, + i, + i1, + _$config.pointer) + .object(const $Bitmap$NullableType()); + } + + static final _id_createBitmap$13 = _class.staticMethodId( + r'createBitmap', + r'(Landroid/graphics/Picture;)Landroid/graphics/Bitmap;', + ); + + static final _createBitmap$13 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `static public android.graphics.Bitmap createBitmap(android.graphics.Picture picture)` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap? createBitmap$13( + jni$_.JObject? picture, + ) { + final _$picture = picture?.reference ?? jni$_.jNullReference; + return _createBitmap$13(_class.reference.pointer, + _id_createBitmap$13 as jni$_.JMethodIDPtr, _$picture.pointer) + .object(const $Bitmap$NullableType()); + } + + static final _id_createBitmap$14 = _class.staticMethodId( + r'createBitmap', + r'(Landroid/graphics/Picture;IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;', + ); + + static final _createBitmap$14 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Pointer + )>)>>('globalEnv_CallStaticObjectMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + int, + int, + jni$_.Pointer)>(); + + /// from: `static public android.graphics.Bitmap createBitmap(android.graphics.Picture picture, int i, int i1, android.graphics.Bitmap$Config config)` + /// The returned object must be released after use, by calling the [release] method. + static Bitmap? createBitmap$14( + jni$_.JObject? picture, + int i, + int i1, + Bitmap$Config? config, + ) { + final _$picture = picture?.reference ?? jni$_.jNullReference; + final _$config = config?.reference ?? jni$_.jNullReference; + return _createBitmap$14( + _class.reference.pointer, + _id_createBitmap$14 as jni$_.JMethodIDPtr, + _$picture.pointer, + i, + i1, + _$config.pointer) + .object(const $Bitmap$NullableType()); + } + + static final _id_getNinePatchChunk = _class.instanceMethodId( + r'getNinePatchChunk', + r'()[B', + ); + + static final _getNinePatchChunk = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, - )>>('globalEnv_CallBooleanMethod') + )>>('globalEnv_CallObjectMethod') .asFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, )>(); - /// from: `public boolean canRead()` - bool canRead() { - return _canRead(reference.pointer, _id_canRead as jni$_.JMethodIDPtr) + /// from: `public byte[] getNinePatchChunk()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JByteArray? getNinePatchChunk() { + return _getNinePatchChunk( + reference.pointer, _id_getNinePatchChunk as jni$_.JMethodIDPtr) + .object(const jni$_.JByteArrayNullableType()); + } + + static final _id_compress = _class.instanceMethodId( + r'compress', + r'(Landroid/graphics/Bitmap$CompressFormat;ILjava/io/OutputStream;)Z', + ); + + static final _compress = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Pointer + )>)>>('globalEnv_CallBooleanMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + int, + jni$_.Pointer)>(); + + /// from: `public boolean compress(android.graphics.Bitmap$CompressFormat compressFormat, int i, java.io.OutputStream outputStream)` + bool compress( + Bitmap$CompressFormat? compressFormat, + int i, + jni$_.JObject? outputStream, + ) { + final _$compressFormat = compressFormat?.reference ?? jni$_.jNullReference; + final _$outputStream = outputStream?.reference ?? jni$_.jNullReference; + return _compress(reference.pointer, _id_compress as jni$_.JMethodIDPtr, + _$compressFormat.pointer, i, _$outputStream.pointer) .boolean; } - static final _id_canWrite = _class.instanceMethodId( - r'canWrite', + static final _id_isMutable = _class.instanceMethodId( + r'isMutable', r'()Z', ); - static final _canWrite = jni$_.ProtectedJniExtensions.lookup< + static final _isMutable = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, @@ -1902,18 +3031,18 @@ class File extends jni$_.JObject { jni$_.JMethodIDPtr, )>(); - /// from: `public boolean canWrite()` - bool canWrite() { - return _canWrite(reference.pointer, _id_canWrite as jni$_.JMethodIDPtr) + /// from: `public boolean isMutable()` + bool isMutable() { + return _isMutable(reference.pointer, _id_isMutable as jni$_.JMethodIDPtr) .boolean; } - static final _id_exists = _class.instanceMethodId( - r'exists', + static final _id_isPremultiplied = _class.instanceMethodId( + r'isPremultiplied', r'()Z', ); - static final _exists = jni$_.ProtectedJniExtensions.lookup< + static final _isPremultiplied = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, @@ -1925,156 +3054,341 @@ class File extends jni$_.JObject { jni$_.JMethodIDPtr, )>(); - /// from: `public boolean exists()` - bool exists() { - return _exists(reference.pointer, _id_exists as jni$_.JMethodIDPtr).boolean; + /// from: `public boolean isPremultiplied()` + bool isPremultiplied() { + return _isPremultiplied( + reference.pointer, _id_isPremultiplied as jni$_.JMethodIDPtr) + .boolean; } - static final _id_isDirectory = _class.instanceMethodId( - r'isDirectory', - r'()Z', + static final _id_setPremultiplied = _class.instanceMethodId( + r'setPremultiplied', + r'(Z)V', + ); + + static final _setPremultiplied = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallVoidMethod') + .asFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public void setPremultiplied(boolean z)` + void setPremultiplied( + bool z, + ) { + _setPremultiplied(reference.pointer, + _id_setPremultiplied as jni$_.JMethodIDPtr, z ? 1 : 0) + .check(); + } + + static final _id_getWidth = _class.instanceMethodId( + r'getWidth', + r'()I', ); - static final _isDirectory = jni$_.ProtectedJniExtensions.lookup< + static final _getWidth = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, - )>>('globalEnv_CallBooleanMethod') + )>>('globalEnv_CallIntMethod') .asFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, )>(); - /// from: `public boolean isDirectory()` - bool isDirectory() { - return _isDirectory( - reference.pointer, _id_isDirectory as jni$_.JMethodIDPtr) - .boolean; + /// from: `public int getWidth()` + int getWidth() { + return _getWidth(reference.pointer, _id_getWidth as jni$_.JMethodIDPtr) + .integer; } - static final _id_isFile = _class.instanceMethodId( - r'isFile', - r'()Z', + static final _id_getHeight = _class.instanceMethodId( + r'getHeight', + r'()I', ); - static final _isFile = jni$_.ProtectedJniExtensions.lookup< + static final _getHeight = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, - )>>('globalEnv_CallBooleanMethod') + )>>('globalEnv_CallIntMethod') .asFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, )>(); - /// from: `public boolean isFile()` - bool isFile() { - return _isFile(reference.pointer, _id_isFile as jni$_.JMethodIDPtr).boolean; + /// from: `public int getHeight()` + int getHeight() { + return _getHeight(reference.pointer, _id_getHeight as jni$_.JMethodIDPtr) + .integer; } - static final _id_isHidden = _class.instanceMethodId( - r'isHidden', - r'()Z', + static final _id_getScaledWidth = _class.instanceMethodId( + r'getScaledWidth', + r'(Landroid/graphics/Canvas;)I', + ); + + static final _getScaledWidth = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public int getScaledWidth(android.graphics.Canvas canvas)` + int getScaledWidth( + jni$_.JObject? canvas, + ) { + final _$canvas = canvas?.reference ?? jni$_.jNullReference; + return _getScaledWidth(reference.pointer, + _id_getScaledWidth as jni$_.JMethodIDPtr, _$canvas.pointer) + .integer; + } + + static final _id_getScaledHeight = _class.instanceMethodId( + r'getScaledHeight', + r'(Landroid/graphics/Canvas;)I', + ); + + static final _getScaledHeight = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public int getScaledHeight(android.graphics.Canvas canvas)` + int getScaledHeight( + jni$_.JObject? canvas, + ) { + final _$canvas = canvas?.reference ?? jni$_.jNullReference; + return _getScaledHeight(reference.pointer, + _id_getScaledHeight as jni$_.JMethodIDPtr, _$canvas.pointer) + .integer; + } + + static final _id_getScaledWidth$1 = _class.instanceMethodId( + r'getScaledWidth', + r'(Landroid/util/DisplayMetrics;)I', + ); + + static final _getScaledWidth$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public int getScaledWidth(android.util.DisplayMetrics displayMetrics)` + int getScaledWidth$1( + jni$_.JObject? displayMetrics, + ) { + final _$displayMetrics = displayMetrics?.reference ?? jni$_.jNullReference; + return _getScaledWidth$1( + reference.pointer, + _id_getScaledWidth$1 as jni$_.JMethodIDPtr, + _$displayMetrics.pointer) + .integer; + } + + static final _id_getScaledHeight$1 = _class.instanceMethodId( + r'getScaledHeight', + r'(Landroid/util/DisplayMetrics;)I', + ); + + static final _getScaledHeight$1 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Pointer,)>)>>( + 'globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer)>(); + + /// from: `public int getScaledHeight(android.util.DisplayMetrics displayMetrics)` + int getScaledHeight$1( + jni$_.JObject? displayMetrics, + ) { + final _$displayMetrics = displayMetrics?.reference ?? jni$_.jNullReference; + return _getScaledHeight$1( + reference.pointer, + _id_getScaledHeight$1 as jni$_.JMethodIDPtr, + _$displayMetrics.pointer) + .integer; + } + + static final _id_getScaledWidth$2 = _class.instanceMethodId( + r'getScaledWidth', + r'(I)I', + ); + + static final _getScaledWidth$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public int getScaledWidth(int i)` + int getScaledWidth$2( + int i, + ) { + return _getScaledWidth$2( + reference.pointer, _id_getScaledWidth$2 as jni$_.JMethodIDPtr, i) + .integer; + } + + static final _id_getScaledHeight$2 = _class.instanceMethodId( + r'getScaledHeight', + r'(I)I', + ); + + static final _getScaledHeight$2 = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JniResult Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallIntMethod') + .asFunction< + jni$_.JniResult Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + + /// from: `public int getScaledHeight(int i)` + int getScaledHeight$2( + int i, + ) { + return _getScaledHeight$2( + reference.pointer, _id_getScaledHeight$2 as jni$_.JMethodIDPtr, i) + .integer; + } + + static final _id_getRowBytes = _class.instanceMethodId( + r'getRowBytes', + r'()I', ); - static final _isHidden = jni$_.ProtectedJniExtensions.lookup< + static final _getRowBytes = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, - )>>('globalEnv_CallBooleanMethod') + )>>('globalEnv_CallIntMethod') .asFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, )>(); - /// from: `public boolean isHidden()` - bool isHidden() { - return _isHidden(reference.pointer, _id_isHidden as jni$_.JMethodIDPtr) - .boolean; + /// from: `public int getRowBytes()` + int getRowBytes() { + return _getRowBytes( + reference.pointer, _id_getRowBytes as jni$_.JMethodIDPtr) + .integer; } - static final _id_lastModified = _class.instanceMethodId( - r'lastModified', - r'()J', + static final _id_getByteCount = _class.instanceMethodId( + r'getByteCount', + r'()I', ); - static final _lastModified = jni$_.ProtectedJniExtensions.lookup< + static final _getByteCount = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, - )>>('globalEnv_CallLongMethod') + )>>('globalEnv_CallIntMethod') .asFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, )>(); - /// from: `public long lastModified()` - int lastModified() { - return _lastModified( - reference.pointer, _id_lastModified as jni$_.JMethodIDPtr) - .long; + /// from: `public int getByteCount()` + int getByteCount() { + return _getByteCount( + reference.pointer, _id_getByteCount as jni$_.JMethodIDPtr) + .integer; } - static final _id_length = _class.instanceMethodId( - r'length', - r'()J', + static final _id_getAllocationByteCount = _class.instanceMethodId( + r'getAllocationByteCount', + r'()I', ); - static final _length = jni$_.ProtectedJniExtensions.lookup< + static final _getAllocationByteCount = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, - )>>('globalEnv_CallLongMethod') + )>>('globalEnv_CallIntMethod') .asFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, )>(); - /// from: `public long length()` - int length() { - return _length(reference.pointer, _id_length as jni$_.JMethodIDPtr).long; + /// from: `public int getAllocationByteCount()` + int getAllocationByteCount() { + return _getAllocationByteCount( + reference.pointer, _id_getAllocationByteCount as jni$_.JMethodIDPtr) + .integer; } - static final _id_createNewFile = _class.instanceMethodId( - r'createNewFile', - r'()Z', + static final _id_getConfig = _class.instanceMethodId( + r'getConfig', + r'()Landroid/graphics/Bitmap$Config;', ); - static final _createNewFile = jni$_.ProtectedJniExtensions.lookup< + static final _getConfig = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, - )>>('globalEnv_CallBooleanMethod') + )>>('globalEnv_CallObjectMethod') .asFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, )>(); - /// from: `public boolean createNewFile()` - bool createNewFile() { - return _createNewFile( - reference.pointer, _id_createNewFile as jni$_.JMethodIDPtr) - .boolean; + /// from: `public android.graphics.Bitmap$Config getConfig()` + /// The returned object must be released after use, by calling the [release] method. + Bitmap$Config? getConfig() { + return _getConfig(reference.pointer, _id_getConfig as jni$_.JMethodIDPtr) + .object(const $Bitmap$Config$NullableType()); } - static final _id_delete = _class.instanceMethodId( - r'delete', + static final _id_hasAlpha = _class.instanceMethodId( + r'hasAlpha', r'()Z', ); - static final _delete = jni$_.ProtectedJniExtensions.lookup< + static final _hasAlpha = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, @@ -2086,95 +3400,89 @@ class File extends jni$_.JObject { jni$_.JMethodIDPtr, )>(); - /// from: `public boolean delete()` - bool delete() { - return _delete(reference.pointer, _id_delete as jni$_.JMethodIDPtr).boolean; + /// from: `public boolean hasAlpha()` + bool hasAlpha() { + return _hasAlpha(reference.pointer, _id_hasAlpha as jni$_.JMethodIDPtr) + .boolean; } - static final _id_deleteOnExit = _class.instanceMethodId( - r'deleteOnExit', - r'()V', + static final _id_setHasAlpha = _class.instanceMethodId( + r'setHasAlpha', + r'(Z)V', ); - static final _deleteOnExit = jni$_.ProtectedJniExtensions.lookup< + static final _setHasAlpha = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JThrowablePtr Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>>('globalEnv_CallVoidMethod') + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallVoidMethod') .asFunction< jni$_.JThrowablePtr Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>(); + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); - /// from: `public void deleteOnExit()` - void deleteOnExit() { - _deleteOnExit(reference.pointer, _id_deleteOnExit as jni$_.JMethodIDPtr) + /// from: `public void setHasAlpha(boolean z)` + void setHasAlpha( + bool z, + ) { + _setHasAlpha( + reference.pointer, _id_setHasAlpha as jni$_.JMethodIDPtr, z ? 1 : 0) .check(); } - static final _id_list = _class.instanceMethodId( - r'list', - r'()[Ljava/lang/String;', + static final _id_hasMipMap = _class.instanceMethodId( + r'hasMipMap', + r'()Z', ); - static final _list = jni$_.ProtectedJniExtensions.lookup< + static final _hasMipMap = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, - )>>('globalEnv_CallObjectMethod') + )>>('globalEnv_CallBooleanMethod') .asFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, )>(); - /// from: `public java.lang.String[] list()` - /// The returned object must be released after use, by calling the [release] method. - jni$_.JArray? list() { - return _list(reference.pointer, _id_list as jni$_.JMethodIDPtr) - .object?>( - const jni$_.JArrayNullableType( - jni$_.JStringNullableType())); + /// from: `public boolean hasMipMap()` + bool hasMipMap() { + return _hasMipMap(reference.pointer, _id_hasMipMap as jni$_.JMethodIDPtr) + .boolean; } - static final _id_list$1 = _class.instanceMethodId( - r'list', - r'(Ljava/io/FilenameFilter;)[Ljava/lang/String;', + static final _id_setHasMipMap = _class.instanceMethodId( + r'setHasMipMap', + r'(Z)V', ); - static final _list$1 = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - jni$_.VarArgs<(jni$_.Pointer,)>)>>( - 'globalEnv_CallObjectMethod') + static final _setHasMipMap = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallVoidMethod') .asFunction< - jni$_.JniResult Function(jni$_.Pointer, - jni$_.JMethodIDPtr, jni$_.Pointer)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); - /// from: `public java.lang.String[] list(java.io.FilenameFilter filenameFilter)` - /// The returned object must be released after use, by calling the [release] method. - jni$_.JArray? list$1( - jni$_.JObject? filenameFilter, + /// from: `public void setHasMipMap(boolean z)` + void setHasMipMap( + bool z, ) { - final _$filenameFilter = filenameFilter?.reference ?? jni$_.jNullReference; - return _list$1(reference.pointer, _id_list$1 as jni$_.JMethodIDPtr, - _$filenameFilter.pointer) - .object?>( - const jni$_.JArrayNullableType( - jni$_.JStringNullableType())); + _setHasMipMap(reference.pointer, _id_setHasMipMap as jni$_.JMethodIDPtr, + z ? 1 : 0) + .check(); } - static final _id_listFiles = _class.instanceMethodId( - r'listFiles', - r'()[Ljava/io/File;', + static final _id_getColorSpace = _class.instanceMethodId( + r'getColorSpace', + r'()Landroid/graphics/ColorSpace;', ); - static final _listFiles = jni$_.ProtectedJniExtensions.lookup< + static final _getColorSpace = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, @@ -2186,76 +3494,46 @@ class File extends jni$_.JObject { jni$_.JMethodIDPtr, )>(); - /// from: `public java.io.File[] listFiles()` - /// The returned object must be released after use, by calling the [release] method. - jni$_.JArray? listFiles() { - return _listFiles(reference.pointer, _id_listFiles as jni$_.JMethodIDPtr) - .object?>( - const jni$_.JArrayNullableType($File$NullableType())); - } - - static final _id_listFiles$1 = _class.instanceMethodId( - r'listFiles', - r'(Ljava/io/FilenameFilter;)[Ljava/io/File;', - ); - - static final _listFiles$1 = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - jni$_.VarArgs<(jni$_.Pointer,)>)>>( - 'globalEnv_CallObjectMethod') - .asFunction< - jni$_.JniResult Function(jni$_.Pointer, - jni$_.JMethodIDPtr, jni$_.Pointer)>(); - - /// from: `public java.io.File[] listFiles(java.io.FilenameFilter filenameFilter)` + /// from: `public android.graphics.ColorSpace getColorSpace()` /// The returned object must be released after use, by calling the [release] method. - jni$_.JArray? listFiles$1( - jni$_.JObject? filenameFilter, - ) { - final _$filenameFilter = filenameFilter?.reference ?? jni$_.jNullReference; - return _listFiles$1(reference.pointer, - _id_listFiles$1 as jni$_.JMethodIDPtr, _$filenameFilter.pointer) - .object?>( - const jni$_.JArrayNullableType($File$NullableType())); + jni$_.JObject? getColorSpace() { + return _getColorSpace( + reference.pointer, _id_getColorSpace as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } - static final _id_listFiles$2 = _class.instanceMethodId( - r'listFiles', - r'(Ljava/io/FileFilter;)[Ljava/io/File;', + static final _id_setColorSpace = _class.instanceMethodId( + r'setColorSpace', + r'(Landroid/graphics/ColorSpace;)V', ); - static final _listFiles$2 = jni$_.ProtectedJniExtensions.lookup< + static final _setColorSpace = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< - jni$_.JniResult Function( + jni$_.JThrowablePtr Function( jni$_.Pointer, jni$_.JMethodIDPtr, jni$_.VarArgs<(jni$_.Pointer,)>)>>( - 'globalEnv_CallObjectMethod') + 'globalEnv_CallVoidMethod') .asFunction< - jni$_.JniResult Function(jni$_.Pointer, + jni$_.JThrowablePtr Function(jni$_.Pointer, jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public java.io.File[] listFiles(java.io.FileFilter fileFilter)` - /// The returned object must be released after use, by calling the [release] method. - jni$_.JArray? listFiles$2( - jni$_.JObject? fileFilter, + /// from: `public void setColorSpace(android.graphics.ColorSpace colorSpace)` + void setColorSpace( + jni$_.JObject? colorSpace, ) { - final _$fileFilter = fileFilter?.reference ?? jni$_.jNullReference; - return _listFiles$2(reference.pointer, - _id_listFiles$2 as jni$_.JMethodIDPtr, _$fileFilter.pointer) - .object?>( - const jni$_.JArrayNullableType($File$NullableType())); + final _$colorSpace = colorSpace?.reference ?? jni$_.jNullReference; + _setColorSpace(reference.pointer, _id_setColorSpace as jni$_.JMethodIDPtr, + _$colorSpace.pointer) + .check(); } - static final _id_mkdir = _class.instanceMethodId( - r'mkdir', + static final _id_hasGainmap = _class.instanceMethodId( + r'hasGainmap', r'()Z', ); - static final _mkdir = jni$_.ProtectedJniExtensions.lookup< + static final _hasGainmap = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, @@ -2267,431 +3545,366 @@ class File extends jni$_.JObject { jni$_.JMethodIDPtr, )>(); - /// from: `public boolean mkdir()` - bool mkdir() { - return _mkdir(reference.pointer, _id_mkdir as jni$_.JMethodIDPtr).boolean; + /// from: `public boolean hasGainmap()` + bool hasGainmap() { + return _hasGainmap(reference.pointer, _id_hasGainmap as jni$_.JMethodIDPtr) + .boolean; } - static final _id_mkdirs = _class.instanceMethodId( - r'mkdirs', - r'()Z', + static final _id_getGainmap = _class.instanceMethodId( + r'getGainmap', + r'()Landroid/graphics/Gainmap;', ); - static final _mkdirs = jni$_.ProtectedJniExtensions.lookup< + static final _getGainmap = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, - )>>('globalEnv_CallBooleanMethod') + )>>('globalEnv_CallObjectMethod') .asFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, )>(); - /// from: `public boolean mkdirs()` - bool mkdirs() { - return _mkdirs(reference.pointer, _id_mkdirs as jni$_.JMethodIDPtr).boolean; + /// from: `public android.graphics.Gainmap getGainmap()` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? getGainmap() { + return _getGainmap(reference.pointer, _id_getGainmap as jni$_.JMethodIDPtr) + .object(const jni$_.JObjectNullableType()); } - static final _id_renameTo = _class.instanceMethodId( - r'renameTo', - r'(Ljava/io/File;)Z', + static final _id_setGainmap = _class.instanceMethodId( + r'setGainmap', + r'(Landroid/graphics/Gainmap;)V', ); - static final _renameTo = jni$_.ProtectedJniExtensions.lookup< + static final _setGainmap = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< - jni$_.JniResult Function( + jni$_.JThrowablePtr Function( jni$_.Pointer, jni$_.JMethodIDPtr, jni$_.VarArgs<(jni$_.Pointer,)>)>>( - 'globalEnv_CallBooleanMethod') + 'globalEnv_CallVoidMethod') .asFunction< - jni$_.JniResult Function(jni$_.Pointer, + jni$_.JThrowablePtr Function(jni$_.Pointer, jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public boolean renameTo(java.io.File file)` - bool renameTo( - File? file, + /// from: `public void setGainmap(android.graphics.Gainmap gainmap)` + void setGainmap( + jni$_.JObject? gainmap, ) { - final _$file = file?.reference ?? jni$_.jNullReference; - return _renameTo(reference.pointer, _id_renameTo as jni$_.JMethodIDPtr, - _$file.pointer) - .boolean; + final _$gainmap = gainmap?.reference ?? jni$_.jNullReference; + _setGainmap(reference.pointer, _id_setGainmap as jni$_.JMethodIDPtr, + _$gainmap.pointer) + .check(); } - static final _id_setLastModified = _class.instanceMethodId( - r'setLastModified', - r'(J)Z', + static final _id_eraseColor = _class.instanceMethodId( + r'eraseColor', + r'(I)V', ); - static final _setLastModified = jni$_.ProtectedJniExtensions.lookup< + static final _eraseColor = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< - jni$_.JniResult Function( + jni$_.JThrowablePtr Function( jni$_.Pointer, jni$_.JMethodIDPtr, - jni$_ - .VarArgs<(jni$_.Int64,)>)>>('globalEnv_CallBooleanMethod') + jni$_.VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallVoidMethod') .asFunction< - jni$_.JniResult Function( + jni$_.JThrowablePtr Function( jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); - /// from: `public boolean setLastModified(long j)` - bool setLastModified( - int j, + /// from: `public void eraseColor(int i)` + void eraseColor( + int i, ) { - return _setLastModified( - reference.pointer, _id_setLastModified as jni$_.JMethodIDPtr, j) - .boolean; + _eraseColor(reference.pointer, _id_eraseColor as jni$_.JMethodIDPtr, i) + .check(); } - static final _id_setReadOnly = _class.instanceMethodId( - r'setReadOnly', - r'()Z', + static final _id_eraseColor$1 = _class.instanceMethodId( + r'eraseColor', + r'(J)V', ); - static final _setReadOnly = jni$_.ProtectedJniExtensions.lookup< + static final _eraseColor$1 = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>>('globalEnv_CallBooleanMethod') + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.VarArgs<(jni$_.Int64,)>)>>('globalEnv_CallVoidMethod') .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); - /// from: `public boolean setReadOnly()` - bool setReadOnly() { - return _setReadOnly( - reference.pointer, _id_setReadOnly as jni$_.JMethodIDPtr) - .boolean; + /// from: `public void eraseColor(long j)` + void eraseColor$1( + int j, + ) { + _eraseColor$1(reference.pointer, _id_eraseColor$1 as jni$_.JMethodIDPtr, j) + .check(); } - static final _id_setWritable = _class.instanceMethodId( - r'setWritable', - r'(ZZ)Z', + static final _id_getPixel = _class.instanceMethodId( + r'getPixel', + r'(II)I', ); - static final _setWritable = jni$_.ProtectedJniExtensions.lookup< + static final _getPixel = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, jni$_.VarArgs<(jni$_.Int32, jni$_.Int32)>)>>( - 'globalEnv_CallBooleanMethod') + 'globalEnv_CallIntMethod') .asFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, int, int)>(); - /// from: `public boolean setWritable(boolean z, boolean z1)` - bool setWritable( - bool z, - bool z1, - ) { - return _setWritable(reference.pointer, - _id_setWritable as jni$_.JMethodIDPtr, z ? 1 : 0, z1 ? 1 : 0) - .boolean; - } - - static final _id_setWritable$1 = _class.instanceMethodId( - r'setWritable', - r'(Z)Z', - ); - - static final _setWritable$1 = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - jni$_ - .VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallBooleanMethod') - .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); - - /// from: `public boolean setWritable(boolean z)` - bool setWritable$1( - bool z, + /// from: `public int getPixel(int i, int i1)` + int getPixel( + int i, + int i1, ) { - return _setWritable$1(reference.pointer, - _id_setWritable$1 as jni$_.JMethodIDPtr, z ? 1 : 0) - .boolean; + return _getPixel( + reference.pointer, _id_getPixel as jni$_.JMethodIDPtr, i, i1) + .integer; } - static final _id_setReadable = _class.instanceMethodId( - r'setReadable', - r'(ZZ)Z', + static final _id_getColor = _class.instanceMethodId( + r'getColor', + r'(II)Landroid/graphics/Color;', ); - static final _setReadable = jni$_.ProtectedJniExtensions.lookup< + static final _getColor = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, jni$_.VarArgs<(jni$_.Int32, jni$_.Int32)>)>>( - 'globalEnv_CallBooleanMethod') + 'globalEnv_CallObjectMethod') .asFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, int, int)>(); - /// from: `public boolean setReadable(boolean z, boolean z1)` - bool setReadable( - bool z, - bool z1, + /// from: `public android.graphics.Color getColor(int i, int i1)` + /// The returned object must be released after use, by calling the [release] method. + jni$_.JObject? getColor( + int i, + int i1, ) { - return _setReadable(reference.pointer, - _id_setReadable as jni$_.JMethodIDPtr, z ? 1 : 0, z1 ? 1 : 0) - .boolean; + return _getColor( + reference.pointer, _id_getColor as jni$_.JMethodIDPtr, i, i1) + .object(const jni$_.JObjectNullableType()); } - static final _id_setReadable$1 = _class.instanceMethodId( - r'setReadable', - r'(Z)Z', + static final _id_getPixels = _class.instanceMethodId( + r'getPixels', + r'([IIIIIII)V', ); - static final _setReadable$1 = jni$_.ProtectedJniExtensions.lookup< + static final _getPixels = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< - jni$_.JniResult Function( + jni$_.JThrowablePtr Function( jni$_.Pointer, jni$_.JMethodIDPtr, - jni$_ - .VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallBooleanMethod') + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32 + )>)>>('globalEnv_CallVoidMethod') .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + int, + int, + int, + int, + int, + int)>(); - /// from: `public boolean setReadable(boolean z)` - bool setReadable$1( - bool z, + /// from: `public void getPixels(int[] is, int i, int i1, int i2, int i3, int i4, int i5)` + void getPixels( + jni$_.JIntArray? is$, + int i, + int i1, + int i2, + int i3, + int i4, + int i5, ) { - return _setReadable$1(reference.pointer, - _id_setReadable$1 as jni$_.JMethodIDPtr, z ? 1 : 0) - .boolean; + final _$is$ = is$?.reference ?? jni$_.jNullReference; + _getPixels(reference.pointer, _id_getPixels as jni$_.JMethodIDPtr, + _$is$.pointer, i, i1, i2, i3, i4, i5) + .check(); } - static final _id_setExecutable = _class.instanceMethodId( - r'setExecutable', - r'(ZZ)Z', + static final _id_setPixel = _class.instanceMethodId( + r'setPixel', + r'(III)V', ); - static final _setExecutable = jni$_.ProtectedJniExtensions.lookup< + static final _setPixel = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< - jni$_.JniResult Function( + jni$_.JThrowablePtr Function( jni$_.Pointer, jni$_.JMethodIDPtr, - jni$_.VarArgs<(jni$_.Int32, jni$_.Int32)>)>>( - 'globalEnv_CallBooleanMethod') + jni$_.VarArgs<(jni$_.Int32, jni$_.Int32, jni$_.Int32)>)>>( + 'globalEnv_CallVoidMethod') .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, jni$_.JMethodIDPtr, int, int)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, jni$_.JMethodIDPtr, int, int, int)>(); - /// from: `public boolean setExecutable(boolean z, boolean z1)` - bool setExecutable( - bool z, - bool z1, + /// from: `public void setPixel(int i, int i1, int i2)` + void setPixel( + int i, + int i1, + int i2, ) { - return _setExecutable(reference.pointer, - _id_setExecutable as jni$_.JMethodIDPtr, z ? 1 : 0, z1 ? 1 : 0) - .boolean; + _setPixel(reference.pointer, _id_setPixel as jni$_.JMethodIDPtr, i, i1, i2) + .check(); } - static final _id_setExecutable$1 = _class.instanceMethodId( - r'setExecutable', - r'(Z)Z', + static final _id_setPixels = _class.instanceMethodId( + r'setPixels', + r'([IIIIIII)V', ); - static final _setExecutable$1 = jni$_.ProtectedJniExtensions.lookup< + static final _setPixels = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< - jni$_.JniResult Function( + jni$_.JThrowablePtr Function( jni$_.Pointer, jni$_.JMethodIDPtr, - jni$_ - .VarArgs<(jni$_.Int32,)>)>>('globalEnv_CallBooleanMethod') + jni$_.VarArgs< + ( + jni$_.Pointer, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32, + jni$_.Int32 + )>)>>('globalEnv_CallVoidMethod') .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, jni$_.JMethodIDPtr, int)>(); + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_.Pointer, + int, + int, + int, + int, + int, + int)>(); - /// from: `public boolean setExecutable(boolean z)` - bool setExecutable$1( - bool z, + /// from: `public void setPixels(int[] is, int i, int i1, int i2, int i3, int i4, int i5)` + void setPixels( + jni$_.JIntArray? is$, + int i, + int i1, + int i2, + int i3, + int i4, + int i5, ) { - return _setExecutable$1(reference.pointer, - _id_setExecutable$1 as jni$_.JMethodIDPtr, z ? 1 : 0) - .boolean; - } - - static final _id_canExecute = _class.instanceMethodId( - r'canExecute', - r'()Z', - ); - - static final _canExecute = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>>('globalEnv_CallBooleanMethod') - .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>(); - - /// from: `public boolean canExecute()` - bool canExecute() { - return _canExecute(reference.pointer, _id_canExecute as jni$_.JMethodIDPtr) - .boolean; - } - - static final _id_listRoots = _class.staticMethodId( - r'listRoots', - r'()[Ljava/io/File;', - ); - - static final _listRoots = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>>('globalEnv_CallStaticObjectMethod') - .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>(); - - /// from: `static public java.io.File[] listRoots()` - /// The returned object must be released after use, by calling the [release] method. - static jni$_.JArray? listRoots() { - return _listRoots( - _class.reference.pointer, _id_listRoots as jni$_.JMethodIDPtr) - .object?>( - const jni$_.JArrayNullableType($File$NullableType())); + final _$is$ = is$?.reference ?? jni$_.jNullReference; + _setPixels(reference.pointer, _id_setPixels as jni$_.JMethodIDPtr, + _$is$.pointer, i, i1, i2, i3, i4, i5) + .check(); } - static final _id_getTotalSpace = _class.instanceMethodId( - r'getTotalSpace', - r'()J', + static final _id_describeContents = _class.instanceMethodId( + r'describeContents', + r'()I', ); - static final _getTotalSpace = jni$_.ProtectedJniExtensions.lookup< + static final _describeContents = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, - )>>('globalEnv_CallLongMethod') + )>>('globalEnv_CallIntMethod') .asFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, )>(); - /// from: `public long getTotalSpace()` - int getTotalSpace() { - return _getTotalSpace( - reference.pointer, _id_getTotalSpace as jni$_.JMethodIDPtr) - .long; + /// from: `public int describeContents()` + int describeContents() { + return _describeContents( + reference.pointer, _id_describeContents as jni$_.JMethodIDPtr) + .integer; } - static final _id_getFreeSpace = _class.instanceMethodId( - r'getFreeSpace', - r'()J', + static final _id_writeToParcel = _class.instanceMethodId( + r'writeToParcel', + r'(Landroid/os/Parcel;I)V', ); - static final _getFreeSpace = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>>('globalEnv_CallLongMethod') + static final _writeToParcel = jni$_.ProtectedJniExtensions.lookup< + jni$_.NativeFunction< + jni$_.JThrowablePtr Function( + jni$_.Pointer, + jni$_.JMethodIDPtr, + jni$_ + .VarArgs<(jni$_.Pointer, jni$_.Int32)>)>>( + 'globalEnv_CallVoidMethod') .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>(); + jni$_.JThrowablePtr Function(jni$_.Pointer, + jni$_.JMethodIDPtr, jni$_.Pointer, int)>(); - /// from: `public long getFreeSpace()` - int getFreeSpace() { - return _getFreeSpace( - reference.pointer, _id_getFreeSpace as jni$_.JMethodIDPtr) - .long; + /// from: `public void writeToParcel(android.os.Parcel parcel, int i)` + void writeToParcel( + jni$_.JObject? parcel, + int i, + ) { + final _$parcel = parcel?.reference ?? jni$_.jNullReference; + _writeToParcel(reference.pointer, _id_writeToParcel as jni$_.JMethodIDPtr, + _$parcel.pointer, i) + .check(); } - static final _id_getUsableSpace = _class.instanceMethodId( - r'getUsableSpace', - r'()J', + static final _id_extractAlpha = _class.instanceMethodId( + r'extractAlpha', + r'()Landroid/graphics/Bitmap;', ); - static final _getUsableSpace = jni$_.ProtectedJniExtensions.lookup< + static final _extractAlpha = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, - )>>('globalEnv_CallLongMethod') + )>>('globalEnv_CallObjectMethod') .asFunction< jni$_.JniResult Function( jni$_.Pointer, jni$_.JMethodIDPtr, )>(); - /// from: `public long getUsableSpace()` - int getUsableSpace() { - return _getUsableSpace( - reference.pointer, _id_getUsableSpace as jni$_.JMethodIDPtr) - .long; - } - - static final _id_createTempFile = _class.staticMethodId( - r'createTempFile', - r'(Ljava/lang/String;Ljava/lang/String;Ljava/io/File;)Ljava/io/File;', - ); - - static final _createTempFile = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - jni$_.VarArgs< - ( - jni$_.Pointer, - jni$_.Pointer, - jni$_.Pointer - )>)>>('globalEnv_CallStaticObjectMethod') - .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - jni$_.Pointer, - jni$_.Pointer, - jni$_.Pointer)>(); - - /// from: `static public java.io.File createTempFile(java.lang.String string, java.lang.String string1, java.io.File file)` + /// from: `public android.graphics.Bitmap extractAlpha()` /// The returned object must be released after use, by calling the [release] method. - static File? createTempFile( - jni$_.JString? string, - jni$_.JString? string1, - File? file, - ) { - final _$string = string?.reference ?? jni$_.jNullReference; - final _$string1 = string1?.reference ?? jni$_.jNullReference; - final _$file = file?.reference ?? jni$_.jNullReference; - return _createTempFile( - _class.reference.pointer, - _id_createTempFile as jni$_.JMethodIDPtr, - _$string.pointer, - _$string1.pointer, - _$file.pointer) - .object(const $File$NullableType()); + Bitmap? extractAlpha() { + return _extractAlpha( + reference.pointer, _id_extractAlpha as jni$_.JMethodIDPtr) + .object(const $Bitmap$NullableType()); } - static final _id_createTempFile$1 = _class.staticMethodId( - r'createTempFile', - r'(Ljava/lang/String;Ljava/lang/String;)Ljava/io/File;', + static final _id_extractAlpha$1 = _class.instanceMethodId( + r'extractAlpha', + r'(Landroid/graphics/Paint;[I)Landroid/graphics/Bitmap;', ); - static final _createTempFile$1 = jni$_.ProtectedJniExtensions.lookup< + static final _extractAlpha$1 = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, @@ -2700,7 +3913,7 @@ class File extends jni$_.JObject { ( jni$_.Pointer, jni$_.Pointer - )>)>>('globalEnv_CallStaticObjectMethod') + )>)>>('globalEnv_CallObjectMethod') .asFunction< jni$_.JniResult Function( jni$_.Pointer, @@ -2708,54 +3921,28 @@ class File extends jni$_.JObject { jni$_.Pointer, jni$_.Pointer)>(); - /// from: `static public java.io.File createTempFile(java.lang.String string, java.lang.String string1)` + /// from: `public android.graphics.Bitmap extractAlpha(android.graphics.Paint paint, int[] is)` /// The returned object must be released after use, by calling the [release] method. - static File? createTempFile$1( - jni$_.JString? string, - jni$_.JString? string1, - ) { - final _$string = string?.reference ?? jni$_.jNullReference; - final _$string1 = string1?.reference ?? jni$_.jNullReference; - return _createTempFile$1( - _class.reference.pointer, - _id_createTempFile$1 as jni$_.JMethodIDPtr, - _$string.pointer, - _$string1.pointer) - .object(const $File$NullableType()); - } - - static final _id_compareTo = _class.instanceMethodId( - r'compareTo', - r'(Ljava/io/File;)I', - ); - - static final _compareTo = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - jni$_.VarArgs<(jni$_.Pointer,)>)>>( - 'globalEnv_CallIntMethod') - .asFunction< - jni$_.JniResult Function(jni$_.Pointer, - jni$_.JMethodIDPtr, jni$_.Pointer)>(); - - /// from: `public int compareTo(java.io.File file)` - int compareTo( - File? file, + Bitmap? extractAlpha$1( + jni$_.JObject? paint, + jni$_.JIntArray? is$, ) { - final _$file = file?.reference ?? jni$_.jNullReference; - return _compareTo(reference.pointer, _id_compareTo as jni$_.JMethodIDPtr, - _$file.pointer) - .integer; + final _$paint = paint?.reference ?? jni$_.jNullReference; + final _$is$ = is$?.reference ?? jni$_.jNullReference; + return _extractAlpha$1( + reference.pointer, + _id_extractAlpha$1 as jni$_.JMethodIDPtr, + _$paint.pointer, + _$is$.pointer) + .object(const $Bitmap$NullableType()); } - static final _id_equals = _class.instanceMethodId( - r'equals', - r'(Ljava/lang/Object;)Z', + static final _id_sameAs = _class.instanceMethodId( + r'sameAs', + r'(Landroid/graphics/Bitmap;)Z', ); - static final _equals = jni$_.ProtectedJniExtensions.lookup< + static final _sameAs = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, @@ -2766,69 +3953,45 @@ class File extends jni$_.JObject { jni$_.JniResult Function(jni$_.Pointer, jni$_.JMethodIDPtr, jni$_.Pointer)>(); - /// from: `public boolean equals(java.lang.Object object)` - bool equals( - jni$_.JObject? object, + /// from: `public boolean sameAs(android.graphics.Bitmap bitmap)` + bool sameAs( + Bitmap? bitmap, ) { - final _$object = object?.reference ?? jni$_.jNullReference; - return _equals(reference.pointer, _id_equals as jni$_.JMethodIDPtr, - _$object.pointer) + final _$bitmap = bitmap?.reference ?? jni$_.jNullReference; + return _sameAs(reference.pointer, _id_sameAs as jni$_.JMethodIDPtr, + _$bitmap.pointer) .boolean; } - static final _id_hashCode$1 = _class.instanceMethodId( - r'hashCode', - r'()I', - ); - - static final _hashCode$1 = jni$_.ProtectedJniExtensions.lookup< - jni$_.NativeFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>>('globalEnv_CallIntMethod') - .asFunction< - jni$_.JniResult Function( - jni$_.Pointer, - jni$_.JMethodIDPtr, - )>(); - - /// from: `public int hashCode()` - int hashCode$1() { - return _hashCode$1(reference.pointer, _id_hashCode$1 as jni$_.JMethodIDPtr) - .integer; - } - - static final _id_toString$1 = _class.instanceMethodId( - r'toString', - r'()Ljava/lang/String;', + static final _id_prepareToDraw = _class.instanceMethodId( + r'prepareToDraw', + r'()V', ); - static final _toString$1 = jni$_.ProtectedJniExtensions.lookup< + static final _prepareToDraw = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< - jni$_.JniResult Function( + jni$_.JThrowablePtr Function( jni$_.Pointer, jni$_.JMethodIDPtr, - )>>('globalEnv_CallObjectMethod') + )>>('globalEnv_CallVoidMethod') .asFunction< - jni$_.JniResult Function( + jni$_.JThrowablePtr Function( jni$_.Pointer, jni$_.JMethodIDPtr, )>(); - /// from: `public java.lang.String toString()` - /// The returned object must be released after use, by calling the [release] method. - jni$_.JString? toString$1() { - return _toString$1(reference.pointer, _id_toString$1 as jni$_.JMethodIDPtr) - .object(const jni$_.JStringNullableType()); + /// from: `public void prepareToDraw()` + void prepareToDraw() { + _prepareToDraw(reference.pointer, _id_prepareToDraw as jni$_.JMethodIDPtr) + .check(); } - static final _id_toPath = _class.instanceMethodId( - r'toPath', - r'()Ljava/nio/file/Path;', + static final _id_getHardwareBuffer = _class.instanceMethodId( + r'getHardwareBuffer', + r'()Landroid/hardware/HardwareBuffer;', ); - static final _toPath = jni$_.ProtectedJniExtensions.lookup< + static final _getHardwareBuffer = jni$_.ProtectedJniExtensions.lookup< jni$_.NativeFunction< jni$_.JniResult Function( jni$_.Pointer, @@ -2840,27 +4003,28 @@ class File extends jni$_.JObject { jni$_.JMethodIDPtr, )>(); - /// from: `public java.nio.file.Path toPath()` + /// from: `public android.hardware.HardwareBuffer getHardwareBuffer()` /// The returned object must be released after use, by calling the [release] method. - jni$_.JObject? toPath() { - return _toPath(reference.pointer, _id_toPath as jni$_.JMethodIDPtr) + jni$_.JObject? getHardwareBuffer() { + return _getHardwareBuffer( + reference.pointer, _id_getHardwareBuffer as jni$_.JMethodIDPtr) .object(const jni$_.JObjectNullableType()); } } -final class $File$NullableType extends jni$_.JObjType { +final class $Bitmap$NullableType extends jni$_.JObjType { @jni$_.internal - const $File$NullableType(); + const $Bitmap$NullableType(); @jni$_.internal @core$_.override - String get signature => r'Ljava/io/File;'; + String get signature => r'Landroid/graphics/Bitmap;'; @jni$_.internal @core$_.override - File? fromReference(jni$_.JReference reference) => reference.isNull + Bitmap? fromReference(jni$_.JReference reference) => reference.isNull ? null - : File.fromReference( + : Bitmap.fromReference( reference, ); @jni$_.internal @@ -2869,33 +4033,33 @@ final class $File$NullableType extends jni$_.JObjType { @jni$_.internal @core$_.override - jni$_.JObjType get nullableType => this; + jni$_.JObjType get nullableType => this; @jni$_.internal @core$_.override final superCount = 1; @core$_.override - int get hashCode => ($File$NullableType).hashCode; + int get hashCode => ($Bitmap$NullableType).hashCode; @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($File$NullableType) && - other is $File$NullableType; + return other.runtimeType == ($Bitmap$NullableType) && + other is $Bitmap$NullableType; } } -final class $File$Type extends jni$_.JObjType { +final class $Bitmap$Type extends jni$_.JObjType { @jni$_.internal - const $File$Type(); + const $Bitmap$Type(); @jni$_.internal @core$_.override - String get signature => r'Ljava/io/File;'; + String get signature => r'Landroid/graphics/Bitmap;'; @jni$_.internal @core$_.override - File fromReference(jni$_.JReference reference) => File.fromReference( + Bitmap fromReference(jni$_.JReference reference) => Bitmap.fromReference( reference, ); @jni$_.internal @@ -2904,17 +4068,17 @@ final class $File$Type extends jni$_.JObjType { @jni$_.internal @core$_.override - jni$_.JObjType get nullableType => const $File$NullableType(); + jni$_.JObjType get nullableType => const $Bitmap$NullableType(); @jni$_.internal @core$_.override final superCount = 1; @core$_.override - int get hashCode => ($File$Type).hashCode; + int get hashCode => ($Bitmap$Type).hashCode; @core$_.override bool operator ==(Object other) { - return other.runtimeType == ($File$Type) && other is $File$Type; + return other.runtimeType == ($Bitmap$Type) && other is $Bitmap$Type; } } diff --git a/flutter/lib/src/native/java/sentry_native_java.dart b/flutter/lib/src/native/java/sentry_native_java.dart index 60d537e372..154902017e 100644 --- a/flutter/lib/src/native/java/sentry_native_java.dart +++ b/flutter/lib/src/native/java/sentry_native_java.dart @@ -33,9 +33,8 @@ class SentryNativeJava extends SentryNativeChannel { final nativeReplay = native.SentryFlutterPlugin$Companion(null) .privateSentryGetReplayIntegration()!; - _replayRecorder = AndroidReplayRecorder(config, options, - nativeReplay, call.arguments['directory'] as String) - ..start(); + _replayRecorder = + AndroidReplayRecorder(config, options, nativeReplay)..start(); hub.configureScope((s) { // ignore: invalid_use_of_internal_member From a87e80fc72c749c404e58c1b1db3c882210d8938 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Fri, 7 Feb 2025 19:04:36 +0100 Subject: [PATCH 04/24] move all native to android_replay_recorder --- flutter/lib/src/native/java/android_replay_recorder.dart | 4 +++- flutter/lib/src/native/java/sentry_native_java.dart | 7 +------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/flutter/lib/src/native/java/android_replay_recorder.dart b/flutter/lib/src/native/java/android_replay_recorder.dart index 875994a3c1..63f1143cde 100644 --- a/flutter/lib/src/native/java/android_replay_recorder.dart +++ b/flutter/lib/src/native/java/android_replay_recorder.dart @@ -10,8 +10,10 @@ import 'binding.dart' as native; class AndroidReplayRecorder extends ScheduledScreenshotRecorder { late final native.ReplayIntegration _nativeReplay; - AndroidReplayRecorder(super.config, super.options, this._nativeReplay) { + AndroidReplayRecorder(super.config, super.options) { super.callback = _addReplayScreenshot; + _nativeReplay = native.SentryFlutterPlugin$Companion(null) + .privateSentryGetReplayIntegration()!; } Future _addReplayScreenshot( diff --git a/flutter/lib/src/native/java/sentry_native_java.dart b/flutter/lib/src/native/java/sentry_native_java.dart index 154902017e..e1447191e4 100644 --- a/flutter/lib/src/native/java/sentry_native_java.dart +++ b/flutter/lib/src/native/java/sentry_native_java.dart @@ -4,7 +4,6 @@ import '../../../sentry_flutter.dart'; import '../../replay/scheduled_recorder_config.dart'; import '../sentry_native_channel.dart'; import 'android_replay_recorder.dart'; -import 'binding.dart' as native; @internal class SentryNativeJava extends SentryNativeChannel { @@ -30,11 +29,7 @@ class SentryNativeJava extends SentryNativeChannel { height: (call.arguments['height'] as num).toDouble(), frameRate: call.arguments['frameRate'] as int); - final nativeReplay = native.SentryFlutterPlugin$Companion(null) - .privateSentryGetReplayIntegration()!; - - _replayRecorder = - AndroidReplayRecorder(config, options, nativeReplay)..start(); + _replayRecorder = AndroidReplayRecorder(config, options)..start(); hub.configureScope((s) { // ignore: invalid_use_of_internal_member From b20afac37d328232f8fb5d683a286b3adc274065 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 10 Feb 2025 08:28:43 +0100 Subject: [PATCH 05/24] android screenshot isolate --- .../native/java/android_replay_recorder.dart | 59 ++++++++++--------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/flutter/lib/src/native/java/android_replay_recorder.dart b/flutter/lib/src/native/java/android_replay_recorder.dart index 63f1143cde..5c1e8aee8a 100644 --- a/flutter/lib/src/native/java/android_replay_recorder.dart +++ b/flutter/lib/src/native/java/android_replay_recorder.dart @@ -1,3 +1,5 @@ +import 'dart:isolate'; + import 'package:jni/jni.dart'; import 'package:meta/meta.dart'; @@ -8,12 +10,11 @@ import 'binding.dart' as native; @internal class AndroidReplayRecorder extends ScheduledScreenshotRecorder { - late final native.ReplayIntegration _nativeReplay; + static final _nativeReplay = native.SentryFlutterPlugin$Companion(null) + .privateSentryGetReplayIntegration()!; AndroidReplayRecorder(super.config, super.options) { super.callback = _addReplayScreenshot; - _nativeReplay = native.SentryFlutterPlugin$Companion(null) - .privateSentryGetReplayIntegration()!; } Future _addReplayScreenshot( @@ -29,33 +30,17 @@ class AndroidReplayRecorder extends ScheduledScreenshotRecorder { '${screenshot.width}x${screenshot.height} pixels, ' '${data.lengthInBytes} bytes)'); - using((arena) { - // https://developer.android.com/reference/android/graphics/Bitmap#createBitmap(int,%20int,%20android.graphics.Bitmap.Config) - final jBitmap = native.Bitmap.createBitmap$3( - screenshot.width, - screenshot.height, - native.Bitmap$Config.ARGB_8888, - )?..releasedBy(arena); - if (jBitmap == null) { - options.logger( - SentryLevel.warning, - '$logName: failed to create native Bitmap', - ); - return; - } - - // TODO this uses setAll() which is slow, change to memcpy or ideally use Uint8List directly. - final jBuffer = JByteBuffer.fromList(data.buffer.asUint8List()); - try { - jBitmap.copyPixelsFromBuffer(jBuffer); - } finally { - jBuffer.release(); - } - _nativeReplay.onScreenshotRecorded(jBitmap); - }); + // TODO evaluate setAll() performance, consider memcpy. + final jBuffer = JByteBuffer.fromList(data.buffer.asUint8List()); + int width = screenshot.width; + int height = screenshot.height; - // _nativeReplay.onScreenshotRecorded$1( - // native.File(filePath.toJString()), timestamp); + // TODO possible future improvements: + // - long-lived isolate + // - store Bitmap (creation is a bit expensive) and only refresh when the resolution changes + await Isolate.run( + () => _addReplayScreenshotNative(jBuffer, width, height), + debugName: 'SentryReplayRecorder'); } catch (error, stackTrace) { options.logger( SentryLevel.error, @@ -68,4 +53,20 @@ class AndroidReplayRecorder extends ScheduledScreenshotRecorder { } } } + + static void _addReplayScreenshotNative( + JByteBuffer jBuffer, int width, int height) { + using((arena) { + // https://developer.android.com/reference/android/graphics/Bitmap#createBitmap(int,%20int,%20android.graphics.Bitmap.Config) + final jBitmap = native.Bitmap.createBitmap$3( + width, height, native.Bitmap$Config.ARGB_8888)! + ..releasedBy(arena); + try { + jBitmap.copyPixelsFromBuffer(jBuffer); + } finally { + jBuffer.release(); + } + _nativeReplay.onScreenshotRecorded(jBitmap); + }); + } } From c7acf2d9f92e0f95a6e9e506e2ac4031c484f6ec Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 10 Feb 2025 09:34:48 +0100 Subject: [PATCH 06/24] cleanup --- .../native/java/android_replay_recorder.dart | 49 ++++++++++++------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/flutter/lib/src/native/java/android_replay_recorder.dart b/flutter/lib/src/native/java/android_replay_recorder.dart index 5c1e8aee8a..1505bf8020 100644 --- a/flutter/lib/src/native/java/android_replay_recorder.dart +++ b/flutter/lib/src/native/java/android_replay_recorder.dart @@ -10,8 +10,10 @@ import 'binding.dart' as native; @internal class AndroidReplayRecorder extends ScheduledScreenshotRecorder { - static final _nativeReplay = native.SentryFlutterPlugin$Companion(null) + late final _nativeReplay = native.SentryFlutterPlugin$Companion(null) .privateSentryGetReplayIntegration()!; + // Android Bitmap creation is a bit costly so we reuse it between captures. + native.Bitmap? _bitmap; AndroidReplayRecorder(super.config, super.options) { super.callback = _addReplayScreenshot; @@ -35,9 +37,7 @@ class AndroidReplayRecorder extends ScheduledScreenshotRecorder { int width = screenshot.width; int height = screenshot.height; - // TODO possible future improvements: - // - long-lived isolate - // - store Bitmap (creation is a bit expensive) and only refresh when the resolution changes + // Note: possible future improvement: long-lived isolate await Isolate.run( () => _addReplayScreenshotNative(jBuffer, width, height), debugName: 'SentryReplayRecorder'); @@ -54,19 +54,34 @@ class AndroidReplayRecorder extends ScheduledScreenshotRecorder { } } - static void _addReplayScreenshotNative( - JByteBuffer jBuffer, int width, int height) { - using((arena) { - // https://developer.android.com/reference/android/graphics/Bitmap#createBitmap(int,%20int,%20android.graphics.Bitmap.Config) - final jBitmap = native.Bitmap.createBitmap$3( - width, height, native.Bitmap$Config.ARGB_8888)! - ..releasedBy(arena); - try { - jBitmap.copyPixelsFromBuffer(jBuffer); - } finally { - jBuffer.release(); + @override + Future stop() async { + await super.stop(); + _bitmap?.release(); + _bitmap = null; + } + + void _addReplayScreenshotNative(JByteBuffer jBuffer, int width, int height) { + if (_bitmap != null) { + if (_bitmap!.getWidth() != width || _bitmap!.getHeight() != height) { + _bitmap!.release(); + _bitmap = null; } - _nativeReplay.onScreenshotRecorded(jBitmap); - }); + } + + // https://developer.android.com/reference/android/graphics/Bitmap#createBitmap(int,%20int,%20android.graphics.Bitmap.Config) + // Note: in the currently generated API this may return null so we null-check below. + _bitmap ??= native.Bitmap.createBitmap$3( + width, height, native.Bitmap$Config.ARGB_8888); + + try { + _bitmap?.copyPixelsFromBuffer(jBuffer); + } finally { + jBuffer.release(); + } + + if (_bitmap != null) { + _nativeReplay.onScreenshotRecorded(_bitmap!); + } } } From f17c72deee98ccdb099e926d719a6db307639987 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 10 Feb 2025 11:09:21 +0100 Subject: [PATCH 07/24] use persistent isolate --- .../native/java/android_replay_recorder.dart | 182 +++++++++++++++--- .../src/native/java/sentry_native_java.dart | 3 +- 2 files changed, 153 insertions(+), 32 deletions(-) diff --git a/flutter/lib/src/native/java/android_replay_recorder.dart b/flutter/lib/src/native/java/android_replay_recorder.dart index 1505bf8020..da7e08748e 100644 --- a/flutter/lib/src/native/java/android_replay_recorder.dart +++ b/flutter/lib/src/native/java/android_replay_recorder.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:isolate'; import 'package:jni/jni.dart'; @@ -10,19 +11,30 @@ import 'binding.dart' as native; @internal class AndroidReplayRecorder extends ScheduledScreenshotRecorder { - late final _nativeReplay = native.SentryFlutterPlugin$Companion(null) - .privateSentryGetReplayIntegration()!; - // Android Bitmap creation is a bit costly so we reuse it between captures. - native.Bitmap? _bitmap; + _AndroidNativeReplayWorker? _worker; AndroidReplayRecorder(super.config, super.options) { super.callback = _addReplayScreenshot; } + @override + Future start() async { + final spawningWorker = _AndroidNativeReplayWorker.spawn(); + super.start(); + _worker = await spawningWorker; + } + + @override + Future stop() async { + await super.stop(); + _worker?.close(); + _worker = null; + } + Future _addReplayScreenshot( Screenshot screenshot, bool isNewlyCaptured) async { // TODO this is currently missing in native onScreenshotRecorded() - // final timestamp = screenshot.timestamp.millisecondsSinceEpoch; + final timestamp = screenshot.timestamp.millisecondsSinceEpoch; try { final data = await screenshot.rawRgbaData; @@ -37,10 +49,11 @@ class AndroidReplayRecorder extends ScheduledScreenshotRecorder { int width = screenshot.width; int height = screenshot.height; - // Note: possible future improvement: long-lived isolate - await Isolate.run( - () => _addReplayScreenshotNative(jBuffer, width, height), - debugName: 'SentryReplayRecorder'); + await _worker!.nativeAddScreenshot(_WorkItem( + timestamp: timestamp, + jBuffer: jBuffer, + width: width, + height: height)); } catch (error, stackTrace) { options.logger( SentryLevel.error, @@ -53,35 +66,142 @@ class AndroidReplayRecorder extends ScheduledScreenshotRecorder { } } } +} - @override - Future stop() async { - await super.stop(); - _bitmap?.release(); - _bitmap = null; - } +// Based on https://dart.dev/language/isolates#robust-ports-example +class _AndroidNativeReplayWorker { + final SendPort _commands; + final ReceivePort _responses; + final Map> _activeRequests = {}; + int _idCounter = 0; + bool _closed = false; - void _addReplayScreenshotNative(JByteBuffer jBuffer, int width, int height) { - if (_bitmap != null) { - if (_bitmap!.getWidth() != width || _bitmap!.getHeight() != height) { - _bitmap!.release(); - _bitmap = null; - } + static Future<_AndroidNativeReplayWorker> spawn() async { + // Create a receive port and add its initial message handler + final initPort = RawReceivePort(); + final connection = Completer<(ReceivePort, SendPort)>.sync(); + initPort.handler = (SendPort commandPort) { + connection.complete(( + ReceivePort.fromRawReceivePort(initPort), + commandPort, + )); + }; + + // Spawn the isolate. + try { + await Isolate.spawn(_startRemoteIsolate, (initPort.sendPort), + debugName: 'SentryReplayRecorder'); + } on Object { + initPort.close(); + rethrow; } - // https://developer.android.com/reference/android/graphics/Bitmap#createBitmap(int,%20int,%20android.graphics.Bitmap.Config) - // Note: in the currently generated API this may return null so we null-check below. - _bitmap ??= native.Bitmap.createBitmap$3( - width, height, native.Bitmap$Config.ARGB_8888); + final (ReceivePort receivePort, SendPort sendPort) = + await connection.future; - try { - _bitmap?.copyPixelsFromBuffer(jBuffer); - } finally { - jBuffer.release(); + return _AndroidNativeReplayWorker._(receivePort, sendPort); + } + + _AndroidNativeReplayWorker._(this._responses, this._commands) { + _responses.listen(_handleResponsesFromIsolate); + } + + Future nativeAddScreenshot(_WorkItem item) async { + if (_closed) throw StateError('Closed'); + final completer = Completer.sync(); + final id = _idCounter++; + _activeRequests[id] = completer; + _commands.send((id, item)); + return await completer.future; + } + + void _handleResponsesFromIsolate(dynamic message) { + final (int id, Object? response) = message as (int, Object?); + final completer = _activeRequests.remove(id)!; + + if (response is RemoteError) { + completer.completeError(response); + } else { + completer.complete(response); } - if (_bitmap != null) { - _nativeReplay.onScreenshotRecorded(_bitmap!); + if (_closed && _activeRequests.isEmpty) _responses.close(); + } + + /// This is the actual Android native implementation, the rest is just plumbing. + static void _handleCommandsToIsolate( + ReceivePort receivePort, + SendPort sendPort, + ) { + // Android Bitmap creation is a bit costly so we reuse it between captures. + native.Bitmap? bitmap; + + final _nativeReplay = native.SentryFlutterPlugin$Companion(null) + .privateSentryGetReplayIntegration()!; + + receivePort.listen((message) { + if (message == 'shutdown') { + receivePort.close(); + return; + } + final (id, item) = message as (int, _WorkItem); + try { + if (bitmap != null) { + if (bitmap!.getWidth() != item.width || + bitmap!.getHeight() != item.height) { + bitmap!.release(); + bitmap = null; + } + } + + // https://developer.android.com/reference/android/graphics/Bitmap#createBitmap(int,%20int,%20android.graphics.Bitmap.Config) + // Note: in the currently generated API this may return null so we null-check below. + bitmap ??= native.Bitmap.createBitmap$3( + item.width, item.height, native.Bitmap$Config.ARGB_8888); + + try { + bitmap?.copyPixelsFromBuffer(item.jBuffer); + } finally { + item.jBuffer.release(); + } + + if (bitmap != null) { + _nativeReplay.onScreenshotRecorded(bitmap!); + } + + sendPort.send((id, null)); + } catch (e, stacktrace) { + sendPort.send((id, RemoteError(e.toString(), stacktrace.toString()))); + } + }); + } + + static void _startRemoteIsolate(SendPort sendPort) { + final receivePort = ReceivePort(); + sendPort.send(receivePort.sendPort); + _handleCommandsToIsolate(receivePort, sendPort); + } + + void close() { + if (!_closed) { + _closed = true; + _commands.send('shutdown'); + if (_activeRequests.isEmpty) _responses.close(); + print('--- port closed --- '); } } } + +class _WorkItem { + final int timestamp; + final JByteBuffer jBuffer; + final int width; + final int height; + + const _WorkItem({ + required this.timestamp, + required this.jBuffer, + required this.width, + required this.height, + }); +} diff --git a/flutter/lib/src/native/java/sentry_native_java.dart b/flutter/lib/src/native/java/sentry_native_java.dart index e1447191e4..e23b6ac8cd 100644 --- a/flutter/lib/src/native/java/sentry_native_java.dart +++ b/flutter/lib/src/native/java/sentry_native_java.dart @@ -29,7 +29,8 @@ class SentryNativeJava extends SentryNativeChannel { height: (call.arguments['height'] as num).toDouble(), frameRate: call.arguments['frameRate'] as int); - _replayRecorder = AndroidReplayRecorder(config, options)..start(); + _replayRecorder = AndroidReplayRecorder(config, options); + await _replayRecorder!.start(); hub.configureScope((s) { // ignore: invalid_use_of_internal_member From 0517a361fe49aff602be3cf39129bfbdfd7c4676 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 10 Feb 2025 13:35:07 +0100 Subject: [PATCH 08/24] update replay native tests --- .../src/native/java/sentry_native_java.dart | 7 +- flutter/test/replay/replay_native_test.dart | 118 +++++++----------- 2 files changed, 53 insertions(+), 72 deletions(-) diff --git a/flutter/lib/src/native/java/sentry_native_java.dart b/flutter/lib/src/native/java/sentry_native_java.dart index e23b6ac8cd..ca2bca7ca2 100644 --- a/flutter/lib/src/native/java/sentry_native_java.dart +++ b/flutter/lib/src/native/java/sentry_native_java.dart @@ -13,6 +13,11 @@ class SentryNativeJava extends SentryNativeChannel { @override bool get supportsReplay => true; + @visibleForTesting + AndroidReplayRecorder Function( + ScheduledScreenshotRecorderConfig, SentryFlutterOptions) + replayRecorderFactory = AndroidReplayRecorder.new; + @override Future init(Hub hub) async { // We only need these when replay is enabled (session or error capture) @@ -29,7 +34,7 @@ class SentryNativeJava extends SentryNativeChannel { height: (call.arguments['height'] as num).toDouble(), frameRate: call.arguments['frameRate'] as int); - _replayRecorder = AndroidReplayRecorder(config, options); + _replayRecorder = replayRecorderFactory(config, options); await _replayRecorder!.start(); hub.configureScope((s) { diff --git a/flutter/test/replay/replay_native_test.dart b/flutter/test/replay/replay_native_test.dart index 515d61a7ff..d893f72203 100644 --- a/flutter/test/replay/replay_native_test.dart +++ b/flutter/test/replay/replay_native_test.dart @@ -5,12 +5,14 @@ library; import 'dart:async'; -import 'package:file/file.dart'; -import 'package:file/memory.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:sentry_flutter/src/native/factory.dart'; +import 'package:sentry_flutter/src/native/java/android_replay_recorder.dart'; +import 'package:sentry_flutter/src/native/java/sentry_native_java.dart'; +import 'package:sentry_flutter/src/replay/scheduled_recorder.dart'; +import 'package:sentry_flutter/src/screenshot/screenshot.dart'; import '../native_memory_web_mock.dart' if (dart.library.io) 'package:sentry_flutter/src/native/native_memory.dart'; import 'package:sentry_flutter/src/native/sentry_native_binding.dart'; @@ -25,20 +27,24 @@ void main() { for (final mockPlatform in [ MockPlatform.android(), - MockPlatform.iOs(), + // MockPlatform.iOs(), ]) { group('$SentryNativeBinding (${mockPlatform.operatingSystem})', () { late SentryNativeBinding sut; late NativeChannelFixture native; late SentryFlutterOptions options; late MockHub hub; - late FileSystem fs; late Map replayConfig; + late _MockAndroidReplayRecorder mockAndroidRecorder; setUp(() { hub = MockHub(); - fs = MemoryFileSystem.test(); native = NativeChannelFixture(); + options = + defaultTestOptions(MockPlatformChecker(mockPlatform: mockPlatform)) + ..methodChannel = native.channel + ..experimental.replay.quality = SentryReplayQuality.low; + sut = createBinding(options); if (mockPlatform.isIOS) { replayConfig = { @@ -47,23 +53,15 @@ void main() { } else if (mockPlatform.isAndroid) { replayConfig = { 'replayId': '123', - 'directory': 'dir', 'width': 800, 'height': 600, 'frameRate': 1000, }; - fs.directory(replayConfig['directory']).createSync(recursive: true); - when(native.handler('addReplayScreenshot', any)) - .thenAnswer((_) => Future.value()); + (sut as SentryNativeJava).replayRecorderFactory = (config, options) { + mockAndroidRecorder = _MockAndroidReplayRecorder(config, options); + return mockAndroidRecorder; + }; } - - options = - defaultTestOptions(MockPlatformChecker(mockPlatform: mockPlatform)) - ..fileSystem = fs - ..methodChannel = native.channel - ..experimental.replay.quality = SentryReplayQuality.low; - - sut = createBinding(options); }); tearDown(() async { @@ -100,10 +98,6 @@ void main() { expect(scope.replayId, isNull); await closure(scope); expect(scope.replayId.toString(), replayConfig['replayId']); - - if (mockPlatform.isAndroid) { - await native.invokeFromNative('ReplayRecorder.stop'); - } }); }); @@ -131,79 +125,41 @@ void main() { await pumpTestElement(tester); if (mockPlatform.isAndroid) { - final replayDir = fs.directory(replayConfig['directory']); - - var callbackFinished = Completer(); - nextFrame({bool wait = true}) async { - final future = callbackFinished.future; + mockAndroidRecorder.completer = Completer(); + final future = mockAndroidRecorder.completer!.future; await tester.pumpAndWaitUntil(future, requiredToComplete: wait); } - imageSizeBytes(File file) => file.readAsBytesSync().length; - - final capturedImages = {}; - when(native.handler('addReplayScreenshot', any)) - .thenAnswer((invocation) { - final path = - invocation.positionalArguments[1]["path"] as String; - capturedImages[path] = imageSizeBytes(fs.file(path)); - callbackFinished.complete(); - callbackFinished = Completer(); - return null; - }); - - fsImages() { - final files = replayDir.listSync().map((f) => f as File); - return {for (var f in files) f.path: imageSizeBytes(f)}; - } - - await nextFrame(wait: false); - expect(fsImages(), isEmpty); - verifyNever(native.handler('addReplayScreenshot', any)); - await native.invokeFromNative( 'ReplayRecorder.start', replayConfig); await nextFrame(); - expect(fsImages().values, isNotEmpty); - final size = fsImages().values.first; - expect(size, greaterThan(3000)); - expect(fsImages().values, [size]); - expect(capturedImages, equals(fsImages())); - - await nextFrame(); - fsImages().values.forEach((s) => expect(s, size)); - expect(capturedImages, equals(fsImages())); + expect(mockAndroidRecorder.captured, isNotEmpty); + final screenshot = mockAndroidRecorder.captured.first; + expect(screenshot.width, replayConfig['width']); + expect(screenshot.height, replayConfig['height']); await native.invokeFromNative('ReplayRecorder.pause'); - var count = capturedImages.length; + var count = mockAndroidRecorder.captured.length; await nextFrame(wait: false); await Future.delayed(const Duration(milliseconds: 100)); - fsImages().values.forEach((s) => expect(s, size)); - expect(capturedImages, equals(fsImages())); - expect(capturedImages.length, count); + expect(mockAndroidRecorder.captured.length, equals(count)); await nextFrame(wait: false); - fsImages().values.forEach((s) => expect(s, size)); - expect(capturedImages, equals(fsImages())); - expect(capturedImages.length, count); + expect(mockAndroidRecorder.captured.length, equals(count)); await native.invokeFromNative('ReplayRecorder.resume'); await nextFrame(); - fsImages().values.forEach((s) => expect(s, size)); - expect(capturedImages, equals(fsImages())); - expect(capturedImages.length, greaterThan(count)); + expect(mockAndroidRecorder.captured.length, greaterThan(count)); await native.invokeFromNative('ReplayRecorder.stop'); - count = capturedImages.length; + count = mockAndroidRecorder.captured.length; await Future.delayed(const Duration(milliseconds: 100)); await nextFrame(wait: false); - fsImages().values.forEach((s) => expect(s, size)); - expect(capturedImages, equals(fsImages())); - expect(capturedImages.length, count); + expect(mockAndroidRecorder.captured.length, equals(count)); } else if (mockPlatform.isIOS) { Future captureAndVerify() async { final future = native.invokeFromNative( @@ -233,3 +189,23 @@ void main() { }); } } + +class _MockAndroidReplayRecorder extends ScheduledScreenshotRecorder + implements AndroidReplayRecorder { + final captured = []; + Completer? completer; + + _MockAndroidReplayRecorder(super.config, super.options) { + super.callback = (screenshot, _) async { + captured.add(screenshot); + if (completer?.isCompleted == false) { + completer?.complete(); + } + }; + } + + @override + Future start() async { + super.start(); + } +} From 069c7260a00206d56f48319d2fdb06274b8b6f78 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 10 Feb 2025 13:35:18 +0100 Subject: [PATCH 09/24] update high-risk-code list --- .github/file-filters.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index 4da3356a47..7280ac9201 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -7,3 +7,4 @@ high_risk_code: &high_risk_code - "flutter/ios/Classes/SentryFlutterPluginApple.swift" - "flutter/lib/src/screenshot/recorder.dart" - "flutter/lib/src/screenshot/widget_filter.dart" + - "flutter/lib/src/native/java/android_replay_recorder.dart" From d986a26678debe3ae050bcca6aae117b54553102 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 10 Feb 2025 13:36:48 +0100 Subject: [PATCH 10/24] remove print() --- flutter/lib/src/native/java/android_replay_recorder.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/flutter/lib/src/native/java/android_replay_recorder.dart b/flutter/lib/src/native/java/android_replay_recorder.dart index da7e08748e..b0261c0b6c 100644 --- a/flutter/lib/src/native/java/android_replay_recorder.dart +++ b/flutter/lib/src/native/java/android_replay_recorder.dart @@ -187,7 +187,6 @@ class _AndroidNativeReplayWorker { _closed = true; _commands.send('shutdown'); if (_activeRequests.isEmpty) _responses.close(); - print('--- port closed --- '); } } } From f80477401730270914a6d96f8b5acb0b37a67bfe Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 10 Feb 2025 13:37:53 +0100 Subject: [PATCH 11/24] remove package:file dependency --- flutter/lib/src/sentry_flutter_options.dart | 5 ----- flutter/pubspec.yaml | 1 - 2 files changed, 6 deletions(-) diff --git a/flutter/lib/src/sentry_flutter_options.dart b/flutter/lib/src/sentry_flutter_options.dart index d19cd75b6f..9aaf2589c4 100644 --- a/flutter/lib/src/sentry_flutter_options.dart +++ b/flutter/lib/src/sentry_flutter_options.dart @@ -1,7 +1,5 @@ import 'dart:async'; -import 'package:file/file.dart'; -import 'package:file/local.dart'; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; import 'package:meta/meta.dart' as meta; @@ -390,9 +388,6 @@ class SentryFlutterOptions extends SentryOptions { // ignore: invalid_use_of_internal_member set automatedTestMode(bool value) => super.automatedTestMode = value; - @meta.internal - FileSystem fileSystem = LocalFileSystem(); - /// Configuration of experimental features that may change or be removed /// without prior notice. Additionally, these features may not be ready for /// production use yet. diff --git a/flutter/pubspec.yaml b/flutter/pubspec.yaml index c3df13d37c..ca7f42fd9f 100644 --- a/flutter/pubspec.yaml +++ b/flutter/pubspec.yaml @@ -27,7 +27,6 @@ dependencies: package_info_plus: '>=1.0.0' meta: ^1.3.0 ffi: ^2.0.0 - file: '>=6.1.4' collection: ^1.16.0 jni: 0.14.0 From 3b054bdbff481d64ae2541ec0c2adda18570bb87 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 10 Feb 2025 14:48:52 +0100 Subject: [PATCH 12/24] JNI benchmark --- .../native/java/android_replay_recorder.dart | 3 +- flutter/microbenchmarks/lib/main.dart | 15 +++ .../microbenchmarks/lib/src/jni_bench.dart | 95 +++++++++++++++++++ .../linux/flutter/generated_plugins.cmake | 1 + flutter/microbenchmarks/pubspec.yaml | 1 + .../windows/flutter/generated_plugins.cmake | 1 + 6 files changed, 114 insertions(+), 2 deletions(-) create mode 100644 flutter/microbenchmarks/lib/src/jni_bench.dart diff --git a/flutter/lib/src/native/java/android_replay_recorder.dart b/flutter/lib/src/native/java/android_replay_recorder.dart index b0261c0b6c..3ef0ff99bf 100644 --- a/flutter/lib/src/native/java/android_replay_recorder.dart +++ b/flutter/lib/src/native/java/android_replay_recorder.dart @@ -33,7 +33,6 @@ class AndroidReplayRecorder extends ScheduledScreenshotRecorder { Future _addReplayScreenshot( Screenshot screenshot, bool isNewlyCaptured) async { - // TODO this is currently missing in native onScreenshotRecorded() final timestamp = screenshot.timestamp.millisecondsSinceEpoch; try { @@ -44,7 +43,6 @@ class AndroidReplayRecorder extends ScheduledScreenshotRecorder { '${screenshot.width}x${screenshot.height} pixels, ' '${data.lengthInBytes} bytes)'); - // TODO evaluate setAll() performance, consider memcpy. final jBuffer = JByteBuffer.fromList(data.buffer.asUint8List()); int width = screenshot.width; int height = screenshot.height; @@ -166,6 +164,7 @@ class _AndroidNativeReplayWorker { } if (bitmap != null) { + // TODO timestamp is currently missing in onScreenshotRecorded() _nativeReplay.onScreenshotRecorded(bitmap!); } diff --git a/flutter/microbenchmarks/lib/main.dart b/flutter/microbenchmarks/lib/main.dart index 968cfb92f8..27471fb732 100644 --- a/flutter/microbenchmarks/lib/main.dart +++ b/flutter/microbenchmarks/lib/main.dart @@ -1,16 +1,31 @@ import 'dart:io'; import 'src/image_bench.dart' as image_bench; import 'src/memory_bench.dart' as memory_bench; +import 'src/jni_bench.dart' as jni_bench; typedef BenchmarkSet = (String name, Future Function() callback); +const filter = String.fromEnvironment("FILTER"); + Future main() async { final benchmarks = [ ('Image', image_bench.execute), ('Memory', memory_bench.execute), + if (Platform.isAndroid) ('JNI', jni_bench.execute), ]; + RegExp? filterRegexp; + if (filter.isNotEmpty) { + print('Filtering benchmarks with "$filter"'); + filterRegexp = RegExp(filter, caseSensitive: false); + } + for (final benchmark in benchmarks) { + if (filterRegexp != null && !filterRegexp.hasMatch(benchmark.$1)) { + print('BenchmarkSet ${benchmark.$1}: skipped due to filter'); + continue; + } + final watch = Stopwatch()..start(); print('BenchmarkSet ${benchmark.$1}: starting'); await benchmark.$2.call(); diff --git a/flutter/microbenchmarks/lib/src/jni_bench.dart b/flutter/microbenchmarks/lib/src/jni_bench.dart new file mode 100644 index 0000000000..4a841bb6c0 --- /dev/null +++ b/flutter/microbenchmarks/lib/src/jni_bench.dart @@ -0,0 +1,95 @@ +import 'dart:ffi'; +import 'dart:math'; + +import 'package:jni/jni.dart'; +import 'package:benchmarking/benchmarking.dart'; +import 'package:flutter/foundation.dart'; + +Future execute() async { + final worksets = [ + _WorkSet(10 * 1000), + _WorkSet(1000 * 1000), + _WorkSet(10 * 1000 * 1000), + ]; + + // For baseline + syncBenchmark('JByteBuffer.release()', () { + JByteBuffer.allocateDirect(1).release(); + }).report(); + + for (var workset in worksets) { + syncBenchmark('JByteBuffer.fromList(${workset.size})', () { + final jBuffer = JByteBuffer.fromList(workset.data); + jBuffer.release(); + }).report(); + + syncBenchmark('JByteBuffer.allocatedDirect(${workset.size})', () { + final jBuffer = JByteBuffer.allocateDirect(workset.size); + jBuffer.release(); + }).report(); + + syncBenchmark('JByteBuffer.allocatedDirect(${workset.size}) + memcpy', () { + final jBuffer = JByteBuffer.allocateDirect(workset.size); + final jData = jBuffer._asUint8ListUnsafe(); + memcpy(jData.address, workset.data.address, workset.size); + jBuffer.release(); + }).report(); + } +} + +class _WorkSet { + static final rand = Random(); + final int size; + late final Uint8List data; + + _WorkSet(this.size) { + // Randomized size prevents loop optimizations of constant sized loops. Just in case... + + data = Uint8List.fromList( + List.generate(size, (_) => rand.nextInt(size) % 256)); + } +} + +// Copied over from package:jni due to visibility +extension on JByteBuffer { + Uint8List _asUint8ListUnsafe() { + _ensureIsDirect(); + final address = _directBufferAddress(); + final capacity = _directBufferCapacity(); + return address.cast().asTypedList(capacity); + } + + Pointer _directBufferAddress() { + final address = Jni.env.GetDirectBufferAddress(reference.pointer); + if (address == nullptr) { + throw StateError( + 'The memory region is undefined or ' + 'direct buffer access is not supported by this JVM.', + ); + } + return address; + } + + int _directBufferCapacity() { + final capacity = Jni.env.GetDirectBufferCapacity(reference.pointer); + if (capacity == -1) { + throw StateError( + 'The object is an unaligned view buffer and the processor ' + 'architecture does not support unaligned access.', + ); + } + return capacity; + } + + void _ensureIsDirect() { + if (!isDirect) { + throw StateError( + 'The buffer must be created with `JByteBuffer.allocateDirect`.', + ); + } + } +} + +/// void* memcpy( void* dest, const void* src, std::size_t count ); +@Native(symbol: 'memcpy', isLeaf: true) +external void memcpy(Pointer dest, Pointer src, int count); diff --git a/flutter/microbenchmarks/linux/flutter/generated_plugins.cmake b/flutter/microbenchmarks/linux/flutter/generated_plugins.cmake index 7204441060..7244781b99 100644 --- a/flutter/microbenchmarks/linux/flutter/generated_plugins.cmake +++ b/flutter/microbenchmarks/linux/flutter/generated_plugins.cmake @@ -7,6 +7,7 @@ list(APPEND FLUTTER_PLUGIN_LIST ) list(APPEND FLUTTER_FFI_PLUGIN_LIST + jni ) set(PLUGIN_BUNDLED_LIBRARIES) diff --git a/flutter/microbenchmarks/pubspec.yaml b/flutter/microbenchmarks/pubspec.yaml index 23da62bdfb..80b2bcf0fa 100644 --- a/flutter/microbenchmarks/pubspec.yaml +++ b/flutter/microbenchmarks/pubspec.yaml @@ -17,6 +17,7 @@ dependencies: benchmarking: ^0.6.1 sentry_flutter: path: ../ + jni: ^0.14.0 dev_dependencies: flutter_lints: ^5.0.0 diff --git a/flutter/microbenchmarks/windows/flutter/generated_plugins.cmake b/flutter/microbenchmarks/windows/flutter/generated_plugins.cmake index e3e2f3e784..5af1999cb4 100644 --- a/flutter/microbenchmarks/windows/flutter/generated_plugins.cmake +++ b/flutter/microbenchmarks/windows/flutter/generated_plugins.cmake @@ -7,6 +7,7 @@ list(APPEND FLUTTER_PLUGIN_LIST ) list(APPEND FLUTTER_FFI_PLUGIN_LIST + jni ) set(PLUGIN_BUNDLED_LIBRARIES) From 6995e120b3e5dac0c7885694cb2e27d9cdcb1272 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 10 Feb 2025 17:05:32 +0100 Subject: [PATCH 13/24] ktlint format --- .../src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt b/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt index 7d3da481a0..6feda34795 100644 --- a/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt +++ b/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt @@ -36,7 +36,6 @@ import io.sentry.protocol.DebugImage import io.sentry.protocol.SentryId import io.sentry.protocol.User import io.sentry.transport.CurrentDateProvider -import java.io.File import java.lang.ref.WeakReference import kotlin.math.roundToInt @@ -519,9 +518,7 @@ class SentryFlutterPlugin : private const val NATIVE_CRASH_WAIT_TIME = 500L - @JvmStatic fun privateSentryGetReplayIntegration() : ReplayIntegration? { - return replay - } + @JvmStatic fun privateSentryGetReplayIntegration(): ReplayIntegration? = replay private fun crash() { val exception = RuntimeException("FlutterSentry Native Integration: Sample RuntimeException") From 09202be1a1ba62a7f0f1102fc4db7cae5128fc4c Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Mon, 10 Feb 2025 17:15:46 +0100 Subject: [PATCH 14/24] fixup ci --- flutter/test/replay/replay_native_test.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/flutter/test/replay/replay_native_test.dart b/flutter/test/replay/replay_native_test.dart index d893f72203..eb469f2f99 100644 --- a/flutter/test/replay/replay_native_test.dart +++ b/flutter/test/replay/replay_native_test.dart @@ -66,6 +66,10 @@ void main() { tearDown(() async { await sut.close(); + + if (mockPlatform.isAndroid) { + await native.invokeFromNative('ReplayRecorder.stop'); + } }); group('replay recorder', () { From 8094735d5bf4da368f13501b581ec82bd9877b41 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Tue, 11 Feb 2025 12:14:49 +0100 Subject: [PATCH 15/24] fixup --- flutter/test/replay/replay_native_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flutter/test/replay/replay_native_test.dart b/flutter/test/replay/replay_native_test.dart index eb469f2f99..d7c282e238 100644 --- a/flutter/test/replay/replay_native_test.dart +++ b/flutter/test/replay/replay_native_test.dart @@ -27,7 +27,7 @@ void main() { for (final mockPlatform in [ MockPlatform.android(), - // MockPlatform.iOs(), + MockPlatform.iOs(), ]) { group('$SentryNativeBinding (${mockPlatform.operatingSystem})', () { late SentryNativeBinding sut; From 2f5fd6e2d3560dccc41e3b279515d7edc1b602d1 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Tue, 11 Feb 2025 13:37:46 +0100 Subject: [PATCH 16/24] fix web tests --- .../native/java/android_replay_recorder.dart | 6 ++++++ .../src/native/java/sentry_native_java.dart | 7 +------ .../replay/android_replay_recorder_web.dart | 21 +++++++++++++++++++ flutter/test/replay/replay_native_test.dart | 7 ++++--- 4 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 flutter/test/replay/android_replay_recorder_web.dart diff --git a/flutter/lib/src/native/java/android_replay_recorder.dart b/flutter/lib/src/native/java/android_replay_recorder.dart index 3ef0ff99bf..d43d2b668c 100644 --- a/flutter/lib/src/native/java/android_replay_recorder.dart +++ b/flutter/lib/src/native/java/android_replay_recorder.dart @@ -6,6 +6,7 @@ import 'package:meta/meta.dart'; import '../../../sentry_flutter.dart'; import '../../replay/scheduled_recorder.dart'; +import '../../replay/scheduled_recorder_config.dart'; import '../../screenshot/screenshot.dart'; import 'binding.dart' as native; @@ -13,6 +14,11 @@ import 'binding.dart' as native; class AndroidReplayRecorder extends ScheduledScreenshotRecorder { _AndroidNativeReplayWorker? _worker; + @internal // visible for testing, used by SentryNativeJava + static AndroidReplayRecorder Function( + ScheduledScreenshotRecorderConfig, SentryFlutterOptions) + factory = AndroidReplayRecorder.new; + AndroidReplayRecorder(super.config, super.options) { super.callback = _addReplayScreenshot; } diff --git a/flutter/lib/src/native/java/sentry_native_java.dart b/flutter/lib/src/native/java/sentry_native_java.dart index ca2bca7ca2..d4c5be2eed 100644 --- a/flutter/lib/src/native/java/sentry_native_java.dart +++ b/flutter/lib/src/native/java/sentry_native_java.dart @@ -13,11 +13,6 @@ class SentryNativeJava extends SentryNativeChannel { @override bool get supportsReplay => true; - @visibleForTesting - AndroidReplayRecorder Function( - ScheduledScreenshotRecorderConfig, SentryFlutterOptions) - replayRecorderFactory = AndroidReplayRecorder.new; - @override Future init(Hub hub) async { // We only need these when replay is enabled (session or error capture) @@ -34,7 +29,7 @@ class SentryNativeJava extends SentryNativeChannel { height: (call.arguments['height'] as num).toDouble(), frameRate: call.arguments['frameRate'] as int); - _replayRecorder = replayRecorderFactory(config, options); + _replayRecorder = AndroidReplayRecorder.factory(config, options); await _replayRecorder!.start(); hub.configureScope((s) { diff --git a/flutter/test/replay/android_replay_recorder_web.dart b/flutter/test/replay/android_replay_recorder_web.dart new file mode 100644 index 0000000000..ab8bc199bb --- /dev/null +++ b/flutter/test/replay/android_replay_recorder_web.dart @@ -0,0 +1,21 @@ +// ignore_for_file: invalid_use_of_internal_member + +import 'dart:async'; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; +import 'package:sentry_flutter/src/replay/scheduled_recorder.dart'; +import 'package:sentry_flutter/src/replay/scheduled_recorder_config.dart'; + +class AndroidReplayRecorder extends ScheduledScreenshotRecorder { + static AndroidReplayRecorder Function( + ScheduledScreenshotRecorderConfig, SentryFlutterOptions) factory = + AndroidReplayRecorder.new; + + AndroidReplayRecorder(super.config, super.options); + + @override + Future start() async { + super.start(); + } +} diff --git a/flutter/test/replay/replay_native_test.dart b/flutter/test/replay/replay_native_test.dart index d7c282e238..1ec52c7901 100644 --- a/flutter/test/replay/replay_native_test.dart +++ b/flutter/test/replay/replay_native_test.dart @@ -9,8 +9,8 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:sentry_flutter/src/native/factory.dart'; -import 'package:sentry_flutter/src/native/java/android_replay_recorder.dart'; -import 'package:sentry_flutter/src/native/java/sentry_native_java.dart'; +import 'android_replay_recorder_web.dart' // see https://github.com/flutter/flutter/issues/160675 + if (dart.library.io) 'package:sentry_flutter/src/native/java/android_replay_recorder.dart'; import 'package:sentry_flutter/src/replay/scheduled_recorder.dart'; import 'package:sentry_flutter/src/screenshot/screenshot.dart'; import '../native_memory_web_mock.dart' @@ -57,7 +57,7 @@ void main() { 'height': 600, 'frameRate': 1000, }; - (sut as SentryNativeJava).replayRecorderFactory = (config, options) { + AndroidReplayRecorder.factory = (config, options) { mockAndroidRecorder = _MockAndroidReplayRecorder(config, options); return mockAndroidRecorder; }; @@ -69,6 +69,7 @@ void main() { if (mockPlatform.isAndroid) { await native.invokeFromNative('ReplayRecorder.stop'); + AndroidReplayRecorder.factory = AndroidReplayRecorder.new; } }); From f6aee8a63d63d4c69b6aa747779774069409a19c Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Tue, 11 Feb 2025 13:44:16 +0100 Subject: [PATCH 17/24] dart format --- flutter/lib/src/native/java/android_replay_recorder.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flutter/lib/src/native/java/android_replay_recorder.dart b/flutter/lib/src/native/java/android_replay_recorder.dart index d43d2b668c..135dc640f1 100644 --- a/flutter/lib/src/native/java/android_replay_recorder.dart +++ b/flutter/lib/src/native/java/android_replay_recorder.dart @@ -16,8 +16,8 @@ class AndroidReplayRecorder extends ScheduledScreenshotRecorder { @internal // visible for testing, used by SentryNativeJava static AndroidReplayRecorder Function( - ScheduledScreenshotRecorderConfig, SentryFlutterOptions) - factory = AndroidReplayRecorder.new; + ScheduledScreenshotRecorderConfig, SentryFlutterOptions) factory = + AndroidReplayRecorder.new; AndroidReplayRecorder(super.config, super.options) { super.callback = _addReplayScreenshot; From baeb5f68c542e52b204435f609d595bb5b2de86b Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Tue, 11 Feb 2025 14:51:38 +0100 Subject: [PATCH 18/24] try to fix ci --- flutter/test/replay/replay_native_test.dart | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/flutter/test/replay/replay_native_test.dart b/flutter/test/replay/replay_native_test.dart index 1ec52c7901..51b8b6902d 100644 --- a/flutter/test/replay/replay_native_test.dart +++ b/flutter/test/replay/replay_native_test.dart @@ -131,8 +131,7 @@ void main() { await pumpTestElement(tester); if (mockPlatform.isAndroid) { nextFrame({bool wait = true}) async { - mockAndroidRecorder.completer = Completer(); - final future = mockAndroidRecorder.completer!.future; + final future = mockAndroidRecorder.completer.future; await tester.pumpAndWaitUntil(future, requiredToComplete: wait); } @@ -198,14 +197,13 @@ void main() { class _MockAndroidReplayRecorder extends ScheduledScreenshotRecorder implements AndroidReplayRecorder { final captured = []; - Completer? completer; + var completer = Completer(); _MockAndroidReplayRecorder(super.config, super.options) { super.callback = (screenshot, _) async { captured.add(screenshot); - if (completer?.isCompleted == false) { - completer?.complete(); - } + completer.complete(); + completer = Completer(); }; } From c1a2f56e86a438a5655486becf179ce6d07fdfde Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Tue, 11 Feb 2025 16:01:37 +0100 Subject: [PATCH 19/24] try to fix ci --- flutter/test/replay/replay_native_test.dart | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/flutter/test/replay/replay_native_test.dart b/flutter/test/replay/replay_native_test.dart index 51b8b6902d..cb76cec0e6 100644 --- a/flutter/test/replay/replay_native_test.dart +++ b/flutter/test/replay/replay_native_test.dart @@ -5,6 +5,7 @@ library; import 'dart:async'; +import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; @@ -66,11 +67,6 @@ void main() { tearDown(() async { await sut.close(); - - if (mockPlatform.isAndroid) { - await native.invokeFromNative('ReplayRecorder.stop'); - AndroidReplayRecorder.factory = AndroidReplayRecorder.new; - } }); group('replay recorder', () { @@ -103,6 +99,15 @@ void main() { expect(scope.replayId, isNull); await closure(scope); expect(scope.replayId.toString(), replayConfig['replayId']); + + if (mockPlatform.isAndroid) { + await native.invokeFromNative('ReplayRecorder.stop'); + AndroidReplayRecorder.factory = AndroidReplayRecorder.new; + + // Workaround for "A Timer is still pending even after the widget tree was disposed." + await tester.pumpWidget(Container()); + await tester.pumpAndSettle(); + } }); }); From 3308015bb1d019a502a8e3a8a73710cf391553d0 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Tue, 11 Feb 2025 16:09:35 +0100 Subject: [PATCH 20/24] chore: exclude binding from coverage --- .github/actions/coverage/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/coverage/action.yml b/.github/actions/coverage/action.yml index 9b8b53d539..d0167ffa2e 100644 --- a/.github/actions/coverage/action.yml +++ b/.github/actions/coverage/action.yml @@ -33,4 +33,4 @@ runs: with: path: './${{ inputs.directory }}/coverage/lcov.info' min_coverage: ${{ inputs.min-coverage }} - exclude: 'lib/src/native/**/binding.dart' + exclude: 'lib/src/native/**/binding.dart lib/src/native/java/android_replay_recorder.dart' From db4e700a3e6429a05985aefec8e28097c902bdb0 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Tue, 11 Feb 2025 16:36:29 +0100 Subject: [PATCH 21/24] comments --- flutter/lib/src/native/java/android_replay_recorder.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flutter/lib/src/native/java/android_replay_recorder.dart b/flutter/lib/src/native/java/android_replay_recorder.dart index 135dc640f1..160a29eb05 100644 --- a/flutter/lib/src/native/java/android_replay_recorder.dart +++ b/flutter/lib/src/native/java/android_replay_recorder.dart @@ -10,6 +10,8 @@ import '../../replay/scheduled_recorder_config.dart'; import '../../screenshot/screenshot.dart'; import 'binding.dart' as native; +// Note, this is currently not unit-tested because mocking the JNI calls is +// cumbersome, see https://github.com/dart-lang/native/issues/1794 @internal class AndroidReplayRecorder extends ScheduledScreenshotRecorder { _AndroidNativeReplayWorker? _worker; From 1ba949f3ecbad4e053d118c9ddcaed4b2f3a71ae Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Tue, 11 Feb 2025 16:38:14 +0100 Subject: [PATCH 22/24] chore: changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71ef58a89a..396c3ba20b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased 9.0.0 +### Breaking changes + - Remove `SentryDisplayWidget` and manual TTID implementation ([#2668](https://github.com/getsentry/sentry-dart/pull/2668)) - Increase minimum SDK version requirements to Dart v3.5.0 and Flutter v3.24.0 ([#2643](https://github.com/getsentry/sentry-dart/pull/2643)) - Remove screenshot option `attachScreenshotOnlyWhenResumed` ([#2664](https://github.com/getsentry/sentry-dart/pull/2664)) @@ -10,6 +12,10 @@ - Remove user segment ([#2687](https://github.com/getsentry/sentry-dart/pull/2687)) - Remove `options.autoAppStart` and `setAppStartEnd` ([#2680](https://github.com/getsentry/sentry-dart/pull/2680)) +### Enhancements + +- Replay: improve iOS native interop performance by using JNI ([#2670](https://github.com/getsentry/sentry-dart/pull/2670)) + ### Dependencies - Bump Android SDK from v7.20.1 to v8.1.0 ([#2650](https://github.com/getsentry/sentry-dart/pull/2650)) From 0506e8c3a0d760837f6829e82ba2eb820aa5c1ca Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Wed, 12 Feb 2025 13:54:18 +0100 Subject: [PATCH 23/24] move uint8list creation to separate isolate --- .../native/java/android_replay_recorder.dart | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/flutter/lib/src/native/java/android_replay_recorder.dart b/flutter/lib/src/native/java/android_replay_recorder.dart index 160a29eb05..f0af91d004 100644 --- a/flutter/lib/src/native/java/android_replay_recorder.dart +++ b/flutter/lib/src/native/java/android_replay_recorder.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'dart:isolate'; +import 'dart:typed_data'; import 'package:jni/jni.dart'; import 'package:meta/meta.dart'; @@ -10,7 +11,7 @@ import '../../replay/scheduled_recorder_config.dart'; import '../../screenshot/screenshot.dart'; import 'binding.dart' as native; -// Note, this is currently not unit-tested because mocking the JNI calls is +// Note, this is currently not unit-tested because mocking JNI calls is // cumbersome, see https://github.com/dart-lang/native/issues/1794 @internal class AndroidReplayRecorder extends ScheduledScreenshotRecorder { @@ -51,15 +52,12 @@ class AndroidReplayRecorder extends ScheduledScreenshotRecorder { '${screenshot.width}x${screenshot.height} pixels, ' '${data.lengthInBytes} bytes)'); - final jBuffer = JByteBuffer.fromList(data.buffer.asUint8List()); - int width = screenshot.width; - int height = screenshot.height; - await _worker!.nativeAddScreenshot(_WorkItem( - timestamp: timestamp, - jBuffer: jBuffer, - width: width, - height: height)); + timestamp: timestamp, + data: data.buffer.asUint8List(), + width: screenshot.width, + height: screenshot.height, + )); } catch (error, stackTrace) { options.logger( SentryLevel.error, @@ -161,20 +159,19 @@ class _AndroidNativeReplayWorker { } // https://developer.android.com/reference/android/graphics/Bitmap#createBitmap(int,%20int,%20android.graphics.Bitmap.Config) - // Note: in the currently generated API this may return null so we null-check below. + // Note: while the generated API is nullable, the docs say the returned value cannot be null.. bitmap ??= native.Bitmap.createBitmap$3( item.width, item.height, native.Bitmap$Config.ARGB_8888); + final jBuffer = JByteBuffer.fromList(item.data); try { - bitmap?.copyPixelsFromBuffer(item.jBuffer); + bitmap!.copyPixelsFromBuffer(jBuffer); } finally { - item.jBuffer.release(); + jBuffer.release(); } - if (bitmap != null) { - // TODO timestamp is currently missing in onScreenshotRecorded() - _nativeReplay.onScreenshotRecorded(bitmap!); - } + // TODO timestamp is currently missing in onScreenshotRecorded() + _nativeReplay.onScreenshotRecorded(bitmap!); sendPort.send((id, null)); } catch (e, stacktrace) { @@ -200,13 +197,13 @@ class _AndroidNativeReplayWorker { class _WorkItem { final int timestamp; - final JByteBuffer jBuffer; + final Uint8List data; final int width; final int height; const _WorkItem({ required this.timestamp, - required this.jBuffer, + required this.data, required this.width, required this.height, }); From 96c04581a3a93b4702b7819e81b95f1258bcbe81 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos <6349682+vaind@users.noreply.github.com> Date: Wed, 12 Feb 2025 22:26:14 +0100 Subject: [PATCH 24/24] Update CHANGELOG.md Co-authored-by: Giancarlo Buenaflor --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 396c3ba20b..b6aa1ac028 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ ### Enhancements -- Replay: improve iOS native interop performance by using JNI ([#2670](https://github.com/getsentry/sentry-dart/pull/2670)) +- Replay: improve Android native interop performance by using JNI ([#2670](https://github.com/getsentry/sentry-dart/pull/2670)) ### Dependencies