2
* Copyright (c) 2024 Huawei Device Co., Ltd.
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at
7
* http://www.apache.org/licenses/LICENSE-2.0
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
16
package org.koalaui.arkoala;
18
public class NativeModule {
20
Runtime.getRuntime().loadLibrary("NativeBridgeJni");
25
static native long _StringMake(String string);
26
static native int _StringLength(long ptr);
27
static native void _StringData(long ptr, byte[] arg1, int arg2);
28
static native long _GetStringFinalizer();
29
static native int _GetPtrVectorSize(long ptr);
30
static native long _GetGroupedLog(int kind);
31
static native long _GetPtrVectorElement(long ptr, int index);
32
static native void _InvokeFinalizer(long func, long obj);
33
static native long _GetNodeFinalizer();
34
static native void _StartGroupedLog(int index);
35
static native void _StopGroupedLog(int index);
36
static native int _TestPerfNumber(int value);
37
static native void _TestPerfNumberWithArray(byte[] data, int length);
38
static native void _StartPerf(String traceName);
39
static native void _EndPerf(String traceName);
40
static native long _DumpPerf(int options);
41
static native int _ManagedStringWrite(String string, byte[] buffer, int offset);
42
static native void _Test_SetEventsApi();
43
static native void _Test_Common_OnChildTouchTest(byte[] valueArray, int valueSerializerLength);
44
static native void _Test_List_OnScrollVisibleContentChange(byte[] valueArray, int valueSerializerLength);
45
static native void _Test_TextPicker_OnAccept(byte[] valueArray, int valueSerializerLength);
47
static native long _CreateNode(int type, int id, int flags);
48
static native long _GetNodeByViewStack();
49
static native void _DisposeNode(long nodePtr);
50
static native void _Dump(long nodePtr);
51
static native int _AddChild(long parent, long child);
52
static native void _RemoveChild(long parent, long child);
53
static native int _InsertChildAfter(long parent, long child, long sibling);
54
static native int _InsertChildBefore(long parent, long child, long sibling);
55
static native int _InsertChildAt(long parent, long child, int position);
56
// static native void _RegisterNodeAsyncEvent(long nodePtr, int kind, long extraParam);
57
static native void _UnRegisterNodeAsyncEvent(long nodePtr, int kind);
58
static native void _RegisterNodeAsyncEventReceiver(long eventReceiver);
59
static native void _UnRegisterNodeAsyncEventReceiver();
60
static native void _ApplyModifierFinish(long nodePtr);
61
static native void _MarkDirty(long nodePtr, int dirtyFlag);
62
static native boolean _IsBuilderNode(long nodePtr);
63
static native void _MeasureLayoutAndDraw(long nodePtr);
64
static native int _MeasureNode(long nodePtr, float[] data);
65
static native int _LayoutNode(long nodePtr, float[] data);
66
static native int _DrawNode(long nodePtr, float[] data);
67
static native int _IndexerChecker(long nodePtr);
68
static native void _SetLazyItemIndexer(long nodePtr, int indexerId);
69
static native void _SetCustomCallback(long nodePtr, int updaterId);
70
static native void _SetMeasureWidth(long nodePtr, int value);
71
static native int _GetMeasureWidth(long nodePtr);
72
static native void _SetMeasureHeight(long nodePtr, int value);
73
static native int _GetMeasureHeight(long nodePtr);
74
static native void _SetX(long nodePtr, int value);
75
static native int _GetX(long nodePtr);
76
static native void _SetY(long nodePtr, int value);
77
static native int _GetY(long nodePtr);
78
static native void _SetAlignment(long nodePtr, int value);
79
static native int _GetAlignment(long nodePtr);
80
static native void _SetRangeUpdater(long nodePtr, int updaterId);
82
static native void _SetChildTotalCount(long nodePtr, int totalCount);
84
static native void _ShowCrash(String message);
86
static native long _GetPipelineContext(long nodePtr);
87
static native void _SetVsyncCallback(long pipelineContext, int callbackId);
88
static native void _UnblockVsyncWait(long pipelineContext);
89
static native float _ConvertLengthMetricsUnit(float value, int originUnit, int targetUnit);