diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..4947287
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/OAT.xml b/OAT.xml
index ff5a7d1..f90efce 100644
--- a/OAT.xml
+++ b/OAT.xml
@@ -67,10 +67,44 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frameworks/ringtone_extension_hap/BUILD.gn b/frameworks/ringtone_extension_hap/BUILD.gn
new file mode 100644
index 0000000..c560cd8
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/BUILD.gn
@@ -0,0 +1,46 @@
+# Copyright (C) 2024 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.gni")
+import("//foundation/multimedia/ringtone_library/ringtone_library.gni")
+
+ohos_hap("ringtone_extension_hap") {
+ hap_profile = "RingtoneLibraryExt/entry/src/main/module.json"
+ deps = [
+ ":RingtoneLibStage_js_assets",
+ ":RingtoneLibStage_resources",
+ ]
+ certificate_profile = "${RINGTONE_EXT_HAP_PATH}/signature/ringtonelibrary.p7b"
+ shared_libraries = [ "${RINGTONE_SERVICES_PATH}:ringtone_data_extension" ]
+ hap_name = "Ringtone_Library_Ext"
+ part_name = "prebuilt_hap"
+ subsystem_name = "applications"
+ module_install_dir = "app/com.ohos.ringtonelibrary.RingtoneLibraryData"
+}
+
+ohos_js_assets("RingtoneLibStage_js_assets") {
+ hap_profile = "RingtoneLibraryExt/entry/src/main/module.json"
+ ets2abc = true
+ source_dir = "RingtoneLibraryExt/entry/src/main/ets"
+}
+
+ohos_app_scope("RingtoneLibStage_app_profile") {
+ app_profile = "RingtoneLibraryExt/AppScope/app.json"
+ sources = [ "RingtoneLibraryExt/AppScope/resources" ]
+}
+
+ohos_resources("RingtoneLibStage_resources") {
+ hap_profile = "RingtoneLibraryExt/entry/src/main/module.json"
+ deps = [ ":RingtoneLibStage_app_profile" ]
+ sources = [ "RingtoneLibraryExt/entry/src/main/resources" ]
+}
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/.gitignore b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/.gitignore
new file mode 100644
index 0000000..39187eb
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/.gitignore
@@ -0,0 +1,4 @@
+/node_modules
+/local.properties
+/.idea
+**/build
\ No newline at end of file
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/AppScope/app.json b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/AppScope/app.json
new file mode 100644
index 0000000..799a8d8
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/AppScope/app.json
@@ -0,0 +1,17 @@
+{
+ "app": {
+ "bundleName": "com.ohos.ringtonelibrary.ringtonelibrarydata",
+ "vendor": "huawei",
+ "versionCode": 10000000,
+ "versionName": "1.0.0.0",
+ "minAPIVersion": 12,
+ "targetAPIVersion": 12,
+ "KeepAlive": false,
+ "removable": false,
+ "singleton": false,
+ "icon": "$media:app_icon",
+ "label": "$string:app_name",
+ "generateBuildHash": true,
+ "distributedNotificationEnabled": true
+ }
+}
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/AppScope/resources/base/element/string.json b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000..d504011
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "RingtoneLibraryExt"
+ }
+ ]
+}
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/AppScope/resources/base/media/app_icon.png b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000..ce307a8
Binary files /dev/null and b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/AppScope/resources/base/media/app_icon.png differ
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/build-profile.json5 b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/build-profile.json5
new file mode 100644
index 0000000..cc52191
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/build-profile.json5
@@ -0,0 +1,26 @@
+{
+ "app": {
+ "compileSdkVersion": 12,
+ "compatibleSdkVersion": 12,
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/.gitignore b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/.gitignore
new file mode 100644
index 0000000..4f9a973
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/.gitignore
@@ -0,0 +1,3 @@
+/node_modules
+/.preview
+/build
\ No newline at end of file
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/build-profile.json5 b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/build-profile.json5
new file mode 100644
index 0000000..7dc37bb
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/build-profile.json5
@@ -0,0 +1,13 @@
+{
+ "apiType": 'stageMode',
+ "buildOption": {
+ },
+ "targets": [
+ {
+ "name": "default",
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/hvigorfile.js b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/hvigorfile.js
new file mode 100644
index 0000000..d7720ee
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/hvigorfile.js
@@ -0,0 +1,2 @@
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+module.exports = require('@ohos/hvigor-ohos-plugin').hapTasks
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/package-lock.json b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/package-lock.json
new file mode 100644
index 0000000..15bc714
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/package-lock.json
@@ -0,0 +1,5 @@
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "lockfileVersion": 1
+}
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/package.json b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/package.json
new file mode 100644
index 0000000..d584df6
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/package.json
@@ -0,0 +1,14 @@
+{
+ "license":"ISC",
+ "devDependencies":{},
+ "name":"entry",
+ "ohos":{
+ "org":"huawei",
+ "directoryLevel":"module",
+ "buildTool":"hvigor"
+ },
+ "description":"example description",
+ "repository":{},
+ "version":"1.0.0",
+ "dependencies":{}
+}
\ No newline at end of file
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/ets/Application/AbilityStage.ts b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/ets/Application/AbilityStage.ts
new file mode 100644
index 0000000..26cac19
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/ets/Application/AbilityStage.ts
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2024 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 AbilityStage from '@ohos.app.ability.AbilityStage';
+
+export default class MyAbilityStage extends AbilityStage {
+ onCreate(): void {
+ console.log('[Ringtone] MyAbilityStage onCreate');
+ }
+}
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/ets/DataShareExtAbility/DataShareExtAbility.ts b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/ets/DataShareExtAbility/DataShareExtAbility.ts
new file mode 100644
index 0000000..8868aaf
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/ets/DataShareExtAbility/DataShareExtAbility.ts
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2024 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 Extension from '@ohos.application.DataShareExtensionAbility';
+
+export default class DataShareExtAbility extends Extension {
+ private rdbStore_;
+
+ onCreate(want): void {
+ console.log('[RingtoneDataShare] <> DataShareExtAbility onCreate, want:' + want.abilityName);
+ }
+
+ getFileTypes(uri: string, mimeTypeFilter: string): void {
+ console.info('[RingtoneDataShare] <> [getFileTypes] enter');
+ }
+
+ insert(uri, value, callback): void {
+ console.info('[RingtoneDataShare] <> [insert] enter');
+ }
+
+ update(uri, value, predicates, callback): void {
+ console.info('[RingtoneDataShare] <> [update] enter');
+ }
+
+ delete(uri, predicates, callback): void {
+ console.info('[RingtoneDataShare] <> [delete] enter');
+ }
+
+ query(uri, columns, predicates, callback): void {
+ console.info('[RingtoneDataShare] <> [query] enter');
+ }
+
+ getType(uri: string): void {
+ console.info('[RingtoneDataShare] <> [getType] enter');
+ }
+
+ batchInsert(uri: string, valueBuckets, callback): void {
+ console.info('[RingtoneDataShare] <> [batchInsert] enter');
+ }
+
+ normalizeUri(uri: string): void {
+ console.info('[RingtoneDataShare] <> [normalizeUri] enter');
+ }
+
+ denormalizeUri(uri: string): void {
+ console.info('[RingtoneDataShare] <> [denormalizeUri] enter');
+ }
+};
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/ets/MainAbility/MainAbility.ts b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/ets/MainAbility/MainAbility.ts
new file mode 100644
index 0000000..1d5bf9e
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/ets/MainAbility/MainAbility.ts
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2024 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 Ability from '@ohos.app.ability.UIAbility';
+
+export default class MainAbility extends Ability {
+ onCreate(want, launchParam): void {
+ console.log('[Ringtone] MainAbility onCreate');
+ globalThis.abilityWant = want;
+ }
+
+ onDestroy(): void {
+ console.log('[Ringtone] MainAbility onDestroy');
+ }
+
+ onWindowStageCreate(windowStage): void {
+ // Main window is created, set main page for this ability
+ console.log('[Ringtone] MainAbility onWindowStageCreate');
+ windowStage.setUIContent(this.context, 'pages/index', null);
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ console.log('[Ringtone] MainAbility onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ console.log('[Ringtone] MainAbility onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ console.log('[Ringtone] MainAbility onBackground');
+ }
+};
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/ets/pages/index.ets b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/ets/pages/index.ets
new file mode 100644
index 0000000..d6ca48c
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/ets/pages/index.ets
@@ -0,0 +1,17 @@
+@Entry
+@Component
+struct Index {
+ @State message: string = 'Hello World'
+
+ build() {
+ Row() {
+ Column() {
+ Text(this.message)
+ .fontSize(50)
+ .fontWeight(FontWeight.Bold)
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
\ No newline at end of file
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/module.json b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/module.json
new file mode 100644
index 0000000..8a34811
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/module.json
@@ -0,0 +1,73 @@
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "srcEntrance": "./ets/Application/AbilityStage.ts",
+ "description": "$string:entry_desc",
+ "mainElement": "MainAbility",
+ "deviceTypes": [
+ "default",
+ "phone",
+ "tablet",
+ "2in1"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "uiSyntax": "ets",
+ "abilities": [
+ {
+ "name": "MainAbility",
+ "srcEntrance": "./ets/MainAbility/MainAbility.ts",
+ "description": "$string:MainAbility_desc",
+ "icon": "$media:icon",
+ "label": "$string:app_name",
+ "visible": false
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "srcEntrance": "./ets/DataShareExtAbility/DataShareExtAbility.ts",
+ "name": "DataShareExtAbility",
+ "icon": "$media:icon",
+ "srcLanguage": "ets",
+ "description": "$string:DataShareExtAbility_desc",
+ "type": "dataShare",
+ "uri": "datashare://ringtone",
+ "visible": true
+ }
+ ],
+ "requestPermissions": [
+ {
+ "name": "ohos.permission.PERMISSION_USED_STATS",
+ "reason": "$string:permission_used_stats",
+ "usedScene": {
+ "abilities": [
+ "DataShareExtAbility"
+ ],
+ "when": "inuse"
+ }
+ },
+ {
+ "name": "ohos.permission.PROXY_AUTHORIZATION_URI",
+ "reason": "$string:permission_proxy_authorization_uri",
+ "usedScene": {
+ "abilities": [
+ "DataShareExtAbility"
+ ],
+ "when": "inuse"
+ }
+ },
+ {
+ "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
+ "reason": "$string:permission_get_bundle_info_privileged",
+ "usedScene": {
+ "abilities": [
+ "DataShareExtAbility"
+ ],
+ "when": "inuse"
+ }
+ }
+ ]
+ }
+}
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/resources/base/element/string.json b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000..332be58
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "entry_desc",
+ "value": "description"
+ },
+ {
+ "name": "MainAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "DataShareExtAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "permission_used_stats",
+ "value": "Allow the application to access the permission usage records"
+ },
+ {
+ "name": "permission_proxy_authorization_uri",
+ "value": "Allow the application proxy to grant URIs"
+ },
+ {
+ "name": "permission_get_bundle_info_privileged",
+ "value": "Allows querying of the app's basic information and other sensitive information"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/resources/base/media/icon.png b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000..ce307a8
Binary files /dev/null and b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/resources/base/media/icon.png differ
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/resources/base/profile/main_pages.json b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000..feec276
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/index"
+ ]
+}
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/ets/TestAbility/TestAbility.ts b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/ets/TestAbility/TestAbility.ts
new file mode 100644
index 0000000..24d364a
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/ets/TestAbility/TestAbility.ts
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2024 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 Ability from '@ohos.app.ability.UIAbility';
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from 'hypium/index';
+import testsuite from '../test/List.test';
+
+export default class TestAbility extends Ability {
+ onCreate(want, launchParam): void {
+ console.log('TestAbility onCreate');
+ let abilityDelegator;
+ abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+ let abilityDelegatorArguments;
+ abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments();
+ console.info('start run testcase!!!');
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite);
+ }
+
+ onDestroy(): void {
+ console.log('TestAbility onDestroy');
+ }
+
+ onWindowStageCreate(windowStage): void {
+ console.log('TestAbility onWindowStageCreate');
+ windowStage.setUIContent(this.context, 'TestAbility/pages/index', null);
+
+ globalThis.abilityContext = this.context;
+ }
+
+ onWindowStageDestroy(): void {
+ console.log('TestAbility onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ console.log('TestAbility onForeground');
+ }
+
+ onBackground(): void {
+ console.log('TestAbility onBackground');
+ }
+};
\ No newline at end of file
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/ets/TestAbility/pages/index.ets b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/ets/TestAbility/pages/index.ets
new file mode 100644
index 0000000..733600a
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/ets/TestAbility/pages/index.ets
@@ -0,0 +1,34 @@
+import router from '@ohos.router';
+
+@Entry
+@Component
+struct Index {
+ aboutToAppear() {
+ console.info('TestAbility index aboutToAppear')
+ }
+ @State message: string = 'Hello World'
+ build() {
+ Row() {
+ Column() {
+ Text(this.message)
+ .fontSize(50)
+ .fontWeight(FontWeight.Bold)
+ Button() {
+ Text('next page')
+ .fontSize(20)
+ .fontWeight(FontWeight.Bold)
+ }.type(ButtonType.Capsule)
+ .margin({
+ top: 20
+ })
+ .backgroundColor('#0D9FFB')
+ .width('35%')
+ .height('5%')
+ .onClick(()=>{
+ })
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+ }
\ No newline at end of file
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts
new file mode 100644
index 0000000..0eee5e0
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2024 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 TestRunner from '@ohos.application.testRunner';
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+
+let abilityDelegator = undefined;
+let abilityDelegatorArguments = undefined;
+
+function translateParamsToString(parameters): string {
+ const keySet = new Set([
+ '-s class', '-s notClass', '-s suite', '-s it',
+ '-s level', '-s testType', '-s size', '-s timeout'
+ ])
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams = `${targetParams} ${key} ${parameters[key]}`;
+ }
+ }
+ return targetParams.trim();
+}
+
+async function onAbilityCreateCallback(): Promise {
+ console.log('onAbilityCreateCallback');
+}
+
+async function addAbilityMonitorCallback(err): Promise {
+ console.info('addAbilityMonitorCallback : ' + JSON.stringify(err));
+}
+
+export default class OpenHarmonyTestRunner implements TestRunner {
+ constructor() {
+ }
+
+ onPrepare(): void {
+ console.info('OpenHarmonyTestRunner OnPrepare ');
+ }
+
+ async onRun(): Promise {
+ console.log('OpenHarmonyTestRunner onRun run');
+ abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments();
+ abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+ let testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility';
+ let lMonitor = {
+ abilityName: testAbilityName,
+ onAbilityCreate: onAbilityCreateCallback,
+ };
+ abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback);
+ let cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName;
+ cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters);
+ console.info('cmd : ' + cmd);
+ abilityDelegator.executeShellCommand(cmd,
+ (err, d) => {
+ console.info('executeShellCommand : err : ' + JSON.stringify(err));
+ console.info('executeShellCommand : data : ' + d.stdResult);
+ console.info('executeShellCommand : data : ' + d.exitCode);
+ });
+ console.info('OpenHarmonyTestRunner onRun end');
+ }
+};
\ No newline at end of file
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/ets/test/Ability.test.ets b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000..679d23a
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,13 @@
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index'
+
+export default function abilityTest() {
+ describe('ActsAbilityTest', function () {
+ it('assertContain',0, function () {
+ console.info("it begin")
+ let a = 'abc'
+ let b = 'b'
+ expect(a).assertContain(b)
+ expect(a).assertEqual(a)
+ })
+ })
+}
\ No newline at end of file
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/ets/test/List.test.ets b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000..d766fe2
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,5 @@
+import abilityTest from './Ability.test'
+
+export default function testsuite() {
+ abilityTest()
+}
\ No newline at end of file
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/module.json5 b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/module.json5
new file mode 100644
index 0000000..a1a754e
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/module.json5
@@ -0,0 +1,38 @@
+{
+ "module": {
+ "name": "entry_test",
+ "type": "feature",
+ "srcEntrance": "./ets/TestAbility/TestAbility.ts",
+ "description": "$string:entry_test_desc",
+ "mainElement": "TestAbility",
+ "deviceTypes": [
+ "phone",
+ "tablet",
+ "2in1"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:test_pages",
+ "uiSyntax": "ets",
+ "abilities": [
+ {
+ "name": "TestAbility",
+ "srcEntrance": "./ets/TestAbility/TestAbility.ts",
+ "description": "$string:TestAbility_desc",
+ "icon": "$media:icon",
+ "label": "$string:TestAbility_label",
+ "visible": true,
+ "skills": [
+ {
+ "actions": [
+ "action.system.home"
+ ],
+ "entities": [
+ "entity.system.home"
+ ]
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/resources/base/element/string.json b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/resources/base/element/string.json
new file mode 100644
index 0000000..8407800
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "entry_test_desc",
+ "value": "i am an entry for tv"
+ },
+ {
+ "name": "TestAbility_desc",
+ "value": "the tv entry test ability"
+ },
+ {
+ "name": "TestAbility_label",
+ "value": "tvBase"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/resources/base/media/icon.png b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/resources/base/media/icon.png
new file mode 100644
index 0000000..ce307a8
Binary files /dev/null and b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/resources/base/media/icon.png differ
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/resources/base/profile/test_pages.json b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/resources/base/profile/test_pages.json
new file mode 100644
index 0000000..fcef82b
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/entry/src/ohosTest/resources/base/profile/test_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "TestAbility/pages/index"
+ ]
+}
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/hvigorfile.js b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/hvigorfile.js
new file mode 100644
index 0000000..5f2735e
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/hvigorfile.js
@@ -0,0 +1,2 @@
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+module.exports = require('@ohos/hvigor-ohos-plugin').appTasks
\ No newline at end of file
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/package-lock.json b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/package-lock.json
new file mode 100644
index 0000000..99a99d8
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/package-lock.json
@@ -0,0 +1,1652 @@
+{
+ "name": "ringtonelibrarydata",
+ "version": "1.0.0",
+ "lockfileVersion": 1,
+ "requires": true,
+ "dependencies": {
+ "@ohos/hvigor": {
+ "version": "1.0.6",
+ "resolved": "https://repo.harmonyos.com/npm/@ohos/hvigor/-/@ohos/hvigor-1.0.6.tgz",
+ "integrity": "sha512-jjp7vpvUOMW1Nf7TdyhOtonwWHoSyBJLUiZTQqIx/GJV4UJyIqsiURUOqFwncQ4L7PDdeHuWly4uEelknYeWhg==",
+ "requires": {
+ "@ohos/hvigor-base": "1.0.6",
+ "interpret": "1.4.0",
+ "liftoff": "4.0.0",
+ "mute-stdout": "1.0.0",
+ "pretty-hrtime": "1.0.0",
+ "v8flags": "3.2.0",
+ "yargs": "7.1.0"
+ }
+ },
+ "@ohos/hvigor-base": {
+ "version": "1.0.6",
+ "resolved": "https://repo.harmonyos.com/npm/@ohos/hvigor-base/-/@ohos/hvigor-base-1.0.6.tgz",
+ "integrity": "sha512-cRDnWICTxmpNiFb9clIioqP5Oik1seLCICztXVhZqultrHuxwTheCRUZrHwlpyWdkSB2Al+FFBqmSwzIgZX4IQ==",
+ "requires": {
+ "json5": "2.2.0",
+ "log4js": "6.4.1",
+ "undertaker": "1.2.1"
+ }
+ },
+ "@ohos/hvigor-ohos-plugin": {
+ "version": "1.0.6",
+ "resolved": "https://repo.harmonyos.com/npm/@ohos/hvigor-ohos-plugin/-/@ohos/hvigor-ohos-plugin-1.0.6.tgz",
+ "integrity": "sha512-MAAi8uJxMzODUoSSNfBr+fU4HQ20dfQtkje9I+X4asc7qY2kAplW/q9f5XS8IOvv8zhC8OcSgsAXOAJuLMstOQ==",
+ "requires": {
+ "@ohos/hvigor-base": "1.0.6",
+ "@ohos/sdkmanager-common": "1.1.3",
+ "ajv": "8.10.0",
+ "archiver": "5.3.0",
+ "execa": "5.1.1",
+ "fs-extra": "10.0.0",
+ "glob": "7.2.0",
+ "iconv-lite": "0.6.3",
+ "json5": "2.2.0",
+ "lodash": "4.17.21",
+ "pretty-hrtime": "1.0.3",
+ "resolve-package-path": "4.0.3"
+ },
+ "dependencies": {
+ "fs-extra": {
+ "version": "10.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/fs-extra/-/fs-extra-10.0.0.tgz",
+ "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==",
+ "requires": {
+ "graceful-fs": "^4.2.0",
+ "jsonfile": "^6.0.1",
+ "universalify": "^2.0.0"
+ }
+ },
+ "pretty-hrtime": {
+ "version": "1.0.3",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz",
+ "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE="
+ }
+ }
+ },
+ "@ohos/sdkmanager-common": {
+ "version": "1.1.3",
+ "resolved": "https://repo.harmonyos.com/npm/@ohos/sdkmanager-common/-/@ohos/sdkmanager-common-1.1.3.tgz",
+ "integrity": "sha512-d2uhVauDDJZIUvyyaWWoavG4N/jLyfF5IH5kEXKV6R8HNf3606H1zDQzA+UZtOfwwJFXhD9djRjnVFNB8xc7aw=="
+ },
+ "ajv": {
+ "version": "8.10.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/ajv/-/ajv-8.10.0.tgz",
+ "integrity": "sha512-bzqAEZOjkrUMl2afH8dknrq5KEk2SrwdBROR+vH1EKVQTqaUbJVPdc/gEdggTMM0Se+s+Ja4ju4TlNcStKl2Hw==",
+ "requires": {
+ "fast-deep-equal": "^3.1.1",
+ "json-schema-traverse": "^1.0.0",
+ "require-from-string": "^2.0.2",
+ "uri-js": "^4.2.2"
+ }
+ },
+ "ansi-regex": {
+ "version": "2.1.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/ansi-regex/-/ansi-regex-2.1.1.tgz",
+ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
+ },
+ "archiver": {
+ "version": "5.3.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/archiver/-/archiver-5.3.0.tgz",
+ "integrity": "sha512-iUw+oDwK0fgNpvveEsdQ0Ase6IIKztBJU2U0E9MzszMfmVVUyv1QJhS2ITW9ZCqx8dktAxVAjWWkKehuZE8OPg==",
+ "requires": {
+ "archiver-utils": "^2.1.0",
+ "async": "^3.2.0",
+ "buffer-crc32": "^0.2.1",
+ "readable-stream": "^3.6.0",
+ "readdir-glob": "^1.0.0",
+ "tar-stream": "^2.2.0",
+ "zip-stream": "^4.1.0"
+ }
+ },
+ "archiver-utils": {
+ "version": "2.1.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/archiver-utils/-/archiver-utils-2.1.0.tgz",
+ "integrity": "sha512-bEL/yUb/fNNiNTuUz979Z0Yg5L+LzLxGJz8x79lYmR54fmTIb6ob/hNQgkQnIUDWIFjZVQwl9Xs356I6BAMHfw==",
+ "requires": {
+ "glob": "^7.1.4",
+ "graceful-fs": "^4.2.0",
+ "lazystream": "^1.0.0",
+ "lodash.defaults": "^4.2.0",
+ "lodash.difference": "^4.5.0",
+ "lodash.flatten": "^4.4.0",
+ "lodash.isplainobject": "^4.0.6",
+ "lodash.union": "^4.6.0",
+ "normalize-path": "^3.0.0",
+ "readable-stream": "^2.0.0"
+ },
+ "dependencies": {
+ "readable-stream": {
+ "version": "2.3.7",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/readable-stream/-/readable-stream-2.3.7.tgz",
+ "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
+ "requires": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.3",
+ "isarray": "~1.0.0",
+ "process-nextick-args": "~2.0.0",
+ "safe-buffer": "~5.1.1",
+ "string_decoder": "~1.1.1",
+ "util-deprecate": "~1.0.1"
+ }
+ }
+ }
+ },
+ "arr-filter": {
+ "version": "1.1.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/arr-filter/-/arr-filter-1.1.2.tgz",
+ "integrity": "sha1-Q/3d0JHo7xGqTEXZzcGOLf8XEe4=",
+ "requires": {
+ "make-iterator": "^1.0.0"
+ }
+ },
+ "arr-flatten": {
+ "version": "1.1.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/arr-flatten/-/arr-flatten-1.1.0.tgz",
+ "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg=="
+ },
+ "arr-map": {
+ "version": "2.0.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/arr-map/-/arr-map-2.0.2.tgz",
+ "integrity": "sha1-Onc0X/wc814qkYJWAfnljy4kysQ=",
+ "requires": {
+ "make-iterator": "^1.0.0"
+ }
+ },
+ "array-each": {
+ "version": "1.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/array-each/-/array-each-1.0.1.tgz",
+ "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8="
+ },
+ "array-initial": {
+ "version": "1.1.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/array-initial/-/array-initial-1.1.0.tgz",
+ "integrity": "sha1-L6dLJnOTccOUe9enrcc74zSz15U=",
+ "requires": {
+ "array-slice": "^1.0.0",
+ "is-number": "^4.0.0"
+ }
+ },
+ "array-last": {
+ "version": "1.3.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/array-last/-/array-last-1.3.0.tgz",
+ "integrity": "sha512-eOCut5rXlI6aCOS7Z7kCplKRKyiFQ6dHFBem4PwlwKeNFk2/XxTrhRh5T9PyaEWGy/NHTZWbY+nsZlNFJu9rYg==",
+ "requires": {
+ "is-number": "^4.0.0"
+ }
+ },
+ "array-slice": {
+ "version": "1.1.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/array-slice/-/array-slice-1.1.0.tgz",
+ "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w=="
+ },
+ "async": {
+ "version": "3.2.3",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/async/-/async-3.2.3.tgz",
+ "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g=="
+ },
+ "async-done": {
+ "version": "1.3.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/async-done/-/async-done-1.3.2.tgz",
+ "integrity": "sha512-uYkTP8dw2og1tu1nmza1n1CMW0qb8gWWlwqMmLb7MhBVs4BXrFziT6HXUd+/RlRA/i4H9AkofYloUbs1fwMqlw==",
+ "requires": {
+ "end-of-stream": "^1.1.0",
+ "once": "^1.3.2",
+ "process-nextick-args": "^2.0.0",
+ "stream-exhaust": "^1.0.1"
+ }
+ },
+ "async-settle": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/async-settle/-/async-settle-1.0.0.tgz",
+ "integrity": "sha1-HQqRS7Aldb7IqPOnTlCA9yssDGs=",
+ "requires": {
+ "async-done": "^1.2.2"
+ }
+ },
+ "bach": {
+ "version": "1.2.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/bach/-/bach-1.2.0.tgz",
+ "integrity": "sha1-Szzpa/JxNPeaG0FKUcFONMO9mIA=",
+ "requires": {
+ "arr-filter": "^1.1.1",
+ "arr-flatten": "^1.0.1",
+ "arr-map": "^2.0.0",
+ "array-each": "^1.0.0",
+ "array-initial": "^1.0.0",
+ "array-last": "^1.1.1",
+ "async-done": "^1.2.2",
+ "async-settle": "^1.0.0",
+ "now-and-later": "^2.0.0"
+ }
+ },
+ "balanced-match": {
+ "version": "1.0.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/balanced-match/-/balanced-match-1.0.2.tgz",
+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
+ },
+ "base64-js": {
+ "version": "1.5.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/base64-js/-/base64-js-1.5.1.tgz",
+ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
+ },
+ "bl": {
+ "version": "4.1.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/bl/-/bl-4.1.0.tgz",
+ "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
+ "requires": {
+ "buffer": "^5.5.0",
+ "inherits": "^2.0.4",
+ "readable-stream": "^3.4.0"
+ }
+ },
+ "brace-expansion": {
+ "version": "1.1.11",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/brace-expansion/-/brace-expansion-1.1.11.tgz",
+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+ "requires": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "braces": {
+ "version": "3.0.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/braces/-/braces-3.0.2.tgz",
+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "requires": {
+ "fill-range": "^7.0.1"
+ }
+ },
+ "buffer": {
+ "version": "5.7.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/buffer/-/buffer-5.7.1.tgz",
+ "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
+ "requires": {
+ "base64-js": "^1.3.1",
+ "ieee754": "^1.1.13"
+ }
+ },
+ "buffer-crc32": {
+ "version": "0.2.13",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
+ "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI="
+ },
+ "call-bind": {
+ "version": "1.0.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/call-bind/-/call-bind-1.0.2.tgz",
+ "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
+ "requires": {
+ "function-bind": "^1.1.1",
+ "get-intrinsic": "^1.0.2"
+ }
+ },
+ "camelcase": {
+ "version": "3.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/camelcase/-/camelcase-3.0.0.tgz",
+ "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo="
+ },
+ "cliui": {
+ "version": "3.2.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/cliui/-/cliui-3.2.0.tgz",
+ "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=",
+ "requires": {
+ "string-width": "^1.0.1",
+ "strip-ansi": "^3.0.1",
+ "wrap-ansi": "^2.0.0"
+ }
+ },
+ "code-point-at": {
+ "version": "1.1.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/code-point-at/-/code-point-at-1.1.0.tgz",
+ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c="
+ },
+ "collection-map": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/collection-map/-/collection-map-1.0.0.tgz",
+ "integrity": "sha1-rqDwb40mx4DCt1SUOFVEsiVa8Yw=",
+ "requires": {
+ "arr-map": "^2.0.2",
+ "for-own": "^1.0.0",
+ "make-iterator": "^1.0.0"
+ }
+ },
+ "compress-commons": {
+ "version": "4.1.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/compress-commons/-/compress-commons-4.1.1.tgz",
+ "integrity": "sha512-QLdDLCKNV2dtoTorqgxngQCMA+gWXkM/Nwu7FpeBhk/RdkzimqC3jueb/FDmaZeXh+uby1jkBqE3xArsLBE5wQ==",
+ "requires": {
+ "buffer-crc32": "^0.2.13",
+ "crc32-stream": "^4.0.2",
+ "normalize-path": "^3.0.0",
+ "readable-stream": "^3.6.0"
+ }
+ },
+ "concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
+ },
+ "core-util-is": {
+ "version": "1.0.3",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/core-util-is/-/core-util-is-1.0.3.tgz",
+ "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
+ },
+ "crc-32": {
+ "version": "1.2.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/crc-32/-/crc-32-1.2.2.tgz",
+ "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ=="
+ },
+ "crc32-stream": {
+ "version": "4.0.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/crc32-stream/-/crc32-stream-4.0.2.tgz",
+ "integrity": "sha512-DxFZ/Hk473b/muq1VJ///PMNLj0ZMnzye9thBpmjpJKCc5eMgB95aK8zCGrGfQ90cWo561Te6HK9D+j4KPdM6w==",
+ "requires": {
+ "crc-32": "^1.2.0",
+ "readable-stream": "^3.4.0"
+ }
+ },
+ "cross-spawn": {
+ "version": "7.0.3",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/cross-spawn/-/cross-spawn-7.0.3.tgz",
+ "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
+ "requires": {
+ "path-key": "^3.1.0",
+ "shebang-command": "^2.0.0",
+ "which": "^2.0.1"
+ },
+ "dependencies": {
+ "which": {
+ "version": "2.0.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/which/-/which-2.0.2.tgz",
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
+ "requires": {
+ "isexe": "^2.0.0"
+ }
+ }
+ }
+ },
+ "d": {
+ "version": "1.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/d/-/d-1.0.1.tgz",
+ "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==",
+ "requires": {
+ "es5-ext": "^0.10.50",
+ "type": "^1.0.1"
+ }
+ },
+ "date-format": {
+ "version": "4.0.7",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/date-format/-/date-format-4.0.7.tgz",
+ "integrity": "sha512-k5xqlzDGIfv2N/DHR/BR8Kc4N9CRy9ReuDkmdxeX/jNfit94QXd36emWMm40ZOEDKNm/c91yV9EO3uGPkR7wWQ=="
+ },
+ "debug": {
+ "version": "4.3.4",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/debug/-/debug-4.3.4.tgz",
+ "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
+ "requires": {
+ "ms": "2.1.2"
+ }
+ },
+ "decamelize": {
+ "version": "1.2.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/decamelize/-/decamelize-1.2.0.tgz",
+ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
+ },
+ "default-resolution": {
+ "version": "2.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/default-resolution/-/default-resolution-2.0.0.tgz",
+ "integrity": "sha1-vLgrqnKtebQmp2cy8aga1t8m1oQ="
+ },
+ "define-properties": {
+ "version": "1.1.4",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/define-properties/-/define-properties-1.1.4.tgz",
+ "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==",
+ "requires": {
+ "has-property-descriptors": "^1.0.0",
+ "object-keys": "^1.1.1"
+ }
+ },
+ "detect-file": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/detect-file/-/detect-file-1.0.0.tgz",
+ "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc="
+ },
+ "end-of-stream": {
+ "version": "1.4.4",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/end-of-stream/-/end-of-stream-1.4.4.tgz",
+ "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
+ "requires": {
+ "once": "^1.4.0"
+ }
+ },
+ "error-ex": {
+ "version": "1.3.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/error-ex/-/error-ex-1.3.2.tgz",
+ "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
+ "requires": {
+ "is-arrayish": "^0.2.1"
+ }
+ },
+ "es5-ext": {
+ "version": "0.10.61",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/es5-ext/-/es5-ext-0.10.61.tgz",
+ "integrity": "sha512-yFhIqQAzu2Ca2I4SE2Au3rxVfmohU9Y7wqGR+s7+H7krk26NXhIRAZDgqd6xqjCEFUomDEA3/Bo/7fKmIkW1kA==",
+ "requires": {
+ "es6-iterator": "^2.0.3",
+ "es6-symbol": "^3.1.3",
+ "next-tick": "^1.1.0"
+ }
+ },
+ "es6-iterator": {
+ "version": "2.0.3",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/es6-iterator/-/es6-iterator-2.0.3.tgz",
+ "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=",
+ "requires": {
+ "d": "1",
+ "es5-ext": "^0.10.35",
+ "es6-symbol": "^3.1.1"
+ }
+ },
+ "es6-symbol": {
+ "version": "3.1.3",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/es6-symbol/-/es6-symbol-3.1.3.tgz",
+ "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==",
+ "requires": {
+ "d": "^1.0.1",
+ "ext": "^1.1.2"
+ }
+ },
+ "es6-weak-map": {
+ "version": "2.0.3",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/es6-weak-map/-/es6-weak-map-2.0.3.tgz",
+ "integrity": "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==",
+ "requires": {
+ "d": "1",
+ "es5-ext": "^0.10.46",
+ "es6-iterator": "^2.0.3",
+ "es6-symbol": "^3.1.1"
+ }
+ },
+ "execa": {
+ "version": "5.1.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/execa/-/execa-5.1.1.tgz",
+ "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
+ "requires": {
+ "cross-spawn": "^7.0.3",
+ "get-stream": "^6.0.0",
+ "human-signals": "^2.1.0",
+ "is-stream": "^2.0.0",
+ "merge-stream": "^2.0.0",
+ "npm-run-path": "^4.0.1",
+ "onetime": "^5.1.2",
+ "signal-exit": "^3.0.3",
+ "strip-final-newline": "^2.0.0"
+ }
+ },
+ "expand-tilde": {
+ "version": "2.0.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/expand-tilde/-/expand-tilde-2.0.2.tgz",
+ "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=",
+ "requires": {
+ "homedir-polyfill": "^1.0.1"
+ }
+ },
+ "ext": {
+ "version": "1.6.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/ext/-/ext-1.6.0.tgz",
+ "integrity": "sha512-sdBImtzkq2HpkdRLtlLWDa6w4DX22ijZLKx8BMPUuKe1c5lbN6xwQDQCxSfxBQnHZ13ls/FH0MQZx/q/gr6FQg==",
+ "requires": {
+ "type": "^2.5.0"
+ },
+ "dependencies": {
+ "type": {
+ "version": "2.6.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/type/-/type-2.6.0.tgz",
+ "integrity": "sha512-eiDBDOmkih5pMbo9OqsqPRGMljLodLcwd5XD5JbtNB0o89xZAwynY9EdCDsJU7LtcVCClu9DvM7/0Ep1hYX3EQ=="
+ }
+ }
+ },
+ "extend": {
+ "version": "3.0.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/extend/-/extend-3.0.2.tgz",
+ "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="
+ },
+ "fast-deep-equal": {
+ "version": "3.1.3",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
+ },
+ "fill-range": {
+ "version": "7.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/fill-range/-/fill-range-7.0.1.tgz",
+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "requires": {
+ "to-regex-range": "^5.0.1"
+ }
+ },
+ "find-up": {
+ "version": "1.1.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/find-up/-/find-up-1.1.2.tgz",
+ "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=",
+ "requires": {
+ "path-exists": "^2.0.0",
+ "pinkie-promise": "^2.0.0"
+ }
+ },
+ "findup-sync": {
+ "version": "5.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/findup-sync/-/findup-sync-5.0.0.tgz",
+ "integrity": "sha512-MzwXju70AuyflbgeOhzvQWAvvQdo1XL0A9bVvlXsYcFEBM87WR4OakL4OfZq+QRmr+duJubio+UtNQCPsVESzQ==",
+ "requires": {
+ "detect-file": "^1.0.0",
+ "is-glob": "^4.0.3",
+ "micromatch": "^4.0.4",
+ "resolve-dir": "^1.0.1"
+ }
+ },
+ "fined": {
+ "version": "2.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/fined/-/fined-2.0.0.tgz",
+ "integrity": "sha512-OFRzsL6ZMHz5s0JrsEr+TpdGNCtrVtnuG3x1yzGNiQHT0yaDnXAj8V/lWcpJVrnoDpcwXcASxAZYbuXda2Y82A==",
+ "requires": {
+ "expand-tilde": "^2.0.2",
+ "is-plain-object": "^5.0.0",
+ "object.defaults": "^1.1.0",
+ "object.pick": "^1.3.0",
+ "parse-filepath": "^1.0.2"
+ }
+ },
+ "flagged-respawn": {
+ "version": "2.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/flagged-respawn/-/flagged-respawn-2.0.0.tgz",
+ "integrity": "sha512-Gq/a6YCi8zexmGHMuJwahTGzXlAZAOsbCVKduWXC6TlLCjjFRlExMJc4GC2NYPYZ0r/brw9P7CpRgQmlPVeOoA=="
+ },
+ "flatted": {
+ "version": "3.2.5",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/flatted/-/flatted-3.2.5.tgz",
+ "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg=="
+ },
+ "for-in": {
+ "version": "1.0.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/for-in/-/for-in-1.0.2.tgz",
+ "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA="
+ },
+ "for-own": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/for-own/-/for-own-1.0.0.tgz",
+ "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=",
+ "requires": {
+ "for-in": "^1.0.1"
+ }
+ },
+ "fs-constants": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/fs-constants/-/fs-constants-1.0.0.tgz",
+ "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="
+ },
+ "fs-extra": {
+ "version": "10.1.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/fs-extra/-/fs-extra-10.1.0.tgz",
+ "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==",
+ "requires": {
+ "graceful-fs": "^4.2.0",
+ "jsonfile": "^6.0.1",
+ "universalify": "^2.0.0"
+ }
+ },
+ "fs.realpath": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/fs.realpath/-/fs.realpath-1.0.0.tgz",
+ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
+ },
+ "function-bind": {
+ "version": "1.1.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/function-bind/-/function-bind-1.1.1.tgz",
+ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
+ },
+ "get-caller-file": {
+ "version": "1.0.3",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/get-caller-file/-/get-caller-file-1.0.3.tgz",
+ "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w=="
+ },
+ "get-intrinsic": {
+ "version": "1.1.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
+ "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==",
+ "requires": {
+ "function-bind": "^1.1.1",
+ "has": "^1.0.3",
+ "has-symbols": "^1.0.1"
+ }
+ },
+ "get-stream": {
+ "version": "6.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/get-stream/-/get-stream-6.0.1.tgz",
+ "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg=="
+ },
+ "glob": {
+ "version": "7.2.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/glob/-/glob-7.2.0.tgz",
+ "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==",
+ "requires": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.0.4",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ }
+ },
+ "global-modules": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/global-modules/-/global-modules-1.0.0.tgz",
+ "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==",
+ "requires": {
+ "global-prefix": "^1.0.1",
+ "is-windows": "^1.0.1",
+ "resolve-dir": "^1.0.0"
+ }
+ },
+ "global-prefix": {
+ "version": "1.0.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/global-prefix/-/global-prefix-1.0.2.tgz",
+ "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=",
+ "requires": {
+ "expand-tilde": "^2.0.2",
+ "homedir-polyfill": "^1.0.1",
+ "ini": "^1.3.4",
+ "is-windows": "^1.0.1",
+ "which": "^1.2.14"
+ }
+ },
+ "graceful-fs": {
+ "version": "4.2.10",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/graceful-fs/-/graceful-fs-4.2.10.tgz",
+ "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA=="
+ },
+ "has": {
+ "version": "1.0.3",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/has/-/has-1.0.3.tgz",
+ "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
+ "requires": {
+ "function-bind": "^1.1.1"
+ }
+ },
+ "has-property-descriptors": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz",
+ "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==",
+ "requires": {
+ "get-intrinsic": "^1.1.1"
+ }
+ },
+ "has-symbols": {
+ "version": "1.0.3",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/has-symbols/-/has-symbols-1.0.3.tgz",
+ "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="
+ },
+ "homedir-polyfill": {
+ "version": "1.0.3",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz",
+ "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==",
+ "requires": {
+ "parse-passwd": "^1.0.0"
+ }
+ },
+ "hosted-git-info": {
+ "version": "2.8.9",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/hosted-git-info/-/hosted-git-info-2.8.9.tgz",
+ "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw=="
+ },
+ "human-signals": {
+ "version": "2.1.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/human-signals/-/human-signals-2.1.0.tgz",
+ "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw=="
+ },
+ "hypium": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/hypium/-/hypium-1.0.0.tgz",
+ "integrity": "sha512-nl+RQVv2AU/5FvFRhsXyWO5wh+2huhdqRZ3bszBWZzW+kpNI3AT4ydvVRYIfaQbYwV4UlX/rSc7BtFjLAezhow=="
+ },
+ "iconv-lite": {
+ "version": "0.6.3",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/iconv-lite/-/iconv-lite-0.6.3.tgz",
+ "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
+ "requires": {
+ "safer-buffer": ">= 2.1.2 < 3.0.0"
+ }
+ },
+ "ieee754": {
+ "version": "1.2.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/ieee754/-/ieee754-1.2.1.tgz",
+ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="
+ },
+ "inflight": {
+ "version": "1.0.6",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/inflight/-/inflight-1.0.6.tgz",
+ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
+ "requires": {
+ "once": "^1.3.0",
+ "wrappy": "1"
+ }
+ },
+ "inherits": {
+ "version": "2.0.4",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
+ },
+ "ini": {
+ "version": "1.3.8",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/ini/-/ini-1.3.8.tgz",
+ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="
+ },
+ "interpret": {
+ "version": "1.4.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/interpret/-/interpret-1.4.0.tgz",
+ "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA=="
+ },
+ "invert-kv": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/invert-kv/-/invert-kv-1.0.0.tgz",
+ "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY="
+ },
+ "is-absolute": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/is-absolute/-/is-absolute-1.0.0.tgz",
+ "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==",
+ "requires": {
+ "is-relative": "^1.0.0",
+ "is-windows": "^1.0.1"
+ }
+ },
+ "is-arrayish": {
+ "version": "0.2.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/is-arrayish/-/is-arrayish-0.2.1.tgz",
+ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0="
+ },
+ "is-core-module": {
+ "version": "2.9.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/is-core-module/-/is-core-module-2.9.0.tgz",
+ "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==",
+ "requires": {
+ "has": "^1.0.3"
+ }
+ },
+ "is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI="
+ },
+ "is-fullwidth-code-point": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
+ "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
+ "requires": {
+ "number-is-nan": "^1.0.0"
+ }
+ },
+ "is-glob": {
+ "version": "4.0.3",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/is-glob/-/is-glob-4.0.3.tgz",
+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
+ "requires": {
+ "is-extglob": "^2.1.1"
+ }
+ },
+ "is-number": {
+ "version": "4.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/is-number/-/is-number-4.0.0.tgz",
+ "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ=="
+ },
+ "is-plain-object": {
+ "version": "5.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/is-plain-object/-/is-plain-object-5.0.0.tgz",
+ "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q=="
+ },
+ "is-relative": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/is-relative/-/is-relative-1.0.0.tgz",
+ "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==",
+ "requires": {
+ "is-unc-path": "^1.0.0"
+ }
+ },
+ "is-stream": {
+ "version": "2.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/is-stream/-/is-stream-2.0.1.tgz",
+ "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg=="
+ },
+ "is-unc-path": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/is-unc-path/-/is-unc-path-1.0.0.tgz",
+ "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==",
+ "requires": {
+ "unc-path-regex": "^0.1.2"
+ }
+ },
+ "is-utf8": {
+ "version": "0.2.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/is-utf8/-/is-utf8-0.2.1.tgz",
+ "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI="
+ },
+ "is-windows": {
+ "version": "1.0.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/is-windows/-/is-windows-1.0.2.tgz",
+ "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA=="
+ },
+ "isarray": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/isarray/-/isarray-1.0.0.tgz",
+ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
+ },
+ "isexe": {
+ "version": "2.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/isexe/-/isexe-2.0.0.tgz",
+ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
+ },
+ "isobject": {
+ "version": "3.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/isobject/-/isobject-3.0.1.tgz",
+ "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8="
+ },
+ "json-schema-traverse": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
+ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
+ },
+ "json5": {
+ "version": "2.2.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/json5/-/json5-2.2.0.tgz",
+ "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==",
+ "requires": {
+ "minimist": "^1.2.5"
+ }
+ },
+ "jsonfile": {
+ "version": "6.1.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/jsonfile/-/jsonfile-6.1.0.tgz",
+ "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
+ "requires": {
+ "graceful-fs": "^4.1.6",
+ "universalify": "^2.0.0"
+ }
+ },
+ "kind-of": {
+ "version": "6.0.3",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/kind-of/-/kind-of-6.0.3.tgz",
+ "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw=="
+ },
+ "last-run": {
+ "version": "1.1.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/last-run/-/last-run-1.1.1.tgz",
+ "integrity": "sha1-RblpQsF7HHnHchmCWbqUO+v4yls=",
+ "requires": {
+ "default-resolution": "^2.0.0",
+ "es6-weak-map": "^2.0.1"
+ }
+ },
+ "lazystream": {
+ "version": "1.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/lazystream/-/lazystream-1.0.1.tgz",
+ "integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==",
+ "requires": {
+ "readable-stream": "^2.0.5"
+ },
+ "dependencies": {
+ "readable-stream": {
+ "version": "2.3.7",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/readable-stream/-/readable-stream-2.3.7.tgz",
+ "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
+ "requires": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.3",
+ "isarray": "~1.0.0",
+ "process-nextick-args": "~2.0.0",
+ "safe-buffer": "~5.1.1",
+ "string_decoder": "~1.1.1",
+ "util-deprecate": "~1.0.1"
+ }
+ }
+ }
+ },
+ "lcid": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/lcid/-/lcid-1.0.0.tgz",
+ "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=",
+ "requires": {
+ "invert-kv": "^1.0.0"
+ }
+ },
+ "liftoff": {
+ "version": "4.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/liftoff/-/liftoff-4.0.0.tgz",
+ "integrity": "sha512-rMGwYF8q7g2XhG2ulBmmJgWv25qBsqRbDn5gH0+wnuyeFt7QBJlHJmtg5qEdn4pN6WVAUMgXnIxytMFRX9c1aA==",
+ "requires": {
+ "extend": "^3.0.2",
+ "findup-sync": "^5.0.0",
+ "fined": "^2.0.0",
+ "flagged-respawn": "^2.0.0",
+ "is-plain-object": "^5.0.0",
+ "object.map": "^1.0.1",
+ "rechoir": "^0.8.0",
+ "resolve": "^1.20.0"
+ }
+ },
+ "load-json-file": {
+ "version": "1.1.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/load-json-file/-/load-json-file-1.1.0.tgz",
+ "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "parse-json": "^2.2.0",
+ "pify": "^2.0.0",
+ "pinkie-promise": "^2.0.0",
+ "strip-bom": "^2.0.0"
+ }
+ },
+ "lodash": {
+ "version": "4.17.21",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/lodash/-/lodash-4.17.21.tgz",
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
+ },
+ "lodash.defaults": {
+ "version": "4.2.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/lodash.defaults/-/lodash.defaults-4.2.0.tgz",
+ "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw="
+ },
+ "lodash.difference": {
+ "version": "4.5.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/lodash.difference/-/lodash.difference-4.5.0.tgz",
+ "integrity": "sha1-nMtOUF1Ia5FlE0V3KIWi3yf9AXw="
+ },
+ "lodash.flatten": {
+ "version": "4.4.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/lodash.flatten/-/lodash.flatten-4.4.0.tgz",
+ "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8="
+ },
+ "lodash.isplainobject": {
+ "version": "4.0.6",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
+ "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs="
+ },
+ "lodash.union": {
+ "version": "4.6.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/lodash.union/-/lodash.union-4.6.0.tgz",
+ "integrity": "sha1-SLtQiECfFvGCFmZkHETdGqrjzYg="
+ },
+ "log4js": {
+ "version": "6.4.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/log4js/-/log4js-6.4.1.tgz",
+ "integrity": "sha512-iUiYnXqAmNKiIZ1XSAitQ4TmNs8CdZYTAWINARF3LjnsLN8tY5m0vRwd6uuWj/yNY0YHxeZodnbmxKFUOM2rMg==",
+ "requires": {
+ "date-format": "^4.0.3",
+ "debug": "^4.3.3",
+ "flatted": "^3.2.4",
+ "rfdc": "^1.3.0",
+ "streamroller": "^3.0.2"
+ }
+ },
+ "make-iterator": {
+ "version": "1.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/make-iterator/-/make-iterator-1.0.1.tgz",
+ "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==",
+ "requires": {
+ "kind-of": "^6.0.2"
+ }
+ },
+ "map-cache": {
+ "version": "0.2.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/map-cache/-/map-cache-0.2.2.tgz",
+ "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8="
+ },
+ "merge-stream": {
+ "version": "2.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/merge-stream/-/merge-stream-2.0.0.tgz",
+ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w=="
+ },
+ "micromatch": {
+ "version": "4.0.5",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/micromatch/-/micromatch-4.0.5.tgz",
+ "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==",
+ "requires": {
+ "braces": "^3.0.2",
+ "picomatch": "^2.3.1"
+ }
+ },
+ "mimic-fn": {
+ "version": "2.1.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/mimic-fn/-/mimic-fn-2.1.0.tgz",
+ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg=="
+ },
+ "minimatch": {
+ "version": "3.1.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/minimatch/-/minimatch-3.1.2.tgz",
+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
+ "requires": {
+ "brace-expansion": "^1.1.7"
+ }
+ },
+ "minimist": {
+ "version": "1.2.6",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/minimist/-/minimist-1.2.6.tgz",
+ "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q=="
+ },
+ "ms": {
+ "version": "2.1.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
+ },
+ "mute-stdout": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/mute-stdout/-/mute-stdout-1.0.0.tgz",
+ "integrity": "sha1-WzLqB+tDyd7WEwQ0z5JvRrKn/U0="
+ },
+ "next-tick": {
+ "version": "1.1.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/next-tick/-/next-tick-1.1.0.tgz",
+ "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ=="
+ },
+ "normalize-package-data": {
+ "version": "2.5.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
+ "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==",
+ "requires": {
+ "hosted-git-info": "^2.1.4",
+ "resolve": "^1.10.0",
+ "semver": "2 || 3 || 4 || 5",
+ "validate-npm-package-license": "^3.0.1"
+ }
+ },
+ "normalize-path": {
+ "version": "3.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/normalize-path/-/normalize-path-3.0.0.tgz",
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="
+ },
+ "now-and-later": {
+ "version": "2.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/now-and-later/-/now-and-later-2.0.1.tgz",
+ "integrity": "sha512-KGvQ0cB70AQfg107Xvs/Fbu+dGmZoTRJp2TaPwcwQm3/7PteUyN2BCgk8KBMPGBUXZdVwyWS8fDCGFygBm19UQ==",
+ "requires": {
+ "once": "^1.3.2"
+ }
+ },
+ "npm-run-path": {
+ "version": "4.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/npm-run-path/-/npm-run-path-4.0.1.tgz",
+ "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
+ "requires": {
+ "path-key": "^3.0.0"
+ }
+ },
+ "number-is-nan": {
+ "version": "1.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/number-is-nan/-/number-is-nan-1.0.1.tgz",
+ "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0="
+ },
+ "object-keys": {
+ "version": "1.1.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/object-keys/-/object-keys-1.1.1.tgz",
+ "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA=="
+ },
+ "object.assign": {
+ "version": "4.1.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/object.assign/-/object.assign-4.1.2.tgz",
+ "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==",
+ "requires": {
+ "call-bind": "^1.0.0",
+ "define-properties": "^1.1.3",
+ "has-symbols": "^1.0.1",
+ "object-keys": "^1.1.1"
+ }
+ },
+ "object.defaults": {
+ "version": "1.1.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/object.defaults/-/object.defaults-1.1.0.tgz",
+ "integrity": "sha1-On+GgzS0B96gbaFtiNXNKeQ1/s8=",
+ "requires": {
+ "array-each": "^1.0.1",
+ "array-slice": "^1.0.0",
+ "for-own": "^1.0.0",
+ "isobject": "^3.0.0"
+ }
+ },
+ "object.map": {
+ "version": "1.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/object.map/-/object.map-1.0.1.tgz",
+ "integrity": "sha1-z4Plncj8wK1fQlDh94s7gb2AHTc=",
+ "requires": {
+ "for-own": "^1.0.0",
+ "make-iterator": "^1.0.0"
+ }
+ },
+ "object.pick": {
+ "version": "1.3.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/object.pick/-/object.pick-1.3.0.tgz",
+ "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=",
+ "requires": {
+ "isobject": "^3.0.1"
+ }
+ },
+ "object.reduce": {
+ "version": "1.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/object.reduce/-/object.reduce-1.0.1.tgz",
+ "integrity": "sha1-b+NI8qx/oPlcpiEiZZkJaCW7A60=",
+ "requires": {
+ "for-own": "^1.0.0",
+ "make-iterator": "^1.0.0"
+ }
+ },
+ "once": {
+ "version": "1.4.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/once/-/once-1.4.0.tgz",
+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+ "requires": {
+ "wrappy": "1"
+ }
+ },
+ "onetime": {
+ "version": "5.1.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/onetime/-/onetime-5.1.2.tgz",
+ "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
+ "requires": {
+ "mimic-fn": "^2.1.0"
+ }
+ },
+ "os-locale": {
+ "version": "1.4.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/os-locale/-/os-locale-1.4.0.tgz",
+ "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
+ "requires": {
+ "lcid": "^1.0.0"
+ }
+ },
+ "parse-filepath": {
+ "version": "1.0.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/parse-filepath/-/parse-filepath-1.0.2.tgz",
+ "integrity": "sha1-pjISf1Oq89FYdvWHLz/6x2PWyJE=",
+ "requires": {
+ "is-absolute": "^1.0.0",
+ "map-cache": "^0.2.0",
+ "path-root": "^0.1.1"
+ }
+ },
+ "parse-json": {
+ "version": "2.2.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/parse-json/-/parse-json-2.2.0.tgz",
+ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=",
+ "requires": {
+ "error-ex": "^1.2.0"
+ }
+ },
+ "parse-passwd": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/parse-passwd/-/parse-passwd-1.0.0.tgz",
+ "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY="
+ },
+ "path-exists": {
+ "version": "2.1.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/path-exists/-/path-exists-2.1.0.tgz",
+ "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=",
+ "requires": {
+ "pinkie-promise": "^2.0.0"
+ }
+ },
+ "path-is-absolute": {
+ "version": "1.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
+ },
+ "path-key": {
+ "version": "3.1.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/path-key/-/path-key-3.1.1.tgz",
+ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="
+ },
+ "path-parse": {
+ "version": "1.0.7",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/path-parse/-/path-parse-1.0.7.tgz",
+ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="
+ },
+ "path-root": {
+ "version": "0.1.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/path-root/-/path-root-0.1.1.tgz",
+ "integrity": "sha1-mkpoFMrBwM1zNgqV8yCDyOpHRbc=",
+ "requires": {
+ "path-root-regex": "^0.1.0"
+ }
+ },
+ "path-root-regex": {
+ "version": "0.1.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/path-root-regex/-/path-root-regex-0.1.2.tgz",
+ "integrity": "sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0="
+ },
+ "path-type": {
+ "version": "1.1.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/path-type/-/path-type-1.1.0.tgz",
+ "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=",
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "pify": "^2.0.0",
+ "pinkie-promise": "^2.0.0"
+ }
+ },
+ "picomatch": {
+ "version": "2.3.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/picomatch/-/picomatch-2.3.1.tgz",
+ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="
+ },
+ "pify": {
+ "version": "2.3.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/pify/-/pify-2.3.0.tgz",
+ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
+ },
+ "pinkie": {
+ "version": "2.0.4",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/pinkie/-/pinkie-2.0.4.tgz",
+ "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA="
+ },
+ "pinkie-promise": {
+ "version": "2.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
+ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
+ "requires": {
+ "pinkie": "^2.0.0"
+ }
+ },
+ "pretty-hrtime": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/pretty-hrtime/-/pretty-hrtime-1.0.0.tgz",
+ "integrity": "sha1-9ualItPmBwRSK/Db5oVu0g515Nw="
+ },
+ "process-nextick-args": {
+ "version": "2.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
+ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
+ },
+ "punycode": {
+ "version": "2.1.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/punycode/-/punycode-2.1.1.tgz",
+ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
+ },
+ "read-pkg": {
+ "version": "1.1.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/read-pkg/-/read-pkg-1.1.0.tgz",
+ "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=",
+ "requires": {
+ "load-json-file": "^1.0.0",
+ "normalize-package-data": "^2.3.2",
+ "path-type": "^1.0.0"
+ }
+ },
+ "read-pkg-up": {
+ "version": "1.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
+ "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=",
+ "requires": {
+ "find-up": "^1.0.0",
+ "read-pkg": "^1.0.0"
+ }
+ },
+ "readable-stream": {
+ "version": "3.6.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/readable-stream/-/readable-stream-3.6.0.tgz",
+ "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
+ "requires": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ }
+ },
+ "readdir-glob": {
+ "version": "1.1.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/readdir-glob/-/readdir-glob-1.1.1.tgz",
+ "integrity": "sha512-91/k1EzZwDx6HbERR+zucygRFfiPl2zkIYZtv3Jjr6Mn7SkKcVct8aVO+sSRiGMc6fLf72du3d92/uY63YPdEA==",
+ "requires": {
+ "minimatch": "^3.0.4"
+ }
+ },
+ "rechoir": {
+ "version": "0.8.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/rechoir/-/rechoir-0.8.0.tgz",
+ "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==",
+ "requires": {
+ "resolve": "^1.20.0"
+ }
+ },
+ "require-directory": {
+ "version": "2.1.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/require-directory/-/require-directory-2.1.1.tgz",
+ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I="
+ },
+ "require-from-string": {
+ "version": "2.0.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/require-from-string/-/require-from-string-2.0.2.tgz",
+ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw=="
+ },
+ "require-main-filename": {
+ "version": "1.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/require-main-filename/-/require-main-filename-1.0.1.tgz",
+ "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE="
+ },
+ "resolve": {
+ "version": "1.22.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/resolve/-/resolve-1.22.0.tgz",
+ "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==",
+ "requires": {
+ "is-core-module": "^2.8.1",
+ "path-parse": "^1.0.7",
+ "supports-preserve-symlinks-flag": "^1.0.0"
+ }
+ },
+ "resolve-dir": {
+ "version": "1.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/resolve-dir/-/resolve-dir-1.0.1.tgz",
+ "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=",
+ "requires": {
+ "expand-tilde": "^2.0.0",
+ "global-modules": "^1.0.0"
+ }
+ },
+ "resolve-package-path": {
+ "version": "4.0.3",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/resolve-package-path/-/resolve-package-path-4.0.3.tgz",
+ "integrity": "sha512-SRpNAPW4kewOaNUt8VPqhJ0UMxawMwzJD8V7m1cJfdSTK9ieZwS6K7Dabsm4bmLFM96Z5Y/UznrpG5kt1im8yA==",
+ "requires": {
+ "path-root": "^0.1.1"
+ }
+ },
+ "rfdc": {
+ "version": "1.3.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/rfdc/-/rfdc-1.3.0.tgz",
+ "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA=="
+ },
+ "safe-buffer": {
+ "version": "5.1.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/safe-buffer/-/safe-buffer-5.1.2.tgz",
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
+ },
+ "safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
+ },
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
+ },
+ "set-blocking": {
+ "version": "2.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/set-blocking/-/set-blocking-2.0.0.tgz",
+ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
+ },
+ "shebang-command": {
+ "version": "2.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/shebang-command/-/shebang-command-2.0.0.tgz",
+ "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
+ "requires": {
+ "shebang-regex": "^3.0.0"
+ }
+ },
+ "shebang-regex": {
+ "version": "3.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/shebang-regex/-/shebang-regex-3.0.0.tgz",
+ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="
+ },
+ "signal-exit": {
+ "version": "3.0.7",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/signal-exit/-/signal-exit-3.0.7.tgz",
+ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="
+ },
+ "spdx-correct": {
+ "version": "3.1.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/spdx-correct/-/spdx-correct-3.1.1.tgz",
+ "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==",
+ "requires": {
+ "spdx-expression-parse": "^3.0.0",
+ "spdx-license-ids": "^3.0.0"
+ }
+ },
+ "spdx-exceptions": {
+ "version": "2.3.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz",
+ "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A=="
+ },
+ "spdx-expression-parse": {
+ "version": "3.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz",
+ "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==",
+ "requires": {
+ "spdx-exceptions": "^2.1.0",
+ "spdx-license-ids": "^3.0.0"
+ }
+ },
+ "spdx-license-ids": {
+ "version": "3.0.11",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz",
+ "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g=="
+ },
+ "stream-exhaust": {
+ "version": "1.0.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/stream-exhaust/-/stream-exhaust-1.0.2.tgz",
+ "integrity": "sha512-b/qaq/GlBK5xaq1yrK9/zFcyRSTNxmcZwFLGSTG0mXgZl/4Z6GgiyYOXOvY7N3eEvFRAG1bkDRz5EPGSvPYQlw=="
+ },
+ "streamroller": {
+ "version": "3.0.7",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/streamroller/-/streamroller-3.0.7.tgz",
+ "integrity": "sha512-kh68kwiDGuIPiPDWwRbEC5us+kfARP1e9AsQiaLaSqGrctOvMn0mtL8iNY3r4/o5nIoYi3gPI1jexguZsXDlxw==",
+ "requires": {
+ "date-format": "^4.0.7",
+ "debug": "^4.3.4",
+ "fs-extra": "^10.0.1"
+ }
+ },
+ "string-width": {
+ "version": "1.0.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/string-width/-/string-width-1.0.2.tgz",
+ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
+ "requires": {
+ "code-point-at": "^1.0.0",
+ "is-fullwidth-code-point": "^1.0.0",
+ "strip-ansi": "^3.0.0"
+ }
+ },
+ "string_decoder": {
+ "version": "1.1.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/string_decoder/-/string_decoder-1.1.1.tgz",
+ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
+ "requires": {
+ "safe-buffer": "~5.1.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "3.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/strip-ansi/-/strip-ansi-3.0.1.tgz",
+ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
+ "requires": {
+ "ansi-regex": "^2.0.0"
+ }
+ },
+ "strip-bom": {
+ "version": "2.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/strip-bom/-/strip-bom-2.0.0.tgz",
+ "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=",
+ "requires": {
+ "is-utf8": "^0.2.0"
+ }
+ },
+ "strip-final-newline": {
+ "version": "2.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
+ "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA=="
+ },
+ "supports-preserve-symlinks-flag": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
+ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="
+ },
+ "tar-stream": {
+ "version": "2.2.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/tar-stream/-/tar-stream-2.2.0.tgz",
+ "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
+ "requires": {
+ "bl": "^4.0.3",
+ "end-of-stream": "^1.4.1",
+ "fs-constants": "^1.0.0",
+ "inherits": "^2.0.3",
+ "readable-stream": "^3.1.1"
+ }
+ },
+ "to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "requires": {
+ "is-number": "^7.0.0"
+ },
+ "dependencies": {
+ "is-number": {
+ "version": "7.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="
+ }
+ }
+ },
+ "type": {
+ "version": "1.2.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/type/-/type-1.2.0.tgz",
+ "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg=="
+ },
+ "unc-path-regex": {
+ "version": "0.1.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/unc-path-regex/-/unc-path-regex-0.1.2.tgz",
+ "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo="
+ },
+ "undertaker": {
+ "version": "1.2.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/undertaker/-/undertaker-1.2.1.tgz",
+ "integrity": "sha512-71WxIzDkgYk9ZS+spIB8iZXchFhAdEo2YU8xYqBYJ39DIUIqziK78ftm26eecoIY49X0J2MLhG4hr18Yp6/CMA==",
+ "requires": {
+ "arr-flatten": "^1.0.1",
+ "arr-map": "^2.0.0",
+ "bach": "^1.0.0",
+ "collection-map": "^1.0.0",
+ "es6-weak-map": "^2.0.1",
+ "last-run": "^1.1.0",
+ "object.defaults": "^1.0.0",
+ "object.reduce": "^1.0.0",
+ "undertaker-registry": "^1.0.0"
+ }
+ },
+ "undertaker-registry": {
+ "version": "1.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/undertaker-registry/-/undertaker-registry-1.0.1.tgz",
+ "integrity": "sha1-XkvaMI5KiirlhPm5pDWaSZglzFA="
+ },
+ "universalify": {
+ "version": "2.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/universalify/-/universalify-2.0.0.tgz",
+ "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ=="
+ },
+ "uri-js": {
+ "version": "4.4.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/uri-js/-/uri-js-4.4.1.tgz",
+ "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
+ "requires": {
+ "punycode": "^2.1.0"
+ }
+ },
+ "util-deprecate": {
+ "version": "1.0.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/util-deprecate/-/util-deprecate-1.0.2.tgz",
+ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
+ },
+ "v8flags": {
+ "version": "3.2.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/v8flags/-/v8flags-3.2.0.tgz",
+ "integrity": "sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg==",
+ "requires": {
+ "homedir-polyfill": "^1.0.1"
+ }
+ },
+ "validate-npm-package-license": {
+ "version": "3.0.4",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
+ "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
+ "requires": {
+ "spdx-correct": "^3.0.0",
+ "spdx-expression-parse": "^3.0.0"
+ }
+ },
+ "which": {
+ "version": "1.3.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/which/-/which-1.3.1.tgz",
+ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+ "requires": {
+ "isexe": "^2.0.0"
+ }
+ },
+ "which-module": {
+ "version": "1.0.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/which-module/-/which-module-1.0.0.tgz",
+ "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8="
+ },
+ "wrap-ansi": {
+ "version": "2.1.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
+ "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
+ "requires": {
+ "string-width": "^1.0.1",
+ "strip-ansi": "^3.0.1"
+ }
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
+ },
+ "y18n": {
+ "version": "3.2.2",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/y18n/-/y18n-3.2.2.tgz",
+ "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ=="
+ },
+ "yargs": {
+ "version": "7.1.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/yargs/-/yargs-7.1.0.tgz",
+ "integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=",
+ "requires": {
+ "camelcase": "^3.0.0",
+ "cliui": "^3.2.0",
+ "decamelize": "^1.1.1",
+ "get-caller-file": "^1.0.1",
+ "os-locale": "^1.4.0",
+ "read-pkg-up": "^1.0.1",
+ "require-directory": "^2.1.1",
+ "require-main-filename": "^1.0.1",
+ "set-blocking": "^2.0.0",
+ "string-width": "^1.0.2",
+ "which-module": "^1.0.0",
+ "y18n": "^3.2.1",
+ "yargs-parser": "^5.0.0"
+ }
+ },
+ "yargs-parser": {
+ "version": "5.0.1",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/yargs-parser/-/yargs-parser-5.0.1.tgz",
+ "integrity": "sha512-wpav5XYiddjXxirPoCTUPbqM0PXvJ9hiBMvuJgInvo4/lAOTZzUprArw17q2O1P2+GHhbBr18/iQwjL5Z9BqfA==",
+ "requires": {
+ "camelcase": "^3.0.0",
+ "object.assign": "^4.1.0"
+ }
+ },
+ "zip-stream": {
+ "version": "4.1.0",
+ "resolved": "https://repo.huaweicloud.com/repository/npm/zip-stream/-/zip-stream-4.1.0.tgz",
+ "integrity": "sha512-zshzwQW7gG7hjpBlgeQP9RuyPGNxvJdzR8SUM3QhxCnLjWN2E7j3dOvpeDcQoETfHx0urRS7EtmVToql7YpU4A==",
+ "requires": {
+ "archiver-utils": "^2.1.0",
+ "compress-commons": "^4.1.0",
+ "readable-stream": "^3.6.0"
+ }
+ }
+ }
+}
diff --git a/frameworks/ringtone_extension_hap/RingtoneLibraryExt/package.json b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/package.json
new file mode 100644
index 0000000..63c7ca3
--- /dev/null
+++ b/frameworks/ringtone_extension_hap/RingtoneLibraryExt/package.json
@@ -0,0 +1,18 @@
+{
+ "license":"ISC",
+ "devDependencies":{},
+ "name":"ringtonelibrarydata",
+ "ohos":{
+ "org":"huawei",
+ "directoryLevel":"project",
+ "buildTool":"hvigor"
+ },
+ "description":"example description",
+ "repository":{},
+ "version":"1.0.0",
+ "dependencies":{
+ "@ohos/hvigor-ohos-plugin":"1.0.6",
+ "hypium":"^1.0.0",
+ "@ohos/hvigor":"1.0.6"
+ }
+}
diff --git a/frameworks/ringtone_extension_hap/signature/ringtonelibrary.p7b b/frameworks/ringtone_extension_hap/signature/ringtonelibrary.p7b
new file mode 100644
index 0000000..896a109
Binary files /dev/null and b/frameworks/ringtone_extension_hap/signature/ringtonelibrary.p7b differ
diff --git a/hisysevent.yaml b/hisysevent.yaml
new file mode 100644
index 0000000..afb95c6
--- /dev/null
+++ b/hisysevent.yaml
@@ -0,0 +1,45 @@
+# Copyright (c) 2024 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.
+
+#####################################################
+# below is the format of defining event #
+#####################################################
+#domain: domain name. [Only one domain name can be defined at the top]
+#
+#author: the author name who defined this event.
+#date: the date when this event was defined, format is YYYY-MM-DD.
+#logged: source file which refer to this event.
+#usage: the usage of this event.
+#//Define event name and event properties.
+#@EVENT_NAME: the event definition part begin.
+# // __BASE is used for defining the basic info of the event.
+# // "type" optional values are: FAULT, STATISTICS, SECURITY, BEHAVIOR.
+# // "level" optional values are: CRITICAL, MINOR.
+# // "tag" set tags with may used by subscriber of this event, multiple tags divided by space.
+# // "desc" full description of this event.
+# @PARAMETER: {type: parameter type, arrsize: array length(optional), desc: parameter description}.
+# // follow the __BASE block, each line defines a parameter of this event.
+# // "type" optional values are: INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, FLOAT, DOUBLE, STRING.
+# // "arrsize" of the parameter is an array, set a non-zero value.
+# // "desc" full description of this parameter.
+
+# DESCRIPTION contains userid,request type.
+# REASON contains errno num, and failed interface.
+
+domain: RINGTONELIBRARY
+
+RINGTONELIB_DFX_MESSAGE:
+ __BASE: { type: STATISTIC, level: MINOR, desc: preset and custom ringtone number }
+ DATE: { type: STRING, desc: report date }
+ PRESET_NUM: { type: INT32, desc: preset ringtone number }
+ CUSTOM_NUM: { type: INT32, desc: custom ringtone number }
diff --git a/services/ringtone_data_extension/include/ringtone_bundle_manager.h b/services/ringtone_data_extension/include/ringtone_bundle_manager.h
new file mode 100644
index 0000000..fd196ee
--- /dev/null
+++ b/services/ringtone_data_extension/include/ringtone_bundle_manager.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2024 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_RINGTONE_BUNDLE_MANAGER_H
+#define OHOS_RINGTONE_BUNDLE_MANAGER_H
+
+#include
+#include
+#include
+
+namespace OHOS {
+namespace Media {
+class RingtoneBundleManager {
+public:
+ RingtoneBundleManager() = default;
+ ~RingtoneBundleManager() = default;
+ static std::shared_ptr GetInstance();
+ std::string GetClientBundleName();
+ void Clear();
+
+private:
+ void GetBundleNameByUid(const int32_t uid, std::string &bundleName);
+
+ // BundleMessage is the pair of bundleName and whether bundle is system app
+ std::list> cacheList_;
+ std::unordered_map>::iterator> cacheMap_;
+ std::mutex uninstallMutex_;
+
+ static std::mutex mutex_;
+ static std::shared_ptr instance_;
+};
+} // RingtoneBundleManager
+} // OHOS
+#endif // OHOS_RINGTONE_BUNDLE_MANAGER_H
diff --git a/services/ringtone_data_extension/include/ringtone_data_command.h b/services/ringtone_data_extension/include/ringtone_data_command.h
new file mode 100644
index 0000000..e58d09d
--- /dev/null
+++ b/services/ringtone_data_extension/include/ringtone_data_command.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2024 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 RINGTONE_COLUMN_DATA_COMMAND_H
+#define RINGTONE_COLUMN_DATA_COMMAND_H
+
+#include "abs_rdb_predicates.h"
+#include "datashare_predicates.h"
+#include "ringtone_db_const.h"
+#include "uri.h"
+#include "values_bucket.h"
+
+namespace OHOS {
+namespace Media {
+#define EXPORT __attribute__ ((visibility ("default")))
+enum class EXPORT RingtoneOperationType : uint32_t {
+ UNKNOWN_TYPE = 0,
+ OPEN,
+ INSERT,
+ DELETE,
+ UPDATE,
+ QUERY,
+ SCAN,
+};
+
+class RingtoneDataCommand {
+public:
+ EXPORT explicit RingtoneDataCommand(const Uri &uri, const std::string &table, const RingtoneOperationType type);
+ EXPORT RingtoneDataCommand() = delete;
+ EXPORT ~RingtoneDataCommand();
+ EXPORT RingtoneDataCommand(const RingtoneDataCommand &) = delete;
+ EXPORT RingtoneDataCommand &operator=(const RingtoneDataCommand &) = delete;
+ EXPORT RingtoneDataCommand(RingtoneDataCommand &&) = delete;
+ EXPORT RingtoneDataCommand &operator=(RingtoneDataCommand &&) = delete;
+
+ const Uri &GetUri() const;
+ const std::string &GetTableName();
+ NativeRdb::ValuesBucket &GetValueBucket();
+ EXPORT NativeRdb::AbsRdbPredicates *GetAbsRdbPredicates();
+ const std::string &GetBundleName();
+ const std::string &GetResult();
+
+ EXPORT void SetDataSharePred(const DataShare::DataSharePredicates &pred);
+ EXPORT void SetValueBucket(const NativeRdb::ValuesBucket &value);
+ void SetBundleName(const std::string &bundleName);
+ void SetResult(const std::string &result);
+ RingtoneOperationType GetOprnType() const;
+private:
+ static int32_t GetToneIdFromUri(Uri &uri);
+
+ Uri uri_ {""};
+ std::string tableName_;
+ RingtoneOperationType oprnType_ {RingtoneOperationType::UNKNOWN_TYPE};
+ int32_t toneId_;
+ NativeRdb::ValuesBucket insertValue_;
+ std::unique_ptr absRdbPredicates_;
+ std::unique_ptr datasharePred_;
+ std::string bundleName_;
+ std::string result_;
+};
+} // namespace Media
+} // namespace OHOS
+
+#endif // RINGTONE_COLUMN_DATA_COMMAND_H
diff --git a/services/ringtone_data_extension/include/ringtone_data_manager.h b/services/ringtone_data_extension/include/ringtone_data_manager.h
new file mode 100644
index 0000000..cfbee16
--- /dev/null
+++ b/services/ringtone_data_extension/include/ringtone_data_manager.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2024 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 RINGTONE_COLUMN_DATA_MANAGER_H
+#define RINGTONE_COLUMN_DATA_MANAGER_H
+
+#include "datashare_values_bucket.h"
+#include "rdb_utils.h"
+#include "ringtone_asset.h"
+#include "ringtone_data_command.h"
+#include "ringtone_datashare_extension.h"
+
+#define EXPORT __attribute__ ((visibility ("default")))
+
+namespace OHOS {
+namespace AbilityRuntime {
+class RingtoneDataShareExtension;
+}
+namespace Media {
+using OHOS::AbilityRuntime::RingtoneDataShareExtension;
+class RingtoneDataManager {
+public:
+ EXPORT RingtoneDataManager();
+ EXPORT ~RingtoneDataManager();
+ EXPORT static std::shared_ptr GetInstance();
+
+ EXPORT int32_t Insert(RingtoneDataCommand &cmd, const DataShare::DataShareValuesBucket &value);
+ EXPORT int32_t Delete(RingtoneDataCommand &cmd, const DataShare::DataSharePredicates &predicates);
+ EXPORT int32_t Update(RingtoneDataCommand &cmd, const DataShare::DataShareValuesBucket &value,
+ const DataShare::DataSharePredicates &predicates);
+ EXPORT std::shared_ptr Query(RingtoneDataCommand &cmd,
+ const std::vector &columns, const DataShare::DataSharePredicates &predicates, int &errCode);
+ EXPORT int32_t OpenFile(RingtoneDataCommand &cmd, const std::string &mode);
+
+ EXPORT int32_t Init(const std::shared_ptr &context);
+ EXPORT void ClearRingtoneDataMgr();
+ EXPORT void SetOwner(const std::shared_ptr &datashareExtension);
+ EXPORT std::shared_ptr GetOwner();
+private:
+ std::string GetIdFromUri(Uri &uri);
+ std::shared_ptr GetRingtoneAssetFromId(const std::string &id);
+ int32_t DeleteFileFromResultSet(std::shared_ptr &resultSet);
+ std::shared_mutex mgrSharedMutex_;
+ std::shared_ptr context_ = nullptr;
+ static std::mutex mutex_;
+ static std::shared_ptr instance_;
+ std::atomic refCnt_ {0};
+ std::shared_ptr extension_ = nullptr;
+};
+} // namespace Media
+} // namespace OHOS
+#endif // RINGTONE_COLUMN_DATA_MANAGER_H
diff --git a/services/ringtone_data_extension/include/ringtone_datashare_extension.h b/services/ringtone_data_extension/include/ringtone_datashare_extension.h
new file mode 100644
index 0000000..8827d4e
--- /dev/null
+++ b/services/ringtone_data_extension/include/ringtone_datashare_extension.h
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2024 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 FOUNDATION_ABILITYRUNTIME_OHOS_RINGTONE_COLUMN_DATASHARE_EXT_ABILITY_H
+#define FOUNDATION_ABILITYRUNTIME_OHOS_RINGTONE_COLUMN_DATASHARE_EXT_ABILITY_H
+
+#include "datashare_ext_ability.h"
+
+namespace OHOS {
+namespace AbilityRuntime {
+using namespace DataShare;
+/**
+ * @brief Basic datashare extension ability components.
+ */
+#define EXPORT __attribute__ ((visibility ("default")))
+class RingtoneDataShareExtension : public DataShareExtAbility {
+public:
+ EXPORT RingtoneDataShareExtension(Runtime &runtime);
+ EXPORT virtual ~RingtoneDataShareExtension() override;
+
+ /**
+ * @brief Create RingtoneDataShareExtension.
+ *
+ * @param runtime The runtime.
+ * @return The RingtoneDataShareExtension instance.
+ */
+ EXPORT static RingtoneDataShareExtension *Create(const std::unique_ptr &runtime);
+
+ /**
+ * @brief Init the extension.
+ *
+ * @param record the extension record.
+ * @param application the application info.
+ * @param handler the extension handler.
+ * @param token the remote token.
+ */
+ EXPORT void Init(const std::shared_ptr &record,
+ const std::shared_ptr &application,
+ std::shared_ptr &handler,
+ const sptr &token) override;
+
+ /**
+ * @brief Called when this datashare extension ability is started. You must override this function if you want to
+ * perform some initialization operations during extension startup.
+ *
+ * This function can be called only once in the entire lifecycle of an extension.
+ * @param Want Indicates the {@link Want} structure containing startup information about the extension.
+ */
+ EXPORT void OnStart(const AAFwk::Want &want) override;
+
+ EXPORT void OnStop() override;
+
+ /**
+ * @brief Called when this datashare extension ability is connected for the first time.
+ *
+ * You can override this function to implement your own processing logic.
+ *
+ * @param want Indicates the {@link Want} structure containing connection information about the datashare
+ * extension.
+ * @return Returns a pointer to the sid of the connected datashare extension ability.
+ */
+ EXPORT sptr OnConnect(const AAFwk::Want &want) override;
+ /**
+ * @brief Inserts a single data record into the database.
+ *
+ * @param uri Indicates the path of the data to operate.
+ * @param value Indicates the data record to insert. If this parameter is null, a blank row will be inserted.
+ *
+ * @return Returns the index of the inserted data record.
+ */
+ EXPORT int Insert(const Uri &uri, const DataShareValuesBucket &value) override;
+
+ /**
+ * @brief Deletes one or more data records from the database.
+ *
+ * @param uri Indicates the path of the data to operate.
+ * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null.
+ *
+ * @return Returns the number of data records deleted.
+ */
+ EXPORT int Delete(const Uri &uri, const DataSharePredicates &predicates) override;
+
+ /**
+ * @brief Updates data records in the database.
+ *
+ * @param uri Indicates the path of data to update.
+ * @param value Indicates the data to update. This parameter can be null.
+ * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null.
+ *
+ * @return Returns the number of data records updated.
+ */
+ EXPORT int Update(const Uri &uri, const DataSharePredicates &predicates,
+ const DataShareValuesBucket &value) override;
+
+ /**
+ * @brief query one or more data records from the database.
+ *
+ * @param uri Indicates the path of data to query.
+ * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null.
+ * @param columns Indicates the columns to query. If this parameter is null, all columns are queried.
+ * @param businessError Indicates errorcode and message.
+
+ * @return Returns the query result.
+ */
+ EXPORT std::shared_ptr Query(const Uri &uri, const DataSharePredicates &predicates,
+ std::vector &columns, DatashareBusinessError &businessError) override;
+
+ /**
+ * @brief Opens a file in a specified remote path.
+ *
+ * @param uri Indicates the path of the file to open.
+ * @param mode Indicates the file open mode, which can be "r" for read-only access, "w" for write-only access
+ * (erasing whatever data is currently in the file), "wt" for write access that truncates any existing file,
+ * "wa" for write-only access to append to any existing data, "rw" for read and write access on any existing data,
+ * or "rwt" for read and write access that truncates any existing file.
+ *
+ * @return Returns the file descriptor.
+ */
+ EXPORT int OpenFile(const Uri &uri, const std::string &mode) override;
+private:
+ static void DumpDataShareValueBucket(const std::vector &tabFields, const DataShareValuesBucket &value);
+ Runtime &runtime_;
+};
+} // namespace AbilityRuntime
+} // namespace OHOS
+#endif // FOUNDATION_ABILITYRUNTIME_OHOS_RINGTONE_COLUMN_DATASHARE_EXT_ABILITY_H
diff --git a/services/ringtone_data_extension/include/ringtone_datashare_stub_impl.h b/services/ringtone_data_extension/include/ringtone_datashare_stub_impl.h
new file mode 100644
index 0000000..9f7af04
--- /dev/null
+++ b/services/ringtone_data_extension/include/ringtone_datashare_stub_impl.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2024 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 RINGTONE_COLUMN_DATASHARE_STUB_IMPL_H
+#define RINGTONE_COLUMN_DATASHARE_STUB_IMPL_H
+
+#include "datashare_stub.h"
+#include "ringtone_datashare_extension.h"
+
+namespace OHOS {
+namespace DataShare {
+using DataShare::RingtoneDataShareExtension;
+#define EXPORT __attribute__ ((visibility ("default")))
+class EXPORT RingtoneDataShareStubImpl : public DataShareStub {
+public:
+ EXPORT explicit RingtoneDataShareStubImpl(const std::shared_ptr& extension,
+ napi_env env) : extension_(extension) {}
+
+ EXPORT virtual ~RingtoneDataShareStubImpl() {}
+
+ EXPORT std::vector GetFileTypes(const Uri &uri, const std::string &mimeTypeFilter) override;
+
+ EXPORT int OpenFile(const Uri &uri, const std::string &mode) override;
+
+ EXPORT int Insert(const Uri &uri, const DataShareValuesBucket &value) override;
+
+ EXPORT int InsertExt(const Uri &uri, const DataShareValuesBucket &value, std::string &result) override;
+
+ EXPORT int Update(const Uri &uri, const DataSharePredicates &predicates,
+ const DataShareValuesBucket &value) override;
+
+ EXPORT int Delete(const Uri &uri, const DataSharePredicates &predicates) override;
+
+ EXPORT std::shared_ptr Query(const Uri &uri, const DataSharePredicates &predicates,
+ std::vector &columns, DatashareBusinessError &businessError) override;
+
+ EXPORT int OpenRawFile(const Uri &uri, const std::string &mode) override;
+
+ EXPORT std::string GetType(const Uri &uri) override;
+
+ EXPORT int BatchInsert(const Uri &uri, const std::vector &values) override;
+
+ EXPORT bool RegisterObserver(const Uri &uri, const sptr &dataObserver) override;
+
+ EXPORT bool UnregisterObserver(const Uri &uri, const sptr &dataObserver) override;
+
+ EXPORT bool NotifyChange(const Uri &uri) override;
+
+ EXPORT Uri NormalizeUri(const Uri &uri) override;
+
+ EXPORT Uri DenormalizeUri(const Uri &uri) override;
+
+private:
+ EXPORT std::shared_ptr GetOwner();
+
+private:
+ std::shared_ptr extension_;
+};
+} // namespace Media_DataShare
+} // namespace OHOS
+#endif // RINGTONE_COLUMN_DATASHARE_STUB_IMPL_H
+
diff --git a/services/ringtone_data_extension/include/ringtone_rdbstore.h b/services/ringtone_data_extension/include/ringtone_rdbstore.h
new file mode 100644
index 0000000..dd3288f
--- /dev/null
+++ b/services/ringtone_data_extension/include/ringtone_rdbstore.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2024 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 RINGTONE_RDBSTORE_H
+#define RINGTONE_RDBSTORE_H
+
+#include "ringtone_unistore.h"
+
+namespace OHOS {
+namespace Media {
+#define EXPORT __attribute__ ((visibility ("default")))
+
+class RingtoneDataCallBack;
+
+class RingtoneRdbStore final : public RingtoneUnistore {
+public:
+ EXPORT static RingtoneUnistore *GetInstance(const std::shared_ptr &context =
+ nullptr);
+ EXPORT virtual ~RingtoneRdbStore();
+
+ EXPORT virtual int32_t Init() override;
+ EXPORT virtual void Stop() override;
+
+ EXPORT virtual int32_t Insert(RingtoneDataCommand &cmd, int64_t &rowId) override;
+ EXPORT virtual int32_t Delete(RingtoneDataCommand &cmd, int32_t &deletedRows) override;
+ EXPORT virtual int32_t Update(RingtoneDataCommand &cmd, int32_t &changedRows) override;
+ EXPORT std::shared_ptr Query(RingtoneDataCommand &cmd,
+ const std::vector &columns) override;
+
+ EXPORT int32_t ExecuteSql(const std::string &sql) override;
+ EXPORT std::shared_ptr QuerySql(const std::string &sql,
+ const std::vector &selectionArgs = std::vector()) override;
+ EXPORT std::shared_ptr GetRaw() override;
+private:
+ explicit RingtoneRdbStore(const std::shared_ptr &context);
+
+ std::string bundleName_ {BUNDLE_NAME};
+ NativeRdb::RdbStoreConfig config_ {""};
+ static std::shared_ptr rdbStore_;
+};
+
+class RingtoneDataCallBack : public NativeRdb::RdbOpenCallback {
+public:
+ int32_t OnCreate(NativeRdb::RdbStore &rdbStore) override;
+ int32_t OnUpgrade(NativeRdb::RdbStore &rdbStore, int32_t oldVersion, int32_t newVersion) override;
+private:
+ static int32_t InitSql(NativeRdb::RdbStore &store);
+ static int32_t PrepareDir();
+ static int32_t CreatePreloadFolder(const std::string &path);
+ static int32_t MkdirRecursive(const std::string &path, size_t start);
+};
+} // namespace Media
+} // namespace OHOS
+
+#endif // RINGTONE_RDBSTORE_H
diff --git a/services/ringtone_data_extension/include/ringtone_subscriber.h b/services/ringtone_data_extension/include/ringtone_subscriber.h
new file mode 100644
index 0000000..640e125
--- /dev/null
+++ b/services/ringtone_data_extension/include/ringtone_subscriber.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2024 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 RINGTONE_SUBSCRIBER_H
+#define RINGTONE_SUBSCRIBER_H
+
+#include "common_event_manager.h"
+
+namespace OHOS {
+namespace Media {
+#define EXPORT __attribute__ ((visibility ("default")))
+class EXPORT RingtoneSubscriber : public EventFwk::CommonEventSubscriber {
+public:
+ EXPORT RingtoneSubscriber() = default;
+ EXPORT explicit RingtoneSubscriber(const EventFwk::CommonEventSubscribeInfo &subscriberInfo);
+ EXPORT static bool Subscribe(void);
+ EXPORT virtual ~RingtoneSubscriber() = default;
+
+ EXPORT virtual void OnReceiveEvent(const EventFwk::CommonEventData &eventData) override;
+
+private:
+ static const std::vector events_;
+};
+} // namespace Media
+} // namespace OHOS
+
+#endif // RINGTONE_SUBSCRIBER_H
diff --git a/services/ringtone_data_extension/include/ringtone_unistore.h b/services/ringtone_data_extension/include/ringtone_unistore.h
new file mode 100644
index 0000000..ea53108
--- /dev/null
+++ b/services/ringtone_data_extension/include/ringtone_unistore.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2024 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 RINGTONE_UNISTORE_H
+#define RINGTONE_UNISTORE_H
+
+#include "ability_context.h"
+#include "rdb_helper.h"
+#include "ringtone_data_command.h"
+
+namespace OHOS {
+namespace Media {
+#define EXPORT __attribute__ ((visibility ("default")))
+class RingtoneUnistore {
+public:
+ EXPORT RingtoneUnistore() = default;
+ EXPORT virtual ~RingtoneUnistore() = default;
+
+ EXPORT virtual int32_t Init() = 0;
+ EXPORT virtual void Stop() = 0;
+
+ EXPORT virtual int32_t Insert(RingtoneDataCommand &cmd, int64_t &rowId) = 0;
+ EXPORT virtual int32_t Delete(RingtoneDataCommand &cmd, int32_t &rowId) = 0;
+ EXPORT virtual int32_t Update(RingtoneDataCommand &cmd, int32_t &rowId) = 0;
+ EXPORT virtual std::shared_ptr Query(RingtoneDataCommand &cmd,
+ const std::vector &columns)
+ {
+ return nullptr;
+ }
+
+ EXPORT virtual int32_t ExecuteSql(const std::string &sql)
+ {
+ return NativeRdb::E_NOT_SUPPORT;
+ }
+
+ EXPORT virtual std::shared_ptr QuerySql(const std::string &sql,
+ const std::vector &selectionArgs = std::vector())
+ {
+ return nullptr;
+ }
+ EXPORT virtual std::shared_ptr GetRaw() = 0;
+};
+} // namespace Media
+} // namespace OHOS
+
+#endif // RINGTONE_UNISTORE_H
diff --git a/services/ringtone_data_extension/src/ringtone_bundle_manager.cpp b/services/ringtone_data_extension/src/ringtone_bundle_manager.cpp
new file mode 100644
index 0000000..962f729
--- /dev/null
+++ b/services/ringtone_data_extension/src/ringtone_bundle_manager.cpp
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2024 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.
+ */
+
+#define MLOG_TAG "RingtoneBundleManager"
+
+#include "ringtone_bundle_manager.h"
+
+#include "ipc_skeleton.h"
+#include "permission_utils.h"
+
+using namespace std;
+
+namespace OHOS {
+namespace Media {
+const int CAPACITY = 50;
+shared_ptr RingtoneBundleManager::instance_ = nullptr;
+mutex RingtoneBundleManager::mutex_;
+shared_ptr RingtoneBundleManager::GetInstance()
+{
+ if (instance_ == nullptr) {
+ lock_guard lock(mutex_);
+ if (instance_ == nullptr) {
+ instance_ = make_shared();
+ }
+ }
+ return instance_;
+}
+
+void RingtoneBundleManager::GetBundleNameByUid(const int32_t uid, string &bundleName)
+{
+ RingtonePermissionUtils::GetClientBundle(uid, bundleName);
+ if (bundleName.empty()) {
+ return;
+ }
+
+ auto it = cacheMap_.find(uid);
+ if (it != cacheMap_.end()) {
+ cacheList_.erase(it->second);
+ }
+ cacheList_.push_front(make_pair(uid, bundleName));
+ cacheMap_[uid] = cacheList_.begin();
+ if (cacheMap_.size() > CAPACITY) {
+ int32_t deleteKey = cacheList_.back().first;
+ cacheMap_.erase(deleteKey);
+ cacheList_.pop_back();
+ }
+}
+
+string RingtoneBundleManager::GetClientBundleName()
+{
+ lock_guard lock(uninstallMutex_);
+ int32_t uid = IPCSkeleton::GetCallingUid();
+ auto iter = cacheMap_.find(uid);
+ if (iter == cacheMap_.end()) {
+ string bundleName;
+ GetBundleNameByUid(uid, bundleName);
+ return bundleName;
+ }
+ cacheList_.splice(cacheList_.begin(), cacheList_, iter->second);
+ return iter->second->second;
+}
+
+void RingtoneBundleManager::Clear()
+{
+ lock_guard lock(uninstallMutex_);
+ cacheList_.clear();
+ cacheMap_.clear();
+}
+} // Ringtone
+} // OHOS
diff --git a/services/ringtone_data_extension/src/ringtone_data_command.cpp b/services/ringtone_data_extension/src/ringtone_data_command.cpp
new file mode 100644
index 0000000..6192eb7
--- /dev/null
+++ b/services/ringtone_data_extension/src/ringtone_data_command.cpp
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2024 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 "ringtone_data_command.h"
+
+#include "ringtone_errno.h"
+#include "ringtone_log.h"
+
+using namespace std;
+using namespace OHOS::NativeRdb;
+using namespace OHOS::DataShare;
+
+namespace OHOS {
+namespace Media {
+
+RingtoneDataCommand::RingtoneDataCommand(const Uri &uri, const string &table, const RingtoneOperationType type)
+ : uri_(uri), tableName_(table), oprnType_(type), toneId_(-1)
+{
+ toneId_ = GetToneIdFromUri(uri_);
+}
+
+RingtoneDataCommand::~RingtoneDataCommand() {}
+
+// set functions
+void RingtoneDataCommand::SetDataSharePred(const DataShare::DataSharePredicates &pred)
+{
+ datasharePred_ = make_unique(pred);
+}
+
+void RingtoneDataCommand::SetValueBucket(const NativeRdb::ValuesBucket &value)
+{
+ insertValue_ = value;
+}
+
+void RingtoneDataCommand::SetBundleName(const string &bundleName)
+{
+ bundleName_ = bundleName;
+}
+
+void RingtoneDataCommand::SetResult(const string &result)
+{
+ result_ = result;
+}
+
+// get functions
+ValuesBucket &RingtoneDataCommand::GetValueBucket()
+{
+ return insertValue_;
+}
+
+AbsRdbPredicates *RingtoneDataCommand::GetAbsRdbPredicates()
+{
+ if (absRdbPredicates_ == nullptr) {
+ absRdbPredicates_ = make_unique(tableName_);
+ }
+ return absRdbPredicates_.get();
+}
+
+const string &RingtoneDataCommand::GetTableName()
+{
+ return tableName_;
+}
+
+const Uri &RingtoneDataCommand::GetUri() const
+{
+ return uri_;
+}
+
+const string &RingtoneDataCommand::GetBundleName()
+{
+ return bundleName_;
+}
+
+const string &RingtoneDataCommand::GetResult()
+{
+ return result_;
+}
+
+static bool IsNumber(const string &str)
+{
+ if (str.empty()) {
+ RINGTONE_ERR_LOG("IsNumber input is empty ");
+ return false;
+ }
+
+ for (char const &c : str) {
+ if (isdigit(c) == 0) {
+ return false;
+ }
+ }
+ return true;
+}
+
+int32_t RingtoneDataCommand::GetToneIdFromUri(Uri &uri)
+{
+ string uriStr = uri.ToString();
+ if (uriStr.empty()) {
+ return E_INVALID_URI;
+ }
+
+ auto toneId = uriStr.substr(RINGTONE_PATH_URI.size(), uriStr.size());
+ if (IsNumber(toneId)) {
+ RINGTONE_INFO_LOG("Get toneId=%{public}s from Uri", toneId.c_str());
+ return stoi(toneId);
+ }
+
+ return E_INVALID_URI;
+}
+
+RingtoneOperationType RingtoneDataCommand::GetOprnType() const
+{
+ return oprnType_;
+}
+} // namespace Media
+} // namespace OHOS
diff --git a/services/ringtone_data_extension/src/ringtone_data_manager.cpp b/services/ringtone_data_extension/src/ringtone_data_manager.cpp
new file mode 100644
index 0000000..501a0f8
--- /dev/null
+++ b/services/ringtone_data_extension/src/ringtone_data_manager.cpp
@@ -0,0 +1,359 @@
+/*
+ * Copyright (C) 2024 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.
+ */
+
+#define MLOG_TAG "DataManager"
+
+#include "ringtone_data_manager.h"
+
+#include "directory_ex.h"
+#include "rdb_utils.h"
+#include "ringtone_fetch_result.h"
+#include "ringtone_file_utils.h"
+#include "ringtone_log.h"
+#include "ringtone_mimetype_utils.h"
+#include "ringtone_rdbstore.h"
+#include "ringtone_scanner_manager.h"
+#include "ringtone_tracer.h"
+
+
+using namespace std;
+using namespace OHOS::AppExecFwk;
+using namespace OHOS::AbilityRuntime;
+using namespace OHOS::NativeRdb;
+using namespace OHOS::DataShare;
+using namespace OHOS::RdbDataShareAdapter;
+
+namespace OHOS {
+namespace Media {
+shared_ptr RingtoneDataManager::instance_ = nullptr;
+mutex RingtoneDataManager::mutex_;
+RingtoneUnistore *g_uniStore_ = nullptr;
+
+RingtoneDataManager::RingtoneDataManager(void)
+{
+}
+
+RingtoneDataManager::~RingtoneDataManager(void)
+{
+}
+
+shared_ptr RingtoneDataManager::GetInstance()
+{
+ if (instance_ == nullptr) {
+ lock_guard lock(mutex_);
+
+ if (instance_ == nullptr) {
+ instance_ = make_shared();
+ }
+ }
+ return instance_;
+}
+
+int32_t RingtoneDataManager::Init(const shared_ptr &context)
+{
+ RINGTONE_DEBUG_LOG("start");
+ lock_guard lock(mgrSharedMutex_);
+
+ if (refCnt_.load() > 0) {
+ RINGTONE_DEBUG_LOG("already initialized");
+ refCnt_++;
+ return E_OK;
+ }
+ context_ = context;
+ if (g_uniStore_ == nullptr) {
+ g_uniStore_ = RingtoneRdbStore::GetInstance(context_);
+ if (g_uniStore_ == nullptr) {
+ RINGTONE_ERR_LOG("RingtoneDataManager is not initialized");
+ return E_DB_FAIL;
+ }
+ }
+ RingtoneMimeTypeUtils::InitMimeTypeMap();
+ refCnt_++;
+
+ RINGTONE_DEBUG_LOG("end");
+ return E_OK;
+}
+
+int32_t RingtoneDataManager::Insert(RingtoneDataCommand &cmd, const DataShareValuesBucket &dataShareValue)
+{
+ RINGTONE_DEBUG_LOG("start");
+ shared_lock sharedLock(mgrSharedMutex_);
+ if (refCnt_.load() <= 0) {
+ RINGTONE_ERR_LOG("RingtoneDataManager is not initialized");
+ return E_FAIL;
+ }
+ if (g_uniStore_ == nullptr) {
+ RINGTONE_ERR_LOG("rdb store is not initialized");
+ return E_DB_FAIL;
+ }
+
+ ValuesBucket value = RdbUtils::ToValuesBucket(dataShareValue);
+ if (value.IsEmpty()) {
+ RINGTONE_ERR_LOG("RingtoneDataManager Insert: Input parameter is invalid");
+ return E_INVALID_VALUES;
+ }
+ cmd.SetValueBucket(value);
+
+ int64_t outRowId = E_HAS_DB_ERROR;
+ auto retRdb = g_uniStore_->Insert(cmd, outRowId);
+ if (retRdb != NativeRdb::E_OK) {
+ RINGTONE_ERR_LOG("Insert operation failed. Result %{public}d.", retRdb);
+ return E_HAS_DB_ERROR;
+ }
+
+ auto asset = GetRingtoneAssetFromId(to_string(outRowId));
+ if (asset == nullptr) {
+ RINGTONE_ERR_LOG("Failed to get RingtoneAsset");
+ return E_INVALID_VALUES;
+ }
+
+ auto ret = RingtoneFileUtils::CreateFile(asset->GetPath());
+ if (ret != E_SUCCESS) {
+ return ret;
+ }
+
+ RINGTONE_DEBUG_LOG("end");
+ return static_cast(outRowId);
+}
+
+int32_t RingtoneDataManager::DeleteFileFromResultSet(std::shared_ptr &resultSet)
+{
+ auto count = 0;
+ auto ret = resultSet->GetRowCount(count);
+ if (ret != NativeRdb::E_OK) {
+ RINGTONE_ERR_LOG("get rdbstore failed");
+ return E_HAS_DB_ERROR;
+ }
+ if (count == 0) {
+ RINGTONE_ERR_LOG("have no files to delete");
+ return E_SUCCESS;
+ }
+
+ shared_ptr> fetchResult = make_shared>();
+ if (fetchResult == nullptr) {
+ RINGTONE_ERR_LOG("Failed to obtain fetch file result");
+ return E_ERR;
+ }
+
+ for (auto i = 0; i < count; i++) {
+ auto asset = fetchResult->GetObjectFromRdb(resultSet, i);
+ RingtoneFileUtils::DeleteFile(asset->GetPath());
+ }
+
+ return E_SUCCESS;
+}
+
+int32_t RingtoneDataManager::Delete(RingtoneDataCommand &cmd, const DataSharePredicates &predicates)
+{
+ RINGTONE_DEBUG_LOG("start");
+ shared_lock sharedLock(mgrSharedMutex_);
+ if (refCnt_.load() <= 0) {
+ RINGTONE_DEBUG_LOG("RingtoneDataManager is not initialized");
+ return E_FAIL;
+ }
+ if (g_uniStore_ == nullptr) {
+ RINGTONE_ERR_LOG("rdb store is not initialized");
+ return E_DB_FAIL;
+ }
+
+ string uriString = cmd.GetUri().ToString();
+ if (uriString.find(RINGTONE_URI) == string::npos) {
+ RINGTONE_ERR_LOG("Not Data ability Uri");
+ return E_INVALID_URI;
+ }
+
+ NativeRdb::RdbPredicates rdbPredicate = RdbUtils::ToPredicates(predicates, cmd.GetTableName());
+ cmd.GetAbsRdbPredicates()->SetWhereClause(rdbPredicate.GetWhereClause());
+ cmd.GetAbsRdbPredicates()->SetWhereArgs(rdbPredicate.GetWhereArgs());
+
+ vector columns = {RINGTONE_COLUMN_TONE_ID, RINGTONE_COLUMN_DATA};
+ auto absResultSet = g_uniStore_->Query(cmd, columns);
+
+ DeleteFileFromResultSet(absResultSet);
+
+ int32_t deletedRows = E_HAS_DB_ERROR;
+ int32_t ret = g_uniStore_->Delete(cmd, deletedRows);
+ if (ret != NativeRdb::E_OK || deletedRows <= 0) {
+ RINGTONE_ERR_LOG("Delete operation failed. Result %{public}d.", ret);
+ deletedRows = E_HAS_DB_ERROR;
+ }
+
+ RINGTONE_DEBUG_LOG("end");
+ return deletedRows;
+}
+
+int32_t RingtoneDataManager::Update(RingtoneDataCommand &cmd, const DataShareValuesBucket &dataShareValue,
+ const DataSharePredicates &predicates)
+{
+ RINGTONE_DEBUG_LOG("start");
+ shared_lock sharedLock(mgrSharedMutex_);
+ if (refCnt_.load() <= 0) {
+ RINGTONE_DEBUG_LOG("RingtoneDataManager is not initialized");
+ return E_FAIL;
+ }
+ if (g_uniStore_ == nullptr) {
+ RINGTONE_ERR_LOG("rdb store is not initialized");
+ return E_DB_FAIL;
+ }
+
+ ValuesBucket value = RdbUtils::ToValuesBucket(dataShareValue);
+ if (value.IsEmpty()) {
+ RINGTONE_ERR_LOG("RingtoneDataManager Update:Input parameter is invalid");
+ return E_INVALID_VALUES;
+ }
+
+ cmd.SetValueBucket(value);
+ cmd.SetDataSharePred(predicates);
+ NativeRdb::RdbPredicates rdbPredicate = RdbUtils::ToPredicates(predicates, cmd.GetTableName());
+ cmd.GetAbsRdbPredicates()->SetWhereClause(rdbPredicate.GetWhereClause());
+ cmd.GetAbsRdbPredicates()->SetWhereArgs(rdbPredicate.GetWhereArgs());
+
+ int32_t updatedRows = E_HAS_DB_ERROR;
+ int32_t result = g_uniStore_->Update(cmd, updatedRows);
+ if (result != NativeRdb::E_OK || updatedRows <= 0) {
+ RINGTONE_ERR_LOG("Update operation failed. Result %{public}d. Updated %{public}d", result, updatedRows);
+ updatedRows = E_HAS_DB_ERROR;
+ }
+
+ RINGTONE_DEBUG_LOG("end");
+ return updatedRows;
+}
+
+shared_ptr RingtoneDataManager::Query(RingtoneDataCommand &cmd,
+ const vector &columns, const DataSharePredicates &predicates, int &errCode)
+{
+ RINGTONE_DEBUG_LOG("start");
+ shared_lock sharedLock(mgrSharedMutex_);
+ if (refCnt_.load() <= 0) {
+ RINGTONE_DEBUG_LOG("RingtoneDataManager is not initialized");
+ return nullptr;
+ }
+ if (g_uniStore_ == nullptr) {
+ RINGTONE_ERR_LOG("rdb store is not initialized");
+ return nullptr;
+ }
+
+ RingtoneTracer tracer;
+ tracer.Start("RingtoneDataManager::Query");
+ cmd.SetDataSharePred(predicates);
+ NativeRdb::RdbPredicates rdbPredicate = RdbUtils::ToPredicates(predicates, cmd.GetTableName());
+ cmd.GetAbsRdbPredicates()->SetWhereClause(rdbPredicate.GetWhereClause());
+ cmd.GetAbsRdbPredicates()->SetWhereArgs(rdbPredicate.GetWhereArgs());
+ cmd.GetAbsRdbPredicates()->SetOrder(rdbPredicate.GetOrder());
+
+ auto absResultSet = g_uniStore_->Query(cmd, columns);
+
+ RINGTONE_DEBUG_LOG("end");
+ return RdbUtils::ToResultSetBridge(absResultSet);
+}
+
+static bool IsNumber(const string &str)
+{
+ if (str.empty()) {
+ RINGTONE_ERR_LOG("IsNumber input is empty ");
+ return false;
+ }
+
+ for (char const &c : str) {
+ if (isdigit(c) == 0) {
+ return false;
+ }
+ }
+ return true;
+}
+
+int32_t RingtoneDataManager::OpenFile(RingtoneDataCommand &cmd, const string &mode)
+{
+ RINGTONE_DEBUG_LOG("start");
+ RingtoneTracer tracer;
+ tracer.Start("RingtoneDataManager::OpenFile");
+ string toneId = GetIdFromUri(const_cast(cmd.GetUri()));
+ auto asset = GetRingtoneAssetFromId(toneId);
+ if (asset == nullptr) {
+ RINGTONE_ERR_LOG("Failed to get RingtoneAsset");
+ return E_INVALID_VALUES;
+ }
+
+ string absFilePath;
+ if (!PathToRealPath(asset->GetPath(), absFilePath)) {
+ RINGTONE_ERR_LOG("Failed to get real path: %{private}s", asset->GetPath().c_str());
+ return E_ERR;
+ }
+
+ RINGTONE_DEBUG_LOG("end");
+ return RingtoneFileUtils::OpenFile(absFilePath, mode);
+}
+
+void RingtoneDataManager::SetOwner(const shared_ptr &datashareExternsion)
+{
+ extension_ = datashareExternsion;
+}
+
+shared_ptr RingtoneDataManager::GetOwner()
+{
+ return extension_;
+}
+
+string RingtoneDataManager::GetIdFromUri(Uri &uri)
+{
+ vector segments;
+ uri.GetPathSegments(segments);
+ const int uriSegmentsCount = 3;
+ const int toneIdSegmentNumber = 2;
+ if (segments.size() != uriSegmentsCount || segments[1] != RINGTONE_URI_PATH ||
+ !IsNumber(segments[toneIdSegmentNumber])) {
+ return {};
+ }
+ return segments[toneIdSegmentNumber];
+}
+
+shared_ptr RingtoneDataManager::GetRingtoneAssetFromId(const string &id)
+{
+ if ((id.empty()) || (!IsNumber(id)) || (stoi(id) == -1)) {
+ RINGTONE_ERR_LOG("Id for the path is incorrect: %{private}s", id.c_str());
+ return nullptr;
+ }
+ Uri uri("");
+ RingtoneDataCommand cmd(uri, RINGTONE_TABLE, RingtoneOperationType::QUERY);
+ cmd.GetAbsRdbPredicates()->EqualTo(RINGTONE_COLUMN_TONE_ID, id);
+
+ auto resultSet = g_uniStore_->Query(cmd, {RINGTONE_COLUMN_TONE_ID, RINGTONE_COLUMN_DATA});
+ if (resultSet == nullptr) {
+ RINGTONE_ERR_LOG("Failed to obtain file asset from database");
+ return nullptr;
+ }
+
+ shared_ptr> fetchResult = make_shared>();
+ if (fetchResult == nullptr) {
+ RINGTONE_ERR_LOG("Failed to obtain fetch file result");
+ return nullptr;
+ }
+ return fetchResult->GetObjectFromRdb(resultSet, 0);
+}
+
+void RingtoneDataManager::ClearRingtoneDataMgr()
+{
+ lock_guard lock(mgrSharedMutex_);
+
+ refCnt_--;
+ if (refCnt_.load() > 0) {
+ RINGTONE_DEBUG_LOG("still other extension exist");
+ return;
+ }
+
+ extension_ = nullptr;
+}
+} // namespace Media
+} // namespace OHOS
diff --git a/services/ringtone_data_extension/src/ringtone_datashare_extension.cpp b/services/ringtone_data_extension/src/ringtone_datashare_extension.cpp
new file mode 100644
index 0000000..940396b
--- /dev/null
+++ b/services/ringtone_data_extension/src/ringtone_datashare_extension.cpp
@@ -0,0 +1,337 @@
+/*
+ * Copyright (c) 2024 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.
+ */
+#define MLOG_TAG "ringtone_Extension"
+
+#include "ringtone_datashare_extension.h"
+
+#include "app_mgr_client.h"
+#include "datashare_ext_ability_context.h"
+#include "dfx_manager.h"
+#include "parameter.h"
+#include "permission_utils.h"
+#include "ringtone_data_manager.h"
+#include "ringtone_datashare_stub_impl.h"
+#include "ringtone_log.h"
+#include "ringtone_scanner_manager.h"
+#include "runtime.h"
+#include "singleton.h"
+
+
+using namespace std;
+using namespace OHOS::AppExecFwk;
+using namespace OHOS::NativeRdb;
+using namespace OHOS::Media;
+using namespace OHOS::DataShare;
+
+namespace OHOS {
+namespace AbilityRuntime {
+using namespace OHOS::AppExecFwk;
+const char RINGTONE_PARAMETER_SCANNER_COMPLETED_KEY[] = "ringtone.scanner.completed";
+const char RINGTONE_PARAMETER_SCANNER_COMPLETED_TRUE[] = "1";
+const char RINGTONE_PARAMETER_SCANNER_COMPLETED_FALSE[] = "0";
+const int32_t SYSPARA_SIZE = 64;
+
+RingtoneDataShareExtension *RingtoneDataShareExtension::Create(const unique_ptr &runtime)
+{
+ return new RingtoneDataShareExtension(static_cast(*runtime));
+}
+
+RingtoneDataShareExtension::RingtoneDataShareExtension(Runtime &runtime) : DataShareExtAbility(), runtime_(runtime) {}
+
+RingtoneDataShareExtension::~RingtoneDataShareExtension()
+{
+}
+
+void RingtoneDataShareExtension::Init(const shared_ptr &record,
+ const shared_ptr &application, shared_ptr &handler,
+ const sptr &token)
+{
+ if ((record == nullptr) || (application == nullptr) || (handler == nullptr) || (token == nullptr)) {
+ RINGTONE_ERR_LOG("RingtoneDataShareExtension::init failed, some object is nullptr");
+ DelayedSingleton::GetInstance()->KillApplicationSelf();
+ return;
+ }
+ DataShareExtAbility::Init(record, application, handler, token);
+}
+
+void RingtoneDataShareExtension::OnStart(const AAFwk::Want &want)
+{
+ RINGTONE_INFO_LOG("begin.");
+ Extension::OnStart(want);
+ auto context = AbilityRuntime::Context::GetApplicationContext();
+ if (context == nullptr) {
+ RINGTONE_ERR_LOG("Failed to get context");
+ DelayedSingleton::GetInstance()->KillApplicationSelf();
+ return;
+ }
+ RINGTONE_INFO_LOG("runtime language %{public}d", runtime_.GetLanguage());
+ auto dataManager = RingtoneDataManager::GetInstance();
+ if (dataManager == nullptr) {
+ RINGTONE_ERR_LOG("Failed to get dataManager");
+ DelayedSingleton::GetInstance()->KillApplicationSelf();
+ return;
+ }
+ int32_t ret = dataManager->Init(context);
+ if (ret != E_OK) {
+ RINGTONE_ERR_LOG("Failed to init RingtoneData Mgr");
+ DelayedSingleton::GetInstance()->KillApplicationSelf();
+ return;
+ }
+ dataManager->SetOwner(static_pointer_cast(shared_from_this()));
+ auto dfxMgr = DfxManager::GetInstance();
+ dfxMgr->Init(context);
+
+ // ringtone scan
+ char scanCompletedValue[SYSPARA_SIZE] = {0};
+ GetParameter(RINGTONE_PARAMETER_SCANNER_COMPLETED_KEY, RINGTONE_PARAMETER_SCANNER_COMPLETED_FALSE,
+ scanCompletedValue, SYSPARA_SIZE);
+ int isCompleted = atoi(scanCompletedValue);
+ if (!isCompleted) {
+ RingtoneScannerManager::GetInstance()->Start(false);
+ SetParameter(RINGTONE_PARAMETER_SCANNER_COMPLETED_KEY, RINGTONE_PARAMETER_SCANNER_COMPLETED_TRUE);
+ }
+ RINGTONE_INFO_LOG("end.");
+}
+
+void RingtoneDataShareExtension::OnStop()
+{
+ RINGTONE_INFO_LOG("begin.");
+ auto scannerManager = RingtoneScannerManager::GetInstance();
+ if (scannerManager != nullptr) {
+ scannerManager->Stop();
+ }
+ RingtoneDataManager::GetInstance()->ClearRingtoneDataMgr();
+ RINGTONE_INFO_LOG("end.");
+}
+
+sptr RingtoneDataShareExtension::OnConnect(const AAFwk::Want &want)
+{
+ RINGTONE_INFO_LOG("begin.");
+ Extension::OnConnect(want);
+ sptr remoteObject = new (nothrow) RingtoneDataShareStubImpl(
+ static_pointer_cast(shared_from_this()),
+ nullptr);
+ if (remoteObject == nullptr) {
+ RINGTONE_ERR_LOG("No memory allocated for DataShareStubImpl");
+ return nullptr;
+ }
+ RINGTONE_INFO_LOG("end.");
+ return remoteObject->AsObject();
+}
+
+static int32_t CheckRingtonePerm(RingtoneDataCommand &cmd, bool isWrite)
+{
+ auto err = E_SUCCESS;
+ if (isWrite) {
+ err = (RingtonePermissionUtils::CheckCallerPermission(PERM_WRITE_RINGTONE) ? E_SUCCESS : E_PERMISSION_DENIED);
+ }
+
+ return err;
+}
+
+static int32_t UriValidCheck(const Uri &uri)
+{
+ string uriStr = uri.ToString();
+ if (uriStr.compare(0, RINGTONE_PATH_URI.size(), RINGTONE_PATH_URI)) {
+ RINGTONE_ERR_LOG("error: invalid uri!");
+ return E_INVALID_URI;
+ }
+ return E_OK;
+}
+
+static const std::vector g_ringToneTableFields = {
+ { RINGTONE_COLUMN_TONE_ID },
+ { RINGTONE_COLUMN_DATA },
+ { RINGTONE_COLUMN_SIZE },
+ { RINGTONE_COLUMN_DISPLAY_NAME },
+ { RINGTONE_COLUMN_TITLE },
+ { RINGTONE_COLUMN_MEDIA_TYPE },
+ { RINGTONE_COLUMN_TONE_TYPE },
+ { RINGTONE_COLUMN_MIME_TYPE },
+ { RINGTONE_COLUMN_SOURCE_TYPE },
+ { RINGTONE_COLUMN_DATE_ADDED },
+ { RINGTONE_COLUMN_DATE_MODIFIED },
+ { RINGTONE_COLUMN_DATE_TAKEN },
+ { RINGTONE_COLUMN_DURATION },
+ { RINGTONE_COLUMN_SHOT_TONE_TYPE },
+ { RINGTONE_COLUMN_SHOT_TONE_SOURCE_TYPE },
+ { RINGTONE_COLUMN_NOTIFICATION_TONE_TYPE },
+ { RINGTONE_COLUMN_NOTIFICATION_TONE_SOURCE_TYPE },
+ { RINGTONE_COLUMN_RING_TONE_TYPE },
+ { RINGTONE_COLUMN_RING_TONE_SOURCE_TYPE },
+ { RINGTONE_COLUMN_ALARM_TONE_TYPE },
+ { RINGTONE_COLUMN_ALARM_TONE_SOURCE_TYPE },
+};
+
+void RingtoneDataShareExtension::DumpDataShareValueBucket(const std::vector &tabFields,
+ const DataShareValuesBucket &value)
+{
+ bool isValid = false;
+ for (auto tab : tabFields) {
+ auto valueObject = value.Get(tab, isValid);
+ if (!isValid) {
+ RINGTONE_INFO_LOG("not set field: %{public}s", tab.c_str());
+ continue;
+ }
+
+ if (std::get_if>(&(valueObject.value))) {
+ auto value = static_cast>(valueObject);
+ RINGTONE_INFO_LOG("field: %{public}s, value=%{public}s",
+ tab.c_str(), value.data());
+ } else if (std::get_if(&(valueObject.value))) {
+ auto value = static_cast(valueObject);
+ RINGTONE_INFO_LOG("field: %{public}s, value=%{public}lld",
+ tab.c_str(), value);
+ } else if (std::get_if(&(valueObject.value))) {
+ auto value = static_cast(valueObject);
+ RINGTONE_INFO_LOG("field: %{public}s, value=%{public}s",
+ tab.c_str(), value.c_str());
+ } else if (std::get_if(&(valueObject.value))) {
+ auto value = static_cast(valueObject);
+ RINGTONE_INFO_LOG("field: %{public}s, value=%{public}d",
+ tab.c_str(), value);
+ } else if (std::get_if(&(valueObject.value))) {
+ auto value = static_cast(valueObject);
+ RINGTONE_INFO_LOG("field: %{public}s, value=%{public}lf",
+ tab.c_str(), value);
+ } else {
+ RINGTONE_INFO_LOG("unkown field: %{public}s type", tab.c_str());
+ }
+ }
+}
+
+int RingtoneDataShareExtension::Insert(const Uri &uri, const DataShareValuesBucket &value)
+{
+ RINGTONE_DEBUG_LOG("entry, uri=%{public}s", uri.ToString().c_str());
+
+ DumpDataShareValueBucket(g_ringToneTableFields, value);
+
+ int err = UriValidCheck(uri);
+ if (err != E_OK) {
+ return err;
+ }
+ RingtoneDataCommand cmd(uri, RINGTONE_TABLE, RingtoneOperationType::INSERT);
+ err = CheckRingtonePerm(cmd, true);
+ if (err < 0) {
+ RINGTONE_ERR_LOG("Check Insert-permission failed, errCode: %{public}d", err);
+ return err;
+ }
+
+ auto ret = RingtoneDataManager::GetInstance()->Insert(cmd, value);
+ return ret;
+}
+
+int RingtoneDataShareExtension::Update(const Uri &uri, const DataSharePredicates &predicates,
+ const DataShareValuesBucket &value)
+{
+ RINGTONE_DEBUG_LOG("entry, uri=%{public}s", uri.ToString().c_str());
+ RINGTONE_DEBUG_LOG("WhereClause=%{public}s", predicates.GetWhereClause().c_str());
+
+ int err = UriValidCheck(uri);
+ if (err != E_OK) {
+ return err;
+ }
+ RingtoneDataCommand cmd(uri, RINGTONE_TABLE, RingtoneOperationType::UPDATE);
+ err = CheckRingtonePerm(cmd, false);
+ if (err < 0) {
+ RINGTONE_ERR_LOG("Check Update-permission failed, errCode: %{public}d", err);
+ return err;
+ }
+
+ return RingtoneDataManager::GetInstance()->Update(cmd, value, predicates);
+}
+
+int RingtoneDataShareExtension::Delete(const Uri &uri, const DataSharePredicates &predicates)
+{
+ RINGTONE_DEBUG_LOG("entry, uri=%{public}s", uri.ToString().c_str());
+
+ int err = UriValidCheck(uri);
+ if (err != E_OK) {
+ return err;
+ }
+ RingtoneDataCommand cmd(uri, RINGTONE_TABLE, RingtoneOperationType::DELETE);
+ err = CheckRingtonePerm(cmd, true);
+ if (err < 0) {
+ RINGTONE_ERR_LOG("Check Delete-permission failed, errCode: %{public}d", err);
+ return err;
+ }
+
+ return RingtoneDataManager::GetInstance()->Delete(cmd, predicates);
+}
+
+shared_ptr RingtoneDataShareExtension::Query(const Uri &uri,
+ const DataSharePredicates &predicates, vector &columns, DatashareBusinessError &businessError)
+{
+ RINGTONE_DEBUG_LOG("entry, uri=%{public}s", uri.ToString().c_str());
+ int err = UriValidCheck(uri);
+ if (err != E_OK) {
+ return nullptr;
+ }
+ RingtoneDataCommand cmd(uri, RINGTONE_TABLE, RingtoneOperationType::QUERY);
+ err = CheckRingtonePerm(cmd, false);
+ if (err < 0) {
+ businessError.SetCode(err);
+ RINGTONE_ERR_LOG("Check Query-permission failed, errCode: %{public}d", err);
+ return nullptr;
+ }
+
+ int errCode = businessError.GetCode();
+ auto queryResultSet = RingtoneDataManager::GetInstance()->Query(cmd, columns, predicates, errCode);
+ businessError.SetCode(to_string(errCode));
+ if (queryResultSet == nullptr) {
+ RINGTONE_ERR_LOG("queryResultSet is nullptr! errCode: %{public}d", errCode);
+ return nullptr;
+ }
+ shared_ptr resultSet = make_shared(queryResultSet);
+ return resultSet;
+}
+
+int RingtoneDataShareExtension::OpenFile(const Uri &uri, const string &mode)
+{
+ RINGTONE_DEBUG_LOG("entry, uri=%{public}s, mode=%{public}s",
+ uri.ToString().c_str(), mode.c_str());
+
+ int err = UriValidCheck(uri);
+ if (err != E_OK) {
+ return err;
+ }
+ RingtoneDataCommand cmd(uri, RINGTONE_TABLE, RingtoneOperationType::OPEN);
+
+ string unifyMode = mode;
+ transform(unifyMode.begin(), unifyMode.end(), unifyMode.begin(), ::tolower);
+
+ err = CheckRingtonePerm(cmd, true);
+ if (err == E_PERMISSION_DENIED) {
+ RINGTONE_ERR_LOG("OpenFile denied, errCode: %{public}d", err);
+ return err;
+ }
+ return RingtoneDataManager::GetInstance()->OpenFile(cmd, unifyMode);
+}
+
+static DataShare::DataShareExtAbility *RingtoneDataShareCreator(const unique_ptr &runtime)
+{
+ RINGTONE_DEBUG_LOG("entry");
+ return RingtoneDataShareExtension::Create(runtime);
+}
+
+__attribute__((constructor)) void RegisterDataShareCreator()
+{
+ RINGTONE_ERR_LOG("entry");
+ DataShare::DataShareExtAbility::SetCreator(RingtoneDataShareCreator);
+
+ RINGTONE_ERR_LOG("End");
+}
+} // namespace AbilityRuntime
+} // namespace OHOS
diff --git a/services/ringtone_data_extension/src/ringtone_datashare_stub_impl.cpp b/services/ringtone_data_extension/src/ringtone_datashare_stub_impl.cpp
new file mode 100644
index 0000000..800115a
--- /dev/null
+++ b/services/ringtone_data_extension/src/ringtone_datashare_stub_impl.cpp
@@ -0,0 +1,242 @@
+/*
+ * Copyright (c) 2024 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.
+ */
+#define MLOG_TAG "Extension"
+
+#include "ringtone_datashare_stub_impl.h"
+
+#include "ringtone_log.h"
+
+namespace OHOS {
+namespace DataShare {
+std::shared_ptr RingtoneDataShareStubImpl::GetOwner()
+{
+ return extension_;
+}
+
+std::vector RingtoneDataShareStubImpl::GetFileTypes(const Uri &uri, const std::string &mimeTypeFilter)
+{
+ RINGTONE_INFO_LOG("begin.");
+ std::vector ret;
+ auto client = sptr(this);
+ auto extension = client->GetOwner();
+ if (extension == nullptr) {
+ RINGTONE_ERR_LOG("end failed.");
+ return ret;
+ }
+ ret = extension->GetFileTypes(uri, mimeTypeFilter);
+ RINGTONE_INFO_LOG("end successfully.");
+ return ret;
+}
+
+int RingtoneDataShareStubImpl::OpenFile(const Uri &uri, const std::string &mode)
+{
+ int ret = -1;
+ auto client = sptr(this);
+ auto extension = client->GetOwner();
+ if (extension == nullptr) {
+ RINGTONE_ERR_LOG("end failed.");
+ return ret;
+ }
+ ret = extension->OpenFile(uri, mode);
+ return ret;
+}
+
+int RingtoneDataShareStubImpl::OpenRawFile(const Uri &uri, const std::string &mode)
+{
+ RINGTONE_INFO_LOG("begin.");
+ int ret = -1;
+ auto client = sptr(this);
+ auto extension = client->GetOwner();
+ if (extension == nullptr) {
+ RINGTONE_ERR_LOG("end failed.");
+ return ret;
+ }
+ ret = extension->OpenRawFile(uri, mode);
+ RINGTONE_INFO_LOG("end successfully. ret: %{public}d", ret);
+ return ret;
+}
+
+int RingtoneDataShareStubImpl::Insert(const Uri &uri, const DataShareValuesBucket &value)
+{
+ int ret = 0;
+ auto client = sptr(this);
+ auto extension = client->GetOwner();
+ if (extension == nullptr) {
+ RINGTONE_ERR_LOG("end failed.");
+ return ret;
+ }
+ ret = extension->Insert(uri, value);
+ return ret;
+}
+
+int RingtoneDataShareStubImpl::InsertExt(const Uri &uri, const DataShareValuesBucket &value, std::string &result)
+{
+ int ret = 0;
+ auto client = sptr(this);
+ auto extension = client->GetOwner();
+ if (extension == nullptr) {
+ RINGTONE_ERR_LOG("end failed.");
+ return ret;
+ }
+ ret = extension->InsertExt(uri, value, result);
+ return ret;
+}
+
+int RingtoneDataShareStubImpl::Update(const Uri &uri, const DataSharePredicates &predicates,
+ const DataShareValuesBucket &value)
+{
+ int ret = 0;
+ auto client = sptr(this);
+ auto extension = client->GetOwner();
+ if (extension == nullptr) {
+ RINGTONE_ERR_LOG("end failed.");
+ return ret;
+ }
+ ret = extension->Update(uri, predicates, value);
+ return ret;
+}
+
+int RingtoneDataShareStubImpl::Delete(const Uri &uri, const DataSharePredicates &predicates)
+{
+ int ret = 0;
+ auto client = sptr(this);
+ auto extension = client->GetOwner();
+ if (extension == nullptr) {
+ RINGTONE_ERR_LOG("end failed.");
+ return ret;
+ }
+ ret = extension->Delete(uri, predicates);
+ return ret;
+}
+
+std::shared_ptr RingtoneDataShareStubImpl::Query(const Uri &uri,
+ const DataSharePredicates &predicates, std::vector &columns, DatashareBusinessError &businessError)
+{
+ auto client = sptr(this);
+ auto extension = client->GetOwner();
+ if (extension == nullptr) {
+ RINGTONE_ERR_LOG("end failed.");
+ return nullptr;
+ }
+ return extension->Query(uri, predicates, columns, businessError);
+}
+
+std::string RingtoneDataShareStubImpl::GetType(const Uri &uri)
+{
+ RINGTONE_INFO_LOG("begin.");
+ std::string ret = "";
+ auto client = sptr(this);
+ auto extension = client->GetOwner();
+ if (extension == nullptr) {
+ RINGTONE_ERR_LOG("end failed.");
+ return ret;
+ }
+ ret = extension->GetType(uri);
+ RINGTONE_INFO_LOG("end successfully.");
+ return ret;
+}
+
+int RingtoneDataShareStubImpl::BatchInsert(const Uri &uri, const std::vector &values)
+{
+ RINGTONE_INFO_LOG("begin.");
+ int ret = 0;
+ auto client = sptr(this);
+ auto extension = client->GetOwner();
+ if (extension == nullptr) {
+ RINGTONE_ERR_LOG("end failed.");
+ return ret;
+ }
+ ret = extension->BatchInsert(uri, values);
+ RINGTONE_INFO_LOG("end successfully.");
+ return ret;
+}
+
+bool RingtoneDataShareStubImpl::RegisterObserver(const Uri &uri, const sptr &dataObserver)
+{
+ RINGTONE_INFO_LOG("begin.");
+ bool ret = false;
+ auto client = sptr(this);
+ auto extension = client->GetOwner();
+ if (extension == nullptr) {
+ RINGTONE_ERR_LOG("end failed.");
+ return ret;
+ }
+ ret = extension->RegisterObserver(uri, dataObserver);
+ RINGTONE_INFO_LOG("end successfully. ret: %{public}d", ret);
+ return ret;
+}
+
+bool RingtoneDataShareStubImpl::UnregisterObserver(const Uri &uri,
+ const sptr &dataObserver)
+{
+ RINGTONE_INFO_LOG("begin.");
+ bool ret = false;
+ auto client = sptr(this);
+ auto extension = client->GetOwner();
+ if (extension == nullptr) {
+ RINGTONE_ERR_LOG("end failed.");
+ return ret;
+ }
+ ret = extension->UnregisterObserver(uri, dataObserver);
+ RINGTONE_INFO_LOG("end successfully. ret: %{public}d", ret);
+ return ret;
+}
+
+bool RingtoneDataShareStubImpl::NotifyChange(const Uri &uri)
+{
+ RINGTONE_INFO_LOG("begin.");
+ bool ret = false;
+ auto client = sptr(this);
+ auto extension = client->GetOwner();
+ if (extension == nullptr) {
+ RINGTONE_ERR_LOG("end failed.");
+ return ret;
+ }
+ ret = extension->NotifyChange(uri);
+ RINGTONE_INFO_LOG("end successfully. ret: %{public}d", ret);
+ return ret;
+}
+
+Uri RingtoneDataShareStubImpl::NormalizeUri(const Uri &uri)
+{
+ RINGTONE_INFO_LOG("begin.");
+ Uri urivalue("");
+ auto client = sptr(this);
+ auto extension = client->GetOwner();
+ if (extension == nullptr) {
+ RINGTONE_ERR_LOG("end failed.");
+ return urivalue;
+ }
+ urivalue = extension->NormalizeUri(uri);
+ RINGTONE_INFO_LOG("end successfully.");
+ return urivalue;
+}
+
+Uri RingtoneDataShareStubImpl::DenormalizeUri(const Uri &uri)
+{
+ RINGTONE_INFO_LOG("begin.");
+ Uri urivalue("");
+ auto client = sptr(this);
+ auto extension = client->GetOwner();
+ if (extension == nullptr) {
+ RINGTONE_ERR_LOG("end failed.");
+ return urivalue;
+ }
+ urivalue = extension->DenormalizeUri(uri);
+ RINGTONE_INFO_LOG("end successfully.");
+ return urivalue;
+}
+} // namespace DataShare
+} // namespace OHOS
diff --git a/services/ringtone_data_extension/src/ringtone_rdbstore.cpp b/services/ringtone_data_extension/src/ringtone_rdbstore.cpp
new file mode 100644
index 0000000..1fa1195
--- /dev/null
+++ b/services/ringtone_data_extension/src/ringtone_rdbstore.cpp
@@ -0,0 +1,327 @@
+/*
+ * Copyright (C) 2024 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.
+ */
+#define MLOG_TAG "RdbStore"
+
+#include "ringtone_rdbstore.h"
+
+#include
+
+#include "rdb_sql_utils.h"
+#include "ringtone_errno.h"
+#include "ringtone_log.h"
+#include "ringtone_tracer.h"
+
+using namespace std;
+using namespace OHOS::NativeRdb;
+namespace OHOS::Media {
+static const mode_t MODE_RWX_USR_GRP = 02771;
+const std::string CREATE_RINGTONE_TABLE = "CREATE TABLE IF NOT EXISTS " + RINGTONE_TABLE + "(" +
+ RINGTONE_COLUMN_TONE_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
+ RINGTONE_COLUMN_DATA + " TEXT , " +
+ RINGTONE_COLUMN_SIZE + " BIGINT DEFAULT 0, " +
+ RINGTONE_COLUMN_DISPLAY_NAME + " TEXT , " +
+ RINGTONE_COLUMN_TITLE + " TEXT , " +
+ RINGTONE_COLUMN_MEDIA_TYPE + " INT DEFAULT 0, " +
+ RINGTONE_COLUMN_TONE_TYPE + " INT DEFAULT 0, " +
+ RINGTONE_COLUMN_MIME_TYPE + " TEXT , " +
+ RINGTONE_COLUMN_SOURCE_TYPE + " INT DEFAULT 0, " +
+ RINGTONE_COLUMN_DATE_ADDED + " BIGINT DEFAULT 0, " +
+ RINGTONE_COLUMN_DATE_MODIFIED + " BIGINT DEFAULT 0, " +
+ RINGTONE_COLUMN_DATE_TAKEN + " BIGINT DEFAULT 0, " +
+ RINGTONE_COLUMN_DURATION + " INT DEFAULT 0, " +
+ RINGTONE_COLUMN_SHOT_TONE_TYPE + " INT DEFAULT 0, " +
+ RINGTONE_COLUMN_SHOT_TONE_SOURCE_TYPE + " INT DEFAULT 0, " +
+ RINGTONE_COLUMN_NOTIFICATION_TONE_TYPE + " INT DEFAULT 0, " +
+ RINGTONE_COLUMN_NOTIFICATION_TONE_SOURCE_TYPE + " INT DEFAULT 0, " +
+ RINGTONE_COLUMN_RING_TONE_TYPE + " INT DEFAULT 0, " +
+ RINGTONE_COLUMN_RING_TONE_SOURCE_TYPE + " INT DEFAULT 0, " +
+ RINGTONE_COLUMN_ALARM_TONE_TYPE + " INT DEFAULT 0, " +
+ RINGTONE_COLUMN_ALARM_TONE_SOURCE_TYPE + " INT DEFAULT 0 " + ")";
+
+shared_ptr RingtoneRdbStore::rdbStore_;
+
+static const vector g_initSqls = {
+ CREATE_RINGTONE_TABLE,
+};
+
+int32_t RingtoneDataCallBack::MkdirRecursive(const string &path, size_t start)
+{
+ RINGTONE_DEBUG_LOG("start pos %{public}zu", start);
+ size_t end = path.find("/", start + 1);
+
+ string subDir = "";
+ if (end == std::string::npos) {
+ if (start + 1 == path.size()) {
+ RINGTONE_DEBUG_LOG("path size=%d", path.size());
+ } else {
+ subDir = path.substr(start + 1, path.size() - start - 1);
+ }
+ } else {
+ subDir = path.substr(start + 1, end - start - 1);
+ }
+
+ if (subDir.size() == 0) {
+ return NativeRdb::E_OK;
+ } else {
+ string real = path.substr(0, start + subDir.size() + 1);
+ mode_t mask = umask(0);
+ int result = mkdir(real.c_str(), MODE_RWX_USR_GRP);
+ if (result == 0) {
+ RINGTONE_INFO_LOG("mkdir %{public}s successfully", real.c_str());
+ } else {
+ RINGTONE_INFO_LOG("mkdir %{public}s failed, errno is %{public}d", real.c_str(), errno);
+ }
+ umask(mask);
+ }
+ if (end == std::string::npos) {
+ return NativeRdb::E_OK;
+ }
+
+ return MkdirRecursive(path, end);
+}
+
+int32_t RingtoneDataCallBack::CreatePreloadFolder(const string &path)
+{
+ RINGTONE_DEBUG_LOG("start");
+ if (access(path.c_str(), F_OK) == 0) {
+ RINGTONE_INFO_LOG("dir is existing");
+ return NativeRdb::E_OK;
+ }
+
+ auto start = path.find(RINGTONE_CUSTOMIZED_BASE_PATH);
+ if (start == string::npos) {
+ RINGTONE_ERR_LOG("base dir is wrong");
+ return NativeRdb::E_ERROR;
+ }
+
+ return MkdirRecursive(path, start + RINGTONE_CUSTOMIZED_BASE_PATH.size());
+}
+
+int32_t RingtoneDataCallBack::PrepareDir()
+{
+ static const vector userPreloadDirs = {
+ { RINGTONE_CUSTOMIZED_ALARM }, { RINGTONE_CUSTOMIZED_RINGTONE }, { RINGTONE_CUSTOMIZED_NOTIFICATIONS }
+ };
+
+ for (const auto &dir: userPreloadDirs) {
+ if (CreatePreloadFolder(dir) != NativeRdb::E_OK) {
+ RINGTONE_INFO_LOG("scan failed on dir %{public}s", dir.c_str());
+ continue;
+ }
+ }
+ return NativeRdb::E_OK;
+}
+
+int32_t RingtoneDataCallBack::InitSql(RdbStore &store)
+{
+ for (const string &sqlStr : g_initSqls) {
+ if (store.ExecuteSql(sqlStr) != NativeRdb::E_OK) {
+ RINGTONE_ERR_LOG("Failed to execute sql");
+ return NativeRdb::E_ERROR;
+ }
+ }
+ return NativeRdb::E_OK;
+}
+
+int32_t RingtoneDataCallBack::OnCreate(RdbStore &store)
+{
+ if (InitSql(store) != NativeRdb::E_OK) {
+ RINGTONE_DEBUG_LOG("error");
+ return NativeRdb::E_ERROR;
+ }
+
+ if (PrepareDir() != NativeRdb::E_OK) {
+ RINGTONE_DEBUG_LOG("Prepare dir error");
+ return NativeRdb::E_ERROR;
+ }
+ return NativeRdb::E_OK;
+}
+
+int32_t RingtoneDataCallBack::OnUpgrade(RdbStore &store, int32_t oldVersion, int32_t newVersion)
+{
+ RINGTONE_DEBUG_LOG("OnUpgrade old:%d, new:%d", oldVersion, newVersion);
+
+ return NativeRdb::E_OK;
+}
+RingtoneUnistore *RingtoneRdbStore::GetInstance(const std::shared_ptr &context)
+{
+ static RingtoneRdbStore *instance = nullptr;
+ if (instance == nullptr && context == nullptr) {
+ RINGTONE_ERR_LOG("RingtoneRdbStore is not initialized");
+ return nullptr;
+ }
+ if (instance == nullptr) {
+ instance = new RingtoneRdbStore(context);
+ if (instance->Init() != 0) {
+ RINGTONE_ERR_LOG("init RingtoneRdbStore failed");
+ delete instance;
+ instance = nullptr;
+ return nullptr;
+ }
+ }
+ return instance;
+}
+
+RingtoneRdbStore::RingtoneRdbStore(const shared_ptr &context)
+{
+ if (context == nullptr) {
+ RINGTONE_ERR_LOG("Failed to get context");
+ return;
+ }
+ string databaseDir = context->GetDatabaseDir();
+ string name = RINGTONE_COLUMN_DATA_ABILITY_DB_NAME;
+ int32_t errCode = 0;
+ string realPath = RdbSqlUtils::GetDefaultDatabasePath(databaseDir, name, errCode);
+ config_.SetName(move(name));
+ config_.SetPath(move(realPath));
+ config_.SetBundleName(context->GetBundleName());
+ config_.SetArea(context->GetArea());
+ config_.SetSecurityLevel(SecurityLevel::S3);
+}
+
+int32_t RingtoneRdbStore::Init()
+{
+ RINGTONE_INFO_LOG("Init rdb store");
+ if (rdbStore_ != nullptr) {
+ return E_OK;
+ }
+
+ int32_t errCode = 0;
+ RingtoneDataCallBack rdbDataCallBack;
+ rdbStore_ = RdbHelper::GetRdbStore(config_, RINGTONE_RDB_VERSION, rdbDataCallBack, errCode);
+ if (rdbStore_ == nullptr) {
+ RINGTONE_ERR_LOG("GetRdbStore is failed , errCode=%{public}d", errCode);
+ return E_ERR;
+ }
+ RINGTONE_INFO_LOG("SUCCESS");
+ return E_OK;
+}
+
+RingtoneRdbStore::~RingtoneRdbStore() = default;
+
+void RingtoneRdbStore::Stop()
+{
+ if (rdbStore_ == nullptr) {
+ return;
+ }
+
+ rdbStore_ = nullptr;
+}
+
+int32_t RingtoneRdbStore::Insert(RingtoneDataCommand &cmd, int64_t &rowId)
+{
+ RingtoneTracer tracer;
+ tracer.Start("RingtoneRdbStore::Insert");
+ if (rdbStore_ == nullptr) {
+ RINGTONE_ERR_LOG("Pointer rdbStore_ is nullptr. Maybe it didn't init successfully.");
+ return E_HAS_DB_ERROR;
+ }
+
+ int32_t ret = rdbStore_->Insert(rowId, cmd.GetTableName(), cmd.GetValueBucket());
+ if (ret != NativeRdb::E_OK) {
+ RINGTONE_ERR_LOG("rdbStore_->Insert failed, ret = %{public}d", ret);
+ return E_HAS_DB_ERROR;
+ }
+
+ RINGTONE_DEBUG_LOG("rdbStore_->Insert end, rowId = %d, ret = %{public}d", (int)rowId, ret);
+ return ret;
+}
+
+int32_t RingtoneRdbStore::Delete(RingtoneDataCommand &cmd, int32_t &deletedRows)
+{
+ if (rdbStore_ == nullptr) {
+ RINGTONE_ERR_LOG("Pointer rdbStore_ is nullptr. Maybe it didn't init successfully.");
+ return E_HAS_DB_ERROR;
+ }
+ RingtoneTracer tracer;
+ tracer.Start("RdbStore->DeleteByCmd");
+
+ auto predicates = cmd.GetAbsRdbPredicates();
+ int32_t ret = rdbStore_->Delete(deletedRows, cmd.GetTableName(), predicates->GetWhereClause(),
+ predicates->GetWhereArgs());
+ if (ret != NativeRdb::E_OK) {
+ RINGTONE_ERR_LOG("rdbStore_->Delete failed, ret = %{public}d", ret);
+ return E_HAS_DB_ERROR;
+ }
+ return ret;
+}
+
+int32_t RingtoneRdbStore::Update(RingtoneDataCommand &cmd, int32_t &changedRows)
+{
+ if (rdbStore_ == nullptr) {
+ RINGTONE_ERR_LOG("rdbStore_ is nullptr");
+ return E_HAS_DB_ERROR;
+ }
+
+ RingtoneTracer tracer;
+ tracer.Start("RdbStore->UpdateByCmd");
+ int32_t ret = rdbStore_->Update(changedRows, cmd.GetTableName(), cmd.GetValueBucket(),
+ cmd.GetAbsRdbPredicates()->GetWhereClause(), cmd.GetAbsRdbPredicates()->GetWhereArgs());
+ if (ret != NativeRdb::E_OK) {
+ RINGTONE_ERR_LOG("rdbStore_->Update failed, ret = %{public}d", ret);
+ return E_HAS_DB_ERROR;
+ }
+ return ret;
+}
+
+shared_ptr RingtoneRdbStore::Query(RingtoneDataCommand &cmd,
+ const vector &columns)
+{
+ if (rdbStore_ == nullptr) {
+ RINGTONE_ERR_LOG("rdbStore_ is nullptr");
+ return nullptr;
+ }
+
+ RingtoneTracer tracer;
+ tracer.Start("RdbStore->QueryByCmd");
+
+ auto resultSet = rdbStore_->Query(*cmd.GetAbsRdbPredicates(), columns);
+ return resultSet;
+}
+
+int32_t RingtoneRdbStore::ExecuteSql(const string &sql)
+{
+ if (rdbStore_ == nullptr) {
+ RINGTONE_ERR_LOG("Pointer rdbStore_ is nullptr. Maybe it didn't init successfully.");
+ return E_HAS_DB_ERROR;
+ }
+ RingtoneTracer tracer;
+ tracer.Start("RdbStore->ExecuteSql");
+ int32_t ret = rdbStore_->ExecuteSql(sql);
+ if (ret != NativeRdb::E_OK) {
+ RINGTONE_ERR_LOG("rdbStore_->ExecuteSql failed, ret = %{public}d", ret);
+ return E_HAS_DB_ERROR;
+ }
+ return ret;
+}
+
+shared_ptr RingtoneRdbStore::QuerySql(const string &sql, const vector &selectionArgs)
+{
+ if (rdbStore_ == nullptr) {
+ RINGTONE_ERR_LOG("Pointer rdbStore_ is nullptr. Maybe it didn't init successfully.");
+ return nullptr;
+ }
+
+ RingtoneTracer tracer;
+ tracer.Start("RdbStore->QuerySql");
+ auto resultSet = rdbStore_->QuerySql(sql, selectionArgs);
+ return resultSet;
+}
+
+shared_ptr RingtoneRdbStore::GetRaw()
+{
+ return rdbStore_;
+}
+} // namespace OHOS::Media
diff --git a/services/ringtone_data_extension/src/ringtone_subscriber.cpp b/services/ringtone_data_extension/src/ringtone_subscriber.cpp
new file mode 100644
index 0000000..f57e8d2
--- /dev/null
+++ b/services/ringtone_data_extension/src/ringtone_subscriber.cpp
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2024 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.
+ */
+#define MLOG_TAG "Subscribe"
+
+#include "ringtone_subscriber.h"
+
+#include "common_event_support.h"
+#include "ringtone_log.h"
+
+using namespace OHOS::AAFwk;
+
+namespace OHOS {
+namespace Media {
+const std::vector RingtoneSubscriber::events_ = {
+ EventFwk::CommonEventSupport::COMMON_EVENT_CHARGING,
+ EventFwk::CommonEventSupport::COMMON_EVENT_DISCHARGING,
+ EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_OFF,
+ EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_ON,
+ EventFwk::CommonEventSupport::COMMON_EVENT_PACKAGE_REMOVED,
+ EventFwk::CommonEventSupport::COMMON_EVENT_BOOT_COMPLETED
+};
+
+RingtoneSubscriber::RingtoneSubscriber(const EventFwk::CommonEventSubscribeInfo &subscriberInfo)
+ : EventFwk::CommonEventSubscriber(subscriberInfo)
+{
+}
+
+bool RingtoneSubscriber::Subscribe(void)
+{
+ EventFwk::MatchingSkills matchingSkills;
+ for (auto event : events_) {
+ matchingSkills.AddEvent(event);
+ }
+ EventFwk::CommonEventSubscribeInfo subscribeInfo(matchingSkills);
+
+ std::shared_ptr subscriber = std::make_shared(subscribeInfo);
+ return EventFwk::CommonEventManager::SubscribeCommonEvent(subscriber);
+}
+
+void RingtoneSubscriber::OnReceiveEvent(const EventFwk::CommonEventData &eventData)
+{
+ const AAFwk::Want &want = eventData.GetWant();
+ std::string action = want.GetAction();
+ RINGTONE_INFO_LOG("OnReceiveEvent action:%{public}s.", action.c_str());
+ if (action.compare(EventFwk::CommonEventSupport::COMMON_EVENT_BOOT_COMPLETED) == 0) {
+ RINGTONE_INFO_LOG("recieve boot complete event.");
+ }
+}
+} // namespace Media
+} // namespace OHOS
diff --git a/services/ringtone_helper/BUILD.gn b/services/ringtone_helper/BUILD.gn
new file mode 100644
index 0000000..942ab51
--- /dev/null
+++ b/services/ringtone_helper/BUILD.gn
@@ -0,0 +1,80 @@
+# Copyright (C) 2024 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.gni")
+import("//foundation/multimedia/ringtone_library/ringtone_library.gni")
+
+config("ringtone_helper_public_config") {
+ visibility = [ ":*" ]
+}
+
+ohos_shared_library("ringtone_data_helper") {
+ install_enable = true
+
+ include_dirs = [
+ "${RINGTONE_SCANNER_PATH}/include",
+ "${RINGTONE_BACKUP_PATH}/include",
+ "${RINGTONE_EXTENSION_PATH}/include",
+ "${RINGTONE_DFX_PATH}/include",
+ "${RINGTONE_SERVICES_PATH}/utils/include",
+ "${RINGTONE_INTERFACES_PATH}/inner_api/native",
+ "${RINGTONE_HELPER_PATH}/include",
+ ]
+
+ sources = [
+ "src/ringtone_asset.cpp",
+ "src/ringtone_fetch_result.cpp",
+ ]
+
+ public_configs = [ ":ringtone_helper_public_config" ]
+
+ cflags = [
+ "-Wall",
+ "-Werror",
+ "-Wno-unused-but-set-variable",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-Os",
+ ]
+
+ cflags_cc = [ "-Os" ]
+
+ external_deps = [
+ "ability_base:zuri",
+ "ability_runtime:abilitykit_native",
+ "app_file_service:sandbox_helper_native",
+ "c_utils:utils",
+ "common_event_service:cesfwk_innerkits",
+ "data_share:datashare_common",
+ "data_share:datashare_consumer",
+ "hilog:libhilog",
+ "hitrace:hitrace_meter",
+ "kv_store:distributeddata_inner",
+ "relational_store:native_rdb",
+ ]
+
+ if (!ringtone_link_opt) {
+ sanitize = {
+ cfi = true
+ cfi_cross_dso = true
+ debug = false
+ integer_overflow = true
+ ubsan = true
+ boundary_sanitize = true
+ stack_protector_ret = true
+ }
+ }
+
+ subsystem_name = "multimedia"
+ part_name = "ringtone_library"
+}
diff --git a/services/ringtone_helper/include/ringtone_asset.h b/services/ringtone_helper/include/ringtone_asset.h
new file mode 100644
index 0000000..48359b2
--- /dev/null
+++ b/services/ringtone_helper/include/ringtone_asset.h
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2024 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 RINGTONE_ASSET_H
+#define RINGTONE_ASSET_H
+
+#include
+#include
+
+namespace OHOS {
+namespace Media {
+#define EXPORT __attribute__ ((visibility ("default")))
+
+class RingtoneAsset {
+public:
+ EXPORT RingtoneAsset();
+ EXPORT virtual ~RingtoneAsset() = default;
+
+ EXPORT int32_t GetId() const;
+ EXPORT void SetId(int32_t id);
+
+ EXPORT int64_t GetSize() const;
+ EXPORT void SetSize(int64_t size);
+
+ EXPORT const std::string &GetPath() const;
+ EXPORT void SetPath(const std::string &path);
+
+ EXPORT const std::string &GetDisplayName() const;
+ EXPORT void SetDisplayName(const std::string &displayName);
+
+ EXPORT const std::string &GetTitle() const;
+ EXPORT void SetTitle(const std::string &title);
+
+ EXPORT const std::string &GetMimeType() const;
+ EXPORT void SetMimeType(const std::string &mimeType);
+
+ EXPORT int32_t GetSourceType() const;
+ EXPORT void SetSourceType(int32_t type);
+
+ EXPORT int64_t GetDateAdded() const;
+ EXPORT void SetDateAdded(int64_t dateAdded);
+
+ EXPORT int64_t GetDateModified() const;
+ EXPORT void SetDateModified(int64_t dateModified);
+
+ EXPORT int64_t GetDateTaken() const;
+ EXPORT void SetDateTaken(int64_t dateTaken);
+
+ EXPORT int32_t GetDuration() const;
+ EXPORT void SetDuration(int32_t duration);
+
+ EXPORT int32_t GetShottoneType() const;
+ EXPORT void SetShottoneType(int32_t type);
+
+ EXPORT int32_t GetShottoneSourceType() const;
+ EXPORT void SetShottoneSourceType(int32_t type);
+
+ EXPORT int32_t GetNotificationtoneType() const;
+ EXPORT void SetNotificationtoneType(int32_t type);
+
+ EXPORT int32_t GetNotificationtoneSourceType() const;
+ EXPORT void SetNotificationtoneSourceType(int32_t type);
+
+ EXPORT int32_t GetRingtoneType() const;
+ EXPORT void SetRingtoneType(int32_t type);
+
+ EXPORT int32_t GetRingtoneSourceType() const;
+ EXPORT void SetRingtoneSourceType(int32_t type);
+
+ EXPORT int32_t GetAlarmtoneType() const;
+ EXPORT void SetAlarmtoneType(int32_t type);
+
+ EXPORT int32_t GetAlarmtoneSourceType() const;
+ EXPORT void SetAlarmtoneSourceType(int32_t type);
+
+ EXPORT void SetOpenStatus(int32_t fd, int32_t openStatus);
+ EXPORT void RemoveOpenStatus(int32_t fd);
+ EXPORT int32_t GetOpenStatus(int32_t fd);
+
+ EXPORT std::unordered_map> &GetMemberMap();
+ EXPORT std::variant &GetMemberValue(const std::string &name);
+
+private:
+ const std::string &GetStrMember(const std::string &name) const;
+ int32_t GetInt32Member(const std::string &name) const;
+ int64_t GetInt64Member(const std::string &name) const;
+
+ std::unordered_map> member_;
+ std::mutex openStatusMapMutex_;
+ std::shared_ptr> openStatusMap_;
+};
+} // namespace Media
+} // namespace OHOS
+
+#endif // RINGTONE_ASSET_H
diff --git a/services/ringtone_helper/include/ringtone_fetch_result.h b/services/ringtone_helper/include/ringtone_fetch_result.h
new file mode 100644
index 0000000..10018fb
--- /dev/null
+++ b/services/ringtone_helper/include/ringtone_fetch_result.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2024 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 RINGTONE_FETCH_RESULT_H
+#define RINGTONE_FETCH_RESULT_H
+
+#include "abs_shared_result_set.h"
+#include "datashare_result_set.h"
+#include "rdb_errno.h"
+#include "ringtone_asset.h"
+#include "ringtone_db_const.h"
+#include "ringtone_type.h"
+
+namespace OHOS {
+namespace Media {
+#define EXPORT __attribute__ ((visibility ("default")))
+/**
+ * @brief Class for returning the data cursor to application.
+ *
+ * @since 1.0
+ * @version 1.0
+ */
+template
+class RingtoneFetchResult {
+public:
+ EXPORT explicit RingtoneFetchResult(const std::shared_ptr &resultset);
+ EXPORT RingtoneFetchResult();
+ EXPORT virtual ~RingtoneFetchResult();
+
+ EXPORT void Close();
+ EXPORT int32_t GetCount();
+ EXPORT bool IsAtLastRow();
+
+ EXPORT std::shared_ptr &GetDataShareResultSet();
+
+ EXPORT std::unique_ptr GetObjectAtPosition(int32_t index);
+ EXPORT std::unique_ptr GetFirstObject();
+ EXPORT std::unique_ptr GetObjectFromRdb(std::shared_ptr &resultSet, int idx);
+ EXPORT std::unique_ptr GetNextObject();
+ EXPORT std::unique_ptr GetLastObject();
+ EXPORT std::unique_ptr GetObject();
+
+private:
+ EXPORT std::unique_ptr GetObject(std::shared_ptr &resultSet);
+ EXPORT std::variant GetRowValFromColumn(std::string columnName,
+ ResultSetDataType dataType, std::shared_ptr &resultSet);
+ std::variant GetValByIndex(int32_t index, ResultSetDataType dataType,
+ std::shared_ptr &resultSet);
+
+ void SetRingtoneAsset(RingtoneAsset *asset, std::shared_ptr &resultSet);
+
+ void GetObjectFromResultSet(RingtoneAsset *asset, std::shared_ptr &resultSet);
+
+ std::shared_ptr resultset_ = nullptr;
+};
+} // namespace Media
+} // namespace OHOS
+
+#endif // INTERFACES_INNERKITS_NATIVE_INCLUDE_FETCH_RESULT_H
diff --git a/services/ringtone_helper/src/ringtone_asset.cpp b/services/ringtone_helper/src/ringtone_asset.cpp
new file mode 100644
index 0000000..c267050
--- /dev/null
+++ b/services/ringtone_helper/src/ringtone_asset.cpp
@@ -0,0 +1,280 @@
+/*
+ * Copyright (C) 2024 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.
+ */
+#define MLOG_TAG "RingtoneAsset"
+
+#include "ringtone_asset.h"
+
+#include "ringtone_db_const.h"
+#include "ringtone_errno.h"
+#include "ringtone_log.h"
+#include "ringtone_type.h"
+
+using namespace std;
+
+namespace OHOS {
+namespace Media {
+RingtoneAsset::RingtoneAsset()
+{
+}
+
+int32_t RingtoneAsset::GetId() const
+{
+ return GetInt32Member(RINGTONE_COLUMN_TONE_ID);
+}
+
+void RingtoneAsset::SetId(int32_t id)
+{
+ member_[RINGTONE_COLUMN_TONE_ID] = id;
+}
+
+int64_t RingtoneAsset::GetSize() const
+{
+ return GetInt64Member(RINGTONE_COLUMN_SIZE);
+}
+
+void RingtoneAsset::SetSize(int64_t size)
+{
+ member_[RINGTONE_COLUMN_SIZE] = size;
+}
+
+const string &RingtoneAsset::GetPath() const
+{
+ return GetStrMember(RINGTONE_COLUMN_DATA);
+}
+
+void RingtoneAsset::SetPath(const string &path)
+{
+ member_[RINGTONE_COLUMN_DATA] = path;
+}
+
+const string &RingtoneAsset::GetDisplayName() const
+{
+ return GetStrMember(RINGTONE_COLUMN_DISPLAY_NAME);
+}
+
+void RingtoneAsset::SetDisplayName(const string &displayName)
+{
+ member_[RINGTONE_COLUMN_DISPLAY_NAME] = displayName;
+}
+
+const string &RingtoneAsset::GetTitle() const
+{
+ return GetStrMember(RINGTONE_COLUMN_TITLE);
+}
+
+void RingtoneAsset::SetTitle(const string &title)
+{
+ member_[RINGTONE_COLUMN_TITLE] = title;
+}
+
+const string &RingtoneAsset::GetMimeType() const
+{
+ return GetStrMember(RINGTONE_COLUMN_MIME_TYPE);
+}
+
+void RingtoneAsset::SetMimeType(const string &mimeType)
+{
+ member_[RINGTONE_COLUMN_MIME_TYPE] = mimeType;
+}
+
+int32_t RingtoneAsset::GetSourceType() const
+{
+ return GetInt32Member(RINGTONE_COLUMN_SOURCE_TYPE);
+}
+
+void RingtoneAsset::SetSourceType(int32_t type)
+{
+ member_[RINGTONE_COLUMN_SOURCE_TYPE] = type;
+}
+
+int64_t RingtoneAsset::GetDateAdded() const
+{
+ return GetInt64Member(RINGTONE_COLUMN_DATE_ADDED);
+}
+
+void RingtoneAsset::SetDateAdded(int64_t dateAdded)
+{
+ member_[RINGTONE_COLUMN_DATE_ADDED] = dateAdded;
+}
+
+int64_t RingtoneAsset::GetDateModified() const
+{
+ return GetInt64Member(RINGTONE_COLUMN_DATE_MODIFIED);
+}
+
+void RingtoneAsset::SetDateModified(int64_t dateModified)
+{
+ member_[RINGTONE_COLUMN_DATE_MODIFIED] = dateModified;
+}
+
+
+int64_t RingtoneAsset::GetDateTaken() const
+{
+ return GetInt64Member(RINGTONE_COLUMN_DATE_TAKEN);
+}
+
+void RingtoneAsset::SetDateTaken(int64_t dataTaken)
+{
+ member_[RINGTONE_COLUMN_DATE_TAKEN] = dataTaken;
+}
+
+int32_t RingtoneAsset::GetDuration() const
+{
+ return GetInt32Member(RINGTONE_COLUMN_DURATION);
+}
+
+void RingtoneAsset::SetDuration(int32_t duration)
+{
+ member_[RINGTONE_COLUMN_DURATION] = duration;
+}
+
+int32_t RingtoneAsset::GetShottoneType() const
+{
+ return GetInt32Member(RINGTONE_COLUMN_SHOT_TONE_TYPE);
+}
+
+void RingtoneAsset::SetShottoneType(int32_t type)
+{
+ member_[RINGTONE_COLUMN_SHOT_TONE_TYPE] = type;
+}
+
+int32_t RingtoneAsset::GetShottoneSourceType() const
+{
+ return GetInt32Member(RINGTONE_COLUMN_SHOT_TONE_SOURCE_TYPE);
+}
+
+void RingtoneAsset::SetShottoneSourceType(int32_t type)
+{
+ member_[RINGTONE_COLUMN_SHOT_TONE_SOURCE_TYPE] = type;
+}
+
+int32_t RingtoneAsset::GetNotificationtoneType() const
+{
+ return GetInt32Member(RINGTONE_COLUMN_NOTIFICATION_TONE_TYPE);
+}
+
+void RingtoneAsset::SetNotificationtoneType(int32_t type)
+{
+ member_[RINGTONE_COLUMN_NOTIFICATION_TONE_TYPE] = type;
+}
+
+int32_t RingtoneAsset::GetNotificationtoneSourceType() const
+{
+ return GetInt32Member(RINGTONE_COLUMN_NOTIFICATION_TONE_SOURCE_TYPE);
+}
+
+void RingtoneAsset::SetNotificationtoneSourceType(int32_t type)
+{
+ member_[RINGTONE_COLUMN_NOTIFICATION_TONE_SOURCE_TYPE] = type;
+}
+
+int32_t RingtoneAsset::GetRingtoneType() const
+{
+ return GetInt32Member(RINGTONE_COLUMN_RING_TONE_TYPE);
+}
+
+void RingtoneAsset::SetRingtoneType(int32_t type)
+{
+ member_[RINGTONE_COLUMN_RING_TONE_TYPE] = type;
+}
+
+int32_t RingtoneAsset::GetRingtoneSourceType() const
+{
+ return GetInt32Member(RINGTONE_COLUMN_RING_TONE_SOURCE_TYPE);
+}
+
+void RingtoneAsset::SetRingtoneSourceType(int32_t type)
+{
+ member_[RINGTONE_COLUMN_RING_TONE_SOURCE_TYPE] = type;
+}
+
+int32_t RingtoneAsset::GetAlarmtoneType() const
+{
+ return GetInt32Member(RINGTONE_COLUMN_ALARM_TONE_TYPE);
+}
+
+void RingtoneAsset::SetAlarmtoneType(int32_t type)
+{
+ member_[RINGTONE_COLUMN_ALARM_TONE_TYPE] = type;
+}
+
+int32_t RingtoneAsset::GetAlarmtoneSourceType() const
+{
+ return GetInt32Member(RINGTONE_COLUMN_ALARM_TONE_SOURCE_TYPE);
+}
+
+void RingtoneAsset::SetAlarmtoneSourceType(int32_t type)
+{
+ member_[RINGTONE_COLUMN_ALARM_TONE_SOURCE_TYPE] = type;
+}
+
+void RingtoneAsset::SetOpenStatus(int32_t fd, int32_t openStatus)
+{
+ lock_guard lock(openStatusMapMutex_);
+ if (openStatusMap_ == nullptr) {
+ openStatusMap_ = make_shared>();
+ }
+ openStatusMap_->insert({fd, openStatus});
+}
+
+void RingtoneAsset::RemoveOpenStatus(int32_t fd)
+{
+ lock_guard lock(openStatusMapMutex_);
+ if (openStatusMap_ == nullptr) {
+ return;
+ }
+ openStatusMap_->erase(fd);
+}
+
+int32_t RingtoneAsset::GetOpenStatus(int32_t fd)
+{
+ lock_guard lock(openStatusMapMutex_);
+ if (openStatusMap_ == nullptr) {
+ return E_INVALID_VALUES;
+ }
+ if (openStatusMap_->find(fd) != openStatusMap_->end()) {
+ return openStatusMap_->at(fd);
+ } else {
+ RINGTONE_ERR_LOG("can not find this fd: [%{public}d]", fd);
+ return E_INVALID_VALUES;
+ }
+}
+
+unordered_map> &RingtoneAsset::GetMemberMap()
+{
+ return member_;
+}
+
+variant &RingtoneAsset::GetMemberValue(const string &name)
+{
+ return member_[name];
+}
+
+const string &RingtoneAsset::GetStrMember(const string &name) const
+{
+ return (member_.count(name) > 0) ? get(member_.at(name)) : DEFAULT_STR;
+}
+
+int32_t RingtoneAsset::GetInt32Member(const string &name) const
+{
+ return (member_.count(name) > 0) ? get(member_.at(name)) : DEFAULT_INT32;
+}
+
+int64_t RingtoneAsset::GetInt64Member(const string &name) const
+{
+ return (member_.count(name) > 0) ? get(member_.at(name)) : DEFAULT_INT64;
+}
+} // namespace Media
+} // namespace OHOS
diff --git a/services/ringtone_helper/src/ringtone_fetch_result.cpp b/services/ringtone_helper/src/ringtone_fetch_result.cpp
new file mode 100644
index 0000000..75d3537
--- /dev/null
+++ b/services/ringtone_helper/src/ringtone_fetch_result.cpp
@@ -0,0 +1,309 @@
+/*
+ * Copyright (C) 2024 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.
+ */
+#define MLOG_TAG "RingtoneFetchResult"
+
+#include "ringtone_fetch_result.h"
+
+#include "ringtone_log.h"
+
+using namespace std;
+
+namespace OHOS {
+namespace Media {
+using ResultTypeMap = unordered_map;
+
+static const ResultTypeMap &GetResultTypeMap()
+{
+ static const ResultTypeMap RESULT_TYPE_MAP = {
+ { RINGTONE_COLUMN_TONE_ID, TYPE_INT32 },
+ { RINGTONE_COLUMN_DATA, TYPE_STRING },
+ { RINGTONE_COLUMN_SIZE, TYPE_INT64 },
+ { RINGTONE_COLUMN_DISPLAY_NAME, TYPE_STRING },
+ { RINGTONE_COLUMN_TITLE, TYPE_STRING },
+ { RINGTONE_COLUMN_MEDIA_TYPE, TYPE_INT32 },
+ { RINGTONE_COLUMN_TONE_TYPE, TYPE_INT32 },
+ { RINGTONE_COLUMN_MIME_TYPE, TYPE_STRING },
+ { RINGTONE_COLUMN_SOURCE_TYPE, TYPE_INT32 },
+ { RINGTONE_COLUMN_DATE_ADDED, TYPE_INT64 },
+ { RINGTONE_COLUMN_DATE_MODIFIED, TYPE_INT64 },
+ { RINGTONE_COLUMN_DATE_TAKEN, TYPE_INT64 },
+ { RINGTONE_COLUMN_DURATION, TYPE_INT32 },
+ { RINGTONE_COLUMN_SHOT_TONE_TYPE, TYPE_INT32 },
+ { RINGTONE_COLUMN_SHOT_TONE_SOURCE_TYPE, TYPE_INT32 },
+ { RINGTONE_COLUMN_NOTIFICATION_TONE_TYPE, TYPE_INT32 },
+ { RINGTONE_COLUMN_NOTIFICATION_TONE_SOURCE_TYPE, TYPE_INT32 },
+ { RINGTONE_COLUMN_RING_TONE_TYPE, TYPE_INT32 },
+ { RINGTONE_COLUMN_RING_TONE_SOURCE_TYPE, TYPE_INT32 },
+ { RINGTONE_COLUMN_ALARM_TONE_TYPE, TYPE_INT32 },
+ { RINGTONE_COLUMN_ALARM_TONE_SOURCE_TYPE, TYPE_INT32 },
+ };
+ return RESULT_TYPE_MAP;
+}
+
+template
+RingtoneFetchResult::RingtoneFetchResult(const shared_ptr &resultset)
+{
+ resultset_ = resultset;
+ GetCount();
+}
+
+template
+// empty constructor napi
+RingtoneFetchResult::RingtoneFetchResult() : resultset_(nullptr)
+{
+}
+
+template
+RingtoneFetchResult::~RingtoneFetchResult()
+{
+ resultset_.reset();
+}
+
+template
+void RingtoneFetchResult::Close()
+{
+ if (resultset_ != nullptr) {
+ resultset_->Close();
+ resultset_ = nullptr;
+ }
+}
+
+template
+int32_t RingtoneFetchResult::GetCount()
+{
+ int32_t count = 0;
+ if (resultset_ == nullptr || resultset_->GetRowCount(count) != NativeRdb::E_OK) {
+ return 0;
+ }
+ return count < 0 ? 0 : count;
+}
+
+template
+shared_ptr &RingtoneFetchResult::GetDataShareResultSet()
+{
+ return resultset_;
+}
+
+template
+unique_ptr RingtoneFetchResult::GetObjectAtPosition(int32_t index)
+{
+ if (resultset_ == nullptr) {
+ RINGTONE_ERR_LOG("rs is null");
+ return nullptr;
+ }
+
+ int32_t count = GetCount();
+ if ((index < 0) || (index > (count - 1))) {
+ RINGTONE_ERR_LOG("index not proper");
+ return nullptr;
+ }
+
+ if (resultset_->GoToRow(index) != 0) {
+ RINGTONE_ERR_LOG("failed to go to row at index pos");
+ return nullptr;
+ }
+
+ return GetObject();
+}
+
+template
+unique_ptr RingtoneFetchResult::GetFirstObject()
+{
+ if ((resultset_ == nullptr) || (resultset_->GoToFirstRow() != 0)) {
+ RINGTONE_DEBUG_LOG("resultset is null|first row failed");
+ return nullptr;
+ }
+
+ return GetObject();
+}
+
+template
+unique_ptr RingtoneFetchResult::GetNextObject()
+{
+ if ((resultset_ == nullptr) || (resultset_->GoToNextRow() != 0)) {
+ RINGTONE_DEBUG_LOG("resultset is null|go to next row failed");
+ return nullptr;
+ }
+
+ return GetObject();
+}
+
+template
+unique_ptr RingtoneFetchResult::GetLastObject()
+{
+ if ((resultset_ == nullptr) || (resultset_->GoToLastRow() != 0)) {
+ RINGTONE_ERR_LOG("resultset is null|go to last row failed");
+ return nullptr;
+ }
+
+ return GetObject();
+}
+
+template
+bool RingtoneFetchResult::IsAtLastRow()
+{
+ if (resultset_ == nullptr) {
+ RINGTONE_ERR_LOG("resultset null");
+ return false;
+ }
+
+ bool retVal = false;
+ resultset_->IsAtLastRow(retVal);
+ return retVal;
+}
+
+variant ReturnDefaultOnError(string errMsg, ResultSetDataType dataType)
+{
+ if (dataType == TYPE_STRING) {
+ return "";
+ } else if (dataType == TYPE_INT64) {
+ return static_cast(0);
+ } else {
+ return 0;
+ }
+}
+
+template
+variant RingtoneFetchResult::GetRowValFromColumn(string columnName,
+ ResultSetDataType dataType, shared_ptr &resultSet)
+{
+ if ((resultset_ == nullptr) && (resultSet == nullptr)) {
+ return ReturnDefaultOnError("Resultset is null", dataType);
+ }
+ int index;
+ int status;
+ if (resultSet) {
+ status = resultSet->GetColumnIndex(columnName, index);
+ } else {
+ status = resultset_->GetColumnIndex(columnName, index);
+ }
+ if (status != NativeRdb::E_OK) {
+ return ReturnDefaultOnError("failed to obtain the index", dataType);
+ }
+ return GetValByIndex(index, dataType, resultSet);
+}
+
+template
+variant RingtoneFetchResult::GetValByIndex(int32_t index,
+ ResultSetDataType dataType, shared_ptr &resultSet)
+{
+ if ((resultset_ == nullptr) && (resultSet == nullptr)) {
+ return ReturnDefaultOnError("Resultset is null", dataType);
+ }
+ variant cellValue;
+ int integerVal = 0;
+ string stringVal = "";
+ int64_t longVal = 0;
+ int status;
+ double doubleVal = 0.0;
+ switch (dataType) {
+ case TYPE_STRING:
+ if (resultSet) {
+ status = resultSet->GetString(index, stringVal);
+ } else {
+ status = resultset_->GetString(index, stringVal);
+ }
+ cellValue = move(stringVal);
+ break;
+ case TYPE_INT32:
+ if (resultSet) {
+ status = resultSet->GetInt(index, integerVal);
+ } else {
+ status = resultset_->GetInt(index, integerVal);
+ }
+ cellValue = integerVal;
+ break;
+ case TYPE_INT64:
+ if (resultSet) {
+ status = resultSet->GetLong(index, longVal);
+ } else {
+ status = resultset_->GetLong(index, longVal);
+ }
+ cellValue = longVal;
+ break;
+ case TYPE_DOUBLE:
+ if (resultSet) {
+ status = resultSet->GetDouble(index, doubleVal);
+ } else {
+ status = resultset_->GetDouble(index, doubleVal);
+ }
+ cellValue = doubleVal;
+ break;
+ default:
+ break;
+ }
+ return cellValue;
+}
+
+template
+void RingtoneFetchResult::SetRingtoneAsset(RingtoneAsset *asset, shared_ptr &resultSet)
+{
+ if ((resultset_ == nullptr) && (resultSet == nullptr)) {
+ RINGTONE_ERR_LOG("SetRingtoneAsset fail, result is nullptr");
+ return;
+ }
+ vector columnNames;
+ if (resultSet != nullptr) {
+ resultSet->GetAllColumnNames(columnNames);
+ } else {
+ resultset_->GetAllColumnNames(columnNames);
+ }
+ int32_t index = -1;
+ auto &map = asset->GetMemberMap();
+ for (const auto &name : columnNames) {
+ index++;
+ if (GetResultTypeMap().count(name) == 0) {
+ continue;
+ }
+ auto memberType = GetResultTypeMap().at(name);
+ map.emplace(move(name), move(GetValByIndex(index, memberType, resultSet)));
+ }
+}
+
+template
+void RingtoneFetchResult::GetObjectFromResultSet(RingtoneAsset *asset, shared_ptr &resultSet)
+{
+ SetRingtoneAsset(asset, resultSet);
+}
+
+template
+unique_ptr RingtoneFetchResult::GetObject(shared_ptr &resultSet)
+{
+ unique_ptr