diff --git a/bundle.json b/bundle.json
index 06952ef47384abcef9ebebef2d5cf7b62fefc703..050c155dd3eb555c98edece46d49327dba3999b8 100644
--- a/bundle.json
+++ b/bundle.json
@@ -69,4 +69,4 @@
]
}
}
-}
+}
\ No newline at end of file
diff --git a/common/include/dialog_ui/js/pages/index/index.css b/common/include/dialog_ui/js/pages/index/index.css
index 6a57d7386b47062529e5ab39b1ec32c27e62d51c..024615c3806a6534e933fafd9fa5b8585e2064fb 100644
--- a/common/include/dialog_ui/js/pages/index/index.css
+++ b/common/include/dialog_ui/js/pages/index/index.css
@@ -2,6 +2,7 @@
flex-direction: column;
justify-content: center;
align-items: center;
+ opacity: 0.8;
background-color: azure;
}
@@ -22,8 +23,6 @@
width: 70%;
height: 80px;
font-size: 40px;
- border: 1px solid #e7e7e7;
- border-radius: 50px;
}
.but2 {
@@ -31,8 +30,6 @@
height: 80px;
font-size: 40px;
margin-left: 10%;
- border: 1px solid #e7e7e7;
- border-radius: 50px;
}
diff --git a/common/include/dm_constants.h b/common/include/dm_constants.h
index 1206f3909740ac8325d19fdcb5f1a940afb2e817..913e73f82a279d4159d2a6aa4ad9da8d98248ed8 100644
--- a/common/include/dm_constants.h
+++ b/common/include/dm_constants.h
@@ -140,6 +140,7 @@ const std::string AUTH_TYPE = "authType";
const std::string TOKEN = "token";
const std::string PIN_TOKEN = "pinToken";
const std::string PIN_CODE_KEY = "pinCode";
+const std::string TAG_CERTIFIED_PARAM = "certifiedParam";
const int32_t AUTH_TYPE_PIN = 1;
const int32_t AUTH_TYPE_SCAN = 2;
const int32_t AUTH_TYPE_TOUCH = 3;
diff --git a/ext/BUILD.gn b/ext/BUILD.gn
index df1b58535c2d55fa019bf3c12c6dafefad964edb..9a10471d6a5fd8a89a6a30eb66f64c61444ad435 100644
--- a/ext/BUILD.gn
+++ b/ext/BUILD.gn
@@ -19,6 +19,8 @@ group("ext_modules") {
deps += [
"./pin_auth:devicemanagerext_pin_auth",
"./profile:devicemanagerext_profile",
+ "./nfc_auth:devicemanager_nfcauth",
+ "./qr_code_auth:devicemanager_qrcodeauth"
]
}
}
diff --git a/ext/input_pin_dialog/dialog_ui/js/BUILD.gn b/ext/child_auth_ui/input_pin_dialog/dialog_ui/js/BUILD.gn
similarity index 94%
rename from ext/input_pin_dialog/dialog_ui/js/BUILD.gn
rename to ext/child_auth_ui/input_pin_dialog/dialog_ui/js/BUILD.gn
index 8abf88695e272f47842c8c6549920376cff6b74b..00603189b07801ea95f7c2f55bb3437c612e0a8e 100644
--- a/ext/input_pin_dialog/dialog_ui/js/BUILD.gn
+++ b/ext/child_auth_ui/input_pin_dialog/dialog_ui/js/BUILD.gn
@@ -15,7 +15,7 @@ import("//foundation/ace/ace_engine/build/ace_gen_sa_dialog_js.gni")
import("//foundation/distributedhardware/devicemanager/devicemanager.gni")
gen_sa_dialog_js("dialog_js_files_etc") {
- project_path = "//foundation/distributedhardware/devicemanager/ext/input_pin_dialog/dialog_ui/js"
+ project_path = "//foundation/distributedhardware/devicemanager/ext/child_auth_ui//input_pin_dialog/dialog_ui/js"
dialog_name = "input_pin_service"
part_name = "device_manager_base"
subsystem_name = "distributedhardware"
diff --git a/ext/input_pin_dialog/dialog_ui/js/common/KeyBoard.js b/ext/child_auth_ui/input_pin_dialog/dialog_ui/js/common/KeyBoard.js
similarity index 100%
rename from ext/input_pin_dialog/dialog_ui/js/common/KeyBoard.js
rename to ext/child_auth_ui/input_pin_dialog/dialog_ui/js/common/KeyBoard.js
diff --git a/ext/input_pin_dialog/dialog_ui/js/common/index.hml b/ext/child_auth_ui/input_pin_dialog/dialog_ui/js/common/index.hml
similarity index 100%
rename from ext/input_pin_dialog/dialog_ui/js/common/index.hml
rename to ext/child_auth_ui/input_pin_dialog/dialog_ui/js/common/index.hml
diff --git a/ext/input_pin_dialog/dialog_ui/js/common/pincode.png b/ext/child_auth_ui/input_pin_dialog/dialog_ui/js/common/pincode.png
similarity index 100%
rename from ext/input_pin_dialog/dialog_ui/js/common/pincode.png
rename to ext/child_auth_ui/input_pin_dialog/dialog_ui/js/common/pincode.png
diff --git a/ext/input_pin_dialog/dialog_ui/js/i18n/en-US.json b/ext/child_auth_ui/input_pin_dialog/dialog_ui/js/i18n/en-US.json
similarity index 100%
rename from ext/input_pin_dialog/dialog_ui/js/i18n/en-US.json
rename to ext/child_auth_ui/input_pin_dialog/dialog_ui/js/i18n/en-US.json
diff --git a/ext/input_pin_dialog/dialog_ui/js/i18n/zh-CN.json b/ext/child_auth_ui/input_pin_dialog/dialog_ui/js/i18n/zh-CN.json
similarity index 100%
rename from ext/input_pin_dialog/dialog_ui/js/i18n/zh-CN.json
rename to ext/child_auth_ui/input_pin_dialog/dialog_ui/js/i18n/zh-CN.json
diff --git a/ext/input_pin_dialog/dialog_ui/js/pages/index/index.css b/ext/child_auth_ui/input_pin_dialog/dialog_ui/js/pages/index/index.css
similarity index 76%
rename from ext/input_pin_dialog/dialog_ui/js/pages/index/index.css
rename to ext/child_auth_ui/input_pin_dialog/dialog_ui/js/pages/index/index.css
index 7a13cd6ce3967228bf41825c336b2cc3a6e16e14..fc2207c2f9f7e3d00aa2e2d32073cbfbf2ea34ec 100644
--- a/ext/input_pin_dialog/dialog_ui/js/pages/index/index.css
+++ b/ext/child_auth_ui/input_pin_dialog/dialog_ui/js/pages/index/index.css
@@ -2,6 +2,7 @@
flex-direction: column;
justify-content: center;
align-items: center;
+ opacity: 0.8;
background-color: azure;
}
@@ -14,13 +15,13 @@
.title-list {
font-size: 60px;
line-height: 60px;
- font-weight: 600;
+ font-weight: 800;
}
.title-error {
font-size: 30px;
line-height: 40px;
- font-weight: 500;
+ font-weight: 800;
color: #ff0000;
}
@@ -40,17 +41,13 @@
.but1 {
width: 30%;
height: 80px;
- font-size: 40px;
+ font-size: 50px;
margin-left: 10%;
- border: 1px solid #e7e7e7;
- border-radius: 50px;
}
.but2 {
width: 30%;
height: 80px;
- font-size: 40px;
+ font-size: 50px;
margin-left: 55%;
- border: 1px solid #e7e7e7;
- border-radius: 50px;
}
\ No newline at end of file
diff --git a/ext/input_pin_dialog/dialog_ui/js/pages/index/index.hml b/ext/child_auth_ui/input_pin_dialog/dialog_ui/js/pages/index/index.hml
similarity index 58%
rename from ext/input_pin_dialog/dialog_ui/js/pages/index/index.hml
rename to ext/child_auth_ui/input_pin_dialog/dialog_ui/js/pages/index/index.hml
index 84f217637922f7f11220581ad95ca82c435abbf6..c8edca3fb50de19ccbca16b9436c9f148c42cafb 100644
--- a/ext/input_pin_dialog/dialog_ui/js/pages/index/index.hml
+++ b/ext/child_auth_ui/input_pin_dialog/dialog_ui/js/pages/index/index.hml
@@ -6,14 +6,11 @@
请输入另一个设备显示的PIN码进行验证
-
- PIN码输入错误,请重新输入(3次:还有{{isTimes}}次机会)
-
-
diff --git a/ext/input_pin_dialog/dialog_ui/js/pages/index/index.js b/ext/child_auth_ui/input_pin_dialog/dialog_ui/js/pages/index/index.js
similarity index 62%
rename from ext/input_pin_dialog/dialog_ui/js/pages/index/index.js
rename to ext/child_auth_ui/input_pin_dialog/dialog_ui/js/pages/index/index.js
index 514b6ec77625f87c10ea936fcd20191c9f544f72..c68e1a3dd639e7f449fd306401e046a139abdc45 100644
--- a/ext/input_pin_dialog/dialog_ui/js/pages/index/index.js
+++ b/ext/child_auth_ui/input_pin_dialog/dialog_ui/js/pages/index/index.js
@@ -6,32 +6,24 @@ var inputVal = 0;
export default {
data: {
pincode: router.getParams().pinCode,
- isShow:false,
- isTimes:3,
},
onInit() {
code = router.getParams().pinCode;
- callNativeHandler("EVENT_CONFIRM", "2");
},
onChange(e){
inputVal = e.value;
},
onConfirm() {
numbs = numbs + 1;
- if(numbs <= 3){
+ if(numbs < 3){
console.info('click cancel numbs < 3 ');
console.info('code: ' + code);
console.info('inputVal: ' + inputVal);
if(code == inputVal){
- console.info('click cancel code == inputVal');
- callNativeHandler("EVENT_INPUT", "0");
+ console.info('click cancel code == inputVal');
+ callNativeHandler("EVENT_INPUT", "0");
}else{
- if(numbs == 3){
- callNativeHandler("EVENT_CONFIRM", "1");
- }
- console.info('click cancel code != inputVal');
- this.isShow = true;
- this.isTimes = 3 - numbs;
+ console.info('click cancel code != inputVal');
}
}else{
console.info('click cancel numbs > 3 ');
diff --git a/ext/child_auth_ui/nfc_dialog/dialog_ui/js/BUILD.gn b/ext/child_auth_ui/nfc_dialog/dialog_ui/js/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..c04a18b42c3ae59fe3191bf271bc10d91829c33c
--- /dev/null
+++ b/ext/child_auth_ui/nfc_dialog/dialog_ui/js/BUILD.gn
@@ -0,0 +1,22 @@
+# 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.
+
+import("//foundation/ace/ace_engine/build/ace_gen_sa_dialog_js.gni")
+import("//foundation/distributedhardware/devicemanager/devicemanager.gni")
+
+gen_sa_dialog_js("dialog_js_files_etc") {
+ project_path = "//foundation/distributedhardware/devicemanager/ext/child_auth_ui/nfc_dialog/dialog_ui/js"
+ dialog_name = "nfc_service"
+ part_name = "device_manager_base"
+ subsystem_name = "distributedhardware"
+}
diff --git a/ext/show_pin_dialog/dialog_ui/js/common/pincode.png b/ext/child_auth_ui/nfc_dialog/dialog_ui/js/common/pincode.png
similarity index 100%
rename from ext/show_pin_dialog/dialog_ui/js/common/pincode.png
rename to ext/child_auth_ui/nfc_dialog/dialog_ui/js/common/pincode.png
diff --git a/ext/show_pin_dialog/dialog_ui/js/i18n/en-US.json b/ext/child_auth_ui/nfc_dialog/dialog_ui/js/i18n/en-US.json
similarity index 100%
rename from ext/show_pin_dialog/dialog_ui/js/i18n/en-US.json
rename to ext/child_auth_ui/nfc_dialog/dialog_ui/js/i18n/en-US.json
diff --git a/ext/show_pin_dialog/dialog_ui/js/i18n/zh-CN.json b/ext/child_auth_ui/nfc_dialog/dialog_ui/js/i18n/zh-CN.json
similarity index 100%
rename from ext/show_pin_dialog/dialog_ui/js/i18n/zh-CN.json
rename to ext/child_auth_ui/nfc_dialog/dialog_ui/js/i18n/zh-CN.json
diff --git a/ext/child_auth_ui/nfc_dialog/dialog_ui/js/pages/index/index.css b/ext/child_auth_ui/nfc_dialog/dialog_ui/js/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..d6b65b0781fc28b3933b4ca103878e1b1b27e073
--- /dev/null
+++ b/ext/child_auth_ui/nfc_dialog/dialog_ui/js/pages/index/index.css
@@ -0,0 +1,53 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ opacity: 0.8;
+ background-color: azure;
+}
+
+.title {
+ font-size: 80px;
+ line-height: 100px;
+ font-weight: 800;
+}
+
+.title-list {
+ font-size: 60px;
+ line-height: 60px;
+ font-weight: 800;
+}
+
+.title-error {
+ font-size: 30px;
+ line-height: 40px;
+ font-weight: 800;
+ color: #ff0000;
+}
+
+.title-pin {
+ font-size: 60px;
+ line-height: 80px;
+ font-weight: 800;
+}
+
+.but {
+ width: 85%;
+ margin-top: 10%;
+ text-align: center;
+ height: 100px;
+}
+
+.but1 {
+ width: 30%;
+ height: 80px;
+ font-size: 50px;
+ margin-left: 10%;
+}
+
+.but2 {
+ width: 30%;
+ height: 80px;
+ font-size: 50px;
+ margin-left: 55%;
+}
\ No newline at end of file
diff --git a/ext/child_auth_ui/nfc_dialog/dialog_ui/js/pages/index/index.hml b/ext/child_auth_ui/nfc_dialog/dialog_ui/js/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..8b2066f1cacd1e8f1271b2a4f5888353bbfd4157
--- /dev/null
+++ b/ext/child_auth_ui/nfc_dialog/dialog_ui/js/pages/index/index.hml
@@ -0,0 +1,19 @@
+
+
+ 碰一碰
+
+
+ 请点击确认
+
+
+ 图片
+
+
+
+ 取消
+
+
+ 确定
+
+
+
\ No newline at end of file
diff --git a/ext/child_auth_ui/nfc_dialog/dialog_ui/js/pages/index/index.js b/ext/child_auth_ui/nfc_dialog/dialog_ui/js/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..6bb9649546eedd315e96025bc3a3c7c23d95ee15
--- /dev/null
+++ b/ext/child_auth_ui/nfc_dialog/dialog_ui/js/pages/index/index.js
@@ -0,0 +1,21 @@
+import router from '@ohos.router'
+
+var code = "";
+export default {
+ data: {
+ nfcCode: router.getParams().certifiedParam,
+ },
+ onInit() {
+ code = router.getParams().certifiedParam;
+ console.info('getParams: ' + router.getParams());
+ callNativeHandler("EVENT_INIT", "0");
+ },
+ onConfirm() {
+ console.info('click confirm');
+ callNativeHandler("EVENT_CONFIRM", code);
+ },
+ onCancel() {
+ console.info('click cancel');
+ callNativeHandler("EVENT_CANCEL", "2");
+ }
+}
diff --git a/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/BUILD.gn b/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..777f4b0f47f03a682e175581e1c5ac20fae09d09
--- /dev/null
+++ b/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/BUILD.gn
@@ -0,0 +1,22 @@
+# 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.
+
+import("//foundation/ace/ace_engine/build/ace_gen_sa_dialog_js.gni")
+import("//foundation/distributedhardware/devicemanager/devicemanager.gni")
+
+gen_sa_dialog_js("dialog_js_files_etc") {
+ project_path = "//foundation/distributedhardware/devicemanager/ext/child_auth_ui/qr_code_dialog/dialog_ui/js"
+ dialog_name = "qr_code_service"
+ part_name = "device_manager_base"
+ subsystem_name = "distributedhardware"
+}
diff --git a/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/common/pincode.png b/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/common/pincode.png
new file mode 100644
index 0000000000000000000000000000000000000000..6616f7659fcf1d5da5ab6796863e32efbe086cdc
Binary files /dev/null and b/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/common/pincode.png differ
diff --git a/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/i18n/en-US.json b/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..0714fc75f8420ac089a6ee1c24c8f2d8472ff511
--- /dev/null
+++ b/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/i18n/en-US.json
@@ -0,0 +1,5 @@
+{
+ "message":{
+ "hello": "hello world"
+ }
+}
\ No newline at end of file
diff --git a/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/i18n/zh-CN.json b/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..53afe2047da6ff0423e5eae8d9f9af9f73d85d0b
--- /dev/null
+++ b/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/i18n/zh-CN.json
@@ -0,0 +1,5 @@
+{
+ "message": {
+ "hello": "你好世界"
+ }
+}
\ No newline at end of file
diff --git a/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/pages/index/index.css b/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..d6b65b0781fc28b3933b4ca103878e1b1b27e073
--- /dev/null
+++ b/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/pages/index/index.css
@@ -0,0 +1,53 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ opacity: 0.8;
+ background-color: azure;
+}
+
+.title {
+ font-size: 80px;
+ line-height: 100px;
+ font-weight: 800;
+}
+
+.title-list {
+ font-size: 60px;
+ line-height: 60px;
+ font-weight: 800;
+}
+
+.title-error {
+ font-size: 30px;
+ line-height: 40px;
+ font-weight: 800;
+ color: #ff0000;
+}
+
+.title-pin {
+ font-size: 60px;
+ line-height: 80px;
+ font-weight: 800;
+}
+
+.but {
+ width: 85%;
+ margin-top: 10%;
+ text-align: center;
+ height: 100px;
+}
+
+.but1 {
+ width: 30%;
+ height: 80px;
+ font-size: 50px;
+ margin-left: 10%;
+}
+
+.but2 {
+ width: 30%;
+ height: 80px;
+ font-size: 50px;
+ margin-left: 55%;
+}
\ No newline at end of file
diff --git a/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/pages/index/index.hml b/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..45c8429e09673275d3f00e54e0dccd7c52a1c678
--- /dev/null
+++ b/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/pages/index/index.hml
@@ -0,0 +1,16 @@
+
+
+ 二维码扫描
+
+
+ 二维码扫描框
+
+
+
+ 取消
+
+
+ 确定
+
+
+
\ No newline at end of file
diff --git a/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/pages/index/index.js b/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..d44d8d964d14c0a11fe4c5b09048a68352dbfbe3
--- /dev/null
+++ b/ext/child_auth_ui/qr_code_dialog/dialog_ui/js/pages/index/index.js
@@ -0,0 +1,21 @@
+import router from '@ohos.router'
+
+var code = "";
+export default {
+ data: {
+ qr_code: router.getParams().certifiedParam,
+ },
+ onInit() {
+ code = router.getParams().certifiedParam;
+ console.info('getParams: ' + router.getParams());
+ callNativeHandler("EVENT_INIT", "0");
+ },
+ onConfirm() {
+ console.info('click confirm');
+ callNativeHandler("EVENT_CONFIRM", code);
+ },
+ onCancel() {
+ console.info('click cancel');
+ callNativeHandler("EVENT_CANCEL", "2");
+ }
+}
\ No newline at end of file
diff --git a/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/BUILD.gn b/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..c65b557793c345b97aa83d1181b04cbaf23c61c1
--- /dev/null
+++ b/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/BUILD.gn
@@ -0,0 +1,22 @@
+# 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.
+
+import("//foundation/ace/ace_engine/build/ace_gen_sa_dialog_js.gni")
+import("//foundation/distributedhardware/devicemanager/devicemanager.gni")
+
+gen_sa_dialog_js("dialog_js_files_etc") {
+ project_path = "//foundation/distributedhardware/devicemanager/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js"
+ dialog_name = "show_nfc_service"
+ part_name = "device_manager_base"
+ subsystem_name = "distributedhardware"
+}
diff --git a/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/common/pincode.png b/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/common/pincode.png
new file mode 100644
index 0000000000000000000000000000000000000000..6616f7659fcf1d5da5ab6796863e32efbe086cdc
Binary files /dev/null and b/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/common/pincode.png differ
diff --git a/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/i18n/en-US.json b/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..0714fc75f8420ac089a6ee1c24c8f2d8472ff511
--- /dev/null
+++ b/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/i18n/en-US.json
@@ -0,0 +1,5 @@
+{
+ "message":{
+ "hello": "hello world"
+ }
+}
\ No newline at end of file
diff --git a/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/i18n/zh-CN.json b/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..53afe2047da6ff0423e5eae8d9f9af9f73d85d0b
--- /dev/null
+++ b/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/i18n/zh-CN.json
@@ -0,0 +1,5 @@
+{
+ "message": {
+ "hello": "你好世界"
+ }
+}
\ No newline at end of file
diff --git a/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/pages/index/index.css b/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..d6b65b0781fc28b3933b4ca103878e1b1b27e073
--- /dev/null
+++ b/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/pages/index/index.css
@@ -0,0 +1,53 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ opacity: 0.8;
+ background-color: azure;
+}
+
+.title {
+ font-size: 80px;
+ line-height: 100px;
+ font-weight: 800;
+}
+
+.title-list {
+ font-size: 60px;
+ line-height: 60px;
+ font-weight: 800;
+}
+
+.title-error {
+ font-size: 30px;
+ line-height: 40px;
+ font-weight: 800;
+ color: #ff0000;
+}
+
+.title-pin {
+ font-size: 60px;
+ line-height: 80px;
+ font-weight: 800;
+}
+
+.but {
+ width: 85%;
+ margin-top: 10%;
+ text-align: center;
+ height: 100px;
+}
+
+.but1 {
+ width: 30%;
+ height: 80px;
+ font-size: 50px;
+ margin-left: 10%;
+}
+
+.but2 {
+ width: 30%;
+ height: 80px;
+ font-size: 50px;
+ margin-left: 55%;
+}
\ No newline at end of file
diff --git a/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/pages/index/index.hml b/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..2eda353dd683d431c978648793ce3e8f2dc18c3e
--- /dev/null
+++ b/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/pages/index/index.hml
@@ -0,0 +1,14 @@
+
+
+ 碰一碰
+
+
+ 若终止,请取消
+
+
+ 图片
+
+
+ 取消({{seconds}}秒)
+
+
\ No newline at end of file
diff --git a/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/pages/index/index.js b/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..498f3466b1e42ddc124496d606c7f008849c6972
--- /dev/null
+++ b/ext/child_auth_ui/show_nfc_dialog/dialog_ui/js/pages/index/index.js
@@ -0,0 +1,29 @@
+import router from '@ohos.router'
+
+var timel = null;
+export default {
+ data: {
+ nfcCode: router.getParams().certifiedParam,
+ seconds:60,
+ },
+ onInit() {
+ console.info('getParams: ' + router.getParams());
+ callNativeHandler("EVENT_INIT", "0");
+ },
+ onShow() {
+ timel = setInterval(this.run,1000)
+ },
+ run() {
+ this.seconds--;
+ if (this.seconds == 0) {
+ clearInterval(timel);
+ timel = null;
+ console.info('click cancel');
+ callNativeHandler("EVENT_CANCEL", "1");
+ }
+ },
+ onConfirm() {
+ console.info('click confirm');
+ callNativeHandler("EVENT_CANCEL", "1");
+ }
+}
\ No newline at end of file
diff --git a/ext/show_pin_dialog/dialog_ui/js/BUILD.gn b/ext/child_auth_ui/show_pin_dialog/dialog_ui/js/BUILD.gn
similarity index 95%
rename from ext/show_pin_dialog/dialog_ui/js/BUILD.gn
rename to ext/child_auth_ui/show_pin_dialog/dialog_ui/js/BUILD.gn
index 8c623e7f87ffeec940e5f3a0730114001f79f6e0..82e4ec76e469bcaeb778ac54ca26fb5a08f02e7a 100644
--- a/ext/show_pin_dialog/dialog_ui/js/BUILD.gn
+++ b/ext/child_auth_ui/show_pin_dialog/dialog_ui/js/BUILD.gn
@@ -15,7 +15,7 @@ import("//foundation/ace/ace_engine/build/ace_gen_sa_dialog_js.gni")
import("//foundation/distributedhardware/devicemanager/devicemanager.gni")
gen_sa_dialog_js("dialog_js_files_etc") {
- project_path = "//foundation/distributedhardware/devicemanager/ext/show_pin_dialog/dialog_ui/js"
+ project_path = "//foundation/distributedhardware/devicemanager/ext/child_auth_ui/show_pin_dialog/dialog_ui/js"
dialog_name = "show_pin_service"
part_name = "device_manager_base"
subsystem_name = "distributedhardware"
diff --git a/ext/child_auth_ui/show_pin_dialog/dialog_ui/js/common/pincode.png b/ext/child_auth_ui/show_pin_dialog/dialog_ui/js/common/pincode.png
new file mode 100644
index 0000000000000000000000000000000000000000..6616f7659fcf1d5da5ab6796863e32efbe086cdc
Binary files /dev/null and b/ext/child_auth_ui/show_pin_dialog/dialog_ui/js/common/pincode.png differ
diff --git a/ext/child_auth_ui/show_pin_dialog/dialog_ui/js/i18n/en-US.json b/ext/child_auth_ui/show_pin_dialog/dialog_ui/js/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..0714fc75f8420ac089a6ee1c24c8f2d8472ff511
--- /dev/null
+++ b/ext/child_auth_ui/show_pin_dialog/dialog_ui/js/i18n/en-US.json
@@ -0,0 +1,5 @@
+{
+ "message":{
+ "hello": "hello world"
+ }
+}
\ No newline at end of file
diff --git a/ext/child_auth_ui/show_pin_dialog/dialog_ui/js/i18n/zh-CN.json b/ext/child_auth_ui/show_pin_dialog/dialog_ui/js/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..53afe2047da6ff0423e5eae8d9f9af9f73d85d0b
--- /dev/null
+++ b/ext/child_auth_ui/show_pin_dialog/dialog_ui/js/i18n/zh-CN.json
@@ -0,0 +1,5 @@
+{
+ "message": {
+ "hello": "你好世界"
+ }
+}
\ No newline at end of file
diff --git a/ext/show_pin_dialog/dialog_ui/js/pages/index/index.css b/ext/child_auth_ui/show_pin_dialog/dialog_ui/js/pages/index/index.css
similarity index 45%
rename from ext/show_pin_dialog/dialog_ui/js/pages/index/index.css
rename to ext/child_auth_ui/show_pin_dialog/dialog_ui/js/pages/index/index.css
index ad2c2c4163304477cc340203355f1f1ea6b60d30..fc2207c2f9f7e3d00aa2e2d32073cbfbf2ea34ec 100644
--- a/ext/show_pin_dialog/dialog_ui/js/pages/index/index.css
+++ b/ext/child_auth_ui/show_pin_dialog/dialog_ui/js/pages/index/index.css
@@ -2,31 +2,52 @@
flex-direction: column;
justify-content: center;
align-items: center;
+ opacity: 0.8;
background-color: azure;
}
.title {
font-size: 80px;
- line-height: 120px;
+ line-height: 100px;
font-weight: 800;
}
.title-list {
font-size: 60px;
- line-height: 100px;
- font-weight: 600;
+ line-height: 60px;
+ font-weight: 800;
+}
+
+.title-error {
+ font-size: 30px;
+ line-height: 40px;
+ font-weight: 800;
+ color: #ff0000;
}
.title-pin {
font-size: 60px;
- line-height: 100px;
+ line-height: 80px;
font-weight: 800;
}
.but {
+ width: 85%;
+ margin-top: 10%;
+ text-align: center;
+ height: 100px;
+}
+
+.but1 {
+ width: 30%;
+ height: 80px;
+ font-size: 50px;
+ margin-left: 10%;
+}
+
+.but2 {
width: 30%;
- font-size: 40px;
height: 80px;
- border: 1px solid #e7e7e7;
- border-radius: 50px;
+ font-size: 50px;
+ margin-left: 55%;
}
\ No newline at end of file
diff --git a/ext/show_pin_dialog/dialog_ui/js/pages/index/index.hml b/ext/child_auth_ui/show_pin_dialog/dialog_ui/js/pages/index/index.hml
similarity index 100%
rename from ext/show_pin_dialog/dialog_ui/js/pages/index/index.hml
rename to ext/child_auth_ui/show_pin_dialog/dialog_ui/js/pages/index/index.hml
diff --git a/ext/show_pin_dialog/dialog_ui/js/pages/index/index.js b/ext/child_auth_ui/show_pin_dialog/dialog_ui/js/pages/index/index.js
similarity index 100%
rename from ext/show_pin_dialog/dialog_ui/js/pages/index/index.js
rename to ext/child_auth_ui/show_pin_dialog/dialog_ui/js/pages/index/index.js
diff --git a/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/BUILD.gn b/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..4a850d2444cf3023704a12c2092d1bc6960700e8
--- /dev/null
+++ b/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/BUILD.gn
@@ -0,0 +1,22 @@
+# 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.
+
+import("//foundation/ace/ace_engine/build/ace_gen_sa_dialog_js.gni")
+import("//foundation/distributedhardware/devicemanager/devicemanager.gni")
+
+gen_sa_dialog_js("dialog_js_files_etc") {
+ project_path = "//foundation/distributedhardware/devicemanager/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js"
+ dialog_name = "show_qr_code_dialog"
+ part_name = "device_manager_base"
+ subsystem_name = "distributedhardware"
+}
diff --git a/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/common/pincode.png b/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/common/pincode.png
new file mode 100644
index 0000000000000000000000000000000000000000..6616f7659fcf1d5da5ab6796863e32efbe086cdc
Binary files /dev/null and b/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/common/pincode.png differ
diff --git a/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/i18n/en-US.json b/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..0714fc75f8420ac089a6ee1c24c8f2d8472ff511
--- /dev/null
+++ b/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/i18n/en-US.json
@@ -0,0 +1,5 @@
+{
+ "message":{
+ "hello": "hello world"
+ }
+}
\ No newline at end of file
diff --git a/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/i18n/zh-CN.json b/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..53afe2047da6ff0423e5eae8d9f9af9f73d85d0b
--- /dev/null
+++ b/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/i18n/zh-CN.json
@@ -0,0 +1,5 @@
+{
+ "message": {
+ "hello": "你好世界"
+ }
+}
\ No newline at end of file
diff --git a/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/pages/index/index.css b/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..d6b65b0781fc28b3933b4ca103878e1b1b27e073
--- /dev/null
+++ b/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/pages/index/index.css
@@ -0,0 +1,53 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ opacity: 0.8;
+ background-color: azure;
+}
+
+.title {
+ font-size: 80px;
+ line-height: 100px;
+ font-weight: 800;
+}
+
+.title-list {
+ font-size: 60px;
+ line-height: 60px;
+ font-weight: 800;
+}
+
+.title-error {
+ font-size: 30px;
+ line-height: 40px;
+ font-weight: 800;
+ color: #ff0000;
+}
+
+.title-pin {
+ font-size: 60px;
+ line-height: 80px;
+ font-weight: 800;
+}
+
+.but {
+ width: 85%;
+ margin-top: 10%;
+ text-align: center;
+ height: 100px;
+}
+
+.but1 {
+ width: 30%;
+ height: 80px;
+ font-size: 50px;
+ margin-left: 10%;
+}
+
+.but2 {
+ width: 30%;
+ height: 80px;
+ font-size: 50px;
+ margin-left: 55%;
+}
\ No newline at end of file
diff --git a/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/pages/index/index.hml b/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..e05240ebe86afdf21b76d73d9bbe687d51c492c2
--- /dev/null
+++ b/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/pages/index/index.hml
@@ -0,0 +1,14 @@
+
+
+ 通过二维码验证
+
+
+ 请在对端设备扫描二维码进行验证
+
+
+ 图片
+
+
+ 取消({{seconds}}秒)
+
+
\ No newline at end of file
diff --git a/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/pages/index/index.js b/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..ef281e64c3f7ec6a06735f0c9cca548dfcdd0672
--- /dev/null
+++ b/ext/child_auth_ui/show_qr_code_dialog/dialog_ui/js/pages/index/index.js
@@ -0,0 +1,29 @@
+import router from '@ohos.router'
+
+var timel = null;
+export default {
+ data: {
+ qr_code: router.getParams().certifiedParam,
+ seconds:60,
+ },
+ onInit() {
+ console.info('getParams: ' + router.getParams());
+ callNativeHandler("EVENT_INIT", "0");
+ },
+ onShow() {
+ timel = setInterval(this.run,1000)
+ },
+ run() {
+ this.seconds--;
+ if (this.seconds == 0) {
+ clearInterval(timel);
+ timel = null;
+ console.info('click cancel');
+ callNativeHandler("EVENT_CANCEL", "1");
+ }
+ },
+ onConfirm() {
+ console.info('click confirm');
+ callNativeHandler("EVENT_CANCEL", "1");
+ }
+}
\ No newline at end of file
diff --git a/ext/nfc_auth/BUILD.gn b/ext/nfc_auth/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..89de7ed96d3d5a7c98bca0ea2de0f81811a5cede
--- /dev/null
+++ b/ext/nfc_auth/BUILD.gn
@@ -0,0 +1,105 @@
+# 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.
+
+if (defined(ohos_lite)) {
+ import("//build/lite/config/component/lite_component.gni")
+} else {
+ import("//build/ohos.gni")
+}
+
+import("//foundation/distributedhardware/devicemanager/devicemanager.gni")
+
+if (defined(ohos_lite)) {
+} else {
+ ohos_shared_library("devicemanager_nfcauth") {
+ include_dirs = [
+ "include",
+ "${common_path}/include",
+ "${ext_path}/pin_auth/include/ability",
+ "${services_path}/include/dependency/timer",
+ "${services_path}/include/config",
+ "${services_path}/include/adapter",
+ "${services_path}/include/authentication",
+ "${services_path}/include/ability",
+ "${services_path}/include/deviceinfo",
+ "${services_path}/include/devicestate",
+ "${services_path}/include/discovery",
+ "${services_path}/include/dependency/commonevent",
+ "${services_path}/include/dependency/hichain",
+ "${services_path}/include/dependency/softbus",
+ "${services_path}/include/dependency/timer",
+ "${services_path}/include/ipc",
+ "${services_path}/include/ipc/standard",
+ "${utils_path}/include",
+ "${utils_path}/include/ipc/standard",
+ "${services_path}/include",
+ "${innerkits_path}/native_cpp/include",
+ "${common_path}/include/ipc",
+ "${common_path}/include/ipc/model",
+ "${innerkits_path}/native_cpp/include",
+ "${innerkits_path}/native_cpp/include/ipc",
+ "${innerkits_path}/native_cpp/include/ipc/standard",
+ "//third_party/json/include",
+ "//utils/native/base/include",
+ "//utils/system/safwk/native/include",
+ "//base/notification/ces_standard/frameworks/core/include",
+ "//base/notification/ces_standard/interfaces/innerkits/native/include",
+ "//base/security/deviceauth/interfaces/innerkits",
+ "//base/startup/syspara_lite/interfaces/kits",
+ "//base/startup/syspara_lite/adapter/native/syspara/include",
+ ]
+
+ sources = [
+ "src/nfc_auth.cpp"
+ ]
+
+ deps = [
+ "${ext_path}/child_auth_ui/show_nfc_dialog/dialog_ui/js:dialog_js_files_etc",
+ "${ext_path}/child_auth_ui/nfc_dialog/dialog_ui/js:dialog_js_files_etc",
+ "${innerkits_path}/native_cpp:devicemanagersdk",
+ "${services_path}:devicemanagerservice",
+ "${utils_path}:devicemanagerutils",
+ "//base/security/deviceauth/services:deviceauth_sdk",
+ "//foundation/aafwk/standard/interfaces/innerkits/ability_manager:ability_manager",
+ "//foundation/aafwk/standard/interfaces/innerkits/want:want",
+ "//foundation/aafwk/standard/services/abilitymgr:abilityms",
+ "//foundation/ace/ace_engine/interfaces/innerkits/ui_service_manager:ui_service_mgr",
+ "//foundation/windowmanager/wm:libwm",
+ "//utils/native/base:utils",
+ ]
+
+ external_deps = [
+ "bundle_framework:appexecfwk_base",
+ "bundle_framework:appexecfwk_core",
+ "ces_standard:cesfwk_core",
+ "ces_standard:cesfwk_innerkits",
+ "dsoftbus_standard:softbus_client",
+ "hiviewdfx_hilog_native:libhilog",
+ "ipc:ipc_core",
+ "safwk:system_ability_fwk",
+ "samgr_standard:samgr_proxy",
+ "startup_l2:syspara",
+ "startup_l2:syspara_watchagent",
+ ]
+
+ defines = [
+ "HI_LOG_ENABLE",
+ "DH_LOG_TAG=\"devicemanagerext\"",
+ "LOG_DOMAIN=0xD004100",
+ ]
+
+ subsystem_name = "distributedhardware"
+
+ part_name = "device_manager_base"
+ }
+}
diff --git a/ext/nfc_auth/include/nfc_auth.h b/ext/nfc_auth/include/nfc_auth.h
new file mode 100644
index 0000000000000000000000000000000000000000..25cd2706a013c07992a0d8a3b1f676fc2fcb370c
--- /dev/null
+++ b/ext/nfc_auth/include/nfc_auth.h
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+#ifndef OHOS_DM_TOUCH_AUTH_H
+#define OHOS_DM_TOUCH_AUTH_H
+
+#include
+#include
+
+#include "authentication.h"
+#include "dm_auth_manager.h"
+
+namespace OHOS {
+namespace DistributedHardware {
+class NFCAuth : public IAuthentication {
+public:
+ NFCAuth();
+ ~NFCAuth();
+ int32_t ShowAuthInfo(std::string &certifiedParam, std::shared_ptr authManager) override;
+ int32_t StartAuth(std::string &certifiedParam, std::shared_ptr authManager) override;
+ int32_t VerifyAuthentication(std::string &certifiedParam, const std::string &authParam) override;
+};
+} // namespace DistributedHardware
+} // namespace OHOS
+#endif // OHOS_DM_TOUCH_AUTH_H
\ No newline at end of file
diff --git a/ext/nfc_auth/src/nfc_auth.cpp b/ext/nfc_auth/src/nfc_auth.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a08a66a03b8e2a229c37b391c678297a5b2f9fc1
--- /dev/null
+++ b/ext/nfc_auth/src/nfc_auth.cpp
@@ -0,0 +1,102 @@
+/*
+ * 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 "nfc_auth.h"
+
+#include
+
+#include "dm_constants.h"
+#include "dm_log.h"
+#include "nlohmann/json.hpp"
+#include "ui_service_mgr_client.h"
+namespace OHOS {
+namespace DistributedHardware {
+NFCAuth::NFCAuth()
+{
+ LOGI("NFCAuth constructor");
+}
+
+NFCAuth::~NFCAuth()
+{
+}
+
+int32_t NFCAuth::ShowAuthInfo(std::string &certifiedParam, std::shared_ptr authManager)
+{
+ LOGI("ShowNFCDialog start");
+ nlohmann::json jsonObj;
+ jsonObj[TAG_CERTIFIED_PARAM] = certifiedParam;
+ jsonObj.dump();
+ const std::string params = jsonObj.dump();
+
+ Ace::UIServiceMgrClient::GetInstance()->ShowDialog(
+ "show_nfc_service",
+ params,
+ OHOS::Rosen::WindowType::WINDOW_TYPE_SYSTEM_ALARM_WINDOW,
+ ACE_X, ACE_Y, ACE_WIDTH, ACE_HEIGHT,
+ [authManager](int32_t id, const std::string& event, const std::string& params) {
+ LOGI("CancelDialog start id:%d,event:%s,parms:%s", id, event.c_str(), params.c_str());
+ if (event == "EVENT_INIT") {
+ authManager->SetPageId(id);
+ } else {
+ Ace::UIServiceMgrClient::GetInstance()->CancelDialog(id);
+ authManager->AuthenticateFinish();
+ }
+ });
+ LOGI("ShowNFCDialog end");
+ return DM_OK;
+}
+
+int32_t NFCAuth::StartAuth(std::string &certifiedParam, std::shared_ptr authManager)
+{
+ LOGI("NFCDialog start");
+ nlohmann::json jsonObj;
+ jsonObj[TAG_CERTIFIED_PARAM] = certifiedParam;
+ jsonObj.dump();
+ const std::string params = jsonObj.dump();
+
+ Ace::UIServiceMgrClient::GetInstance()->ShowDialog(
+ "nfc_service",
+ params,
+ OHOS::Rosen::WindowType::WINDOW_TYPE_SYSTEM_ALARM_WINDOW,
+ ACE_X, ACE_Y, ACE_WIDTH, ACE_HEIGHT,
+ [authManager](int32_t id, const std::string& event, const std::string& params) {
+ LOGI("CancelDialog start id:%d,event:%s,parms:%s", id, event.c_str(), params.c_str());
+ if (event == "EVENT_INIT") {
+ authManager->SetPageId(id);
+ } else if(event == "EVENT_CONFIRM") {
+ authManager->VerifyAuthentication(params);
+ } else {
+ Ace::UIServiceMgrClient::GetInstance()->CancelDialog(id);
+ authManager->AuthenticateFinish();
+ }
+ });
+ LOGI("NFCDialog end");
+ return DM_OK;
+}
+
+int32_t NFCAuth::VerifyAuthentication(std::string &certifiedParam, const std::string &authParam)
+{
+ if (certifiedParam == authParam) {
+ return DM_OK;
+ }
+ return DM_FAILED;
+}
+
+extern "C" IAuthentication *CreateNfcAuthObject(void)
+{
+ return new NFCAuth;
+}
+} // namespace DistributedHardware
+} // namespace OHOS
diff --git a/ext/pin_auth/BUILD.gn b/ext/pin_auth/BUILD.gn
index 41bfe45895d84043dd289304b4e37359cf414055..ba5e64b1fd3ef1689a46c8fece07d8c3ee33261b 100644
--- a/ext/pin_auth/BUILD.gn
+++ b/ext/pin_auth/BUILD.gn
@@ -66,16 +66,16 @@ if (defined(ohos_lite)) {
]
deps = [
- "${ext_path}/input_pin_dialog/dialog_ui/js:dialog_js_files_etc",
- "${ext_path}/show_pin_dialog/dialog_ui/js:dialog_js_files_etc",
+ "${ext_path}/child_auth_ui/input_pin_dialog/dialog_ui/js:dialog_js_files_etc",
+ "${ext_path}/child_auth_ui/show_pin_dialog/dialog_ui/js:dialog_js_files_etc",
"${innerkits_path}/native_cpp:devicemanagersdk",
+ "${services_path}:devicemanagerservice",
"${utils_path}:devicemanagerutils",
"//base/security/deviceauth/services:deviceauth_sdk",
"//foundation/aafwk/standard/interfaces/innerkits/ability_manager:ability_manager",
"//foundation/aafwk/standard/interfaces/innerkits/want:want",
"//foundation/aafwk/standard/services/abilitymgr:abilityms",
"//foundation/ace/ace_engine/interfaces/innerkits/ui_service_manager:ui_service_mgr",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice:devicemanagerservice",
"//foundation/windowmanager/wm:libwm",
"//utils/native/base:utils",
]
@@ -104,4 +104,4 @@ if (defined(ohos_lite)) {
part_name = "device_manager_base"
}
-}
+}
\ No newline at end of file
diff --git a/ext/pin_auth/include/pin_auth.h b/ext/pin_auth/include/pin_auth.h
index dca2e7e7f9e12b4679d778c7d4a9b893f46c129d..df761c07ad026f4632e9e7aafeec94443319f85f 100644
--- a/ext/pin_auth/include/pin_auth.h
+++ b/ext/pin_auth/include/pin_auth.h
@@ -30,12 +30,10 @@ class PinAuth : public IAuthentication {
public:
PinAuth();
~PinAuth();
- int32_t ShowAuthInfo(int32_t code, std::shared_ptr authManager) override;
- int32_t StartAuth(int32_t code, std::shared_ptr authManager) override;
- int32_t VerifyAuthentication(std::string pinToken, int32_t code, const std::string &authParam) override;
-
+ int32_t ShowAuthInfo(std::string &certifiedParam, std::shared_ptr authManager) override;
+ int32_t StartAuth(std::string &certifiedParam, std::shared_ptr authManager) override;
+ int32_t VerifyAuthentication(std::string &certifiedParam, const std::string &authParam) override;
private:
- int32_t times_ = 0;
std::shared_ptr pinAuthUi_;
};
} // namespace DistributedHardware
diff --git a/ext/pin_auth/src/pin_auth.cpp b/ext/pin_auth/src/pin_auth.cpp
index 0bbadd15f7aa503e771432a132e9512f1834eec8..bcaf0abb732e7fd7de420248f11be2835588eca3 100644
--- a/ext/pin_auth/src/pin_auth.cpp
+++ b/ext/pin_auth/src/pin_auth.cpp
@@ -23,7 +23,6 @@
namespace OHOS {
namespace DistributedHardware {
-const int32_t MAX_VERIFY_TIMES = 3;
PinAuth::PinAuth()
{
LOGI("PinAuth constructor");
@@ -33,37 +32,41 @@ PinAuth::~PinAuth()
{
}
-int32_t PinAuth::ShowAuthInfo(int32_t code, std::shared_ptr authManager)
+int32_t PinAuth::ShowAuthInfo(std::string &certifiedParam, std::shared_ptr authManager)
{
- return pinAuthUi_->ShowPinDialog(code, authManager);
+ return pinAuthUi_->ShowPinDialog(atoi(certifiedParam.c_str()), authManager);
}
-int32_t PinAuth::StartAuth(int32_t code, std::shared_ptr authManager)
+int32_t PinAuth::StartAuth(std::string &certifiedParam, std::shared_ptr authManager)
{
- return pinAuthUi_->InputPinDialog(code, authManager);
+ return pinAuthUi_->InputPinDialog(atoi(certifiedParam.c_str()), authManager);
}
-int32_t PinAuth::VerifyAuthentication(std::string pinToken, int32_t code, const std::string &authParam)
+int32_t PinAuth::VerifyAuthentication(std::string &certifiedParam, const std::string &authParam)
{
- times_ += 1;
- nlohmann::json jsonObject = nlohmann::json::parse(authParam, nullptr, false);
- if (jsonObject.is_discarded()) {
- LOGE("DecodeRequestAuth jsonStr error");
- return DM_FAILED;
- }
- if (!jsonObject.contains(PIN_CODE_KEY) && !jsonObject.contains(PIN_TOKEN)) {
- LOGE("err json string, first time");
- return DM_FAILED;
- }
- int32_t inputPinCode = jsonObject[PIN_CODE_KEY];
- int32_t inputPinToken = jsonObject[PIN_TOKEN];
- if (code == inputPinCode && stoi(pinToken) == inputPinToken) {
+ // times_ += 1;
+ // nlohmann::json jsonObject = nlohmann::json::parse(authParam, nullptr, false);
+ // if (jsonObject.is_discarded()) {
+ // LOGE("DecodeRequestAuth jsonStr error");
+ // return DM_FAILED;
+ // }
+ // if (!jsonObject.contains(PIN_CODE_KEY) && !jsonObject.contains(PIN_TOKEN)) {
+ // LOGE("err json string, first time");
+ // return DM_FAILED;
+ // }
+ // int32_t inputPinCode = jsonObject[PIN_CODE_KEY];
+ // int32_t inputPinToken = jsonObject[PIN_TOKEN];
+ // if (code == inputPinCode && stoi(pinToken) == inputPinToken) {
+ // return DM_OK;
+ // } else if (code != inputPinCode && times_ < MAX_VERIFY_TIMES) {
+ // return DM_AUTH_INPUT_FAILED;
+ // } else {
+ // return DM_FAILED;
+ // }
+ if (authParam == "0"){
return DM_OK;
- } else if (code != inputPinCode && times_ < MAX_VERIFY_TIMES) {
- return DM_AUTH_INPUT_FAILED;
- } else {
- return DM_FAILED;
}
+ return DM_FAILED;
}
extern "C" IAuthentication *CreatePinAuthObject(void)
diff --git a/ext/pin_auth/src/pin_auth_ui.cpp b/ext/pin_auth/src/pin_auth_ui.cpp
index 9fc3459cda10a015720e9c8184833825b398c14f..f570e14fc9427a4917ca8d4818cb1efc3b89957c 100644
--- a/ext/pin_auth/src/pin_auth_ui.cpp
+++ b/ext/pin_auth/src/pin_auth_ui.cpp
@@ -43,7 +43,7 @@ int32_t PinAuthUi::ShowPinDialog(int32_t code, std::shared_ptr au
ACE_X, ACE_Y, ACE_WIDTH, ACE_HEIGHT,
[authManager](int32_t id, const std::string& event, const std::string& params) {
if (strcmp(params.c_str(), "0") == 0) {
- authManager->ClosePage(id);
+ authManager->SetPageId(id);
}
if (strcmp(params.c_str(), "1") == 0) {
LOGI("CancelDialog start id:%d,event:%s,parms:%s", id, event.c_str(), params.c_str());
@@ -68,14 +68,9 @@ int32_t PinAuthUi::InputPinDialog(int32_t code, std::shared_ptr a
OHOS::Rosen::WindowType::WINDOW_TYPE_SYSTEM_ALARM_WINDOW,
ACE_X, ACE_Y, ACE_WIDTH, ACE_HEIGHT,
[authManager](int32_t id, const std::string& event, const std::string& params) {
- if (strcmp(params.c_str(), "2") == 0) {
- authManager->ClosePage(id);
- }
- if (strcmp(params.c_str(), "0") == 0 || strcmp(params.c_str(), "1") == 0) {
- Ace::UIServiceMgrClient::GetInstance()->CancelDialog(id);
- LOGI("CancelDialog start id:%d,event:%s,parms:%s", id, event.c_str(), params.c_str());
- authManager->VerifyPinAuthAuthentication(params.c_str());
- }
+ Ace::UIServiceMgrClient::GetInstance()->CancelDialog(id);
+ LOGI("CancelDialog start id:%d,event:%s,parms:%s", id, event.c_str(), params.c_str());
+ authManager->VerifyAuthentication(params.c_str());
});
LOGI("ShowConfigDialog end");
return DM_OK;
diff --git a/ext/profile/BUILD.gn b/ext/profile/BUILD.gn
index 552653a03c2077c3eea4b5b85534e18fc34c5e57..9dfe54e45e01efe71194329923d12f68c5167a08 100644
--- a/ext/profile/BUILD.gn
+++ b/ext/profile/BUILD.gn
@@ -30,7 +30,15 @@ if (defined(ohos_lite)) {
"${ext_path}/profile/include",
"${services_path}/include",
"${services_path}/include/adapter",
+ "${services_path}/include/authentication",
+ "${services_path}/include/ability",
+ "${services_path}/include/deviceinfo",
+ "${services_path}/include/devicestate",
+ "${services_path}/include/discovery",
+ "${services_path}/include/dependency/commonevent",
+ "${services_path}/include/dependency/hichain",
"${services_path}/include/dependency/softbus",
+ "${services_path}/include/dependency/timer",
"${services_path}/include/ipc/standard",
"${services_path}/include/devicestate",
"${utils_path}/include",
@@ -38,11 +46,12 @@ if (defined(ohos_lite)) {
"${innerkits_path}/native_cpp/include",
"${innerkits_path}/native_cpp/include/ipc",
"${innerkits_path}/native_cpp/include/ipc/standard",
- "//foundation/communication/dsoftbus/interfaces/kits/bus_center",
- "//foundation/communication/dsoftbus/interfaces/kits/common",
- "//foundation/communication/dsoftbus/interfaces/kits/discovery",
- "//foundation/communication/dsoftbus/interfaces/kits/transport",
- "//foundation/communication/dsoftbus/interfaces/inner_kits/transport",
+
+ "//base/notification/ces_standard/frameworks/core/include",
+ "//base/notification/ces_standard/interfaces/innerkits/native/include",
+ "//base/security/deviceauth/interfaces/innerkits",
+ "//base/startup/syspara_lite/interfaces/kits",
+ "//base/startup/syspara_lite/adapter/native/syspara/include",
]
sources = [
@@ -60,6 +69,7 @@ if (defined(ohos_lite)) {
"device_profile_core:distributed_device_profile_client",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
+ "dsoftbus_standard:softbus_client"
]
defines = [
diff --git a/ext/qr_code_auth/BUILD.gn b/ext/qr_code_auth/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..5f051041ef7e648cc064abf8ac86ce15be554bd7
--- /dev/null
+++ b/ext/qr_code_auth/BUILD.gn
@@ -0,0 +1,105 @@
+# 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.
+
+if (defined(ohos_lite)) {
+ import("//build/lite/config/component/lite_component.gni")
+} else {
+ import("//build/ohos.gni")
+}
+
+import("//foundation/distributedhardware/devicemanager/devicemanager.gni")
+
+if (defined(ohos_lite)) {
+} else {
+ ohos_shared_library("devicemanager_qrcodeauth") {
+ include_dirs = [
+ "include",
+ "${common_path}/include",
+ "${ext_path}/pin_auth/include/ability",
+ "${services_path}/include/dependency/timer",
+ "${services_path}/include/config",
+ "${services_path}/include/adapter",
+ "${services_path}/include/authentication",
+ "${services_path}/include/ability",
+ "${services_path}/include/deviceinfo",
+ "${services_path}/include/devicestate",
+ "${services_path}/include/discovery",
+ "${services_path}/include/dependency/commonevent",
+ "${services_path}/include/dependency/hichain",
+ "${services_path}/include/dependency/softbus",
+ "${services_path}/include/dependency/timer",
+ "${services_path}/include/ipc",
+ "${services_path}/include/ipc/standard",
+ "${utils_path}/include",
+ "${utils_path}/include/ipc/standard",
+ "${services_path}/include",
+ "${innerkits_path}/native_cpp/include",
+ "${common_path}/include/ipc",
+ "${common_path}/include/ipc/model",
+ "${innerkits_path}/native_cpp/include",
+ "${innerkits_path}/native_cpp/include/ipc",
+ "${innerkits_path}/native_cpp/include/ipc/standard",
+ "//third_party/json/include",
+ "//utils/native/base/include",
+ "//utils/system/safwk/native/include",
+ "//base/notification/ces_standard/frameworks/core/include",
+ "//base/notification/ces_standard/interfaces/innerkits/native/include",
+ "//base/security/deviceauth/interfaces/innerkits",
+ "//base/startup/syspara_lite/interfaces/kits",
+ "//base/startup/syspara_lite/adapter/native/syspara/include",
+ ]
+
+ sources = [
+ "src/qr_code_auth.cpp",
+ ]
+
+ deps = [
+ "${utils_path}:devicemanagerutils",
+ "${services_path}:devicemanagerservice",
+ "${innerkits_path}/native_cpp:devicemanagersdk",
+ "${ext_path}/child_auth_ui/qr_code_dialog/dialog_ui/js:dialog_js_files_etc",
+ "${ext_path}/child_auth_ui/show_qr_code_dialog/dialog_ui/js:dialog_js_files_etc",
+ "//base/security/deviceauth/services:deviceauth_sdk",
+ "//foundation/aafwk/standard/interfaces/innerkits/ability_manager:ability_manager",
+ "//foundation/aafwk/standard/interfaces/innerkits/want:want",
+ "//foundation/aafwk/standard/services/abilitymgr:abilityms",
+ "//foundation/ace/ace_engine/interfaces/innerkits/ui_service_manager:ui_service_mgr",
+ "//foundation/windowmanager/wm:libwm",
+ "//utils/native/base:utils",
+ ]
+
+ external_deps = [
+ "bundle_framework:appexecfwk_base",
+ "bundle_framework:appexecfwk_core",
+ "ces_standard:cesfwk_core",
+ "ces_standard:cesfwk_innerkits",
+ "dsoftbus_standard:softbus_client",
+ "hiviewdfx_hilog_native:libhilog",
+ "ipc:ipc_core",
+ "safwk:system_ability_fwk",
+ "samgr_standard:samgr_proxy",
+ "startup_l2:syspara",
+ "startup_l2:syspara_watchagent",
+ ]
+
+ defines = [
+ "HI_LOG_ENABLE",
+ "DH_LOG_TAG=\"devicemanagerext\"",
+ "LOG_DOMAIN=0xD004100",
+ ]
+
+ subsystem_name = "distributedhardware"
+
+ part_name = "device_manager_base"
+ }
+}
diff --git a/ext/qr_code_auth/include/qr_code_auth.h b/ext/qr_code_auth/include/qr_code_auth.h
new file mode 100644
index 0000000000000000000000000000000000000000..541806d25bfd8a6bbfc47c31c0618632625028ce
--- /dev/null
+++ b/ext/qr_code_auth/include/qr_code_auth.h
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+#ifndef OHOS_DM_QR_CODE_AUTH_H
+#define OHOS_DM_QR_CODE_AUTH_H
+
+#include
+#include
+
+#include "authentication.h"
+#include "dm_auth_manager.h"
+
+namespace OHOS {
+namespace DistributedHardware {
+class QRCodeAuth : public IAuthentication {
+public:
+ QRCodeAuth();
+ ~QRCodeAuth();
+ int32_t ShowAuthInfo(std::string &certifiedParam, std::shared_ptr authManager) override;
+ int32_t StartAuth(std::string &certifiedParam, std::shared_ptr authManager) override;
+ int32_t VerifyAuthentication(std::string &certifiedParam, const std::string &authParam) override;
+};
+} // namespace DistributedHardware
+} // namespace OHOS
+#endif // OHOS_DM_QR_CODE_AUTH_H
\ No newline at end of file
diff --git a/ext/qr_code_auth/src/qr_code_auth.cpp b/ext/qr_code_auth/src/qr_code_auth.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5f9ad55096bf5bf5aa1dfd11074bab83210007e4
--- /dev/null
+++ b/ext/qr_code_auth/src/qr_code_auth.cpp
@@ -0,0 +1,102 @@
+/*
+ * 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 "qr_code_auth.h"
+
+#include
+
+#include "dm_constants.h"
+#include "dm_log.h"
+#include "nlohmann/json.hpp"
+#include "ui_service_mgr_client.h"
+namespace OHOS {
+namespace DistributedHardware {
+QRCodeAuth::QRCodeAuth()
+{
+ LOGI("QRCodeAuth constructor");
+}
+
+QRCodeAuth::~QRCodeAuth()
+{
+}
+
+int32_t QRCodeAuth::ShowAuthInfo(std::string &certifiedParam, std::shared_ptr authManager)
+{
+ LOGI("ShowQRcodeDialog start");
+ nlohmann::json jsonObj;
+ jsonObj[TAG_CERTIFIED_PARAM] = certifiedParam;
+ jsonObj.dump();
+ const std::string params = jsonObj.dump();
+
+ Ace::UIServiceMgrClient::GetInstance()->ShowDialog(
+ "show_qr_code_dialog",
+ params,
+ OHOS::Rosen::WindowType::WINDOW_TYPE_SYSTEM_ALARM_WINDOW,
+ ACE_X, ACE_Y, ACE_WIDTH, ACE_HEIGHT,
+ [authManager](int32_t id, const std::string& event, const std::string& params) {
+ LOGI("CancelDialog start id:%d,event:%s,parms:%s", id, event.c_str(), params.c_str());
+ if (event == "EVENT_INIT") {
+ authManager->SetPageId(id);
+ } else {
+ Ace::UIServiceMgrClient::GetInstance()->CancelDialog(id);
+ authManager->AuthenticateFinish();
+ }
+ });
+ LOGI("ShowQRcodeDialog end");
+ return DM_OK;
+}
+
+int32_t QRCodeAuth::StartAuth(std::string &certifiedParam, std::shared_ptr authManager)
+{
+ LOGI("QRcodeDialog start");
+ nlohmann::json jsonObj;
+ jsonObj[TAG_CERTIFIED_PARAM] = certifiedParam;
+ jsonObj.dump();
+ const std::string params = jsonObj.dump();
+
+ Ace::UIServiceMgrClient::GetInstance()->ShowDialog(
+ "qr_code_service",
+ params,
+ OHOS::Rosen::WindowType::WINDOW_TYPE_SYSTEM_ALARM_WINDOW,
+ ACE_X, ACE_Y, ACE_WIDTH, ACE_HEIGHT,
+ [authManager](int32_t id, const std::string& event, const std::string& params) {
+ LOGI("CancelDialog start id:%d,event:%s,parms:%s", id, event.c_str(), params.c_str());
+ if (event == "EVENT_INIT") {
+ authManager->SetPageId(id);
+ } else if(event == "EVENT_CONFIRM") {
+ authManager->VerifyAuthentication(params);
+ } else {
+ Ace::UIServiceMgrClient::GetInstance()->CancelDialog(id);
+ authManager->AuthenticateFinish();
+ }
+ });
+ LOGI("QRcodeDialog end");
+ return DM_OK;
+}
+
+int32_t QRCodeAuth::VerifyAuthentication(std::string &certifiedParam, const std::string &authParam)
+{
+ if (certifiedParam == authParam) {
+ return DM_OK;
+ }
+ return DM_FAILED;
+}
+
+extern "C" IAuthentication *CreateQRcodeAuthObject(void)
+{
+ return new QRCodeAuth;
+}
+} // namespace DistributedHardware
+} // namespace OHOS
diff --git a/interfaces/inner_kits/native_cpp/include/device_manager.h b/interfaces/inner_kits/native_cpp/include/device_manager.h
index 9e76a136103750e228535c364432533b4e55de33..f88a3f15515143314ecc1c4c4fb1361abbe290e7 100644
--- a/interfaces/inner_kits/native_cpp/include/device_manager.h
+++ b/interfaces/inner_kits/native_cpp/include/device_manager.h
@@ -50,8 +50,6 @@ public:
virtual int32_t RegisterDeviceManagerFaCallback(const std::string &pkgName,
std::shared_ptr callback) = 0;
virtual int32_t UnRegisterDeviceManagerFaCallback(const std::string &pkgName) = 0;
- virtual int32_t GetFaParam(const std::string &pkgName, DmAuthParam &faParam) = 0;
- virtual int32_t SetUserOperation(const std::string &pkgName, int32_t action) = 0;
virtual int32_t GetUdidByNetworkId(const std::string &pkgName, const std::string &netWorkId, std::string &udid) = 0;
virtual int32_t GetUuidByNetworkId(const std::string &pkgName, const std::string &netWorkId, std::string &uuid) = 0;
};
diff --git a/interfaces/inner_kits/native_cpp/include/device_manager_impl.h b/interfaces/inner_kits/native_cpp/include/device_manager_impl.h
index 46d8c3222c242a4e50e3d987e67de17c24e3c86d..74ab2e674f69dcd291819d4a47110108024d6f0b 100644
--- a/interfaces/inner_kits/native_cpp/include/device_manager_impl.h
+++ b/interfaces/inner_kits/native_cpp/include/device_manager_impl.h
@@ -49,8 +49,6 @@ public:
virtual int32_t RegisterDeviceManagerFaCallback(const std::string &packageName,
std::shared_ptr callback) override;
virtual int32_t UnRegisterDeviceManagerFaCallback(const std::string &pkgName) override;
- virtual int32_t GetFaParam(const std::string &pkgName, DmAuthParam &faParam) override;
- virtual int32_t SetUserOperation(const std::string &pkgName, int32_t action) override;
virtual int32_t GetUdidByNetworkId(const std::string &pkgName, const std::string &netWorkId,
std::string &udid) override;
virtual int32_t GetUuidByNetworkId(const std::string &pkgName, const std::string &netWorkId,
diff --git a/interfaces/inner_kits/native_cpp/src/device_manager_impl.cpp b/interfaces/inner_kits/native_cpp/src/device_manager_impl.cpp
index 811a6d7f49c9bacdfd17d18f177127b3dcd7b8a6..a32102c3ad82502bfae810743bf9362381c5e2a8 100644
--- a/interfaces/inner_kits/native_cpp/src/device_manager_impl.cpp
+++ b/interfaces/inner_kits/native_cpp/src/device_manager_impl.cpp
@@ -448,52 +448,6 @@ int32_t DeviceManagerImpl::VerifyAuthentication(const std::string &pkgName, cons
return DM_OK;
}
-int32_t DeviceManagerImpl::GetFaParam(const std::string &pkgName, DmAuthParam &dmFaParam)
-{
- LOGI("DeviceManager::GetFaParam start, pkgName: %s", pkgName.c_str());
- if (pkgName.empty()) {
- LOGE("VerifyAuthentication failed, pkgName is empty");
- return DM_INVALID_VALUE;
- }
-
- std::shared_ptr req = std::make_shared();
- std::shared_ptr rsp = std::make_shared();
- req->SetPkgName(pkgName);
-
- if (ipcClientProxy_->SendRequest(SERVER_GET_DMFA_INFO, req, rsp) != DM_OK) {
- LOGI("DeviceManagerImpl::GetFaParam start 2");
- return DM_IPC_SEND_REQUEST_FAILED;
- }
- dmFaParam = rsp->GetDmAuthParam();
- LOGI("GetFaParam completed, pkgName: %s", pkgName.c_str());
- return DM_OK;
-}
-
-int32_t DeviceManagerImpl::SetUserOperation(const std::string &pkgName, int32_t action)
-{
- LOGI("DeviceManager::SetUserOperation start, pkgName: %s", pkgName.c_str());
- if (pkgName.empty()) {
- LOGE("VerifyAuthentication failed, pkgName is empty");
- return DM_INVALID_VALUE;
- }
-
- std::shared_ptr req = std::make_shared();
- std::shared_ptr rsp = std::make_shared();
- req->SetPkgName(pkgName);
- req->SetOperation(action);
-
- if (ipcClientProxy_->SendRequest(SERVER_USER_AUTH_OPERATION, req, rsp) != DM_OK) {
- return DM_IPC_SEND_REQUEST_FAILED;
- }
- int32_t ret = rsp->GetErrCode();
- if (ret != DM_OK) {
- LOGE("CheckAuthentication Failed with ret %d", ret);
- return ret;
- }
- LOGI("SetUserOperation completed, pkgName: %s", pkgName.c_str());
- return DM_OK;
-}
-
int32_t DeviceManagerImpl::GetUdidByNetworkId(const std::string &pkgName, const std::string &netWorkId,
std::string &udid)
{
diff --git a/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_cmd_parser.cpp b/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_cmd_parser.cpp
index be759e55e1057e56de3f5f2561f2fa21f8947279..ef11689db37c2d4aca0b0fb9a44e098472fd5ed4 100644
--- a/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_cmd_parser.cpp
+++ b/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_cmd_parser.cpp
@@ -298,57 +298,6 @@ ON_IPC_READ_RESPONSE(VERIFY_AUTHENTICATION, MessageParcel &reply, std::shared_pt
return DM_OK;
}
-ON_IPC_SET_REQUEST(SERVER_GET_DMFA_INFO, std::shared_ptr pBaseReq, MessageParcel &data)
-{
- std::shared_ptr pReq = std::static_pointer_cast(pBaseReq);
- std::string packagename = pReq->GetPkgName();
- if (!data.WriteString(packagename)) {
- LOGE("write pkgName failed");
- return DM_IPC_FLATTEN_OBJECT;
- }
- return DM_OK;
-}
-
-ON_IPC_READ_RESPONSE(SERVER_GET_DMFA_INFO, MessageParcel &reply, std::shared_ptr pBaseRsp)
-{
- std::shared_ptr pRsp = std::static_pointer_cast(pBaseRsp);
- DmAuthParam authParam;
- authParam.direction = reply.ReadInt32();
- authParam.authType = reply.ReadInt32();
- authParam.authToken = reply.ReadString();
- authParam.packageName = reply.ReadString();
- authParam.appName = reply.ReadString();
- authParam.appDescription = reply.ReadString();
- authParam.business = reply.ReadInt32();
- authParam.pincode = reply.ReadInt32();
- pRsp->SetDmAuthParam(authParam);
- return DM_OK;
-}
-
-ON_IPC_SET_REQUEST(SERVER_USER_AUTH_OPERATION, std::shared_ptr pBaseReq, MessageParcel &data)
-{
- std::shared_ptr pReq = std::static_pointer_cast(pBaseReq);
- std::string pkgName = pReq->GetPkgName();
- int32_t action = pReq->GetOperation();
-
- if (!data.WriteString(pkgName)) {
- LOGE("write pkgName failed");
- return DM_IPC_TRANSACTION_FAILED;
- }
- if (!data.WriteInt32(action)) {
- LOGE("write action failed");
- return DM_WRITE_FAILED;
- }
-
- return DM_OK;
-}
-
-ON_IPC_READ_RESPONSE(SERVER_USER_AUTH_OPERATION, MessageParcel &reply, std::shared_ptr pBaseRsp)
-{
- pBaseRsp->SetErrCode(reply.ReadInt32());
- return DM_OK;
-}
-
ON_IPC_CMD(SERVER_DEVICE_STATE_NOTIFY, MessageParcel &data, MessageParcel &reply)
{
std::string pkgName = data.ReadString();
diff --git a/interfaces/kits/js/include/native_devicemanager_js.h b/interfaces/kits/js/include/native_devicemanager_js.h
index 71cb995b4f81a9ffcb6fd2b857fbecaeb4e5c78b..dbba19a6a465752818bfc919216a0c0066e4b2ac 100644
--- a/interfaces/kits/js/include/native_devicemanager_js.h
+++ b/interfaces/kits/js/include/native_devicemanager_js.h
@@ -167,7 +167,6 @@ public:
static napi_value Constructor(napi_env env, napi_callback_info info);
static napi_value CreateDeviceManager(napi_env env, napi_callback_info info);
static napi_value ReleaseDeviceManager(napi_env env, napi_callback_info info);
- static napi_value SetUserOperationSync(napi_env env, napi_callback_info info);
static napi_value GetTrustedDeviceListSync(napi_env env, napi_callback_info info);
static napi_value GetTrustedDeviceList(napi_env env, napi_callback_info info);
static napi_value GetLocalDeviceInfoSync(napi_env env, napi_callback_info info);
@@ -179,7 +178,6 @@ public:
static napi_value VerifyAuthInfo(napi_env env, napi_callback_info info);
static napi_value JsOn(napi_env env, napi_callback_info info);
static napi_value JsOff(napi_env env, napi_callback_info info);
- static napi_value GetAuthenticationParamSync(napi_env env, napi_callback_info info);
static void HandleCreateDmCallBack(const napi_env &env, AsyncCallbackInfo *asCallbackInfo);
static DeviceManagerNapi *GetDeviceManagerNapi(std::string &buldleName);
static void CreateDmCallback(napi_env env, std::string &bundleName, std::string &eventType);
@@ -187,8 +185,6 @@ public:
static void DeviceInfoToJsArray(const napi_env &env,
const std::vector &vecDevInfo,
const int32_t idx, napi_value &arrayResult);
- static void DmAuthParamToJsAuthParam(const napi_env &env, const OHOS::DistributedHardware::DmAuthParam &authParam,
- napi_value ¶mResult);
static void SetValueInt32(const napi_env &env, const std::string &fieldStr, const int32_t intValue,
napi_value &result);
static void SetValueUtf8String(const napi_env &env, const std::string &fieldStr, const std::string &str,
diff --git a/interfaces/kits/js/src/native_devicemanager_js.cpp b/interfaces/kits/js/src/native_devicemanager_js.cpp
index bb96c37a7044c5a55a282bc3077f4f9ed3ee30f6..1ab6a4f68ddf72b95abb4c4206088d0f98af5a53 100644
--- a/interfaces/kits/js/src/native_devicemanager_js.cpp
+++ b/interfaces/kits/js/src/native_devicemanager_js.cpp
@@ -526,12 +526,6 @@ void DeviceManagerNapi::DeviceInfoToJsArray(const napi_env &env, const std::vect
}
}
-void DeviceManagerNapi::DmAuthParamToJsAuthParam(const napi_env &env, const DmAuthParam &authParam,
- napi_value ¶mResult)
-{
- return;
-}
-
void DeviceManagerNapi::JsObjectToString(const napi_env &env, const napi_value &object, const std::string &fieldStr,
char *dest, const int32_t destLen)
{
@@ -908,50 +902,6 @@ void DeviceManagerNapi::ReleaseDmCallback(std::string &bundleName, std::string &
}
}
-napi_value DeviceManagerNapi::GetAuthenticationParamSync(napi_env env, napi_callback_info info)
-{
- LOGI("GetAuthenticationParamSync in");
- size_t argc = 0;
- napi_value thisVar = nullptr;
- napi_value resultParam = nullptr;
-
- NAPI_CALL(env, napi_get_cb_info(env, info, &argc, nullptr, &thisVar, nullptr));
- NAPI_ASSERT(env, argc == 0, "Wrong number of arguments");
- DeviceManagerNapi *deviceManagerWrapper = nullptr;
- napi_unwrap(env, thisVar, reinterpret_cast(&deviceManagerWrapper));
- DmAuthParam authParam;
- int32_t ret = DeviceManager::GetInstance().GetFaParam(deviceManagerWrapper->bundleName_, authParam);
- if (ret != 0) {
- LOGE("GetAuthenticationParam for %s failed, ret %d", deviceManagerWrapper->bundleName_.c_str(), ret);
- napi_get_undefined(env, &resultParam);
- return resultParam;
- }
- napi_create_object(env, &resultParam);
- DmAuthParamToJsAuthParam(env, authParam, resultParam);
- return resultParam;
-}
-
-napi_value DeviceManagerNapi::SetUserOperationSync(napi_env env, napi_callback_info info)
-{
- LOGI("SetUserOperationSync in");
- GET_PARAMS(env, info, DM_NAPI_ARGS_ONE);
- napi_valuetype valueType;
- napi_typeof(env, argv[0], &valueType);
- NAPI_ASSERT(env, valueType == napi_number, "Wrong argument type. Object expected.");
-
- int32_t action = 0;
- napi_get_value_int32(env, argv[0], &action);
- DeviceManagerNapi *deviceManagerWrapper = nullptr;
- napi_unwrap(env, thisVar, reinterpret_cast(&deviceManagerWrapper));
- int32_t ret = DeviceManager::GetInstance().SetUserOperation(deviceManagerWrapper->bundleName_, action);
- if (ret != 0) {
- LOGE("SetUserOperation for bunderName %s failed, ret %d", deviceManagerWrapper->bundleName_.c_str(), ret);
- }
- napi_value result = nullptr;
- napi_get_undefined(env, &result);
- return result;
-}
-
void DeviceManagerNapi::CallGetTrustedDeviceListStatusSync(napi_env env, napi_status &status,
DeviceInfoAsyncCallbackInfo *deviceInfoAsyncCallbackInfo)
{
@@ -1491,8 +1441,8 @@ napi_value DeviceManagerNapi::AuthenticateDevice(napi_env env, napi_callback_inf
JsToDmDeviceInfo(env, argv[0], deviceInfo);
std::string extraString;
JsToDmExtra(env, argv[PARAM_INDEX_ONE], extraString, authAsyncCallbackInfo_.authType);
- int32_t ret = DeviceManager::GetInstance().AuthenticateDevice(deviceManagerWrapper->bundleName_, 1, deviceInfo,
- extraString, authCallback);
+ int32_t ret = DeviceManager::GetInstance().AuthenticateDevice(deviceManagerWrapper->bundleName_,
+ authAsyncCallbackInfo_.authType, deviceInfo, extraString, authCallback);
if (ret != 0) {
LOGE("AuthenticateDevice for bundleName %s failed, ret %d", deviceManagerWrapper->bundleName_.c_str(), ret);
}
@@ -1824,9 +1774,6 @@ napi_value DeviceManagerNapi::Init(napi_env env, napi_value exports)
DECLARE_NAPI_FUNCTION("unAuthenticateDevice", UnAuthenticateDevice),
DECLARE_NAPI_FUNCTION("authenticateDevice", AuthenticateDevice),
DECLARE_NAPI_FUNCTION("verifyAuthInfo", VerifyAuthInfo),
- DECLARE_NAPI_FUNCTION("setUserOperation", SetUserOperationSync),
- DECLARE_NAPI_FUNCTION("getFaParam", GetAuthenticationParamSync),
- DECLARE_NAPI_FUNCTION("getAuthenticationParam", GetAuthenticationParamSync),
DECLARE_NAPI_FUNCTION("on", JsOn),
DECLARE_NAPI_FUNCTION("off", JsOff)};
diff --git a/services/devicemanagerservice/BUILD.gn b/services/devicemanagerservice/BUILD.gn
index cde4b3193c839c7d977c0188478d1d6adbfb58ef..4e798afa5d234e01b2d92a5039832fc5f8e136ab 100644
--- a/services/devicemanagerservice/BUILD.gn
+++ b/services/devicemanagerservice/BUILD.gn
@@ -23,10 +23,6 @@ if (defined(ohos_lite)) {
executable("devicemanagerservice") {
sources = [ "src/ipc/lite/ipc_server_main.cpp" ]
}
-} else if (!support_jsapi) {
- group("devicemanagerservice") {
- deps = []
- }
} else {
config("devicemanagerservice_config") {
include_dirs = [
diff --git a/services/devicemanagerservice/include/authentication/authentication.h b/services/devicemanagerservice/include/authentication/authentication.h
index 67ca0c3ee86b1e0fccae4eb20927cda40dc3a829..b0176fb9abb6e56753924533cf1361ec51382765 100644
--- a/services/devicemanagerservice/include/authentication/authentication.h
+++ b/services/devicemanagerservice/include/authentication/authentication.h
@@ -16,17 +16,15 @@
#ifndef OHOS_DM_AUTHENTICATION_H
#define OHOS_DM_AUTHENTICATION_H
-#include "dm_ability_manager.h"
-
namespace OHOS {
namespace DistributedHardware {
class DmAuthManager;
class IAuthentication {
public:
virtual ~IAuthentication() = default;
- virtual int32_t ShowAuthInfo(int32_t code, std::shared_ptr authManager) = 0;
- virtual int32_t StartAuth(int32_t code, std::shared_ptr authManager) = 0;
- virtual int32_t VerifyAuthentication(std::string pinToken, int32_t code, const std::string &authParam) = 0;
+ virtual int32_t ShowAuthInfo(std::string &certifiedParam, std::shared_ptr authManager) = 0;
+ virtual int32_t StartAuth(std::string &certifiedParam, std::shared_ptr authManager) = 0;
+ virtual int32_t VerifyAuthentication(std::string &certifiedParam, const std::string &authParam) = 0;
};
using CreateIAuthAdapterFuncPtr = IAuthentication *(*)(void);
diff --git a/services/devicemanagerservice/include/authentication/dm_auth_manager.h b/services/devicemanagerservice/include/authentication/dm_auth_manager.h
index 6a7ae6b85aeb7a5a7f90f58e97bf559765801835..3ce614d6ee85c8353c760af28c40cefc9fa92af1 100644
--- a/services/devicemanagerservice/include/authentication/dm_auth_manager.h
+++ b/services/devicemanagerservice/include/authentication/dm_auth_manager.h
@@ -86,7 +86,6 @@ typedef struct DmAuthRequestContext {
std::string appThumbnail;
std::string token;
int32_t reason;
- int32_t aceId;
std::vector syncGroupList;
} DmAuthRequestContext;
@@ -110,10 +109,11 @@ typedef struct DmAuthResponseContext {
std::string appIcon;
std::string appThumbnail;
std::string token;
+ std::string certifiedParam;
+ int32_t pageId;
int64_t requestId;
int32_t code;
int32_t state;
- int32_t aceId;
std::vector syncGroupList;
} DmAuthResponseContext;
@@ -131,7 +131,6 @@ public:
const std::string &extra);
int32_t UnAuthenticateDevice(const std::string &pkgName, const std::string &deviceId);
int32_t VerifyAuthentication(const std::string &authParam);
- void VerifyPinAuthAuthentication(const std::string &action);
void OnSessionOpened(int32_t sessionId, int32_t sessionSide, int32_t result);
void OnSessionClosed(int32_t sessionId);
void OnDataReceived(int32_t sessionId, std::string message);
@@ -156,15 +155,12 @@ public:
int32_t GetPinCode();
std::string GenerateGroupName();
int32_t HandleAuthenticateTimeout();
- void CancelDisplay();
int32_t GeneratePincode();
void ShowConfigDialog();
void ShowAuthInfoDialog();
void ShowStartAuthDialog();
- int32_t GetAuthenticationParam(DmAuthParam &authParam);
- int32_t OnUserOperation(int32_t action);
- void UserSwitchEventCallback(int32_t userId);
- void ClosePage(const int32_t &id);
+ int32_t SetPageId(int32_t pageId);
+ void UserSwitchEventCallback (int32_t userId);
private:
std::shared_ptr softbusConnector_;
diff --git a/services/devicemanagerservice/include/dependency/hichain/hichain_connector.h b/services/devicemanagerservice/include/dependency/hichain/hichain_connector.h
index 99d534f6ef6ee9d3749494be63c4dde0d2d5c170..9742a347fc8c663930ad401243e33352dc887d5f 100644
--- a/services/devicemanagerservice/include/dependency/hichain/hichain_connector.h
+++ b/services/devicemanagerservice/include/dependency/hichain/hichain_connector.h
@@ -59,11 +59,12 @@ public:
int32_t AddMember(std::string deviceId, std::string &connectInfo);
int32_t DelMemberFromGroup(std::string groupId, std::string deviceId);
int32_t DeleteGroup(std::string &groupId);
- int32_t DeleteGroup(const int32_t userId, std::string &groupId);
bool IsDevicesInGroup(std::string hostDevice, std::string peerDevice);
int32_t GetRelatedGroups(std::string DeviceId, std::vector &groupList);
int32_t GetGroupInfo(std::string queryParams, std::vector &groupList);
int32_t GetGroupInfo(const int32_t userId, std::string queryParams, std::vector &groupList);
+ int32_t DeleteGroup(const int32_t userId, std::string &groupId);
+ int32_t DeleteTimeOutGroup(const char* deviceId);
private:
int64_t GenRequestId();
int32_t SyncGroups(std::string deviceId, std::vector &remoteGroupIdList);
diff --git a/services/devicemanagerservice/include/devicestate/dm_device_state_manager.h b/services/devicemanagerservice/include/devicestate/dm_device_state_manager.h
index a54ef47ef12102bd5a5d4838bd135757e0b7e488..d3d3e245ae73d5e4b11763d24eb94b20fb13eebe 100644
--- a/services/devicemanagerservice/include/devicestate/dm_device_state_manager.h
+++ b/services/devicemanagerservice/include/devicestate/dm_device_state_manager.h
@@ -19,14 +19,29 @@
#include "device_manager_service_listener.h"
#include "dm_adapter_manager.h"
#include "softbus_connector.h"
-
+#include "dm_timer.h"
+#include "hichain_connector.h"
namespace OHOS {
namespace DistributedHardware {
+class HmDevice {
+public:
+ HmDevice(std::string deviceId, std::shared_ptr stateMgr);
+ ~HmDevice();
+
+public:
+ std::string mDeviceId;
+ std::map mGroupMap;
+ std::shared_ptr mOfflineTimerPtr;
+ std::shared_ptr deviceStateMgr;
+};
+
+#define OFFLINE_TIMEOUT 300
class DmDeviceStateManager final : public ISoftbusStateCallback,
public std::enable_shared_from_this {
public:
DmDeviceStateManager(std::shared_ptr softbusConnector,
- std::shared_ptr listener);
+ std::shared_ptr listener,
+ std::shared_ptr hiChainConnector);
~DmDeviceStateManager();
void OnDeviceOnline(const std::string &pkgName, const DmDeviceInfo &info);
void OnDeviceOffline(const std::string &pkgName, const DmDeviceInfo &info);
@@ -34,6 +49,9 @@ public:
void OnDeviceReady(const std::string &pkgName, const DmDeviceInfo &info);
void OnProfileReady(const std::string &pkgName, const std::string deviceId);
int32_t RegisterSoftbusStateCallback();
+ void RegisterOffLineTimer(const DmDeviceInfo &deviceInfo);
+ void StartOffLineTimer(const DmDeviceInfo &deviceInfo);
+ void DeleteTimeOutGroup(HmDevice *hmDevice);
private:
std::shared_ptr softbusConnector_;
@@ -41,7 +59,10 @@ private:
std::shared_ptr listener_;
std::map deviceStateMap_;
std::map remoteDeviceInfos_;
+ std::map> timerMap_;
+ std::shared_ptr hiChainConnector_;
std::string profileSoName_;
+ std::map mHmDeviceMap_ = {};
};
} // namespace DistributedHardware
} // namespace OHOS
diff --git a/services/devicemanagerservice/src/authentication/auth_message_processor.cpp b/services/devicemanagerservice/src/authentication/auth_message_processor.cpp
index 9ba556f4a188c3e4bf57fd6ff8f48da531b2ad7a..8f5228f3702dfaf50e49140302ae421fb93f9f20 100644
--- a/services/devicemanagerservice/src/authentication/auth_message_processor.cpp
+++ b/services/devicemanagerservice/src/authentication/auth_message_processor.cpp
@@ -146,6 +146,7 @@ void AuthMessageProcessor::CreateResponseAuthMessage(nlohmann::json &json)
json[TAG_REQUEST_ID] = authResponseContext_->requestId;
json[TAG_GROUP_ID] = groupId;
json[TAG_GROUP_NAME] = authResponseContext_->groupName;
+ json[TAG_CERTIFIED_PARAM] = authResponseContext_->certifiedParam;
LOGI("AuthMessageProcessor::ParseAuthResponseMessage %s,%s", groupId.c_str(),
authResponseContext_->groupName.c_str());
}
@@ -225,6 +226,7 @@ void AuthMessageProcessor::ParseAuthResponseMessage(nlohmann::json &json)
authResponseContext_->requestId = json[TAG_REQUEST_ID];
authResponseContext_->groupId = json[TAG_GROUP_ID];
authResponseContext_->groupName = json[TAG_GROUP_NAME];
+ authResponseContext_->certifiedParam = json[TAG_CERTIFIED_PARAM];
LOGI("AuthMessageProcessor::ParseAuthResponseMessage %s,%s", authResponseContext_->groupId.c_str(),
authResponseContext_->groupName.c_str());
}
diff --git a/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp b/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp
index dfe504b5c30c43ce160c5ee2c1543e8abcbbef50..4902c352e211d16d33d8ccd4b2465d8f05fc3c61 100644
--- a/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp
+++ b/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp
@@ -48,7 +48,6 @@ const int32_t INPUT_TIMEOUT = 60;
const int32_t ADD_TIMEOUT = 10;
const int32_t WAIT_NEGOTIATE_TIMEOUT = 10;
const int32_t WAIT_REQUEST_TIMEOUT = 10;
-const int32_t CANCEL_PIN_CODE_DISPLAY = 1;
const int32_t DEVICE_ID_HALF = 2;
static void TimeOut(void *data)
@@ -80,7 +79,7 @@ DmAuthManager::~DmAuthManager()
int32_t DmAuthManager::AuthenticateDevice(const std::string &pkgName, int32_t authType, const std::string &deviceId,
const std::string &extra)
{
- LOGE("DmAuthManager::AuthenticateDevice start");
+ LOGE("DmAuthManager::AuthenticateDevice start auth type %d", authType);
std::shared_ptr authentication = authenticationMap_[authType];
if (authentication == nullptr) {
LOGE("DmAuthManager::AuthenticateDevice authType %d not support.", authType);
@@ -178,22 +177,18 @@ int32_t DmAuthManager::VerifyAuthentication(const std::string &authParam)
timerMap_[INPUT_TIMEOUT_TASK]->Stop(SESSION_CANCEL_TIMEOUT);
std::shared_ptr ptr;
- if (authenticationMap_.find(1) == authenticationMap_.end()) {
+ if (authenticationMap_.find(authResponseContext_->authType) == authenticationMap_.end()) {
LOGE("DmAuthManager::authenticationMap_ is null");
return DM_FAILED;
}
- ptr = authenticationMap_[1];
- int32_t ret = ptr->VerifyAuthentication(authRequestContext_->token, authResponseContext_->code, authParam);
+
+ ptr = authenticationMap_[authResponseContext_->authType];
+ int32_t ret = ptr->VerifyAuthentication(authResponseContext_->certifiedParam, authParam);
switch (ret) {
case DM_OK:
authRequestState_->TransitionTo(std::make_shared());
break;
- case DM_AUTH_INPUT_FAILED:
- listener_->OnVerifyAuthResult(authRequestContext_->hostPkgName, authRequestContext_->deviceId,
- DM_AUTH_INPUT_FAILED, "");
- break;
default:
- CancelDisplay();
authRequestContext_->reason = DM_AUTH_INPUT_FAILED;
authResponseContext_->state = authRequestState_->GetStateType();
authRequestState_->TransitionTo(std::make_shared());
@@ -326,6 +321,7 @@ void DmAuthManager::OnGroupCreated(int64_t requestId, const std::string &groupId
softbusConnector_->GetSoftbusSession()->SendData(authResponseContext_->sessionId, message);
return;
}
+ authResponseContext_->certifiedParam = GenerateGroupName();
authResponseContext_->code = GeneratePincode();
authResponseContext_->groupId = groupId;
authMessageProcessor_->SetResponseContext(authResponseContext_);
@@ -336,6 +332,8 @@ void DmAuthManager::OnGroupCreated(int64_t requestId, const std::string &groupId
void DmAuthManager::OnMemberJoin(int64_t requestId, int32_t status)
{
+ LOGI("DmAuthManager OnMemberJoin start");
+ Ace::UIServiceMgrClient::GetInstance()->CancelDialog(authResponseContext_->pageId);
LOGE("DmAuthManager OnMemberJoin start");
if (authRequestState_ != nullptr) {
timerMap_[ADD_TIMEOUT_TASK]->Stop(SESSION_CANCEL_TIMEOUT);
@@ -520,7 +518,7 @@ int32_t DmAuthManager::AddMember(const std::string &deviceId)
return DM_FAILED;
}
LOGI("DmAuthManager::authRequestContext CancelDisplay start");
- Ace::UIServiceMgrClient::GetInstance()->CancelDialog(authResponseContext_->aceId);
+ Ace::UIServiceMgrClient::GetInstance()->CancelDialog(authResponseContext_->pageId);
return DM_OK;
}
@@ -547,7 +545,13 @@ void DmAuthManager::AuthenticateFinish()
LOGI("DmAuthManager::AuthenticateFinish start");
if (authResponseState_ != nullptr) {
if (authResponseState_->GetStateType() == AuthState::AUTH_RESPONSE_FINISH) {
- Ace::UIServiceMgrClient::GetInstance()->CancelDialog(authResponseContext_->aceId);
+ Ace::UIServiceMgrClient::GetInstance()->CancelDialog(authResponseContext_->pageId);
+ }
+ if (authResponseState_->GetStateType() == AuthState::AUTH_RESPONSE_SHOW
+ && authResponseContext_->authType != 1) {
+ authMessageProcessor_->SetResponseContext(authResponseContext_);
+ std::string message = authMessageProcessor_->CreateSimpleMessage(MSG_TYPE_REQ_AUTH_TERMINATE);
+ softbusConnector_->GetSoftbusSession()->SendData(authResponseContext_->sessionId, message);
}
if (!timerMap_.empty()) {
for (auto &iter : timerMap_) {
@@ -569,7 +573,7 @@ void DmAuthManager::AuthenticateFinish()
}
if (authResponseContext_->state == AuthState::AUTH_REQUEST_INPUT) {
- Ace::UIServiceMgrClient::GetInstance()->CancelDialog(authResponseContext_->aceId);
+ Ace::UIServiceMgrClient::GetInstance()->CancelDialog(authResponseContext_->pageId);
}
listener_->OnAuthResult(authRequestContext_->hostPkgName, authRequestContext_->deviceId,
@@ -591,16 +595,6 @@ void DmAuthManager::AuthenticateFinish()
LOGI("DmAuthManager::AuthenticateFinish complete");
}
-void DmAuthManager::CancelDisplay()
-{
- LOGI("DmAuthManager::CancelDisplay start");
- nlohmann::json jsonObj;
- jsonObj[CANCEL_DISPLAY_KEY] = CANCEL_PIN_CODE_DISPLAY;
- std::string paramJson = jsonObj.dump();
- std::string pkgName = "com.ohos.devicemanagerui";
- listener_->OnFaCall(pkgName, paramJson);
-}
-
int32_t DmAuthManager::GeneratePincode()
{
return GenRandInt(MIN_PIN_CODE, MAX_PIN_CODE);
@@ -680,74 +674,37 @@ void DmAuthManager::ShowConfigDialog()
void DmAuthManager::ShowAuthInfoDialog()
{
LOGI("DmAuthManager::ShowAuthInfoDialog start");
+ if (authResponseContext_->authType == 1) {
+ authResponseContext_->certifiedParam = std::to_string(authResponseContext_->code);
+ } else {
+ authResponseContext_->certifiedParam = GenerateGroupName();
+ }
+
std::shared_ptr ptr;
- if (authenticationMap_.find(1) == authenticationMap_.end()) {
+ if (authenticationMap_.find(authResponseContext_->authType) == authenticationMap_.end()) {
LOGE("DmAuthManager::authenticationMap_ is null");
return;
}
- ptr = authenticationMap_[1];
+ ptr = authenticationMap_[authResponseContext_->authType];
LOGI("ShowAuthInfoDialog code:%d", authResponseContext_->code);
- ptr->ShowAuthInfo(authResponseContext_->code, shared_from_this());
+ ptr->ShowAuthInfo(authResponseContext_->certifiedParam, shared_from_this());
}
void DmAuthManager::ShowStartAuthDialog()
{
LOGI("DmAuthManager::ShowStartAuthDialog start");
std::shared_ptr ptr;
- if (authenticationMap_.find(1) == authenticationMap_.end()) {
+ if (authenticationMap_.find(authResponseContext_->authType) == authenticationMap_.end()) {
LOGE("DmAuthManager::authenticationMap_ is null");
return;
}
- ptr = authenticationMap_[1];
- ptr->StartAuth(authResponseContext_->code, shared_from_this());
-}
-
-int32_t DmAuthManager::GetAuthenticationParam(DmAuthParam &authParam)
-{
- if (dmAbilityMgr_ == nullptr) {
- LOGI("dmAbilityMgr_ is nullptr");
- return DM_POINT_NULL;
- }
-
- dmAbilityMgr_->StartAbilityDone();
- AbilityRole role = dmAbilityMgr_->GetAbilityRole();
- authParam.direction = (int32_t)role;
- authParam.authType = AUTH_TYPE_PIN;
- authParam.authToken = authResponseContext_->token;
-
- if (role == AbilityRole::ABILITY_ROLE_PASSIVE) {
- authResponseContext_->code = GeneratePincode();
- authParam.packageName = authResponseContext_->targetPkgName;
- authParam.appName = authResponseContext_->appName;
- authParam.appDescription = authResponseContext_->appDesc;
- authParam.business = BUSINESS_FA_MIRGRATION;
- authParam.pincode = authResponseContext_->code;
- }
- return DM_OK;
+ ptr = authenticationMap_[authResponseContext_->authType];
+ ptr->StartAuth(authResponseContext_->certifiedParam, shared_from_this());
}
-int32_t DmAuthManager::OnUserOperation(int32_t action)
+int32_t DmAuthManager::SetPageId(int32_t pageId)
{
- switch (action) {
- case USER_OPERATION_TYPE_ALLOW_AUTH:
- case USER_OPERATION_TYPE_CANCEL_AUTH:
- StartAuthProcess(action);
- break;
- case USER_OPERATION_TYPE_AUTH_CONFIRM_TIMEOUT:
- AuthenticateFinish();
- break;
- case USER_OPERATION_TYPE_CANCEL_PINCODE_DISPLAY:
- CancelDisplay();
- break;
- case USER_OPERATION_TYPE_CANCEL_PINCODE_INPUT:
- authRequestContext_->reason = DM_AUTH_DONT_AUTH;
- authResponseContext_->state = authRequestState_->GetStateType();
- AuthenticateFinish();
- break;
- default:
- LOGE("this action id not support");
- break;
- }
+ authResponseContext_->pageId = pageId;
return DM_OK;
}
@@ -783,25 +740,5 @@ void DmAuthManager::UserSwitchEventCallback (int32_t userId)
}
}
}
-
-void DmAuthManager::VerifyPinAuthAuthentication(const std::string &action)
-{
- LOGI("DmAuthManager::VerifyPinAuthAuthentication");
- timerMap_[INPUT_TIMEOUT_TASK]->Stop(SESSION_CANCEL_TIMEOUT);
- if (action == "0") {
- authRequestState_->TransitionTo(std::make_shared());
- }
- if (action == "1") {
- authRequestContext_->reason = DM_AUTH_INPUT_FAILED;
- authResponseContext_->state = authRequestState_->GetStateType();
- authRequestState_->TransitionTo(std::make_shared());
- }
- LOGI("DmAuthManager::VerifyAuthentication complete");
-}
-
-void DmAuthManager::ClosePage(const int32_t &id)
-{
- authResponseContext_->aceId = id;
-}
} // namespace DistributedHardware
} // namespace OHOS
diff --git a/services/devicemanagerservice/src/config/dm_config_manager.cpp b/services/devicemanagerservice/src/config/dm_config_manager.cpp
index b91a09276adbacb0105ada63d00fb711f43f172c..3b382f5967cd8a653269cb3f57864a6c71b4d024 100644
--- a/services/devicemanagerservice/src/config/dm_config_manager.cpp
+++ b/services/devicemanagerservice/src/config/dm_config_manager.cpp
@@ -284,7 +284,14 @@ void DmConfigManager::GetAuthAdapter(std::mapsecond).funcName.c_str());
auto func = (CreateIAuthAdapterFuncPtr)dlsym(so_handle, (iter->second).funcName.c_str());
+ if (dlerror() != nullptr) {
+ LOGE("Create object function is not exist 1");
+ }
+ if (func == nullptr) {
+ LOGE("Create object function is not exist 2");
+ }
if (dlerror() != nullptr || func == nullptr) {
LOGE("Create object function is not exist");
continue;
diff --git a/services/devicemanagerservice/src/dependency/hichain/hichain_connector.cpp b/services/devicemanagerservice/src/dependency/hichain/hichain_connector.cpp
index 22a50c39d2031d6ae48e308e4d656ebe56fbfa3d..990509de1a2c4f029ae36556e502cdd8e3141426 100644
--- a/services/devicemanagerservice/src/dependency/hichain/hichain_connector.cpp
+++ b/services/devicemanagerservice/src/dependency/hichain/hichain_connector.cpp
@@ -490,5 +490,26 @@ int32_t HiChainConnector::DeleteGroup(const int32_t userId, std::string &groupId
}
return DM_OK;
}
+
+int32_t HiChainConnector::DeleteTimeOutGroup(const char* deviceId)
+{
+ LOGE("HiChainConnector::DeleteTimeOutGroup start");
+ int32_t userId = MultipleUserConnector::GetCurrentAccountUserID();
+ if (userId < 0) {
+ LOGE("get current process account user id failed");
+ return DM_FAILED;
+ }
+ std::vector peerGroupInfoList;
+ GetRelatedGroups(deviceId, peerGroupInfoList);
+ char localDeviceId[DEVICE_UUID_LENGTH] = {0};
+ GetDevUdid(localDeviceId, DEVICE_UUID_LENGTH);
+ for (auto &group : peerGroupInfoList){
+ if (deviceGroupManager_->isDeviceInGroup(userId, DM_PKG_NAME.c_str(), group.groupId.c_str(), localDeviceId)){
+ DeleteGroup(group.groupId);
+ return DM_OK;
+ }
+ }
+ return DM_FAILED;
+}
} // namespace DistributedHardware
} // namespace OHOS
diff --git a/services/devicemanagerservice/src/dependency/timer/dm_timer.cpp b/services/devicemanagerservice/src/dependency/timer/dm_timer.cpp
index a33034f48a1ba692dd046fe310998c54a148f65d..8c9146f3460f51d88e84a55c11b5175d6262bde4 100644
--- a/services/devicemanagerservice/src/dependency/timer/dm_timer.cpp
+++ b/services/devicemanagerservice/src/dependency/timer/dm_timer.cpp
@@ -107,6 +107,10 @@ void DmTimer::WaitForTimeout()
int32_t nfds = epoll_wait(mEpFd_, mEvents_, MAX_EVENTS, mTimeOutSec_ * MILL_SECONDS_PER_SECOND);
if (nfds < 0) {
LOGE("DmTimer %s epoll_wait returned n=%d, error: %d", mTimerName_.c_str(), nfds, errno);
+ if (errno == EINTR) {
+ LOGI("DmTimer is stop");
+ return;
+ }
}
char event = 0;
diff --git a/services/devicemanagerservice/src/device_manager_service.cpp b/services/devicemanagerservice/src/device_manager_service.cpp
index 8a02d72652ff492a4d90a471db1de89b8175c9a4..146e1df66ffc9e94422bb29643b7a6d488eb1d91 100644
--- a/services/devicemanagerservice/src/device_manager_service.cpp
+++ b/services/devicemanagerservice/src/device_manager_service.cpp
@@ -77,7 +77,7 @@ int32_t DeviceManagerService::Init()
}
}
if (deviceStateMgr_ == nullptr) {
- deviceStateMgr_ = std::make_shared(softbusConnector_, listener_);
+ deviceStateMgr_ = std::make_shared(softbusConnector_, listener_, hiChainConnector_);
if (deviceStateMgr_ == nullptr) {
LOGE("Init failed, deviceStateMgr_ apply for failure");
return DM_MAKE_SHARED_FAIL;
@@ -245,24 +245,5 @@ int32_t DeviceManagerService::VerifyAuthentication(const std::string &authParam)
return authMgr_->VerifyAuthentication(authParam);
}
-int32_t DeviceManagerService::GetFaParam(std::string &pkgName, DmAuthParam &authParam)
-{
- if (pkgName.empty()) {
- LOGE("GetFaParam failed, pkgName is empty");
- return DM_INPUT_PARA_EMPTY;
- }
- authMgr_->GetAuthenticationParam(authParam);
- return DM_OK;
-}
-
-int32_t DeviceManagerService::SetUserOperation(std::string &pkgName, int32_t action)
-{
- if (pkgName.empty()) {
- LOGE("SetUserOperation failed, pkgName is empty");
- return DM_INPUT_PARA_EMPTY;
- }
- authMgr_->OnUserOperation(action);
- return DM_OK;
-}
} // namespace DistributedHardware
} // namespace OHOS
diff --git a/services/devicemanagerservice/src/devicestate/dm_device_state_manager.cpp b/services/devicemanagerservice/src/devicestate/dm_device_state_manager.cpp
index 8fc7214ac674ccef47a525787d456057e7b471c0..97a41f5f43a259c7b3446dc2fe96f38e87db6ffc 100644
--- a/services/devicemanagerservice/src/devicestate/dm_device_state_manager.cpp
+++ b/services/devicemanagerservice/src/devicestate/dm_device_state_manager.cpp
@@ -20,9 +20,21 @@
#include "dm_log.h"
namespace OHOS {
namespace DistributedHardware {
+static void TimeOut(void *data)
+{
+ LOGE("time out ");
+ std::shared_ptr deviceStateMgr = ((HmDevice *)data)->deviceStateMgr;
+ if (deviceStateMgr == nullptr) {
+ LOGE("OnDeviceOfflineTimeOut hmDevice owner = nullptr");
+ return;
+ }
+ deviceStateMgr->DeleteTimeOutGroup((HmDevice *)data);
+}
+
DmDeviceStateManager::DmDeviceStateManager(std::shared_ptr softbusConnector,
- std::shared_ptr listener)
- : softbusConnector_(softbusConnector), listener_(listener)
+ std::shared_ptr listener,
+ std::shared_ptr hiChainConnector)
+ : softbusConnector_(softbusConnector), listener_(listener), hiChainConnector_(hiChainConnector)
{
LOGI("DmDeviceStateManager constructor");
profileSoName_ = "libdevicemanagerext_profile.z.so";
@@ -37,6 +49,7 @@ DmDeviceStateManager::~DmDeviceStateManager()
void DmDeviceStateManager::OnDeviceOnline(const std::string &pkgName, const DmDeviceInfo &info)
{
LOGI("DmDeviceStateManager::OnDeviceOnline in");
+ RegisterOffLineTimer(info);
DmAdapterManager &adapterMgrPtr = DmAdapterManager::GetInstance();
std::shared_ptr profileAdapter = adapterMgrPtr.GetProfileAdapter(profileSoName_);
if (profileAdapter == nullptr) {
@@ -66,6 +79,7 @@ void DmDeviceStateManager::OnDeviceOnline(const std::string &pkgName, const DmDe
void DmDeviceStateManager::OnDeviceOffline(const std::string &pkgName, const DmDeviceInfo &info)
{
+ StartOffLineTimer(info);
DmAdapterManager &adapterMgrPtr = DmAdapterManager::GetInstance();
std::shared_ptr profileAdapter = adapterMgrPtr.GetProfileAdapter(profileSoName_);
if (profileAdapter == nullptr) {
@@ -113,5 +127,51 @@ int32_t DmDeviceStateManager::RegisterSoftbusStateCallback()
std::shared_ptr(shared_from_this()));
return DM_OK;
}
+
+void DmDeviceStateManager::RegisterOffLineTimer(const DmDeviceInfo &deviceInfo)
+{
+ std::string deviceId;
+ softbusConnector_->GetUdidByNetworkId(deviceInfo.deviceId, deviceId);
+ LOGI("Device<%s>Online", deviceId.c_str());
+ auto iter = mHmDeviceMap_.find(deviceId);
+ if (iter != mHmDeviceMap_.end()) {
+ iter->second->mOfflineTimerPtr->Stop(0);
+ return;
+ }
+
+ HmDevice *hmDevice = new HmDevice(deviceId, shared_from_this());
+ mHmDeviceMap_[hmDevice->mDeviceId] = hmDevice;
+}
+
+void DmDeviceStateManager::StartOffLineTimer(const DmDeviceInfo &deviceInfo)
+{
+ std::string deviceId;
+ softbusConnector_->GetUdidByNetworkId(deviceInfo.deviceId, deviceId);
+ LOGI("Device<%s>Offline", deviceId.c_str());
+ for (auto &iter : mHmDeviceMap_) {
+ if (iter.second->mDeviceId.compare(deviceId) == 0) {
+ iter.second->mOfflineTimerPtr->Start(OFFLINE_TIMEOUT, TimeOut, iter.second);
+ }
+ }
+}
+
+void DmDeviceStateManager::DeleteTimeOutGroup(HmDevice *hmDevice)
+{
+ LOGI("Remove DmDevice<%s> Hichain Group", hmDevice->mDeviceId.c_str());
+ hiChainConnector_->DeleteTimeOutGroup(hmDevice->mDeviceId.c_str());
+}
+
+HmDevice::HmDevice(std::string deviceId, std::shared_ptr stateMgr)
+{
+ mDeviceId = deviceId;
+ std::string timerName = "HmDeviceTimer";
+ mOfflineTimerPtr = std::make_shared(timerName);
+ deviceStateMgr = stateMgr;
+}
+
+HmDevice::~HmDevice()
+{
+ mOfflineTimerPtr = nullptr;
+}
} // namespace DistributedHardware
} // namespace OHOS
diff --git a/services/devicemanagerservice/src/ipc/standard/ipc_cmd_parser.cpp b/services/devicemanagerservice/src/ipc/standard/ipc_cmd_parser.cpp
index 2a61266b53f6988a4c8f1df2a628f3bd1d931ed2..c858a408223835240e44cadc510b5251d29e9333 100644
--- a/services/devicemanagerservice/src/ipc/standard/ipc_cmd_parser.cpp
+++ b/services/devicemanagerservice/src/ipc/standard/ipc_cmd_parser.cpp
@@ -386,50 +386,5 @@ ON_IPC_CMD(GET_UUID_BY_NETWORK, MessageParcel &data, MessageParcel &reply)
}
return DM_OK;
}
-
-ON_IPC_CMD(SERVER_GET_DMFA_INFO, MessageParcel &data, MessageParcel &reply)
-{
- std::string packName = data.ReadString();
- DmAuthParam authParam;
- int32_t ret = DM_OK;
- ret = DeviceManagerService::GetInstance().GetFaParam(packName, authParam);
- int32_t appIconLen = authParam.imageinfo.GetAppIconLen();
- int32_t appThumbnailLen = authParam.imageinfo.GetAppThumbnailLen();
-
- if (!reply.WriteInt32(authParam.direction) || !reply.WriteInt32(authParam.authType) ||
- !reply.WriteString(authParam.authToken) || !reply.WriteString(authParam.packageName) ||
- !reply.WriteString(authParam.appName) || !reply.WriteString(authParam.appDescription) ||
- !reply.WriteInt32(authParam.business) || !reply.WriteInt32(authParam.pincode) ||
- !reply.WriteInt32(appIconLen) || !reply.WriteInt32(appThumbnailLen)) {
- LOGE("write reply failed");
- return DM_IPC_FLATTEN_OBJECT;
- }
-
- if (appIconLen > 0 && authParam.imageinfo.GetAppIcon() != nullptr) {
- if (!reply.WriteRawData(authParam.imageinfo.GetAppIcon(), appIconLen)) {
- LOGE("write appIcon failed");
- return DM_IPC_FLATTEN_OBJECT;
- }
- }
- if (appThumbnailLen > 0 && authParam.imageinfo.GetAppThumbnail() != nullptr) {
- if (!reply.WriteRawData(authParam.imageinfo.GetAppThumbnail(), appThumbnailLen)) {
- LOGE("write appThumbnail failed");
- return DM_IPC_FLATTEN_OBJECT;
- }
- }
- return DM_OK;
-}
-
-ON_IPC_CMD(SERVER_USER_AUTH_OPERATION, MessageParcel &data, MessageParcel &reply)
-{
- std::string packageName = data.ReadString();
- int32_t action = data.ReadInt32();
- int result = DeviceManagerService::GetInstance().SetUserOperation(packageName, action);
- if (!reply.WriteInt32(action)) {
- LOGE("write result failed");
- return DM_WRITE_FAILED;
- }
- return result;
-}
} // namespace DistributedHardware
} // namespace OHOS
diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn
index fd0d387c720c81215493e802c43a7c7fea2765dc..8e3dbd99a44ad7edcb27a92eb8dc1ffdf8791940 100644
--- a/test/unittest/BUILD.gn
+++ b/test/unittest/BUILD.gn
@@ -105,14 +105,16 @@ ohos_unittest("UTTest_dm_device_state_manager") {
module_out_path = module_out_path
sources = [
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/src/adapter/standard/dm_adapter_manager.cpp",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/src/config/dm_config_manager.cpp",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/src/dependency/softbus/softbus_connector.cpp",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/src/dependency/softbus/softbus_session.cpp",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/src/dependency/timer/dm_timer.cpp",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/src/device_manager_service_listener.cpp",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/src/devicestate/dm_device_state_manager.cpp",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/src/discovery/dm_discovery_manager.cpp",
+ "${services_path}/src/adapter/standard/dm_adapter_manager.cpp",
+ "${services_path}/src/config/dm_config_manager.cpp",
+ "${services_path}/src/dependency/hichain/hichain_connector.cpp",
+ "${services_path}/src/dependency/multipleuser/multiple_user_connector.cpp",
+ "${services_path}/src/dependency/softbus/softbus_connector.cpp",
+ "${services_path}/src/dependency/softbus/softbus_session.cpp",
+ "${services_path}/src/dependency/timer/dm_timer.cpp",
+ "${services_path}/src/device_manager_service_listener.cpp",
+ "${services_path}/src/devicestate/dm_device_state_manager.cpp",
+ "${services_path}/src/discovery/dm_discovery_manager.cpp",
"//foundation/distributedhardware/devicemanager/test/unittest/mock/ipc_server_listener.cpp",
"//foundation/distributedhardware/devicemanager/test/unittest/mock/parameter.cpp",
"UTTest_dm_device_state_manager.cpp",
@@ -128,7 +130,7 @@ ohos_unittest("UTTest_device_manager_service_listener") {
module_out_path = module_out_path
sources = [
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/src/device_manager_service_listener.cpp",
+ "${services_path}/src/device_manager_service_listener.cpp",
"//foundation/distributedhardware/devicemanager/test/unittest/mock/ipc_server_listener.cpp",
"UTTest_device_manager_service_listener.cpp",
]
@@ -186,11 +188,11 @@ ohos_unittest("UTTest_dm_discovery_manager") {
module_out_path = module_out_path
sources = [
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/src/dependency/softbus/softbus_connector.cpp",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/src/dependency/softbus/softbus_session.cpp",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/src/dependency/timer/dm_timer.cpp",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/src/device_manager_service_listener.cpp",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/src/discovery/dm_discovery_manager.cpp",
+ "${services_path}/src/dependency/softbus/softbus_connector.cpp",
+ "${services_path}/src/dependency/softbus/softbus_session.cpp",
+ "${services_path}/src/dependency/timer/dm_timer.cpp",
+ "${services_path}/src/device_manager_service_listener.cpp",
+ "${services_path}/src/discovery/dm_discovery_manager.cpp",
"//foundation/distributedhardware/devicemanager/test/unittest/mock/ipc_server_listener.cpp",
"//foundation/distributedhardware/devicemanager/test/unittest/mock/parameter.cpp",
"UTTest_dm_discovery_manager.cpp",
@@ -205,10 +207,10 @@ config("device_manager_test_common_public_config") {
include_dirs = [
"//utils/native/base/include",
"//utils/system/safwk/native/include",
- "//foundation/distributedhardware/devicemanager/interfaces/inner_kits/native_cpp/include",
- "//foundation/distributedhardware/devicemanager/interfaces/inner_kits/native_cpp/include/ipc/standard",
- "//foundation/distributedhardware/devicemanager/interfaces/inner_kits/native_cpp/include/ipc",
- "//foundation/distributedhardware/devicemanager/interfaces/inner_kits/native_cpp/include/notify",
+ "${innerkits_path}/native_cpp/include",
+ "${innerkits_path}/native_cpp/include/ipc/standard",
+ "${innerkits_path}/native_cpp/include/ipc",
+ "${innerkits_path}/native_cpp/include/notify",
"//third_party/json/include",
"${common_path}/include",
"${common_path}/include/ipc",
@@ -219,25 +221,25 @@ config("device_manager_test_common_public_config") {
"${services_path}/include/dependency/timer",
"${services_path}/include/discovery",
"${services_path}/include/dependency/softbus",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include/dependency/softbus",
+ "${services_path}/include/dependency/softbus",
+ "${services_path}/include/authentication",
+ "${services_path}/include/adapter",
+ "${services_path}/include",
+ "${services_path}/include/ipc/standard",
+ "${services_path}/include/discovery",
+ "${services_path}/include/dependency/hichain",
+ "${services_path}/include/deviceinfo/",
+ "${services_path}/include/devicestate",
"//foundation/communication/dsoftbus/interfaces/kits/bus_center",
"//foundation/communication/softbus_lite/interfaces/kits/transport",
"//foundation/communication/ipc_lite/interfaces/kits",
"//foundation/communication/dsoftbus/interfaces/kits/common",
"//foundation/communication/dsoftbus/interfaces/kits/discovery",
"//foundation/communication/dsoftbus/interfaces/inner_kits/transport",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include/authentication",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include/adapter",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include/ipc/standard",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include/discovery",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include/dependency/hichain",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include/deviceinfo/",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include/devicestate",
"//foundation/distributedhardware/devicemanager/test/unittest/mock",
"//base/security/deviceauth/interfaces/innerkits",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include/ability",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include/config",
+ "${services_path}/include/ability",
+ "${services_path}/include/config",
]
cflags = [
@@ -263,16 +265,15 @@ ohos_static_library("device_manager_test_common") {
public_configs = [ ":device_manager_test_common_public_config" ]
public_deps = [
+ "${innerkits_path}/native_cpp:devicemanagersdk",
+ "${services_path}:devicemanagerservice",
"${utils_path}:devicemanagerutils",
"//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core",
- "//foundation/distributedhardware/devicemanager/interfaces/inner_kits/native_cpp:devicemanagersdk",
"//foundation/distributedhardware/devicemanager/interfaces/kits/js:devicemanager",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice:devicemanagerservice",
"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//utils/native/base:utils",
- "//utils/native/base:utils",
]
}
@@ -283,9 +284,9 @@ config("device_manager_test_common_public") {
include_dirs = [
"//utils/native/base/include",
"//utils/system/safwk/native/include",
- "//foundation/distributedhardware/devicemanager/interfaces/inner_kits/native_cpp/include",
- "//foundation/distributedhardware/devicemanager/interfaces/inner_kits/native_cpp/include/ipc",
- "//foundation/distributedhardware/devicemanager/interfaces/inner_kits/native_cpp/include/notify",
+ "${innerkits_path}/native_cpp/include",
+ "${innerkits_path}/native_cpp/include/ipc",
+ "${innerkits_path}/native_cpp/include/notify",
"//third_party/json/include",
"${common_path}/include",
"${common_path}/include/ipc",
@@ -296,23 +297,27 @@ config("device_manager_test_common_public") {
"${services_path}/include/dependency/timer",
"${services_path}/include/discovery",
"${services_path}/include/dependency/softbus",
+ "${services_path}/include/dependency/hichain",
+ "${services_path}/include/dependency/multipleuser",
+ "${services_path}/include/dependency/softbus",
+ "${services_path}/include/authentication",
+ "${services_path}/include/adapter",
+ "${services_path}/include",
+ "${services_path}/include/discovery",
+ "${services_path}/include/deviceinfo/",
+ "${services_path}/include/devicestate",
+ "//foundation/distributedhardware/devicemanager/test/unittest/mock/",
+ "${services_path}/include/ability",
+ "${services_path}/include/config",
"//foundation/communication/dsoftbus/interfaces/kits/bus_center",
"//foundation/communication/ipc_lite/interfaces/kits",
"//foundation/communication/dsoftbus/interfaces/kits/common",
"//foundation/communication/dsoftbus/interfaces/kits/discovery",
"//foundation/communication/dsoftbus/interfaces/inner_kits/transport",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include/dependency/softbus",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include/authentication",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include/adapter",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include/discovery",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include/dependency/hichain",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include/deviceinfo/",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include/devicestate",
- "//foundation/distributedhardware/devicemanager/test/unittest/mock/",
"//base/security/deviceauth/interfaces/innerkits",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include/ability",
- "//foundation/distributedhardware/devicemanager/services/devicemanagerservice/include/config",
+ "//base/account/os_account/interfaces/innerkits/osaccount/native/include",
+ "//base/account/os_account/frameworks/common/database/include",
+ "//base/account/os_account/frameworks/common/account_error/include",
]
cflags = [
@@ -338,9 +343,9 @@ ohos_static_library("device_manager_test") {
public_configs = [ ":device_manager_test_common_public" ]
public_deps = [
+ "${innerkits_path}/native_cpp:devicemanagersdk",
"${utils_path}:devicemanagerutils",
"//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core",
- "//foundation/distributedhardware/devicemanager/interfaces/inner_kits/native_cpp:devicemanagersdk",
"//foundation/distributedhardware/devicemanager/interfaces/kits/js:devicemanager",
"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
"//third_party/googletest:gmock",
@@ -351,6 +356,7 @@ ohos_static_library("device_manager_test") {
deps = [
"${innerkits_path}/native_cpp:devicemanagersdk",
"${utils_path}:devicemanagerutils",
+ "//base/account/os_account/frameworks/osaccount/native:os_account_innerkits",
"//base/security/deviceauth/services:deviceauth_sdk",
"//foundation/aafwk/standard/interfaces/innerkits/ability_manager:ability_manager",
"//foundation/aafwk/standard/interfaces/innerkits/want:want",
diff --git a/test/unittest/UTTest_dm_device_state_manager.cpp b/test/unittest/UTTest_dm_device_state_manager.cpp
index 83b6eb9c05613561ebf6eb7ec1f3bff9859780b1..507cdca5d066332d489fb0997d800cd881ce6b0e 100644
--- a/test/unittest/UTTest_dm_device_state_manager.cpp
+++ b/test/unittest/UTTest_dm_device_state_manager.cpp
@@ -23,6 +23,7 @@
#include "dm_device_state_manager.h"
#include "ipc_notify_device_found_req.h"
#include "ipc_notify_discover_result_req.h"
+#include "hichain_connector.h"
#include "UTTest_dm_device_state_manager.h"
namespace OHOS {
@@ -43,10 +44,11 @@ void DmDeviceStateManagerTest::TearDownTestCase()
{
}
namespace {
+ std::shared_ptr hiChainConnector_ = std::make_shared();
std::shared_ptr softbusConnector = std::make_shared();
std::shared_ptr listener_ = std::make_shared();
std::shared_ptr dmDeviceStateManager =
- std::make_shared(softbusConnector, listener_);
+ std::make_shared(softbusConnector, listener_, hiChainConnector_);
/**
* @tc.name: DmDeviceStateManager_001
@@ -56,7 +58,8 @@ std::shared_ptr dmDeviceStateManager =
*/
HWTEST_F(DmDeviceStateManagerTest, DmDeviceStateManager_001, testing::ext::TestSize.Level0)
{
- std::shared_ptr p = std::make_shared(softbusConnector, listener_);
+ std::shared_ptr p = std::make_shared(softbusConnector, listener_,
+ hiChainConnector_);
ASSERT_NE(p, nullptr);
}
@@ -68,7 +71,8 @@ HWTEST_F(DmDeviceStateManagerTest, DmDeviceStateManager_001, testing::ext::TestS
*/
HWTEST_F(DmDeviceStateManagerTest, DmDeviceStateManager_002, testing::ext::TestSize.Level0)
{
- std::shared_ptr p = std::make_shared(softbusConnector, listener_);
+ std::shared_ptr p = std::make_shared(softbusConnector, listener_,
+ hiChainConnector_);
p.reset();
EXPECT_EQ(p, nullptr);
}
diff --git a/test/unittest/mock/device_auth.h b/test/unittest/mock/device_auth.h
index 39b701f894cc4f7c38a9b204873b120c8a83570c..68e7cba41e08f83cc745f6d9c1812ae402f76999 100644
--- a/test/unittest/mock/device_auth.h
+++ b/test/unittest/mock/device_auth.h
@@ -4,7 +4,7 @@
* 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
+ * 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,
@@ -16,10 +16,11 @@
#ifndef DEVICE_AUTH_H
#define DEVICE_AUTH_H
-#include
+#include
+#include
#if defined(__LINUX__) || defined(_UNIX)
-#define DEVICE_AUTH_API_PUBLIC __attribute__((visibility("default")))
+#define DEVICE_AUTH_API_PUBLIC __attribute__ ((visibility("default")))
#else
#define DEVICE_AUTH_API_PUBLIC
#endif
@@ -65,51 +66,68 @@
#define FIELD_GROUP_VISIBILITY "groupVisibility"
#define FIELD_EXPIRE_TIME "expireTime"
#define FIELD_IS_DELETE_ALL "isDeleteAll"
+#define FIELD_BLE_CHALLENGE "bleChallenge"
+#define FIELD_OS_ACCOUNT_ID "osAccountId"
-enum GroupType {
+typedef enum {
+ DEFAULT_OS_ACCOUNT = 0,
+ INVALID_OS_ACCOUNT = -1,
+ ANY_OS_ACCOUNT = -2,
+} OsAccountEnum;
+
+typedef enum {
ALL_GROUP = 0,
IDENTICAL_ACCOUNT_GROUP = 1,
PEER_TO_PEER_GROUP = 256,
COMPATIBLE_GROUP = 512,
ACROSS_ACCOUNT_AUTHORIZE_GROUP = 1282
-};
+} GroupType;
-enum GroupOperationCode {
+typedef enum {
GROUP_CREATE = 0,
GROUP_DISBAND = 1,
MEMBER_INVITE = 2,
MEMBER_JOIN = 3,
MEMBER_DELETE = 4,
ACCOUNT_BIND = 5
-};
+} GroupOperationCode;
-enum GroupAuthForm {
+typedef enum {
AUTH_FORM_INVALID_TYPE = -1,
AUTH_FORM_ACCOUNT_UNRELATED = 0,
AUTH_FORM_IDENTICAL_ACCOUNT = 1,
AUTH_FORM_ACROSS_ACCOUNT = 2,
-};
+} GroupAuthForm;
-enum CredentialCode {
- CREDENTIAL_SAVE = 0,
- CREDENTIAL_CLEAR = 1,
- CREDENTIAL_UPDATE = 2,
- CREDENTIAL_QUERY = 3,
-};
+typedef enum {
+ IMPORT_SELF_CREDENTIAL = 0,
+ DELETE_SELF_CREDENTIAL = 1,
+ QUERY_SELF_CREDENTIAL_INFO = 2,
+ IMPORT_TRUSTED_CREDENTIALS = 3,
+ DELETE_TRUSTED_CREDENTIALS = 4,
+ QUERY_TRUSTED_CREDENTIALS = 5,
+ REQUEST_SIGNATURE = 6,
+} CredentialCode;
-enum UserType {
+typedef enum {
DEVICE_TYPE_ACCESSORY = 0,
DEVICE_TYPE_CONTROLLER = 1,
DEVICE_TYPE_PROXY = 2
-};
+} UserType;
+
+typedef enum {
+ EXPIRE_TIME_INDEFINITE = -1,
+ EXPIRE_TIME_MIN = 1,
+ EXPIRE_TIME_MAX = 90,
+} ExpireTime;
-enum RequestResponse {
+typedef enum {
REQUEST_REJECTED = 0x80000005,
REQUEST_ACCEPTED = 0x80000006,
REQUEST_WAITING = 0x80000007
-};
+} RequestResponse;
-struct DataChangeListener {
+typedef struct {
void (*onGroupCreated)(const char *groupInfo);
void (*onGroupDeleted)(const char *groupInfo);
void (*onDeviceBound)(const char *peerUdid, const char *groupInfo);
@@ -117,38 +135,40 @@ struct DataChangeListener {
void (*onDeviceNotTrusted)(const char *peerUdid);
void (*onLastGroupDeleted)(const char *peerUdid, int groupType);
void (*onTrustedDeviceNumChanged)(int curTrustedDeviceNum);
-};
+} DataChangeListener;
-struct DeviceAuthCallback {
+typedef struct {
bool (*onTransmit)(int64_t requestId, const uint8_t *data, uint32_t dataLen);
void (*onSessionKeyReturned)(int64_t requestId, const uint8_t *sessionKey, uint32_t sessionKeyLen);
void (*onFinish)(int64_t requestId, int operationCode, const char *returnData);
void (*onError)(int64_t requestId, int operationCode, int errorCode, const char *errorReturn);
char *(*onRequest)(int64_t requestId, int operationCode, const char *reqParams);
-};
+} DeviceAuthCallback;
-struct GroupAuthManager {
+typedef struct {
int32_t (*processData)(int64_t authReqId, const uint8_t *data, uint32_t dataLen,
- const DeviceAuthCallback *gaCallback);
+ const DeviceAuthCallback *gaCallback);
int32_t (*queryTrustedDeviceNum)(void);
bool (*isTrustedDevice)(const char *udid);
- int32_t (*getAuthState)(int64_t authReqId, const char *groupId, const char *peerUdid, uint8_t *out,
- uint32_t *outLen);
- int32_t (*authDevice)(int64_t authReqId, const char *authParams, const DeviceAuthCallback *gaCallback);
+ int32_t (*getAuthState)(int64_t authReqId, const char *groupId, const char *peerUdid,
+ uint8_t *out, uint32_t *outLen);
+ int32_t (*authDevice)(int32_t osAccountId, int64_t authReqId, const char *authParams,
+ const DeviceAuthCallback *gaCallback);
void (*informDeviceDisconnection)(const char *udid);
-};
+} GroupAuthManager;
-struct DeviceGroupManager {
+typedef struct {
int32_t (*regCallback)(const char *appId, const DeviceAuthCallback *callback);
int32_t (*unRegCallback)(const char *appId);
int32_t (*regDataChangeListener)(const char *appId, const DataChangeListener *listener);
int32_t (*unRegDataChangeListener)(const char *appId);
- int32_t (*createGroup)(int64_t requestId, const char *appId, const char *createParams);
- int32_t (*deleteGroup)(int64_t requestId, const char *appId, const char *disbandParams);
- int32_t (*addMemberToGroup)(int64_t requestId, const char *appId, const char *addParams);
- int32_t (*deleteMemberFromGroup)(int64_t requestId, const char *appId, const char *deleteParams);
+ int32_t (*createGroup)(int32_t osAccountId, int64_t requestId, const char *appId, const char *createParams);
+ int32_t (*deleteGroup)(int32_t osAccountId, int64_t requestId, const char *appId, const char *disbandParams);
+ int32_t (*addMemberToGroup)(int32_t osAccountId, int64_t requestId, const char *appId, const char *addParams);
+ int32_t (*deleteMemberFromGroup)(int32_t osAccountId, int64_t requestId, const char *appId,
+ const char *deleteParams);
int32_t (*processData)(int64_t requestId, const uint8_t *data, uint32_t dataLen);
- int32_t (*confirmRequest)(int64_t requestId, const char *appId, const char *confirmParams);
+ int32_t (*confirmRequest)(int32_t osAccountId, int64_t requestId, const char *appId, const char *confirmParams);
int32_t (*bindPeer)(int64_t requestId, const char *appId, const char *bindParams);
int32_t (*unbindPeer)(int64_t requestId, const char *appId, const char *unbindParams);
int32_t (*processLiteData)(int64_t requestId, const char *appId, const uint8_t *data, uint32_t dataLen);
@@ -157,24 +177,32 @@ struct DeviceGroupManager {
int32_t (*processCredential)(int operationCode, const char *reqJsonStr, char **returnJsonStr);
int32_t (*getRegisterInfo)(char **returnRegisterInfo);
int32_t (*getLocalConnectInfo)(char *returnInfo, int32_t bufLen);
- int32_t (*checkAccessToGroup)(const char *appId, const char *groupId);
- int32_t (*getPkInfoList)(const char *appId, const char *queryParams, char **returnInfoList,
- uint32_t *returnInfoNum);
- int32_t (*addGroupManager)(const char *appId, const char *groupId, const char *managerAppId);
- int32_t (*addGroupFriend)(const char *appId, const char *groupId, const char *friendAppId);
- int32_t (*deleteGroupManager)(const char *appId, const char *groupId, const char *managerAppId);
- int32_t (*deleteGroupFriend)(const char *appId, const char *groupId, const char *friendAppId);
- int32_t (*getGroupManagers)(const char *appId, const char *groupId, char **returnManagers, uint32_t *returnSize);
- int32_t (*getGroupFriends)(const char *appId, const char *groupId, char **returnFriends, uint32_t *returnSize);
- int32_t (*getGroupInfoById)(const char *appId, const char *groupId, char **returnGroupInfo);
- int32_t (*getGroupInfo)(const char *appId, const char *queryParams, char **returnGroupVec, uint32_t *groupNum);
- int32_t (*getJoinedGroups)(const char *appId, int groupType, char **returnGroupVec, uint32_t *groupNum);
- int32_t (*getRelatedGroups)(const char *appId, const char *peerDeviceId, char **returnGroupVec, uint32_t *groupNum);
- int32_t (*getDeviceInfoById)(const char *appId, const char *deviceId, const char *groupId, char **returnDeviceInfo);
- int32_t (*getTrustedDevices)(const char *appId, const char *groupId, char **returnDevInfoVec, uint32_t *deviceNum);
- bool (*isDeviceInGroup)(const char *appId, const char *groupId, const char *deviceId);
+ int32_t (*checkAccessToGroup)(int32_t osAccountId, const char *appId, const char *groupId);
+ int32_t (*getPkInfoList)(int32_t osAccountId, const char *appId, const char *queryParams, char **returnInfoList,
+ uint32_t *returnInfoNum);
+ int32_t (*addGroupManager)(int32_t osAccountId, const char *appId, const char *groupId, const char *managerAppId);
+ int32_t (*addGroupFriend)(int32_t osAccountId, const char *appId, const char *groupId, const char *friendAppId);
+ int32_t (*deleteGroupManager)(int32_t osAccountId, const char *appId, const char *groupId,
+ const char *managerAppId);
+ int32_t (*deleteGroupFriend)(int32_t osAccountId, const char *appId, const char *groupId, const char *friendAppId);
+ int32_t (*getGroupManagers)(int32_t osAccountId, const char *appId, const char *groupId, char **returnManagers,
+ uint32_t *returnSize);
+ int32_t (*getGroupFriends)(int32_t osAccountId, const char *appId, const char *groupId,
+ char **returnFriends, uint32_t *returnSize);
+ int32_t (*getGroupInfoById)(int32_t osAccountId, const char *appId, const char *groupId, char **returnGroupInfo);
+ int32_t (*getGroupInfo)(int32_t osAccountId, const char *appId, const char *queryParams,
+ char **returnGroupVec, uint32_t *groupNum);
+ int32_t (*getJoinedGroups)(int32_t osAccountId, const char *appId, int groupType,
+ char **returnGroupVec, uint32_t *groupNum);
+ int32_t (*getRelatedGroups)(int32_t osAccountId, const char *appId, const char *peerDeviceId,
+ char **returnGroupVec, uint32_t *groupNum);
+ int32_t (*getDeviceInfoById)(int32_t osAccountId, const char *appId, const char *deviceId, const char *groupId,
+ char **returnDeviceInfo);
+ int32_t (*getTrustedDevices)(int32_t osAccountId, const char *appId, const char *groupId,
+ char **returnDevInfoVec, uint32_t *deviceNum);
+ bool (*isDeviceInGroup)(int32_t osAccountId, const char *appId, const char *groupId, const char *deviceId);
void (*destroyInfo)(char **returnInfo);
-};
+} DeviceGroupManager;
#ifdef __cplusplus
extern "C" {
diff --git a/test/unittest/mock/parameter.cpp b/test/unittest/mock/parameter.cpp
index a51d9ed9371769c4abf055d1e37e95aa6524e528..99fa1c54e68aef636a0716033158640d33abdb97 100644
--- a/test/unittest/mock/parameter.cpp
+++ b/test/unittest/mock/parameter.cpp
@@ -29,3 +29,8 @@ int WatchParameter(const char *keyprefix, ParameterChgPtr callback, void *contex
{
return 0;
}
+
+int GetDevUdid(char *udid, int size)
+{
+ return 0;
+}
\ No newline at end of file
diff --git a/test/unittest/mock/parameter.h b/test/unittest/mock/parameter.h
index 23da1b6a60ebf597bb6dc6fddbab8e58b4da85ec..77b456430108bc778dbb64ada18c40cb9fe43014 100644
--- a/test/unittest/mock/parameter.h
+++ b/test/unittest/mock/parameter.h
@@ -29,6 +29,7 @@ int SetParameter(const char *key, const char *value);
typedef void (*ParameterChgPtr)(const char *key, const char *value, void *context);
int WatchParameter(const char *keyprefix, ParameterChgPtr callback, void *context);
+int GetDevUdid(char *udid, int size);
#ifdef __cplusplus
#if __cplusplus
}