diff --git a/README.md b/README.md
index b14abb8494772dd8cc25f9e91f8de3e9f27e6691..87465c986a10e4919ec79df88450650580b8f8b1 100644
--- a/README.md
+++ b/README.md
@@ -266,6 +266,36 @@ Chrome restricts the usage of WebCryptographyApi to secure origins. It means 'ht
| delay | number | 网络时延,单位是ms |
| bitrate | number | 码率,单位是kbps |
+### 4.12 云手机桌面(home)功能
+
+- 接口介绍
+
+ cloudApp.home();
+
+- 功能描述
+
+ 进入云手机桌面。
+
+### 4.13 云手机回退(back)功能
+
+- 接口介绍
+
+ cloudApp.back();
+
+- 功能描述
+
+ 应用退出、返回上一步。
+
+### 4.14 云手机多任务(menu)功能
+
+- 接口介绍
+
+ cloudApp.menu();
+
+- 功能描述
+
+ 进入云手机多任务页面。
+
### 5. 开发指导
### 6. license
Apache License 2.0。
\ No newline at end of file
diff --git a/sdk/demo/demo.html b/sdk/demo/demo.html
index dc8a403aee776002a5ac4f958768c2ed0c654f5d..cb58d925241967d41f542c7a6544fcc41543a92a 100644
--- a/sdk/demo/demo.html
+++ b/sdk/demo/demo.html
@@ -399,9 +399,9 @@ Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
退出云手机
-
-
-
+
+
+
@@ -444,9 +444,9 @@ Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
-
-
-
+
+
+
@@ -774,27 +774,20 @@ Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
console.log("Is in fullscreen?", cloudapp.isFullscreen());
}
- function sendKeyCodeCmd(code) {
- // keyCodeType与PROTOCOL_CONFIG中KEYEVENT_KEYCODE_TYPE对应
- let keyCodeType = '';
- switch (code) {
- case 4:
- keyCodeType = 'KEYCODE_BACK';
- break;
- case 3:
- keyCodeType = 'KEYCODE_HOME';
- break;
- case 187:
- keyCodeType = 'KEYCODE_APP_SWITCH';
- break;
- default:
- break;
- }
- cloudapp.sendKeyCodeCmd(keyCodeType);
+ function sendKeyCodeBack() {
+ cloudapp.back();
+ }
+
+ function sendKeyCodeHome() {
+ cloudapp.home();
const buttonModalEle = document.getElementById('buttonModal');
- if (keyCodeType !== 'KEYCODE_BACK') {
- buttonModalEle.style.display = 'none';
- }
+ buttonModalEle.style.display = 'none';
+ }
+
+ function sendKeyCodeMenu() {
+ cloudapp.menu();
+ const buttonModalEle = document.getElementById('buttonModal');
+ buttonModalEle.style.display = 'none';
}
function setResolution() {
diff --git a/sdk/index.html b/sdk/index.html
index dc8a403aee776002a5ac4f958768c2ed0c654f5d..cb58d925241967d41f542c7a6544fcc41543a92a 100644
--- a/sdk/index.html
+++ b/sdk/index.html
@@ -399,9 +399,9 @@ Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
退出云手机
-
-
-
+
+
+
@@ -444,9 +444,9 @@ Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
-
-
-
+
+
+
@@ -774,27 +774,20 @@ Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
console.log("Is in fullscreen?", cloudapp.isFullscreen());
}
- function sendKeyCodeCmd(code) {
- // keyCodeType与PROTOCOL_CONFIG中KEYEVENT_KEYCODE_TYPE对应
- let keyCodeType = '';
- switch (code) {
- case 4:
- keyCodeType = 'KEYCODE_BACK';
- break;
- case 3:
- keyCodeType = 'KEYCODE_HOME';
- break;
- case 187:
- keyCodeType = 'KEYCODE_APP_SWITCH';
- break;
- default:
- break;
- }
- cloudapp.sendKeyCodeCmd(keyCodeType);
+ function sendKeyCodeBack() {
+ cloudapp.back();
+ }
+
+ function sendKeyCodeHome() {
+ cloudapp.home();
const buttonModalEle = document.getElementById('buttonModal');
- if (keyCodeType !== 'KEYCODE_BACK') {
- buttonModalEle.style.display = 'none';
- }
+ buttonModalEle.style.display = 'none';
+ }
+
+ function sendKeyCodeMenu() {
+ cloudapp.menu();
+ const buttonModalEle = document.getElementById('buttonModal');
+ buttonModalEle.style.display = 'none';
}
function setResolution() {
diff --git a/sdk/src/CloudApp.js b/sdk/src/CloudApp.js
index 837a5fd81e31eaa4955320210153a16257ade91b..1551a3dd09f8183a5be6f03a784918357fed04f5 100644
--- a/sdk/src/CloudApp.js
+++ b/sdk/src/CloudApp.js
@@ -80,8 +80,16 @@ class CloudApp {
this.channel.sendDataToCloudApp(data);
}
- sendKeyCodeCmd(keyCodeType) {
- this.channel.sendKeyCodeMsg(keyCodeType);
+ home() {
+ this.channel.sendKeyCodeMsg('KEYCODE_HOME');
+ }
+
+ back() {
+ this.channel.sendKeyCodeMsg('KEYCODE_BACK');
+ }
+
+ menu() {
+ this.channel.sendKeyCodeMsg('KEYCODE_APP_SWITCH');
}
_getChannel(containerId, options) {