diff --git a/services/BUILD.gn b/services/BUILD.gn index d0441abdc546527462cf4d61e84de35bdd674661..3c1d8d64442c2108e1af5a1b79fed1cc3e42d7f0 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -16,49 +16,7 @@ import("//build/ohos.gni") import("//foundation/filemanagement/user_file_service/filemanagement_aafwk.gni") group("user_file_managers") { - deps = [ - ":external_file_manager_hap", - ":file_access_service", - ":file_access_service.cfg", - ":file_access_service_profile", - ] -} - -ohos_hap("external_file_manager_hap") { - hap_profile = "file_extension_hap/entry/src/main/module.json" - deps = [ - ":external_file_manager_js_assets", - ":external_file_manager_resources", - ] - publicity_file = "../publicity.xml" - certificate_profile = "signature/fileextension.p7b" - hap_name = "external_file_manager" - subsystem_name = "filemanagement" - part_name = "user_file_service" - module_install_dir = "app/com.ohos.UserFile.ExternalFileManager" -} - -ohos_js_assets("external_file_manager_js_assets") { - hap_profile = "file_extension_hap/entry/src/main/module.json" - ets2abc = true - source_dir = "file_extension_hap/entry/src/main/ets" -} - -ohos_app_scope("external_file_manager_app_profile") { - app_profile = "file_extension_hap/AppScope/app.json" - sources = [ "file_extension_hap/AppScope/resources" ] -} - -ohos_sa_profile("file_access_service_profile") { - sources = [ "5010.json" ] - part_name = "user_file_service" -} - -ohos_prebuilt_etc("file_access_service.cfg") { - source = "file_access_service.cfg" - relative_install_dir = "init" - subsystem_name = "filemanagement" - part_name = "user_file_service" + deps = [":file_access_service"] } config("ability_config") { @@ -80,11 +38,7 @@ config("ability_public_config") { ] } -ohos_resources("external_file_manager_resources") { - sources = [ "file_extension_hap/entry/src/main/resources" ] - deps = [ ":external_file_manager_app_profile" ] - hap_profile = "file_extension_hap/entry/src/main/module.json" -} + idl_gen_interface("IFile_Access_Service_Base") { sources = [ "IFileAccessServiceBase.idl" ] diff --git a/services/file_extension_hap/AppScope/app.json b/services/file_extension_hap/AppScope/app.json index f66b52de63d59eec8c32c91edcfe85f0e46fe08a..7645ac63b66a868d62053bf3309dbf5448d0f7bf 100644 --- a/services/file_extension_hap/AppScope/app.json +++ b/services/file_extension_hap/AppScope/app.json @@ -1,12 +1,10 @@ { "app": { "bundleName": "com.ohos.UserFile.ExternalFileManager", + "vendor": "example", "versionCode": 1000004, "versionName": "1.0.0.4", - "minAPIVersion": 9, - "targetAPIVersion": 9, "icon": "$media:app_icon", - "label": "$string:app_name", - "generateBuildHash": true + "label": "$string:app_name" } } diff --git a/services/file_extension_hap/BUILD.gn b/services/file_extension_hap/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..fe95ffcc818a86677054f2c22b17558a53367967 --- /dev/null +++ b/services/file_extension_hap/BUILD.gn @@ -0,0 +1,93 @@ +# Copyright (c) 2021-2025 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/config/components/idl_tool/idl.gni") +import("//build/ohos.gni") +import("//foundation/filemanagement/user_file_service/filemanagement_aafwk.gni") + +group("user_file_managers") { + deps = [ + ":external_file_manager_hap", + ":file_access_service.cfg", + ":file_access_service_profile", + ] +} + +ohos_app("external_file_manager_hap") { + publicity_file = "../publicity.xml" + certificate_profile = "signature/fileextension.p7b" + hap_name = "external_file_manager" + subsystem_name = "filemanagement" + part_name = "user_file_service" + module_install_dir = "app/com.ohos.UserFile.ExternalFileManager" + sdk_home = "//prebuilts/ohos-sdk/linux" + sdk_type_name = [ "sdk.dir" ] + assemble_type = "assembleHar" + build_level = "module" + build_modules = [ "entry" ] + build_profile = "file_extension_hap/build-profile.json5" + if (defined(sign_hap_py_path)) { + certificate_profile = "//vendor/tools/hap_sign_conf/filemanagement/user_file_service/external_file_manager.p7b" + key_alias = "ExternalFileManager" + private_key_path = "ExternalFileManager" + compatible_version = "9" + } +} + +ohos_js_assets("external_file_manager_js_assets") { + hap_profile = "file_extension_hap/entry/src/main/module.json5" + ets2abc = true + source_dir = "file_extension_hap/entry/src/main/ets" +} + +ohos_app_scope("external_file_manager_app_profile") { + app_profile = "file_extension_hap/AppScope/app.json5" + sources = [ "file_extension_hap/AppScope/resources" ] +} + +ohos_sa_profile("file_access_service_profile") { + sources = [ "5010.json" ] + part_name = "user_file_service" +} + +ohos_prebuilt_etc("file_access_service.cfg") { + source = "file_access_service.cfg" + relative_install_dir = "init" + subsystem_name = "filemanagement" + part_name = "user_file_service" +} + +config("ability_config") { + visibility = [ ":*" ] + include_dirs = [ + "native/file_access_service/include", + "${user_file_service_path}/utils", + "${user_file_service_path}/interfaces/inner_api/file_access/include", + "${user_file_service_path}/frameworks/js/napi/file_access_module", + ] +} + +config("ability_public_config") { + visibility = [ ":*" ] + include_dirs = [ + "native/file_access_service/include", + "${user_file_service_path}/utils", + "${user_file_service_path}/interfaces/kits/js/src/common", + ] +} + +ohos_resources("external_file_manager_resources") { + sources = [ "file_extension_hap/entry/src/main/resources" ] + deps = [ ":external_file_manager_app_profile" ] + hap_profile = "file_extension_hap/entry/src/main/module.json5" +} \ No newline at end of file diff --git a/services/file_extension_hap/build-profile.json5 b/services/file_extension_hap/build-profile.json5 index 8fac20813cb081694e75ab50d19a5faac524c66c..e15d70312925fc9a3bf98232796cff8d749dc9cd 100644 --- a/services/file_extension_hap/build-profile.json5 +++ b/services/file_extension_hap/build-profile.json5 @@ -1,25 +1,26 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ { "app": { - "compileSdkVersion": 9, - "compatibleSdkVersion": 9, + "signingConfigs": [], "products": [ { "name": "default", "signingConfig": "default", + "compatibleSdkVersion": "5.0.1(13)", + "runtimeOS": "HarmonyOS", + "buildOption": { + "strictMode": { + "caseSensitiveCheck": true, + "useNormalizedOHMUrl": true + } + } + } + ], + "buildModeSet": [ + { + "name": "debug", + }, + { + "name": "release" } ] }, diff --git a/services/file_extension_hap/entry/build-profile.json5 b/services/file_extension_hap/entry/build-profile.json5 index d3089f7ba484c6385983234a1f147c161a5d9cdd..3c8e3bd058b31b3d7a11fe0f5c38547914d74de8 100644 --- a/services/file_extension_hap/entry/build-profile.json5 +++ b/services/file_extension_hap/entry/build-profile.json5 @@ -13,12 +13,27 @@ * limitations under the License. */ { - "apiType": 'stageMode', + "apiType": "stageMode", "buildOption": { }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": false, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], "targets": [ { - "name": "default", + "name": "default" } ] -} \ No newline at end of file +}} \ No newline at end of file diff --git a/services/file_extension_hap/entry/hvigorfile.js b/services/file_extension_hap/entry/hvigorfile.ts similarity index 100% rename from services/file_extension_hap/entry/hvigorfile.js rename to services/file_extension_hap/entry/hvigorfile.ts diff --git a/services/file_extension_hap/entry/obfuscation-rules.txt b/services/file_extension_hap/entry/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/services/file_extension_hap/entry/oh-package.json5 b/services/file_extension_hap/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/services/file_extension_hap/entry/src/main/ets/Application/AbilityStage.ts b/services/file_extension_hap/entry/src/main/ets/entryability/Entryability.ets similarity index 73% rename from services/file_extension_hap/entry/src/main/ets/Application/AbilityStage.ts rename to services/file_extension_hap/entry/src/main/ets/entryability/Entryability.ets index 5a874ca608ac451d6a2a568f7be6e257dca96fcf..2d949165cc99acb890e1cbee97c0e04befcde388 100644 --- a/services/file_extension_hap/entry/src/main/ets/Application/AbilityStage.ts +++ b/services/file_extension_hap/entry/src/main/ets/entryability/Entryability.ets @@ -13,8 +13,11 @@ * limitations under the License. */ import AbilityStage from '@ohos.app.ability.AbilityStage'; +import {AbilityConstant, ConfigurationComstant, UIAbility, Want} from '@Kit.ArkUI'; +import {window} from '@Kit.ArkUI'; + +export default class EntryAbility extends UIAbility { + onCreate(want: Want, launchParam: AbilityConstant.launchParam): void { -export default class MyAbilityStage extends AbilityStage { - onCreate(): void { } } \ No newline at end of file diff --git a/services/file_extension_hap/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/services/file_extension_hap/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..0624fe761a0a5e89242255b210bb017ffcabc137 --- /dev/null +++ b/services/file_extension_hap/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {BackupExtensionAbility, BundleVersion} from '@Kit.CoreFileKit'; + + +export default class EntryBackupAbility extends BackupExtensionAbility { + async onBackup() { + + } + async onRestore(bundleVersion:BundleVersion) { + + } +} \ No newline at end of file diff --git a/services/file_extension_hap/entry/src/main/ets/pages/index.ets b/services/file_extension_hap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/services/file_extension_hap/entry/src/main/module.json b/services/file_extension_hap/entry/src/main/module.json5 similarity index 42% rename from services/file_extension_hap/entry/src/main/module.json rename to services/file_extension_hap/entry/src/main/module.json5 index 36f17c61be00e392a4e8a6db402f0ebac5292534..30f387bdb8ba400136ef1dedfa3691aff52681f0 100644 --- a/services/file_extension_hap/entry/src/main/module.json +++ b/services/file_extension_hap/entry/src/main/module.json5 @@ -2,10 +2,9 @@ "module": { "name": "entry", "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:module_desc", "mainElement": "FileExtensionAbility", "deviceTypes": [ - "default", "phone", "tablet", "2in1" @@ -13,15 +12,34 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", - "uiSyntax": "ets", - "abilities": [], + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:layered_image", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], "extensionAbilities": [ { - "srcEntrance": "./ets/FileExtensionAbility/FileExtensionAbility.ts", "name": "FileExtensionAbility", + "srcEntry": "./ets/FileExtensionAbility/FileExtensionAbility.ts", "type": "fileAccess", "uri": "fileAccess://docs", - "visible": true } ], "requestPermissions": [ @@ -29,5 +47,5 @@ "name": "ohos.permission.FILE_ACCESS_MANAGER" } ] - } + } } diff --git a/services/file_extension_hap/entry/src/main/resources/base/element/color.json b/services/file_extension_hap/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/services/file_extension_hap/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/services/file_extension_hap/entry/src/main/resources/base/element/string.json b/services/file_extension_hap/entry/src/main/resources/base/element/string.json index c4e8611bfbd8bb3177924f05e7e22a7ca3dcf5dd..a34afbaa7c8cbaf84f0a4610592624ffa2357522 100644 --- a/services/file_extension_hap/entry/src/main/resources/base/element/string.json +++ b/services/file_extension_hap/entry/src/main/resources/base/element/string.json @@ -1,12 +1,16 @@ { "string": [ { - "name": "entry_desc", + "name": "moudle_desc", + "value": "moudle description" + }, + { + "name": "EntryAbility_desc", "value": "description" }, { - "name": "description_serviceability", - "value": "description_serviceability" + "name": "EntryAbility_label", + "value": "label" } ] } \ No newline at end of file diff --git a/services/file_extension_hap/entry/src/main/resources/base/profile/backup_config.json b/services/file_extension_hap/entry/src/main/resources/base/profile/backup_config.json new file mode 100644 index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a --- /dev/null +++ b/services/file_extension_hap/entry/src/main/resources/base/profile/backup_config.json @@ -0,0 +1,3 @@ +{ + "allowToBackupRestore": true +} \ No newline at end of file diff --git a/services/file_extension_hap/entry/src/main/resources/base/profile/main_pages.json b/services/file_extension_hap/entry/src/main/resources/base/profile/main_pages.json index b12d9e9faa33835d362c73333632d70b7c61328a..55c3f007f87b7ce5206d325f968cc56f2f79441f 100644 --- a/services/file_extension_hap/entry/src/main/resources/base/profile/main_pages.json +++ b/services/file_extension_hap/entry/src/main/resources/base/profile/main_pages.json @@ -1,3 +1,5 @@ { - "src": [] + "src": [ + "pages/Index" + ] } \ No newline at end of file diff --git a/services/file_extension_hap/entry/src/main/resources/dark/color.json b/services/file_extension_hap/entry/src/main/resources/dark/color.json new file mode 100644 index 0000000000000000000000000000000000000000..79b11c2747aec33e710fd3a7b2b3c94dd9965499 --- /dev/null +++ b/services/file_extension_hap/entry/src/main/resources/dark/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#000000" + } + ] +} \ No newline at end of file diff --git a/services/file_extension_hap/hvigor/hvigor-config.json5 b/services/file_extension_hap/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/services/file_extension_hap/hvigor/hvigor-wrapper.js b/services/file_extension_hap/hvigor/hvigor-wrapper.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/services/file_extension_hap/hvigorfile.js b/services/file_extension_hap/hvigorfile.ts similarity index 100% rename from services/file_extension_hap/hvigorfile.js rename to services/file_extension_hap/hvigorfile.ts diff --git a/services/file_extension_hap/oh-package-lock.json5 b/services/file_extension_hap/oh-package-lock.json5 new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/services/file_extension_hap/oh-package.json5 b/services/file_extension_hap/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/services/file_extension_hap/signature/fileextension.p7b b/services/file_extension_hap/signature/fileextension.p7b new file mode 100644 index 0000000000000000000000000000000000000000..49056b5d9a8be74d7d225cb059ba1824e7ade953 Binary files /dev/null and b/services/file_extension_hap/signature/fileextension.p7b differ