From 089990c087e207856efbd84cffa4d5ed883eae5e Mon Sep 17 00:00:00 2001 From: cjand <1747143535@qq.com> Date: Mon, 17 Feb 2025 19:30:11 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=AB=E6=8F=8F?= =?UTF-8?q?=E7=B1=BB=E4=BC=BC=E4=BB=A3=E7=A0=81=E7=89=87=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cjand <1747143535@qq.com> --- .../embedding/engine/dart/DartExecutor.ets | 22 ------ .../embedding/engine/dart/DartMessenger.ets | 11 --- .../systemchannels/RestorationChannel.ets | 30 --------- .../common/BackgroundBasicMessageChannel.ets | 25 ------- .../plugin/common/BackgroundMethodChannel.ets | 36 ---------- .../ets/plugin/common/BasicMessageChannel.ets | 43 +----------- .../ets/plugin/common/BinaryMessenger.ets | 66 +----------------- .../main/ets/plugin/common/MethodChannel.ets | 67 +------------------ .../main/ets/plugin/common/MethodCodec.ets | 31 +-------- .../ets/plugin/common/SendableMethodCodec.ets | 31 +-------- .../ets/plugin/common/StandardMethodCodec.ets | 10 --- .../src/main/ets/plugin/editing/TextUtils.ets | 1 - .../main/ets/plugin/platform/PlatformView.ets | 16 ----- 13 files changed, 7 insertions(+), 382 deletions(-) diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/dart/DartExecutor.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/dart/DartExecutor.ets index 7bee8f8100..f18525e272 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/dart/DartExecutor.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/dart/DartExecutor.ets @@ -171,20 +171,6 @@ export default class DartExecutor implements BinaryMessenger { this.getBinaryMessenger().setMessageHandler(channel, handler, taskQueue, ...args); } - /** - * Returns the number of pending channel callback replies. - * - *

When sending messages to the Flutter application using {@link BinaryMessenger#send(String, - * ByteBuffer, io.flutter.plugin.common.BinaryMessenger.BinaryReply)}, developers can optionally - * specify a reply callback if they expect a reply from the Flutter application. - * - *

This method tracks all the pending callbacks that are waiting for response, and is supposed - * to be called from the main thread (as other methods). Calling from a different thread could - * possibly capture an indeterministic internal state, so don't do it. - * - *

Currently, it's mainly useful for a testing framework like Espresso to determine whether all - * the async channel callbacks are handled and the app is idle. - */ getPendingChannelResponseCount(): number { return this.dartMessenger.getPendingChannelResponseCount(); } @@ -326,14 +312,6 @@ export class DefaultBinaryMessenger implements BinaryMessenger { this.messenger.send(channel, message, callback); } - /** - * Sets the given {@link io.flutter.plugin.common.BinaryMessenger.BinaryMessageHandler} as the - * singular handler for all incoming messages received from the Dart side of this Dart execution - * context. - * - * @param channel the name of the channel. - * @param handler a {@link BinaryMessageHandler} to be invoked on incoming messages, or null. - */ setMessageHandler(channel: String, handler: BinaryMessageHandler | SendableBinaryMessageHandler | null, taskQueue?: TaskQueue, ...args: Object[]): void { this.messenger.setMessageHandler(channel, handler, taskQueue, ...args); } diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/dart/DartMessenger.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/dart/DartMessenger.ets index 3f8a71b970..ac4938e050 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/dart/DartMessenger.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/dart/DartMessenger.ets @@ -140,17 +140,6 @@ export class DartMessenger implements BinaryMessenger, PlatformMessageHandler { } } - /** - * Returns the number of pending channel callback replies. - * - *

When sending messages to the Flutter application using {@link BinaryMessenger#send(String, - * ByteBuffer, io.flutter.plugin.common.BinaryMessenger.BinaryReply)}, developers can optionally - * specify a reply callback if they expect a reply from the Flutter application. - * - *

This method tracks all the pending callbacks that are waiting for response, and is supposed - * to be called from the main thread (as other methods). Calling from a different thread could - * possibly capture an indeterministic internal state, so don't do it. - */ getPendingChannelResponseCount(): number { return this.pendingReplies.size; } diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/systemchannels/RestorationChannel.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/systemchannels/RestorationChannel.ets index 2da3631c48..95687278e9 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/systemchannels/RestorationChannel.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/systemchannels/RestorationChannel.ets @@ -16,41 +16,11 @@ import Log from '../../../util/Log'; import StringUtils from '../../../util/StringUtils'; import DartExecutor from '../dart/DartExecutor'; -/** - * System channel to exchange restoration data between framework and engine. - * - *

The engine can obtain the current restoration data from the framework via this channel to - * store it on disk and - when the app is relaunched - provide the stored data back to the framework - * to recreate the original state of the app. - * - *

The channel can be configured to delay responding to the framework's request for restoration - * data via {@code waitForRestorationData} until the engine-side has provided the data. This is - * useful when the engine is pre-warmed at a point in the application's life cycle where the - * restoration data is not available yet. For example, if the engine is pre-warmed as part of the - * Application before an Activity is created, this flag should be set to true because Android will - * only provide the restoration data to the Activity during the onCreate callback. - * - *

The current restoration data provided by the framework can be read via {@code - * getRestorationData()}. - */ export default class RestorationChannel { private static TAG = "RestorationChannel"; private static CHANNEL_NAME = "flutter/restoration"; - /** - * Whether the channel delays responding to the framework's initial request for restoration data - * until {@code setRestorationData} has been called. - * - *

If the engine never calls {@code setRestorationData} this flag must be set to false. If set - * to true, the engine must call {@code setRestorationData} either with the actual restoration - * data as argument or null if it turns out that there is no restoration data. - * - *

If the response to the framework's request for restoration data is not delayed until the - * data has been set via {@code setRestorationData}, the framework may intermittently initialize - * itself to default values until the restoration data has been made available. Setting this flag - * to true avoids that extra work. - */ public waitForRestorationData: boolean = false; public pendingFrameworkRestorationChannelRequest: MethodResult | null = null; diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/BackgroundBasicMessageChannel.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/BackgroundBasicMessageChannel.ets index cf7cc4d63a..31171169fc 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/BackgroundBasicMessageChannel.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/BackgroundBasicMessageChannel.ets @@ -14,20 +14,6 @@ import SendableMessageCodec from './SendableMessageCodec'; import SendableMessageHandler from './SendableMessageHandler'; import StringUtils from '../../util/StringUtils'; -/** - * A named channel for communicating with the Flutter application using basic, asynchronous message - * passing. - * - *

Messages are encoded into binary before being sent, and binary messages received are decoded - * into Java objects. The {@link MessageCodec} used must be compatible with the one used by the - * Flutter application. This can be achieved by creating a BasicMessageChannel - * counterpart of this channel on the Dart side. The static Java type of messages sent and received - * is {@code Object}, but only values supported by the specified {@link MessageCodec} can be used. - * - *

The logical identity of the channel is given by its name. Identically named channels will - * interfere with each other's communication. - */ export default class BackgroundBasicMessageChannel { public static TAG = "BackgroundBasicMessageChannel#"; public static CHANNEL_BUFFERS_CHANNEL = "dev.flutter/channel-buffers"; @@ -56,17 +42,6 @@ export default class BackgroundBasicMessageChannel { callback == null ? null : new IncomingReplyHandler(callback, this.codec)); } - /** - * Registers a message handler on this channel for receiving messages sent from the Flutter - * application. - * - *

Overrides any existing handler registration for (the name of) this channel. - * - *

If no handler has been registered, any incoming message on this channel will be handled - * silently by sending a null reply. - * - * @param handler a {@link MessageHandler}, or null to deregister. - */ setMessageHandler(handler: SendableMessageHandler | null): void { this.messenger.setMessageHandler(this.name, handler == null ? null : new IncomingSendableMessageHandler(handler, this.codec), this.taskQueue); diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/BackgroundMethodChannel.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/BackgroundMethodChannel.ets index 8e9294f0ae..532e6d24d0 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/BackgroundMethodChannel.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/BackgroundMethodChannel.ets @@ -16,19 +16,6 @@ import SendableMethodCallHandler from './SendableMethodCallHandler' import SendableMethodCodec from './SendableMethodCodec' import SendableBinaryMessageHandler from './SendableBinaryMessageHandler' -/** - * A named channel for communicating with the Flutter application using asynchronous method calls. - * - *

Incoming method calls are decoded from binary on receipt, and Java results are encoded into - * binary before being transmitted back to Flutter. The {@link MethodCodec} used must be compatible - * with the one used by the Flutter application. This can be achieved by creating a MethodChannel - * counterpart of this channel on the Dart side. The Java type of method call arguments and results - * is {@code Object}, but only values supported by the specified {@link MethodCodec} can be used. - * - *

The logical identity of the channel is given by its name. Identically named channels will - * interfere with each other's communication. - */ export default class BackgroundMethodChannel { static TAG = "BackgroundMethodChannel#"; @@ -50,35 +37,12 @@ export default class BackgroundMethodChannel { this.args = args } - /** - * Invokes a method on this channel, optionally expecting a result. - * - *

Any uncaught exception thrown by the result callback will be caught and logged. - * - * @param method the name String of the method. - * @param arguments the arguments for the invocation, possibly null. - * @param callback a {@link Result} callback for the invocation result, or null. - */ invokeMethod(method: string, args: Any, callback?: MethodResult): void { this.messenger.send(this.name, this.codec.encodeMethodCall(new MethodCall(method, args)), callback == null ? null : new IncomingSendableResultHandler(callback, this.codec)); } - /** - * Registers a method call handler on this channel. - * - *

Overrides any existing handler registration for (the name of) this channel. - * - *

If no handler has been registered, any incoming method call on this channel will be handled - * silently by sending a null reply. This results in a MissingPluginException - * on the Dart side, unless an OptionalMethodChannel - * is used. - * - * @param handler a {@link MethodCallHandler}, or null to deregister. - */ setMethodCallHandler(handler: SendableMethodCallHandler | null): void { this.messenger.setMessageHandler(this.name, handler == null ? null : new IncomingSendableMethodCallHandler(handler, this.codec), diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/BasicMessageChannel.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/BasicMessageChannel.ets index 464a23f56b..b3a84251e9 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/BasicMessageChannel.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/BasicMessageChannel.ets @@ -16,20 +16,6 @@ import MessageCodec from './MessageCodec'; import { BinaryMessenger } from './BinaryMessenger'; import StringUtils from '../../util/StringUtils'; -/** - * A named channel for communicating with the Flutter application using basic, asynchronous message - * passing. - * - *

Messages are encoded into binary before being sent, and binary messages received are decoded - * into Java objects. The {@link MessageCodec} used must be compatible with the one used by the - * Flutter application. This can be achieved by creating a BasicMessageChannel - * counterpart of this channel on the Dart side. The static Java type of messages sent and received - * is {@code Object}, but only values supported by the specified {@link MessageCodec} can be used. - * - *

The logical identity of the channel is given by its name. Identically named channels will - * interfere with each other's communication. - */ export default class BasicMessageChannel { public static TAG = "BasicMessageChannel#"; public static CHANNEL_BUFFERS_CHANNEL = "dev.flutter/channel-buffers"; @@ -55,17 +41,6 @@ export default class BasicMessageChannel { this.messenger.send(this.name, this.codec.encodeMessage(message), callback == null ? null : new IncomingReplyHandler(callback, this.codec)); } - /** - * Registers a message handler on this channel for receiving messages sent from the Flutter - * application. - * - *

Overrides any existing handler registration for (the name of) this channel. - * - *

If no handler has been registered, any incoming message on this channel will be handled - * silently by sending a null reply. - * - * @param handler a {@link MessageHandler}, or null to deregister. - */ setMessageHandler(handler: MessageHandler | null): void { this.messenger.setMessageHandler(this.name, handler == null ? null : new IncomingMessageHandler(handler, this.codec)); } @@ -92,24 +67,8 @@ export interface Reply { export interface MessageHandler { - /** - * Handles the specified message received from Flutter. - * - *

Handler implementations must reply to all incoming messages, by submitting a single reply - * message to the given {@link Reply}. Failure to do so will result in lingering Flutter reply - * handlers. The reply may be submitted asynchronously and invoked on any thread. - * - *

Any uncaught exception thrown by this method, or the preceding message decoding, will be - * caught by the channel implementation and logged, and a null reply message will be sent back - * to Flutter. - * - *

Any uncaught exception thrown during encoding a reply message submitted to the {@link - * Reply} is treated similarly: the exception is logged, and a null reply is sent to Flutter. - * - * @param message the message, possibly null. - * @param reply a {@link Reply} for sending a single message reply back to Flutter. - */ onMessage(message: T, reply: Reply): void; + } class IncomingReplyHandler implements BinaryReply { diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/BinaryMessenger.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/BinaryMessenger.ets index 0de3c3a4a6..f1d5cf852d 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/BinaryMessenger.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/BinaryMessenger.ets @@ -8,14 +8,6 @@ * */ -/** - * An abstraction over the threading policy used to invoke message handlers. - * - *

These are generated by calling methods like {@link - * BinaryMessenger#makeBackgroundTaskQueue(TaskQueueOptions)} and can be passed into platform - * channels' constructors to control the threading policy for handling platform channels' - * messages. - */ import SendableBinaryMessageHandler from './SendableBinaryMessageHandler' @@ -86,38 +78,10 @@ export interface BinaryReply { /** Handler for incoming binary messages from Flutter. */ export interface BinaryMessageHandler { - /** - * Handles the specified message. - * - *

Handler implementations must reply to all incoming messages, by submitting a single reply - * message to the given {@link BinaryReply}. Failure to do so will result in lingering Flutter - * reply handlers. The reply may be submitted asynchronously. - * - *

Any uncaught exception thrown by this method will be caught by the messenger - * implementation and logged, and a null reply message will be sent back to Flutter. - * - * @param message the message {@link ByteBuffer} payload, possibly null. - * @param reply A {@link BinaryReply} used for submitting a reply back to Flutter. - */ + onMessage(message: ArrayBuffer, reply: BinaryReply): void; -} -/** - * Facility for communicating with Flutter using asynchronous message passing with binary messages. - * The Flutter Dart code should use BinaryMessages to - * participate. - * - *

{@code BinaryMessenger} is expected to be utilized from a single thread throughout the - * duration of its existence. If created on the main thread, then all invocations should take place - * on the main thread. If created on a background thread, then all invocations should take place on - * that background thread. - * - * @see BasicMessageChannel , which supports message passing with Strings and semi-structured - * messages. - * @see MethodChannel , which supports communication using asynchronous method invocation. - * @see EventChannel , which supports communication using event streams. - */ +} export interface BinaryMessenger { makeBackgroundTaskQueue(options?: TaskQueueOptions): TaskQueue; @@ -131,33 +95,7 @@ export interface BinaryMessenger { */ send(channel: String, message: ArrayBuffer | null): void; - /** - * Sends a binary message to the Flutter application, optionally expecting a reply. - * - *

Any uncaught exception thrown by the reply callback will be caught and logged. - * - * @param channel the name {@link String} of the logical channel used for the message. - * @param message the message payload, a direct-allocated {@link ByteBuffer} with the message - * bytes between position zero and current position, or null. - * @param callback a {@link BinaryReply} callback invoked when the Flutter application responds to - * the message, possibly null. - */ send(channel: String, message: ArrayBuffer, callback?: BinaryReply | null): void; - /** - * Registers a handler to be invoked when the Flutter application sends a message to its host - * platform. - * - *

Registration overwrites any previous registration for the same channel name. Use a null - * handler to deregister. - * - *

If no handler has been registered for a particular channel, any incoming message on that - * channel will be handled silently by sending a null reply. - * - * @param channel the name {@link String} of the channel. - * @param handler a {@link BinaryMessageHandler} to be invoked on incoming messages, or null. - * @param taskQueue a {@link BinaryMessenger.TaskQueue} that specifies what thread will execute - * the handler. Specifying null means execute on the platform thread. - */ setMessageHandler(channel: String, handler: BinaryMessageHandler | SendableBinaryMessageHandler | null, taskQueue?: TaskQueue, ...args: Object[]): void; } diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/MethodChannel.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/MethodChannel.ets index a624188a7f..4f0d6be0a7 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/MethodChannel.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/MethodChannel.ets @@ -17,19 +17,6 @@ import MethodCall from './MethodCall'; import MethodCodec from './MethodCodec'; import StandardMethodCodec from './StandardMethodCodec'; -/** - * A named channel for communicating with the Flutter application using asynchronous method calls. - * - *

Incoming method calls are decoded from binary on receipt, and Java results are encoded into - * binary before being transmitted back to Flutter. The {@link MethodCodec} used must be compatible - * with the one used by the Flutter application. This can be achieved by creating a MethodChannel - * counterpart of this channel on the Dart side. The Java type of method call arguments and results - * is {@code Object}, but only values supported by the specified {@link MethodCodec} can be used. - * - *

The logical identity of the channel is given by its name. Identically named channels will - * interfere with each other's communication. - */ export default class MethodChannel { static TAG = "MethodChannel#"; @@ -43,33 +30,10 @@ export default class MethodChannel { this.codec = codec } - /** - * Invokes a method on this channel, optionally expecting a result. - * - *

Any uncaught exception thrown by the result callback will be caught and logged. - * - * @param method the name String of the method. - * @param arguments the arguments for the invocation, possibly null. - * @param callback a {@link Result} callback for the invocation result, or null. - */ invokeMethod(method: string, args: Any, callback?: MethodResult): void { this.messenger.send(this.name, this.codec.encodeMethodCall(new MethodCall(method, args)), callback == null ? null : new IncomingResultHandler(callback, this.codec)); } - /** - * Registers a method call handler on this channel. - * - *

Overrides any existing handler registration for (the name of) this channel. - * - *

If no handler has been registered, any incoming method call on this channel will be handled - * silently by sending a null reply. This results in a MissingPluginException - * on the Dart side, unless an OptionalMethodChannel - * is used. - * - * @param handler a {@link MethodCallHandler}, or null to deregister. - */ setMethodCallHandler(handler: MethodCallHandler | null): void { this.messenger.setMessageHandler(this.name, handler == null ? null : new IncomingMethodCallHandler(handler, this.codec)); } @@ -86,27 +50,9 @@ export default class MethodChannel { /** A handler of incoming method calls. */ export interface MethodCallHandler { - /** - * Handles the specified method call received from Flutter. - * - *

Handler implementations must submit a result for all incoming calls, by making a single - * call on the given {@link Result} callback. Failure to do so will result in lingering Flutter - * result handlers. The result may be submitted asynchronously and on any thread. Calls to - * unknown or unimplemented methods should be handled using {@link Result#notImplemented()}. - * - *

Any uncaught exception thrown by this method will be caught by the channel implementation - * and logged, and an error result will be sent back to Flutter. - * - *

The handler is called on the platform thread (Android main thread) by default, or - * otherwise on the thread specified by the {@link BinaryMessenger.TaskQueue} provided to the - * associated {@link MethodChannel} when it was created. See also Threading in - * the Flutter Engine. - * - * @param call A {@link MethodCall}. - * @param result A {@link Result} used for submitting the result of the call. - */ + onMethodCall(call: MethodCall, result: MethodResult): void; + } /** @@ -127,15 +73,6 @@ export interface MethodResult { */ success: (result: Any) => void; - /** - * Handles an error result. - * - * @param errorCode An error code String. - * @param errorMessage A human-readable error message String, possibly null. - * @param errorDetails Error details, possibly null. The details must be an Object type - * supported by the codec. For instance, if you are using {@link StandardMessageCodec} - * (default), please see its documentation on what types are supported. - */ error: (errorCode: string, errorMessage: string, errorDetails: Any) => void; /** Handles a call to an unimplemented method. */ diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/MethodCodec.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/MethodCodec.ets index c61d977852..098e6398dd 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/MethodCodec.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/MethodCodec.ets @@ -10,15 +10,7 @@ import Any from './Any'; import MethodCall from './MethodCall'; -/** - * A codec for method calls and enveloped results. - * - *

Method calls are encoded as binary messages with enough structure that the codec can extract a - * method name String and an arguments Object. These data items are used to populate a {@link - * MethodCall}. - * - *

All operations throw {@link IllegalArgumentException}, if conversion fails. - */ + export default interface MethodCodec { /** * Encodes a message call into binary. @@ -47,29 +39,8 @@ export default interface MethodCodec { */ encodeSuccessEnvelope(result: Any): ArrayBuffer; - /** - * Encodes an error result into a binary envelope message. - * - * @param errorCode An error code String. - * @param errorMessage An error message String, possibly null. - * @param errorDetails Error details, possibly null. Consider supporting {@link Throwable} in your - * codec. This is the most common value passed to this field. - * @return a {@link ByteBuffer} containing the encoding between position 0 and the current - * position. - */ encodeErrorEnvelope(errorCode: string, errorMessage: string, errorDetails: Any): ArrayBuffer; - /** - * Encodes an error result into a binary envelope message with the native stacktrace. - * - * @param errorCode An error code String. - * @param errorMessage An error message String, possibly null. - * @param errorDetails Error details, possibly null. Consider supporting {@link Throwable} in your - * codec. This is the most common value passed to this field. - * @param errorStacktrace Platform stacktrace for the error. possibly null. - * @return a {@link ByteBuffer} containing the encoding between position 0 and the current - * position. - */ encodeErrorEnvelopeWithStacktrace(errorCode: string, errorMessage: string, errorDetails: Any, errorStacktrace: string): ArrayBuffer /** diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/SendableMethodCodec.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/SendableMethodCodec.ets index 3e416914a0..570fafa931 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/SendableMethodCodec.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/SendableMethodCodec.ets @@ -11,15 +11,7 @@ import { lang } from '@kit.ArkTS'; import Any from './Any'; import MethodCall from './MethodCall'; -/** - * A codec for method calls and enveloped results. - * - *

Method calls are encoded as binary messages with enough structure that the codec can extract a - * method name String and an arguments Object. These data items are used to populate a {@link - * MethodCall}. - * - *

All operations throw {@link IllegalArgumentException}, if conversion fails. - */ + type ISendable = lang.ISendable; export default interface SendableMethodCodec extends ISendable { /** @@ -49,29 +41,8 @@ export default interface SendableMethodCodec extends ISendable { */ encodeSuccessEnvelope(result: Any): ArrayBuffer; - /** - * Encodes an error result into a binary envelope message. - * - * @param errorCode An error code String. - * @param errorMessage An error message String, possibly null. - * @param errorDetails Error details, possibly null. Consider supporting {@link Throwable} in your - * codec. This is the most common value passed to this field. - * @return a {@link ByteBuffer} containing the encoding between position 0 and the current - * position. - */ encodeErrorEnvelope(errorCode: string, errorMessage: string, errorDetails: Any): ArrayBuffer; - /** - * Encodes an error result into a binary envelope message with the native stacktrace. - * - * @param errorCode An error code String. - * @param errorMessage An error message String, possibly null. - * @param errorDetails Error details, possibly null. Consider supporting {@link Throwable} in your - * codec. This is the most common value passed to this field. - * @param errorStacktrace Platform stacktrace for the error. possibly null. - * @return a {@link ByteBuffer} containing the encoding between position 0 and the current - * position. - */ encodeErrorEnvelopeWithStacktrace(errorCode: string, errorMessage: string, errorDetails: Any, errorStacktrace: string): ArrayBuffer /** diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/StandardMethodCodec.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/StandardMethodCodec.ets index cb3a0f2fdd..635dcd7d8a 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/StandardMethodCodec.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/StandardMethodCodec.ets @@ -15,16 +15,6 @@ import MethodCall from './MethodCall'; import MethodCodec from './MethodCodec'; import StandardMessageCodec from './StandardMessageCodec'; -/** - * A {@link MethodCodec} using the Flutter standard binary encoding. - * - *

This codec is guaranteed to be compatible with the corresponding StandardMethodCodec - * on the Dart side. These parts of the Flutter SDK are evolved synchronously. - * - *

Values supported as method arguments and result payloads are those supported by {@link - * StandardMessageCodec}. - */ export default class StandardMethodCodec implements MethodCodec { private static TAG = "StandardMethodCodec"; public static INSTANCE = new StandardMethodCodec(StandardMessageCodec.INSTANCE); diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextUtils.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextUtils.ets index 3dcd312ed1..54ce5265d1 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextUtils.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextUtils.ets @@ -138,7 +138,6 @@ export class FlutterTextUtils { return offset - deleteCharCount; } - // Keycaps if (codePoint == COMBINING_ENCLOSING_KEYCAP) { codePoint = FlutterTextUtils.codePointBefore(text, lastOffset); lastOffset -= FlutterTextUtils.charCount(codePoint); diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/platform/PlatformView.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/platform/PlatformView.ets index 51b452c37a..65e2f9b41a 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/platform/PlatformView.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/platform/PlatformView.ets @@ -22,22 +22,6 @@ export default abstract class PlatformView { return 'default'; } - /** Returns the DynamicView to be embedded in the Flutter hierarchy. */ - abstract getView(): WrappedBuilder<[Params]>; - /** - * Called by the {@link io.flutter.embedding.engine.FlutterEngine} that owns this {@code - * PlatformView} when the DynamicView responsible for rendering a Flutter UI is - * associated with the {@link io.flutter.embedding.engine.FlutterEngine}. - * - *

This means that our associated {@link io.flutter.embedding.engine.FlutterEngine} can now - * render a UI and interact with the user. - * - *

Some platform views may have unusual dependencies on the {@link View} that renders Flutter - * UIs, such as unique keyboard interactions. That {@link View} is provided here for those - * purposes. Use of this {@link View} should be avoided if it is not absolutely necessary, because - * depending on this {@link View} will tend to make platform view code more brittle to future - * changes. - */ onFlutterViewAttached(dvModel: DVModel): void {} /** -- Gitee From 368f8f2686ab7fa20a7ff8c5b482e8e67ed00c8c Mon Sep 17 00:00:00 2001 From: cjand <1747143535@qq.com> Date: Mon, 17 Feb 2025 20:25:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=AB=E6=8F=8F?= =?UTF-8?q?=E7=B1=BB=E4=BC=BC=E4=BB=A3=E7=A0=81=E7=89=87=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cjand <1747143535@qq.com> --- .../main/ets/embedding/engine/FlutterNapi.ets | 24 +++++-------------- .../embedding/engine/loader/FlutterLoader.ets | 11 --------- .../src/main/ets/plugin/editing/TextUtils.ets | 5 ---- 3 files changed, 6 insertions(+), 34 deletions(-) diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterNapi.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterNapi.ets index 37c50126ce..75ec3f3f3c 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterNapi.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterNapi.ets @@ -217,24 +217,12 @@ export default class FlutterNapi { , displayFeaturesType: Array, displayFeaturesState: Array): void { if (this.isAttached()) { flutter.nativeSetViewportMetrics(this.nativeShellHolderId!, devicePixelRatio, - physicalWidth, - physicalHeight, - physicalPaddingTop, - physicalPaddingRight, - physicalPaddingBottom, - physicalPaddingLeft, - physicalViewInsetTop, - physicalViewInsetRight, - physicalViewInsetBottom, - physicalViewInsetLeft, - systemGestureInsetTop, - systemGestureInsetRight, - systemGestureInsetBottom, - systemGestureInsetLeft, - physicalTouchSlop, - displayFeaturesBounds, - displayFeaturesType, - displayFeaturesState); + physicalWidth, physicalHeight, physicalPaddingTop, physicalPaddingRight, + physicalPaddingBottom, physicalPaddingLeft, physicalViewInsetTop, + physicalViewInsetRight, physicalViewInsetBottom, physicalViewInsetLeft, + systemGestureInsetTop, systemGestureInsetRight, systemGestureInsetBottom, + systemGestureInsetLeft, physicalTouchSlop, displayFeaturesBounds, + displayFeaturesType, displayFeaturesState); } } diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/loader/FlutterLoader.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/loader/FlutterLoader.ets index a5c5dd6ecb..51c2d50003 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/loader/FlutterLoader.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/loader/FlutterLoader.ets @@ -73,17 +73,6 @@ export default class FlutterLoader { this.flutterNapi = flutterNapi; } - /** - * Starts initialization of the native system. - * - *

This loads the Flutter engine's native library to enable subsequent JNI calls. This also - * starts locating and unpacking Dart resources packaged in the app's APK. - * - *

Calling this method multiple times has no effect. - * - * @param applicationContext The Android application context. - * @param settings Configuration settings. - */ async startInitialization(context: common.Context) { Log.d(TAG, "flutterLoader start init") this.initStartTimestampMillis = Date.now(); diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextUtils.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextUtils.ets index 54ce5265d1..afb9f6f37c 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextUtils.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextUtils.ets @@ -152,11 +152,6 @@ export class FlutterTextUtils { return offset - deleteCharCount; } - /** - * Following if statements for Emoji tag sequence and Variation selector are skipping these - * modifiers for going through the last statement that is for handling emojis. They return the - * offset if they don't find proper base characters - */ // Emoji Tag Sequence if (codePoint == CANCEL_TAG) { // tag_end codePoint = FlutterTextUtils.codePointBefore(text, lastOffset); -- Gitee