diff --git a/customization/BUILD.gn b/customization/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..b22d774528cc37416601afa76d26533713e11c31
--- /dev/null
+++ b/customization/BUILD.gn
@@ -0,0 +1,21 @@
+# Copyright (C) 2022 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("//build/ohos_var.gni")
+
+group("customization") {
+ testonly = true
+ if (is_standard_system) {
+ deps = [ "enterprise_device_management:edm_test_grop" ]
+ }
+}
diff --git a/customization/enterprise_device_management/BUILD.gn b/customization/enterprise_device_management/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..4f95ba3d5854bcf62e9761174ea969adf102de93
--- /dev/null
+++ b/customization/enterprise_device_management/BUILD.gn
@@ -0,0 +1,40 @@
+# Copyright (C) 2022 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("//test/xts/tools/build/suite.gni")
+
+group("edm_test_grop") {
+ testonly = true
+ if (is_standard_system) {
+ deps = [
+ ":edm_test",
+ "edmsceneone:edmJstest1",
+ ]
+ }
+}
+ohos_js_hap_suite("edm_test") {
+ hap_profile = "./src/main/config.json"
+ deps = [
+ ":edm_assets",
+ ":edm_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+ hap_name = "ActsEdmJsTest"
+}
+ohos_js_assets("edm_assets") {
+ source_dir = "./src/main/js/default"
+}
+ohos_resources("edm_resources") {
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
+}
diff --git a/customization/enterprise_device_management/Test.json b/customization/enterprise_device_management/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..5e86cfd7e8945b8469ab99557f0aef2edc12fc0d
--- /dev/null
+++ b/customization/enterprise_device_management/Test.json
@@ -0,0 +1,32 @@
+{
+ "description": "Configuration for enterprise device management Tests",
+ "driver": {
+ "type": "JSUnitTest",
+ "test-timeout": "300000",
+ "package": "ohos.edm.test",
+ "shell-timeout": "60000"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsEdmJsTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ },
+ {
+ "type": "PushKit",
+ "push": [
+ "edmJstest1.hap->/data/edmJstest1.hap"
+ ]
+
+ },
+ {
+ "type": "ShellKit",
+ "run-command": [
+ "chmod 644 /data/*.hap",
+ "param set ro.config.pass_edm_permission true"
+ ]
+ }
+ ]
+}
diff --git a/customization/enterprise_device_management/edmsceneone/BUILD.gn b/customization/enterprise_device_management/edmsceneone/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..285ca9c48e90647bc5874e0eb8066470b6b0b8bb
--- /dev/null
+++ b/customization/enterprise_device_management/edmsceneone/BUILD.gn
@@ -0,0 +1,34 @@
+# Copyright (c) 2022 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("//test/xts/tools/build/suite.gni")
+
+ohos_hap("edmJstest1") {
+ hap_profile = "./src/main/config.json"
+ hap_name = "edmJstest1"
+ subsystem_name = XTS_SUITENAME
+ final_hap_path =
+ "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
+ testonly = true
+ deps = [
+ ":hjs_demo_js_assets",
+ ":hjs_demo_resources",
+ ]
+ certificate_profile = "./signature/openharmony_sx.p7b"
+}
+ohos_js_assets("hjs_demo_js_assets") {
+ source_dir = "./src/main/js/default"
+}
+ohos_resources("hjs_demo_resources") {
+ sources = [ "./src/main/js/resources" ]
+ hap_profile = "./src/main/config.json"
+}
diff --git a/customization/enterprise_device_management/edmsceneone/Test.json b/customization/enterprise_device_management/edmsceneone/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..7a88763ed8d2ac31dd30211b9574f47273e84549
--- /dev/null
+++ b/customization/enterprise_device_management/edmsceneone/Test.json
@@ -0,0 +1,3 @@
+{
+ "description": "Configuration for hjunit demo Tests",
+}
diff --git a/customization/enterprise_device_management/edmsceneone/signature/openharmony_sx.p7b b/customization/enterprise_device_management/edmsceneone/signature/openharmony_sx.p7b
new file mode 100644
index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5
Binary files /dev/null and b/customization/enterprise_device_management/edmsceneone/signature/openharmony_sx.p7b differ
diff --git a/customization/enterprise_device_management/edmsceneone/src/main/config.json b/customization/enterprise_device_management/edmsceneone/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..c1c32d47cc53efd2668e3f263a97b420a384e3a3
--- /dev/null
+++ b/customization/enterprise_device_management/edmsceneone/src/main/config.json
@@ -0,0 +1,70 @@
+{
+ "app": {
+ "bundleName": "com.example.myapplication1",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 5,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.example.myapplication1",
+ "name": ".MyApplication1",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": ".MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:app_name",
+ "type": "page",
+ "isVisible": "true",
+ "launchType": "standard",
+ "language": "C++",
+ "metaData": {
+ "customizeData": [
+ {
+ "name": "originWidgetName",
+ "value": "com.weather.testWidget"
+ }
+ ]
+ }
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/customization/enterprise_device_management/edmsceneone/src/main/js/default/app.js b/customization/enterprise_device_management/edmsceneone/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..2d316a0a089b332c5c28729be9ff937aa46618c5
--- /dev/null
+++ b/customization/enterprise_device_management/edmsceneone/src/main/js/default/app.js
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2022 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.
+ */
+export default {
+ onCreate() {
+ console.info('AceApplication onCreate');
+ },
+ onDestroy() {
+ console.info('AceApplication onDestroy');
+ }
+};
diff --git a/customization/enterprise_device_management/edmsceneone/src/main/js/default/i18n/en-US.json b/customization/enterprise_device_management/edmsceneone/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/customization/enterprise_device_management/edmsceneone/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ }
+}
\ No newline at end of file
diff --git a/customization/enterprise_device_management/edmsceneone/src/main/js/default/i18n/zh-CN.json b/customization/enterprise_device_management/edmsceneone/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/customization/enterprise_device_management/edmsceneone/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
+}
\ No newline at end of file
diff --git a/customization/enterprise_device_management/edmsceneone/src/main/js/default/pages/index/index.css b/customization/enterprise_device_management/edmsceneone/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/customization/enterprise_device_management/edmsceneone/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/customization/enterprise_device_management/edmsceneone/src/main/js/default/pages/index/index.hml b/customization/enterprise_device_management/edmsceneone/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184
--- /dev/null
+++ b/customization/enterprise_device_management/edmsceneone/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/customization/enterprise_device_management/edmsceneone/src/main/js/default/pages/index/index.js b/customization/enterprise_device_management/edmsceneone/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..eb5be916aa414adb35cf8541635725d702a893dc
--- /dev/null
+++ b/customization/enterprise_device_management/edmsceneone/src/main/js/default/pages/index/index.js
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2022 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.
+ */
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ }
+}
diff --git a/customization/enterprise_device_management/edmsceneone/src/main/js/resources/base/element/string.json b/customization/enterprise_device_management/edmsceneone/src/main/js/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..21f88982736302157aad1cc00a3735adf299eccb
--- /dev/null
+++ b/customization/enterprise_device_management/edmsceneone/src/main/js/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "bmssceneone"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/customization/enterprise_device_management/edmsceneone/src/main/js/resources/base/media/icon.png b/customization/enterprise_device_management/edmsceneone/src/main/js/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/customization/enterprise_device_management/edmsceneone/src/main/js/resources/base/media/icon.png differ
diff --git a/customization/enterprise_device_management/signature/openharmony_sx.p7b b/customization/enterprise_device_management/signature/openharmony_sx.p7b
new file mode 100644
index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858
Binary files /dev/null and b/customization/enterprise_device_management/signature/openharmony_sx.p7b differ
diff --git a/customization/enterprise_device_management/src/main/config.json b/customization/enterprise_device_management/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..5e6a9d1ec0a740b77fbaf6ec2ffb24b53cddc0fe
--- /dev/null
+++ b/customization/enterprise_device_management/src/main/config.json
@@ -0,0 +1,74 @@
+{
+ "app": {
+ "bundleName": "ohos.edm.test",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "ohos.edm.test",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "visible": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "name": "ohos.edm.test.MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "MyApplication",
+ "type": "page",
+ "launchType": "standard"
+ }
+ ],
+ "reqPermissions": [
+ {
+ "name":"ohos.permission.GET_BUNDLE_INFO",
+ "reason":"need use ohos.permission.GET_BUNDLE_INFO"
+ },
+ {
+ "name":"ohos.permission.INSTALL_BUNDLE",
+ "reason":"need use ohos.permission.GET_BUNDLE_INFO"
+ },
+ {
+ "name":"ohos.permission.EDM_MANAGE_DATETIME",
+ "reason":"need use EDM_MANAGE_DATETIME"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ]
+ }
+}
diff --git a/customization/enterprise_device_management/src/main/js/default/app.js b/customization/enterprise_device_management/src/main/js/default/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..c1a2274b034140503e7ef5347935c10c69a96d59
--- /dev/null
+++ b/customization/enterprise_device_management/src/main/js/default/app.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate');
+ },
+ onDestroy() {
+ console.info('TestApplication onDestroy');
+ }
+};
diff --git a/customization/enterprise_device_management/src/main/js/default/i18n/en-US.json b/customization/enterprise_device_management/src/main/js/default/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c
--- /dev/null
+++ b/customization/enterprise_device_management/src/main/js/default/i18n/en-US.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ }
+}
\ No newline at end of file
diff --git a/customization/enterprise_device_management/src/main/js/default/i18n/zh-CN.json b/customization/enterprise_device_management/src/main/js/default/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f
--- /dev/null
+++ b/customization/enterprise_device_management/src/main/js/default/i18n/zh-CN.json
@@ -0,0 +1,6 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ }
+}
\ No newline at end of file
diff --git a/customization/enterprise_device_management/src/main/js/default/pages/index/index.css b/customization/enterprise_device_management/src/main/js/default/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf
--- /dev/null
+++ b/customization/enterprise_device_management/src/main/js/default/pages/index/index.css
@@ -0,0 +1,9 @@
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/customization/enterprise_device_management/src/main/js/default/pages/index/index.hml b/customization/enterprise_device_management/src/main/js/default/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..1c26cf73deab18390844a53a103458b10ed11e93
--- /dev/null
+++ b/customization/enterprise_device_management/src/main/js/default/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
diff --git a/customization/enterprise_device_management/src/main/js/default/pages/index/index.js b/customization/enterprise_device_management/src/main/js/default/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..fc9eda0c61a0529da9627bc4bb29fd34f6ce81a7
--- /dev/null
+++ b/customization/enterprise_device_management/src/main/js/default/pages/index/index.js
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2022 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 {Core, ExpectExtend} from 'deccjsunit/index'
+
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ const core = Core.getInstance()
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ })
+ core.addService('expect', expectExtend)
+ core.init()
+
+ const configService = core.getDefaultService('config')
+ configService.setConfig(this)
+
+ require('../../test/List.test')
+ core.execute()
+ },
+ onReady() {
+ },
+}
diff --git a/customization/enterprise_device_management/src/main/js/default/test/EnterpriseDeviceManager.test.js b/customization/enterprise_device_management/src/main/js/default/test/EnterpriseDeviceManager.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..64e0554d6293845645ec913205bb9829efc0c5e3
--- /dev/null
+++ b/customization/enterprise_device_management/src/main/js/default/test/EnterpriseDeviceManager.test.js
@@ -0,0 +1,397 @@
+/*
+ * Copyright (C) 2022 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
+import bundle from '@ohos.bundle'
+import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager'
+
+const PATH = "/data/"
+const EDMJSTEST1 = "edmJstest1.hap"
+const WANT1 = {
+ bundleName: "com.example.myapplication1",
+ abilityName: "com.example.myapplication1.MainAbility"
+};
+
+const SELFWANT = {
+ bundleName: "ohos.edm.test",
+ abilityName: "ohos.edm.test.MainAbility"
+};
+const HAPNAME1 = "com.example.myapplication1"
+const SELFHAPNAME = "ohos.edm.test"
+const COMPANYNAME2 = "company2"
+const DESCRIPTION2 = "edm demo2"
+const ENTINFO1 = {
+ name: "company",
+ description: "edm demo"
+};
+
+const ENTINFO2 = {
+ name: "company2",
+ description: "edm demo2"
+};
+
+describe('EnterpriseDeviceManagerTest', function () {
+ console.log('*************start EnterpriseDeviceManagerTest*************');
+
+ /**
+ * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0100
+ * @tc.name test activateAdmin method in promise mode
+ * @tc.desc activate admin in promise mode
+ */
+ it('activateAdmin_test_001', 0, async function (done) {
+ let installData = await bundle.getBundleInstaller()
+ installData.install([PATH + EDMJSTEST1], {
+ userId: 100,
+ installFlag: 0,
+ isKeepData: false
+ }, async (err, data) => {
+ expect(err.code).assertEqual(0);
+ expect(data.status).assertEqual(0);
+ expect(data.statusMessage).assertEqual('SUCCESS');
+ await bundle.getBundleInfo(HAPNAME1,
+ bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION).then(datainfo => {
+ console.info("getBundleInfo success:" + JSON.stringify(datainfo));
+ });
+ activateAdmin();
+ });
+ async function activateAdmin() {
+ var retValue = await enterpriseDeviceManager.activateAdmin(WANT1, ENTINFO1,
+ enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL);
+ console.log('enterpriseDeviceManager.activateAdmin ADMIN_TYPE_NORMAL : ' + retValue);
+ expect(retValue).assertTrue();
+
+ var isActive = await enterpriseDeviceManager.isAdminAppActive(WANT1);
+ console.log('enterpriseDeviceManager.isAdminAppActive : ' + isActive);
+ expect(isActive).assertTrue();
+
+ retValue = await enterpriseDeviceManager.deactivateAdmin(WANT1);
+ console.log('enterpriseDeviceManager.deactivateAdmin : ' + retValue);
+ expect(retValue).assertTrue();
+
+ isActive = await enterpriseDeviceManager.isAdminAppActive(WANT1);
+ console.log('enterpriseDeviceManager.isAdminAppActive : ' + isActive);
+ expect(isActive).assertFalse();
+
+ installData.uninstall(HAPNAME1, {
+ userId: 100,
+ installFlag: 0,
+ isKeepData: false
+ }, (err, data) => {
+ expect(err.code).assertEqual(0);
+ expect(data.status).assertEqual(0);
+ expect(data.statusMessage).assertEqual('SUCCESS');
+ done();
+ });
+ }
+ })
+
+ /**
+ * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0200
+ * @tc.name test activateAdmin method in callback mode
+ * @tc.desc activate admin in callback mode
+ */
+ it('activateAdmin_test_002', 0, async function (done) {
+ let installData = await bundle.getBundleInstaller()
+ installData.install([PATH + EDMJSTEST1], {
+ userId: 100,
+ installFlag: 0,
+ isKeepData: false
+ }, async (err, data) => {
+ expect(err.code).assertEqual(0);
+ expect(data.status).assertEqual(0);
+ expect(data.statusMessage).assertEqual('SUCCESS');
+ activateAdmin();
+ });
+ async function activateAdmin() {
+ console.log('activateAdmin()');
+ var retValue = await enterpriseDeviceManager.activateAdmin(WANT1, ENTINFO1,
+ enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, OnReceiveEvent);
+ async function OnReceiveEvent(err, datainfo) {
+ console.log('enterpriseDeviceManager.activateAdmin ADMIN_TYPE_NORMAL :' + datainfo);
+ expect(datainfo).assertTrue();
+
+ var isActive = await enterpriseDeviceManager.isAdminAppActive(WANT1);
+ console.log('enterpriseDeviceManager.isAdminAppActive :' + isActive);
+ expect(isActive).assertTrue();
+
+ retValue = await enterpriseDeviceManager.deactivateAdmin(WANT1);
+ console.log('enterpriseDeviceManager.deactivateAdmin : ' + retValue);
+ expect(retValue).assertTrue();
+
+ isActive = await enterpriseDeviceManager.isAdminAppActive(WANT1);
+ console.log('enterpriseDeviceManager.isAdminAppActive : ' + isActive);
+ expect(isActive).assertFalse();
+
+ installData.uninstall(HAPNAME1, {
+ userId: 100,
+ installFlag: 0,
+ isKeepData: false
+ }, (err, data) => {
+ expect(err.code).assertEqual(0);
+ expect(data.status).assertEqual(0);
+ expect(data.statusMessage).assertEqual('SUCCESS');
+ done();
+ });
+ }
+ }
+ })
+
+
+ /**
+ * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0300
+ * @tc.name test activateAdmin method in promise mode with ADMIN_TYPE_SUPER param
+ * @tc.desc activate super admin in promise mode
+ */
+ it('activateAdmin_test_003', 0, async function (done) {
+ await bundle.getBundleInfo(SELFHAPNAME,
+ bundle.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION).then(datainfo => {
+ console.info("getBundleInfo success:" + JSON.stringify(datainfo));
+ });
+
+ console.log('enterpriseDeviceManager.activateAdmin ADMIN_TYPE_SUPER');
+ var retValue = await enterpriseDeviceManager.activateAdmin(SELFWANT, ENTINFO1,
+ enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER);
+ console.log('enterpriseDeviceManager.activateAdmin ADMIN_TYPE_SUPER : ' + retValue);
+ expect(retValue).assertTrue();
+
+ var isActive = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME);
+ console.log('enterpriseDeviceManager.isSuperAdmin :' + isActive);
+ expect(isActive).assertTrue();
+
+ retValue = await enterpriseDeviceManager.deactivateSuperAdmin(SELFHAPNAME);
+ console.log('enterpriseDeviceManager.deactivateSuperAdmin : ' + retValue);
+ expect(retValue).assertTrue();
+
+ isActive = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME);
+ console.log('enterpriseDeviceManager.isSuperAdmin : ' + isActive);
+ expect(isActive).assertFalse();
+ done();
+ })
+
+ /**
+ * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0400
+ * @tc.name test activateAdmin method in callback mode with ADMIN_TYPE_SUPER param
+ * @tc.desc activate super admin in callback mode
+ */
+ it('activateAdmin_test_004', 0, async function (done) {
+ var retValue = await enterpriseDeviceManager.activateAdmin(SELFWANT, ENTINFO1,
+ enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, OnReceiveEvent);
+ async function OnReceiveEvent(err, datainfo) {
+ console.log('enterpriseDeviceManager.activateAdmin : ' + retValue);
+ expect(datainfo).assertTrue();
+
+ var isActive = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME);
+ console.log('enterpriseDeviceManager.isSuperAdmin :' + isActive);
+ expect(isActive).assertTrue();
+
+ retValue = await enterpriseDeviceManager.deactivateSuperAdmin(SELFHAPNAME);
+ console.log('enterpriseDeviceManager.deactivateSuperAdmin : ' + retValue);
+ expect(retValue).assertTrue();
+
+ isActive = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME);
+ console.log('enterpriseDeviceManager.isSuperAdmin : ' + isActive);
+ expect(isActive).assertFalse();
+ done();
+ }
+ })
+
+ /**
+ * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0500
+ * @tc.name test activateAdmin method in promise mode
+ * @tc.desc activate admin in promise mode
+ */
+ it('activateAdmin_test_005', 0, async function (done) {
+
+ var retValue = await enterpriseDeviceManager.activateAdmin(SELFWANT, ENTINFO1,
+ enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL);
+ console.log('enterpriseDeviceManager.activateAdmin ADMIN_TYPE_NORMAL : ' + retValue);
+ expect(retValue).assertTrue();
+
+ var isActive = await enterpriseDeviceManager.isAdminAppActive(SELFWANT);
+ console.log('enterpriseDeviceManager.isAdminAppActive : ' + isActive);
+ expect(isActive).assertTrue();
+
+ retValue = await enterpriseDeviceManager.deactivateAdmin(SELFWANT);
+ console.log('enterpriseDeviceManager.deactivateAdmin : ' + retValue);
+ expect(retValue).assertTrue();
+
+ isActive = await enterpriseDeviceManager.isAdminAppActive(SELFWANT);
+ console.log('enterpriseDeviceManager.isAdminAppActive : ' + isActive);
+ expect(isActive).assertFalse();
+
+ done();
+ })
+
+ /**
+ * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0600
+ * @tc.name test activateAdmin method in callback mode
+ * @tc.desc activate admin in callback mode
+ */
+ it('activateAdmin_test_006', 0, async function (done) {
+
+ console.log(' activateAdmin()');
+ var retValue = await enterpriseDeviceManager.activateAdmin(SELFWANT, ENTINFO1,
+ enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, OnReceiveEvent);
+ async function OnReceiveEvent(err, datainfo) {
+ console.log('enterpriseDeviceManager.activateAdmin ADMIN_TYPE_NORMAL :' + datainfo);
+ expect(datainfo).assertTrue();
+
+ var isActive = await enterpriseDeviceManager.isAdminAppActive(SELFWANT);
+ console.log('enterpriseDeviceManager.isAdminAppActive :' + isActive);
+ expect(isActive).assertTrue();
+
+ retValue = await enterpriseDeviceManager.deactivateAdmin(SELFWANT);
+ console.log('enterpriseDeviceManager.deactivateAdmin : ' + retValue);
+ expect(retValue).assertTrue();
+
+ isActive = await enterpriseDeviceManager.isAdminAppActive(SELFWANT);
+ console.log('enterpriseDeviceManager.isAdminAppActive : ' + isActive);
+ expect(isActive).assertFalse();
+ done();
+ }
+ })
+
+
+ /**
+ * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0700
+ * @tc.name test setEnterpriseInfo method in promise mode
+ * @tc.desc set enterprise info in promise mode
+ */
+ it('setEnterpriseInfo_test_001', 0, async function (done) {
+ var retValue = await enterpriseDeviceManager.activateAdmin(SELFWANT, ENTINFO1,
+ enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL);
+ console.log('enterpriseDeviceManager.activateAdmin ADMIN_TYPE_NORMAL : ' + retValue);
+ expect(retValue).assertTrue();
+
+ var isActive = await enterpriseDeviceManager.isAdminAppActive(SELFWANT);
+ expect(isActive).assertTrue();
+ console.log('enterpriseDeviceManager.isAdminAppActive : ' + isActive);
+
+ retValue = await enterpriseDeviceManager.setEnterpriseInfo(SELFWANT, ENTINFO2);
+ console.log('enterpriseDeviceManager.setEnterpriseInfo : ' + retValue);
+ expect(retValue).assertTrue();
+
+ var entInfo = await enterpriseDeviceManager.getEnterpriseInfo(SELFWANT);
+ expect(entInfo.name).assertEqual(COMPANYNAME2);
+ expect(entInfo.description).assertEqual(DESCRIPTION2);
+
+ retValue = await enterpriseDeviceManager.deactivateAdmin(SELFWANT);
+ console.log('enterpriseDeviceManager.deactivateAdmin : ' + retValue);
+ expect(retValue).assertTrue();
+
+ isActive = await enterpriseDeviceManager.isAdminAppActive(SELFWANT);
+ console.log('enterpriseDeviceManager.isAdminAppActive : ' + isActive);
+ expect(isActive).assertFalse();
+ done();
+
+ })
+
+ /**
+ * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0800
+ * @tc.name test setEnterpriseInfo method in callback mode
+ * @tc.desc set enterprise info in callback mode
+ */
+ it('setEnterpriseInfo_test_002', 0, async function (done) {
+ var retValue = await enterpriseDeviceManager.activateAdmin(SELFWANT, ENTINFO1,
+ enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL);
+ console.log('enterpriseDeviceManager.activateAdmin ADMIN_TYPE_NORMAL : ' + retValue);
+ expect(retValue).assertTrue();
+ var isActive = await enterpriseDeviceManager.isAdminAppActive(SELFWANT);
+ expect(isActive).assertTrue();
+ console.log('enterpriseDeviceManager.isAdminAppActive : ' + isActive);
+
+ retValue = await enterpriseDeviceManager.setEnterpriseInfo(SELFWANT, ENTINFO2, OnReceiveEvent);
+ async function OnReceiveEvent(err, datainfo) {
+ console.log('enterpriseDeviceManager.setEnterpriseInfo : ' + datainfo);
+ expect(datainfo).assertTrue();
+
+ var entInfo = await enterpriseDeviceManager.getEnterpriseInfo(SELFWANT);
+ expect(entInfo.name).assertEqual(COMPANYNAME2);
+ expect(entInfo.description).assertEqual(DESCRIPTION2);
+
+ retValue = await enterpriseDeviceManager.deactivateAdmin(SELFWANT);
+ console.log('enterpriseDeviceManager.deactivateAdmin : ' + retValue);
+ expect(retValue).assertTrue();
+
+ isActive = await enterpriseDeviceManager.isAdminAppActive(SELFWANT);
+ console.log('enterpriseDeviceManager.isAdminAppActive : ' + isActive);
+ expect(isActive).assertFalse();
+ done();
+ }
+ })
+
+ /**
+ * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0900
+ * @tc.name test getDeviceSettingsManager method in callback mode
+ * @tc.desc get the device settings manager in callback mode
+ */
+ it('getDeviceSettingsManager_test_001', 0, async function (done) {
+ enterpriseDeviceManager.getDeviceSettingsManager((error, mgr) => {
+ expect(mgr !== null).assertTrue();
+ })
+ console.log('getDeviceSettingsManager_test_001 done');
+ done();
+ })
+
+ /**
+ * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_1000
+ * @tc.name test getDeviceSettingsManager method in promise mode
+ * @tc.desc get the device settings manager in promise mode
+ */
+ it('getDeviceSettingsManager_test_002', 0, async function (done) {
+ enterpriseDeviceManager.getDeviceSettingsManager().then(mgr => {
+ expect(mgr !== null).assertTrue();
+ })
+ console.log('getDeviceSettingsManager_test_002 done');
+ done();
+ })
+
+ /**
+ * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_1100
+ * @tc.name test setDateTime method in promise mode
+ * @tc.desc set system date time in promise mode
+ */
+ it('setDateTime_test_001', 0, async function (done) {
+ await enterpriseDeviceManager.activateAdmin(SELFWANT, ENTINFO1,
+ enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER);
+ let dsmgr = await enterpriseDeviceManager.getDeviceSettingsManager();
+ expect(dsmgr !== null).assertTrue();
+ console.log('before setDateTime');
+ var setSuccess = await dsmgr.setDateTime(SELFWANT, 1526003846000);
+ expect(setSuccess).assertTrue();
+ await enterpriseDeviceManager.deactivateSuperAdmin(SELFHAPNAME);
+ done();
+ })
+
+ /**
+ * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_1200
+ * @tc.name test setDateTime method in callback mode
+ * @tc.desc set system date time in callback mode
+ */
+ it('setDateTime_test_002', 0, async function (done) {
+ await enterpriseDeviceManager.activateAdmin(SELFWANT, ENTINFO1,
+ enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER);
+ let dsmgr = await enterpriseDeviceManager.getDeviceSettingsManager();
+ expect(dsmgr !== null).assertTrue();
+ console.log('before setDateTime');
+ await dsmgr.setDateTime(SELFWANT, 1526003846000, (error, data) => {
+ console.log("setDateTime ===data: " + data);
+ console.log("setDateTime ===error: " + error);
+ });
+ await enterpriseDeviceManager.deactivateSuperAdmin(SELFHAPNAME);
+ done();
+ })
+
+ console.log('*************end EnterpriseDeviceManagerTest*************');
+})
\ No newline at end of file
diff --git a/customization/enterprise_device_management/src/main/js/default/test/List.test.js b/customization/enterprise_device_management/src/main/js/default/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..e6206c4fbdd44c3d0580457372120b98ce1edade
--- /dev/null
+++ b/customization/enterprise_device_management/src/main/js/default/test/List.test.js
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+require('./EnterpriseDeviceManager.test.js')
diff --git a/customization/enterprise_device_management/src/main/resources/base/element/plural.json b/customization/enterprise_device_management/src/main/resources/base/element/plural.json
new file mode 100644
index 0000000000000000000000000000000000000000..5df662491e2cba0cc4ca28cb1547351bea8a78f3
--- /dev/null
+++ b/customization/enterprise_device_management/src/main/resources/base/element/plural.json
@@ -0,0 +1,33 @@
+{
+ "plural":[
+ {
+ "name":"plural_name",
+ "value":[
+ {
+ "quantity":"zero",
+ "value":"%d test zero"
+ },
+ {
+ "quantity":"one",
+ "value":"%d test one"
+ },
+ {
+ "quantity":"two",
+ "value":"%d test two"
+ },
+ {
+ "quantity":"few",
+ "value":"%d test few"
+ },
+ {
+ "quantity":"many",
+ "value":"%d test many"
+ },
+ {
+ "quantity":"other",
+ "value":"%d test other"
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/customization/enterprise_device_management/src/main/resources/base/element/strarray.json b/customization/enterprise_device_management/src/main/resources/base/element/strarray.json
new file mode 100644
index 0000000000000000000000000000000000000000..643b3ced65e64d0a4555e9b3c091f5809526da9b
--- /dev/null
+++ b/customization/enterprise_device_management/src/main/resources/base/element/strarray.json
@@ -0,0 +1,21 @@
+{
+ "strarray": [
+ {
+ "name": "sizeList",
+ "value":[
+ {
+ "value":"small"
+ },
+ {
+ "value":"middle"
+ },
+ {
+ "value":"large"
+ },
+ {
+ "value":"extra large"
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/customization/enterprise_device_management/src/main/resources/base/element/string.json b/customization/enterprise_device_management/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..26ee728d01904a59b0af7ca29262f6d921eadfb4
--- /dev/null
+++ b/customization/enterprise_device_management/src/main/resources/base/element/string.json
@@ -0,0 +1,12 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "L2Test"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Phone_Empty Feature Ability"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/customization/enterprise_device_management/src/main/resources/base/media/icon.png b/customization/enterprise_device_management/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/customization/enterprise_device_management/src/main/resources/base/media/icon.png differ
diff --git a/test_packages.gni b/test_packages.gni
index ed2362dec91fb9f135fbd3b0bb0ba0534a5ed4ff..34275fdcfeb612b1ff400f673b52c093a2355cb8 100644
--- a/test_packages.gni
+++ b/test_packages.gni
@@ -42,6 +42,7 @@ _all_test_packages = [
"${ACTS_ROOT}/location:location",
"${ACTS_ROOT}/settingsdata:settingsdata",
"${ACTS_ROOT}/barrierfree:barrierfree",
+ "${ACTS_ROOT}/customization:customization",
]
_all_test_packages_ivi = [