Commit 0f31a59a authored by zhangying's avatar zhangying

IR001-SR002

parents
*.iml
.kotlin
.gradle
**/build/
xcuserdata
!src/**/build/
local.properties
.idea
.DS_Store
captures
.externalNativeBuild
.cxx
test_execution.log
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcodeproj/project.xcworkspace/
!*.xcworkspace/contents.xcworkspacedata
**/xcshareddata/WorkspaceSettings.xcsettings
node_modules/
test-reports/
includeTemp/
\ No newline at end of file
Initialized native services in: /Users/liluo/.gradle/native
Initialized jansi services in: /Users/liluo/.gradle/native
Found daemon DaemonInfo{pid=75162, address=[e11487d2-e870-4c5f-ae14-3a7baa5589cd port:59816, addresses:[/127.0.0.1]], state=Idle, lastBusy=1766641409813, context=DefaultDaemonContext[uid=bcf53fd5-f12c-4c95-b6d9-e8c751f4393f,javaHome=/Applications/Android Studio.app/Contents/jbr/Contents/Home,javaVersion=21,javaVendor=JetBrains s.r.o.,daemonRegistryDir=/Users/liluo/.gradle/daemon,pid=75162,idleTimeout=10800000,priority=NORMAL,applyInstrumentationAgent=true,nativeServicesMode=ENABLED,daemonOpts=-Xmx4096M,-Dfile.encoding=UTF-8,-Duser.country=CN,-Duser.language=zh,-Duser.variant]} however its context does not match the desired criteria.
JVM is incompatible.
Wanted: DaemonRequestContext{jvmCriteria=/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home (no JDK specified, using current Java home), daemonOpts=[-Xmx4096M, -Dfile.encoding=UTF-8, -Duser.country=CN, -Duser.language=zh, -Duser.variant], applyInstrumentationAgent=true, nativeServicesMode=ENABLED, priority=NORMAL}
Actual: DefaultDaemonContext[uid=bcf53fd5-f12c-4c95-b6d9-e8c751f4393f,javaHome=/Applications/Android Studio.app/Contents/jbr/Contents/Home,javaVersion=21,javaVendor=JetBrains s.r.o.,daemonRegistryDir=/Users/liluo/.gradle/daemon,pid=75162,idleTimeout=10800000,priority=NORMAL,applyInstrumentationAgent=true,nativeServicesMode=ENABLED,daemonOpts=-Xmx4096M,-Dfile.encoding=UTF-8,-Duser.country=CN,-Duser.language=zh,-Duser.variant]
Looking for a different daemon...
The client will now receive all logging from the daemon (pid: 52727). The daemon log file: /Users/liluo/.gradle/daemon/8.14.3/daemon-52727.out.log
Starting 57th build in daemon [uptime: 5 hrs 37 mins 29.876 secs, performance: 100%, GC rate: 0.00/s, heap usage: 4% of 4 GiB]
Using 14 worker leases.
Now considering [/Users/liluo/mine/projects/kmp/kmp-capi] as hierarchies to watch
Reusing configuration cache.
Now considering [/Users/liluo/mine/projects/kmp/kmp-capi] as hierarchies to watch
Watching the file system is configured to be enabled if available
File system watching is active
Using local directory build cache for the root build (location = /Users/liluo/.gradle/caches/build-cache-1, remove unused entries = after 7 days).
Tasks to be executed: [task ':composeApp:kmpPartiallyResolvedDependenciesChecker', task ':composeApp:checkKotlinGradlePluginConfigurationErrors', task ':composeApp:downloadKotlinNativeDistribution', task ':composeApp:compileKotlinOhosArm64']
Tasks that were excluded: []
Resolve mutations for :composeApp:kmpPartiallyResolvedDependenciesChecker (Thread[Execution worker,5,main]) started.
Resolve mutations for :composeApp:downloadKotlinNativeDistribution (Thread[Execution worker Thread 2,5,main]) started.
:composeApp:kmpPartiallyResolvedDependenciesChecker (Thread[Execution worker,5,main]) started.
:composeApp:downloadKotlinNativeDistribution (Thread[Execution worker Thread 2,5,main]) started.
> Task :composeApp:kmpPartiallyResolvedDependenciesChecker
Caching disabled for task ':composeApp:kmpPartiallyResolvedDependenciesChecker' because:
This task is not intended for execution
Task ':composeApp:kmpPartiallyResolvedDependenciesChecker' is not up-to-date because:
Task has not declared any outputs despite executing actions.
Execution stopped by some action with message: null
Resolve mutations for :composeApp:checkKotlinGradlePluginConfigurationErrors (Thread[Execution worker,5,main]) started.
Build 3d72bc78-a843-4599-a7a1-31ffbd23ec35 is started
:composeApp:checkKotlinGradlePluginConfigurationErrors (Thread[Execution worker,5,main]) started.
> Task :composeApp:checkKotlinGradlePluginConfigurationErrors SKIPPED
Skipping task ':composeApp:checkKotlinGradlePluginConfigurationErrors' as task onlyIf 'errorDiagnostics are present' is false.
> Task :composeApp:downloadKotlinNativeDistribution UP-TO-DATE
Kotlin Native Bundle: Acquire lock: /Users/liluo/.konan/kotlin-native-prebuilt-macos-aarch64-2.2.21-ohos-01/.lock ...
Kotlin Native Bundle: Lock acquired: /Users/liluo/.konan/kotlin-native-prebuilt-macos-aarch64-2.2.21-ohos-01/.lock
Kotlin Native Bundle: Lock released: /Users/liluo/.konan/kotlin-native-prebuilt-macos-aarch64-2.2.21-ohos-01/.lock
Build cache key for task ':composeApp:downloadKotlinNativeDistribution' is 9273d577ee8b60b158bbec6fa2f7f1c1
Skipping task ':composeApp:downloadKotlinNativeDistribution' as it is up-to-date.
Resolve mutations for :composeApp:compileKotlinOhosArm64 (Thread[Execution worker Thread 2,5,main]) started.
:composeApp:compileKotlinOhosArm64 (Thread[Execution worker Thread 2,5,main]) started.
> Task :composeApp:compileKotlinOhosArm64
Kotlin Native Bundle: Acquire lock: /Users/liluo/.konan/kotlin-native-prebuilt-macos-aarch64-2.2.21-ohos-01/.lock ...
Kotlin Native Bundle: Lock acquired: /Users/liluo/.konan/kotlin-native-prebuilt-macos-aarch64-2.2.21-ohos-01/.lock
Kotlin Native Bundle: Lock released: /Users/liluo/.konan/kotlin-native-prebuilt-macos-aarch64-2.2.21-ohos-01/.lock
Build cache key for task ':composeApp:compileKotlinOhosArm64' is 76a41cd61dab48a66dffb84e476394f4
Task ':composeApp:compileKotlinOhosArm64' is not up-to-date because:
Task has failed previously.
file or directory '/Users/liluo/mine/projects/kmp/kmp-capi/composeApp/src/nativeMain/kotlin', not found
file or directory '/Users/liluo/mine/projects/kmp/kmp-capi/composeApp/src/nativeMain/kotlin', not found
file or directory '/Users/liluo/mine/projects/kmp/kmp-capi/composeApp/src/nativeMain/kotlin', not found
Stored cache entry for task ':composeApp:compileKotlinOhosArm64' with cache key 76a41cd61dab48a66dffb84e476394f4
Build 3d72bc78-a843-4599-a7a1-31ffbd23ec35 is closed
BUILD SUCCESSFUL in 742ms
3 actionable tasks: 2 executed, 1 up-to-date
Watched directory hierarchies: [/Users/liluo/mine/projects/kmp/kmp-capi]
Configuration cache entry reused.
# KMP-CAPI HarmonyOS Interop 示例项目
本项目是一个 Kotlin Multiplatform (KMP) 工程,展示了如何在 HarmonyOS (OpenHarmony) 平台上,通过 Kotlin/Native 与 HarmonyOS 的 C-API (ArkUI Native Node API & Custom Dialog API) 进行深度交互。
核心特色:**在 Kotlin/C++ 侧直接构建原生 UI 并控制系统组件,无需完全依赖 ArkTS。**
## 1. 项目结构
* **`composeApp/`**: KMP 共享代码模块。
* `src/commonMain`: 跨平台通用业务逻辑。
* `src/ohosArm64Main`: **[核心]** HarmonyOS 特有的 Kotlin/Native 实现。包含与 C-API 交互的绑定(`cinterop`)和导出给 C++ 的接口(`OhosExports.kt`)。
* **`harmonyApp/`**: HarmonyOS 原生工程(DevEco Studio 工程)。
* `entry/src/main/cpp`: **[核心]** C++ 桥接层(NAPI)。负责实现具体的 UI 构建逻辑(`entry_module.cpp`),并将 Kotlin 接口暴露给 ArkTS。
* `entry/src/main/ets`: ArkTS UI 界面,作为应用入口。
## 2. 环境要求
* **IDE**:
* IntelliJ IDEA / Android Studio (用于编写 Kotlin 代码)
* DevEco Studio (用于编译和运行 HarmonyOS 应用)
* **SDK**:
* HarmonyOS SDK (API 12+ / OpenHarmony 5.0+) - **必须支持 ArkUI Native Node API**
* **语言**:
* Kotlin 1.9+
* Java 17+
* C++ (CMake)
## 3. 如何启动运行
### 步骤 1: 编译 Kotlin/Native 产物
在项目根目录下运行以下命令,将 Kotlin 代码编译为动态库(`libkn.so`)并发布到 HarmonyOS 工程中:
```bash
./gradlew publishDebugBinariesToHarmonyApp
```
*此任务会自动将生成的 `.so` 文件和头文件复制到 `harmonyApp/entry/libs` 和 `harmonyApp/entry/src/main/cpp/include` 目录。*
### 步骤 2: 运行 HarmonyOS 应用
1. 使用 **DevEco Studio** 打开 `harmonyApp` 目录。
2. 等待 Sync 完成。
3. 连接 HarmonyOS 真机或启动模拟器(API 12+)。
4. 点击 **Run 'entry'**
---
## 4. 核心功能详解:Kotlin 调用 HarmonyOS Native 弹窗
本项目成功实现了一个复杂的场景:**在 C++ 层构建 UI 节点树,传递给 Kotlin 层,再由 Kotlin 层调用 ArkUI C-API 显示原生自定义弹窗。**
### 实现原理
1. **C++ (ArkUI Node API)**: 动态创建 UI 组件树(Column, Row, Text, Button)。
2. **Kotlin/Native (Interop)**: 接收 C++ 创建的 Node 指针,封装为 `ArkUI_CustomDialogOptions`
3. **ArkUI Dialog API**: 调用 `OH_ArkUI_CustomDialog_OpenDialog` 显示弹窗。
### 详细实现步骤
#### 1. C++ 侧构建复杂 UI (`entry_module.cpp`)
我们在 C++ 中使用 `ArkUI_NativeNodeAPI_1` 手动构建一个包含标题栏、内容区和底部按钮的复杂布局。
```cpp
// 示例:创建复杂的弹窗内容节点
ArkUI_NodeHandle root = api->createNode(ARKUI_NODE_COLUMN);
// 设置 Padding
ArkUI_NumberValue paddingValue[] = {{.f32 = 12.0f}, {.f32 = 12.0f}, ...};
api->setAttribute(root, NODE_PADDING, &paddingItem);
// 创建标题栏 (Row)
ArkUI_NodeHandle titleRow = api->createNode(ARKUI_NODE_ROW);
ArkUI_NodeHandle titleText = CreateTextNode(api, "标题", 20.0f);
ArkUI_NodeHandle closeBtn = CreateTextNode(api, "X", 20.0f);
// 注册点击事件 (关闭弹窗)
api->registerNodeEvent(closeBtn, NODE_ON_CLICK, 0, nullptr);
api->addNodeEventReceiver(closeBtn, OnCloseDialog); // OnCloseDialog 调用 closeBasicDialog()
// ... 组装节点树 ...
api->addChild(root, titleRow);
api->addChild(root, contentText);
api->addChild(root, buttonRow);
// 将生成的根节点指针转换为 long 传递给 Kotlin
openBasicDialog(reinterpret_cast<int64_t>(root));
```
#### 2. Kotlin 侧定义弹窗逻辑 (`OhosExports.kt`)
Kotlin 侧通过 `@CName` 暴露接口给 C++,接收 Node 指针,并配置弹窗样式。
```kotlin
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
@CName("openBasicDialog")
fun openBasicDialog(nodeAddress: Long): Int {
// 1. 将 long 转换回 C 指针
val node = if (nodeAddress == 0L) null else nodeAddress.toCPointer<COpaque>()
if (node == null) return -31
// 2. 创建弹窗选项 (Options)
val options = OH_ArkUI_CustomDialog_CreateOptions(node)
// 3. 配置弹窗样式 (去除默认大圆角,设置白底)
OH_ArkUI_CustomDialog_SetModalMode(options, true)
OH_ArkUI_CustomDialog_SetCornerRadius(options, 10f, 10f, 10f, 10f) // 设置 10vp 圆角
OH_ArkUI_CustomDialog_SetBackgroundColor(options, 0xFFFFFFFF.toUInt()) // 白色背景
// 4. 定义回调 (DialogId 用于关闭)
val cb = staticCFunction { dialogId: Int ->
lastDialogId = dialogId // 保存 ID 用于后续关闭
Unit
}
// 5. 打开弹窗
val code = OH_ArkUI_CustomDialog_OpenDialog(options, cb)
return code
}
```
#### 3. C++ 侧事件处理与关闭
当用户点击 C++ 创建的按钮时,触发回调,调用 Kotlin 暴露的关闭函数。
```cpp
// entry_module.cpp
void OnCloseDialog(ArkUI_NodeEvent* event) {
closeBasicDialog(); // 调用 Kotlin 暴露的关闭函数
}
// OhosExports.kt
@CName("closeBasicDialog")
fun closeBasicDialog(): Int {
return OH_ArkUI_CustomDialog_CloseDialog(lastDialogId)
}
```
#### 4. ArkTS 入口调用
最终在 ArkTS 侧,只需要简单地调用 NAPI 暴露的方法即可触发整个流程。
```typescript
// Index.ets
import { openBasicDialog } from 'libentry.so';
Button("Options样式弹窗")
.onClick(() => {
// 触发 C++ -> Kotlin -> ArkUI Native 的调用链
openBasicDialog();
})
```
## 5. 常见问题排查
* **Crash (SIGSEGV)**: 通常是因为传递了无效的 Node 指针给 `OH_ArkUI_CustomDialog_CreateOptions`。请确保 Node 已正确创建且未被释放。
* **弹窗样式异常(大圆角/透明)**: 默认系统样式可能带有较大的圆角。使用 `OH_ArkUI_CustomDialog_SetCornerRadius``OH_ArkUI_CustomDialog_SetBackgroundColor` 进行显式配置。
* **Error -31**: 自定义错误码,表示传入的 Node 指针为空。
---
Happy Coding with KMP & HarmonyOS!
plugins {
// this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
}
\ No newline at end of file
import android.databinding.tool.ext.capitalizeUS
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidApplication)
}
kotlin {
androidTarget {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
}
listOf(
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "ComposeApp"
isStatic = true
}
}
ohosArm64 {
binaries.sharedLib {
baseName = "kn"
// linkerOpts(
// "-lnative_drawing",
// "-lpixelmap",
// "-lpixelmap_ndk.z",
// "-lace_ndk.z",
// "-lace_napi.z",
// "-lhilog_ndk.z",
// "-limage_source",
// "-lhitrace_ndk.z",
// "-luv",
// "-lnative_window",
// "-lunwind",
// )
// // 在debug和release模式,让gradle都打包带符号表的so
// // release包在鸿蒙应用打包时strip掉so中的符号表
// // 打包出的符号表可以对现网崩溃进行 addr2line
// debuggable = true
}
compilations.all {
compilerOptions.configure {
// uncomment below to enable address asnitizer
// freeCompilerArgs.add("-Xbinary=sanitizer=address")
}
}
val main by compilations.getting
}
sourceSets {
androidMain.dependencies {}
commonMain.dependencies {
}
commonTest.dependencies {
implementation(libs.kotlin.test)
}
val ohosArm64Main by getting
}
}
android {
namespace = "com.example.kmpmultiplatform"
compileSdk = libs.versions.android.compileSdk.get().toInt()
defaultConfig {
applicationId = "com.example.kmpmultiplatform"
minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk = libs.versions.android.targetSdk.get().toInt()
versionCode = 1
versionName = "1.0"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}
dependencies {}
arrayOf("debug", "release").forEach { type ->
tasks.register<Copy>("publish${type.capitalizeUS()}BinariesToHarmonyApp") {
group = "harmony"
dependsOn("link${type.capitalizeUS()}SharedOhosArm64")
into(rootProject.file("harmonyApp"))
from("build/bin/ohosArm64/${type}Shared/libkn_api.h") {
into("entry/src/main/cpp/include/")
}
from(project.file("build/bin/ohosArm64/${type}Shared/libkn.so")) {
into("entry/libs/arm64-v8a/")
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@android:style/Theme.Material.Light.NoActionBar">
<activity
android:exported="true"
android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
package com.example.kmpmultiplatform
import android.app.Activity
import android.os.Bundle
import android.graphics.Color
import android.graphics.Typeface
import android.view.Gravity
import android.widget.FrameLayout
import android.widget.TextView
class MainActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val content = App()
val tv = TextView(this)
tv.text = content.text
tv.setTextColor(Color.parseColor(content.colorHex))
tv.textSize = content.sizeSp
tv.typeface = if (content.bold) Typeface.DEFAULT_BOLD else Typeface.DEFAULT
val container = FrameLayout(this)
val lp = FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT
)
lp.gravity = Gravity.CENTER
container.addView(tv, lp)
setContentView(container)
}
}
package com.example.kmpmultiplatform
import android.os.Build
class AndroidPlatform : Platform {
override val name: String = "Android ${Build.VERSION.SDK_INT}"
}
actual fun getPlatform(): Platform = AndroidPlatform()
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<resources>
<string name="app_name">KMPMultiplatform</string>
</resources>
\ No newline at end of file
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="450dp"
android:height="450dp"
android:viewportWidth="64"
android:viewportHeight="64">
<path
android:pathData="M56.25,18V46L32,60 7.75,46V18L32,4Z"
android:fillColor="#6075f2"/>
<path
android:pathData="m41.5,26.5v11L32,43V60L56.25,46V18Z"
android:fillColor="#6b57ff"/>
<path
android:pathData="m32,43 l-9.5,-5.5v-11L7.75,18V46L32,60Z">
<aapt:attr name="android:fillColor">
<gradient
android:centerX="23.131"
android:centerY="18.441"
android:gradientRadius="42.132"
android:type="radial">
<item android:offset="0" android:color="#FF5383EC"/>
<item android:offset="0.867" android:color="#FF7F52FF"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M22.5,26.5 L32,21 41.5,26.5 56.25,18 32,4 7.75,18Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="44.172"
android:startY="4.377"
android:endX="17.973"
android:endY="34.035"
android:type="linear">
<item android:offset="0" android:color="#FF33C3FF"/>
<item android:offset="0.878" android:color="#FF5383EC"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="m32,21 l9.526,5.5v11L32,43 22.474,37.5v-11z"
android:fillColor="#000000"/>
</vector>
\ No newline at end of file
package com.example.kmpmultiplatform
data class AppText(
val text: String,
val colorHex: String,
val sizeSp: Float,
val bold: Boolean
)
fun App(): AppText = AppText(
text = "Hello World",
colorHex = "#181818",
sizeSp = 32f,
bold = true
)
package com.example.kmpmultiplatform
class Greeting {
private val platform = getPlatform()
fun greet(): String {
return "Hello, ${platform.name}!"
}
}
\ No newline at end of file
package com.example.kmpmultiplatform
interface Platform {
val name: String
}
expect fun getPlatform(): Platform
\ No newline at end of file
package com.example.kmpmultiplatform
import kotlin.test.Test
import kotlin.test.assertEquals
class ComposeAppCommonTest {
@Test
fun example() {
assertEquals(3, 1 + 2)
}
}
\ No newline at end of file
package com.example.kmpmultiplatform
import platform.UIKit.UIColor
import platform.UIKit.UIViewController
import platform.UIKit.UILabel
import platform.UIKit.UITextAlignmentCenter
import platform.UIKit.UIFont
import platform.CoreGraphics.CGRectMake
import platform.CoreGraphics.CGPointMake
private fun uiColorFromHex(hex: String): UIColor {
val clean = if (hex.startsWith("#")) hex.substring(1) else hex
val value = clean.toLong(16)
val r = ((value shr 16) and 0xFF).toDouble() / 255.0
val g = ((value shr 8) and 0xFF).toDouble() / 255.0
val b = (value and 0xFF).toDouble() / 255.0
return UIColor(red = r, green = g, blue = b, alpha = 1.0)
}
private class MainViewControllerImpl : UIViewController() {
private val label = UILabel(frame = CGRectMake(0.0, 0.0, 300.0, 80.0))
override fun viewDidLoad() {
super.viewDidLoad()
val content = App()
view.backgroundColor = UIColor.whiteColor
label.text = content.text
label.textAlignment = UITextAlignmentCenter
label.textColor = uiColorFromHex(content.colorHex)
label.font = if (content.bold) UIFont.boldSystemFontOfSize(content.sizeSp.toDouble())
else UIFont.systemFontOfSize(content.sizeSp.toDouble())
label.sizeToFit()
view.addSubview(label)
}
override fun viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
label.center = CGPointMake(view.center.x, view.center.y)
}
}
fun MainViewController(): UIViewController {
return MainViewControllerImpl()
}
package com.example.kmpmultiplatform
import platform.UIKit.UIDevice
class IOSPlatform: Platform {
override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion
}
actual fun getPlatform(): Platform = IOSPlatform()
\ No newline at end of file
#ifndef GLOBAL_RAW_FILE_H
#define GLOBAL_RAW_FILE_H
#ifdef __cplusplus
extern "C" {
#endif
struct RawFile;
typedef struct RawFile RawFile;
int OH_ResourceManager_ReadRawFile(const RawFile *rawFile, void *buf, size_t length);
long OH_ResourceManager_GetRawFileSize(RawFile *rawFile);
void OH_ResourceManager_CloseRawFile(RawFile *rawFile);
#ifdef __cplusplus
};
#endif
/** @} */
#endif // GLOBAL_RAW_FILE_H
#ifndef GLOBAL_NATIVE_RESOURCE_MANAGER_H
#define GLOBAL_NATIVE_RESOURCE_MANAGER_H
#include "napi/native_api.h"
#include "raw_file.h"
#ifdef __cplusplus
extern "C" {
#endif
struct NativeResourceManager;
typedef struct NativeResourceManager NativeResourceManager;
NativeResourceManager *OH_ResourceManager_InitNativeResourceManager(napi_env env, napi_value jsResMgr);
void OH_ResourceManager_ReleaseNativeResourceManager(NativeResourceManager *resMgr);
RawFile *OH_ResourceManager_OpenRawFile(const NativeResourceManager *mgr, const char *fileName);
#ifdef __cplusplus
};
#endif
/** @} */
#endif // GLOBAL_NATIVE_RESOURCE_MANAGER_H
package = platform.resource
headers = raw_file_manager.h raw_file.h
\ No newline at end of file
package = sanTest
headers = san_test.h
package com.example.kmpmultiplatform
class OHOSPlatform : Platform {
override val name: String = "OpenHarmony"
}
actual fun getPlatform(): Platform = OHOSPlatform()
package com.example.test.AVCodecKit.AVCapability
import kotlinx.cinterop.*
import kotlin.experimental.ExperimentalNativeApi
import platform.AVCodecKit.AVCapability.*
import platform.AVCodecKit.Core.*
import com.example.test.common.ApiGuard
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetName")
fun avcGetName(mime: String, isEncoder: UInt): String {
return ApiGuard.guardString {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
val p = OH_AVCapability_GetName(cap)
p?.toKString() ?: "error"
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetMaxSupportedInstances")
fun avcGetMaxSupportedInstances(mime: String, isEncoder: UInt): Int {
return ApiGuard.guardInt {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
OH_AVCapability_GetMaxSupportedInstances(cap)
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcIsHardware")
fun avcIsHardware(mime: String, isEncoder: UInt): Int {
return ApiGuard.guardInt {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
if (OH_AVCapability_IsHardware(cap)) 1 else 0
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetEncoderBitrateRange")
fun avcGetEncoderBitrateRange(mime: String): String {
return ApiGuard.guardString {
val cap = OH_AVCodec_GetCapability(mime, true)
memScoped {
val range = alloc<OH_AVRange>()
val code = OH_AVCapability_GetEncoderBitrateRange(cap, range.ptr)
if (code == 0u) "${range.minVal},${range.maxVal}" else "error"
}
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetVideoWidthRange")
fun avcGetVideoWidthRange(mime: String, isEncoder: UInt): String {
return ApiGuard.guardString {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
memScoped {
val range = alloc<OH_AVRange>()
val code = OH_AVCapability_GetVideoWidthRange(cap, range.ptr)
if (code == 0u) "${range.minVal},${range.maxVal}" else "error"
}
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetVideoHeightRange")
fun avcGetVideoHeightRange(mime: String, isEncoder: UInt): String {
return ApiGuard.guardString {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
memScoped {
val range = alloc<OH_AVRange>()
val code = OH_AVCapability_GetVideoHeightRange(cap, range.ptr)
if (code == 0u) "${range.minVal},${range.maxVal}" else "error"
}
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcIsVideoSizeSupported")
fun avcIsVideoSizeSupported(mime: String, isEncoder: UInt, width: Int, height: Int): Int {
return ApiGuard.guardInt {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
if (OH_AVCapability_IsVideoSizeSupported(cap, width, height)) 1 else 0
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetVideoFrameRateRange")
fun avcGetVideoFrameRateRange(mime: String, isEncoder: UInt): String {
return ApiGuard.guardString {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
memScoped {
val range = alloc<OH_AVRange>()
val code = OH_AVCapability_GetVideoFrameRateRange(cap, range.ptr)
if (code == 0u) "${range.minVal},${range.maxVal}" else "error"
}
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetNameByCategory")
fun avcGetNameByCategory(mime: String, isEncoder: UInt, category: UInt): String {
return ApiGuard.guardString {
val cap = OH_AVCodec_GetCapabilityByCategory(mime, isEncoder != 0u, category)
val p = OH_AVCapability_GetName(cap)
p?.toKString() ?: "error"
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetVideoWidthAlignment")
fun avcGetVideoWidthAlignment(mime: String, isEncoder: UInt): Int {
return ApiGuard.guardInt {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
memScoped {
val align = alloc<IntVar>()
val code = OH_AVCapability_GetVideoWidthAlignment(cap, align.ptr)
if (code == 0u) align.value else -1
}
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetVideoHeightAlignment")
fun avcGetVideoHeightAlignment(mime: String, isEncoder: UInt): Int {
return ApiGuard.guardInt {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
memScoped {
val align = alloc<IntVar>()
val code = OH_AVCapability_GetVideoHeightAlignment(cap, align.ptr)
if (code == 0u) align.value else -1
}
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetVideoWidthRangeForHeight")
fun avcGetVideoWidthRangeForHeight(mime: String, isEncoder: UInt, height: Int): String {
return ApiGuard.guardString {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
memScoped {
val range = alloc<OH_AVRange>()
val code = OH_AVCapability_GetVideoWidthRangeForHeight(cap, height, range.ptr)
if (code == 0u) "${range.minVal},${range.maxVal}" else "error"
}
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetVideoHeightRangeForWidth")
fun avcGetVideoHeightRangeForWidth(mime: String, isEncoder: UInt, width: Int): String {
return ApiGuard.guardString {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
memScoped {
val range = alloc<OH_AVRange>()
val code = OH_AVCapability_GetVideoHeightRangeForWidth(cap, width, range.ptr)
if (code == 0u) "${range.minVal},${range.maxVal}" else "error"
}
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetVideoFrameRateRangeForSize")
fun avcGetVideoFrameRateRangeForSize(mime: String, isEncoder: UInt, width: Int, height: Int): String {
return ApiGuard.guardString {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
memScoped {
val range = alloc<OH_AVRange>()
val code = OH_AVCapability_GetVideoFrameRateRangeForSize(cap, width, height, range.ptr)
if (code == 0u) "${range.minVal},${range.maxVal}" else "error"
}
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcAreVideoSizeAndFrameRateSupported")
fun avcAreVideoSizeAndFrameRateSupported(mime: String, isEncoder: UInt, width: Int, height: Int, frameRate: Int): Int {
return ApiGuard.guardInt {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
if (OH_AVCapability_AreVideoSizeAndFrameRateSupported(cap, width, height, frameRate)) 1 else 0
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcIsFeatureSupported")
fun avcIsFeatureSupported(mime: String, isEncoder: UInt, feature: UInt): Int {
return ApiGuard.guardInt {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
if (OH_AVCapability_IsFeatureSupported(cap, feature)) 1 else 0
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetFeaturePropertiesDump")
fun avcGetFeaturePropertiesDump(mime: String, isEncoder: UInt, feature: UInt): String {
return ApiGuard.guardString {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
val fmt = OH_AVCapability_GetFeatureProperties(cap, feature)
val s = OH_AVFormat_DumpInfo(fmt)
val ret = s?.toKString() ?: "error"
OH_AVFormat_Destroy(fmt)
ret
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("getAVCapabilityEnumValuesJson")
fun getAVCapabilityEnumValuesJson(): String {
return """
{
"AVCodecCategory": {
"HARDWARE": $HARDWARE,
"SOFTWARE": $SOFTWARE
},
"AVCapabilityFeature": {
"VIDEO_ENCODER_TEMPORAL_SCALABILITY": $VIDEO_ENCODER_TEMPORAL_SCALABILITY,
"VIDEO_ENCODER_LONG_TERM_REFERENCE": $VIDEO_ENCODER_LONG_TERM_REFERENCE,
"VIDEO_LOW_LATENCY": $VIDEO_LOW_LATENCY,
"VIDEO_ENCODER_B_FRAME": $VIDEO_ENCODER_B_FRAME
}
}
""".trimIndent()
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetAudioSupportedSampleRates")
fun avcGetAudioSupportedSampleRates(mime: String, isEncoder: UInt): String {
return ApiGuard.guardString {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
memScoped {
val ratesPtr = alloc<CPointerVar<IntVar>>()
val num = alloc<UIntVar>()
val code = OH_AVCapability_GetAudioSupportedSampleRates(cap, ratesPtr.ptr, num.ptr)
if (code == 0u) {
val count = num.value.toInt()
val arr = ratesPtr.value
if (arr != null && count > 0) {
buildString {
for (i in 0 until count) {
val v = arr[i]
append(v)
if (i != count - 1) append(',')
}
}
} else {
"error"
}
} else {
"error"
}
}
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetAudioSupportedSampleRateRanges")
fun avcGetAudioSupportedSampleRateRanges(mime: String, isEncoder: UInt): String {
return ApiGuard.guardString {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
memScoped {
val rangesPtr = alloc<CPointerVar<OH_AVRange>>()
val num = alloc<UIntVar>()
val code = OH_AVCapability_GetAudioSupportedSampleRateRanges(cap, rangesPtr.ptr, num.ptr)
if (code == 0u) {
num.value.toString()
} else {
"error"
}
}
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetAudioChannelCountRange")
fun avcGetAudioChannelCountRange(mime: String, isEncoder: UInt): String {
return ApiGuard.guardString {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
memScoped {
val range = alloc<OH_AVRange>()
val code = OH_AVCapability_GetAudioChannelCountRange(cap, range.ptr)
if (code == 0u) "${range.minVal},${range.maxVal}" else "error"
}
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetVideoSupportedPixelFormats")
fun avcGetVideoSupportedPixelFormats(mime: String, isEncoder: UInt): String {
return ApiGuard.guardString {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
memScoped {
val fmtsPtr = alloc<CPointerVar<IntVar>>()
val num = alloc<UIntVar>()
val code = OH_AVCapability_GetVideoSupportedPixelFormats(cap, fmtsPtr.ptr, num.ptr)
if (code == 0u) {
num.value.toString()
} else {
"error"
}
}
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetSupportedProfiles")
fun avcGetSupportedProfiles(mime: String, isEncoder: UInt): String {
return ApiGuard.guardString {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
memScoped {
val profPtr = alloc<CPointerVar<IntVar>>()
val num = alloc<UIntVar>()
val code = OH_AVCapability_GetSupportedProfiles(cap, profPtr.ptr, num.ptr)
if (code == 0u) {
num.value.toString()
} else {
"error"
}
}
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetSupportedLevelsForProfile")
fun avcGetSupportedLevelsForProfile(mime: String, isEncoder: UInt, profile: Int): String {
return ApiGuard.guardString {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
memScoped {
val lvlPtr = alloc<CPointerVar<IntVar>>()
val num = alloc<UIntVar>()
val code = OH_AVCapability_GetSupportedLevelsForProfile(cap, profile, lvlPtr.ptr, num.ptr)
if (code == 0u) {
num.value.toString()
} else {
"error"
}
}
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcAreProfileAndLevelSupported")
fun avcAreProfileAndLevelSupported(mime: String, isEncoder: UInt, profile: Int, level: Int): Int {
return ApiGuard.guardInt {
val cap = OH_AVCodec_GetCapability(mime, isEncoder != 0u)
if (OH_AVCapability_AreProfileAndLevelSupported(cap, profile, level)) 1 else 0
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcIsEncoderBitrateModeSupported")
fun avcIsEncoderBitrateModeSupported(mime: String, bitrateMode: UInt): Int {
return ApiGuard.guardInt {
val cap = OH_AVCodec_GetCapability(mime, true)
if (OH_AVCapability_IsEncoderBitrateModeSupported(cap, bitrateMode)) 1 else 0
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetEncoderQualityRange")
fun avcGetEncoderQualityRange(mime: String): String {
return ApiGuard.guardString {
val cap = OH_AVCodec_GetCapability(mime, true)
memScoped {
val range = alloc<OH_AVRange>()
val code = OH_AVCapability_GetEncoderQualityRange(cap, range.ptr)
if (code == 0u) "${range.minVal},${range.maxVal}" else "error"
}
}
}
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, ExperimentalNativeApi::class)
@CName("avcGetEncoderComplexityRange")
fun avcGetEncoderComplexityRange(mime: String): String {
return ApiGuard.guardString {
val cap = OH_AVCodec_GetCapability(mime, true)
memScoped {
val range = alloc<OH_AVRange>()
val code = OH_AVCapability_GetEncoderComplexityRange(cap, range.ptr)
if (code == 0u) "${range.minVal},${range.maxVal}" else "error"
}
}
}
package com.example.test.common
object ApiGuard {
const val CODE_API_VERSION_TOO_HIGH = -10001
const val STR_API_VERSION_TOO_HIGH = "API_VERSION_TOO_HIGH"
inline fun <T> guard(block: () -> T, illegalStateValue: T, otherErrorValue: T): T {
println("ApiGuard: 12")
return try {
println("ApiGuard: 22")
block()
} catch (e: IllegalStateException) {
println("ApiGuard: 当前API版本过高,请升级系统后再进行操作")
illegalStateValue
} catch (_: Throwable) {
println("ApiGuard: 其他错误")
otherErrorValue
}
}
inline fun guardInt(block: () -> Int): Int =
guard(block, CODE_API_VERSION_TOO_HIGH, -1)
inline fun guardLong(block: () -> Long): Long =
guard(block, CODE_API_VERSION_TOO_HIGH.toLong(), -1L)
inline fun guardDouble(block: () -> Double): Double =
guard(block, CODE_API_VERSION_TOO_HIGH.toDouble(), -1.0)
inline fun guardString(block: () -> String): String =
guard(block, STR_API_VERSION_TOO_HIGH, "error")
inline fun guardBoolean(block: () -> Boolean): Boolean =
guard(block, false, false)
}
#Kotlin
kotlin.code.style=official
kotlin.daemon.jvmargs=-Xmx3072M
#Gradle
org.gradle.jvmargs=-Xmx4096M -Dfile.encoding=UTF-8
org.gradle.configuration-cache=true
org.gradle.caching=true
#Android
android.nonTransitiveRClass=true
android.useAndroidX=true
\ No newline at end of file
[versions]
agp = "8.11.2"
android-compileSdk = "36"
android-minSdk = "24"
android-targetSdk = "36"
androidx-activity = "1.12.2"
androidx-appcompat = "1.7.1"
androidx-core = "1.17.0"
androidx-espresso = "3.7.0"
androidx-lifecycle = "2.9.6"
androidx-testExt = "1.3.0"
junit = "4.13.2"
kotlin = "2.2.21-ez-101"
[libraries]
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
kotlin-testJunit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
junit = { module = "junit:junit", version.ref = "junit" }
androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "androidx-core" }
androidx-testExt-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-testExt" }
androidx-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "androidx-espresso" }
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" }
[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
androidLibrary = { id = "com.android.library", version.ref = "agp" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
/node_modules
/oh_modules
/local.properties
/.idea
**/build
/.hvigor
.cxx
/.clangd
/.clang-format
/.clang-tidy
**/.test
/.appanalyzer
\ No newline at end of file
{
"app": {
"bundleName": "com.example.harmonyapp",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:layered_image",
"label": "$string:app_name"
}
}
{
"string": [
{
"name": "app_name",
"value": "harmonyApp"
}
]
}
{
"layered-image":
{
"background" : "$media:background",
"foreground" : "$media:foreground"
}
}
\ No newline at end of file
# OpenHarmony 自动化测试执行器
## 功能特性
1. **灵活执行策略**
- 执行所有测试用例
- 通过配置文件执行部分测试用例
2. **详细的执行结果**
- 每个用例的执行状态(通过/失败/跳过/错误)
- 每个用例的执行时间
- 总执行时间和统计信息
3. **多种报告格式**
- JSON 格式(机器可读)
- HTML 格式(可视化报告)
- JUnit XML 格式
4. **高级功能**
- 超时控制
- 日志记录
## 单元测试的命名规则`run${file_name}UnitTest`
## 安装python依赖
```bash
pip3 install pyyaml
```
## 执行所有测试
```bash
python3 test_runner.py
```
## 命令
```bash
# 列出所有可用的测试
python3 test_runner.py --list-tests
```
## Test Config 使用说明
- 配置文件位置优先级(不传 --config 时自动加载):
- 1) test-config.json
- 2) test-config.yaml 或 test-config.yml
- 若同时存在 JSON 与 YAML,则优先使用 JSON
- 所有相对路径以 test_runner.py 所在目录为基准
### 字段
- test_directories
- 类型: string[]
- 范围: 任意有效目录路径(相对或绝对)
- output_dir
- 类型: string
- 范围: 任意有效目录路径
- report_formats
- 类型: string[]
- 可选: json, text, xml, html(任意组合)
- device_id
- 类型: string
- 示例: 127.0.0.1:5555(模拟器)或真机序列号
- tests(数组,每项支持以下结构)
- { "file": "Ability.test.ets" } 或 { "pattern": "Ability" }:按文件名子串筛选,自动映射 describe 套件
- { "class": "runAbilityUnitTest" }:直接指定 describe 套件
- { "class": "runAbilityUnitTest", "method": "assertContain" }:指定单个 it,用于精确过滤
- { "kit": "PerformanceAnalysisKit" }:按目录子串筛选范围(例如仅执行该目录下的所有测试)
- { "kit": "PerformanceAnalysisKit", "component": "HiLog" }:按 kit 下子目录筛选(例如仅执行 HiLog 组件下的所有测试)
- 备注:tests 为 [] 或 {} 表示执行全部测试(不做额外筛选)
### 示例(JSON)
```json
{
"test_directories": ["./entry/src/ohosTest/ets/test/"],
"output_dir": "./test-reports",
"report_formats": ["json", "text", "xml", "html"],
"device_id": "127.0.0.1:5555",
"tests": [
{ "class": "runOhLogPrintMsgUnitTest", "method": "runOhLogPrintMsgUnitTest_withValidParams" },
{ "kit": "PerformanceAnalysisKit", "component": "HiLog" }
]
}
```
### 示例(YAML)
```yaml
test_directories:
- "./entry/src/ohosTest/ets/test/"
output_dir: "./test-reports"
report_formats: ["json", "text", "xml", "html"]
device_id: "127.0.0.1:5555"
tests:
- class: "runOhLogPrintMsgUnitTest"
method: "runOhLogPrintMsgUnitTest_withValidParams"
- kit: "PerformanceAnalysisKit"
component: "HiLog"
```
### 执行(DevEco侧)
- 自动加载配置:
```bash
python3 test_runner.py
```
- 指定配置路径:
```bash
python3 test_runner.py --config test-config.yaml
```
{
"app": {
"signingConfigs": [],
"products": [
{
"name": "default",
"signingConfig": "default",
"targetSdkVersion": "6.0.1(21)",
"compatibleSdkVersion": "5.0.5(17)",
"runtimeOS": "HarmonyOS",
"buildOption": {
"strictMode": {
"caseSensitiveCheck": true,
"useNormalizedOHMUrl": true
}
}
}
],
"buildModeSet": [
{
"name": "debug",
},
{
"name": "release"
}
]
},
"modules": [
{
"name": "entry",
"srcPath": "./entry",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
]
}
\ No newline at end of file
{
"files": [
"**/*.ets"
],
"ignore": [
"**/src/ohosTest/**/*",
"**/src/test/**/*",
"**/src/mock/**/*",
"**/node_modules/**/*",
"**/oh_modules/**/*",
"**/build/**/*",
"**/.preview/**/*"
],
"ruleSet": [
"plugin:@performance/recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@security/no-unsafe-aes": "error",
"@security/no-unsafe-hash": "error",
"@security/no-unsafe-mac": "warn",
"@security/no-unsafe-dh": "error",
"@security/no-unsafe-dsa": "error",
"@security/no-unsafe-ecdsa": "error",
"@security/no-unsafe-rsa-encrypt": "error",
"@security/no-unsafe-rsa-sign": "error",
"@security/no-unsafe-rsa-key": "error",
"@security/no-unsafe-dsa-key": "error",
"@security/no-unsafe-dh-key": "error",
"@security/no-unsafe-3des": "error"
}
}
\ No newline at end of file
/node_modules
/oh_modules
/.preview
/build
/.cxx
/.test
\ No newline at end of file
{
"apiType": "stageMode",
"buildOption": {
"externalNativeOptions": {
"path": "./src/main/cpp/CMakeLists.txt",
"arguments": "",
"cppFlags": "",
"abiFilters": [
"arm64-v8a"
]
},
"resOptions": {
"copyCodeResource": {
"enable": false
}
}
},
"buildOptionSet": [
{
"name": "release",
"arkOptions": {
"obfuscation": {
"ruleOptions": {
"enable": false,
"files": [
"./obfuscation-rules.txt"
]
}
}
}
},
],
"targets": [
{
"name": "default"
},
{
"name": "ohosTest",
}
]
}
import { hapTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins: [] /* Custom plugin to extend the functionality of Hvigor. */
}
\ No newline at end of file
# Define project specific obfuscation rules here.
# You can include the obfuscation configuration files in the current module's build-profile.json5.
#
# For more details, see
# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
# Obfuscation options:
# -disable-obfuscation: disable all obfuscations
# -enable-property-obfuscation: obfuscate the property names
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
# -compact: remove unnecessary blank spaces and all line feeds
# -remove-log: remove all console.* statements
# -print-namecache: print the name cache that contains the mapping from the old names to new names
# -apply-namecache: reuse the given cache file
# Keep options:
# -keep-property-name: specifies property names that you want to keep
# -keep-global-name: specifies names that you want to keep in the global scope
-enable-property-obfuscation
-enable-toplevel-obfuscation
-enable-filename-obfuscation
-enable-export-obfuscation
\ No newline at end of file
{
"name": "entry",
"version": "1.0.0",
"description": "Please describe the basic information.",
"main": "",
"author": "",
"license": "",
"dependencies": {}
}
cmake_minimum_required(VERSION 3.10)
project(entry_module)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
file(GLOB KITS_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/kits/*.cpp")
add_library(entry SHARED
entry_module.cpp
${KITS_SOURCES}
)
target_include_directories(entry
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
)
# Link prebuilt libkn.so
add_library(kn SHARED IMPORTED)
set_target_properties(kn PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/arm64-v8a/libkn.so"
)
target_link_libraries(entry PUBLIC libace_napi.z.so)
target_link_libraries(entry PRIVATE kn)
#include "napi/native_api.h"
#include <vector>
typedef void (*KitRegistrar)(napi_env, napi_value);
static std::vector<KitRegistrar>& GetKitRegistrars()
{
static std::vector<KitRegistrar> registrars;
return registrars;
}
extern "C" void AddKitRegistrar(KitRegistrar fn)
{
GetKitRegistrars().push_back(fn);
}
static napi_value Init(napi_env env, napi_value exports) {
for (auto fn : GetKitRegistrars()) {
fn(env, exports);
}
return exports;
}
// Module name must match 'libentry'
NAPI_MODULE(libentry, Init)
#ifndef KONAN_LIBKN_H
#define KONAN_LIBKN_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
typedef bool libkn_KBoolean;
#else
typedef _Bool libkn_KBoolean;
#endif
typedef unsigned short libkn_KChar;
typedef signed char libkn_KByte;
typedef short libkn_KShort;
typedef int libkn_KInt;
typedef long long libkn_KLong;
typedef unsigned char libkn_KUByte;
typedef unsigned short libkn_KUShort;
typedef unsigned int libkn_KUInt;
typedef unsigned long long libkn_KULong;
typedef float libkn_KFloat;
typedef double libkn_KDouble;
typedef float __attribute__ ((__vector_size__ (16))) libkn_KVector128;
typedef void* libkn_KNativePtr;
struct libkn_KType;
typedef struct libkn_KType libkn_KType;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_kotlin_Byte;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_kotlin_Short;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_kotlin_Int;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_kotlin_Long;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_kotlin_Float;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_kotlin_Double;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_kotlin_Char;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_kotlin_Boolean;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_kotlin_Unit;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_kotlin_UByte;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_kotlin_UShort;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_kotlin_UInt;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_kotlin_ULong;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_com_example_kmpmultiplatform_AppText;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_com_example_kmpmultiplatform_Platform;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_kotlin_Any;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_com_example_kmpmultiplatform_Greeting;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_com_example_kmpmultiplatform_OHOSPlatform;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_com_example_test_ohosTest;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_com_example_test_common_ApiGuard;
typedef struct {
libkn_KNativePtr pinned;
} libkn_kref_kotlin_Function0;
extern libkn_KInt avcAreProfileAndLevelSupported(const char* mime, libkn_KUInt isEncoder, libkn_KInt profile, libkn_KInt level);
extern libkn_KInt avcAreVideoSizeAndFrameRateSupported(const char* mime, libkn_KUInt isEncoder, libkn_KInt width, libkn_KInt height, libkn_KInt frameRate);
extern const char* avcGetAudioChannelCountRange(const char* mime, libkn_KUInt isEncoder);
extern const char* avcGetAudioSupportedSampleRateRanges(const char* mime, libkn_KUInt isEncoder);
extern const char* avcGetAudioSupportedSampleRates(const char* mime, libkn_KUInt isEncoder);
extern const char* avcGetEncoderBitrateRange(const char* mime);
extern const char* avcGetEncoderComplexityRange(const char* mime);
extern const char* avcGetEncoderQualityRange(const char* mime);
extern const char* avcGetFeaturePropertiesDump(const char* mime, libkn_KUInt isEncoder, libkn_KUInt feature);
extern libkn_KInt avcGetMaxSupportedInstances(const char* mime, libkn_KUInt isEncoder);
extern const char* avcGetName(const char* mime, libkn_KUInt isEncoder);
extern const char* avcGetNameByCategory(const char* mime, libkn_KUInt isEncoder, libkn_KUInt category);
extern const char* avcGetSupportedLevelsForProfile(const char* mime, libkn_KUInt isEncoder, libkn_KInt profile);
extern const char* avcGetSupportedProfiles(const char* mime, libkn_KUInt isEncoder);
extern const char* avcGetVideoFrameRateRange(const char* mime, libkn_KUInt isEncoder);
extern const char* avcGetVideoFrameRateRangeForSize(const char* mime, libkn_KUInt isEncoder, libkn_KInt width, libkn_KInt height);
extern libkn_KInt avcGetVideoHeightAlignment(const char* mime, libkn_KUInt isEncoder);
extern const char* avcGetVideoHeightRange(const char* mime, libkn_KUInt isEncoder);
extern const char* avcGetVideoHeightRangeForWidth(const char* mime, libkn_KUInt isEncoder, libkn_KInt width);
extern const char* avcGetVideoSupportedPixelFormats(const char* mime, libkn_KUInt isEncoder);
extern libkn_KInt avcGetVideoWidthAlignment(const char* mime, libkn_KUInt isEncoder);
extern const char* avcGetVideoWidthRange(const char* mime, libkn_KUInt isEncoder);
extern const char* avcGetVideoWidthRangeForHeight(const char* mime, libkn_KUInt isEncoder, libkn_KInt height);
extern libkn_KInt avcIsEncoderBitrateModeSupported(const char* mime, libkn_KUInt bitrateMode);
extern libkn_KInt avcIsFeatureSupported(const char* mime, libkn_KUInt isEncoder, libkn_KUInt feature);
extern libkn_KInt avcIsHardware(const char* mime, libkn_KUInt isEncoder);
extern libkn_KInt avcIsVideoSizeSupported(const char* mime, libkn_KUInt isEncoder, libkn_KInt width, libkn_KInt height);
extern const char* getAVCapabilityEnumValuesJson();
extern libkn_KLong avdCreateWithSource(void* source);
extern libkn_KInt avdDestroy(void* demuxer);
extern libkn_KInt avdGetMediaKeySystemInfo(void* demuxer);
extern const char* avdReadSample(void* demuxer, libkn_KInt trackIndex, void* sampleMem);
extern libkn_KInt avdReadSampleBuffer(void* demuxer, libkn_KInt trackIndex, void* sampleBuffer);
extern libkn_KInt avdSeekToTime(void* demuxer, libkn_KLong millisecond, libkn_KInt mode);
extern libkn_KInt avdSelectTrackByID(void* demuxer, libkn_KInt trackIndex);
extern libkn_KInt avdSetDemuxerMediaKeySystemInfoCallback(void* demuxer);
extern libkn_KInt avdSetMediaKeySystemInfoCallback(void* demuxer);
extern libkn_KInt avdUnselectTrackByID(void* demuxer, libkn_KInt trackIndex);
extern const char* avmAddTrack(void* muxer, void* trackFormat);
extern libkn_KLong avmCreate(libkn_KInt fd, libkn_KUInt format);
extern libkn_KInt avmDestroy(void* muxer);
extern libkn_KInt avmSetFormat(void* muxer, void* format);
extern libkn_KInt avmSetRotation(void* muxer, libkn_KInt rotation);
extern libkn_KInt avmStart(void* muxer);
extern libkn_KInt avmStop(void* muxer);
extern libkn_KInt avmWriteSampleBuffer(void* muxer, libkn_KInt trackIndex, void* sampleBuffer);
extern libkn_KLong avsCreateWithDataSource(void* dataSource);
extern libkn_KLong avsCreateWithDataSourceExt(void* dataSourceExt, void* userData);
extern libkn_KLong avsCreateWithFD(libkn_KInt fd, libkn_KLong offset, libkn_KLong size);
extern libkn_KLong avsCreateWithURI(const char* uri);
extern libkn_KInt avsDestroy(void* source);
extern libkn_KLong avsGetCustomMetadataFormat(void* source);
extern libkn_KLong avsGetSourceFormat(void* source);
extern libkn_KLong avsGetTrackFormat(void* source, libkn_KInt trackIndex);
extern libkn_KInt acConfigure(void* codec, void* format);
extern libkn_KLong acCreateByMime(const char* mime, libkn_KBoolean isEncoder);
extern libkn_KLong acCreateByName(const char* name);
extern libkn_KInt acDestroy(void* codec);
extern libkn_KInt acFlush(void* codec);
extern libkn_KInt acFreeOutputBuffer(void* codec, libkn_KInt index);
extern libkn_KLong acGetInputBuffer(void* codec, libkn_KInt index);
extern libkn_KLong acGetOutputBuffer(void* codec, libkn_KInt index);
extern libkn_KLong acGetOutputDescription(void* codec);
extern const char* acIsValid(void* codec);
extern libkn_KInt acPrepare(void* codec);
extern libkn_KInt acPushInputBuffer(void* codec, libkn_KInt index);
extern const char* acQueryInputBuffer(void* codec, libkn_KLong timeoutUs);
extern const char* acQueryOutputBuffer(void* codec, libkn_KLong timeoutUs);
extern libkn_KInt acRegisterCallback(void* codec, void* userData);
extern libkn_KInt acReset(void* codec);
extern libkn_KInt acSetDecryptionConfig(void* codec, void* mediaKeySession, libkn_KBoolean secureAudio);
extern libkn_KInt acSetParameter(void* codec, void* format);
extern libkn_KInt acStart(void* codec);
extern libkn_KInt acStop(void* codec);
extern libkn_KLong avcbCreateDataSourceExt(libkn_KLong size);
extern libkn_KLong avcbCreateDataSourceFromFD(libkn_KInt fd, libkn_KLong size);
extern libkn_KLong avcbCreateUserDataFromFD(libkn_KInt fd);
extern const char* getAACProfileEnumValuesJson();
extern const char* getAVCLevelEnumValuesJson();
extern const char* getAVCProfileEnumValuesJson();
extern const char* getAVOutputFormatEnumValuesJson();
extern const char* getAVSeekModeEnumValuesJson();
extern const char* getAudioChannelLayoutEnumValuesJson();
extern const char* getAudioChannelSetEnumValuesJson();
extern const char* getBitrateModeEnumValuesJson();
extern const char* getBitsPerSampleEnumValuesJson();
extern const char* getColorPrimaryEnumValuesJson();
extern const char* getH263LevelEnumValuesJson();
extern const char* getH263ProfileEnumValuesJson();
extern const char* getHEVCLevelEnumValuesJson();
extern const char* getHEVCProfileEnumValuesJson();
extern const char* getMPEG2LevelEnumValuesJson();
extern const char* getMPEG2ProfileEnumValuesJson();
extern const char* getMPEG4LevelEnumValuesJson();
extern const char* getMPEG4ProfileEnumValuesJson();
extern const char* getMatrixCoefficientEnumValuesJson();
extern const char* getMediaTypeEnumValuesJson();
extern const char* getScalingModeEnumValuesJson();
extern const char* getTemporalGopReferenceModeEnumValuesJson();
extern const char* getTransferCharacteristicEnumValuesJson();
extern const char* getVVCLevelEnumValuesJson();
extern const char* getVVCProfileEnumValuesJson();
extern libkn_KLong avbCreate(libkn_KInt capacity);
extern libkn_KInt avbDestroy(void* buffer);
extern libkn_KLong avbGetAddr(void* buffer);
extern const char* avbGetBufferAttr(void* buffer);
extern libkn_KInt avbGetCapacity(void* buffer);
extern libkn_KLong avbGetNativeBuffer(void* buffer);
extern libkn_KLong avbGetParameter(void* buffer);
extern libkn_KInt avbSetBufferAttr(void* buffer, libkn_KLong pts, libkn_KInt size, libkn_KInt offset, libkn_KInt flags);
extern libkn_KInt avbSetParameter(void* buffer, void* format);
extern libkn_KInt avfCopy(void* to, void* from);
extern libkn_KLong avfCreate();
extern libkn_KLong avfCreateAudioFormat(const char* mime, libkn_KInt sampleRate, libkn_KInt channelCount);
extern libkn_KLong avfCreateVideoFormat(const char* mime, libkn_KInt width, libkn_KInt height);
extern libkn_KInt avfDestroy(void* format);
extern const char* avfDumpInfo(void* format);
extern const char* avfGetBuffer(void* format, const char* key);
extern const char* avfGetDoubleValue(void* format, const char* key);
extern const char* avfGetFloatValue(void* format, const char* key);
extern const char* avfGetIntBuffer(void* format, const char* key);
extern const char* avfGetIntValue(void* format, const char* key);
extern const char* avfGetLongValue(void* format, const char* key);
extern const char* avfGetStringValue(void* format, const char* key);
extern libkn_KInt avfSetBuffer(void* format, const char* key, void* addr, libkn_KLong size);
extern libkn_KInt avfSetDoubleValue(void* format, const char* key, libkn_KDouble value);
extern libkn_KInt avfSetFloatValue(void* format, const char* key, libkn_KFloat value);
extern libkn_KInt avfSetIntBuffer(void* format, const char* key, void* addr, libkn_KLong size);
extern libkn_KInt avfSetIntValue(void* format, const char* key, libkn_KInt value);
extern libkn_KInt avfSetLongValue(void* format, const char* key, libkn_KLong value);
extern libkn_KInt avfSetStringValue(void* format, const char* key, const char* value);
extern libkn_KLong avmemCreate(libkn_KInt size);
extern libkn_KInt avmemDestroy(void* mem);
extern libkn_KLong avmemGetAddr(void* mem);
extern libkn_KInt avmemGetSize(void* mem);
extern const char* getAVCodecBufferFlagsEnumValuesJson();
extern const char* getAVErrorEnumValuesJson();
extern const char* getHdrTypeEnumValuesJson();
extern libkn_KInt vdConfigure(void* codec, void* format);
extern libkn_KLong vdCreateByMime(const char* mime);
extern libkn_KLong vdCreateByName(const char* name);
extern libkn_KInt vdDestroy(void* codec);
extern libkn_KInt vdFlush(void* codec);
extern libkn_KInt vdFreeOutputBuffer(void* codec, libkn_KInt index);
extern libkn_KInt vdFreeOutputData(void* codec, libkn_KInt index);
extern libkn_KLong vdGetInputBuffer(void* codec, libkn_KInt index);
extern libkn_KLong vdGetOutputBuffer(void* codec, libkn_KInt index);
extern libkn_KLong vdGetOutputDescription(void* codec);
extern const char* vdIsValid(void* codec);
extern libkn_KInt vdPrepare(void* codec);
extern libkn_KInt vdPushInputBuffer(void* codec, libkn_KInt index);
extern libkn_KInt vdPushInputData(void* codec, libkn_KInt index);
extern const char* vdQueryInputBuffer(void* codec, libkn_KLong timeoutUs);
extern const char* vdQueryOutputBuffer(void* codec, libkn_KLong timeoutUs);
extern libkn_KInt vdRegisterCallback(void* codec, void* userData);
extern libkn_KInt vdRenderOutputBuffer(void* codec, libkn_KInt index);
extern libkn_KInt vdRenderOutputBufferAtTime(void* codec, libkn_KInt index, libkn_KLong renderTimestampNs);
extern libkn_KInt vdRenderOutputData(void* codec, libkn_KInt index);
extern libkn_KInt vdReset(void* codec);
extern libkn_KInt vdSetCallback(void* codec, void* userData);
extern libkn_KInt vdSetDecryptionConfig(void* codec, void* mediaKeySession, libkn_KBoolean secureVideoPath);
extern libkn_KInt vdSetParameter(void* codec, void* format);
extern libkn_KInt vdSetSurface(void* codec, void* window);
extern libkn_KInt vdStart(void* codec);
extern libkn_KInt vdStop(void* codec);
extern libkn_KInt avcbAudioDecoderSetCallback(void* codec, void* userData);
extern const char* avcbVideoEncoderGetSurface(void* codec);
extern libkn_KInt avcbVideoEncoderPushInputBuffer(void* codec, libkn_KInt index);
extern libkn_KInt avcbVideoEncoderSetCallback(void* codec, void* userData);
extern const char* getVideoEncodeBitrateModeEnumValuesJson();
extern libkn_KInt veConfigure(void* codec, void* format);
extern libkn_KLong veCreateByMime(const char* mime);
extern libkn_KLong veCreateByName(const char* name);
extern libkn_KInt veDestroy(void* codec);
extern libkn_KInt veFlush(void* codec);
extern libkn_KInt veFreeOutputBuffer(void* codec, libkn_KInt index);
extern libkn_KInt veFreeOutputData(void* codec, libkn_KInt index);
extern libkn_KLong veGetInputBuffer(void* codec, libkn_KInt index);
extern libkn_KLong veGetInputDescription(void* codec);
extern libkn_KLong veGetOutputBuffer(void* codec, libkn_KInt index);
extern libkn_KLong veGetOutputDescription(void* codec);
extern const char* veGetSurface(void* codec);
extern const char* veIsValid(void* codec);
extern libkn_KInt veNotifyEndOfStream(void* codec);
extern libkn_KInt vePrepare(void* codec);
extern libkn_KInt vePushInputBuffer(void* codec, libkn_KInt index);
extern libkn_KInt vePushInputParameter(void* codec, libkn_KInt index);
extern const char* veQueryInputBuffer(void* codec, libkn_KLong timeoutUs);
extern const char* veQueryOutputBuffer(void* codec, libkn_KLong timeoutUs);
extern libkn_KInt veRegisterCallback(void* codec, void* userData);
extern libkn_KInt veRegisterParameterCallback(void* codec, void* userData);
extern libkn_KInt veReset(void* codec);
extern libkn_KInt veSetParameter(void* codec, void* format);
extern libkn_KInt veStart(void* codec);
extern libkn_KInt veStop(void* codec);
extern const char* getAVMetadataEnumValuesJson();
extern const char* ohavmdBuilderCreate();
extern libkn_KInt ohavmdBuilderDestroy(void* builder);
extern const char* ohavmdBuilderGenerateAVMetadata(void* builder);
extern libkn_KInt ohavmdBuilderSetAlbum(void* builder, const char* album);
extern libkn_KInt ohavmdBuilderSetArtist(void* builder, const char* artist);
extern libkn_KInt ohavmdBuilderSetAssetId(void* builder, const char* assetId);
extern libkn_KInt ohavmdBuilderSetAuthor(void* builder, const char* author);
extern libkn_KInt ohavmdBuilderSetComposer(void* builder, const char* composer);
extern libkn_KInt ohavmdBuilderSetDescription(void* builder, const char* description);
extern libkn_KInt ohavmdBuilderSetDisplayTags(void* builder, libkn_KInt tags);
extern libkn_KInt ohavmdBuilderSetDuration(void* builder, libkn_KLong durationMs);
extern libkn_KInt ohavmdBuilderSetLyric(void* builder, const char* lyric);
extern libkn_KInt ohavmdBuilderSetMediaImageUri(void* builder, const char* uri);
extern libkn_KInt ohavmdBuilderSetSkipIntervals(void* builder, libkn_KInt intervals);
extern libkn_KInt ohavmdBuilderSetSubtitle(void* builder, const char* subtitle);
extern libkn_KInt ohavmdBuilderSetTitle(void* builder, const char* title);
extern libkn_KInt ohavmdBuilderSetWriter(void* builder, const char* writer);
extern libkn_KInt ohavmdDestroy(void* metadata);
extern libkn_KInt abilityBaseAddGetWantFd(const char* key, libkn_KInt fd);
extern libkn_KInt abilityBaseCreateWant(const char* bundleName, const char* moduleName, const char* abilityName);
extern const char* abilityBaseGetWantElement(const char* bundleName, const char* moduleName, const char* abilityName);
extern libkn_KInt abilityBaseSetGetWantBoolParam(const char* key, libkn_KBoolean value);
extern const char* abilityBaseSetGetWantCharParam(const char* key, const char* value);
extern libkn_KDouble abilityBaseSetGetWantDoubleParam(const char* key, libkn_KDouble value);
extern libkn_KInt abilityBaseSetGetWantInt32Param(const char* key, libkn_KInt value);
extern const char* abilityBaseSetGetWantUri(const char* uri);
extern libkn_KInt abilityBaseSetWantElement(const char* bundleName, const char* moduleName, const char* abilityName);
extern libkn_KInt abilityRuntimeAppContextGetAreaMode();
extern const char* abilityRuntimeAppContextGetBundleCodeDir();
extern const char* abilityRuntimeAppContextGetBundleName();
extern const char* abilityRuntimeAppContextGetCacheDir();
extern const char* abilityRuntimeAppContextGetCloudFileDir();
extern const char* abilityRuntimeAppContextGetDatabaseDir();
extern const char* abilityRuntimeAppContextGetDistributedFilesDir();
extern const char* abilityRuntimeAppContextGetFilesDir();
extern const char* abilityRuntimeAppContextGetPreferencesDir();
extern const char* abilityRuntimeAppContextGetResourceDir(const char* moduleName);
extern libkn_KInt abilityRuntimeAppContextGetResourceDirCode(const char* moduleName);
extern const char* abilityRuntimeAppContextGetTempDir();
extern libkn_KInt abilityRuntimeSetGetStartOptionsDisplayId(libkn_KInt displayId);
extern libkn_KInt abilityRuntimeSetGetStartOptionsMaxWindowHeight(libkn_KInt value);
extern libkn_KInt abilityRuntimeSetGetStartOptionsMaxWindowWidth(libkn_KInt value);
extern libkn_KInt abilityRuntimeSetGetStartOptionsMinWindowHeight(libkn_KInt value);
extern libkn_KInt abilityRuntimeSetGetStartOptionsMinWindowWidth(libkn_KInt value);
extern libkn_KInt abilityRuntimeSetGetStartOptionsStartVisibility(libkn_KInt visibility);
extern const char* abilityRuntimeSetGetStartOptionsStartWindowBackgroundColor();
extern libkn_KInt abilityRuntimeSetGetStartOptionsSupportedWindowModes();
extern libkn_KInt abilityRuntimeSetGetStartOptionsWindowHeight(libkn_KInt windowHeight);
extern libkn_KInt abilityRuntimeSetGetStartOptionsWindowLeft(libkn_KInt windowLeft);
extern libkn_KInt abilityRuntimeSetGetStartOptionsWindowMode(libkn_KInt mode);
extern libkn_KInt abilityRuntimeSetGetStartOptionsWindowTop(libkn_KInt windowTop);
extern libkn_KInt abilityRuntimeSetGetStartOptionsWindowWidth(libkn_KInt windowWidth);
extern libkn_KInt abilityRuntimeSetGetStartOptionsWithAnimation(libkn_KBoolean withAnimation);
extern libkn_KInt abilityRuntimeStartOptionsCreateDestroy();
extern libkn_KInt abilityRuntimeStartSelfUIAbility(const char* bundleName, const char* moduleName, const char* abilityName);
extern libkn_KInt abilityRuntimeStartSelfUIAbilityWithStartOptions(const char* bundleName, const char* moduleName, const char* abilityName);
extern libkn_KInt childProcessConfigsCreateDestroy(const char* processName, libkn_KUInt isolationMode);
extern libkn_KInt childProcessCreateNativeChildProcess(const char* libName);
extern libkn_KInt childProcessCreateNativeChildProcessWithConfigs(const char* libName, const char* processName, libkn_KUInt isolationMode);
extern const char* childProcessGetCurrentArgsEntryParams();
extern libkn_KInt childProcessRegisterExitCallback();
extern const char* childProcessStartNativeChildProcess(const char* entry, const char* entryParams);
extern const char* childProcessStartNativeChildProcessWithConfigs(const char* entry, const char* entryParams, const char* processName, libkn_KUInt isolationMode);
extern libkn_KInt childProcessUnregisterExitCallback();
extern libkn_KInt abilityResourceCheckDefaultApp(libkn_KInt index);
extern const char* abilityResourceGetAbilityName(libkn_KInt index);
extern libkn_KInt abilityResourceGetAppIndex(libkn_KInt index);
extern const char* abilityResourceGetBundleName(libkn_KInt index);
extern libkn_KLong abilityResourceGetDrawableDescriptorPtr(libkn_KInt index);
extern const char* abilityResourceGetLabel(libkn_KInt index);
extern const char* abilityResourceGetModuleName(libkn_KInt index);
extern libkn_KInt abilityResourceGetSizeCached();
extern libkn_KInt abilityResourceQueryForFileType(const char* fileType);
extern libkn_KInt abilityResourceReset();
extern const char* getAppId();
extern const char* getAppIdentifier();
extern const char* getBundleManagerErrorCodeEnumValuesJson();
extern const char* getCompatibleDeviceType();
extern const char* getCurrentApplicationInfoJson();
extern const char* getMainElementNameJson();
extern const char* getModuleMetadataJson();
extern libkn_KInt isDebugMode();
extern libkn_KInt arkuiAllowNodeAllDropDataTypes(void* node);
extern libkn_KInt arkuiCancelDataLoading(void* uiContext, const char* key);
extern libkn_KInt arkuiCreateDragActionWithContext(void* uiContext);
extern libkn_KInt arkuiCreateDragActionWithDefaultContext();
extern libkn_KInt arkuiCreateDragActionWithNode(void* node);
extern libkn_KInt arkuiCreateDragPreviewOption();
extern libkn_KInt arkuiDisableDropDataPrefetchOnNode(void* node, libkn_KBoolean disabled);
extern libkn_KInt arkuiDisallowNodeAnyDropDataTypes(void* node);
extern libkn_KInt arkuiDragActionSetDataLoadParamsNull(void* dragAction);
extern libkn_KInt arkuiDragActionSetDataNull(void* dragAction);
extern libkn_KInt arkuiDragActionSetDragPreviewOption(void* dragAction);
extern libkn_KInt arkuiDragActionSetPointerId(void* dragAction, libkn_KInt pointerId);
extern libkn_KInt arkuiDragActionSetTouchPointX(void* dragAction, libkn_KDouble x);
extern libkn_KInt arkuiDragActionSetTouchPointY(void* dragAction, libkn_KDouble y);
extern libkn_KInt arkuiDragEventDisableDefaultDropAnimation(void* event, libkn_KBoolean disable);
extern libkn_KInt arkuiDragEventGetDataTypeCount(void* event);
extern libkn_KInt arkuiDragEventGetDataTypes(void* event, libkn_KInt length, libkn_KInt maxStrLen);
extern libkn_KInt arkuiDragEventGetDisplayId(void* event);
extern libkn_KInt arkuiDragEventGetDragResult(void* event);
extern libkn_KInt arkuiDragEventGetDragSource(void* event, libkn_KInt bufferLen);
extern libkn_KInt arkuiDragEventGetDropOperation(void* event);
extern libkn_KInt arkuiDragEventGetModifierKeyStates(void* event);
extern libkn_KDouble arkuiDragEventGetPreviewRectHeight(void* event);
extern libkn_KDouble arkuiDragEventGetPreviewRectWidth(void* event);
extern libkn_KDouble arkuiDragEventGetPreviewTouchPointX(void* event);
extern libkn_KDouble arkuiDragEventGetPreviewTouchPointY(void* event);
extern libkn_KDouble arkuiDragEventGetTouchPointXToDisplay(void* event);
extern libkn_KDouble arkuiDragEventGetTouchPointXToGlobalDisplay(void* event);
extern libkn_KDouble arkuiDragEventGetTouchPointXToWindow(void* event);
extern libkn_KDouble arkuiDragEventGetTouchPointYToDisplay(void* event);
extern libkn_KDouble arkuiDragEventGetTouchPointYToGlobalDisplay(void* event);
extern libkn_KDouble arkuiDragEventGetTouchPointYToWindow(void* event);
extern libkn_KInt arkuiDragEventGetUdmfDataNull(void* event);
extern libkn_KDouble arkuiDragEventGetVelocity(void* event);
extern libkn_KDouble arkuiDragEventGetVelocityX(void* event);
extern libkn_KDouble arkuiDragEventGetVelocityY(void* event);
extern libkn_KInt arkuiDragEventIsRemote(void* event);
extern libkn_KInt arkuiDragEventRequestDragEndPending(void* event);
extern libkn_KInt arkuiDragEventSetDataLoadParamsNull(void* event);
extern libkn_KInt arkuiDragEventSetDataNull(void* event);
extern libkn_KInt arkuiDragEventSetDragResult(void* event, libkn_KInt result);
extern libkn_KInt arkuiDragEventSetSuggestedDropOperation(void* event, libkn_KInt operation);
extern libkn_KInt arkuiDragEventStartDataLoading(void* event, libkn_KInt bufferLen);
extern libkn_KInt arkuiDragPreviewOptionSetBadgeNumber(libkn_KInt number);
extern libkn_KInt arkuiDragPreviewOptionSetDefaultAnimationBeforeLiftingEnabled(libkn_KBoolean enabled);
extern libkn_KInt arkuiDragPreviewOptionSetDefaultRadiusEnabled(libkn_KBoolean enabled);
extern libkn_KInt arkuiDragPreviewOptionSetDefaultShadowEnabled(libkn_KBoolean enabled);
extern libkn_KInt arkuiDragPreviewOptionSetNumberBadgeEnabled(libkn_KBoolean enabled);
extern libkn_KInt arkuiDragPreviewOptionSetScaleMode(libkn_KInt mode);
extern libkn_KInt arkuiEnableDropDisallowedBadge(void* uiContext, libkn_KBoolean enabled);
extern libkn_KLong arkuiGetCurrentUIContextPtr();
extern libkn_KLong arkuiGetDragActionPtr();
extern libkn_KInt arkuiNodeEventGetPreDragStatus(void* nodeEvent);
extern libkn_KInt arkuiNotifyDragEndPendingDone(libkn_KInt requestId);
extern libkn_KInt arkuiNotifyDragResult(libkn_KInt requestId, libkn_KInt result);
extern libkn_KInt arkuiSetDragEventStrictReportWithContext(void* uiContext, libkn_KBoolean enabled);
extern libkn_KInt arkuiSetDragEventStrictReportWithNode(void* node, libkn_KBoolean enabled);
extern libkn_KInt arkuiSetNodeDragPreviewNull(void* node);
extern libkn_KInt arkuiSetNodeDragPreviewOption(void* node);
extern libkn_KInt arkuiSetNodeDraggable(void* node, libkn_KBoolean enabled);
extern libkn_KInt arkuiStartDrag(void* dragAction);
extern libkn_KInt arkWebGetNativeAPI(libkn_KInt kind);
extern libkn_KInt arkWebRegisterScrollCallback(const char* webTag);
extern const char* getArkWebEnumValuesJson();
extern const char* diGetAbiList();
extern const char* diGetBootloaderVersion();
extern const char* diGetBrand();
extern const char* diGetBuildHost();
extern const char* diGetBuildRootHash();
extern const char* diGetBuildTime();
extern const char* diGetBuildType();
extern const char* diGetBuildUser();
extern const char* diGetDeviceType();
extern const char* diGetDisplayVersion();
extern libkn_KInt diGetDistributionOSApiVersion();
extern const char* diGetDistributionOSName();
extern const char* diGetDistributionOSReleaseType();
extern const char* diGetDistributionOSVersion();
extern libkn_KInt diGetFirstApiVersion();
extern const char* diGetHardwareModel();
extern const char* diGetIncrementalVersion();
extern const char* diGetManufacture();
extern const char* diGetMarketName();
extern const char* diGetOSFullName();
extern const char* diGetOsReleaseType();
extern const char* diGetProductModel();
extern const char* diGetProductSeries();
extern libkn_KInt diGetSdkApiVersion();
extern const char* diGetSecurityPatchTag();
extern const char* diGetSoftwareModel();
extern const char* diGetVersionId();
extern libkn_KInt biGetCapacity();
extern libkn_KInt biGetPluggedType();
extern const char* biGetPluggedTypeEnumValuesJson();
extern libkn_KInt ceAbortCommonEvent(void* subPtr);
extern libkn_KInt ceClearAbortCommonEvent(void* subPtr);
extern libkn_KLong ceCreateParameters();
extern libkn_KLong ceCreatePublishInfo(libkn_KBoolean ordered);
extern libkn_KLong ceCreateSubscribeInfo(const char* eventsJson);
extern libkn_KLong ceCreateSubscriber(void* infoPtr);
extern libkn_KInt ceDestroyParameters(void* paramPtr);
extern libkn_KInt ceDestroyPublishInfo(void* infoPtr);
extern libkn_KInt ceDestroySubscribeInfo(void* infoPtr);
extern libkn_KInt ceDestroySubscriber(void* subPtr);
extern const char* ceErrEnumValuesJson();
extern libkn_KInt ceFinishCommonEvent(void* subPtr);
extern libkn_KInt ceGetAbortCommonEvent(void* subPtr);
extern const char* ceGetBoolArrayFromParameters(void* paramPtr, const char* key);
extern libkn_KInt ceGetBoolFromParameters(void* paramPtr, const char* key, libkn_KBoolean defaultValue);
extern const char* ceGetBundleNameFromRcvData(void* rcvPtr);
extern const char* ceGetCharArrayFromParameters(void* paramPtr, const char* key);
extern const char* ceGetCharFromParameters(void* paramPtr, const char* key, const char* defaultValue);
extern libkn_KInt ceGetCodeFromRcvData(void* rcvPtr);
extern libkn_KInt ceGetCodeFromSubscriber(void* subPtr);
extern const char* ceGetDataFromSubscriber(void* subPtr);
extern const char* ceGetDataStrFromRcvData(void* rcvPtr);
extern const char* ceGetDoubleArrayFromParameters(void* paramPtr, const char* key);
extern const char* ceGetDoubleFromParameters(void* paramPtr, const char* key, const char* defaultValue);
extern const char* ceGetEventFromRcvData(void* rcvPtr);
extern const char* ceGetIntArrayFromParameters(void* paramPtr, const char* key);
extern libkn_KInt ceGetIntFromParameters(void* paramPtr, const char* key, libkn_KInt defaultValue);
extern const char* ceGetLongArrayFromParameters(void* paramPtr, const char* key);
extern libkn_KLong ceGetLongFromParameters(void* paramPtr, const char* key, libkn_KLong defaultValue);
extern libkn_KLong ceGetParametersFromRcvData(void* rcvPtr);
extern libkn_KInt ceHasKeyInParameters(void* paramPtr, const char* key);
extern libkn_KInt ceIsOrderedCommonEvent(void* subPtr);
extern libkn_KInt cePublish(const char* event);
extern libkn_KInt cePublishWithInfo(const char* event, void* infoPtr);
extern libkn_KInt ceSetBoolArrayToParameters(void* paramPtr, const char* key, const char* valuesJson);
extern libkn_KInt ceSetBoolToParameters(void* paramPtr, const char* key, libkn_KBoolean value);
extern libkn_KInt ceSetCharArrayToParameters(void* paramPtr, const char* key, const char* valuesJson);
extern libkn_KInt ceSetCharToParameters(void* paramPtr, const char* key, const char* value);
extern libkn_KInt ceSetCodeToSubscriber(void* subPtr, libkn_KInt code);
extern libkn_KInt ceSetDataToSubscriber(void* subPtr, const char* data);
extern libkn_KInt ceSetDoubleArrayToParameters(void* paramPtr, const char* key, const char* valuesJson);
extern libkn_KInt ceSetDoubleToParameters(void* paramPtr, const char* key, const char* value);
extern libkn_KInt ceSetIntArrayToParameters(void* paramPtr, const char* key, const char* valuesJson);
extern libkn_KInt ceSetIntToParameters(void* paramPtr, const char* key, libkn_KInt value);
extern libkn_KInt ceSetLongArrayToParameters(void* paramPtr, const char* key, const char* valuesJson);
extern libkn_KInt ceSetLongToParameters(void* paramPtr, const char* key, libkn_KLong value);
extern libkn_KInt ceSetPublishInfoBundleName(void* infoPtr, const char* bundleName);
extern libkn_KInt ceSetPublishInfoCode(void* infoPtr, libkn_KInt code);
extern libkn_KInt ceSetPublishInfoData(void* infoPtr, const char* data);
extern libkn_KInt ceSetPublishInfoParameters(void* infoPtr, void* paramPtr);
extern libkn_KInt ceSetPublishInfoPermissions(void* infoPtr, const char* permissionsJson);
extern libkn_KInt ceSetPublisherBundleName(void* infoPtr, const char* bundleName);
extern libkn_KInt ceSetPublisherPermission(void* infoPtr, const char* permission);
extern libkn_KInt ceSubscribe(void* subPtr);
extern libkn_KInt ceUnSubscribe(void* subPtr);
extern const char* prColorModeEnumValuesJson();
extern libkn_KInt prConnectPrinter(const char* printerId);
extern const char* prDiscoveryEventEnumValuesJson();
extern const char* prDocumentFormatEnumValuesJson();
extern const char* prDuplexModeEnumValuesJson();
extern const char* prErrEnumValuesJson();
extern libkn_KInt prInit();
extern const char* prJobDocAdapterStateEnumValuesJson();
extern libkn_KInt prLaunchPrinterManager();
extern const char* prOrientationModeEnumValuesJson();
extern const char* prPrinterEventEnumValuesJson();
extern const char* prPrinterStateEnumValuesJson();
extern const char* prQualityEnumValuesJson();
extern const char* prQueryPrinterInfoJson(const char* printerId);
extern const char* prQueryPrinterListJson();
extern const char* prQueryPrinterPropertiesJson(const char* printerId, const char* propertyKeysJson);
extern libkn_KInt prRegisterPrinterChangeListener();
extern libkn_KInt prRelease();
extern libkn_KInt prRestorePrinterProperties(const char* printerId, const char* propertyKeysJson);
extern libkn_KInt prStartPrintByNative(const char* printJobName);
extern libkn_KInt prStartPrintJob(const char* printJobName);
extern libkn_KInt prStartPrinterDiscovery();
extern libkn_KInt prStopPrinterDiscovery();
extern libkn_KInt prUnregisterPrinterChangeListener();
extern libkn_KInt prUpdatePrinterProperties(const char* printerId, const char* propertiesJson);
extern libkn_KInt scCancelScan(const char* scannerId);
extern libkn_KInt scCloseScanner(const char* scannerId);
extern const char* scErrEnumValuesJson();
extern libkn_KInt scExit();
extern const char* scGetPictureScanProgressJson(const char* scannerId);
extern const char* scGetScannerParameterJson(const char* scannerId);
extern libkn_KInt scInit();
extern libkn_KInt scOpenScanner(const char* scannerId);
extern libkn_KInt scSetScannerParameter(const char* scannerId, libkn_KInt option, const char* value);
extern libkn_KInt scStartScan(const char* scannerId, libkn_KBoolean batchMode);
extern libkn_KInt scStartScannerDiscovery();
extern const char* oaErrEnumValuesJson();
extern libkn_KInt oaGetNameRet(libkn_KULong bufLen);
extern libkn_KInt pbClearData(void* pasteboardPtr);
extern libkn_KLong pbCreateObserver();
extern libkn_KLong pbCreatePasteboard();
extern libkn_KInt pbDestroyObserver(void* observerPtr);
extern libkn_KInt pbDestroyPasteboard(void* pasteboardPtr);
extern const char* pbErrEnumValuesJson();
extern const char* pbFileConflictEnumValuesJson();
extern libkn_KInt pbGetChangeCount(void* pasteboardPtr);
extern libkn_KLong pbGetDataParamsCreate();
extern libkn_KInt pbGetDataParamsDestroy(void* paramsPtr);
extern libkn_KInt pbGetDataParamsSetDestUri(void* paramsPtr, const char* uri);
extern libkn_KInt pbGetDataParamsSetFileConflictOptions(void* paramsPtr, libkn_KInt option);
extern libkn_KInt pbGetDataParamsSetProgressIndicator(void* paramsPtr, libkn_KInt indicator);
extern libkn_KInt pbGetDataParamsSetProgressListener(void* paramsPtr);
extern const char* pbGetDataSourceStr(void* pasteboardPtr, libkn_KInt bufLen);
extern const char* pbGetDataWithProgress(void* pasteboardPtr, void* paramsPtr);
extern const char* pbGetDataWithStatus(void* pasteboardPtr);
extern const char* pbGetMimeTypesJson(void* pasteboardPtr);
extern libkn_KInt pbHasData(void* pasteboardPtr);
extern libkn_KInt pbHasType(void* pasteboardPtr, const char* type);
extern libkn_KInt pbIsRemoteData(void* pasteboardPtr);
extern const char* pbNotifyEnumValuesJson();
extern libkn_KInt pbObserverSetData(void* observerPtr);
extern libkn_KInt pbProgressCancel(void* paramsPtr);
extern const char* pbProgressIndicatorEnumValuesJson();
extern libkn_KInt pbProgressInfoGetProgress(void* infoPtr);
extern libkn_KInt pbSetData(void* pasteboardPtr, void* dataPtr);
extern libkn_KInt pbSubscribe(void* pasteboardPtr, libkn_KInt type, void* observerPtr);
extern libkn_KInt pbSyncDelayedDataAsyncStart(void* pasteboardPtr);
extern libkn_KInt pbUnsubscribe(void* pasteboardPtr, libkn_KInt type, void* observerPtr);
extern const char* tsErrEnumValuesJson();
extern const char* tsGetTimeZone();
extern const char* aipGetErrorEnumValuesJson();
extern libkn_KLong avcencInfoCreate();
extern libkn_KInt avcencInfoDestroy(void* info);
extern libkn_KInt avcencInfoSetAVBuffer(void* info, void* buffer);
extern libkn_KInt avcencInfoSetAlgorithm(void* info, libkn_KInt algo);
extern libkn_KInt avcencInfoSetKeyIdAndIvTest(void* info);
extern libkn_KInt avcencInfoSetMode(void* info, libkn_KInt mode);
extern libkn_KInt avcencInfoSetSubsampleInfoTest(void* info);
extern const char* drmCencGetAlgorithmEnumValuesJson();
extern const char* drmCencGetInfoModeEnumValuesJson();
extern libkn_KInt runAbilityCheckSelfPermission(const char* permission);
extern const char* getHiAppEventEnumValuesJson();
extern libkn_KInt hiAppEventAddBoolArrayParam(const char* name, const char* valuesCsv);
extern libkn_KInt hiAppEventAddBoolParam(const char* name, libkn_KBoolean value);
extern libkn_KInt hiAppEventAddDoubleArrayParam(const char* name, const char* valuesCsv);
extern libkn_KInt hiAppEventAddDoubleParam(const char* name, libkn_KDouble value);
extern libkn_KInt hiAppEventAddFloatArrayParam(const char* name, const char* valuesCsv);
extern libkn_KInt hiAppEventAddFloatParam(const char* name, libkn_KFloat value);
extern libkn_KInt hiAppEventAddInt16ArrayParam(const char* name, const char* valuesCsv);
extern libkn_KInt hiAppEventAddInt16Param(const char* name, libkn_KInt value);
extern libkn_KInt hiAppEventAddInt32ArrayParam(const char* name, const char* valuesCsv);
extern libkn_KInt hiAppEventAddInt32Param(const char* name, libkn_KInt value);
extern libkn_KInt hiAppEventAddInt64ArrayParam(const char* name, const char* valuesCsv);
extern libkn_KInt hiAppEventAddInt64Param(const char* name, libkn_KLong value);
extern libkn_KInt hiAppEventAddInt8ArrayParam(const char* name, const char* valuesCsv);
extern libkn_KInt hiAppEventAddInt8Param(const char* name, libkn_KInt value);
extern libkn_KLong hiAppEventAddProcessor();
extern libkn_KInt hiAppEventAddStringArrayParam(const char* name, const char* valuesCsv);
extern libkn_KInt hiAppEventAddStringParam(const char* name, const char* value);
extern libkn_KInt hiAppEventAddWatcher();
extern libkn_KInt hiAppEventClearData();
extern libkn_KInt hiAppEventConfigure(const char* cfgName, const char* cfgValue);
extern libkn_KLong hiAppEventCreateConfig();
extern libkn_KLong hiAppEventCreateParamList();
extern libkn_KLong hiAppEventCreateProcessor(const char* name);
extern libkn_KLong hiAppEventCreateWatcher(const char* name);
extern libkn_KInt hiAppEventDestroyConfig();
extern libkn_KInt hiAppEventDestroyParamList();
extern libkn_KInt hiAppEventDestroyProcessor();
extern libkn_KInt hiAppEventDestroyWatcher();
extern libkn_KInt hiAppEventRemoveProcessor();
extern libkn_KInt hiAppEventRemoveWatcher();
extern libkn_KInt hiAppEventSetAppEventFilter(const char* domain, libkn_KUByte eventTypesMask, const char* namesCsv);
extern libkn_KInt hiAppEventSetConfigId(libkn_KInt configId);
extern libkn_KInt hiAppEventSetConfigItem(const char* itemName, const char* itemValue);
extern libkn_KInt hiAppEventSetConfigName(const char* configName);
extern libkn_KInt hiAppEventSetCustomConfig(const char* key, const char* value);
extern libkn_KInt hiAppEventSetEventConfig(const char* eventName);
extern libkn_KInt hiAppEventSetReportEvent(const char* domain, const char* name, libkn_KBoolean isRealTime);
extern libkn_KInt hiAppEventSetReportPolicy(libkn_KInt periodReport, libkn_KInt batchReport, libkn_KBoolean onStartReport, libkn_KBoolean onBackgroundReport);
extern libkn_KInt hiAppEventSetReportRoute(const char* appId, const char* routeInfo);
extern libkn_KInt hiAppEventSetReportUserId(const char* userIdsCsv);
extern libkn_KInt hiAppEventSetReportUserProperty(const char* propsCsv);
extern libkn_KInt hiAppEventSetTriggerCondition(libkn_KInt row, libkn_KInt size, libkn_KInt timeout);
extern libkn_KInt hiAppEventSetWatcherOnReceive();
extern libkn_KInt hiAppEventSetWatcherOnTrigger();
extern libkn_KInt hiAppEventTakeWatcherData(libkn_KUInt num);
extern libkn_KInt hiAppEventWrite(const char* domain, const char* name, libkn_KInt type);
extern const char* getHiCollieEnumValuesJson();
extern libkn_KInt hicollieCancelTimer(libkn_KInt id);
extern libkn_KInt hicollieInitJankDetection();
extern libkn_KInt hicollieInitStuckDetection();
extern libkn_KInt hicollieInitStuckDetectionWithTimeout(libkn_KUInt stuckTimeout);
extern libkn_KInt hicollieReport(libkn_KBoolean isSixSecond);
extern const char* hicollieSetTimer(const char* name, libkn_KUInt timeout, libkn_KUInt flag);
extern const char* getHiDebugEnumValuesJson();
extern const char* hiDebugBacktraceFromFp(libkn_KLong fpAddr);
extern libkn_KLong hiDebugCreateBacktraceObjectAddr();
extern libkn_KInt hiDebugDestroyBacktraceObject(libkn_KLong objAddr);
extern libkn_KInt hiDebugFreeLastThreadCpuUsage();
extern libkn_KDouble hiDebugGetAppCpuUsage();
extern const char* hiDebugGetAppMemoryLimitJson();
extern const char* hiDebugGetAppNativeMemInfoJson();
extern const char* hiDebugGetAppNativeMemInfoWithCacheJson(libkn_KBoolean forceRefresh);
extern const char* hiDebugGetAppThreadCpuUsageJson();
extern libkn_KLong hiDebugGetDefaultMallocDispatchTableAddr();
extern const char* hiDebugGetGraphicsMemory();
extern const char* hiDebugGetGraphicsMemorySummary(libkn_KUInt interval);
extern libkn_KDouble hiDebugGetSystemCpuUsage();
extern const char* hiDebugGetSystemMemInfoJson();
extern libkn_KInt hiDebugRequestThreadLiteSampling(libkn_KUInt duration, libkn_KUInt frequency);
extern libkn_KInt hiDebugRestoreMallocDispatchTable();
extern libkn_KInt hiDebugSetMallocDispatchTable();
extern const char* hiDebugStartAppTraceCapture(libkn_KUInt flag, libkn_KULong tags, libkn_KUInt limitSize);
extern libkn_KInt hiDebugStopAppTraceCapture();
extern const char* hiDebugSymbolicAddress(libkn_KULong addr);
extern const char* getHiLogEnumValuesJson();
extern libkn_KInt hiLogIsLoggable(libkn_KUInt domain, const char* tag, libkn_KUInt level);
extern libkn_KInt hiLogPrint(libkn_KUInt type, libkn_KUInt level, libkn_KUInt domain, const char* tag, const char* fmt);
extern libkn_KInt hiLogPrintMsg(libkn_KUInt type, libkn_KUInt level, libkn_KUInt domain, const char* tag, const char* message);
extern libkn_KInt hiLogPrintMsgByLen(libkn_KUInt type, libkn_KUInt level, libkn_KUInt domain, const char* tag, libkn_KULong tagLen, const char* message, libkn_KULong messageLen);
extern libkn_KInt hiLogSetCallback();
extern libkn_KInt hiLogSetMinLogLevel(libkn_KUInt level);
extern libkn_KInt hiLogVPrint(libkn_KUInt type, libkn_KUInt level, libkn_KUInt domain, const char* tag, const char* fmt);
extern const char* getHiTraceEnumValuesJson();
extern libkn_KLong hiTraceAllocIdPtr();
extern libkn_KInt hiTraceClearId();
extern libkn_KInt hiTraceCountTrace(const char* name, libkn_KLong count);
extern libkn_KInt hiTraceCountTraceEx(libkn_KUInt level, const char* name, libkn_KLong count);
extern libkn_KInt hiTraceEnableFlag(void* idPtr, libkn_KUInt flag);
extern libkn_KInt hiTraceEndChain();
extern libkn_KInt hiTraceFinishAsyncTrace(const char* name, libkn_KInt taskId);
extern libkn_KInt hiTraceFinishAsyncTraceEx(libkn_KUInt level, const char* name, libkn_KInt taskId);
extern libkn_KInt hiTraceFinishTrace();
extern libkn_KInt hiTraceFinishTraceEx(libkn_KUInt level);
extern libkn_KInt hiTraceFreeIdPtr(void* idPtr);
extern libkn_KLong hiTraceGetChainId(void* idPtr);
extern libkn_KInt hiTraceGetFlags(void* idPtr);
extern libkn_KLong hiTraceGetParentSpanId(void* idPtr);
extern libkn_KLong hiTraceGetSpanId(void* idPtr);
extern libkn_KInt hiTraceIdFromBytes(void* idPtr, void* bytesPtr, libkn_KInt len);
extern libkn_KInt hiTraceIdFromHex(void* idPtr, const char* hex);
extern const char* hiTraceIdToBytes(void* idPtr, libkn_KInt len);
extern libkn_KInt hiTraceInitId(void* idPtr);
extern libkn_KInt hiTraceIsFlagEnabled(void* idPtr, libkn_KUInt flag);
extern libkn_KInt hiTraceIsIdValid(void* idPtr);
extern libkn_KInt hiTraceIsTraceEnabled();
extern libkn_KInt hiTraceRegisterTraceListener();
extern libkn_KInt hiTraceSetChainId(void* idPtr, libkn_KULong chainId);
extern libkn_KInt hiTraceSetFlags(void* idPtr, libkn_KInt flags);
extern libkn_KInt hiTraceSetId(void* idPtr);
extern libkn_KInt hiTraceSetParentSpanId(void* idPtr, libkn_KULong parentSpanId);
extern libkn_KInt hiTraceSetSpanId(void* idPtr, libkn_KULong spanId);
extern libkn_KInt hiTraceStartAsyncTrace(const char* name, libkn_KInt taskId);
extern libkn_KInt hiTraceStartAsyncTraceEx(libkn_KUInt level, const char* name, libkn_KInt taskId, const char* customCategory, const char* customArgs);
extern libkn_KInt hiTraceStartTrace(const char* name);
extern libkn_KInt hiTraceStartTraceEx(libkn_KUInt level, const char* name, const char* customArgs);
extern libkn_KInt hiTraceTracepoint(libkn_KUInt mode, libkn_KUInt type, void* idPtr, const char* fmt);
extern libkn_KInt hiTraceUnregisterTraceListener(libkn_KInt index);
typedef struct {
/* Service functions. */
void (*DisposeStablePointer)(libkn_KNativePtr ptr);
void (*DisposeString)(const char* string);
libkn_KBoolean (*IsInstance)(libkn_KNativePtr ref, const libkn_KType* type);
libkn_kref_kotlin_Byte (*createNullableByte)(libkn_KByte);
libkn_KByte (*getNonNullValueOfByte)(libkn_kref_kotlin_Byte);
libkn_kref_kotlin_Short (*createNullableShort)(libkn_KShort);
libkn_KShort (*getNonNullValueOfShort)(libkn_kref_kotlin_Short);
libkn_kref_kotlin_Int (*createNullableInt)(libkn_KInt);
libkn_KInt (*getNonNullValueOfInt)(libkn_kref_kotlin_Int);
libkn_kref_kotlin_Long (*createNullableLong)(libkn_KLong);
libkn_KLong (*getNonNullValueOfLong)(libkn_kref_kotlin_Long);
libkn_kref_kotlin_Float (*createNullableFloat)(libkn_KFloat);
libkn_KFloat (*getNonNullValueOfFloat)(libkn_kref_kotlin_Float);
libkn_kref_kotlin_Double (*createNullableDouble)(libkn_KDouble);
libkn_KDouble (*getNonNullValueOfDouble)(libkn_kref_kotlin_Double);
libkn_kref_kotlin_Char (*createNullableChar)(libkn_KChar);
libkn_KChar (*getNonNullValueOfChar)(libkn_kref_kotlin_Char);
libkn_kref_kotlin_Boolean (*createNullableBoolean)(libkn_KBoolean);
libkn_KBoolean (*getNonNullValueOfBoolean)(libkn_kref_kotlin_Boolean);
libkn_kref_kotlin_Unit (*createNullableUnit)(void);
libkn_kref_kotlin_UByte (*createNullableUByte)(libkn_KUByte);
libkn_KUByte (*getNonNullValueOfUByte)(libkn_kref_kotlin_UByte);
libkn_kref_kotlin_UShort (*createNullableUShort)(libkn_KUShort);
libkn_KUShort (*getNonNullValueOfUShort)(libkn_kref_kotlin_UShort);
libkn_kref_kotlin_UInt (*createNullableUInt)(libkn_KUInt);
libkn_KUInt (*getNonNullValueOfUInt)(libkn_kref_kotlin_UInt);
libkn_kref_kotlin_ULong (*createNullableULong)(libkn_KULong);
libkn_KULong (*getNonNullValueOfULong)(libkn_kref_kotlin_ULong);
/* User functions. */
struct {
struct {
struct {
struct {
struct {
struct {
libkn_KType* (*_type)(void);
libkn_kref_com_example_kmpmultiplatform_AppText (*AppText)(const char* text, const char* colorHex, libkn_KFloat sizeSp, libkn_KBoolean bold);
libkn_KBoolean (*get_bold)(libkn_kref_com_example_kmpmultiplatform_AppText thiz);
const char* (*get_colorHex)(libkn_kref_com_example_kmpmultiplatform_AppText thiz);
libkn_KFloat (*get_sizeSp)(libkn_kref_com_example_kmpmultiplatform_AppText thiz);
const char* (*get_text)(libkn_kref_com_example_kmpmultiplatform_AppText thiz);
const char* (*component1)(libkn_kref_com_example_kmpmultiplatform_AppText thiz);
const char* (*component2)(libkn_kref_com_example_kmpmultiplatform_AppText thiz);
libkn_KFloat (*component3)(libkn_kref_com_example_kmpmultiplatform_AppText thiz);
libkn_KBoolean (*component4)(libkn_kref_com_example_kmpmultiplatform_AppText thiz);
libkn_kref_com_example_kmpmultiplatform_AppText (*copy)(libkn_kref_com_example_kmpmultiplatform_AppText thiz, const char* text, const char* colorHex, libkn_KFloat sizeSp, libkn_KBoolean bold);
libkn_KBoolean (*equals)(libkn_kref_com_example_kmpmultiplatform_AppText thiz, libkn_kref_kotlin_Any other);
libkn_KInt (*hashCode)(libkn_kref_com_example_kmpmultiplatform_AppText thiz);
const char* (*toString)(libkn_kref_com_example_kmpmultiplatform_AppText thiz);
} AppText;
struct {
libkn_KType* (*_type)(void);
libkn_kref_com_example_kmpmultiplatform_Greeting (*Greeting)();
const char* (*greet)(libkn_kref_com_example_kmpmultiplatform_Greeting thiz);
} Greeting;
struct {
libkn_KType* (*_type)(void);
const char* (*get_name)(libkn_kref_com_example_kmpmultiplatform_Platform thiz);
} Platform;
struct {
libkn_KType* (*_type)(void);
libkn_kref_com_example_kmpmultiplatform_OHOSPlatform (*OHOSPlatform)();
const char* (*get_name)(libkn_kref_com_example_kmpmultiplatform_OHOSPlatform thiz);
} OHOSPlatform;
libkn_kref_com_example_kmpmultiplatform_AppText (*App)();
libkn_kref_com_example_kmpmultiplatform_Platform (*getPlatform)();
} kmpmultiplatform;
struct {
struct {
libkn_KType* (*_type)(void);
libkn_kref_com_example_test_ohosTest (*ohosTest)();
} ohosTest;
struct {
struct {
libkn_KInt (*avcAreProfileAndLevelSupported_)(const char* mime, libkn_KUInt isEncoder, libkn_KInt profile, libkn_KInt level);
libkn_KInt (*avcAreVideoSizeAndFrameRateSupported_)(const char* mime, libkn_KUInt isEncoder, libkn_KInt width, libkn_KInt height, libkn_KInt frameRate);
const char* (*avcGetAudioChannelCountRange_)(const char* mime, libkn_KUInt isEncoder);
const char* (*avcGetAudioSupportedSampleRateRanges_)(const char* mime, libkn_KUInt isEncoder);
const char* (*avcGetAudioSupportedSampleRates_)(const char* mime, libkn_KUInt isEncoder);
const char* (*avcGetEncoderBitrateRange_)(const char* mime);
const char* (*avcGetEncoderComplexityRange_)(const char* mime);
const char* (*avcGetEncoderQualityRange_)(const char* mime);
const char* (*avcGetFeaturePropertiesDump_)(const char* mime, libkn_KUInt isEncoder, libkn_KUInt feature);
libkn_KInt (*avcGetMaxSupportedInstances_)(const char* mime, libkn_KUInt isEncoder);
const char* (*avcGetName_)(const char* mime, libkn_KUInt isEncoder);
const char* (*avcGetNameByCategory_)(const char* mime, libkn_KUInt isEncoder, libkn_KUInt category);
const char* (*avcGetSupportedLevelsForProfile_)(const char* mime, libkn_KUInt isEncoder, libkn_KInt profile);
const char* (*avcGetSupportedProfiles_)(const char* mime, libkn_KUInt isEncoder);
const char* (*avcGetVideoFrameRateRange_)(const char* mime, libkn_KUInt isEncoder);
const char* (*avcGetVideoFrameRateRangeForSize_)(const char* mime, libkn_KUInt isEncoder, libkn_KInt width, libkn_KInt height);
libkn_KInt (*avcGetVideoHeightAlignment_)(const char* mime, libkn_KUInt isEncoder);
const char* (*avcGetVideoHeightRange_)(const char* mime, libkn_KUInt isEncoder);
const char* (*avcGetVideoHeightRangeForWidth_)(const char* mime, libkn_KUInt isEncoder, libkn_KInt width);
const char* (*avcGetVideoSupportedPixelFormats_)(const char* mime, libkn_KUInt isEncoder);
libkn_KInt (*avcGetVideoWidthAlignment_)(const char* mime, libkn_KUInt isEncoder);
const char* (*avcGetVideoWidthRange_)(const char* mime, libkn_KUInt isEncoder);
const char* (*avcGetVideoWidthRangeForHeight_)(const char* mime, libkn_KUInt isEncoder, libkn_KInt height);
libkn_KInt (*avcIsEncoderBitrateModeSupported_)(const char* mime, libkn_KUInt bitrateMode);
libkn_KInt (*avcIsFeatureSupported_)(const char* mime, libkn_KUInt isEncoder, libkn_KUInt feature);
libkn_KInt (*avcIsHardware_)(const char* mime, libkn_KUInt isEncoder);
libkn_KInt (*avcIsVideoSizeSupported_)(const char* mime, libkn_KUInt isEncoder, libkn_KInt width, libkn_KInt height);
const char* (*getAVCapabilityEnumValuesJson_)();
} AVCapability;
struct {
libkn_KLong (*avdCreateWithSource_)(void* source);
libkn_KInt (*avdDestroy_)(void* demuxer);
libkn_KInt (*avdGetMediaKeySystemInfo_)(void* demuxer);
const char* (*avdReadSample_)(void* demuxer, libkn_KInt trackIndex, void* sampleMem);
libkn_KInt (*avdReadSampleBuffer_)(void* demuxer, libkn_KInt trackIndex, void* sampleBuffer);
libkn_KInt (*avdSeekToTime_)(void* demuxer, libkn_KLong millisecond, libkn_KInt mode);
libkn_KInt (*avdSelectTrackByID_)(void* demuxer, libkn_KInt trackIndex);
libkn_KInt (*avdSetDemuxerMediaKeySystemInfoCallback_)(void* demuxer);
libkn_KInt (*avdSetMediaKeySystemInfoCallback_)(void* demuxer);
libkn_KInt (*avdUnselectTrackByID_)(void* demuxer, libkn_KInt trackIndex);
} AVDemuxer;
struct {
const char* (*avmAddTrack_)(void* muxer, void* trackFormat);
libkn_KLong (*avmCreate_)(libkn_KInt fd, libkn_KUInt format);
libkn_KInt (*avmDestroy_)(void* muxer);
libkn_KInt (*avmSetFormat_)(void* muxer, void* format);
libkn_KInt (*avmSetRotation_)(void* muxer, libkn_KInt rotation);
libkn_KInt (*avmStart_)(void* muxer);
libkn_KInt (*avmStop_)(void* muxer);
libkn_KInt (*avmWriteSampleBuffer_)(void* muxer, libkn_KInt trackIndex, void* sampleBuffer);
} AVMuxer;
struct {
libkn_KLong (*avsCreateWithDataSource_)(void* dataSource);
libkn_KLong (*avsCreateWithDataSourceExt_)(void* dataSourceExt, void* userData);
libkn_KLong (*avsCreateWithFD_)(libkn_KInt fd, libkn_KLong offset, libkn_KLong size);
libkn_KLong (*avsCreateWithURI_)(const char* uri);
libkn_KInt (*avsDestroy_)(void* source);
libkn_KLong (*avsGetCustomMetadataFormat_)(void* source);
libkn_KLong (*avsGetSourceFormat_)(void* source);
libkn_KLong (*avsGetTrackFormat_)(void* source, libkn_KInt trackIndex);
} AVSource;
struct {
libkn_KInt (*acConfigure_)(void* codec, void* format);
libkn_KLong (*acCreateByMime_)(const char* mime, libkn_KBoolean isEncoder);
libkn_KLong (*acCreateByName_)(const char* name);
libkn_KInt (*acDestroy_)(void* codec);
libkn_KInt (*acFlush_)(void* codec);
libkn_KInt (*acFreeOutputBuffer_)(void* codec, libkn_KInt index);
libkn_KLong (*acGetInputBuffer_)(void* codec, libkn_KInt index);
libkn_KLong (*acGetOutputBuffer_)(void* codec, libkn_KInt index);
libkn_KLong (*acGetOutputDescription_)(void* codec);
const char* (*acIsValid_)(void* codec);
libkn_KInt (*acPrepare_)(void* codec);
libkn_KInt (*acPushInputBuffer_)(void* codec, libkn_KInt index);
const char* (*acQueryInputBuffer_)(void* codec, libkn_KLong timeoutUs);
const char* (*acQueryOutputBuffer_)(void* codec, libkn_KLong timeoutUs);
libkn_KInt (*acRegisterCallback_)(void* codec, void* userData);
libkn_KInt (*acReset_)(void* codec);
libkn_KInt (*acSetDecryptionConfig_)(void* codec, void* mediaKeySession, libkn_KBoolean secureAudio);
libkn_KInt (*acSetParameter_)(void* codec, void* format);
libkn_KInt (*acStart_)(void* codec);
libkn_KInt (*acStop_)(void* codec);
} AudioCodec;
struct {
libkn_KLong (*avcbCreateDataSourceExt_)(libkn_KLong size);
libkn_KLong (*avcbCreateDataSourceFromFD_)(libkn_KInt fd, libkn_KLong size);
libkn_KLong (*avcbCreateUserDataFromFD_)(libkn_KInt fd);
const char* (*getAACProfileEnumValuesJson_)();
const char* (*getAVCLevelEnumValuesJson_)();
const char* (*getAVCProfileEnumValuesJson_)();
const char* (*getAVOutputFormatEnumValuesJson_)();
const char* (*getAVSeekModeEnumValuesJson_)();
const char* (*getAudioChannelLayoutEnumValuesJson_)();
const char* (*getAudioChannelSetEnumValuesJson_)();
const char* (*getBitrateModeEnumValuesJson_)();
const char* (*getBitsPerSampleEnumValuesJson_)();
const char* (*getColorPrimaryEnumValuesJson_)();
const char* (*getH263LevelEnumValuesJson_)();
const char* (*getH263ProfileEnumValuesJson_)();
const char* (*getHEVCLevelEnumValuesJson_)();
const char* (*getHEVCProfileEnumValuesJson_)();
const char* (*getMPEG2LevelEnumValuesJson_)();
const char* (*getMPEG2ProfileEnumValuesJson_)();
const char* (*getMPEG4LevelEnumValuesJson_)();
const char* (*getMPEG4ProfileEnumValuesJson_)();
const char* (*getMatrixCoefficientEnumValuesJson_)();
const char* (*getMediaTypeEnumValuesJson_)();
const char* (*getScalingModeEnumValuesJson_)();
const char* (*getTemporalGopReferenceModeEnumValuesJson_)();
const char* (*getTransferCharacteristicEnumValuesJson_)();
const char* (*getVVCLevelEnumValuesJson_)();
const char* (*getVVCProfileEnumValuesJson_)();
} CodecBase;
struct {
libkn_KLong (*avbCreate_)(libkn_KInt capacity);
libkn_KInt (*avbDestroy_)(void* buffer);
libkn_KLong (*avbGetAddr_)(void* buffer);
const char* (*avbGetBufferAttr_)(void* buffer);
libkn_KInt (*avbGetCapacity_)(void* buffer);
libkn_KLong (*avbGetNativeBuffer_)(void* buffer);
libkn_KLong (*avbGetParameter_)(void* buffer);
libkn_KInt (*avbSetBufferAttr_)(void* buffer, libkn_KLong pts, libkn_KInt size, libkn_KInt offset, libkn_KInt flags);
libkn_KInt (*avbSetParameter_)(void* buffer, void* format);
libkn_KInt (*avfCopy_)(void* to, void* from);
libkn_KLong (*avfCreate_)();
libkn_KLong (*avfCreateAudioFormat_)(const char* mime, libkn_KInt sampleRate, libkn_KInt channelCount);
libkn_KLong (*avfCreateVideoFormat_)(const char* mime, libkn_KInt width, libkn_KInt height);
libkn_KInt (*avfDestroy_)(void* format);
const char* (*avfDumpInfo_)(void* format);
const char* (*avfGetBuffer_)(void* format, const char* key);
const char* (*avfGetDoubleValue_)(void* format, const char* key);
const char* (*avfGetFloatValue_)(void* format, const char* key);
const char* (*avfGetIntBuffer_)(void* format, const char* key);
const char* (*avfGetIntValue_)(void* format, const char* key);
const char* (*avfGetLongValue_)(void* format, const char* key);
const char* (*avfGetStringValue_)(void* format, const char* key);
libkn_KInt (*avfSetBuffer_)(void* format, const char* key, void* addr, libkn_KLong size);
libkn_KInt (*avfSetDoubleValue_)(void* format, const char* key, libkn_KDouble value);
libkn_KInt (*avfSetFloatValue_)(void* format, const char* key, libkn_KFloat value);
libkn_KInt (*avfSetIntBuffer_)(void* format, const char* key, void* addr, libkn_KLong size);
libkn_KInt (*avfSetIntValue_)(void* format, const char* key, libkn_KInt value);
libkn_KInt (*avfSetLongValue_)(void* format, const char* key, libkn_KLong value);
libkn_KInt (*avfSetStringValue_)(void* format, const char* key, const char* value);
libkn_KLong (*avmemCreate_)(libkn_KInt size);
libkn_KInt (*avmemDestroy_)(void* mem);
libkn_KLong (*avmemGetAddr_)(void* mem);
libkn_KInt (*avmemGetSize_)(void* mem);
const char* (*getAVCodecBufferFlagsEnumValuesJson_)();
const char* (*getAVErrorEnumValuesJson_)();
const char* (*getHdrTypeEnumValuesJson_)();
} Core;
struct {
libkn_KInt (*vdConfigure_)(void* codec, void* format);
libkn_KLong (*vdCreateByMime_)(const char* mime);
libkn_KLong (*vdCreateByName_)(const char* name);
libkn_KInt (*vdDestroy_)(void* codec);
libkn_KInt (*vdFlush_)(void* codec);
libkn_KInt (*vdFreeOutputBuffer_)(void* codec, libkn_KInt index);
libkn_KInt (*vdFreeOutputData_)(void* codec, libkn_KInt index);
libkn_KLong (*vdGetInputBuffer_)(void* codec, libkn_KInt index);
libkn_KLong (*vdGetOutputBuffer_)(void* codec, libkn_KInt index);
libkn_KLong (*vdGetOutputDescription_)(void* codec);
const char* (*vdIsValid_)(void* codec);
libkn_KInt (*vdPrepare_)(void* codec);
libkn_KInt (*vdPushInputBuffer_)(void* codec, libkn_KInt index);
libkn_KInt (*vdPushInputData_)(void* codec, libkn_KInt index);
const char* (*vdQueryInputBuffer_)(void* codec, libkn_KLong timeoutUs);
const char* (*vdQueryOutputBuffer_)(void* codec, libkn_KLong timeoutUs);
libkn_KInt (*vdRegisterCallback_)(void* codec, void* userData);
libkn_KInt (*vdRenderOutputBuffer_)(void* codec, libkn_KInt index);
libkn_KInt (*vdRenderOutputBufferAtTime_)(void* codec, libkn_KInt index, libkn_KLong renderTimestampNs);
libkn_KInt (*vdRenderOutputData_)(void* codec, libkn_KInt index);
libkn_KInt (*vdReset_)(void* codec);
libkn_KInt (*vdSetCallback_)(void* codec, void* userData);
libkn_KInt (*vdSetDecryptionConfig_)(void* codec, void* mediaKeySession, libkn_KBoolean secureVideoPath);
libkn_KInt (*vdSetParameter_)(void* codec, void* format);
libkn_KInt (*vdSetSurface_)(void* codec, void* window);
libkn_KInt (*vdStart_)(void* codec);
libkn_KInt (*vdStop_)(void* codec);
} VideoDecoder;
struct {
libkn_KInt (*avcbAudioDecoderSetCallback_)(void* codec, void* userData);
const char* (*avcbVideoEncoderGetSurface_)(void* codec);
libkn_KInt (*avcbVideoEncoderPushInputBuffer_)(void* codec, libkn_KInt index);
libkn_KInt (*avcbVideoEncoderSetCallback_)(void* codec, void* userData);
const char* (*getVideoEncodeBitrateModeEnumValuesJson_)();
libkn_KInt (*veConfigure_)(void* codec, void* format);
libkn_KLong (*veCreateByMime_)(const char* mime);
libkn_KLong (*veCreateByName_)(const char* name);
libkn_KInt (*veDestroy_)(void* codec);
libkn_KInt (*veFlush_)(void* codec);
libkn_KInt (*veFreeOutputBuffer_)(void* codec, libkn_KInt index);
libkn_KInt (*veFreeOutputData_)(void* codec, libkn_KInt index);
libkn_KLong (*veGetInputBuffer_)(void* codec, libkn_KInt index);
libkn_KLong (*veGetInputDescription_)(void* codec);
libkn_KLong (*veGetOutputBuffer_)(void* codec, libkn_KInt index);
libkn_KLong (*veGetOutputDescription_)(void* codec);
const char* (*veGetSurface_)(void* codec);
const char* (*veIsValid_)(void* codec);
libkn_KInt (*veNotifyEndOfStream_)(void* codec);
libkn_KInt (*vePrepare_)(void* codec);
libkn_KInt (*vePushInputBuffer_)(void* codec, libkn_KInt index);
libkn_KInt (*vePushInputParameter_)(void* codec, libkn_KInt index);
const char* (*veQueryInputBuffer_)(void* codec, libkn_KLong timeoutUs);
const char* (*veQueryOutputBuffer_)(void* codec, libkn_KLong timeoutUs);
libkn_KInt (*veRegisterCallback_)(void* codec, void* userData);
libkn_KInt (*veRegisterParameterCallback_)(void* codec, void* userData);
libkn_KInt (*veReset_)(void* codec);
libkn_KInt (*veSetParameter_)(void* codec, void* format);
libkn_KInt (*veStart_)(void* codec);
libkn_KInt (*veStop_)(void* codec);
} VideoEncoder;
} AVCodecKit;
struct {
const char* (*getAVMetadataEnumValuesJson_)();
const char* (*ohavmdBuilderCreate_)();
libkn_KInt (*ohavmdBuilderDestroy_)(void* builder);
const char* (*ohavmdBuilderGenerateAVMetadata_)(void* builder);
libkn_KInt (*ohavmdBuilderSetAlbum_)(void* builder, const char* album);
libkn_KInt (*ohavmdBuilderSetArtist_)(void* builder, const char* artist);
libkn_KInt (*ohavmdBuilderSetAssetId_)(void* builder, const char* assetId);
libkn_KInt (*ohavmdBuilderSetAuthor_)(void* builder, const char* author);
libkn_KInt (*ohavmdBuilderSetComposer_)(void* builder, const char* composer);
libkn_KInt (*ohavmdBuilderSetDescription_)(void* builder, const char* description);
libkn_KInt (*ohavmdBuilderSetDisplayTags_)(void* builder, libkn_KInt tags);
libkn_KInt (*ohavmdBuilderSetDuration_)(void* builder, libkn_KLong durationMs);
libkn_KInt (*ohavmdBuilderSetLyric_)(void* builder, const char* lyric);
libkn_KInt (*ohavmdBuilderSetMediaImageUri_)(void* builder, const char* uri);
libkn_KInt (*ohavmdBuilderSetSkipIntervals_)(void* builder, libkn_KInt intervals);
libkn_KInt (*ohavmdBuilderSetSubtitle_)(void* builder, const char* subtitle);
libkn_KInt (*ohavmdBuilderSetTitle_)(void* builder, const char* title);
libkn_KInt (*ohavmdBuilderSetWriter_)(void* builder, const char* writer);
libkn_KInt (*ohavmdDestroy_)(void* metadata);
} AVSessionKit;
struct {
struct {
libkn_KInt (*abilityBaseAddGetWantFd_)(const char* key, libkn_KInt fd);
libkn_KInt (*abilityBaseCreateWant_)(const char* bundleName, const char* moduleName, const char* abilityName);
const char* (*abilityBaseGetWantElement_)(const char* bundleName, const char* moduleName, const char* abilityName);
libkn_KInt (*abilityBaseSetGetWantBoolParam_)(const char* key, libkn_KBoolean value);
const char* (*abilityBaseSetGetWantCharParam_)(const char* key, const char* value);
libkn_KDouble (*abilityBaseSetGetWantDoubleParam_)(const char* key, libkn_KDouble value);
libkn_KInt (*abilityBaseSetGetWantInt32Param_)(const char* key, libkn_KInt value);
const char* (*abilityBaseSetGetWantUri_)(const char* uri);
libkn_KInt (*abilityBaseSetWantElement_)(const char* bundleName, const char* moduleName, const char* abilityName);
} AbilityBase;
struct {
libkn_KInt (*abilityRuntimeAppContextGetAreaMode_)();
const char* (*abilityRuntimeAppContextGetBundleCodeDir_)();
const char* (*abilityRuntimeAppContextGetBundleName_)();
const char* (*abilityRuntimeAppContextGetCacheDir_)();
const char* (*abilityRuntimeAppContextGetCloudFileDir_)();
const char* (*abilityRuntimeAppContextGetDatabaseDir_)();
const char* (*abilityRuntimeAppContextGetDistributedFilesDir_)();
const char* (*abilityRuntimeAppContextGetFilesDir_)();
const char* (*abilityRuntimeAppContextGetPreferencesDir_)();
const char* (*abilityRuntimeAppContextGetResourceDir_)(const char* moduleName);
libkn_KInt (*abilityRuntimeAppContextGetResourceDirCode_)(const char* moduleName);
const char* (*abilityRuntimeAppContextGetTempDir_)();
libkn_KInt (*abilityRuntimeSetGetStartOptionsDisplayId_)(libkn_KInt displayId);
libkn_KInt (*abilityRuntimeSetGetStartOptionsMaxWindowHeight_)(libkn_KInt value);
libkn_KInt (*abilityRuntimeSetGetStartOptionsMaxWindowWidth_)(libkn_KInt value);
libkn_KInt (*abilityRuntimeSetGetStartOptionsMinWindowHeight_)(libkn_KInt value);
libkn_KInt (*abilityRuntimeSetGetStartOptionsMinWindowWidth_)(libkn_KInt value);
libkn_KInt (*abilityRuntimeSetGetStartOptionsStartVisibility_)(libkn_KInt visibility);
const char* (*abilityRuntimeSetGetStartOptionsStartWindowBackgroundColor_)();
libkn_KInt (*abilityRuntimeSetGetStartOptionsSupportedWindowModes_)();
libkn_KInt (*abilityRuntimeSetGetStartOptionsWindowHeight_)(libkn_KInt windowHeight);
libkn_KInt (*abilityRuntimeSetGetStartOptionsWindowLeft_)(libkn_KInt windowLeft);
libkn_KInt (*abilityRuntimeSetGetStartOptionsWindowMode_)(libkn_KInt mode);
libkn_KInt (*abilityRuntimeSetGetStartOptionsWindowTop_)(libkn_KInt windowTop);
libkn_KInt (*abilityRuntimeSetGetStartOptionsWindowWidth_)(libkn_KInt windowWidth);
libkn_KInt (*abilityRuntimeSetGetStartOptionsWithAnimation_)(libkn_KBoolean withAnimation);
libkn_KInt (*abilityRuntimeStartOptionsCreateDestroy_)();
libkn_KInt (*abilityRuntimeStartSelfUIAbility_)(const char* bundleName, const char* moduleName, const char* abilityName);
libkn_KInt (*abilityRuntimeStartSelfUIAbilityWithStartOptions_)(const char* bundleName, const char* moduleName, const char* abilityName);
} AbilityRuntime;
struct {
libkn_KInt (*childProcessConfigsCreateDestroy_)(const char* processName, libkn_KUInt isolationMode);
libkn_KInt (*childProcessCreateNativeChildProcess_)(const char* libName);
libkn_KInt (*childProcessCreateNativeChildProcessWithConfigs_)(const char* libName, const char* processName, libkn_KUInt isolationMode);
const char* (*childProcessGetCurrentArgsEntryParams_)();
libkn_KInt (*childProcessRegisterExitCallback_)();
const char* (*childProcessStartNativeChildProcess_)(const char* entry, const char* entryParams);
const char* (*childProcessStartNativeChildProcessWithConfigs_)(const char* entry, const char* entryParams, const char* processName, libkn_KUInt isolationMode);
libkn_KInt (*childProcessUnregisterExitCallback_)();
} ChildProcess;
struct {
libkn_KInt (*abilityResourceCheckDefaultApp_)(libkn_KInt index);
const char* (*abilityResourceGetAbilityName_)(libkn_KInt index);
libkn_KInt (*abilityResourceGetAppIndex_)(libkn_KInt index);
const char* (*abilityResourceGetBundleName_)(libkn_KInt index);
libkn_KLong (*abilityResourceGetDrawableDescriptorPtr_)(libkn_KInt index);
const char* (*abilityResourceGetLabel_)(libkn_KInt index);
const char* (*abilityResourceGetModuleName_)(libkn_KInt index);
libkn_KInt (*abilityResourceGetSizeCached_)();
libkn_KInt (*abilityResourceQueryForFileType_)(const char* fileType);
libkn_KInt (*abilityResourceReset_)();
const char* (*getAppId_)();
const char* (*getAppIdentifier_)();
const char* (*getBundleManagerErrorCodeEnumValuesJson_)();
const char* (*getCompatibleDeviceType_)();
const char* (*getCurrentApplicationInfoJson_)();
const char* (*getMainElementNameJson_)();
const char* (*getModuleMetadataJson_)();
libkn_KInt (*isDebugMode_)();
} NativeBundle;
} AbilityKit;
struct {
struct {
libkn_KInt (*arkuiAllowNodeAllDropDataTypes_)(void* node);
libkn_KInt (*arkuiCancelDataLoading_)(void* uiContext, const char* key);
libkn_KInt (*arkuiCreateDragActionWithContext_)(void* uiContext);
libkn_KInt (*arkuiCreateDragActionWithDefaultContext_)();
libkn_KInt (*arkuiCreateDragActionWithNode_)(void* node);
libkn_KInt (*arkuiCreateDragPreviewOption_)();
libkn_KInt (*arkuiDisableDropDataPrefetchOnNode_)(void* node, libkn_KBoolean disabled);
libkn_KInt (*arkuiDisallowNodeAnyDropDataTypes_)(void* node);
libkn_KInt (*arkuiDragActionSetDataLoadParamsNull_)(void* dragAction);
libkn_KInt (*arkuiDragActionSetDataNull_)(void* dragAction);
libkn_KInt (*arkuiDragActionSetDragPreviewOption_)(void* dragAction);
libkn_KInt (*arkuiDragActionSetPointerId_)(void* dragAction, libkn_KInt pointerId);
libkn_KInt (*arkuiDragActionSetTouchPointX_)(void* dragAction, libkn_KDouble x);
libkn_KInt (*arkuiDragActionSetTouchPointY_)(void* dragAction, libkn_KDouble y);
libkn_KInt (*arkuiDragEventDisableDefaultDropAnimation_)(void* event, libkn_KBoolean disable);
libkn_KInt (*arkuiDragEventGetDataTypeCount_)(void* event);
libkn_KInt (*arkuiDragEventGetDataTypes_)(void* event, libkn_KInt length, libkn_KInt maxStrLen);
libkn_KInt (*arkuiDragEventGetDisplayId_)(void* event);
libkn_KInt (*arkuiDragEventGetDragResult_)(void* event);
libkn_KInt (*arkuiDragEventGetDragSource_)(void* event, libkn_KInt bufferLen);
libkn_KInt (*arkuiDragEventGetDropOperation_)(void* event);
libkn_KInt (*arkuiDragEventGetModifierKeyStates_)(void* event);
libkn_KDouble (*arkuiDragEventGetPreviewRectHeight_)(void* event);
libkn_KDouble (*arkuiDragEventGetPreviewRectWidth_)(void* event);
libkn_KDouble (*arkuiDragEventGetPreviewTouchPointX_)(void* event);
libkn_KDouble (*arkuiDragEventGetPreviewTouchPointY_)(void* event);
libkn_KDouble (*arkuiDragEventGetTouchPointXToDisplay_)(void* event);
libkn_KDouble (*arkuiDragEventGetTouchPointXToGlobalDisplay_)(void* event);
libkn_KDouble (*arkuiDragEventGetTouchPointXToWindow_)(void* event);
libkn_KDouble (*arkuiDragEventGetTouchPointYToDisplay_)(void* event);
libkn_KDouble (*arkuiDragEventGetTouchPointYToGlobalDisplay_)(void* event);
libkn_KDouble (*arkuiDragEventGetTouchPointYToWindow_)(void* event);
libkn_KInt (*arkuiDragEventGetUdmfDataNull_)(void* event);
libkn_KDouble (*arkuiDragEventGetVelocity_)(void* event);
libkn_KDouble (*arkuiDragEventGetVelocityX_)(void* event);
libkn_KDouble (*arkuiDragEventGetVelocityY_)(void* event);
libkn_KInt (*arkuiDragEventIsRemote_)(void* event);
libkn_KInt (*arkuiDragEventRequestDragEndPending_)(void* event);
libkn_KInt (*arkuiDragEventSetDataLoadParamsNull_)(void* event);
libkn_KInt (*arkuiDragEventSetDataNull_)(void* event);
libkn_KInt (*arkuiDragEventSetDragResult_)(void* event, libkn_KInt result);
libkn_KInt (*arkuiDragEventSetSuggestedDropOperation_)(void* event, libkn_KInt operation);
libkn_KInt (*arkuiDragEventStartDataLoading_)(void* event, libkn_KInt bufferLen);
libkn_KInt (*arkuiDragPreviewOptionSetBadgeNumber_)(libkn_KInt number);
libkn_KInt (*arkuiDragPreviewOptionSetDefaultAnimationBeforeLiftingEnabled_)(libkn_KBoolean enabled);
libkn_KInt (*arkuiDragPreviewOptionSetDefaultRadiusEnabled_)(libkn_KBoolean enabled);
libkn_KInt (*arkuiDragPreviewOptionSetDefaultShadowEnabled_)(libkn_KBoolean enabled);
libkn_KInt (*arkuiDragPreviewOptionSetNumberBadgeEnabled_)(libkn_KBoolean enabled);
libkn_KInt (*arkuiDragPreviewOptionSetScaleMode_)(libkn_KInt mode);
libkn_KInt (*arkuiEnableDropDisallowedBadge_)(void* uiContext, libkn_KBoolean enabled);
libkn_KLong (*arkuiGetCurrentUIContextPtr_)();
libkn_KLong (*arkuiGetDragActionPtr_)();
libkn_KInt (*arkuiNodeEventGetPreDragStatus_)(void* nodeEvent);
libkn_KInt (*arkuiNotifyDragEndPendingDone_)(libkn_KInt requestId);
libkn_KInt (*arkuiNotifyDragResult_)(libkn_KInt requestId, libkn_KInt result);
libkn_KInt (*arkuiSetDragEventStrictReportWithContext_)(void* uiContext, libkn_KBoolean enabled);
libkn_KInt (*arkuiSetDragEventStrictReportWithNode_)(void* node, libkn_KBoolean enabled);
libkn_KInt (*arkuiSetNodeDragPreviewNull_)(void* node);
libkn_KInt (*arkuiSetNodeDragPreviewOption_)(void* node);
libkn_KInt (*arkuiSetNodeDraggable_)(void* node, libkn_KBoolean enabled);
libkn_KInt (*arkuiStartDrag_)(void* dragAction);
} ArkUI_NativeModule;
} ArkUI;
struct {
libkn_KInt (*arkWebGetNativeAPI_)(libkn_KInt kind);
libkn_KInt (*arkWebRegisterScrollCallback_)(const char* webTag);
const char* (*getArkWebEnumValuesJson_)();
} ArkWeb;
struct {
struct {
const char* (*diGetAbiList_)();
const char* (*diGetBootloaderVersion_)();
const char* (*diGetBrand_)();
const char* (*diGetBuildHost_)();
const char* (*diGetBuildRootHash_)();
const char* (*diGetBuildTime_)();
const char* (*diGetBuildType_)();
const char* (*diGetBuildUser_)();
const char* (*diGetDeviceType_)();
const char* (*diGetDisplayVersion_)();
libkn_KInt (*diGetDistributionOSApiVersion_)();
const char* (*diGetDistributionOSName_)();
const char* (*diGetDistributionOSReleaseType_)();
const char* (*diGetDistributionOSVersion_)();
libkn_KInt (*diGetFirstApiVersion_)();
const char* (*diGetHardwareModel_)();
const char* (*diGetIncrementalVersion_)();
const char* (*diGetManufacture_)();
const char* (*diGetMarketName_)();
const char* (*diGetOSFullName_)();
const char* (*diGetOsReleaseType_)();
const char* (*diGetProductModel_)();
const char* (*diGetProductSeries_)();
libkn_KInt (*diGetSdkApiVersion_)();
const char* (*diGetSecurityPatchTag_)();
const char* (*diGetSoftwareModel_)();
const char* (*diGetVersionId_)();
} DeviceInfo;
struct {
libkn_KInt (*biGetCapacity_)();
libkn_KInt (*biGetPluggedType_)();
const char* (*biGetPluggedTypeEnumValuesJson_)();
} OH_BatteryInfo;
struct {
libkn_KInt (*ceAbortCommonEvent_)(void* subPtr);
libkn_KInt (*ceClearAbortCommonEvent_)(void* subPtr);
libkn_KLong (*ceCreateParameters_)();
libkn_KLong (*ceCreatePublishInfo_)(libkn_KBoolean ordered);
libkn_KLong (*ceCreateSubscribeInfo_)(const char* eventsJson);
libkn_KLong (*ceCreateSubscriber_)(void* infoPtr);
libkn_KInt (*ceDestroyParameters_)(void* paramPtr);
libkn_KInt (*ceDestroyPublishInfo_)(void* infoPtr);
libkn_KInt (*ceDestroySubscribeInfo_)(void* infoPtr);
libkn_KInt (*ceDestroySubscriber_)(void* subPtr);
const char* (*ceErrEnumValuesJson_)();
libkn_KInt (*ceFinishCommonEvent_)(void* subPtr);
libkn_KInt (*ceGetAbortCommonEvent_)(void* subPtr);
const char* (*ceGetBoolArrayFromParameters_)(void* paramPtr, const char* key);
libkn_KInt (*ceGetBoolFromParameters_)(void* paramPtr, const char* key, libkn_KBoolean defaultValue);
const char* (*ceGetBundleNameFromRcvData_)(void* rcvPtr);
const char* (*ceGetCharArrayFromParameters_)(void* paramPtr, const char* key);
const char* (*ceGetCharFromParameters_)(void* paramPtr, const char* key, const char* defaultValue);
libkn_KInt (*ceGetCodeFromRcvData_)(void* rcvPtr);
libkn_KInt (*ceGetCodeFromSubscriber_)(void* subPtr);
const char* (*ceGetDataFromSubscriber_)(void* subPtr);
const char* (*ceGetDataStrFromRcvData_)(void* rcvPtr);
const char* (*ceGetDoubleArrayFromParameters_)(void* paramPtr, const char* key);
const char* (*ceGetDoubleFromParameters_)(void* paramPtr, const char* key, const char* defaultValue);
const char* (*ceGetEventFromRcvData_)(void* rcvPtr);
const char* (*ceGetIntArrayFromParameters_)(void* paramPtr, const char* key);
libkn_KInt (*ceGetIntFromParameters_)(void* paramPtr, const char* key, libkn_KInt defaultValue);
const char* (*ceGetLongArrayFromParameters_)(void* paramPtr, const char* key);
libkn_KLong (*ceGetLongFromParameters_)(void* paramPtr, const char* key, libkn_KLong defaultValue);
libkn_KLong (*ceGetParametersFromRcvData_)(void* rcvPtr);
libkn_KInt (*ceHasKeyInParameters_)(void* paramPtr, const char* key);
libkn_KInt (*ceIsOrderedCommonEvent_)(void* subPtr);
libkn_KInt (*cePublish_)(const char* event);
libkn_KInt (*cePublishWithInfo_)(const char* event, void* infoPtr);
libkn_KInt (*ceSetBoolArrayToParameters_)(void* paramPtr, const char* key, const char* valuesJson);
libkn_KInt (*ceSetBoolToParameters_)(void* paramPtr, const char* key, libkn_KBoolean value);
libkn_KInt (*ceSetCharArrayToParameters_)(void* paramPtr, const char* key, const char* valuesJson);
libkn_KInt (*ceSetCharToParameters_)(void* paramPtr, const char* key, const char* value);
libkn_KInt (*ceSetCodeToSubscriber_)(void* subPtr, libkn_KInt code);
libkn_KInt (*ceSetDataToSubscriber_)(void* subPtr, const char* data);
libkn_KInt (*ceSetDoubleArrayToParameters_)(void* paramPtr, const char* key, const char* valuesJson);
libkn_KInt (*ceSetDoubleToParameters_)(void* paramPtr, const char* key, const char* value);
libkn_KInt (*ceSetIntArrayToParameters_)(void* paramPtr, const char* key, const char* valuesJson);
libkn_KInt (*ceSetIntToParameters_)(void* paramPtr, const char* key, libkn_KInt value);
libkn_KInt (*ceSetLongArrayToParameters_)(void* paramPtr, const char* key, const char* valuesJson);
libkn_KInt (*ceSetLongToParameters_)(void* paramPtr, const char* key, libkn_KLong value);
libkn_KInt (*ceSetPublishInfoBundleName_)(void* infoPtr, const char* bundleName);
libkn_KInt (*ceSetPublishInfoCode_)(void* infoPtr, libkn_KInt code);
libkn_KInt (*ceSetPublishInfoData_)(void* infoPtr, const char* data);
libkn_KInt (*ceSetPublishInfoParameters_)(void* infoPtr, void* paramPtr);
libkn_KInt (*ceSetPublishInfoPermissions_)(void* infoPtr, const char* permissionsJson);
libkn_KInt (*ceSetPublisherBundleName_)(void* infoPtr, const char* bundleName);
libkn_KInt (*ceSetPublisherPermission_)(void* infoPtr, const char* permission);
libkn_KInt (*ceSubscribe_)(void* subPtr);
libkn_KInt (*ceUnSubscribe_)(void* subPtr);
} OH_CommonEvent;
struct {
const char* (*prColorModeEnumValuesJson_)();
libkn_KInt (*prConnectPrinter_)(const char* printerId);
const char* (*prDiscoveryEventEnumValuesJson_)();
const char* (*prDocumentFormatEnumValuesJson_)();
const char* (*prDuplexModeEnumValuesJson_)();
const char* (*prErrEnumValuesJson_)();
libkn_KInt (*prInit_)();
const char* (*prJobDocAdapterStateEnumValuesJson_)();
libkn_KInt (*prLaunchPrinterManager_)();
const char* (*prOrientationModeEnumValuesJson_)();
const char* (*prPrinterEventEnumValuesJson_)();
const char* (*prPrinterStateEnumValuesJson_)();
const char* (*prQualityEnumValuesJson_)();
const char* (*prQueryPrinterInfoJson_)(const char* printerId);
const char* (*prQueryPrinterListJson_)();
const char* (*prQueryPrinterPropertiesJson_)(const char* printerId, const char* propertyKeysJson);
libkn_KInt (*prRegisterPrinterChangeListener_)();
libkn_KInt (*prRelease_)();
libkn_KInt (*prRestorePrinterProperties_)(const char* printerId, const char* propertyKeysJson);
libkn_KInt (*prStartPrintByNative_)(const char* printJobName);
libkn_KInt (*prStartPrintJob_)(const char* printJobName);
libkn_KInt (*prStartPrinterDiscovery_)();
libkn_KInt (*prStopPrinterDiscovery_)();
libkn_KInt (*prUnregisterPrinterChangeListener_)();
libkn_KInt (*prUpdatePrinterProperties_)(const char* printerId, const char* propertiesJson);
} OH_Print;
struct {
libkn_KInt (*scCancelScan_)(const char* scannerId);
libkn_KInt (*scCloseScanner_)(const char* scannerId);
const char* (*scErrEnumValuesJson_)();
libkn_KInt (*scExit_)();
const char* (*scGetPictureScanProgressJson_)(const char* scannerId);
const char* (*scGetScannerParameterJson_)(const char* scannerId);
libkn_KInt (*scInit_)();
libkn_KInt (*scOpenScanner_)(const char* scannerId);
libkn_KInt (*scSetScannerParameter_)(const char* scannerId, libkn_KInt option, const char* value);
libkn_KInt (*scStartScan_)(const char* scannerId, libkn_KBoolean batchMode);
libkn_KInt (*scStartScannerDiscovery_)();
} OH_Scan;
struct {
const char* (*oaErrEnumValuesJson_)();
libkn_KInt (*oaGetNameRet_)(libkn_KULong bufLen);
} OsAccount;
struct {
libkn_KInt (*pbClearData_)(void* pasteboardPtr);
libkn_KLong (*pbCreateObserver_)();
libkn_KLong (*pbCreatePasteboard_)();
libkn_KInt (*pbDestroyObserver_)(void* observerPtr);
libkn_KInt (*pbDestroyPasteboard_)(void* pasteboardPtr);
const char* (*pbErrEnumValuesJson_)();
const char* (*pbFileConflictEnumValuesJson_)();
libkn_KInt (*pbGetChangeCount_)(void* pasteboardPtr);
libkn_KLong (*pbGetDataParamsCreate_)();
libkn_KInt (*pbGetDataParamsDestroy_)(void* paramsPtr);
libkn_KInt (*pbGetDataParamsSetDestUri_)(void* paramsPtr, const char* uri);
libkn_KInt (*pbGetDataParamsSetFileConflictOptions_)(void* paramsPtr, libkn_KInt option);
libkn_KInt (*pbGetDataParamsSetProgressIndicator_)(void* paramsPtr, libkn_KInt indicator);
libkn_KInt (*pbGetDataParamsSetProgressListener_)(void* paramsPtr);
const char* (*pbGetDataSourceStr_)(void* pasteboardPtr, libkn_KInt bufLen);
const char* (*pbGetDataWithProgress_)(void* pasteboardPtr, void* paramsPtr);
const char* (*pbGetDataWithStatus_)(void* pasteboardPtr);
const char* (*pbGetMimeTypesJson_)(void* pasteboardPtr);
libkn_KInt (*pbHasData_)(void* pasteboardPtr);
libkn_KInt (*pbHasType_)(void* pasteboardPtr, const char* type);
libkn_KInt (*pbIsRemoteData_)(void* pasteboardPtr);
const char* (*pbNotifyEnumValuesJson_)();
libkn_KInt (*pbObserverSetData_)(void* observerPtr);
libkn_KInt (*pbProgressCancel_)(void* paramsPtr);
const char* (*pbProgressIndicatorEnumValuesJson_)();
libkn_KInt (*pbProgressInfoGetProgress_)(void* infoPtr);
libkn_KInt (*pbSetData_)(void* pasteboardPtr, void* dataPtr);
libkn_KInt (*pbSubscribe_)(void* pasteboardPtr, libkn_KInt type, void* observerPtr);
libkn_KInt (*pbSyncDelayedDataAsyncStart_)(void* pasteboardPtr);
libkn_KInt (*pbUnsubscribe_)(void* pasteboardPtr, libkn_KInt type, void* observerPtr);
} Pasteboard;
struct {
const char* (*tsErrEnumValuesJson_)();
const char* (*tsGetTimeZone_)();
} TimeService;
} BasicServicesKit;
struct {
struct {
const char* (*aipGetErrorEnumValuesJson_)();
} AIP;
} DataAugmentationKit;
struct {
libkn_KLong (*avcencInfoCreate_)();
libkn_KInt (*avcencInfoDestroy_)(void* info);
libkn_KInt (*avcencInfoSetAVBuffer_)(void* info, void* buffer);
libkn_KInt (*avcencInfoSetAlgorithm_)(void* info, libkn_KInt algo);
libkn_KInt (*avcencInfoSetKeyIdAndIvTest_)(void* info);
libkn_KInt (*avcencInfoSetMode_)(void* info, libkn_KInt mode);
libkn_KInt (*avcencInfoSetSubsampleInfoTest_)(void* info);
const char* (*drmCencGetAlgorithmEnumValuesJson_)();
const char* (*drmCencGetInfoModeEnumValuesJson_)();
} Multimedia_Drm;
struct {
struct {
libkn_KInt (*runAbilityCheckSelfPermission_)(const char* permission);
} AbilityAccessControl;
struct {
const char* (*getHiAppEventEnumValuesJson_)();
libkn_KInt (*hiAppEventAddBoolArrayParam_)(const char* name, const char* valuesCsv);
libkn_KInt (*hiAppEventAddBoolParam_)(const char* name, libkn_KBoolean value);
libkn_KInt (*hiAppEventAddDoubleArrayParam_)(const char* name, const char* valuesCsv);
libkn_KInt (*hiAppEventAddDoubleParam_)(const char* name, libkn_KDouble value);
libkn_KInt (*hiAppEventAddFloatArrayParam_)(const char* name, const char* valuesCsv);
libkn_KInt (*hiAppEventAddFloatParam_)(const char* name, libkn_KFloat value);
libkn_KInt (*hiAppEventAddInt16ArrayParam_)(const char* name, const char* valuesCsv);
libkn_KInt (*hiAppEventAddInt16Param_)(const char* name, libkn_KInt value);
libkn_KInt (*hiAppEventAddInt32ArrayParam_)(const char* name, const char* valuesCsv);
libkn_KInt (*hiAppEventAddInt32Param_)(const char* name, libkn_KInt value);
libkn_KInt (*hiAppEventAddInt64ArrayParam_)(const char* name, const char* valuesCsv);
libkn_KInt (*hiAppEventAddInt64Param_)(const char* name, libkn_KLong value);
libkn_KInt (*hiAppEventAddInt8ArrayParam_)(const char* name, const char* valuesCsv);
libkn_KInt (*hiAppEventAddInt8Param_)(const char* name, libkn_KInt value);
libkn_KLong (*hiAppEventAddProcessor_)();
libkn_KInt (*hiAppEventAddStringArrayParam_)(const char* name, const char* valuesCsv);
libkn_KInt (*hiAppEventAddStringParam_)(const char* name, const char* value);
libkn_KInt (*hiAppEventAddWatcher_)();
libkn_KInt (*hiAppEventClearData_)();
libkn_KInt (*hiAppEventConfigure_)(const char* cfgName, const char* cfgValue);
libkn_KLong (*hiAppEventCreateConfig_)();
libkn_KLong (*hiAppEventCreateParamList_)();
libkn_KLong (*hiAppEventCreateProcessor_)(const char* name);
libkn_KLong (*hiAppEventCreateWatcher_)(const char* name);
libkn_KInt (*hiAppEventDestroyConfig_)();
libkn_KInt (*hiAppEventDestroyParamList_)();
libkn_KInt (*hiAppEventDestroyProcessor_)();
libkn_KInt (*hiAppEventDestroyWatcher_)();
libkn_KInt (*hiAppEventRemoveProcessor_)();
libkn_KInt (*hiAppEventRemoveWatcher_)();
libkn_KInt (*hiAppEventSetAppEventFilter_)(const char* domain, libkn_KUByte eventTypesMask, const char* namesCsv);
libkn_KInt (*hiAppEventSetConfigId_)(libkn_KInt configId);
libkn_KInt (*hiAppEventSetConfigItem_)(const char* itemName, const char* itemValue);
libkn_KInt (*hiAppEventSetConfigName_)(const char* configName);
libkn_KInt (*hiAppEventSetCustomConfig_)(const char* key, const char* value);
libkn_KInt (*hiAppEventSetEventConfig_)(const char* eventName);
libkn_KInt (*hiAppEventSetReportEvent_)(const char* domain, const char* name, libkn_KBoolean isRealTime);
libkn_KInt (*hiAppEventSetReportPolicy_)(libkn_KInt periodReport, libkn_KInt batchReport, libkn_KBoolean onStartReport, libkn_KBoolean onBackgroundReport);
libkn_KInt (*hiAppEventSetReportRoute_)(const char* appId, const char* routeInfo);
libkn_KInt (*hiAppEventSetReportUserId_)(const char* userIdsCsv);
libkn_KInt (*hiAppEventSetReportUserProperty_)(const char* propsCsv);
libkn_KInt (*hiAppEventSetTriggerCondition_)(libkn_KInt row, libkn_KInt size, libkn_KInt timeout);
libkn_KInt (*hiAppEventSetWatcherOnReceive_)();
libkn_KInt (*hiAppEventSetWatcherOnTrigger_)();
libkn_KInt (*hiAppEventTakeWatcherData_)(libkn_KUInt num);
libkn_KInt (*hiAppEventWrite_)(const char* domain, const char* name, libkn_KInt type);
} HiAppEvent;
struct {
const char* (*getHiCollieEnumValuesJson_)();
libkn_KInt (*hicollieCancelTimer_)(libkn_KInt id);
libkn_KInt (*hicollieInitJankDetection_)();
libkn_KInt (*hicollieInitStuckDetection_)();
libkn_KInt (*hicollieInitStuckDetectionWithTimeout_)(libkn_KUInt stuckTimeout);
libkn_KInt (*hicollieReport_)(libkn_KBoolean isSixSecond);
const char* (*hicollieSetTimer_)(const char* name, libkn_KUInt timeout, libkn_KUInt flag);
} HiCollie;
struct {
const char* (*getHiDebugEnumValuesJson_)();
const char* (*hiDebugBacktraceFromFp_)(libkn_KLong fpAddr);
libkn_KLong (*hiDebugCreateBacktraceObjectAddr_)();
libkn_KInt (*hiDebugDestroyBacktraceObject_)(libkn_KLong objAddr);
libkn_KInt (*hiDebugFreeLastThreadCpuUsage_)();
libkn_KDouble (*hiDebugGetAppCpuUsage_)();
const char* (*hiDebugGetAppMemoryLimitJson_)();
const char* (*hiDebugGetAppNativeMemInfoJson_)();
const char* (*hiDebugGetAppNativeMemInfoWithCacheJson_)(libkn_KBoolean forceRefresh);
const char* (*hiDebugGetAppThreadCpuUsageJson_)();
libkn_KLong (*hiDebugGetDefaultMallocDispatchTableAddr_)();
const char* (*hiDebugGetGraphicsMemory_)();
const char* (*hiDebugGetGraphicsMemorySummary_)(libkn_KUInt interval);
libkn_KDouble (*hiDebugGetSystemCpuUsage_)();
const char* (*hiDebugGetSystemMemInfoJson_)();
libkn_KInt (*hiDebugRequestThreadLiteSampling_)(libkn_KUInt duration, libkn_KUInt frequency);
libkn_KInt (*hiDebugRestoreMallocDispatchTable_)();
libkn_KInt (*hiDebugSetMallocDispatchTable_)();
const char* (*hiDebugStartAppTraceCapture_)(libkn_KUInt flag, libkn_KULong tags, libkn_KUInt limitSize);
libkn_KInt (*hiDebugStopAppTraceCapture_)();
const char* (*hiDebugSymbolicAddress_)(libkn_KULong addr);
} HiDebug;
struct {
const char* (*getHiLogEnumValuesJson_)();
libkn_KInt (*hiLogIsLoggable_)(libkn_KUInt domain, const char* tag, libkn_KUInt level);
libkn_KInt (*hiLogPrint_)(libkn_KUInt type, libkn_KUInt level, libkn_KUInt domain, const char* tag, const char* fmt);
libkn_KInt (*hiLogPrintMsg_)(libkn_KUInt type, libkn_KUInt level, libkn_KUInt domain, const char* tag, const char* message);
libkn_KInt (*hiLogPrintMsgByLen_)(libkn_KUInt type, libkn_KUInt level, libkn_KUInt domain, const char* tag, libkn_KULong tagLen, const char* message, libkn_KULong messageLen);
libkn_KInt (*hiLogSetCallback_)();
libkn_KInt (*hiLogSetMinLogLevel_)(libkn_KUInt level);
libkn_KInt (*hiLogVPrint_)(libkn_KUInt type, libkn_KUInt level, libkn_KUInt domain, const char* tag, const char* fmt);
} HiLog;
struct {
const char* (*getHiTraceEnumValuesJson_)();
libkn_KLong (*hiTraceAllocIdPtr_)();
libkn_KInt (*hiTraceClearId_)();
libkn_KInt (*hiTraceCountTrace_)(const char* name, libkn_KLong count);
libkn_KInt (*hiTraceCountTraceEx_)(libkn_KUInt level, const char* name, libkn_KLong count);
libkn_KInt (*hiTraceEnableFlag_)(void* idPtr, libkn_KUInt flag);
libkn_KInt (*hiTraceEndChain_)();
libkn_KInt (*hiTraceFinishAsyncTrace_)(const char* name, libkn_KInt taskId);
libkn_KInt (*hiTraceFinishAsyncTraceEx_)(libkn_KUInt level, const char* name, libkn_KInt taskId);
libkn_KInt (*hiTraceFinishTrace_)();
libkn_KInt (*hiTraceFinishTraceEx_)(libkn_KUInt level);
libkn_KInt (*hiTraceFreeIdPtr_)(void* idPtr);
libkn_KLong (*hiTraceGetChainId_)(void* idPtr);
libkn_KInt (*hiTraceGetFlags_)(void* idPtr);
libkn_KLong (*hiTraceGetParentSpanId_)(void* idPtr);
libkn_KLong (*hiTraceGetSpanId_)(void* idPtr);
libkn_KInt (*hiTraceIdFromBytes_)(void* idPtr, void* bytesPtr, libkn_KInt len);
libkn_KInt (*hiTraceIdFromHex_)(void* idPtr, const char* hex);
const char* (*hiTraceIdToBytes_)(void* idPtr, libkn_KInt len);
libkn_KInt (*hiTraceInitId_)(void* idPtr);
libkn_KInt (*hiTraceIsFlagEnabled_)(void* idPtr, libkn_KUInt flag);
libkn_KInt (*hiTraceIsIdValid_)(void* idPtr);
libkn_KInt (*hiTraceIsTraceEnabled_)();
libkn_KInt (*hiTraceRegisterTraceListener_)();
libkn_KInt (*hiTraceSetChainId_)(void* idPtr, libkn_KULong chainId);
libkn_KInt (*hiTraceSetFlags_)(void* idPtr, libkn_KInt flags);
libkn_KInt (*hiTraceSetId_)(void* idPtr);
libkn_KInt (*hiTraceSetParentSpanId_)(void* idPtr, libkn_KULong parentSpanId);
libkn_KInt (*hiTraceSetSpanId_)(void* idPtr, libkn_KULong spanId);
libkn_KInt (*hiTraceStartAsyncTrace_)(const char* name, libkn_KInt taskId);
libkn_KInt (*hiTraceStartAsyncTraceEx_)(libkn_KUInt level, const char* name, libkn_KInt taskId, const char* customCategory, const char* customArgs);
libkn_KInt (*hiTraceStartTrace_)(const char* name);
libkn_KInt (*hiTraceStartTraceEx_)(libkn_KUInt level, const char* name, const char* customArgs);
libkn_KInt (*hiTraceTracepoint_)(libkn_KUInt mode, libkn_KUInt type, void* idPtr, const char* fmt);
libkn_KInt (*hiTraceUnregisterTraceListener_)(libkn_KInt index);
} Hitrace;
} PerformanceAnalysisKit;
struct {
struct {
libkn_KType* (*_type)(void);
libkn_kref_com_example_test_common_ApiGuard (*_instance)();
libkn_KInt (*get_CODE_API_VERSION_TOO_HIGH)(libkn_kref_com_example_test_common_ApiGuard thiz);
const char* (*get_STR_API_VERSION_TOO_HIGH)(libkn_kref_com_example_test_common_ApiGuard thiz);
libkn_KBoolean (*guardBoolean)(libkn_kref_com_example_test_common_ApiGuard thiz, libkn_kref_kotlin_Function0 block);
libkn_KDouble (*guardDouble)(libkn_kref_com_example_test_common_ApiGuard thiz, libkn_kref_kotlin_Function0 block);
libkn_KInt (*guardInt)(libkn_kref_com_example_test_common_ApiGuard thiz, libkn_kref_kotlin_Function0 block);
libkn_KLong (*guardLong)(libkn_kref_com_example_test_common_ApiGuard thiz, libkn_kref_kotlin_Function0 block);
const char* (*guardString)(libkn_kref_com_example_test_common_ApiGuard thiz, libkn_kref_kotlin_Function0 block);
} ApiGuard;
} common;
} test;
} example;
} com;
} root;
} kotlin;
} libkn_ExportedSymbols;
extern libkn_ExportedSymbols* libkn_symbols(void);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* KONAN_LIBKN_H */
#include "napi/native_api.h"
#include "libkn_api.h"
#include <string.h>
extern "C" const char* avcGetName(const char* mime, libkn_KUInt isEncoder);
extern "C" libkn_KInt avcGetMaxSupportedInstances(const char* mime, libkn_KUInt isEncoder);
extern "C" libkn_KInt avcIsHardware(const char* mime, libkn_KUInt isEncoder);
extern "C" const char* avcGetEncoderBitrateRange(const char* mime);
extern "C" const char* avcGetVideoWidthRange(const char* mime, libkn_KUInt isEncoder);
extern "C" const char* avcGetVideoHeightRange(const char* mime, libkn_KUInt isEncoder);
extern "C" libkn_KInt avcIsVideoSizeSupported(const char* mime, libkn_KUInt isEncoder, libkn_KInt width, libkn_KInt height);
extern "C" const char* avcGetVideoFrameRateRange(const char* mime, libkn_KUInt isEncoder);
extern "C" const char* getAVCapabilityEnumValuesJson();
extern "C" const char* avcGetNameByCategory(const char* mime, libkn_KUInt isEncoder, libkn_KUInt category);
extern "C" libkn_KInt avcGetVideoWidthAlignment(const char* mime, libkn_KUInt isEncoder);
extern "C" libkn_KInt avcGetVideoHeightAlignment(const char* mime, libkn_KUInt isEncoder);
extern "C" const char* avcGetVideoWidthRangeForHeight(const char* mime, libkn_KUInt isEncoder, libkn_KInt height);
extern "C" const char* avcGetVideoHeightRangeForWidth(const char* mime, libkn_KUInt isEncoder, libkn_KInt width);
extern "C" const char* avcGetVideoFrameRateRangeForSize(const char* mime, libkn_KUInt isEncoder, libkn_KInt width, libkn_KInt height);
extern "C" libkn_KInt avcAreVideoSizeAndFrameRateSupported(const char* mime, libkn_KUInt isEncoder, libkn_KInt width, libkn_KInt height, libkn_KInt frameRate);
extern "C" libkn_KInt avcIsFeatureSupported(const char* mime, libkn_KUInt isEncoder, libkn_KUInt feature);
extern "C" const char* avcGetFeaturePropertiesDump(const char* mime, libkn_KUInt isEncoder, libkn_KUInt feature);
extern "C" const char* avcGetAudioSupportedSampleRates(const char* mime, libkn_KUInt isEncoder);
extern "C" const char* avcGetAudioSupportedSampleRateRanges(const char* mime, libkn_KUInt isEncoder);
extern "C" const char* avcGetAudioChannelCountRange(const char* mime, libkn_KUInt isEncoder);
extern "C" const char* avcGetVideoSupportedPixelFormats(const char* mime, libkn_KUInt isEncoder);
extern "C" const char* avcGetSupportedProfiles(const char* mime, libkn_KUInt isEncoder);
extern "C" const char* avcGetSupportedLevelsForProfile(const char* mime, libkn_KUInt isEncoder, libkn_KInt profile);
extern "C" libkn_KInt avcAreProfileAndLevelSupported(const char* mime, libkn_KUInt isEncoder, libkn_KInt profile, libkn_KInt level);
extern "C" libkn_KInt avcIsEncoderBitrateModeSupported(const char* mime, libkn_KUInt bitrateMode);
extern "C" const char* avcGetEncoderQualityRange(const char* mime);
extern "C" const char* avcGetEncoderComplexityRange(const char* mime);
static napi_value AvcGetName(napi_env env, napi_callback_info info) {
size_t argc = 2; napi_value argv[2];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
const char* s = avcGetName(mime_buffer, (libkn_KUInt)isEnc);
if (s == nullptr) { s = "error"; }
napi_value result; napi_create_string_utf8(env, s, NAPI_AUTO_LENGTH, &result);
if (s && strcmp(s, "error") != 0) { libkn_symbols()->DisposeString(s); }
return result;
}
static napi_value AvcGetMaxSupportedInstances(napi_env env, napi_callback_info info) {
size_t argc = 2; napi_value argv[2];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
int code = avcGetMaxSupportedInstances(mime_buffer, (libkn_KUInt)isEnc);
napi_value result; napi_create_int32(env, code, &result);
return result;
}
extern "C" void RegisterAVCodecKit(napi_env env, napi_value exports) {
napi_value f1; napi_create_function(env, "avcGetName", NAPI_AUTO_LENGTH, AvcGetName, nullptr, &f1);
napi_set_named_property(env, exports, "avcGetName", f1);
napi_value f2; napi_create_function(env, "avcGetMaxSupportedInstances", NAPI_AUTO_LENGTH, AvcGetMaxSupportedInstances, nullptr, &f2);
napi_set_named_property(env, exports, "avcGetMaxSupportedInstances", f2);
napi_value f3; napi_create_function(env, "avcIsHardware", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 2; napi_value argv[2];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
int code = avcIsHardware(mime_buffer, (libkn_KUInt)isEnc);
napi_value result; napi_create_int32(env, code, &result);
return result;
}, nullptr, &f3);
napi_set_named_property(env, exports, "avcIsHardware", f3);
napi_value f4; napi_create_function(env, "avcGetEncoderBitrateRange", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 1; napi_value argv[1];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
const char* s = avcGetEncoderBitrateRange(mime_buffer);
if (s == nullptr) { s = "error"; }
napi_value result; napi_create_string_utf8(env, s, NAPI_AUTO_LENGTH, &result);
if (s && strcmp(s, "error") != 0) { libkn_symbols()->DisposeString(s); }
return result;
}, nullptr, &f4);
napi_set_named_property(env, exports, "avcGetEncoderBitrateRange", f4);
napi_value f5; napi_create_function(env, "avcGetVideoWidthRange", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 2; napi_value argv[2];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
const char* s = avcGetVideoWidthRange(mime_buffer, (libkn_KUInt)isEnc);
if (s == nullptr) { s = "error"; }
napi_value result; napi_create_string_utf8(env, s, NAPI_AUTO_LENGTH, &result);
if (s && strcmp(s, "error") != 0) { libkn_symbols()->DisposeString(s); }
return result;
}, nullptr, &f5);
napi_set_named_property(env, exports, "avcGetVideoWidthRange", f5);
napi_value f6; napi_create_function(env, "avcGetVideoHeightRange", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 2; napi_value argv[2];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
const char* s = avcGetVideoHeightRange(mime_buffer, (libkn_KUInt)isEnc);
if (s == nullptr) { s = "error"; }
napi_value result; napi_create_string_utf8(env, s, NAPI_AUTO_LENGTH, &result);
if (s && strcmp(s, "error") != 0) { libkn_symbols()->DisposeString(s); }
return result;
}, nullptr, &f6);
napi_set_named_property(env, exports, "avcGetVideoHeightRange", f6);
napi_value f7; napi_create_function(env, "avcIsVideoSizeSupported", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 4; napi_value argv[4];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
int32_t w = 0; napi_get_value_int32(env, argv[2], &w);
int32_t h = 0; napi_get_value_int32(env, argv[3], &h);
int code = avcIsVideoSizeSupported(mime_buffer, (libkn_KUInt)isEnc, w, h);
napi_value result; napi_create_int32(env, code, &result);
return result;
}, nullptr, &f7);
napi_set_named_property(env, exports, "avcIsVideoSizeSupported", f7);
napi_value f7b; napi_create_function(env, "avcGetVideoFrameRateRange", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 2; napi_value argv[2];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
const char* s = avcGetVideoFrameRateRange(mime_buffer, (libkn_KUInt)isEnc);
if (s == nullptr) { s = "error"; }
napi_value result; napi_create_string_utf8(env, s, NAPI_AUTO_LENGTH, &result);
if (s && strcmp(s, "error") != 0) { libkn_symbols()->DisposeString(s); }
return result;
}, nullptr, &f7b);
napi_set_named_property(env, exports, "avcGetVideoFrameRateRange", f7b);
napi_value f9; napi_create_function(env, "avcGetNameByCategory", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 3; napi_value argv[3];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
int32_t cat = 0; napi_get_value_int32(env, argv[2], &cat);
const char* s = avcGetNameByCategory(mime_buffer, (libkn_KUInt)isEnc, (libkn_KUInt)cat);
if (s == nullptr) { s = "error"; }
napi_value result; napi_create_string_utf8(env, s, NAPI_AUTO_LENGTH, &result);
if (s && strcmp(s, "error") != 0) { libkn_symbols()->DisposeString(s); }
return result;
}, nullptr, &f9);
napi_set_named_property(env, exports, "avcGetNameByCategory", f9);
napi_value f10; napi_create_function(env, "avcGetVideoWidthAlignment", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 2; napi_value argv[2];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
int code = avcGetVideoWidthAlignment(mime_buffer, (libkn_KUInt)isEnc);
napi_value result; napi_create_int32(env, code, &result);
return result;
}, nullptr, &f10);
napi_set_named_property(env, exports, "avcGetVideoWidthAlignment", f10);
napi_value f11; napi_create_function(env, "avcGetVideoHeightAlignment", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 2; napi_value argv[2];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
int code = avcGetVideoHeightAlignment(mime_buffer, (libkn_KUInt)isEnc);
napi_value result; napi_create_int32(env, code, &result);
return result;
}, nullptr, &f11);
napi_set_named_property(env, exports, "avcGetVideoHeightAlignment", f11);
napi_value f12; napi_create_function(env, "avcGetVideoWidthRangeForHeight", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 3; napi_value argv[3];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
int32_t h = 0; napi_get_value_int32(env, argv[2], &h);
const char* s = avcGetVideoWidthRangeForHeight(mime_buffer, (libkn_KUInt)isEnc, h);
if (s == nullptr) { s = "error"; }
napi_value result; napi_create_string_utf8(env, s, NAPI_AUTO_LENGTH, &result);
if (s && strcmp(s, "error") != 0) { libkn_symbols()->DisposeString(s); }
return result;
}, nullptr, &f12);
napi_set_named_property(env, exports, "avcGetVideoWidthRangeForHeight", f12);
napi_value f13; napi_create_function(env, "avcGetVideoHeightRangeForWidth", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 3; napi_value argv[3];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
int32_t w = 0; napi_get_value_int32(env, argv[2], &w);
const char* s = avcGetVideoHeightRangeForWidth(mime_buffer, (libkn_KUInt)isEnc, w);
if (s == nullptr) { s = "error"; }
napi_value result; napi_create_string_utf8(env, s, NAPI_AUTO_LENGTH, &result);
if (s && strcmp(s, "error") != 0) { libkn_symbols()->DisposeString(s); }
return result;
}, nullptr, &f13);
napi_set_named_property(env, exports, "avcGetVideoHeightRangeForWidth", f13);
napi_value f14; napi_create_function(env, "avcGetVideoFrameRateRangeForSize", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 4; napi_value argv[4];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
int32_t w = 0; napi_get_value_int32(env, argv[2], &w);
int32_t h = 0; napi_get_value_int32(env, argv[3], &h);
const char* s = avcGetVideoFrameRateRangeForSize(mime_buffer, (libkn_KUInt)isEnc, w, h);
if (s == nullptr) { s = "error"; }
napi_value result; napi_create_string_utf8(env, s, NAPI_AUTO_LENGTH, &result);
if (s && strcmp(s, "error") != 0) { libkn_symbols()->DisposeString(s); }
return result;
}, nullptr, &f14);
napi_set_named_property(env, exports, "avcGetVideoFrameRateRangeForSize", f14);
napi_value f15; napi_create_function(env, "avcAreVideoSizeAndFrameRateSupported", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 5; napi_value argv[5];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
int32_t w = 0; napi_get_value_int32(env, argv[2], &w);
int32_t h = 0; napi_get_value_int32(env, argv[3], &h);
int32_t fr = 0; napi_get_value_int32(env, argv[4], &fr);
int code = avcAreVideoSizeAndFrameRateSupported(mime_buffer, (libkn_KUInt)isEnc, w, h, fr);
napi_value result; napi_create_int32(env, code, &result);
return result;
}, nullptr, &f15);
napi_set_named_property(env, exports, "avcAreVideoSizeAndFrameRateSupported", f15);
napi_value f16; napi_create_function(env, "avcIsFeatureSupported", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 3; napi_value argv[3];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
int32_t feat = 0; napi_get_value_int32(env, argv[2], &feat);
int code = avcIsFeatureSupported(mime_buffer, (libkn_KUInt)isEnc, (libkn_KUInt)feat);
napi_value result; napi_create_int32(env, code, &result);
return result;
}, nullptr, &f16);
napi_set_named_property(env, exports, "avcIsFeatureSupported", f16);
napi_value f17; napi_create_function(env, "avcGetFeaturePropertiesDump", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 3; napi_value argv[3];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
int32_t feat = 0; napi_get_value_int32(env, argv[2], &feat);
const char* s = avcGetFeaturePropertiesDump(mime_buffer, (libkn_KUInt)isEnc, (libkn_KUInt)feat);
if (s == nullptr) { s = "error"; }
napi_value result; napi_create_string_utf8(env, s, NAPI_AUTO_LENGTH, &result);
if (s && strcmp(s, "error") != 0) { libkn_symbols()->DisposeString(s); }
return result;
}, nullptr, &f17);
napi_set_named_property(env, exports, "avcGetFeaturePropertiesDump", f17);
napi_value f8; napi_create_function(env, "getAVCapabilityEnumValuesJson", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 0; napi_value argv[1];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
const char* s = getAVCapabilityEnumValuesJson();
if (s == nullptr) { s = "error"; }
napi_value result; napi_create_string_utf8(env, s, NAPI_AUTO_LENGTH, &result);
if (s && strcmp(s, "error") != 0) { libkn_symbols()->DisposeString(s); }
return result;
}, nullptr, &f8);
napi_set_named_property(env, exports, "getAVCapabilityEnumValuesJson", f8);
napi_value f18; napi_create_function(env, "avcGetAudioSupportedSampleRates", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 2; napi_value argv[2];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
const char* s = avcGetAudioSupportedSampleRates(mime_buffer, (libkn_KUInt)isEnc);
if (s == nullptr) { s = "error"; }
napi_value result; napi_create_string_utf8(env, s, NAPI_AUTO_LENGTH, &result);
if (s && strcmp(s, "error") != 0) { libkn_symbols()->DisposeString(s); }
return result;
}, nullptr, &f18);
napi_set_named_property(env, exports, "avcGetAudioSupportedSampleRates", f18);
napi_value f19; napi_create_function(env, "avcGetAudioSupportedSampleRateRanges", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 2; napi_value argv[2];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
const char* s = avcGetAudioSupportedSampleRateRanges(mime_buffer, (libkn_KUInt)isEnc);
if (s == nullptr) { s = "error"; }
napi_value result; napi_create_string_utf8(env, s, NAPI_AUTO_LENGTH, &result);
if (s && strcmp(s, "error") != 0) { libkn_symbols()->DisposeString(s); }
return result;
}, nullptr, &f19);
napi_set_named_property(env, exports, "avcGetAudioSupportedSampleRateRanges", f19);
napi_value f20; napi_create_function(env, "avcGetAudioChannelCountRange", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 2; napi_value argv[2];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
const char* s = avcGetAudioChannelCountRange(mime_buffer, (libkn_KUInt)isEnc);
if (s == nullptr) { s = "error"; }
napi_value result; napi_create_string_utf8(env, s, NAPI_AUTO_LENGTH, &result);
if (s && strcmp(s, "error") != 0) { libkn_symbols()->DisposeString(s); }
return result;
}, nullptr, &f20);
napi_set_named_property(env, exports, "avcGetAudioChannelCountRange", f20);
napi_value f21; napi_create_function(env, "avcGetVideoSupportedPixelFormats", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 2; napi_value argv[2];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
const char* s = avcGetVideoSupportedPixelFormats(mime_buffer, (libkn_KUInt)isEnc);
if (s == nullptr) { s = "error"; }
napi_value result; napi_create_string_utf8(env, s, NAPI_AUTO_LENGTH, &result);
if (s && strcmp(s, "error") != 0) { libkn_symbols()->DisposeString(s); }
return result;
}, nullptr, &f21);
napi_set_named_property(env, exports, "avcGetVideoSupportedPixelFormats", f21);
napi_value f22; napi_create_function(env, "avcGetSupportedProfiles", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 2; napi_value argv[2];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
const char* s = avcGetSupportedProfiles(mime_buffer, (libkn_KUInt)isEnc);
if (s == nullptr) { s = "error"; }
napi_value result; napi_create_string_utf8(env, s, NAPI_AUTO_LENGTH, &result);
if (s && strcmp(s, "error") != 0) { libkn_symbols()->DisposeString(s); }
return result;
}, nullptr, &f22);
napi_set_named_property(env, exports, "avcGetSupportedProfiles", f22);
napi_value f23; napi_create_function(env, "avcGetSupportedLevelsForProfile", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 3; napi_value argv[3];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
int32_t profile = 0; napi_get_value_int32(env, argv[2], &profile);
const char* s = avcGetSupportedLevelsForProfile(mime_buffer, (libkn_KUInt)isEnc, profile);
if (s == nullptr) { s = "error"; }
napi_value result; napi_create_string_utf8(env, s, NAPI_AUTO_LENGTH, &result);
if (s && strcmp(s, "error") != 0) { libkn_symbols()->DisposeString(s); }
return result;
}, nullptr, &f23);
napi_set_named_property(env, exports, "avcGetSupportedLevelsForProfile", f23);
napi_value f24; napi_create_function(env, "avcAreProfileAndLevelSupported", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 4; napi_value argv[4];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
uint32_t isEnc = 0; napi_get_value_uint32(env, argv[1], &isEnc);
int32_t profile = 0; napi_get_value_int32(env, argv[2], &profile);
int32_t level = 0; napi_get_value_int32(env, argv[3], &level);
int code = avcAreProfileAndLevelSupported(mime_buffer, (libkn_KUInt)isEnc, profile, level);
napi_value result; napi_create_int32(env, code, &result);
return result;
}, nullptr, &f24);
napi_set_named_property(env, exports, "avcAreProfileAndLevelSupported", f24);
napi_value f25; napi_create_function(env, "avcIsEncoderBitrateModeSupported", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 2; napi_value argv[2];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
int32_t mode = 0; napi_get_value_int32(env, argv[1], &mode);
int code = avcIsEncoderBitrateModeSupported(mime_buffer, (libkn_KUInt)mode);
napi_value result; napi_create_int32(env, code, &result);
return result;
}, nullptr, &f25);
napi_set_named_property(env, exports, "avcIsEncoderBitrateModeSupported", f25);
napi_value f26; napi_create_function(env, "avcGetEncoderQualityRange", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 1; napi_value argv[1];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
const char* s = avcGetEncoderQualityRange(mime_buffer);
if (s == nullptr) { s = "error"; }
napi_value result; napi_create_string_utf8(env, s, NAPI_AUTO_LENGTH, &result);
if (s && strcmp(s, "error") != 0) { libkn_symbols()->DisposeString(s); }
return result;
}, nullptr, &f26);
napi_set_named_property(env, exports, "avcGetEncoderQualityRange", f26);
napi_value f27; napi_create_function(env, "avcGetEncoderComplexityRange", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info){
size_t argc = 1; napi_value argv[1];
napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
char mime_buffer[256]; size_t mime_len = 0; napi_get_value_string_utf8(env, argv[0], mime_buffer, 256, &mime_len);
const char* s = avcGetEncoderComplexityRange(mime_buffer);
if (s == nullptr) { s = "error"; }
napi_value result; napi_create_string_utf8(env, s, NAPI_AUTO_LENGTH, &result);
if (s && strcmp(s, "error") != 0) { libkn_symbols()->DisposeString(s); }
return result;
}, nullptr, &f27);
napi_set_named_property(env, exports, "avcGetEncoderComplexityRange", f27);
}
extern "C" void AddKitRegistrar(void (*fn)(napi_env, napi_value));
static void __avcodeckit_auto_register() __attribute__((constructor));
static void __avcodeckit_auto_register()
{
AddKitRegistrar(RegisterAVCodecKit);
}
import { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit';
import { hilog } from '@kit.PerformanceAnalysisKit';
import { window } from '@kit.ArkUI';
const DOMAIN = 0x0000;
export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
// Check for testMode parameter
if (want.parameters && (want.parameters['testMode'] === true || want.parameters['testMode'] === 'true')) {
AppStorage.setOrCreate('testMode', true);
hilog.info(DOMAIN, 'testTag', 'Test Mode Enabled via Launch Param');
}
try {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
} catch (err) {
hilog.error(DOMAIN, 'testTag', 'Failed to set colorMode. Cause: %{public}s', JSON.stringify(err));
}
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate');
}
onDestroy(): void {
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onDestroy');
}
onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err) => {
if (err.code) {
hilog.error(DOMAIN, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err));
return;
}
hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.');
});
}
onWindowStageDestroy(): void {
// Main window is destroyed, release UI related resources
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
}
onForeground(): void {
// Ability has brought to foreground
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground');
}
onBackground(): void {
// Ability has back to background
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onBackground');
}
}
\ No newline at end of file
import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
import { hilog } from '@kit.PerformanceAnalysisKit';
import { window } from '@kit.ArkUI';
const DOMAIN = 0x0000;
export default class ResourceAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
hilog.info(DOMAIN, 'ResourceAbility', '%{public}s', 'onCreate');
}
onDestroy(): void {
hilog.info(DOMAIN, 'ResourceAbility', '%{public}s', 'onDestroy');
}
onWindowStageCreate(windowStage: window.WindowStage): void {
hilog.info(DOMAIN, 'ResourceAbility', '%{public}s', 'onWindowStageCreate');
windowStage.loadContent('pages/Index', (err) => {
if (err.code) {
hilog.error(DOMAIN, 'ResourceAbility', 'Failed to load content: %{public}s', JSON.stringify(err));
return;
}
hilog.info(DOMAIN, 'ResourceAbility', 'Succeeded in loading the content.');
});
}
onWindowStageDestroy(): void {
hilog.info(DOMAIN, 'ResourceAbility', '%{public}s', 'onWindowStageDestroy');
}
onForeground(): void {
hilog.info(DOMAIN, 'ResourceAbility', '%{public}s', 'onForeground');
}
onBackground(): void {
hilog.info(DOMAIN, 'ResourceAbility', '%{public}s', 'onBackground');
}
}
import { hilog } from '@kit.PerformanceAnalysisKit';
import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
const DOMAIN = 0x0000;
export default class EntryBackupAbility extends BackupExtensionAbility {
async onBackup() {
hilog.info(DOMAIN, 'testTag', 'onBackup ok');
await Promise.resolve();
}
async onRestore(bundleVersion: BundleVersion) {
hilog.info(DOMAIN, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
await Promise.resolve();
}
}
\ No newline at end of file
import { getComponent } from './component/registry';
import './component/index';
import ComponentHost from './component/ComponentHost';
import router from '@ohos.router';
import promptAction from '@ohos.promptAction';
interface ComponentParams { component?: string }
@Entry
@Component
struct ComponentDetail {
@State componentName: string = '';
@State nameResult: string = '';
@State maxResult: string = '';
@State printMsgResult: string = '';
@State printMsgLenResult: string = '';
aboutToAppear() {
try {
const params: ComponentParams = router.getParams() as ComponentParams;
this.componentName = params && params.component ? params.component : '';
} catch (e) {
this.componentName = '';
}
}
build() {
Column() {
Row() {
Text('C Api调用')
.fontSize(24)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.padding({ left: 16, right: 16, top: 8, bottom: 8 })
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
Row() {
Text('<')
.fontSize(20)
.fontColor(Color.Blue)
.width(20)
.height(40)
.onClick(() => {
router.back();
})
Text(this.componentName.length > 0 ? this.componentName : '未知 component')
.fontSize(18)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.padding({ left: 8, right: 8, bottom: 16, top: 16 })
.alignItems(VerticalAlign.Center)
Column() {
if (getComponent(this.componentName)) {
ComponentHost({ child: getComponent(this.componentName)! })
} else {
Text('未知组件或未实现').fontSize(16).fontColor(Color.Red).padding(12)
}
}
.layoutWeight(1)
.width('100%')
.backgroundColor('#FFFFFF')
}
.height('100%')
.width('100%')
.alignItems(HorizontalAlign.Center)
.justifyContent(FlexAlign.Start)
}
}
import common from '@ohos.app.ability.common';
import router from '@ohos.router';
import util from '@ohos.util';
interface CapiItem {
kit: string;
component: string;
header: string;
}
interface ApiChild {
api: string;
name?: string;
}
interface HeaderNode {
header: string;
name?: string;
file?: string;
children?: ApiChild[];
api?: string[];
}
interface ComponentNode {
component: string;
name?: string;
children?: HeaderNode[];
}
interface KitNode {
kit: string;
name?: string;
children?: ComponentNode[];
}
type CapiRoot = KitNode | Array<KitNode | CapiItem>;
@Entry
@Component
struct Index {
@State capiData: CapiItem[] = [];
@State capiKitList: string[] = [];
@State capiComponentMap: Map<string, string[]> = new Map();
@State capiViewLevel: string = 'kit';
@State capiSelectedKit: string = '';
@State capiSearchQuery: string = '';
aboutToAppear() {
try {
this.loadCapiData();
} catch (_) {}
}
async loadCapiData() {
try {
const context = getContext(this) as common.UIAbilityContext;
const resourceMgr = context.resourceManager;
let bytes: Uint8Array;
try {
const res1: object = await resourceMgr.getRawFileContent('rawfile/capi_data.json');
bytes = res1 instanceof Uint8Array ? res1 as Uint8Array : new Uint8Array(res1 as ArrayBuffer);
} catch (e1) {
const res2: object = await resourceMgr.getRawFileContent('capi_data.json');
bytes = res2 instanceof Uint8Array ? res2 as Uint8Array : new Uint8Array(res2 as ArrayBuffer);
}
const textDecoder = util.TextDecoder.create('utf-8', { ignoreBOM: true });
let s = textDecoder.decodeToString(bytes, { stream: false }).replace(/\uFEFF/g, '').trim();
const startBracket = s.indexOf('[');
const startBrace = s.indexOf('{');
let start = -1;
if (startBracket >= 0 && startBrace >= 0) {
start = Math.min(startBracket, startBrace);
} else {
start = startBracket >= 0 ? startBracket : startBrace;
}
const endBracket = s.lastIndexOf(']');
const endBrace = s.lastIndexOf('}');
let end = -1;
if (endBracket >= 0 && endBrace >= 0) {
end = Math.max(endBracket, endBrace);
} else {
end = endBracket >= 0 ? endBracket : endBrace;
}
if (start > 0 || (end >= 0 && end < s.length - 1)) {
s = s.slice(start >= 0 ? start : 0, end >= 0 ? end + 1 : s.length);
}
s = s.replace(/[^\x09\x0A\x0D\x20-\x7E\u00A0-\uFFFF]/g, '');
const parsed: CapiRoot = JSON.parse(s) as CapiRoot;
this.capiData = this.flattenCapi(parsed);
this.rebuildCapiIndex();
} catch (_) {}
}
private flattenCapi(parsed: CapiRoot): CapiItem[] {
const out: CapiItem[] = [];
const processKit = (kitItem: KitNode) => {
const kitName: string = kitItem.kit ?? kitItem.name ?? '';
const comps: ComponentNode[] = Array.isArray(kitItem.children) ? kitItem.children as ComponentNode[] : [];
comps.forEach((compItem: ComponentNode) => {
const compName: string = compItem.component ?? compItem.name ?? '';
const headers: HeaderNode[] = Array.isArray(compItem.children) ? compItem.children as HeaderNode[] : [];
headers.forEach((h: HeaderNode) => {
const headerName: string = h.header ?? h.name ?? h.file ?? '';
if (kitName && compName && headerName) {
out.push({ kit: kitName, component: compName, header: headerName });
}
});
});
};
if (Array.isArray(parsed)) {
parsed.forEach((item) => {
const comp = (item as CapiItem).component;
const hdr = (item as CapiItem).header;
if ((comp !== undefined) && (hdr !== undefined)) {
const flat = item as CapiItem;
out.push({ kit: flat.kit, component: flat.component, header: flat.header });
} else {
processKit(item as KitNode);
}
});
return out;
} else {
processKit(parsed as KitNode);
return out;
}
}
rebuildCapiIndex() {
const kits = new Set<string>();
const compSets: Map<string, Set<string>> = new Map();
this.capiData.forEach(item => {
kits.add(item.kit);
const set = compSets.get(item.kit) ?? new Set<string>();
set.add(item.component);
compSets.set(item.kit, set);
});
this.capiKitList = Array.from(kits).sort();
const m = new Map<string, string[]>();
Array.from(compSets.keys()).forEach(k => {
m.set(k, Array.from(compSets.get(k) as Set<string>).sort());
});
this.capiComponentMap = m;
}
private getFilteredKits(): string[] {
const q = (this.capiSearchQuery || '').toLowerCase();
if (!q) return this.capiKitList;
return this.capiKitList.filter(k => k.toLowerCase().includes(q));
}
private getFilteredComponents(): string[] {
const comps = this.capiComponentMap.get(this.capiSelectedKit) ?? [];
const q = (this.capiSearchQuery || '').toLowerCase();
if (!q) return comps;
return comps.filter(c => c.toLowerCase().includes(q));
}
build() {
Column() {
Row() {
Text('C Api调用')
.fontSize(24)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.padding({ left: 16, right: 16, top: 8, bottom: 8 })
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
Column() {
Row() {
if (this.capiViewLevel === 'component') {
Text('<')
.fontSize(20)
.fontColor(Color.Blue)
.width(20)
.height(40)
.onClick(() => { this.capiViewLevel = 'kit'; this.capiSelectedKit = ''; this.capiSearchQuery = ''; })
}
Text(this.capiViewLevel === 'kit' ? 'Kit 列表' : 'Component 列表')
.fontSize(18)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.padding({ left: 16, right: 16, top: 8, bottom: 8 })
Row() {
TextInput({ placeholder: '搜索', text: this.capiSearchQuery })
.width('100%')
.height(40)
.onChange((v: string) => { this.capiSearchQuery = v; })
}
.padding({ left: 16, right: 16 })
.margin({ bottom: 8 })
List() {
if (this.capiViewLevel === 'kit') {
ForEach(this.getFilteredKits(), (kit: string) => {
ListItem() {
Row() {
Text(kit).layoutWeight(1).fontSize(16)
Text('>').fontSize(14).fontColor(Color.Gray)
}
.width('100%')
.padding({ top: 12, bottom: 12, left: 16, right: 16 })
.onClick(() => { this.capiSelectedKit = kit; this.capiViewLevel = 'component'; this.capiSearchQuery = ''; })
}
})
} else {
ForEach(this.getFilteredComponents(), (comp: string) => {
ListItem() {
Row() {
Text(comp).layoutWeight(1).fontSize(16)
}
.width('100%')
.padding({ top: 12, bottom: 12, left: 16, right: 16 })
.onClick(() => {
router.pushUrl({ url: 'pages/ComponentDetail', params: { component: comp } });
})
}
})
}
}
.layoutWeight(1)
.backgroundColor('#FFFFFF')
.borderRadius(8)
}
.width('100%')
.layoutWeight(1)
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Start)
}
.height('100%')
.width('100%')
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.Start)
}
}
import * as lib from 'libentry.so';
import promptAction from '@ohos.promptAction';
import { registerComponent } from '../registry';
import { avcGetName, avcGetMaxSupportedInstances, avcIsHardware, avcGetEncoderBitrateRange, avcGetVideoWidthRange, avcGetVideoHeightRange, avcIsVideoSizeSupported, getAVCapabilityEnumValuesJson, avcGetVideoFrameRateRange, avcGetNameByCategory, avcGetVideoWidthAlignment, avcGetVideoHeightAlignment, avcGetVideoWidthRangeForHeight, avcGetVideoHeightRangeForWidth, avcGetVideoFrameRateRangeForSize, avcAreVideoSizeAndFrameRateSupported, avcIsFeatureSupported, avcGetFeaturePropertiesDump, avcGetAudioSupportedSampleRates, avcGetAudioSupportedSampleRateRanges, avcGetAudioChannelCountRange, avcGetVideoSupportedPixelFormats, avcGetSupportedProfiles, avcGetSupportedLevelsForProfile, avcAreProfileAndLevelSupported, avcIsEncoderBitrateModeSupported, avcGetEncoderQualityRange, avcGetEncoderComplexityRange } from 'libentry.so';
import { describeAVCapabilityCategoryByName, describeAVCapabilityFeatureByName } from '../common/EnumDesc';
import { safeNumberCall, safeStringCall } from '../common/SafeLib';
@Component
export default struct AVCapabilityView {
@State nameResult: string = '';
@State maxResult: string = '';
@State hardwareResult: string = '';
@State bitrateRangeResult: string = '';
@State widthRangeResult: string = '';
@State heightRangeResult: string = '';
@State sizeSupportedResult: string = '';
@State enumCodecHardware: string = '';
@State enumCodecSoftware: string = '';
@State enumFeatureTemporalScalability: string = '';
@State enumFeatureLongTermRef: string = '';
@State enumFeatureLowLatency: string = '';
@State enumFeatureBFrame: string = '';
@State nameByCategoryResult: string = '';
@State widthAlignResult: string = '';
@State heightAlignResult: string = '';
@State widthRangeForHeightResult: string = '';
@State heightRangeForWidthResult: string = '';
@State frameRateRangeForSizeResult: string = '';
@State frameRateRangeResult: string = '';
@State sizeAndFrameRateSupportedResult: string = '';
@State featureSupportedResult: string = '';
@State featureDumpResult: string = '';
@State audioSampleRatesResult: string = '';
@State audioSampleRateRangesResult: string = '';
@State audioChannelCountRangeResult: string = '';
@State videoPixelFormatsResult: string = '';
@State supportedProfilesResult: string = '';
@State supportedLevelsForProfileResult: string = '';
@State profileLevelSupportedResult: string = '';
@State encoderBitrateModeSupportedResult: string = '';
@State encoderQualityRangeResult: string = '';
@State encoderComplexityRangeResult: string = '';
aboutToAppear() {
try {
const s: string = getAVCapabilityEnumValuesJson();
const getNum = (key: string): string => {
const m = new RegExp(`"${key}"\\s*:\\s*(\\d+)`).exec(s);
return m ? m[1] : '';
};
this.enumCodecHardware = getNum('HARDWARE');
this.enumCodecSoftware = getNum('SOFTWARE');
this.enumFeatureTemporalScalability = getNum('VIDEO_ENCODER_TEMPORAL_SCALABILITY');
this.enumFeatureLongTermRef = getNum('VIDEO_ENCODER_LONG_TERM_REFERENCE');
this.enumFeatureLowLatency = getNum('VIDEO_LOW_LATENCY');
this.enumFeatureBFrame = getNum('VIDEO_ENCODER_B_FRAME');
} catch (e) {
try { promptAction.showToast({ message: '枚举值获取失败' }); } catch (_) {}
}
}
build() {
Column() {
List() {
ListItem() {
Column() {
Row() {
Text('获取能力实例的名称').layoutWeight(1).fontSize(18)
Button('调用')
.onClick(() => {
try {
const s: string = safeStringCall((): string => avcGetName('video/avc', 1));
this.nameResult = s;
} catch (e) {
this.nameResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetName failed: ${e}`));
}
})
}.width('100%').padding(12)
Row() {
Text(`结果: ${this.nameResult}`).fontSize(16)
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
}
}
ListItem() {
Column() {
Row() {
Text('获取支持的最大并发实例数').layoutWeight(1).fontSize(18)
Button('调用')
.onClick(() => {
try {
const ret: number = safeNumberCall((): number => avcGetMaxSupportedInstances('video/avc', 1));
this.maxResult = ret >= 0 ? `${ret}` : '调用失败';
} catch (e) {
this.maxResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetMaxSupportedInstances failed: ${e}`));
}
})
}.width('100%').padding(12)
Row() {
Text(`结果: ${this.maxResult}`).fontSize(16)
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
}
}
ListItem() {
Column() {
Row() {
Text('检查能力实例是否描述了硬件编解码器').layoutWeight(1).fontSize(18)
Button('调用')
.onClick(() => {
try {
const ret: number = safeNumberCall((): number => avcIsHardware('video/avc', 1));
this.hardwareResult = ret === 1 ? '硬件编解码器' : (ret === 0 ? '软件编解码器' : '调用失败');
} catch (e) {
this.hardwareResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `IsHardware failed: ${e}`));
}
})
}.width('100%').padding(12)
Row() {
Text(`结果: ${this.hardwareResult}`).fontSize(16)
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
}
}
ListItem() {
Column() {
Row() {
Text('获取编码器支持的比特率范围').layoutWeight(1).fontSize(18)
Button('调用')
.onClick(() => {
try {
const s: string = safeStringCall((): string => avcGetEncoderBitrateRange('video/avc'));
this.bitrateRangeResult = s;
} catch (e) {
this.bitrateRangeResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetEncoderBitrateRange failed: ${e}`));
}
})
}.width('100%').padding(12)
Row() {
Text(`结果: ${this.bitrateRangeResult}`).fontSize(16)
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
}
}
ListItem() {
Column() {
Row() {
Text('获取视频宽度范围').layoutWeight(1).fontSize(18)
Button('调用')
.onClick(() => {
try {
const s: string = safeStringCall((): string => avcGetVideoWidthRange('video/avc', 1));
this.widthRangeResult = s;
} catch (e) {
this.widthRangeResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetVideoWidthRange failed: ${e}`));
}
})
}.width('100%').padding(12)
Row() {
Text(`结果: ${this.widthRangeResult}`).fontSize(16)
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
}
}
ListItem() {
Column() {
Row() {
Text('获取视频高度范围').layoutWeight(1).fontSize(18)
Button('调用')
.onClick(() => {
try {
const s: string = safeStringCall((): string => avcGetVideoHeightRange('video/avc', 1));
this.heightRangeResult = s;
} catch (e) {
this.heightRangeResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetVideoHeightRange failed: ${e}`));
}
})
}.width('100%').padding(12)
Row() {
Text(`结果: ${this.heightRangeResult}`).fontSize(16)
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
}
}
ListItem() {
Column() {
Row() {
Text('检查是否支持指定分辨率(示例:1920×1080)').layoutWeight(1).fontSize(18)
Button('调用')
.onClick(() => {
try {
const ret: number = safeNumberCall((): number => avcIsVideoSizeSupported('video/avc', 1, 1920, 1080));
this.sizeSupportedResult = ret === 1 ? '支持 1920x1080' : (ret === 0 ? '不支持 1920x1080' : '调用失败');
} catch (e) {
this.sizeSupportedResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `IsVideoSizeSupported failed: ${e}`));
}
})
}.width('100%').padding(12)
Row() {
Text(`结果: ${this.sizeSupportedResult}`).fontSize(16)
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
}
}
ListItem() {
Column() {
Row() {
Text('获取视频帧率范围').layoutWeight(1).fontSize(18)
Button('调用')
.onClick(() => {
try {
const s: string = safeStringCall((): string => avcGetVideoFrameRateRange('video/avc', 1));
this.frameRateRangeResult = s;
} catch (e) {
this.frameRateRangeResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetVideoFrameRateRange failed: ${e}`));
}
})
}.width('100%').padding(12)
Row() {
Text(`结果: ${this.frameRateRangeResult}`).fontSize(14)
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
}
}
ListItem() {
Column() {
Row() {
Text('根据类别获取能力实例的名称(硬件)').layoutWeight(1).fontSize(18)
Button('调用')
.onClick(() => {
try {
const s: string = safeStringCall((): string => avcGetNameByCategory('video/avc', 1, Number(this.enumCodecHardware)));
this.nameByCategoryResult = s;
} catch (e) {
this.nameByCategoryResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetNameByCategory failed: ${e}`));
}
})
}.width('100%').padding(12)
Row() {
Text(`结果: ${this.nameByCategoryResult}`).fontSize(14)
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
}
}
ListItem() {
Column() {
Row() {
Text('获取视频宽度/高度对齐').layoutWeight(1).fontSize(18)
}.width('100%').padding(12)
Row() {
Button('调用宽度')
.onClick(() => {
try {
const ret: number = safeNumberCall((): number => avcGetVideoWidthAlignment('video/avc', 1));
this.widthAlignResult = ret >= 0 ? `${ret}` : '调用失败';
} catch (e) {
this.widthAlignResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetVideoWidthAlignment failed: ${e}`));
}
})
}.width('100%').padding({ left: 12, right: 12, bottom: 8 })
Row() {
Button('调用高度')
.onClick(() => {
try {
const ret: number = safeNumberCall((): number => avcGetVideoHeightAlignment('video/avc', 1));
this.heightAlignResult = ret >= 0 ? `${ret}` : '调用失败';
} catch (e) {
this.heightAlignResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetVideoHeightAlignment failed: ${e}`));
}
})
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
Row() {
Text(`宽度对齐: ${this.widthAlignResult},高度对齐: ${this.heightAlignResult}`).fontSize(14)
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
}
}
ListItem() {
Column() {
Row() {
Text('指定高获取宽度范围/指定宽获取高度范围').layoutWeight(1).fontSize(18)
}.width('100%').padding(12)
Row() {
Button('高=1080').onClick(() => {
try {
const s: string = safeStringCall((): string => avcGetVideoWidthRangeForHeight('video/avc', 1, 1080));
this.widthRangeForHeightResult = s;
} catch (e) {
this.widthRangeForHeightResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetVideoWidthRangeForHeight failed: ${e}`));
}
})
}.width('100%').padding({ left: 12, right: 12, bottom: 8 })
Row() {
Button('宽=1920').onClick(() => {
try {
const s: string = safeStringCall((): string => avcGetVideoHeightRangeForWidth('video/avc', 1, 1920));
this.heightRangeForWidthResult = s;
} catch (e) {
this.heightRangeForWidthResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetVideoHeightRangeForWidth failed: ${e}`));
}
})
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
Row() {
Text(`宽范围: ${this.widthRangeForHeightResult},高范围: ${this.heightRangeForWidthResult}`).fontSize(14)
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
}
}
ListItem() {
Column() {
Row() {
Text('指定分辨率获取帧率范围/检查是否支持').layoutWeight(1).fontSize(18)
}.width('100%').padding(12)
Row() {
Button('获取 1920x1080 帧率范围').onClick(() => {
try {
const s: string = safeStringCall((): string => avcGetVideoFrameRateRangeForSize('video/avc', 1, 1920, 1080));
this.frameRateRangeForSizeResult = s;
} catch (e) {
this.frameRateRangeForSizeResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetVideoFrameRateRangeForSize failed: ${e}`));
}
})
}.width('100%').padding({ left: 12, right: 12, bottom: 8 })
Row() {
Button('支持 1920x1080@30').onClick(() => {
try {
const ret: number = safeNumberCall((): number => avcAreVideoSizeAndFrameRateSupported('video/avc', 1, 1920, 1080, 30));
this.sizeAndFrameRateSupportedResult = ret === 1 ? '支持' : (ret === 0 ? '不支持' : '调用失败');
} catch (e) {
this.sizeAndFrameRateSupportedResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `AreVideoSizeAndFrameRateSupported failed: ${e}`));
}
})
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
Row() {
Text(`帧率范围: ${this.frameRateRangeForSizeResult},支持性: ${this.sizeAndFrameRateSupportedResult}`).fontSize(14)
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
}
}
ListItem() {
Column() {
Row() {
Text('特性支持与属性(低时延示例)').layoutWeight(1).fontSize(18)
}.width('100%').padding(12)
Row() {
Button('检查支持').onClick(() => {
try {
const ret: number = safeNumberCall((): number => avcIsFeatureSupported('video/avc', 0, Number(this.enumFeatureLowLatency)));
this.featureSupportedResult = ret === 1 ? '支持' : (ret === 0 ? '不支持' : '调用失败');
} catch (e) {
this.featureSupportedResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `IsFeatureSupported failed: ${e}`));
}
})
}.width('100%').padding({ left: 12, right: 12, bottom: 8 })
Row() {
Button('属性Dump').onClick(() => {
try {
const s: string = safeStringCall((): string => avcGetFeaturePropertiesDump('video/avc', 0, Number(this.enumFeatureLowLatency)));
this.featureDumpResult = s;
} catch (e) {
this.featureDumpResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetFeaturePropertiesDump failed: ${e}`));
}
})
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
Row() {
Text(`支持性: ${this.featureSupportedResult}`).fontSize(14)
}.width('100%').padding({ left: 12, right: 12 })
Row() {
Text(`属性: ${this.featureDumpResult === 'error' ? '不支持或无属性' : this.featureDumpResult}`).fontSize(14)
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
}
}
ListItem() {
Column() {
Row() {
Text('音频支持的采样率/采样率范围/声道范围(AAC)').layoutWeight(1).fontSize(18)
}.width('100%').padding(12)
Row() {
Button('采样率').onClick(() => {
try {
const s: string = safeStringCall((): string => avcGetAudioSupportedSampleRates('audio/mp4a-latm', 1));
this.audioSampleRatesResult = s;
} catch (e) {
this.audioSampleRatesResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetAudioSupportedSampleRates failed: ${e}`));
}
})
}.width('100%').padding({ left: 12, right: 12, bottom: 8 })
Row() {
Button('采样率范围').onClick(() => {
try {
const s: string = safeStringCall((): string => avcGetAudioSupportedSampleRateRanges('audio/mp4a-latm', 1));
this.audioSampleRateRangesResult = s;
} catch (e) {
this.audioSampleRateRangesResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetAudioSupportedSampleRateRanges failed: ${e}`));
}
})
}.width('100%').padding({ left: 12, right: 12, bottom: 8 })
Row() {
Button('声道范围').onClick(() => {
try {
const s: string = safeStringCall((): string => avcGetAudioChannelCountRange('audio/mp4a-latm', 1));
this.audioChannelCountRangeResult = s;
} catch (e) {
this.audioChannelCountRangeResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetAudioChannelCountRange failed: ${e}`));
}
})
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
Row() {
Text(`采样率: ${this.audioSampleRatesResult}`).fontSize(14)
}.width('100%').padding({ left: 12, right: 12 })
Row() {
Text(`采样率范围: ${this.audioSampleRateRangesResult}`).fontSize(14)
}.width('100%').padding({ left: 12, right: 12 })
Row() {
Text(`声道范围: ${this.audioChannelCountRangeResult}`).fontSize(14)
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
}
}
ListItem() {
Column() {
Row() {
Text('视频像素格式/支持的Profiles/Levels').layoutWeight(1).fontSize(18)
}.width('100%').padding(12)
Row() {
Button('像素格式').onClick(() => {
try {
const s: string = safeStringCall((): string => avcGetVideoSupportedPixelFormats('video/avc', 1));
this.videoPixelFormatsResult = s;
} catch (e) {
this.videoPixelFormatsResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetVideoSupportedPixelFormats failed: ${e}`));
}
})
}.width('100%').padding({ left: 12, right: 12, bottom: 8 })
Row() {
Button('Profiles').onClick(() => {
try {
const s: string = safeStringCall((): string => avcGetSupportedProfiles('video/avc', 1));
this.supportedProfilesResult = s;
} catch (e) {
this.supportedProfilesResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetSupportedProfiles failed: ${e}`));
}
})
}.width('100%').padding({ left: 12, right: 12, bottom: 8 })
Row() {
Button('Levels(假设profile=1)').onClick(() => {
try {
const s: string = safeStringCall((): string => avcGetSupportedLevelsForProfile('video/avc', 1, 1));
this.supportedLevelsForProfileResult = s;
} catch (e) {
this.supportedLevelsForProfileResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetSupportedLevelsForProfile failed: ${e}`));
}
})
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
Row() {
Text(`像素格式: ${this.videoPixelFormatsResult}`).fontSize(14)
}.width('100%').padding({ left: 12, right: 12 })
Row() {
Text(`Profiles: ${this.supportedProfilesResult}`).fontSize(14)
}.width('100%').padding({ left: 12, right: 12 })
Row() {
Text(`Levels: ${this.supportedLevelsForProfileResult === 'error' ? '不支持或参数无效' : this.supportedLevelsForProfileResult}`).fontSize(14)
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
}
}
ListItem() {
Column() {
Row() {
Text('检查Profile+Level组合/编码器比特率模式支持/质量/复杂度范围').layoutWeight(1).fontSize(18)
}.width('100%').padding(12)
Row() {
Button('Profile=1, Level=1 支持?').onClick(() => {
try {
const ret: number = safeNumberCall((): number => avcAreProfileAndLevelSupported('video/avc', 1, 1, 1));
this.profileLevelSupportedResult = ret === 1 ? '支持' : (ret === 0 ? '不支持' : '调用失败');
} catch (e) {
this.profileLevelSupportedResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `AreProfileAndLevelSupported failed: ${e}`));
}
})
}.width('100%').padding({ left: 12, right: 12, bottom: 8 })
Row() {
Button('比特率模式 CBR?').onClick(() => {
try {
const ret: number = safeNumberCall((): number => avcIsEncoderBitrateModeSupported('video/avc', 0));
this.encoderBitrateModeSupportedResult = ret === 1 ? '支持' : (ret === 0 ? '不支持' : '调用失败');
} catch (e) {
this.encoderBitrateModeSupportedResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `IsEncoderBitrateModeSupported failed: ${e}`));
}
})
}.width('100%').padding({ left: 12, right: 12, bottom: 8 })
Row() {
Button('质量范围').onClick(() => {
try {
const s: string = safeStringCall((): string => avcGetEncoderQualityRange('video/avc'));
this.encoderQualityRangeResult = s;
} catch (e) {
this.encoderQualityRangeResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetEncoderQualityRange failed: ${e}`));
}
})
}.width('100%').padding({ left: 12, right: 12, bottom: 8 })
Row() {
Button('复杂度范围').onClick(() => {
try {
const s: string = safeStringCall((): string => avcGetEncoderComplexityRange('video/avc'));
this.encoderComplexityRangeResult = s;
} catch (e) {
this.encoderComplexityRangeResult = '错误';
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
safeNumberCall((): number => lib.hiLogPrintMsg(1, 5, 0, 'AVCapability', `GetEncoderComplexityRange failed: ${e}`));
}
})
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
Row() {
Text(`Profile+Level: ${this.profileLevelSupportedResult},比特率模式: ${this.encoderBitrateModeSupportedResult}`).fontSize(14)
}.width('100%').padding({ left: 12, right: 12 })
Row() {
Text(`质量范围: ${this.encoderQualityRangeResult},复杂度范围: ${this.encoderComplexityRangeResult}`).fontSize(14)
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
}
}
ListItem() {
Column() {
Row() {
Text('枚举值').layoutWeight(1).fontSize(18)
}.width('100%').padding(12)
Row() {
Text(`AVCodecCategory.HARDWARE = ${this.enumCodecHardware}(${describeAVCapabilityCategoryByName('HARDWARE')})`).layoutWeight(1)
}.width('100%').padding({ left: 12, right: 12, bottom: 4 })
Row() {
Text(`AVCodecCategory.SOFTWARE = ${this.enumCodecSoftware}(${describeAVCapabilityCategoryByName('SOFTWARE')})`).layoutWeight(1)
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
Row() {
Text(`AVCapabilityFeature.VIDEO_ENCODER_TEMPORAL_SCALABILITY = ${this.enumFeatureTemporalScalability}(${describeAVCapabilityFeatureByName('VIDEO_ENCODER_TEMPORAL_SCALABILITY')})`).layoutWeight(1)
}.width('100%').padding({ left: 12, right: 12, bottom: 4 })
Row() {
Text(`AVCapabilityFeature.VIDEO_ENCODER_LONG_TERM_REFERENCE = ${this.enumFeatureLongTermRef}(${describeAVCapabilityFeatureByName('VIDEO_ENCODER_LONG_TERM_REFERENCE')})`).layoutWeight(1)
}.width('100%').padding({ left: 12, right: 12, bottom: 4 })
Row() {
Text(`AVCapabilityFeature.VIDEO_LOW_LATENCY = ${this.enumFeatureLowLatency}(${describeAVCapabilityFeatureByName('VIDEO_LOW_LATENCY')})`).layoutWeight(1)
}.width('100%').padding({ left: 12, right: 12, bottom: 4 })
Row() {
Text(`AVCapabilityFeature.VIDEO_ENCODER_B_FRAME = ${this.enumFeatureBFrame}(${describeAVCapabilityFeatureByName('VIDEO_ENCODER_B_FRAME')})`).layoutWeight(1)
}.width('100%').padding({ left: 12, right: 12, bottom: 12 })
}
}
}
.width('100%')
}
.width('100%')
}
}
@Builder
export function BuildAVCapability() { AVCapabilityView() }
registerComponent('AVCapability', BuildAVCapability)
import type { ComponentBuilder } from './registry';
@Component
export default struct ComponentHost {
@BuilderParam child: ComponentBuilder
build() { this.child() }
}
export function describeAVErr(code: number): string {
switch (code) {
case 0: return '操作成功';
case 1: return '内存不足';
case 2: return '不允许的操作';
case 3: return '参数无效';
case 4: return 'IO 错误';
case 5: return '网络超时';
case 6: return '未知错误';
case 7: return '媒体服务退出';
case 8: return '状态不支持该操作';
case 9: return '不支持的接口';
case 10: return '输入数据错误';
case 11: return '不支持的格式';
case 5411001: return '无法找到主机';
case 5411002: return '网络连接超时';
case 5411003: return '网络异常';
case 5411004: return '网络不可用';
case 5411005: return '网络权限被拒';
case 5411006: return '网络访问被拒';
case 5411007: return '资源未找到';
case 5411008: return '需要客户端证书';
case 5411009: return '服务器证书验证失败';
case 5411010: return '服务器证书不受信任';
case 5411011: return '不支持的请求';
case 5410005: return '码流格式变化';
case 5410006: return '稍后重试';
default: return `未知错误 (${code})`;
}
}
export function describeAIPByName(name: string): string {
switch (name) {
case 'AIP_OK': return '操作成功';
case 'AIP_E_EXEC_ERR': return '执行报错';
case 'AIP_E_OUT_OF_RANGE': return '下标越界';
case 'AIP_E_NO_SUCH_FIELD': return '不存在该字段';
case 'AIP_E_OVER_LIMIT': return '数组超过最大长度512字节';
case 'AIP_E_CONDITION_OVER_LIMIT': return '条件数量超过上限1';
case 'AIP_E_INVALID_ARGS': return '无效参数';
case 'AIP_E_EMBEDDING_ERR': return '无法生成嵌入向量';
default: return name;
}
}
export function describeHiLogTypeByName(name: string): string {
switch (name) {
case 'LOG_APP': return '应用日志';
default: return name;
}
}
export function describeHiLogLevelByName(name: string): string {
switch (name) {
case 'LOG_DEBUG': return '调试';
case 'LOG_INFO': return '信息';
case 'LOG_WARN': return '警告';
case 'LOG_ERROR': return '错误';
case 'LOG_FATAL': return '致命';
default: return name;
}
}
export function describeHiCollieErrorByName(name: string): string {
switch (name) {
case 'HICOLLIE_SUCCESS': return '操作成功';
case 'HICOLLIE_INVALID_ARGUMENT': return '参数无效';
case 'HICOLLIE_WRONG_THREAD_CONTEXT': return '错误线程环境(不可在主线程调用)';
case 'HICOLLIE_REMOTE_FAILED': return '远程调用失败';
case 'HICOLLIE_INVALID_TIMER_NAME': return '定时器名称无效';
case 'HICOLLIE_INVALID_TIMEOUT_VALUE': return '超时时间无效';
case 'HICOLLIE_WRONG_PROCESS_CONTEXT': return '错误进程环境(受限进程不可调用)';
case 'HICOLLIE_WRONG_TIMER_ID_OUTPUT_PARAM': return '定时器ID输出参数为空';
default: return name;
}
}
export function describeHiCollieFlagByName(name: string): string {
switch (name) {
case 'HICOLLIE_FLAG_DEFAULT': return '默认:生成日志并恢复';
case 'HICOLLIE_FLAG_NOOP': return '无操作';
case 'HICOLLIE_FLAG_LOG': return '生成日志';
case 'HICOLLIE_FLAG_RECOVERY': return '退出恢复';
default: return name;
}
}
export function describeHiTraceFlagByName(name: string): string {
switch (name) {
case 'HITRACE_FLAG_DEFAULT': return '默认';
case 'HITRACE_FLAG_INCLUDE_ASYNC': return '包含异步事件';
case 'HITRACE_FLAG_DONOT_CREATE_SPAN': return '不自动创建跨度';
case 'HITRACE_FLAG_TP_INFO': return '记录 Tracepoint 信息';
case 'HITRACE_FLAG_NO_BE_INFO': return '不包含后台执行信息';
case 'HITRACE_FLAG_DONOT_ENABLE_LOG': return '不启用日志';
case 'HITRACE_FLAG_FAULT_TRIGGER': return '故障触发标记';
case 'HITRACE_FLAG_D2D_TP_INFO': return '端到端 Tracepoint 信息';
default: return name;
}
}
export function describeHiTraceTypeByName(name: string): string {
switch (name) {
case 'HITRACE_TP_CS': return '客户端发送';
case 'HITRACE_TP_CR': return '客户端接收';
case 'HITRACE_TP_SS': return '服务端发送';
case 'HITRACE_TP_SR': return '服务端接收';
case 'HITRACE_TP_GENERAL': return '通用事件';
default: return name;
}
}
export function describeHiTraceModeByName(name: string): string {
switch (name) {
case 'HITRACE_CM_DEFAULT': return '默认链模式';
case 'HITRACE_CM_THREAD': return '按线程';
case 'HITRACE_CM_PROCESS': return '按进程';
case 'HITRACE_CM_DEVICE': return '按设备';
default: return name;
}
}
export function describeHiTraceLevelByName(name: string): string {
switch (name) {
case 'HITRACE_LEVEL_DEBUG': return '调试';
case 'HITRACE_LEVEL_INFO': return '信息';
case 'HITRACE_LEVEL_CRITICAL': return '关键';
case 'HITRACE_LEVEL_COMMERCIAL': return '商用';
case 'HITRACE_LEVEL_MAX': return '最大级别';
default: return name;
}
}
export function describeAVCapabilityCategoryByName(name: string): string {
switch (name) {
case 'HARDWARE': return '硬件编解码器';
case 'SOFTWARE': return '软件编解码器';
default: return name;
}
}
export function describeAVCapabilityFeatureByName(name: string): string {
switch (name) {
case 'VIDEO_ENCODER_TEMPORAL_SCALABILITY': return '视频编码器时域可扩展';
case 'VIDEO_ENCODER_LONG_TERM_REFERENCE': return '视频编码器长期参考';
case 'VIDEO_LOW_LATENCY': return '视频低时延';
case 'VIDEO_ENCODER_B_FRAME': return '视频编码器B帧';
default: return name;
}
}
export function describeHdrTypeByName(name: string): string {
switch (name) {
case 'OH_CORE_HDR_TYPE_NONE': return '无HDR类型';
case 'OH_CORE_HDR_TYPE_VIVID': return 'HDR Vivid类型';
default: return name;
}
}
export function describeDrmCencAlgorithmByName(name: string): string {
switch (name) {
case 'DRM_ALG_CENC_UNENCRYPTED': return '未加密';
case 'DRM_ALG_CENC_AES_CTR': return 'AES CTR';
case 'DRM_ALG_CENC_AES_WV': return 'AES Widevine';
case 'DRM_ALG_CENC_AES_CBC': return 'AES CBC';
case 'DRM_ALG_CENC_SM4_CBC': return 'SM4 CBC';
case 'DRM_ALG_CENC_SM4_CTR': return 'SM4 CTR';
default: return name;
}
}
export function describeDrmCencInfoModeByName(name: string): string {
switch (name) {
case 'DRM_CENC_INFO_KEY_IV_SUBSAMPLES_SET': return '已设置密钥/IV/子样本';
case 'DRM_CENC_INFO_KEY_IV_SUBSAMPLES_NOT_SET': return '未设置密钥/IV/子样本';
default: return name;
}
}
export function describeAVCodecBufferFlagsByName(name: string): string {
switch (name) {
case 'AVCODEC_BUFFER_FLAGS_NONE': return '无标记';
case 'AVCODEC_BUFFER_FLAGS_EOS': return '流结束帧';
case 'AVCODEC_BUFFER_FLAGS_SYNC_FRAME': return '关键帧';
case 'AVCODEC_BUFFER_FLAGS_INCOMPLETE_FRAME': return '不完整帧';
case 'AVCODEC_BUFFER_FLAGS_CODEC_DATA': return '编解码器配置数据';
case 'AVCODEC_BUFFER_FLAGS_DISCARD': return '可丢弃维护状态包';
case 'AVCODEC_BUFFER_FLAGS_DISPOSABLE': return '可丢弃非参考帧';
default: return name;
}
}
export function describeMediaTypeByName(name: string): string {
switch (name) {
case 'MEDIA_TYPE_AUD': return '音频';
case 'MEDIA_TYPE_VID': return '视频';
case 'MEDIA_TYPE_SUBTITLE': return '字幕';
case 'MEDIA_TYPE_TIMED_METADATA': return '时序元数据';
case 'MEDIA_TYPE_AUXILIARY': return '辅助流';
default: return name;
}
}
export function describeAVOutputFormatByName(name: string): string {
switch (name) {
case 'AV_OUTPUT_FORMAT_DEFAULT': return '默认容器';
case 'AV_OUTPUT_FORMAT_MPEG_4': return 'MP4';
case 'AV_OUTPUT_FORMAT_M4A': return 'M4A';
case 'AV_OUTPUT_FORMAT_AMR': return 'AMR';
case 'AV_OUTPUT_FORMAT_MP3': return 'MP3';
case 'AV_OUTPUT_FORMAT_WAV': return 'WAV';
case 'AV_OUTPUT_FORMAT_AAC': return 'AAC';
case 'AV_OUTPUT_FORMAT_FLAC': return 'FLAC';
default: return name;
}
}
export function describeAVSeekModeByName(name: string): string {
switch (name) {
case 'SEEK_MODE_NEXT_SYNC': return '下一个关键帧';
case 'SEEK_MODE_PREVIOUS_SYNC': return '上一个关键帧';
case 'SEEK_MODE_CLOSEST_SYNC': return '最近关键帧';
default: return name;
}
}
export function describeBitrateModeByName(name: string): string {
switch (name) {
case 'BITRATE_MODE_CBR': return '恒定码率 (CBR)';
case 'BITRATE_MODE_VBR': return '可变码率 (VBR)';
case 'BITRATE_MODE_CQ': return '恒定质量 (CQ)';
case 'BITRATE_MODE_SQR': return '主观质量 (SQR)';
default: return name;
}
}
export function describeColorPrimaryByName(name: string): string {
switch (name) {
case 'COLOR_PRIMARY_BT709': return 'BT.709';
case 'COLOR_PRIMARY_UNSPECIFIED': return '未指定';
case 'COLOR_PRIMARY_BT470_M': return 'BT.470 M';
case 'COLOR_PRIMARY_BT601_625': return 'BT.601 625';
case 'COLOR_PRIMARY_BT601_525': return 'BT.601 525';
case 'COLOR_PRIMARY_SMPTE_ST240': return 'SMPTE ST 240';
case 'COLOR_PRIMARY_GENERIC_FILM': return '电影通用';
case 'COLOR_PRIMARY_BT2020': return 'BT.2020';
case 'COLOR_PRIMARY_SMPTE_ST428': return 'SMPTE ST 428';
case 'COLOR_PRIMARY_P3DCI': return 'DCI-P3';
case 'COLOR_PRIMARY_P3D65': return 'Display P3 (D65)';
default: return name;
}
}
export function describeTransferCharacteristicByName(name: string): string {
switch (name) {
case 'TRANSFER_CHARACTERISTIC_BT709': return 'BT.709';
case 'TRANSFER_CHARACTERISTIC_UNSPECIFIED': return '未指定';
case 'TRANSFER_CHARACTERISTIC_GAMMA_2_2': return 'Gamma 2.2';
case 'TRANSFER_CHARACTERISTIC_GAMMA_2_8': return 'Gamma 2.8';
case 'TRANSFER_CHARACTERISTIC_BT601': return 'BT.601';
case 'TRANSFER_CHARACTERISTIC_SMPTE_ST240': return 'SMPTE ST 240';
case 'TRANSFER_CHARACTERISTIC_LINEAR': return '线性';
case 'TRANSFER_CHARACTERISTIC_LOG': return '对数';
case 'TRANSFER_CHARACTERISTIC_LOG_SQRT': return '对数平方根';
case 'TRANSFER_CHARACTERISTIC_IEC_61966_2_4': return 'IEC 61966-2-4';
case 'TRANSFER_CHARACTERISTIC_BT1361': return 'BT.1361';
case 'TRANSFER_CHARACTERISTIC_IEC_61966_2_1': return 'sRGB';
case 'TRANSFER_CHARACTERISTIC_BT2020_10BIT': return 'BT.2020 10bit';
case 'TRANSFER_CHARACTERISTIC_BT2020_12BIT': return 'BT.2020 12bit';
case 'TRANSFER_CHARACTERISTIC_PQ': return 'SMPTE ST 2084 (PQ)';
case 'TRANSFER_CHARACTERISTIC_SMPTE_ST428': return 'SMPTE ST 428';
case 'TRANSFER_CHARACTERISTIC_HLG': return 'HLG';
default: return name;
}
}
export function describeMatrixCoefficientByName(name: string): string {
switch (name) {
case 'MATRIX_COEFFICIENT_IDENTITY': return '恒等 (RGB)';
case 'MATRIX_COEFFICIENT_BT709': return 'BT.709';
case 'MATRIX_COEFFICIENT_UNSPECIFIED': return '未指定';
case 'MATRIX_COEFFICIENT_FCC': return 'FCC';
case 'MATRIX_COEFFICIENT_BT601_625': return 'BT.601 625';
case 'MATRIX_COEFFICIENT_BT601_525': return 'BT.601 525';
case 'MATRIX_COEFFICIENT_SMPTE_ST240': return 'SMPTE ST 240';
case 'MATRIX_COEFFICIENT_YCGCO': return 'YCgCo';
case 'MATRIX_COEFFICIENT_BT2020_NCL': return 'BT.2020 非恒定亮度';
case 'MATRIX_COEFFICIENT_BT2020_CL': return 'BT.2020 恒定亮度';
case 'MATRIX_COEFFICIENT_SMPTE_ST2085': return 'SMPTE ST 2085';
case 'MATRIX_COEFFICIENT_CHROMATICITY_NCL': return '色度 非恒定亮度';
case 'MATRIX_COEFFICIENT_CHROMATICITY_CL': return '色度 恒定亮度';
case 'MATRIX_COEFFICIENT_ICTCP': return 'ICTCP';
default: return name;
}
}
export function describeAudioChannelSetByName(name: string): string {
switch (name) {
case 'CH_SET_FRONT_LEFT': return '前左';
case 'CH_SET_FRONT_RIGHT': return '前右';
case 'CH_SET_FRONT_CENTER': return '前中';
case 'CH_SET_LOW_FREQUENCY': return '低频';
case 'CH_SET_BACK_LEFT': return '后左';
case 'CH_SET_BACK_RIGHT': return '后右';
case 'CH_SET_FRONT_LEFT_OF_CENTER': return '前左中';
case 'CH_SET_FRONT_RIGHT_OF_CENTER': return '前右中';
case 'CH_SET_BACK_CENTER': return '后中';
case 'CH_SET_SIDE_LEFT': return '侧左';
case 'CH_SET_SIDE_RIGHT': return '侧右';
case 'CH_SET_TOP_CENTER': return '顶中';
case 'CH_SET_TOP_FRONT_LEFT': return '顶前左';
case 'CH_SET_TOP_FRONT_CENTER': return '顶前中';
case 'CH_SET_TOP_FRONT_RIGHT': return '顶前右';
case 'CH_SET_TOP_BACK_LEFT': return '顶后左';
case 'CH_SET_TOP_BACK_CENTER': return '顶后中';
case 'CH_SET_TOP_BACK_RIGHT': return '顶后右';
case 'CH_SET_STEREO_LEFT': return '立体左';
case 'CH_SET_STEREO_RIGHT': return '立体右';
case 'CH_SET_WIDE_LEFT': return '宽左';
case 'CH_SET_WIDE_RIGHT': return '宽右';
case 'CH_SET_SURROUND_DIRECT_LEFT': return '直达环绕左';
case 'CH_SET_SURROUND_DIRECT_RIGHT': return '直达环绕右';
case 'CH_SET_LOW_FREQUENCY_2': return '次低频';
case 'CH_SET_TOP_SIDE_LEFT': return '顶侧左';
case 'CH_SET_TOP_SIDE_RIGHT': return '顶侧右';
case 'CH_SET_BOTTOM_FRONT_CENTER': return '底前中';
case 'CH_SET_BOTTOM_FRONT_LEFT': return '底前左';
case 'CH_SET_BOTTOM_FRONT_RIGHT': return '底前右';
default: return name;
}
}
export function describeAudioChannelSetRawByName(name: string): string {
switch (name) {
case 'FRONT_LEFT': return '前左';
case 'FRONT_RIGHT': return '前右';
case 'FRONT_CENTER': return '前中';
case 'LOW_FREQUENCY': return '低频';
case 'BACK_LEFT': return '后左';
case 'BACK_RIGHT': return '后右';
case 'FRONT_LEFT_OF_CENTER': return '前左中';
case 'FRONT_RIGHT_OF_CENTER': return '前右中';
case 'BACK_CENTER': return '后中';
case 'SIDE_LEFT': return '侧左';
case 'SIDE_RIGHT': return '侧右';
case 'TOP_FRONT_LEFT': return '顶前左';
case 'TOP_FRONT_RIGHT': return '顶前右';
case 'TOP_BACK_LEFT': return '顶后左';
case 'TOP_BACK_RIGHT': return '顶后右';
case 'STEREO_LEFT': return '立体左';
case 'STEREO_RIGHT': return '立体右';
case 'WIDE_LEFT': return '宽左';
case 'WIDE_RIGHT': return '宽右';
case 'SURROUND_DIRECT_LEFT': return '直达环绕左';
case 'SURROUND_DIRECT_RIGHT': return '直达环绕右';
case 'LOW_FREQUENCY_2': return '次低频';
case 'TOP_SIDE_LEFT': return '顶侧左';
case 'TOP_SIDE_RIGHT': return '顶侧右';
case 'BOTTOM_FRONT_CENTER': return '底前中';
case 'BOTTOM_FRONT_LEFT': return '底前左';
case 'BOTTOM_FRONT_RIGHT': return '底前右';
default: return name;
}
}
export function describeAmbAttributeSetByName(name: string): string {
switch (name) {
case 'AMB_ORD_1': return '一阶';
case 'AMB_ORD_2': return '二阶';
case 'AMB_ORD_3': return '三阶';
case 'AMB_COM_ACN': return 'ACN 组件排序';
case 'AMB_COM_FUMA': return 'FUMA 组件排序';
case 'AMB_NOR_N3D': return 'N3D 归一化';
case 'AMB_NOR_SN3D': return 'SN3D 归一化';
case 'AMB_MODE': return 'Ambisonic 模式';
default: return name;
}
}
export function describeAudioChannelLayoutByName(name: string): string {
switch (name) {
case 'CH_LAYOUT_UNKNOWN': return '未知布局';
case 'CH_LAYOUT_MONO': return '单声道';
case 'CH_LAYOUT_STEREO': return '双声道立体';
case 'CH_LAYOUT_STEREO_DOWNMIX': return '双声道降混';
case 'CH_LAYOUT_2POINT1': return '2.1 布局';
case 'CH_LAYOUT_3POINT0': return '3.0 布局';
case 'CH_LAYOUT_SURROUND': return '环绕 3.0';
case 'CH_LAYOUT_3POINT1': return '3.1 布局';
case 'CH_LAYOUT_4POINT0': return '4.0 布局';
case 'CH_LAYOUT_QUAD_SIDE': return '四声道侧环绕';
case 'CH_LAYOUT_QUAD': return '四声道';
case 'CH_LAYOUT_2POINT0POINT2': return '2.0.2 高度';
case 'CH_LAYOUT_AMB_ORDER1_ACN_N3D': return '一阶 Ambisonic ACN/N3D';
case 'CH_LAYOUT_AMB_ORDER1_ACN_SN3D': return '一阶 Ambisonic ACN/SN3D';
case 'CH_LAYOUT_AMB_ORDER1_FUMA': return '一阶 Ambisonic FuMa';
case 'CH_LAYOUT_4POINT1': return '4.1 布局';
case 'CH_LAYOUT_5POINT0': return '5.0 布局';
case 'CH_LAYOUT_5POINT0_BACK': return '5.0 后环绕';
case 'CH_LAYOUT_5POINT1': return '环绕 5.1';
case 'CH_LAYOUT_5POINT1_BACK': return '5.1 后环绕';
case 'CH_LAYOUT_6POINT0': return '6.0 布局';
case 'CH_LAYOUT_3POINT1POINT2': return '3.1.2 高度';
case 'CH_LAYOUT_6POINT0_FRONT': return '6.0 前环绕';
case 'CH_LAYOUT_HEXAGONAL': return '六边形 6.0';
case 'CH_LAYOUT_6POINT1': return '6.1 布局';
case 'CH_LAYOUT_6POINT1_BACK': return '6.1 后环绕';
case 'CH_LAYOUT_6POINT1_FRONT': return '6.1 前环绕';
case 'CH_LAYOUT_7POINT0': return '7.0 布局';
case 'CH_LAYOUT_7POINT0_FRONT': return '7.0 前环绕';
case 'CH_LAYOUT_7POINT1': return '环绕 7.1';
case 'CH_LAYOUT_OCTAGONAL': return '八边形 8.0';
case 'CH_LAYOUT_5POINT1POINT2': return '5.1.2 高度';
case 'CH_LAYOUT_7POINT1_WIDE': return '7.1 宽声场';
case 'CH_LAYOUT_7POINT1_WIDE_BACK': return '7.1 宽后声场';
case 'CH_LAYOUT_AMB_ORDER2_ACN_N3D': return '二阶 Ambisonic ACN/N3D';
case 'CH_LAYOUT_AMB_ORDER2_ACN_SN3D': return '二阶 Ambisonic ACN/SN3D';
case 'CH_LAYOUT_AMB_ORDER2_FUMA': return '二阶 Ambisonic FuMa';
case 'CH_LAYOUT_7POINT1POINT4': return '7.1.4 高度';
case 'CH_LAYOUT_5POINT1POINT4': return '5.1.4 高度';
case 'CH_LAYOUT_7POINT1POINT2': return '7.1.2 高度';
case 'CH_LAYOUT_10POINT2': return '10.2 扩展';
case 'CH_LAYOUT_9POINT1POINT4': return '9.1.4 高度';
case 'CH_LAYOUT_9POINT1POINT6': return '9.1.6 高度';
case 'CH_LAYOUT_HEXADECAGONAL': return '十六边形 16.0';
case 'CH_LAYOUT_22POINT2': return '22.2 超高清';
default: return name;
}
}
export function describeAudioChannelLayoutRawByName(name: string): string {
switch (name) {
case 'UNKNOWN_CHANNEL_LAYOUT': return '未知布局';
case 'MONO': return '单声道';
case 'STEREO': return '双声道立体';
case 'SURROUND': return '环绕 3.0';
case 'CH_4POINT0': return '4.0 布局';
case 'CH_4POINT1': return '4.1 布局';
case 'CH_5POINT0': return '5.0 布局';
case 'CH_5POINT1': return '环绕 5.1';
case 'CH_5POINT0_BACK': return '5.0 后环绕';
case 'CH_5POINT1_BACK': return '5.1 后环绕';
case 'CH_6POINT0': return '6.0 布局';
case 'CH_6POINT1': return '6.1 布局';
case 'CH_6POINT1_BACK': return '6.1 后环绕';
case 'CH_7POINT0': return '7.0 布局';
case 'CH_7POINT1': return '环绕 7.1';
case 'CH_7POINT1_WIDE': return '7.1 宽声场';
case 'CH_7POINT1_WIDE_BACK': return '7.1 宽后声场';
case 'CH_3POINT1POINT2': return '3.1.2 高度';
case 'CH_5POINT1POINT2': return '5.1.2 高度';
case 'CH_5POINT1POINT4': return '5.1.4 高度';
case 'CH_7POINT1POINT2': return '7.1.2 高度';
case 'CH_7POINT1POINT4': return '7.1.4 高度';
case 'CH_9POINT1POINT4': return '9.1.4 高度';
case 'CH_9POINT1POINT6': return '9.1.6 高度';
case 'CH_10POINT2': return '10.2 扩展';
case 'CH_22POINT2': return '22.2 超高清';
case 'OCTAGONAL': return '八边形 8.0';
case 'HEXADECAGONAL': return '十六边形 16.0';
case 'STEREO_DOWNMIX': return '双声道降混';
default: return name;
}
}
export function describeVideoEncodeBitrateModeByName(name: string): string {
switch (name) {
case 'CBR': return '恒定码率';
case 'VBR': return '可变码率';
case 'CQ': return '恒定质量';
default: return name;
}
}
export function describeAVMetadataResultByName(name: string): string {
switch (name) {
case 'AVMETADATA_SUCCESS': return '操作成功';
case 'AVMETADATA_ERROR_INVALID_PARAM': return '参数无效';
case 'AVMETADATA_ERROR_NO_MEMORY': return '内存不足';
default: return name;
}
}
export function describeAVMetadataSkipIntervalsByName(name: string): string {
switch (name) {
case 'SECONDS_10': return '10 秒';
case 'SECONDS_15': return '15 秒';
case 'SECONDS_30': return '30 秒';
default: return name;
}
}
export function describeHiDebugErrorByName(name: string): string {
switch (name) {
case 'HIDEBUG_SUCCESS': return '操作成功';
case 'HIDEBUG_INVALID_ARGUMENT': return '参数无效';
case 'HIDEBUG_TRACE_CAPTURED_ALREADY': return '已有 Trace 捕获进行中';
case 'HIDEBUG_NO_PERMISSION': return '无权限';
case 'HIDEBUG_TRACE_ABNORMAL': return 'Trace 异常';
case 'HIDEBUG_NO_TRACE_RUNNING': return '无进行中的 Trace';
case 'HIDEBUG_INVALID_SYMBOLIC_PC_ADDRESS': return '符号化地址无效';
case 'HIDEBUG_NOT_SUPPORTED': return '不支持';
case 'HIDEBUG_UNDER_SAMPLING': return '采样不足';
case 'HIDEBUG_RESOURCE_UNAVAILABLE': return '资源不可用';
default: return name;
}
}
export function describeHiDebugTraceFlagByName(name: string): string {
switch (name) {
case 'HIDEBUG_TRACE_FLAG_MAIN_THREAD': return '主线程采样';
case 'HIDEBUG_TRACE_FLAG_ALL_THREADS': return '所有线程采样';
default: return name;
}
}
export function describeHiDebugStackFrameTypeByName(name: string): string {
switch (name) {
case 'HIDEBUG_STACK_FRAME_TYPE_JS': return 'JS 栈帧';
case 'HIDEBUG_STACK_FRAME_TYPE_NATIVE': return 'Native 栈帧';
default: return name;
}
}
export function describeHiDebugTraceTagByName(name: string): string {
switch (name) {
case 'HIDEBUG_TRACE_TAG_OHOS': return '系统';
case 'HIDEBUG_TRACE_TAG_ARKUI': return 'ArkUI';
case 'HIDEBUG_TRACE_TAG_MEDIA': return '媒体';
case 'HIDEBUG_TRACE_TAG_GRAPHICS': return '图形';
case 'HIDEBUG_TRACE_TAG_NOTIFICATION': return '通知';
default: return name;
}
}
export function describeAVMetadataDisplayTagByName(name: string): string {
switch (name) {
case 'AVSESSION_DISPLAYTAG_AUDIO_VIVID': return '音频 Vivid 属性';
default: return name;
}
}
export function describeBatteryPluggedType(code: number): string {
switch (code) {
case 0: return '电源已拔下。';
case 1: return '电源是交流充电。';
case 2: return '电源是USB DC充电。';
case 3: return '电源为无线充电。';
case 4: return '预留枚举';
case -10001: return '当前API版本过高';
default: return '未知';
}
}
export function describeBundleManagerErrorCodeByName(name: string): string {
switch (name) {
case 'BUNDLE_MANAGER_ERROR_CODE_NO_ERROR': return '操作成功';
case 'BUNDLE_MANAGER_ERROR_CODE_PERMISSION_DENIED': return '权限拒绝';
case 'BUNDLE_MANAGER_ERROR_CODE_PARAM_INVALID': return '参数无效';
default: return name;
}
}
export function describePrintPrinterState(code: number): string {
switch (code) {
case 0: return '空闲';
case 1: return '忙碌';
case 2: return '不可用';
default: return `未知 (${code})`;
}
}
export function describeScanErr(code: number): string {
switch (code) {
case 0: return '操作成功';
case 201: return '权限验证失败';
case 401: return '参数无效';
case 24300101: return '通用内部错误';
case 24300102: return 'RPC通信错误';
case 24300103: return '服务器错误';
case 24300104: return '不支持的操作';
case 24300105: return '操作已取消';
case 24300106: return '设备繁忙';
case 24300107: return '数据无效/无设备';
case 24300108: return '文档进纸器卡纸';
case 24300109: return '文档进纸器缺纸';
case 24300110: return '扫描仪盖板打开';
case 24300111: return '设备I/O错误';
case 24300112: return '内存不足';
default: return `未知错误 (${code})`;
}
}
export function describeOsAccountErr(code: number): string {
switch (code) {
case 0: return '成功';
case 12300001: return '内部错误';
case 12300002: return '无效的参数';
default: return `未知错误 (${code})`;
}
}
export function describeTimeServiceErr(code: number): string {
switch (code) {
case 0: return '成功';
case 13000001: return '获取系统参数失败';
case 13000002: return '无效的参数';
default: return `未知错误 (${code})`;
}
}
export function describeCommonEventErrByName(name: string): string {
switch (name) {
case 'COMMONEVENT_ERR_OK': return '成功';
case 'COMMONEVENT_ERR_PERMISSION_ERROR': return '权限错误';
case 'COMMONEVENT_ERR_INVALID_PARAMETER': return '参数无效';
case 'COMMONEVENT_ERR_SENDING_LIMIT_EXCEEDED': return '发送频率超限';
case 'COMMONEVENT_ERR_NOT_SYSTEM_SERVICE': return '非系统服务';
case 'COMMONEVENT_ERR_SENDING_REQUEST_FAILED': return '发送请求失败';
case 'COMMONEVENT_ERR_INIT_UNDONE': return '初始化未完成';
case 'COMMONEVENT_ERR_OBTAIN_SYSTEM_PARAMS': return '获取系统参数失败';
case 'COMMONEVENT_ERR_SUBSCRIBER_NUM_EXCEEDED': return '订阅者数量超限';
case 'COMMONEVENT_ERR_ALLOC_MEMORY_FAILED': return '内存分配失败';
default: return name;
}
}
export function describePasteboardNotifyTypeByName(name: string): string {
switch (name) {
case 'NOTIFY_LOCAL_DATA_CHANGE': return '本地数据变更';
case 'NOTIFY_REMOTE_DATA_CHANGE': return '远端数据变更';
default: return name;
}
}
export function describePasteboardErrByName(name: string): string {
switch (name) {
case 'ERR_OK': return '成功';
case 'ERR_PERMISSION_ERROR': return '权限错误';
case 'ERR_INVALID_PARAMETER': return '参数无效';
case 'ERR_DEVICE_NOT_SUPPORTED': return '设备不支持';
case 'ERR_INNER_ERROR': return '内部错误';
case 'ERR_BUSY': return '忙碌中';
case 'ERR_PASTEBOARD_COPY_FILE_ERROR': return '拷贝文件失败';
case 'ERR_PASTEBOARD_PROGRESS_START_ERROR': return '进度启动失败';
case 'ERR_PASTEBOARD_PROGRESS_ABNORMAL': return '进度异常退出';
case 'ERR_PASTEBOARD_GET_DATA_FAILED': return '获取数据失败';
default: return name;
}
}
export function describePasteboardFileConflictByName(name: string): string {
switch (name) {
case 'PASTEBOARD_OVERWRITE': return '覆盖已存在文件';
case 'PASTEBOARD_SKIP': return '跳过冲突文件';
default: return name;
}
}
export function describePasteboardProgressIndicatorByName(name: string): string {
switch (name) {
case 'PASTEBOARD_NONE': return '不显示进度';
case 'PASTEBOARD_DEFAULT': return '显示默认进度';
default: return name;
}
}
export function describePrintErrorByName(name: string): string {
switch (name) {
case 'PRINT_ERROR_NONE': return '成功';
case 'PRINT_ERROR_NO_PERMISSION': return '无权限';
case 'PRINT_ERROR_INVALID_PARAMETER': return '参数无效';
case 'PRINT_ERROR_GENERIC_FAILURE': return '通用错误';
case 'PRINT_ERROR_RPC_FAILURE': return 'RPC通信错误';
case 'PRINT_ERROR_SERVER_FAILURE': return '服务器错误';
case 'PRINT_ERROR_INVALID_EXTENSION': return '扩展无效';
case 'PRINT_ERROR_INVALID_PRINTER': return '打印机无效';
case 'PRINT_ERROR_INVALID_PRINT_JOB': return '打印任务无效';
case 'PRINT_ERROR_FILE_IO': return '文件IO错误';
case 'PRINT_ERROR_UNKNOWN': return '未知错误';
default: return name;
}
}
export function describePrintDiscoveryEventByName(name: string): string {
switch (name) {
case 'PRINTER_DISCOVERED': return '发现打印机';
case 'PRINTER_LOST': return '打印机丢失';
case 'PRINTER_CONNECTING': return '正在连接打印机';
case 'PRINTER_CONNECTED': return '已连接打印机';
default: return name;
}
}
export function describePrintPrinterEventByName(name: string): string {
switch (name) {
case 'PRINTER_ADDED': return '打印机已添加';
case 'PRINTER_DELETED': return '打印机已删除';
case 'PRINTER_STATE_CHANGED': return '打印机状态变更';
case 'PRINTER_INFO_CHANGED': return '打印机信息变更';
default: return name;
}
}
export function describePrintDuplexModeByName(name: string): string {
switch (name) {
case 'DUPLEX_MODE_ONE_SIDED': return '单面';
case 'DUPLEX_MODE_TWO_SIDED_LONG_EDGE': return '双面长边';
case 'DUPLEX_MODE_TWO_SIDED_SHORT_EDGE': return '双面短边';
default: return name;
}
}
export function describePrintColorModeByName(name: string): string {
switch (name) {
case 'COLOR_MODE_MONOCHROME': return '黑白';
case 'COLOR_MODE_COLOR': return '彩色';
case 'COLOR_MODE_AUTO': return '自动';
default: return name;
}
}
export function describePrintOrientationModeByName(name: string): string {
switch (name) {
case 'ORIENTATION_MODE_PORTRAIT': return '竖向';
case 'ORIENTATION_MODE_LANDSCAPE': return '横向';
case 'ORIENTATION_MODE_REVERSE_LANDSCAPE': return '反向横向';
case 'ORIENTATION_MODE_REVERSE_PORTRAIT': return '反向竖向';
case 'ORIENTATION_MODE_NONE': return '无';
default: return name;
}
}
export function describePrintQualityByName(name: string): string {
switch (name) {
case 'PRINT_QUALITY_DRAFT': return '草稿';
case 'PRINT_QUALITY_NORMAL': return '标准';
case 'PRINT_QUALITY_HIGH': return '高质量';
default: return name;
}
}
export function describePrintDocumentFormatByName(name: string): string {
switch (name) {
case 'DOCUMENT_FORMAT_AUTO': return '自动';
case 'DOCUMENT_FORMAT_JPEG': return 'JPEG';
case 'DOCUMENT_FORMAT_PDF': return 'PDF';
case 'DOCUMENT_FORMAT_POSTSCRIPT': return 'PostScript';
case 'DOCUMENT_FORMAT_TEXT': return '文本';
default: return name;
}
}
export function describePrintJobDocAdapterStateByName(name: string): string {
switch (name) {
case 'PRINT_DOC_ADAPTER_PREVIEW_ABILITY_DESTROY': return '预览能力销毁';
case 'PRINT_DOC_ADAPTER_PRINT_TASK_SUCCEED': return '打印任务成功';
case 'PRINT_DOC_ADAPTER_PRINT_TASK_FAIL': return '打印任务失败';
case 'PRINT_DOC_ADAPTER_PRINT_TASK_CANCEL': return '打印任务取消';
case 'PRINT_DOC_ADAPTER_PRINT_TASK_BLOCK': return '打印任务阻塞';
case 'PRINT_DOC_ADAPTER_PREVIEW_ABILITY_DESTROY_FOR_CANCELED': return '打印取消时销毁预览能力';
case 'PRINT_DOC_ADAPTER_PREVIEW_ABILITY_DESTROY_FOR_STARTED': return '打印开始时销毁预览能力';
default: return name;
}
}
export function describeHiAppEventErrorByName(name: string): string {
switch (name) {
case 'HIAPPEVENT_SUCCESS': return '操作成功';
case 'HIAPPEVENT_INVALID_PARAM_VALUE_LENGTH': return '参数值长度无效';
case 'HIAPPEVENT_PROCESSOR_IS_NULL': return '处理器为空';
case 'HIAPPEVENT_PROCESSOR_NOT_FOUND': return '处理器未找到';
case 'HIAPPEVENT_INVALID_PARAM_VALUE': return '参数值无效';
case 'HIAPPEVENT_EVENT_CONFIG_IS_NULL': return '事件配置为空';
case 'HIAPPEVENT_OPERATE_FAILED': return '操作失败';
case 'HIAPPEVENT_INVALID_UID': return '无效的用户ID';
default: return name;
}
}
export function describeHiAppEventEventTypeByName(name: string): string {
switch (name) {
case 'FAULT': return '故障事件';
case 'STATISTIC': return '统计事件';
case 'SECURITY': return '安全事件';
case 'BEHAVIOR': return '行为事件';
default: return name;
}
}
export function describeHiAppEventClearData(code: number): string {
switch (code) {
case 0: return '数据清理成功';
default: return '错误';
}
}
export function describeHiAppEventAddProcessor(id: number): string {
if (Number.isNaN(id)) return '错误';
if (id >= 0) return '添加成功';
return describeHiAppEventErrorByName('HIAPPEVENT_OPERATE_FAILED');
}
export function describeArkWebErrorByName(name: string): string {
switch (name) {
case 'ARKWEB_SUCCESS': return '成功';
case 'ARKWEB_INIT_ERROR': return '初始化失败';
case 'ARKWEB_ERROR_UNKNOWN': return '未知错误';
case 'ARKWEB_INVALID_PARAM': return '参数无效';
case 'ARKWEB_SCHEME_REGISTER_FAILED': return 'Scheme 注册失败(需在创建ArkWeb前注册)';
case 'ARKWEB_INVALID_URL': return 'URL 无效';
case 'ARKWEB_INVALID_COOKIE_VALUE': return 'Cookie 值无效';
case 'ARKWEB_LIBRARY_OPEN_FAILURE': return '打开动态库失败';
case 'ARKWEB_LIBRARY_SYMBOL_NOT_FOUND': return '动态库缺少所需符号';
case 'ARKWEB_COOKIE_MANAGER_NOT_INITIALIZED': return 'CookieManager 未初始化';
case 'ARKWEB_COOKIE_MANAGER_INITIALIZE_FAILED': return 'CookieManager 初始化失败';
case 'ARKWEB_COOKIE_SAVE_FAILED': return '保存 Cookie 失败';
default: return name;
}
}
export function describeArkWebBlanklessErrorByName(name: string): string {
switch (name) {
case 'ARKWEB_BLANKLESS_SUCCESS': return '成功';
case 'ARKWEB_BLANKLESS_ERR_UNKNOWN': return '未知错误/内部状态错误';
case 'ARKWEB_BLANKLESS_ERR_INVALID_ARGS': return '参数不合法';
case 'ARKWEB_BLANKLESS_ERR_CONTROLLER_NOT_INITED': return 'WebViewController 未绑定组件';
case 'ARKWEB_BLANKLESS_ERR_KEY_NOT_MATCH': return 'Key 不匹配(需配套使用且一致)';
case 'ARKWEB_BLANKLESS_ERR_SIGNIFICANT_CHANGE': return '跳变太大,插帧启用失败';
case 'ARKWEB_BLANKLESS_ERR_DEVICE_NOT_SUPPORT': return '设备不支持';
default: return name;
}
}
export function describeArkWebNativeApiKindByName(name: string): string {
switch (name) {
case 'ARKWEB_NATIVE_COMPONENT': return '组件相关 API';
case 'ARKWEB_NATIVE_CONTROLLER': return '控制器相关 API';
case 'ARKWEB_NATIVE_WEB_MESSAGE_PORT': return 'WebMessagePort 相关 API';
case 'ARKWEB_NATIVE_WEB_MESSAGE': return 'WebMessage 相关 API';
case 'ARKWEB_NATIVE_COOKIE_MANAGER': return 'CookieManager 相关 API';
case 'ARKWEB_NATIVE_JAVASCRIPT_VALUE': return 'JavaScriptValue 相关 API';
default: return name;
}
}
export function describeArkWebWebMessageTypeByName(name: string): string {
switch (name) {
case 'ARKWEB_NONE': return '错误数据';
case 'ARKWEB_STRING': return '字符串';
case 'ARKWEB_BUFFER': return '字节流';
default: return name;
}
}
export function describeArkWebJavaScriptValueTypeByName(name: string): string {
switch (name) {
case 'ARKWEB_JAVASCRIPT_NONE': return '错误数据';
case 'ARKWEB_JAVASCRIPT_STRING': return '字符串';
case 'ARKWEB_JAVASCRIPT_BOOL': return '布尔';
default: return name;
}
}
export function describeArkWebNetErr(code: number): string {
switch (code) {
case 0: return '正常';
case -2: return '通用失败';
case -7: return '请求超时';
case -100: return '连接关闭';
case -101: return '连接被重置';
case -102: return '连接被拒绝';
case -105: return '主机名解析失败';
case -106: return '网络断开';
case -107: return 'SSL 协议错误';
default: return `未知网络错误 (${code})`;
}
}
export function describeArkWebCustomSchemeOptionByName(name: string): string {
switch (name) {
case 'OH_ARKWEB_SCHEME_OPTION_NONE': return '无额外配置';
case 'ARKWEB_SCHEME_OPTION_STANDARD': return '标准Scheme(遵循RFC1738解析)';
case 'ARKWEB_SCHEME_OPTION_LOCAL': return '本地安全规则(类似file)';
case 'ARKWEB_SCHEME_OPTION_DISPLAY_ISOLATED': return '显示隔离(仅同Scheme展示)';
case 'ARKWEB_SCHEME_OPTION_SECURE': return '安全规则(类似https)';
case 'ARKWEB_SCHEME_OPTION_CORS_ENABLED': return '允许跨域CORS';
case 'ARKWEB_SCHEME_OPTION_CSP_BYPASSING': return '可绕过CSP校验';
case 'ARKWEB_SCHEME_OPTION_FETCH_ENABLED': return '允许Fetch API';
case 'ARKWEB_SCHEME_OPTION_CODE_CACHE_ENABLED': return '允许JS生成代码缓存';
default: return name;
}
}
export function describeArkWebResourceTypeByName(name: string): string {
switch (name) {
case 'MAIN_FRAME': return '顶层页面';
case 'SUB_FRAME': return '子页面/iframe';
case 'STYLE_SHEET': return '样式表';
case 'SCRIPT': return '脚本';
case 'IMAGE': return '图片';
case 'FONT_RESOURCE': return '字体';
case 'SUB_RESOURCE': return '子资源(默认/未知)';
case 'OBJECT': return '插件对象';
case 'MEDIA': return '媒体资源';
case 'WORKER': return 'Dedicated Worker 主资源';
case 'SHARED_WORKER': return 'Shared Worker 主资源';
case 'PREFETCH': return '预取';
case 'FAVICON': return '站点图标';
case 'XHR': return 'XHR 请求';
case 'PING': return 'Ping/Beacon';
case 'SERVICE_WORKER': return 'Service Worker 主资源';
case 'CSP_REPORT': return 'CSP 违规上报';
case 'PLUGIN_RESOURCE': return '插件请求的资源';
case 'NAVIGATION_PRELOAD_MAIN_FRAME': return '主框架导航预加载';
case 'NAVIGATION_PRELOAD_SUB_FRAME': return '子框架导航预加载';
default: return name;
}
}
import { registerComponent } from '../registry';
@Component
export default struct LoadingOverlay {
@Prop visible: boolean = false
@Prop message: string = '加载中'
@State dots: string = ''
private timerId: number = -1
private start() {
if (this.timerId !== -1) { return }
this.dots = ''
this.timerId = Number(setInterval(() => {
this.dots = this.dots.length >= 3 ? '' : this.dots + '.'
}, 400))
}
private stop() {
if (this.timerId !== -1) {
clearInterval(this.timerId)
this.timerId = -1
}
this.dots = ''
}
build() {
if (this.visible) {
Stack() {
Column() {
Text(`${this.message}${this.dots}`).fontSize(18).fontColor('#FFFFFF')
}
.width('100%')
.height('100%')
.backgroundColor('rgba(0,0,0,0.5)')
.justifyContent(FlexAlign.Center)
.zIndex(999)
.onAppear(() => { this.start() })
.onDisAppear(() => { this.stop() })
}
.width('100%')
.height('100%')
}
}
}
@Builder
export function BuildLoadingOverlay(visible: boolean, message: string) {
LoadingOverlay({ visible: visible, message: message })
}
@Builder
export function BuildLoadingOverlayDefault() {
LoadingOverlay()
}
registerComponent('LoadingOverlay', BuildLoadingOverlayDefault)
import * as lib from 'libentry.so';
import promptAction from '@ohos.promptAction';
function showApiTooHighToast(): void {
try { promptAction.showToast({ message: '当前API版本过高,请升级系统后再进行操作' }); } catch (_) {}
}
export function safeNumberCall(invoke: () => number): number {
try {
const r: number = invoke();
if (r === -10001) {
showApiTooHighToast();
}
return r;
} catch (e) {
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
return -1;
}
}
export function safeStringCall(invoke: () => string): string {
try {
const r: string = invoke();
if (r === 'API_VERSION_TOO_HIGH') {
showApiTooHighToast();
}
return r;
} catch (e) {
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
return 'error';
}
}
export function safeStringCallSilent(invoke: () => string): string {
try {
const r: string = invoke();
return r;
} catch (e) {
return 'error';
}
}
export function safeBooleanCall(invoke: () => boolean): boolean {
try {
const r: boolean = invoke();
return r;
} catch (e) {
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
return false;
}
}
export function safeDoubleCall(invoke: () => number): number {
try {
const r: number = invoke();
if (r === -10001) {
showApiTooHighToast();
}
return r;
} catch (e) {
try { promptAction.showToast({ message: '调用失败' }); } catch (_) {}
return -1;
}
}
import './AVCodecKit/AVCapabilityView'
export type ComponentBuilder = () => void
const R: Map<string, ComponentBuilder> = new Map()
export function registerComponent(name: string, builder: ComponentBuilder) { R.set(name, builder) }
export function getComponent(name: string): ComponentBuilder | undefined { return R.get(name) }
declare module 'libentry.so' {
export function avcGetName(mime: string, isEncoder: number): string;
export function avcGetMaxSupportedInstances(mime: string, isEncoder: number): number;
export function avcIsHardware(mime: string, isEncoder: number): number;
export function avcGetEncoderBitrateRange(mime: string): string;
export function avcGetVideoWidthRange(mime: string, isEncoder: number): string;
export function avcGetVideoHeightRange(mime: string, isEncoder: number): string;
export function avcIsVideoSizeSupported(mime: string, isEncoder: number, width: number, height: number): number;
export function getAVCapabilityEnumValuesJson(): string;
export function avcGetVideoFrameRateRange(mime: string, isEncoder: number): string;
export function avcGetNameByCategory(mime: string, isEncoder: number, category: number): string;
export function avcGetVideoWidthAlignment(mime: string, isEncoder: number): number;
export function avcGetVideoHeightAlignment(mime: string, isEncoder: number): number;
export function avcGetVideoWidthRangeForHeight(mime: string, isEncoder: number, height: number): string;
export function avcGetVideoHeightRangeForWidth(mime: string, isEncoder: number, width: number): string;
export function avcGetVideoFrameRateRangeForSize(mime: string, isEncoder: number, width: number, height: number): string;
export function avcAreVideoSizeAndFrameRateSupported(mime: string, isEncoder: number, width: number, height: number, frameRate: number): number;
export function avcIsFeatureSupported(mime: string, isEncoder: number, feature: number): number;
export function avcGetFeaturePropertiesDump(mime: string, isEncoder: number, feature: number): string;
export function avcGetAudioSupportedSampleRates(mime: string, isEncoder: number): string;
export function avcGetAudioSupportedSampleRateRanges(mime: string, isEncoder: number): string;
export function avcGetAudioChannelCountRange(mime: string, isEncoder: number): string;
export function avcGetVideoSupportedPixelFormats(mime: string, isEncoder: number): string;
export function avcGetSupportedProfiles(mime: string, isEncoder: number): string;
export function avcGetSupportedLevelsForProfile(mime: string, isEncoder: number, profile: number): string;
export function avcAreProfileAndLevelSupported(mime: string, isEncoder: number, profile: number, level: number): number;
export function avcIsEncoderBitrateModeSupported(mime: string, bitrateMode: number): number;
export function avcGetEncoderQualityRange(mime: string): string;
export function avcGetEncoderComplexityRange(mime: string): string;
}
{
"module": {
"name": "entry",
"type": "entry",
"description": "$string:module_desc",
"mainElement": "EntryAbility",
"deviceTypes": [
"phone"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"querySchemes": [
"file",
"https",
"content"
],
"requestPermissions": [
{
"name": "ohos.permission.CAMERA",
"reason": "$string:camera_desc",
"usedScene": {
"abilities": ["EntryAbility"]
}
},
{
"name": "ohos.permission.GET_BUNDLE_INFO",
"reason": "$string:get_bundle_info_desc",
"usedScene": {
"abilities": ["EntryAbility", "ResourceAbility"]
}
},
{
"name": "ohos.permission.INTERNET",
"reason": "$string:internet_desc",
"usedScene": {
"abilities": ["EntryAbility"]
}
}
,
{
"name": "ohos.permission.PRINT",
"reason": "$string:print_desc",
"usedScene": {
"abilities": ["EntryAbility"]
}
}
],
"abilities": [
{
"name": "EntryAbility",
"srcEntry": "./ets/entryability/EntryAbility.ets",
"description": "$string:EntryAbility_desc",
"icon": "$media:layered_image",
"label": "$string:EntryAbility_label",
"startWindowIcon": "$media:startIcon",
"startWindowBackground": "$color:start_window_background",
"exported": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"ohos.want.action.home"
]
}
]
},
{
"name": "ResourceAbility",
"srcEntry": "./ets/entryability/ResourceAbility.ets",
"description": "$string:ResourceAbility_desc",
"icon": "$media:startIcon",
"label": "$string:ResourceAbility_label",
"startWindowIcon": "$media:startIcon",
"startWindowBackground": "$color:start_window_background",
"exported": true,
"skills": [
{
"entities": [
"entity.system.browsable"
],
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{ "scheme": "file", "type": "image/png" },
{ "scheme": "file", "type": "image/jpeg" },
{ "scheme": "content", "type": "image/png" },
{ "scheme": "content", "type": "image/jpeg" }
]
}
]
}
],
"extensionAbilities": [
{
"name": "EntryBackupAbility",
"srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
"type": "backup",
"exported": false,
"metadata": [
{
"name": "ohos.extension.backup",
"resource": "$profile:backup_config"
}
],
}
]
}
}
{
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
{
"float": [
{
"name": "page_text_font_size",
"value": "50fp"
}
]
}
{
"string": [
{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "label"
},
{
"name": "camera_desc",
"value": "用于相机能力演示"
},
{
"name": "get_bundle_info_desc",
"value": "用于获取应用信息"
}
,
{
"name": "internet_desc",
"value": "用于访问网络媒体资源"
}
,
{
"name": "ResourceAbility_desc",
"value": "用于处理图片类型(image/png, image/jpeg)的查看请求"
},
{
"name": "ResourceAbility_label",
"value": "资源处理能力"
}
,
{
"name": "print_desc",
"value": "用于打印和扫描功能"
}
]
}
{
"layered-image":
{
"background" : "$media:background",
"foreground" : "$media:foreground"
}
}
\ No newline at end of file
{
"allowToBackupRestore": true
}
\ No newline at end of file
{
"src": [
"pages/Index",
"pages/ComponentDetail"
]
}
{
"color": [
{
"name": "start_window_background",
"value": "#000000"
}
]
}
\ No newline at end of file
[
{
"kit": "Ability Kit(程序框架服务)",
"children": [
{
"component": "AbilityAccessControl",
"children": [
{
"header": "ability_access_control.h",
"api": ["OH_AT_CheckSelfPermission"]
}
]
},
{
"component": "AbilityBase",
"children": [
{
"header": "ability_base_common.h"
},
{
"header": "want.h"
}
]
},
{
"component": "AbilityRuntime",
"children": [
{
"header": "ability_runtime_common.h"
},
{
"header": "application_context.h"
},
{
"header": "context_constant.h"
},
{
"header": "start_options.h"
}
]
},
{
"component": "NativeBundle",
"children": [
{
"header": "native_interface_bundle.h"
}
]
},
{
"component": "ChildProcess",
"children": [
{
"header": "native_child_process.h"
}
]
}
]
},
{
"kit": "ArkData(方舟数据管理)",
"children": [
{
"component": "Preferences",
"children": [
{
"header": "oh_preferences.h"
},
{
"header": "oh_preferences_err_code.h"
},
{
"header": "oh_preferences_option.h"
},
{
"header": "oh_preferences_value.h"
}
]
},
{
"component": "RDB",
"children": [
{
"header": "data_asset.h"
},
{
"header": "oh_cursor.h"
},
{
"header": "oh_data_value.h"
},
{
"header": "oh_data_values.h"
},
{
"header": "oh_data_values_buckets.h"
},
{
"header": "oh_predicates.h"
},
{
"header": "oh_rdb_crypto_param.h"
},
{
"header": "oh_rdb_transaction.h"
},
{
"header": "oh_rdb_types.h"
},
{
"header": "oh_value_object.h"
},
{
"header": "oh_values_bucket.h"
},
{
"header": "relational_store.h"
},
{
"header": "relational_store_error_code.h"
}
]
},
{
"component": "UDMF",
"children": [
{
"header": "udmf.h"
},
{
"header": "udmf_err_code.h"
},
{
"header": "udmf_meta.h"
},
{
"header": "uds.h"
},
{
"header": "utd.h"
}
]
}
]
},
{
"kit": "ArkUI(方舟UI框架)",
"children": [
{
"component": "ArkUI_NativeModule",
"children": [
{
"header": "drag_and_drop.h"
},
{
"header": "drawable_descriptor.h"
},
{
"header": "native_animate.h"
},
{
"header": "native_dialog.h"
},
{
"header": "native_gesture.h"
},
{
"header": "native_interface.h"
},
{
"header": "native_interface_focus.h"
},
{
"header": "native_key_event.h"
},
{
"header": "native_node.h"
},
{
"header": "native_node_napi.h"
},
{
"header": "native_type.h"
},
{
"header": "styled_string.h"
}
]
},
{
"component": "ArkUI_Accessibility",
"children": [
{
"header": "native_interface_accessibility.h"
}
]
},
{
"component": "OH_NativeXComponent Native XComponent",
"children": [
{
"header": "native_interface_xcomponent.h"
},
{
"header": "native_xcomponent_key_event.h"
}
]
},
{
"component": "ArkUI_EventModule",
"children": [
{
"header": "ui_input_event.h"
}
]
},
{
"component": "WindowManager",
"children": [
{
"header": "oh_window.h"
},
{
"header": "oh_window_comm.h"
},
{
"header": "oh_window_event_filter.h"
},
{
"header": "oh_window_pip.h"
}
]
},
{
"component": "OH_DisplayManager",
"children": [
{
"header": "oh_display_capture.h"
},
{
"header": "oh_display_info.h"
},
{
"header": "oh_display_manager.h"
}
]
},
{
"component": "ArkUI_RenderNodeUtils",
"children": [
{
"header": "native_render.h"
}
]
}
]
},
{
"kit": "ArkWeb(方舟Web)",
"children": [
{
"component": "Web",
"children": [
{
"header": "arkweb_error_code.h"
},
{
"header": "arkweb_interface.h"
},
{
"header": "arkweb_net_error_list.h"
},
{
"header": "arkweb_scheme_handler.h"
},
{
"header": "arkweb_type.h"
},
{
"header": "native_interface_arkweb.h"
}
]
}
]
},
{
"kit": "Background Tasks Kit(后台任务开发服务)",
"children": [
{
"component": "BackgroundProcessManager",
"children": [
{
"header": "background_process_manager.h"
}
]
},
{
"component": "TransientTask",
"children": [
{
"header": "transient_task_api.h"
},
{
"header": "transient_task_type.h"
}
]
}
]
},
{
"kit": "Core File Kit(文件基础服务)",
"children": [
{
"component": "Environment",
"children": [
{
"header": "oh_environment.h"
}
]
},
{
"component": "FileIO",
"children": [
{
"header": "error_code.h"
},
{
"header": "oh_fileio.h"
}
]
},
{
"component": "fileShare",
"children": [
{
"header": "oh_file_share.h"
}
]
},
{
"component": "fileUri",
"children": [
{
"header": "oh_file_uri.h"
}
]
}
]
},
{
"kit": "Data Augmentation Kit(数据增强服务)",
"children": [
{
"component": "AIP",
"children": [
{
"header": "aip_error_code.h"
}
]
},
{
"component": "Retrieval",
"children": [
{
"header": "aip_retrieval.h"
},
{
"header": "aip_retrieval_condition.h"
},
{
"header": "aip_retrieval_condition_vector.h"
},
{
"header": "aip_retrieval_query.h"
},
{
"header": "aip_retrieval_record.h"
}
]
}
]
},
{
"kit": "IME Kit(输入法开发服务)",
"children": [
{
"component": "InputMethod",
"children": [
{
"header": "inputmethod_attach_options_capi.h"
},
{
"header": "inputmethod_controller_capi.h"
},
{
"header": "inputmethod_cursor_info_capi.h"
},
{
"header": "inputmethod_inputmethod_proxy_capi.h"
},
{
"header": "inputmethod_private_command_capi.h"
},
{
"header": "inputmethod_text_avoid_info_capi.h"
},
{
"header": "inputmethod_text_config_capi.h"
},
{
"header": "inputmethod_text_editor_proxy_capi.h"
},
{
"header": "inputmethod_types_capi.h"
}
]
}
]
},
{
"kit": "IPC Kit(进程间通信服务)",
"children": [
{
"component": "OHIPCParcel",
"children": [
{
"header": "ipc_cparcel.h"
}
]
},
{
"component": "OHIPCRemoteObject",
"children": [
{
"header": "ipc_cremote_object.h"
}
]
},
{
"component": "OHIPCSkeleton",
"children": [
{
"header": "ipc_cskeleton.h"
}
]
},
{
"component": "OHIPCErrorCode",
"children": [
{
"header": "ipc_error_code.h"
}
]
},
{
"component": "IPCKit",
"children": [
{
"header": "ipc_kit.h"
}
]
}
]
},
{
"kit": "Localization Kit(本地化开发服务)",
"children": [
{
"component": "rawfile",
"children": [
{
"header": "raw_dir.h"
},
{
"header": "raw_file.h"
},
{
"header": "raw_file_manager.h"
}
]
},
{
"component": "resourcemanager",
"children": [
{
"header": "ohresmgr.h"
},
{
"header": "resmgr_common.h"
}
]
}
]
},
{
"kit": "Asset Store Kit(关键资产存储服务)",
"children": [
{
"component": "AssetApi",
"children": [
{
"header": "asset_api.h"
}
]
},
{
"component": "AssetType",
"children": [
{
"header": "asset_type.h"
}
]
}
]
},
{
"kit": "Crypto Architecture Kit(加解密算法框架服务)",
"children": [
{
"component": "CryptoArchitectureKit",
"children": [
{
"header": "crypto_architecture_kit.h"
}
]
},
{
"component": "CryptoAsymCipherApi",
"children": [
{
"header": "crypto_asym_cipher.h"
}
]
},
{
"component": "CryptoAsymKeyApi",
"children": [
{
"header": "crypto_asym_key.h"
}
]
},
{
"component": "CryptoCommonApi",
"children": [
{
"header": "crypto_common.h"
}
]
},
{
"component": "CryptoDigestApi",
"children": [
{
"header": "crypto_digest.h"
}
]
},
{
"component": "CryptoKdfApi",
"children": [
{
"header": "crypto_kdf.h"
}
]
},
{
"component": "CryptoKeyAgreementApi",
"children": [
{
"header": "crypto_key_agreement.h"
}
]
},
{
"component": "CryptoMacApi",
"children": [
{
"header": "crypto_mac.h"
}
]
},
{
"component": "CryptoRandApi",
"children": [
{
"header": "crypto_rand.h"
}
]
},
{
"component": "CryptoSignatureApi",
"children": [
{
"header": "crypto_signature.h"
}
]
},
{
"component": "CryptoSymCipherApi",
"children": [
{
"header": "crypto_sym_cipher.h"
}
]
},
{
"component": "CryptoSymKeyApi",
"children": [
{
"header": "crypto_sym_key.h"
}
]
}
]
},
{
"kit": "Data Protection Kit(数据保护服务)",
"children": [
{
"component": "DlpPermissionApi",
"children": [
{
"header": "dlp_permission_api.h"
}
]
}
]
},
{
"kit": "Device Security Kit(设备安全服务)",
"children": [
{
"component": "DeviceSecurityMode",
"children": [
{
"header": "device_security_mode.h"
}
]
},
{
"component": "SecurityAudit",
"children": [
{
"header": "security_audit.h"
}
]
},
{
"component": "SecurityAntivirus",
"children": [
{
"header": "security_antivirus.h"
}
]
}
]
},
{
"kit": "Online Authentication Kit(在线认证服务)",
"children": [
{
"component": "通行密钥",
"children": [
{
"header": "fido2_api.h"
}
]
}
]
},
{
"kit": "Universal Keystore Kit(密钥管理服务)",
"children": [
{
"component": "HuksKeyApi",
"children": [
{
"header": "native_huks_api.h"
}
]
},
{
"component": "HuksParamSetApi",
"children": [
{
"header": "native_huks_param.h"
}
]
},
{
"component": "HuksTypeApi",
"children": [
{
"header": "native_huks_type.h"
}
]
}
]
},
{
"kit": "Connectivity Kit(短距通信服务)",
"children": [
{
"component": "Bluetooth",
"children": [
{
"header": "oh_bluetooth.h"
}
]
},
{
"component": "Wifi",
"children": [
{
"header": "oh_wifi.h"
}
]
}
]
},
{
"kit": "Distributed Service Kit(分布式管理服务)",
"children": [
{
"component": "DeviceManager",
"children": [
{
"header": "oh_device_manager.h"
},
{
"header": "oh_device_manager_err_code.h"
}
]
}
]
},
{
"kit": "Network Kit(网络服务)",
"children": [
{
"component": "NetConnection",
"children": [
{
"header": "net_connection.h"
},
{
"header": "net_connection_type.h"
}
]
},
{
"component": "Netstack",
"children": [
{
"header": "net_ssl_c.h"
},
{
"header": "net_ssl_c_type.h"
},
{
"header": "net_websocket.h"
},
{
"header": "net_websocket_type.h"
},
{
"header": "net_http.h"
},
{
"header": "net_http_type.h"
}
]
}
]
},
{
"kit": "Network Boost Kit(网络加速服务)",
"children": [
{
"component": "NetworkBoost",
"children": [
{
"header": "network_boost_handover.h"
},
{
"header": "network_boost_quality.h"
}
]
}
]
},
{
"kit": "Remote Communication Kit(远场通信服务)",
"children": [
{
"component": "RemoteCommunication",
"children": [
{
"header": "rcp.h"
}
]
}
]
},
{
"kit": "Service Collaboration Kit(协同服务)",
"children": [
{
"component": "ServiceCollaboration",
"children": [
{
"header": "service_collaboration_api.h"
}
]
}
]
},
{
"kit": "Telephony Kit(蜂窝通信服务)",
"children": [
{
"component": "Telephony",
"children": [
{
"header": "telephony_data.h"
},
{
"header": "telephony_radio.h"
},
{
"header": "telephony_radio_type.h"
}
]
}
]
},
{
"kit": "Basic Services Kit(基础服务)",
"children": [
{
"component": "OH_CommonEvent",
"children": [
{
"header": "oh_commonevent.h"
},
{
"header": "oh_commonevent_support.h"
}
]
},
{
"component": "DeviceInfo",
"children": [
{
"header": "deviceinfo.h"
}
]
},
{
"component": "OsAccount",
"children": [
{
"header": "os_account.h"
},
{
"header": "os_account_common.h"
}
]
},
{
"component": "OH_BatteryInfo",
"children": [
{
"header": "ohbattery_info.h"
}
]
},
{
"component": "OH_Scan",
"children": [
{
"header": "ohscan.h"
}
]
},
{
"component": "OH_Print",
"children": [
{
"header": "ohprint.h"
}
]
},
{
"component": "Pasteboard",
"children": [
{
"header": "oh_pasteboard.h"
},
{
"header": "oh_pasteboard_err_code.h"
}
]
},
{
"component": "TimeService",
"children": [
{
"header": "time_service.h"
}
]
}
]
},
{
"kit": "Function Flow Runtime Kit(任务并发调度服务)",
"children": [
{
"component": "FFRT",
"children": [
{
"header": "condition_variable.h"
},
{
"header": "fiber.h"
},
{
"header": "loop.h"
},
{
"header": "mutex.h"
},
{
"header": "queue.h"
},
{
"header": "shared_mutex.h"
},
{
"header": "sleep.h"
},
{
"header": "task.h"
},
{
"header": "timer.h"
},
{
"header": "type_def.h"
}
]
}
]
},
{
"kit": "Input Kit(多模输入服务)",
"children": [
{
"component": "input",
"children": [
{
"header": "oh_axis_type.h"
},
{
"header": "oh_input_manager.h"
},
{
"header": "oh_key_code.h"
}
]
}
]
},
{
"kit": "Kernel Enhance Kit(内核增强能力)",
"children": [
{
"component": "QoS",
"children": [
{
"header": "qos.h"
}
]
}
]
},
{
"kit": "Driver Development Kit(驱动开发服务)",
"children": [
{
"component": "BaseDdk",
"children": [
{
"header": "ddk_api.h"
},
{
"header": "ddk_types.h"
}
]
},
{
"component": "HidDdk",
"children": [
{
"header": "hid_ddk_api.h"
},
{
"header": "hid_ddk_types.h"
}
]
},
{
"component": "SCSIPeripheralDDK",
"children": [
{
"header": "scsi_peripheral_api.h"
},
{
"header": "scsi_peripheral_types.h"
}
]
},
{
"component": "UsbDDK",
"children": [
{
"header": "usb_ddk_api.h"
},
{
"header": "usb_ddk_types.h"
},
{
"header": "ddk_types.h"
}
]
},
{
"component": "USBSerialDdk",
"children": [
{
"header": "usb_serial_api.h"
},
{
"header": "usb_serial_types.h"
}
]
}
]
},
{
"kit": "Pen Kit(手写笔服务)",
"children": [
{
"component": "GlobalColorPicker",
"children": [
{
"header": "native_gcp_api.h"
}
]
},
{
"component": "HandWrite",
"children": [
{
"header": "native_handwrite_api.h"
}
]
}
]
},
{
"kit": "Sensor Service Kit(传感器服务)",
"children": [
{
"component": "Sensor",
"children": [
{
"header": "oh_sensor.h"
},
{
"header": "oh_sensor_type.h"
}
]
},
{
"component": "Vibrator",
"children": [
{
"header": "vibrator.h"
},
{
"header": "vibrator_type.h"
}
]
}
]
},
{
"kit": "Performance Analysis Kit(性能分析服务)",
"children": [
{
"component": "HiAppEvent",
"children": [
{
"header": "hiappevent.h"
},
{
"header": "hiappevent_cfg.h"
},
{
"header": "hiappevent_event.h"
},
{
"header": "hiappevent_param.h"
}
]
},
{
"component": "HiCollie",
"children": [
{
"header": "hicollie.h"
}
]
},
{
"component": "HiDebug",
"children": [
{
"header": "hidebug.h"
},
{
"header": "hidebug_type.h"
}
]
},
{
"component": "HiLog",
"children": [
{
"header": "log.h",
"api": [
"OH_LOG_Print",
"OH_LOG_PrintMsg",
"OH_LOG_PrintMsgByLen",
"OH_LOG_VPrint",
"OH_LOG_IsLoggable",
"OH_LOG_DEBUG",
"OH_LOG_INFO",
"OH_LOG_WARN",
"OH_LOG_ERROR",
"OH_LOG_FATAL",
"OH_LOG_SetCallback",
"OH_LOG_SetMinLogLevel",
"OH_LOG_SetLogLevel"
]
}
]
},
{
"component": "HiTrace",
"children": [
{
"header": "trace.h"
}
]
}
]
},
{
"kit": "Audio Kit(音频服务)",
"children": [
{
"component": "OHAudio",
"children": [
{
"header": "native_audiocapturer.h"
},
{
"header": "native_audio_manager.h"
},
{
"header": "native_audio_resource_manager.h"
},
{
"header": "native_audio_routing_manager.h"
},
{
"header": "native_audio_session_manager.h"
},
{
"header": "native_audio_stream_manager.h"
},
{
"header": "native_audio_volume_manager.h"
},
{
"header": "native_audiorenderer.h"
},
{
"header": "native_audio_common.h"
},
{
"header": "native_audio_device_base.h"
},
{
"header": "native_audiostream_base.h"
},
{
"header": "native_audiostreambuilder.h"
}
]
}
]
},
{
"kit": "AVCodec Kit(音视频编解码服务)",
"children": [
{
"component": "AVCapability",
"children": [
{
"header": "native_avcapability.h"
}
]
},
{
"component": "AudioCodec",
"children": [
{
"header": "native_avcodec_audiocodec.h"
}
]
},
{
"component": "CodecBase",
"children": [
{
"header": "avcodec_audio_channel_layout.h"
},
{
"header": "native_avcodec_base.h"
}
]
},
{
"component": "Core",
"children": [
{
"header": "media_types.h"
},
{
"header": "native_audio_channel_layout.h"
},
{
"header": "native_avbuffer.h"
},
{
"header": "native_avbuffer_info.h"
},
{
"header": "native_averrors.h"
},
{
"header": "native_avformat.h"
},
{
"header": "native_avmemory.h"
}
]
},
{
"component": "VideoDecoder",
"children": [
{
"header": "native_avcodec_videodecoder.h"
}
]
},
{
"component": "VideoEncoder",
"children": [
{
"header": "native_avcodec_videoencoder.h"
}
]
},
{
"component": "AVDemuxer",
"children": [
{
"header": "native_avdemuxer.h"
}
]
},
{
"component": "AVMuxer",
"children": [
{
"header": "native_avmuxer.h"
}
]
},
{
"component": "AVSource",
"children": [
{
"header": "native_avsource.h"
}
]
},
{
"component": "Multimedia_Drm",
"children": [
{
"header": "native_cencinfo.h"
}
]
}
]
},
{
"kit": "AVSession Kit(音视频播控服务)",
"children": [
{
"component": "OHAVSession",
"children": [
{
"header": "native_avmetadata.h"
},
{
"header": "native_avsession.h"
},
{
"header": "native_avsession_errors.h"
}
]
}
]
},
{
"kit": "Camera Kit(相机服务)",
"children": [
{
"component": "OH_Camera",
"children": [
{
"header": "camera.h"
},
{
"header": "camera_device.h"
},
{
"header": "camera_input.h"
},
{
"header": "camera_manager.h"
},
{
"header": "capture_session.h"
},
{
"header": "metadata_output.h"
},
{
"header": "photo_native.h"
},
{
"header": "photo_output.h"
},
{
"header": "preview_output.h"
},
{
"header": "video_output.h"
}
]
}
]
},
{
"kit": "DRM Kit(数字版权保护服务)",
"children": [
{
"component": "Drm",
"children": [
{
"header": "native_drm_common.h"
},
{
"header": "native_drm_err.h"
},
{
"header": "native_mediakeysession.h"
},
{
"header": "native_mediakeysystem.h"
}
]
}
]
},
{
"kit": "Image Kit(图片处理服务)",
"children": [
{
"component": "Image_NativeModule",
"children": [
{
"header": "image_common.h"
},
{
"header": "image_native.h"
},
{
"header": "image_packer_native.h"
},
{
"header": "image_receiver_native.h"
},
{
"header": "image_source_native.h"
},
{
"header": "picture_native.h"
},
{
"header": "pixelmap_native.h"
}
]
},
{
"component": "Image",
"children": [
{
"header": "image_mdk.h"
},
{
"header": "image_mdk_common.h"
},
{
"header": "image_packer_mdk.h"
},
{
"header": "image_pixel_map_mdk.h"
},
{
"header": "image_pixel_map_napi.h"
},
{
"header": "image_receiver_mdk.h"
},
{
"header": "image_source_mdk.h"
}
]
},
{
"component": "ImageEffect",
"children": [
{
"header": "image_effect.h"
},
{
"header": "image_effect_errors.h"
},
{
"header": "image_effect_filter.h"
}
]
},
{
"component": "ImageProcessing",
"children": [
{
"header": "image_processing.h"
},
{
"header": "image_processing_types.h"
}
]
}
]
},
{
"kit": "Media Kit(媒体服务)",
"children": [
{
"component": "AVImageGenerator",
"children": [
{
"header": "avimage_generator.h"
},
{
"header": "avimage_generator_base.h"
}
]
},
{
"component": "AVMetadataExtractor",
"children": [
{
"header": "avmetadata_extractor.h"
},
{
"header": "avmetadata_extractor_base.h"
}
]
},
{
"component": "AVPlayer",
"children": [
{
"header": "avplayer.h"
},
{
"header": "avplayer_base.h"
}
]
},
{
"component": "AVRecorder",
"children": [
{
"header": "avrecorder.h"
},
{
"header": "avrecorder_base.h"
}
]
},
{
"component": "AVTranscoder",
"children": [
{
"header": "avtranscoder.h"
},
{
"header": "avtranscoder_base.h"
}
]
},
{
"component": "AVScreenCapture",
"children": [
{
"header": "native_avscreen_capture.h"
},
{
"header": "native_avscreen_capture_base.h"
},
{
"header": "native_avscreen_capture_errors.h"
}
]
},
{
"component": "AVSinkBase",
"children": [
{
"header": "lowpower_avsink_base.h"
}
]
},
{
"component": "LowPowerAudioSink",
"children": [
{
"header": "lowpower_audio_sink.h"
},
{
"header": "lowpower_audio_sink_base.h"
}
]
},
{
"component": "LowPowerVideoSink",
"children": [
{
"header": "lowpower_video_sink.h"
},
{
"header": "lowpower_video_sink_base.h"
}
]
},
{
"component": "VideoProcessing",
"children": [
{
"header": "video_processing.h"
},
{
"header": "video_processing_types.h"
}
]
}
]
},
{
"kit": "Media Library Kit(媒体文件管理服务)",
"children": [
{
"component": "MediaAssetManager",
"children": [
{
"header": "media_access_helper_capi.h"
},
{
"header": "media_asset_base_capi.h"
},
{
"header": "media_asset_capi.h"
},
{
"header": "media_asset_change_request_capi.h"
},
{
"header": "media_asset_manager_capi.h"
},
{
"header": "moving_photo_capi.h"
}
]
}
]
},
{
"kit": "AR Engine(AR引擎服务)",
"children": [
{
"component": "AR Engine",
"children": [
{
"header": "ar_engine_core.h"
}
]
}
]
},
{
"kit": "ArkGraphics 2D(方舟2D图形服务",
"children": [
{
"component": "OH_NativeBuffer",
"children": [
{
"header": "buffer_common.h"
},
{
"header": "native_buffer.h"
}
]
},
{
"component": "NativeColorSpaceManager",
"children": [
{
"header": "native_color_space_manager.h"
}
]
},
{
"component": "NativeDisplaySoloist",
"children": [
{
"header": "native_display_soloist.h"
}
]
},
{
"component": "Drawing",
"children": [
{
"header": "drawing_bitmap.h"
},
{
"header": "drawing_brush.h"
},
{
"header": "drawing_canvas.h"
},
{
"header": "drawing_color.h"
},
{
"header": "drawing_color_filter.h"
},
{
"header": "drawing_color_space.h"
},
{
"header": "drawing_error_code.h"
},
{
"header": "drawing_filter.h"
},
{
"header": "drawing_font.h"
},
{
"header": "drawing_font_collection.h"
},
{
"header": "drawing_font_mgr.h"
},
{
"header": "drawing_gpu_context.h"
},
{
"header": "drawing_image.h"
},
{
"header": "drawing_image_filter.h"
},
{
"header": "drawing_mask_filter.h"
},
{
"header": "drawing_matrix.h"
},
{
"header": "drawing_memory_stream.h"
},
{
"header": "drawing_path.h"
},
{
"header": "drawing_path_effect.h"
},
{
"header": "drawing_pen.h"
},
{
"header": "drawing_pixel_map.h"
},
{
"header": "drawing_point.h"
},
{
"header": "drawing_record_cmd.h"
},
{
"header": "drawing_rect.h"
},
{
"header": "drawing_region.h"
},
{
"header": "drawing_register_font.h"
},
{
"header": "drawing_round_rect.h"
},
{
"header": "drawing_sampling_options.h"
},
{
"header": "drawing_shader_effect.h"
},
{
"header": "drawing_shadow_layer.h"
},
{
"header": "drawing_surface.h"
},
{
"header": "drawing_text_blob.h"
},
{
"header": "drawing_text_declaration.h"
},
{
"header": "drawing_text_font_descriptor.h"
},
{
"header": "drawing_text_global.h"
},
{
"header": "drawing_text_line.h"
},
{
"header": "drawing_text_lineTypography.h"
},
{
"header": "drawing_text_run.h"
},
{
"header": "drawing_text_typography.h"
},
{
"header": "drawing_typeface.h"
},
{
"header": "drawing_types.h"
}
]
},
{
"component": "effectKit",
"children": [
{
"header": "effect_filter.h"
},
{
"header": "effect_types.h"
}
]
},
{
"component": "OH_NativeImage",
"children": [
{
"header": "native_image.h"
}
]
},
{
"component": "NativeVsync",
"children": [
{
"header": "native_vsync.h"
}
]
},
{
"component": "NativeWindow",
"children": [
{
"header": "buffer_handle.h"
},
{
"header": "external_window.h"
},
{
"header": "graphic_error_code.h"
}
]
},
{
"component": "NativeFence",
"children": [
{
"header": "native_fence.h"
}
]
}
]
},
{
"kit": "Graphics Accelerate Kit(图形加速服务)",
"children": [
{
"component": "GraphicsAccelerate",
"children": [
{
"header": "abr_base.h"
},
{
"header": "abr_gles.h"
},
{
"header": "frame_generation_base.h"
},
{
"header": "frame_generation_gles.h"
},
{
"header": "frame_generation_vk.h"
},
{
"header": "opengtx_base.h"
}
]
}
]
},
{
"kit": "XEngine Kit(GPU加速引擎服务",
"children": [
{
"component": "XEngine",
"children": [
{
"header": "xeg_extension_defs.h"
},
{
"header": "xeg_gles_adaptive_vrs.h"
},
{
"header": "xeg_gles_extension.h"
},
{
"header": "xeg_gles_neural_upscale.h"
},
{
"header": "xeg_gles_spatial_upscale.h"
},
{
"header": "xeg_gles_temporal_upscale.h"
},
{
"header": "xeg_vulkan_adaptive_vrs.h"
},
{
"header": "xeg_vulkan_common.h"
},
{
"header": "xeg_vulkan_extension.h"
},
{
"header": "xeg_vulkan_hps.h"
},
{
"header": "xeg_vulkan_rt_reflection.h"
},
{
"header": "xeg_vulkan_rt_visible_mask.h"
},
{
"header": "xeg_vulkan_rtgi.h"
},
{
"header": "xeg_vulkan_spatial_upscale.h"
},
{
"header": "xeg_vulkan_temporal_upscale.h"
}
]
}
]
},
{
"kit": "AppGallery Kit(应用市场服务)",
"children": [
{
"component": "ModuleInstall",
"children": [
{
"header": "module_install.h"
}
]
}
]
},
{
"kit": "Game Service Kit(游戏服务)",
"children": [
{
"component": "GamePerformance",
"children": [
{
"header": "game_performance.h"
}
]
}
]
},
{
"kit": "Location Kit(位置服务)",
"children": [
{
"component": "Location",
"children": [
{
"header": "oh_location.h"
},
{
"header": "oh_location_type.h"
}
]
}
]
},
{
"kit": "Notification Kit(用户通知服务)",
"children": [
{
"component": "NOTIFICATION",
"children": [
{
"header": "notification.h"
}
]
}
]
},
{
"kit": "Preview Kit(文件预览服务)",
"children": [
{
"component": "Preview",
"children": [
{
"header": "open_file_boost.h"
},
{
"header": "preview_kit.h"
}
]
}
]
},
{
"kit": "CANN Kit(CANN 服务)",
"children": [
{
"component": "CANN",
"children": [
{
"header": "hiai_aipp_param.h"
},
{
"header": "hiai_helper.h"
},
{
"header": "hiai_options.h"
},
{
"header": "hiai_single_op.h"
},
{
"header": "hiai_tensor.h"
}
]
}
]
},
{
"kit": "MindSpore Lite Kit(昇思推理框架服务)",
"children": [
{
"component": "MindSpore",
"children": [
{
"header": "context.h"
},
{
"header": "data_type.h"
},
{
"header": "format.h"
},
{
"header": "model.h"
},
{
"header": "status.h"
},
{
"header": "tensor.h"
},
{
"header": "types.h"
}
]
}
]
},
{
"kit": "Neural Network Runtime Kit(Neural Network运行时服务)",
"children": [
{
"component": "NeuralNetworkRuntime",
"children": [
{
"header": "neural_network_core.h"
},
{
"header": "neural_network_runtime.h"
},
{
"header": "neural_network_runtime_type.h"
}
]
}
]
},
{
"kit": "公共基础能力",
"children": [
{
"component": "Init",
"children": [
{
"header": "syscap_ndk.h"
}
]
},
{
"component": "memory",
"children": [
{
"header": "purgeable_memory.h"
}
]
},
{
"component": "JSVM",
"children": [
{
"header": "jsvm.h"
},
{
"header": "jsvm_types.h"
}
]
}
]
},
{
"kit": "TEEkit(可信执行环境API)",
"children": [
{
"component": "TeeTrusted",
"children": [
{
"header": "TEEKit/tee/tee_defines.h"
},
{
"header": "TEEKit/tee/tee_apm_api.h"
},
{
"header": "TEEKit/tee/pthread_attr.h"
},
{
"header": "TEEKit/tee/tee_internal_se_api.h"
},
{
"header": "TEEKit/tee/tee_rtc_time_api.h"
},
{
"header": "TEEKit/tee/tee_sharemem_ops.h"
},
{
"header": "TEEKit/tee/tee_mem_mgmt_api.h"
},
{
"header": "TEEKit/tee/tee_log.h"
},
{
"header": "TEEKit/tee/tee_hw_ext_api.h"
},
{
"header": "TEEKit/tee/tee_crypto_api.h"
},
{
"header": "TEEKit/tee/tee_drv_client.h"
},
{
"header": "TEEKit/tee/tee_get_recoverymode.h"
},
{
"header": "TEEKit/tee/tee_dynamic_srv.h"
},
{
"header": "TEEKit/tee/dstb_api.h"
},
{
"header": "TEEKit/tee/tee_time_api.h"
},
{
"header": "TEEKit/tee/tee_sharemem.h"
},
{
"header": "TEEKit/tee/tee_core_api.h"
},
{
"header": "TEEKit/tee/tee_notify_set_priority.h"
},
{
"header": "TEEKit/tee/tee_ext_api.h"
},
{
"header": "TEEKit/tee/tee_service_public.h"
},
{
"header": "TEEKit/tee/tee_arith_api.h"
},
{
"header": "TEEKit/tee/tee_trusted_storage_api.h"
},
{
"header": "TEEKit/tee/rpmb_driver_rw_api.h"
},
{
"header": "TEEKit/tee/rpmb_fcntl.h"
},
{
"header": "TEEKit/tee/tee_tui_gp_api.h"
},
{
"header": "TEEKit/tee/tee_object_api.h"
},
{
"header": "TEEKit/tee/tee_agent.h"
},
{
"header": "TEEKit/tee/tee_crypto_hal.h"
},
{
"header": "TEEKit/tee/tee_property_api.h"
},
{
"header": "TEEKit/tee/tee_hw_ext_api_legacy.h"
}
]
},
{
"component": "TeeClient",
"children": [
{
"header": "tee_client_constants.h"
},
{
"header": "tee_client_type.h"
},
{
"header": "tee_client_api.h"
}
]
}
]
},
{
"kit": "GLES3",
"children": [
{
"component": "GLES3",
"children": [
{
"header": "gl3.h"
},
{
"header": "gl3platform.h"
},
{
"header": "gl31.h"
},
{
"header": "gl32.h"
}
]
},
{
"component": "KHR",
"children": [
{
"header": "khrplatform.h"
}
]
}
]
},
{
"kit": "OpenSLES",
"children": [
{
"component": "SLES",
"children": [
{
"header": "OpenSLES.h"
},
{
"header": "OpenSLES_OpenHarmony.h"
},
{
"header": "OpenSLES_Platform.h"
}
]
}
]
},
{
"kit": "ICONV",
"children": [
{
"component": "ICONV",
"children": [
{
"header": "iconv.h"
}
]
}
]
},
{
"kit": "Native API",
"children": [
{
"component": "NAPI",
"children": [
{
"header": "native_api.h"
},
{
"header": "common.h"
},
{
"header": "js_native_api_types.h"
},
{
"header": "js_native_api.h"
},
{
"header": "node_api_types.h"
},
{
"header": "node_api.h"
},
{
"header": "threads.h"
},
{
"header": "shadow.h"
},
{
"header": "tgmath.h"
},
{
"header": "sysexits.h"
},
{
"header": "syscap_ndk.h"
},
{
"header": "stdalign.h"
},
{
"header": "stdnoreturn.h"
},
{
"header": "stropts.h"
},
{
"header": "iso646.h"
},
{
"header": "uv.h"
}
]
}
]
},
{
"kit": "INFO",
"children": [
{
"component": "INFO",
"children": [
{
"header": "application_target_sdk_version.h"
},
{
"header": "device_api_version.h"
},
{
"header": "fatal_message.h"
}
]
}
]
},
{
"kit": "SOUND",
"children": [
{
"component": "SOUND",
"children": [
{
"header": "asound.h"
},
{
"header": "asound_fm.h"
}
]
}
]
},
{
"kit": "VIDEO",
"children": [
{
"component": "VIDEO",
"children": [
{
"header": "edid.h"
},
{
"header": "sisfb.h"
},
{
"header": "uvesafb.h"
}
]
}
]
},
{
"kit": "ZLIB(数据压缩)",
"children": [
{
"component": "ZLIB",
"children": [
{
"header": "zconf.h"
},
{
"header": "zlib.h"
}
]
}
]
}
]
\ No newline at end of file
{
}
\ No newline at end of file
{
"module": {
"name": "entry_test",
"type": "feature",
"deviceTypes": [
"phone"
],
"deliveryWithInstall": true,
"installationFree": false
}
}
import localUnitTest from './LocalUnit.test';
export default function testsuite() {
localUnitTest();
}
\ No newline at end of file
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
export default function localUnitTest() {
describe('localUnitTest', () => {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(() => {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
});
beforeEach(() => {
// Presets an action, which is performed before each unit test case starts.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: preset action function.
});
afterEach(() => {
// Presets a clear action, which is performed after each unit test case ends.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: clear action function.
});
afterAll(() => {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
});
it('assertContain', 0, () => {
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
let a = 'abc';
let b = 'b';
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
expect(a).assertContain(b);
expect(a).assertEqual(a);
});
});
}
\ No newline at end of file
{
"modelVersion": "6.0.1",
"dependencies": {
},
"execution": {
// "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | "ultrafine" | false ]. Default: "normal" */
// "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
// "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
// "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
// "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
// "optimizationStrategy": "memory" /* Define the optimization strategy. Value: [ "memory" | "performance" ]. Default: "memory" */
},
"logging": {
// "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
},
"debugging": {
// "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
},
"nodeOptions": {
// "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
// "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
}
}
import { appTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins: [] /* Custom plugin to extend the functionality of Hvigor. */
}
\ No newline at end of file
{
"meta": {
"stableOrder": true,
"enableUnifiedLockfile": false
},
"lockfileVersion": 3,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {
"@ohos/hamock@1.0.0": "@ohos/hamock@1.0.0",
"@ohos/hypium@1.0.24": "@ohos/hypium@1.0.24"
},
"packages": {
"@ohos/hamock@1.0.0": {
"name": "@ohos/hamock",
"version": "1.0.0",
"integrity": "sha512-K6lDPYc6VkKe6ZBNQa9aoG+ZZMiwqfcR/7yAVFSUGIuOAhPvCJAo9+t1fZnpe0dBRBPxj2bxPPbKh69VuyAtDg==",
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hamock/-/hamock-1.0.0.har",
"registryType": "ohpm"
},
"@ohos/hypium@1.0.24": {
"name": "@ohos/hypium",
"version": "1.0.24",
"integrity": "sha512-3dCqc+BAR5LqEGG2Vtzi8O3r7ci/3fYU+FWjwvUobbfko7DUnXGOccaror0yYuUhJfXzFK0aZNMGSnXaTwEnbw==",
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.24.har",
"registryType": "ohpm"
}
}
}
\ No newline at end of file
{
"modelVersion": "6.0.1",
"description": "Please describe the basic information.",
"dependencies": {
},
"devDependencies": {
"@ohos/hypium": "1.0.24",
"@ohos/hamock": "1.0.0"
}
}
TEAM_ID=
PRODUCT_NAME=KMPMultiplatform
PRODUCT_BUNDLE_IDENTIFIER=com.example.kmpmultiplatform.KMPMultiplatform$(TEAM_ID)
CURRENT_PROJECT_VERSION=1
MARKETING_VERSION=1.0
\ No newline at end of file
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 77;
objects = {
/* Begin PBXFileReference section */
8601943B9DFB2C4B1760A2E7 /* KMPMultiplatform.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = KMPMultiplatform.app; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
ABC6719BBF0CED1E173B67C5 /* Exceptions for "iosApp" folder in "iosApp" target */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
Info.plist,
);
target = 093AE505BD0D968529A3BB51 /* iosApp */;
};
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
/* Begin PBXFileSystemSynchronizedRootGroup section */
F3660B7F5171E886DFBBFD1C /* iosApp */ = {
isa = PBXFileSystemSynchronizedRootGroup;
exceptions = (
ABC6719BBF0CED1E173B67C5 /* Exceptions for "iosApp" folder in "iosApp" target */,
);
path = iosApp;
sourceTree = "<group>";
};
18C7C1549408F07D4CD61DBA /* Configuration */ = {
isa = PBXFileSystemSynchronizedRootGroup;
path = Configuration;
sourceTree = "<group>";
};
/* End PBXFileSystemSynchronizedRootGroup section */
/* Begin PBXFrameworksBuildPhase section */
23D204683E60A8E33DB2EF0E /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
C8983285FE45CDEFFF808F44 = {
isa = PBXGroup;
children = (
18C7C1549408F07D4CD61DBA /* Configuration */,
F3660B7F5171E886DFBBFD1C /* iosApp */,
30CC54FE27BAEC01065699B6 /* Products */,
);
sourceTree = "<group>";
};
30CC54FE27BAEC01065699B6 /* Products */ = {
isa = PBXGroup;
children = (
8601943B9DFB2C4B1760A2E7 /* KMPMultiplatform.app */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
093AE505BD0D968529A3BB51 /* iosApp */ = {
isa = PBXNativeTarget;
buildConfigurationList = FA2E53C2D0EE90B54C809EFB /* Build configuration list for PBXNativeTarget "iosApp" */;
buildPhases = (
676CAC702DCA0D7749EED0B1 /* Compile Kotlin Framework */,
EE9A642CFBC765A8256532D0 /* Sources */,
23D204683E60A8E33DB2EF0E /* Frameworks */,
1E15D69ED76C1683397ECD97 /* Resources */,
);
buildRules = (
);
dependencies = (
);
fileSystemSynchronizedGroups = (
F3660B7F5171E886DFBBFD1C /* iosApp */,
);
name = iosApp;
packageProductDependencies = (
);
productName = iosApp;
productReference = 8601943B9DFB2C4B1760A2E7 /* KMPMultiplatform.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
6A8D4EEB5FA19A7D59DF893D /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1620;
LastUpgradeCheck = 1620;
TargetAttributes = {
093AE505BD0D968529A3BB51 = {
CreatedOnToolsVersion = 16.2;
};
};
};
buildConfigurationList = 8790773733C5A1280D86BE1D /* Build configuration list for PBXProject "iosApp" */;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = C8983285FE45CDEFFF808F44;
minimizedProjectReferenceProxies = 1;
preferredProjectObjectVersion = 77;
productRefGroup = 30CC54FE27BAEC01065699B6 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
093AE505BD0D968529A3BB51 /* iosApp */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
1E15D69ED76C1683397ECD97 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
676CAC702DCA0D7749EED0B1 /* Compile Kotlin Framework */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Compile Kotlin Framework";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ \"YES\" = \"$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED\" ]; then\n echo \"Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \\\"YES\\\"\"\n exit 0\nfi\ncd \"$SRCROOT/..\"\n./gradlew :composeApp:embedAndSignAppleFrameworkForXcode\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
EE9A642CFBC765A8256532D0 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
BBD9F423EFEC85F12B216082 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReferenceAnchor = 18C7C1549408F07D4CD61DBA /* Configuration */;
baseConfigurationReferenceRelativePath = Config.xcconfig;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 18.2;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
9E41DAE07936FE4C9B5A20D3 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReferenceAnchor = 18C7C1549408F07D4CD61DBA /* Configuration */;
baseConfigurationReferenceRelativePath = Config.xcconfig;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GCC_C_LANGUAGE_STANDARD = gnu17;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 18.2;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
85FA6F585F29F37EDCA958E2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = arm64;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
DEVELOPMENT_TEAM = "${TEAM_ID}";
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = iosApp/Info.plist;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
AB0329AB1AC9BFE95ACE9978 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = arm64;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
DEVELOPMENT_TEAM = "${TEAM_ID}";
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = iosApp/Info.plist;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
8790773733C5A1280D86BE1D /* Build configuration list for PBXProject "iosApp" */ = {
isa = XCConfigurationList;
buildConfigurations = (
BBD9F423EFEC85F12B216082 /* Debug */,
9E41DAE07936FE4C9B5A20D3 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
FA2E53C2D0EE90B54C809EFB /* Build configuration list for PBXNativeTarget "iosApp" */ = {
isa = XCConfigurationList;
buildConfigurations = (
85FA6F585F29F37EDCA958E2 /* Debug */,
AB0329AB1AC9BFE95ACE9978 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 6A8D4EEB5FA19A7D59DF893D /* Project object */;
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "app-icon-1024.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "tinted"
}
],
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
import UIKit
import SwiftUI
import ComposeApp
struct ComposeView: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> UIViewController {
MainViewControllerKt.MainViewController()
}
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}
}
struct ContentView: View {
var body: some View {
ComposeView()
.ignoresSafeArea()
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
</dict>
</plist>
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
import SwiftUI
@main
struct iOSApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
\ No newline at end of file
rootProject.name = "KMPMultiplatform"
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
pluginManagement {
repositories {
maven("https://maven.eazytec-cloud.com/nexus/repository/maven-public/")
google {
mavenContent {
includeGroupAndSubgroups("androidx")
includeGroupAndSubgroups("com.android")
includeGroupAndSubgroups("com.google")
}
}
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositories {
maven("https://maven.eazytec-cloud.com/nexus/repository/maven-public/")
google {
mavenContent {
includeGroupAndSubgroups("androidx")
includeGroupAndSubgroups("com.android")
includeGroupAndSubgroups("com.google")
}
}
mavenCentral()
}
}
include(":composeApp")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment