diff --git a/ability/DistributedScheduler/README_zh.md b/ability/DistributedScheduler/README_zh.md
index bc813c29f0f0dbef649393c1a379a6e1cd638c5b..19155e081906c5a51f54d24a855515c158d84df1 100644
--- a/ability/DistributedScheduler/README_zh.md
+++ b/ability/DistributedScheduler/README_zh.md
@@ -1,29 +1,37 @@
# 分布式任务调度
-- 开发者在应用中集成分布式调度能力,通过调用指定能力的分布式接口,实现跨设备能力调度。
+### 简介
- 根据 Ability 模板及意图的不同,分布式任务调度向开发者提供以下六种能力:启动远程 FA、启动远程 PA、关闭远程 PA、连接远程 PA、断开连接远程 PA 和 FA 跨设备迁移。
+开发者在应用中集成分布式调度能力,通过调用指定能力的分布式接口,实现跨设备能力调度。
- 下面以设备 A(本地设备)和设备 B(远端设备)为例,进行场景介绍:
+根据 Ability 模板及意图的不同,分布式任务调度向开发者提供以下六种能力:启动远程 FA、启动远程 PA、关闭远程 PA、连接远程 PA、断开连接远程 PA 和 FA 跨设备迁移。
- 1. 设备 A 启动设备 B 的 FA:在设备 A 上通过本地应用提供的启动按钮,启动设备 B 上对应的 FA。
+### 使用说明
- 例如:设备 A 控制设备 B 打开相册,只需开发者在启动 FA 时指定打开相册的意图即可。
+下面以设备 A(本地设备)和设备 B(远端设备)为例,进行场景介绍:
- 2. 设备 A 启动设备 B 的 PA:在设备 A 上通过本地应用提供的启动按钮,启动设备 B 上指定的 PA。
+1. 设备 A 启动设备 B 的 FA:在设备 A 上通过本地应用提供的启动按钮,启动设备 B 上对应的 FA。
- 例如:开发者在启动远程服务时通过意图指定音乐播放服务,即可实现设备 A 启动设备 B 音乐播放的能力。
+例如:设备 A 控制设备 B 打开相册,只需开发者在启动 FA 时指定打开相册的意图即可。
- 3. 设备 A 关闭设备 B 的 PA:在设备 A 上通过本地应用提供的关闭按钮,关闭设备 B 上指定的 PA。
+2. 设备 A 启动设备 B 的 PA:在设备 A 上通过本地应用提供的启动按钮,启动设备 B 上指定的 PA。
- 类似启动的过程,开发者在关闭远程服务时通过意图指定音乐播放服务,即可实现关闭设备 B 上该服务的能力。
+例如:开发者在启动远程服务时通过意图指定音乐播放服务,即可实现设备 A 启动设备 B 音乐播放的能力。
- 4. 设备 A 连接设备 B 的 PA:在设备 A 上通过本地应用提供的连接按钮,连接设备 B 上指定的 PA。
+3. 设备 A 关闭设备 B 的 PA:在设备 A 上通过本地应用提供的关闭按钮,关闭设备 B 上指定的 PA。
- 连接后,通过其他功能相关按钮实现控制对端 PA 的能力。通过连接关系,开发者可以实现跨设备的同步服务调度,实现如大型计算任务互助等价值场景。
+类似启动的过程,开发者在关闭远程服务时通过意图指定音乐播放服务,即可实现关闭设备 B 上该服务的能力。
- 5. 设备 A 与设备 B 的 PA 断开连接:在设备 A 上通过本地应用提供断开连接的按钮,将之前已连接的 PA 断开连接。
+4. 设备 A 连接设备 B 的 PA:在设备 A 上通过本地应用提供的连接按钮,连接设备 B 上指定的 PA。
- 6. 设备 A 的 FA 迁移至设备 B:设备 A 上通过本地应用提供的迁移按钮,将设备 A 的业务无缝迁移到设备 B 中。
+连接后,通过其他功能相关按钮实现控制对端 PA 的能力。通过连接关系,开发者可以实现跨设备的同步服务调度,实现如大型计算任务互助等价值场景。
- 通过业务迁移能力,打通设备 A 和设备 B 间的壁垒,实现如文档跨设备编辑、视频从客厅到房间跨设备接续播放等场景。
+5. 设备 A 与设备 B 的 PA 断开连接:在设备 A 上通过本地应用提供断开连接的按钮,将之前已连接的 PA 断开连接。
+
+6. 设备 A 的 FA 迁移至设备 B:设备 A 上通过本地应用提供的迁移按钮,将设备 A 的业务无缝迁移到设备 B 中。
+
+通过业务迁移能力,打通设备 A 和设备 B 间的壁垒,实现如文档跨设备编辑、视频从客厅到房间跨设备接续播放等场景。
+
+### 约束与限制
+
+本示例仅在支持大型系统上运行。
diff --git a/ability/DistributedScheduler/build.gradle b/ability/DistributedScheduler/build.gradle
index 02c896996fcc7893f6f7944fdcf432766d02a5a5..906f424fe303cd6c7ec136c703e8008bde67011f 100644
--- a/ability/DistributedScheduler/build.gradle
+++ b/ability/DistributedScheduler/build.gradle
@@ -4,7 +4,7 @@ apply plugin: 'com.huawei.ohos.app'
ohos {
compileSdkVersion 6
defaultConfig {
- compatibleSdkVersion 6
+ compatibleSdkVersion 5
}
}
diff --git a/ability/DistributedScheduler/entry/build.gradle b/ability/DistributedScheduler/entry/build.gradle
index f8ae90aed26d4446ec7eb02443883f208a547154..039f7877f91214270fa54779929e660dc5f5bc55 100644
--- a/ability/DistributedScheduler/entry/build.gradle
+++ b/ability/DistributedScheduler/entry/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'com.huawei.ohos.hap'
ohos {
compileSdkVersion 6
defaultConfig {
- compatibleSdkVersion 6
+ compatibleSdkVersion 5
}
buildTypes {
release {
diff --git a/ability/DistributedScheduler/entry/src/main/java/ohos/samples/distributedscheduler/slice/MainAbilitySlice.java b/ability/DistributedScheduler/entry/src/main/java/ohos/samples/distributedscheduler/slice/MainAbilitySlice.java
index 999fa13ea2cb1e26b96cc60668b39fe4fc8d6c22..d0f93e7ba747fef6902f8dcfe38a8b5feff325b3 100644
--- a/ability/DistributedScheduler/entry/src/main/java/ohos/samples/distributedscheduler/slice/MainAbilitySlice.java
+++ b/ability/DistributedScheduler/entry/src/main/java/ohos/samples/distributedscheduler/slice/MainAbilitySlice.java
@@ -15,11 +15,7 @@
package ohos.samples.distributedscheduler.slice;
-import ohos.aafwk.ability.continuation.ExtraParams;
-import ohos.aafwk.ability.continuation.ContinuationDeviceInfo;
-import ohos.aafwk.ability.continuation.IContinuationDeviceCallback;
-import ohos.aafwk.ability.continuation.IContinuationRegisterManager;
-import ohos.aafwk.ability.continuation.RequestCallback;
+import ohos.aafwk.ability.continuation.*;
import ohos.distributedschedule.interwork.IInitCallback;
import ohos.samples.distributedscheduler.MainAbility;
import ohos.samples.distributedscheduler.RemoteAgentProxy;
@@ -75,6 +71,8 @@ public class MainAbilitySlice extends AbilitySlice implements IAbilityContinuati
private RemoteAgentProxy remoteAgentProxy = null;
+ private String jsonParams;
+
private EventHandler eventHandler = new EventHandler(EventRunner.current()) {
@Override
protected void processEvent(InnerEvent event) {
@@ -105,8 +103,7 @@ public class MainAbilitySlice extends AbilitySlice implements IAbilityContinuati
String[] devTypes = new String[]{ExtraParams.DEVICETYPE_SMART_PAD, ExtraParams.DEVICETYPE_SMART_PHONE};
params.setDevType(devTypes);
params.setTargetBundleName(REMOTE_BUNDLE);
- String jsonParams = "{\"filter\":{\"commonFilter\":{\"groupType\":\"1|256\"}}," +
- "\"isTurnOffRecommend\":true,\"transferScene\":0}";
+ jsonParams = "{'filter':{'commonFilter':{'groupType':'1|256','faFilter':'{\"targetBundleName\":\"ohos.samples.distributedscheduler\"}'}}}";
params.setJsonParams(jsonParams);
continuationRegisterManager.register(REMOTE_BUNDLE, params, callback, requestCallback);
}
@@ -153,8 +150,6 @@ public class MainAbilitySlice extends AbilitySlice implements IAbilityContinuati
String[] devTypes = new String[]{ExtraParams.DEVICETYPE_SMART_PAD, ExtraParams.DEVICETYPE_SMART_PHONE};
params.setDevType(devTypes);
params.setTargetBundleName(REMOTE_BUNDLE);
- String jsonParams = "{\"filter\":{\"commonFilter\":{\"groupType\":\"1|256\"}}," +
- "\"isTurnOffRecommend\":true,\"transferScene\":0}";
params.setJsonParams(jsonParams);
continuationRegisterManager.showDeviceList(abilityToken, params, null);
}
@@ -162,19 +157,27 @@ public class MainAbilitySlice extends AbilitySlice implements IAbilityContinuati
private IContinuationDeviceCallback callback = new IContinuationDeviceCallback() {
@Override
public void onConnected(ContinuationDeviceInfo deviceInfo) {
- selectedDeviceId = deviceInfo.getDeviceId();
}
@Override
public void onDisconnected(String deviceId) {
- selectedDeviceId = "";
}
@Override
public void onDeviceConnectDone(String deviceId, String deviceType) {
+ HiLog.info(LABEL_LOG, "onDeviceConnectDone: " + deviceId);
+ selectedDeviceId = deviceId;
+ //更新选择设备后的流转状态
+ continuationRegisterManager.updateConnectStatus(abilityToken, selectedDeviceId, DeviceConnectState.CONNECTED.getState(), null);
+ showTips(getContext(), "device connect succeed");
}
@Override
public void onDeviceDisconnectDone(String deviceId) {
+ HiLog.info(LABEL_LOG, "onDeviceDisconnectDone: " + deviceId);
+ selectedDeviceId = "";
+ //更新选择设备后的流转状态
+ continuationRegisterManager.updateConnectStatus(abilityToken, selectedDeviceId, DeviceConnectState.IDLE.getState(), null);
+ showTips(getContext(), "device disconnected");
}
};
diff --git a/native/NativeLayer/README_zh.md b/native/NativeLayer/README_zh.md
new file mode 100644
index 0000000000000000000000000000000000000000..6e372a46c4f71be2d913891ed8a3f3edcfa652ab
--- /dev/null
+++ b/native/NativeLayer/README_zh.md
@@ -0,0 +1,19 @@
+# Native_layer
+
+
+
+### 简介
+
+Native_layer声明了与本机层相关的 JNI。本示例展示了关于Native_layer的JNI接口的使用,使应用程序能够获取与 Java 表面对象匹配的原生层,可以获取原生层信息,也可以设置原生层大小和图层格。
+
+### 使用说明
+
+1、点击**获取原生层信息**,调用JNI接口获取Surface的原生层宽、高和图层格式。
+
+2、点击**设置原生层宽和高**,在弹出的宽和高输入框中输入int型数据,点击**确定**可以设置原生层宽和高,Surface中的图形和文字会重新绘制。
+
+3、点击**设置原生层图层格式**,在在弹出的输入框中输入int型数据,点击**确定**,可以设置原生层图层格式。
+
+### 约束与限制
+
+本示例仅支持在大型系统上运行。
diff --git a/native/NativeLayer/build.gradle b/native/NativeLayer/build.gradle
new file mode 100644
index 0000000000000000000000000000000000000000..f2b0a9cc1b97c5357f3b33b6847b70e94aec8df2
--- /dev/null
+++ b/native/NativeLayer/build.gradle
@@ -0,0 +1,35 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+apply plugin: 'com.huawei.ohos.app'
+
+//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
+ohos {
+ compileSdkVersion 6
+ defaultConfig {
+ compatibleSdkVersion 5
+ }
+}
+
+buildscript {
+ repositories {
+ maven {
+ url 'https://repo.huaweicloud.com/repository/maven/'
+ }
+ maven {
+ url 'https://developer.huawei.com/repo/'
+ }
+ }
+ dependencies {
+ classpath 'com.huawei.ohos:hap:2.4.5.0'
+ }
+}
+
+allprojects {
+ repositories {
+ maven {
+ url 'https://repo.huaweicloud.com/repository/maven/'
+ }
+ maven {
+ url 'https://developer.huawei.com/repo/'
+ }
+ }
+}
diff --git a/native/NativeLayer/entry/build.gradle b/native/NativeLayer/entry/build.gradle
new file mode 100644
index 0000000000000000000000000000000000000000..69ec54f371344d0efbda4597422863ee06f53f79
--- /dev/null
+++ b/native/NativeLayer/entry/build.gradle
@@ -0,0 +1,25 @@
+apply plugin: 'com.huawei.ohos.hap'
+//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
+ohos {
+ compileSdkVersion 6
+ defaultConfig {
+ compatibleSdkVersion 5
+ }
+ buildTypes {
+ release {
+ proguardOpt {
+ proguardEnabled false
+ rulesFiles 'proguard-rules.pro'
+ }
+ }
+ }
+ externalNativeBuild {
+ path "src/main/cpp/CMakeLists.txt"
+ arguments "-v"
+ abiFilters "arm64-v8a"
+ cppFlags ""
+ }
+}
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
+}
diff --git a/native/NativeLayer/entry/src/main/config.json b/native/NativeLayer/entry/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..149a8b07ef2a4b40189d39f9b9d4765a168a32e8
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/config.json
@@ -0,0 +1,48 @@
+{
+ "app": {
+ "bundleName": "ohos.samples.nativelayer",
+ "vendor": "samples",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "ohos.samples.nativelayer",
+ "name": ".MyApplication",
+ "mainAbility": "ohos.samples.nativelayer.MainAbility",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry",
+ "installationFree": false
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "orientation": "portrait",
+ "permissions": [],
+ "name": "ohos.samples.nativelayer.MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:app_name",
+ "type": "page",
+ "launchType": "standard",
+ "visible": true
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/native/NativeLayer/entry/src/main/cpp/CMakeLists.txt b/native/NativeLayer/entry/src/main/cpp/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e4faf3d8727807a790192ca1a300b685f53a3a0c
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/cpp/CMakeLists.txt
@@ -0,0 +1,6 @@
+# the minimum version of CMake.
+cmake_minimum_required(VERSION 3.4.1)
+project(nativeLayer)
+
+add_library(nativelayer SHARED nativelayer.cpp)
+target_link_libraries(nativelayer libzgraphic.z.so)
\ No newline at end of file
diff --git a/native/NativeLayer/entry/src/main/cpp/nativelayer.cpp b/native/NativeLayer/entry/src/main/cpp/nativelayer.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..ee957a95172981079c4696d9844f6b1175cfe182
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/cpp/nativelayer.cpp
@@ -0,0 +1,44 @@
+/**************************************************************
+ Copyright (c) 2021 Huawei Device Co., Ltd.
+ 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
+
+ http://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.
+ **************************************************************/
+
+#include
+#include
+#include
+#include
+
+extern "C"
+JNIEXPORT jint JNICALL Java_ohos_samples_nativelayer_slice_MainAbilitySlice_NativeLayerHandleGetWidthFromJNI(JNIEnv* env, jobject obj,jobject surface){
+ return NativeLayerHandle(GetNativeLayer(env,surface),GET_WIDTH);
+}
+
+extern "C"
+JNIEXPORT jint JNICALL Java_ohos_samples_nativelayer_slice_MainAbilitySlice_NativeLayerHandleGetHeightFromJNI(JNIEnv* env, jobject obj,jobject surface){
+ return NativeLayerHandle(GetNativeLayer(env,surface),GET_HEIGHT);
+}
+
+extern "C"
+JNIEXPORT jint JNICALL Java_ohos_samples_nativelayer_slice_MainAbilitySlice_NativeLayerHandleGetFormatFromJNI(JNIEnv* env, jobject obj,jobject surface){
+ return NativeLayerHandle(GetNativeLayer(env,surface),GET_FORMAT);
+}
+
+extern "C"
+JNIEXPORT jint JNICALL Java_ohos_samples_nativelayer_slice_MainAbilitySlice_NativeLayerHandleSetHeightWidthFromJNI(JNIEnv* env, jobject obj,jobject surface,jint width,jint height){
+ return NativeLayerHandle(GetNativeLayer(env,surface),SET_WIDTH_AND_HEIGHT,width,height);
+}
+
+extern "C"
+JNIEXPORT jint JNICALL Java_ohos_samples_nativelayer_slice_MainAbilitySlice_NativeLayerHandleSetFormatFromJNI(JNIEnv* env, jobject obj,jobject surface,jint format){
+ return NativeLayerHandle(GetNativeLayer(env,surface),SET_FORMAT,format);
+}
\ No newline at end of file
diff --git a/native/NativeLayer/entry/src/main/java/ohos/samples/nativelayer/MainAbility.java b/native/NativeLayer/entry/src/main/java/ohos/samples/nativelayer/MainAbility.java
new file mode 100644
index 0000000000000000000000000000000000000000..1e5854f901130309fdc2719a40ad1f203beb01f5
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/java/ohos/samples/nativelayer/MainAbility.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * 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
+ *
+ * http://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.
+ */
+
+package ohos.samples.nativelayer;
+
+import ohos.samples.nativelayer.slice.MainAbilitySlice;
+import ohos.aafwk.ability.Ability;
+import ohos.aafwk.content.Intent;
+import ohos.security.SystemPermission;
+
+/**
+ * MainAbility
+ *
+ * @since 2021-08-16
+ */
+public class MainAbility extends Ability {
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setMainRoute(MainAbilitySlice.class.getName());
+ }
+}
diff --git a/native/NativeLayer/entry/src/main/java/ohos/samples/nativelayer/MyApplication.java b/native/NativeLayer/entry/src/main/java/ohos/samples/nativelayer/MyApplication.java
new file mode 100644
index 0000000000000000000000000000000000000000..5388192bc6c53c299d83c2ac3deabbb5e6580c48
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/java/ohos/samples/nativelayer/MyApplication.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * 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
+ *
+ * http://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.
+ */
+
+package ohos.samples.nativelayer;
+
+import ohos.aafwk.ability.AbilityPackage;
+
+/**
+ * MyApplication
+ *
+ * @since 2021-08-16
+ */
+public class MyApplication extends AbilityPackage {
+ @Override
+ public void onInitialize() {
+ super.onInitialize();
+ }
+}
diff --git a/native/NativeLayer/entry/src/main/java/ohos/samples/nativelayer/slice/MainAbilitySlice.java b/native/NativeLayer/entry/src/main/java/ohos/samples/nativelayer/slice/MainAbilitySlice.java
new file mode 100644
index 0000000000000000000000000000000000000000..28c8ce43e706f9927e24bc9edd6a580ccc8d6ec8
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/java/ohos/samples/nativelayer/slice/MainAbilitySlice.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * 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
+ *
+ * http://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.
+ */
+
+package ohos.samples.nativelayer.slice;
+
+import ohos.aafwk.ability.AbilitySlice;
+import ohos.aafwk.content.Intent;
+import ohos.agp.components.*;
+import ohos.agp.components.surfaceprovider.SurfaceProvider;
+import ohos.agp.graphics.Surface;
+import ohos.agp.graphics.SurfaceOps;
+import ohos.agp.render.Canvas;
+import ohos.agp.render.Paint;
+import ohos.agp.utils.Color;
+import ohos.samples.nativelayer.ResourceTable;
+import ohos.samples.nativelayer.utils.DialogUtils;
+import ohos.samples.nativelayer.utils.HiLogUtils;
+
+/**
+ * MainAbilitySlice
+ *
+ * @since 2021-08-16
+ */
+public class MainAbilitySlice extends AbilitySlice {
+ private static final String TAG = MainAbilitySlice.class.getSimpleName();
+
+ // Load the 'native-lib' library on application startup.
+ static {
+ System.loadLibrary("nativelayer");
+ }
+
+ private MainAbilitySlice slice;
+ private DependentLayout surfaceLayout;
+ private Surface surface;
+ private Text text;
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ super.setUIContent(ResourceTable.Layout_ability_main);
+ slice = new MainAbilitySlice();
+ initComponents();
+ addSurfaceProvider();
+ }
+
+ private void initComponents() {
+ text = (Text) findComponentById(ResourceTable.Id_text);
+ Button btnNativeLayer = (Button) findComponentById(ResourceTable.Id_getNativeLayer);
+ Button btnSetNativeLayer = (Button) findComponentById(ResourceTable.Id_setNativeLayer);
+ Button btnSetNativeLayerFormat = (Button) findComponentById(ResourceTable.Id_setNativeLayerFormat);
+ surfaceLayout = (DependentLayout) findComponentById(ResourceTable.Id_surface_layout);
+
+ btnNativeLayer.setClickedListener(this::getNativeLayerInfo);
+ btnSetNativeLayer.setClickedListener(this::setNativeLayerInfo);
+ btnSetNativeLayerFormat.setClickedListener(this::setNativeLayerFormat);
+ }
+
+ private void addSurfaceProvider() {
+ SurfaceProvider surfaceProvider = new SurfaceProvider(this);
+ surfaceProvider.pinToZTop(true);
+ if (surfaceProvider.getSurfaceOps().isPresent()) {
+ surfaceProvider.getSurfaceOps().get().addCallback(new SurfaceCallBack());
+ }
+ surfaceLayout.addComponent(surfaceProvider);
+ }
+
+ private void setNativeLayerFormat(Component component) {
+ new DialogUtils().showNormalDialog(getContext(), DialogUtils.TYPE_SET_FORMAT, slice, surface);
+ }
+
+ private void setNativeLayerInfo(Component component) {
+ HiLogUtils.info(TAG, "setNativeLayerInfo");
+ new DialogUtils().showNormalDialog(getContext(), DialogUtils.TYPE_SET_WIDTH_AND_HEIGHT, slice, surface);
+ }
+
+ private void getNativeLayerInfo(Component component) {
+ HiLogUtils.info(TAG, "getNativeLayerInfo,density=" + AttrHelper.getDensity(this));
+ int width = slice.NativeLayerHandleGetWidthFromJNI(surface);
+ int height = slice.NativeLayerHandleGetHeightFromJNI(surface);
+ int format = slice.NativeLayerHandleGetFormatFromJNI(surface);
+ text.setText(getString(ResourceTable.String_get_nativelayer_info_result) + "width:" + width + ", height:" + height + ", format:" + format);
+ }
+
+ private class SurfaceCallBack implements SurfaceOps.Callback {
+ @Override
+ public void surfaceCreated(SurfaceOps callbackSurfaceOps) {
+ surface = callbackSurfaceOps.getSurface();
+ Paint paint = new Paint();
+ paint.setColor(Color.LTGRAY);
+ paint.setStrokeWidth(30f);
+ paint.setStyle(Paint.Style.STROKE_STYLE);
+ Canvas canvas = surface.acquireCanvas();
+ canvas.drawPaint(paint);
+ paint.setColor(Color.YELLOW);
+ canvas.drawCircle(500, 400, 150f, paint);
+ paint.setColor(Color.RED);
+ paint.setStrokeWidth(5f);
+ paint.setTextSize(85);
+ canvas.drawText(paint, "Hello World", 300, 700);
+ surface.syncCanvasDrawCalls();
+ }
+
+ @Override
+ public void surfaceChanged(SurfaceOps callbackSurfaceOps, int format, int width, int height) {
+ }
+
+ @Override
+ public void surfaceDestroyed(SurfaceOps callbackSurfaceOps) {
+ }
+ }
+
+ @Override
+ public void onActive() {
+ super.onActive();
+ }
+
+ @Override
+ public void onForeground(Intent intent) {
+ super.onForeground(intent);
+ }
+
+ /**
+ * A native method that is implemented by the 'native-lib' native library,
+ * which is packaged with this application.
+ */
+ public native int NativeLayerHandleGetWidthFromJNI(Surface surface);
+
+ public native int NativeLayerHandleGetHeightFromJNI(Surface surface);
+
+ public native int NativeLayerHandleGetFormatFromJNI(Surface surface);
+
+ public native int NativeLayerHandleSetHeightWidthFromJNI(Surface surface, int width, int height);
+
+ public native int NativeLayerHandleSetFormatFromJNI(Surface surface, int format);
+
+}
diff --git a/native/NativeLayer/entry/src/main/java/ohos/samples/nativelayer/utils/DialogUtils.java b/native/NativeLayer/entry/src/main/java/ohos/samples/nativelayer/utils/DialogUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..417664ecf31e86c6a2a90db6582b6938caab2a96
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/java/ohos/samples/nativelayer/utils/DialogUtils.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * 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
+ *
+ * http://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.
+ */
+
+package ohos.samples.nativelayer.utils;
+
+import ohos.agp.components.*;
+import ohos.agp.graphics.Surface;
+import ohos.agp.utils.LayoutAlignment;
+import ohos.agp.window.dialog.CommonDialog;
+import ohos.agp.window.dialog.ToastDialog;
+import ohos.app.Context;
+import ohos.samples.nativelayer.ResourceTable;
+import ohos.samples.nativelayer.slice.MainAbilitySlice;
+
+/**
+ * DialogUtils
+ *
+ * @since 2021-08-16
+ */
+public class DialogUtils {
+ private static final String TAG = DialogUtils.class.getSimpleName();
+ public static final int TYPE_SET_WIDTH_AND_HEIGHT = 1;
+ public static final int TYPE_SET_FORMAT = 2;
+
+ private CommonDialog mDialog;
+
+ /**
+ * showNormalDialog
+ * @param context Context
+ * @param type int
+ * @param slice MainAbilitySlice
+ * @param surface Surface
+ */
+ public void showNormalDialog(Context context, int type, MainAbilitySlice slice, Surface surface) {
+ Component component = LayoutScatter.getInstance(context).parse(ResourceTable.Layout_dailog_set_native_info, null, true);
+ Text title = (Text) component.findComponentById(ResourceTable.Id_dialog_title);
+ Component btnSubmit = component.findComponentById(ResourceTable.Id_submit);
+ Component btnCancel = component.findComponentById(ResourceTable.Id_cancel);
+ TextField widthText = (TextField) component.findComponentById(ResourceTable.Id_input_width);
+ Component widthComponent = component.findComponentById(ResourceTable.Id_width_component);
+ Component heightComponent = component.findComponentById(ResourceTable.Id_height_component);
+ Component formatComponent = component.findComponentById(ResourceTable.Id_format_component);
+ TextField heightText = (TextField) component.findComponentById(ResourceTable.Id_input_height);
+ TextField formatText = (TextField) component.findComponentById(ResourceTable.Id_input_format);
+ if (type == TYPE_SET_WIDTH_AND_HEIGHT) {
+ title.setText(ResourceTable.String_set_native_layer_info);
+ formatComponent.setVisibility(Component.HIDE);
+ widthComponent.setVisibility(Component.VISIBLE);
+ heightComponent.setVisibility(Component.VISIBLE);
+ } else {
+ title.setText(ResourceTable.String_set_native_layer_format);
+ formatComponent.setVisibility(Component.VISIBLE);
+ widthComponent.setVisibility(Component.HIDE);
+ heightComponent.setVisibility(Component.HIDE);
+ }
+ btnSubmit.setClickedListener((Component comp) -> {
+ if (type == TYPE_SET_WIDTH_AND_HEIGHT) {
+ if (!widthText.getText().isEmpty() && !heightText.getText().isEmpty()) {
+ try {
+ int width = Integer.parseInt(widthText.getText());
+ int height = Integer.parseInt(heightText.getText());
+ slice.NativeLayerHandleSetHeightWidthFromJNI(surface, width, height);
+ surface.syncCanvasDrawCalls();
+ dismissDialog();
+ } catch (NumberFormatException e) {
+ HiLogUtils.error(TAG, "input type error");
+ showToast(context, "Only supports int type input");
+ }
+ } else {
+ showToast(context, "width and height is not null");
+ }
+ } else {
+ if (!formatText.getText().isEmpty()) {
+ try {
+ int format = Integer.parseInt(formatText.getText());
+ slice.NativeLayerHandleSetFormatFromJNI(surface, format);
+ surface.syncCanvasDrawCalls();
+ dismissDialog();
+ } catch (NumberFormatException e) {
+ HiLogUtils.error(TAG, "input type error");
+ showToast(context, "Only supports int type input");
+ }
+ } else {
+ showToast(context, "format need input");
+ }
+ }
+ });
+ btnCancel.setClickedListener((Component comp) -> dismissDialog());
+ CommonDialog dialog = new CommonDialog(context);
+ mDialog = dialog;
+ dialog.setContentCustomComponent(component);
+ dialog.setAlignment(LayoutAlignment.CENTER);
+ dialog.setTransparent(true);
+ dialog.show();
+ }
+
+ /**
+ * showToast
+ * @param context Context
+ * @param message String
+ */
+ public void showToast(Context context, String message) {
+ ToastDialog dialog = new ToastDialog(context).setText(message).setAlignment(LayoutAlignment.CENTER);
+ dialog.show();
+ }
+
+ /**
+ * dismissDialog
+ */
+ public void dismissDialog() {
+ if (mDialog != null) {
+ mDialog.destroy();
+ }
+ }
+}
diff --git a/native/NativeLayer/entry/src/main/java/ohos/samples/nativelayer/utils/HiLogUtils.java b/native/NativeLayer/entry/src/main/java/ohos/samples/nativelayer/utils/HiLogUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..ff286175644e0dc26c7e98cbae33082107764959
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/java/ohos/samples/nativelayer/utils/HiLogUtils.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2021 Huawei Device Co., Ltd.
+ * 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
+ *
+ * http://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.
+ */
+
+package ohos.samples.nativelayer.utils;
+
+import ohos.hiviewdfx.HiLog;
+import ohos.hiviewdfx.HiLogLabel;
+
+import java.util.Objects;
+
+/**
+ * HiLogUtils
+ *
+ * @since 2021-08-16
+ */
+public class HiLogUtils {
+ public static final String APP_NAME = "NativeLayer";
+ public static final HiLogLabel LABAL_LOG = new HiLogLabel(3, 0xD000f00, APP_NAME);
+ public static final String LOG_FORMAT = "%{public}s:%{public}s";
+
+ private HiLogUtils() {
+
+ }
+
+ /**
+ * info
+ * @param className String
+ * @param msg String
+ */
+ public static void info(String className, String msg) {
+ HiLog.info(LABAL_LOG, LOG_FORMAT, getLogPrefix(className), msg);
+ }
+
+ /**
+ * error
+ * @param className String
+ * @param msg String
+ */
+ public static void error(String className, String msg) {
+ HiLog.error(LABAL_LOG, LOG_FORMAT, getLogPrefix(className), msg);
+ }
+
+ private static String getLogPrefix(String tag) {
+ Thread currentThread = Thread.currentThread();
+ String threadName = currentThread.getName();
+ StackTraceElement[] stackTraceElements = currentThread.getStackTrace();
+ int lineNum = 0;
+ for (int index = 0; index < stackTraceElements.length; index++) {
+ if (Objects.equals(stackTraceElements[index].getClassName(), HiLogUtils.class.getName())
+ && stackTraceElements.length > index + 1
+ && !Objects.equals(stackTraceElements[index + 1].getClassName(), HiLogUtils.class.getName())) {
+ lineNum = stackTraceElements[index + 1].getLineNumber();
+ }
+ }
+ return "[" + threadName + "]" + "(" + tag + ".java" + lineNum + ")";
+ }
+}
+
diff --git a/native/NativeLayer/entry/src/main/resources/base/element/color.json b/native/NativeLayer/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..677c8531c2000e9c379ece8080aa2ef96ff69666
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,40 @@
+{
+ "color": [
+ {
+ "name": "color_button_blue_empty",
+ "value": "#3355FF"
+ },
+ {
+ "name": "color_button_blue_pressed",
+ "value": "#0000CC"
+ },
+ {
+ "name": "color_button_blue_text",
+ "value": "#FFFFFF"
+ },
+ {
+ "name": "color_transparent",
+ "value": "#00000000"
+ },
+ {
+ "name": "color_white",
+ "value": "#FFFFFF"
+ },
+ {
+ "name": "color_dialog_text",
+ "value": "#000000"
+ },
+ {
+ "name": "color_dialog_line",
+ "value": "#9F9F9F"
+ },
+ {
+ "name": "color_dialog_content_text",
+ "value": "#5F5F5F"
+ },
+ {
+ "name": "color_button_white_pressed",
+ "value": "#E5E5E5"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/native/NativeLayer/entry/src/main/resources/base/element/float.json b/native/NativeLayer/entry/src/main/resources/base/element/float.json
new file mode 100644
index 0000000000000000000000000000000000000000..d6f5669e0c137cbad114e9bb42d04194f644477b
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/resources/base/element/float.json
@@ -0,0 +1,48 @@
+{
+ "float": [
+ {
+ "name": "layout_padding",
+ "value": "10vp"
+ },
+ {
+ "name": "surface_height",
+ "value": "300vp"
+ },
+ {
+ "name": "button_height",
+ "value": "40vp"
+ },
+ {
+ "name": "button_width",
+ "value": "180vp"
+ },
+ {
+ "name": "button_margin",
+ "value": "10vp"
+ },
+ {
+ "name": "button_text_size",
+ "value": "18fp"
+ },
+ {
+ "name": "text_size",
+ "value": "18fp"
+ },
+ {
+ "name": "dialog_padding",
+ "value": "20vp"
+ },
+ {
+ "name": "dialog_content_padding",
+ "value": "10vp"
+ },
+ {
+ "name": "dialog_title_text_size",
+ "value": "18fp"
+ },
+ {
+ "name": "dialog_content_text_size",
+ "value": "15fp"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/native/NativeLayer/entry/src/main/resources/base/element/pattern.json b/native/NativeLayer/entry/src/main/resources/base/element/pattern.json
new file mode 100644
index 0000000000000000000000000000000000000000..e333104e932e3687c9380f34694e66d54e593952
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/resources/base/element/pattern.json
@@ -0,0 +1,131 @@
+{
+ "pattern": [
+ {
+ "name": "button_base",
+ "value": [
+ {
+ "name": "width",
+ "value": "$float:button_width"
+ },
+ {
+ "name": "height",
+ "value": "$float:button_height"
+ },
+ {
+ "name": "text_size",
+ "value": "$float:button_text_size"
+ },
+ {
+ "name": "margin",
+ "value": "$float:button_margin"
+ }
+ ]
+ },
+ {
+ "name": "button_blue",
+ "parent": "button_base",
+ "value": [
+ {
+ "name": "background_element",
+ "value": "$graphic:button_blue"
+ },
+ {
+ "name": "text_color",
+ "value": "$color:color_button_blue_text"
+ }
+ ]
+ },
+ {
+ "name": "dialog_title",
+ "value": [
+ {
+ "name": "text_size",
+ "value": "$float:dialog_title_text_size"
+ },
+ {
+ "name": "text_color",
+ "value": "$color:color_dialog_text"
+ },
+ {
+ "name": "padding",
+ "value": "$float:dialog_content_padding"
+ },
+ {
+ "name": "text_font",
+ "value": "sans-serif-medium"
+ }
+ ]
+ },
+ {
+ "name": "dialog_content_text",
+ "value": [
+ {
+ "name": "text_size",
+ "value": "$float:dialog_content_text_size"
+ },
+ {
+ "name": "text_color",
+ "value": "$color:color_dialog_text"
+ },
+ {
+ "name": "padding",
+ "value": "$float:dialog_content_padding"
+ },
+ {
+ "name": "multiple_lines",
+ "value": "false"
+ }
+ ]
+ },
+ {
+ "name": "dialog_content_text_field",
+ "value": [
+ {
+ "name": "text_size",
+ "value": "$float:dialog_content_text_size"
+ },
+ {
+ "name": "text_color",
+ "value": "$color:color_dialog_content_text"
+ },
+ {
+ "name": "padding",
+ "value": "$float:dialog_content_padding"
+ },
+ {
+ "name": "multiple_lines",
+ "value": "false"
+ },
+ {
+ "name": "background_element",
+ "value": "$graphic:background_text_field"
+ }
+ ]
+ },
+ {
+ "name": "dailog_button_pattern",
+ "value": [
+ {
+ "name": "text_size",
+ "value": "17fp"
+ },
+ {
+ "name": "text_color",
+ "value": "$color:color_button_blue_empty"
+ },
+ {
+ "name": "text_font",
+ "value": "sans-serif-medium"
+ },
+ {
+ "name": "weight",
+ "value": "5"
+ },
+ {
+ "name": "background_element",
+ "value": "$graphic:dialog_button"
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/native/NativeLayer/entry/src/main/resources/base/element/string.json b/native/NativeLayer/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..cb44768d5ed254e50683d43373c1cbbd50208f2b
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,48 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "NativeLayer"
+ },
+ {
+ "name": "mainability_description",
+ "value": "Native C++"
+ },
+ {
+ "name": "get_native_layer_info",
+ "value": "Get nativelayer info"
+ },
+ {
+ "name": "set_native_layer_info",
+ "value": "Set nativelayer width and height"
+ },
+ {
+ "name": "set_native_layer_format",
+ "value": "Set nativelayer format"
+ },
+ {
+ "name": "width",
+ "value": "Width: "
+ },
+ {
+ "name": "height",
+ "value": "Height: "
+ },
+ {
+ "name": "format",
+ "value": "Format: "
+ },
+ {
+ "name": "submit",
+ "value": "Sure"
+ },
+ {
+ "name": "cancel",
+ "value": "Cancel"
+ },
+ {
+ "name": "get_nativelayer_info_result",
+ "value": "get nativelayer info result: "
+ }
+ ]
+}
\ No newline at end of file
diff --git a/native/NativeLayer/entry/src/main/resources/base/graphic/background_dialog.xml b/native/NativeLayer/entry/src/main/resources/base/graphic/background_dialog.xml
new file mode 100644
index 0000000000000000000000000000000000000000..59cb55bfb890d3826c9841daa92121bf4b46793a
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/resources/base/graphic/background_dialog.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/native/NativeLayer/entry/src/main/resources/base/graphic/background_text_field.xml b/native/NativeLayer/entry/src/main/resources/base/graphic/background_text_field.xml
new file mode 100644
index 0000000000000000000000000000000000000000..db8aa80c66610238068b45b0dc960dbf19201c11
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/resources/base/graphic/background_text_field.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/native/NativeLayer/entry/src/main/resources/base/graphic/button_blue.xml b/native/NativeLayer/entry/src/main/resources/base/graphic/button_blue.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a06daf270657168e003b02d0e4f4108aa42eccb4
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/resources/base/graphic/button_blue.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/native/NativeLayer/entry/src/main/resources/base/graphic/button_blue_empty.xml b/native/NativeLayer/entry/src/main/resources/base/graphic/button_blue_empty.xml
new file mode 100644
index 0000000000000000000000000000000000000000..ed32eae5fa7c8faba837ba80fe17d9e9e937ec1e
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/resources/base/graphic/button_blue_empty.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/native/NativeLayer/entry/src/main/resources/base/graphic/button_blue_pressed.xml b/native/NativeLayer/entry/src/main/resources/base/graphic/button_blue_pressed.xml
new file mode 100644
index 0000000000000000000000000000000000000000..00ae2d38a5e60b12f62be947649307e9761e7c6a
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/resources/base/graphic/button_blue_pressed.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/native/NativeLayer/entry/src/main/resources/base/graphic/button_white_pressed.xml b/native/NativeLayer/entry/src/main/resources/base/graphic/button_white_pressed.xml
new file mode 100644
index 0000000000000000000000000000000000000000..397d4b73bd64c2e2a8e7714ec4e7c48f94c192ce
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/resources/base/graphic/button_white_pressed.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/native/NativeLayer/entry/src/main/resources/base/graphic/dialog_button.xml b/native/NativeLayer/entry/src/main/resources/base/graphic/dialog_button.xml
new file mode 100644
index 0000000000000000000000000000000000000000..57210c147371fb4cc313cb24dd862e420fe65654
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/resources/base/graphic/dialog_button.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/native/NativeLayer/entry/src/main/resources/base/graphic/dialog_button_normal.xml b/native/NativeLayer/entry/src/main/resources/base/graphic/dialog_button_normal.xml
new file mode 100644
index 0000000000000000000000000000000000000000..ad74709e23ddb949abfc1991287468cd27c7aea5
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/resources/base/graphic/dialog_button_normal.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/native/NativeLayer/entry/src/main/resources/base/layout/ability_main.xml b/native/NativeLayer/entry/src/main/resources/base/layout/ability_main.xml
new file mode 100644
index 0000000000000000000000000000000000000000..283cfb1b5fb9398aa32a159486084571b4208362
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/resources/base/layout/ability_main.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/native/NativeLayer/entry/src/main/resources/base/layout/dailog_set_native_info.xml b/native/NativeLayer/entry/src/main/resources/base/layout/dailog_set_native_info.xml
new file mode 100644
index 0000000000000000000000000000000000000000..793ef3e31a75b8f5ea2ec5b76b41889573f39457
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/resources/base/layout/dailog_set_native_info.xml
@@ -0,0 +1,119 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/native/NativeLayer/entry/src/main/resources/base/media/icon.png b/native/NativeLayer/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/native/NativeLayer/entry/src/main/resources/base/media/icon.png differ
diff --git a/native/NativeLayer/entry/src/main/resources/en/element/string.json b/native/NativeLayer/entry/src/main/resources/en/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..46a5abec5b8a1bf4a83791b4b5efcaec13beed28
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/resources/en/element/string.json
@@ -0,0 +1,36 @@
+{
+ "string": [
+ {
+ "name": "get_native_layer_info",
+ "value": "Get nativelayer info"
+ },
+ {
+ "name": "set_native_layer_info",
+ "value": "Set nativelayer width and height"
+ },
+ {
+ "name": "set_native_layer_format",
+ "value": "Set nativelayer format"
+ },
+ {
+ "name": "width",
+ "value": "Width: "
+ },
+ {
+ "name": "height",
+ "value": "Height: "
+ },
+ {
+ "name": "format",
+ "value": "Format: "
+ },
+ {
+ "name": "submit",
+ "value": "Sure"
+ },
+ {
+ "name": "cancel",
+ "value": "Cancel"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/native/NativeLayer/entry/src/main/resources/zh/element/string.json b/native/NativeLayer/entry/src/main/resources/zh/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..aa1269698a3ed648d88d26c9058a1617776424b7
--- /dev/null
+++ b/native/NativeLayer/entry/src/main/resources/zh/element/string.json
@@ -0,0 +1,36 @@
+{
+ "string": [
+ {
+ "name": "get_native_layer_info",
+ "value": "获取原生层信息"
+ },
+ {
+ "name": "set_native_layer_info",
+ "value": "设置原生层宽和高"
+ },
+ {
+ "name": "set_native_layer_format",
+ "value": "设置原生层图层格式"
+ },
+ {
+ "name": "width",
+ "value": "宽"
+ },
+ {
+ "name": "height",
+ "value": "高: "
+ },
+ {
+ "name": "format",
+ "value": "图层格式: "
+ },
+ {
+ "name": "submit",
+ "value": "确定"
+ },
+ {
+ "name": "cancel",
+ "value": "取消"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/native/NativeLayer/screenshots/devices/main.png b/native/NativeLayer/screenshots/devices/main.png
new file mode 100644
index 0000000000000000000000000000000000000000..eb76ac4a5001eaf657d9a9529c1028696b4b7670
Binary files /dev/null and b/native/NativeLayer/screenshots/devices/main.png differ
diff --git a/native/NativeLayer/screenshots/devices/set_format.png b/native/NativeLayer/screenshots/devices/set_format.png
new file mode 100644
index 0000000000000000000000000000000000000000..32fd18799dc8948a9becdc6f3ea56ba1b0741e1b
Binary files /dev/null and b/native/NativeLayer/screenshots/devices/set_format.png differ
diff --git a/native/NativeLayer/screenshots/devices/set_width_height.png b/native/NativeLayer/screenshots/devices/set_width_height.png
new file mode 100644
index 0000000000000000000000000000000000000000..95a13955fbb52481f60aa73c25301b120bb700f8
Binary files /dev/null and b/native/NativeLayer/screenshots/devices/set_width_height.png differ
diff --git a/native/NativeLayer/settings.gradle b/native/NativeLayer/settings.gradle
new file mode 100644
index 0000000000000000000000000000000000000000..4773db73233a570c2d0c01a22e75321acfbf7a07
--- /dev/null
+++ b/native/NativeLayer/settings.gradle
@@ -0,0 +1 @@
+include ':entry'