diff --git a/LICENSE b/LICENSE
index 4947287f7b5ccb5d1e8b7b2d3aa5d89f322c160d..2bb9ad240fa04c8cf706a4901c4807878e90c2dc 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,3 @@
-
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
diff --git a/README.md b/README.md
deleted file mode 100644
index 1d37300cd840f7d346b5553f06617c2d87cf57ba..0000000000000000000000000000000000000000
--- a/README.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# storage_user_file_manger
-
-#### Description
-{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
-
-#### Software Architecture
-Software architecture description
-
-#### Installation
-
-1. xxxx
-2. xxxx
-3. xxxx
-
-#### Instructions
-
-1. xxxx
-2. xxxx
-3. xxxx
-
-#### Contribution
-
-1. Fork the repository
-2. Create Feat_xxx branch
-3. Commit your code
-4. Create Pull Request
-
-
-#### Gitee Feature
-
-1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
-2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
-3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
-4. The most valuable open source project [GVP](https://gitee.com/gvp)
-5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
-6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
diff --git a/README_zh.md b/README_zh.md
deleted file mode 100644
index 6b659a73f1daa32d97977b92f9359080f57d4a20..0000000000000000000000000000000000000000
--- a/README_zh.md
+++ /dev/null
@@ -1,39 +0,0 @@
-# 公共文件服务
-
-## 简介
-
-公共文件服务提供公共文件访问和管理的服务接口。
-
-公共文件服务中File Manager Service服务向下对接底层文件管理服务,如媒体库、外卡管理。File Manager Service服务向上对接应用提供公共文件查询、创建的能力,如图1。 File Manager Service接口能力当前只对系统应用如文件选择器提供。
-
-支持能力列举如下:
-- 查询、创建公共文件路径下媒体文件。媒体文件包括图片、音频、视频。媒体文件通过相册方式呈现。
-
-- 查询、创建公共文件路径下文档文件。文档文件包括其他文件、外部存储卡内的文件。文件以目录树方式呈现。
-
-**图 1** 公共文件管理架构图
-
-
-## 目录
-
-仓目录结构如下:
-```
-/foundation/storage/user_file_service
-├── figures # 插图文件
-├── serivce # 服务实现
-│ ├── etc # 内部接口实现
-│ ├── src # 内部接口实现
-├── interfaces # 接口代码
-│ ├── innerkits # 内部 Native 接口
-│ └── kits # 外部 JS 接口
-├── BUILD.gn # 编译入口
-└── bundle.json # 部件描述文件
-```
-## 说明
-### 使用说明
-1. 创建文件
- - 提供createFile接口,传入文件名与相册uri进行文件创建。
- - 文件创建成功后,可获得文件uri。应用可通过uri进行文件打开并进行读写操作。
-2. 查询文件
- - 提供listFile接口,传入文件类型、相册uri进行文件查询。
- - 获得相册下文件信息的集合,包括文件名、文件类型、文件大小、文件创建时间等信息。
\ No newline at end of file
diff --git a/bundle.json b/bundle.json
index 95dbc537d0a3d2fcb80f4ae861bdfb655108e715..3ba13c4ebdd866747e8dd726bfce448cd283bc6e 100644
--- a/bundle.json
+++ b/bundle.json
@@ -33,12 +33,11 @@
},
"build": {
"sub_component": [
- "//foundation/filemanagement/user_file_service/services:fms",
- "//foundation/filemanagement/user_file_service/services/sa_profile:filemanager_service_sa_profile",
- "//foundation/filemanagement/user_file_service/interfaces/kits/js:filemanager"
+ "//foundation/filemanagement/user_file_service/frameworks/innerkits:frameworks_innerkits",
+ "//foundation/filemanagement/user_file_service/interfaces/kits/napi/file_access_module:fileaccess",
+ "//foundation/filemanagement/user_file_service/interfaces/kits/napi/file_ext_ability:fileextensionability_napi"
],
"test": [
- "//foundation/filemanagement/user_file_service/services/test:user_file_manager_test"
]
}
}
diff --git a/figures/user_file_manager.png b/figures/user_file_manager.png
deleted file mode 100644
index 597ec2aa841410c412dbe7517a95eed5fe9377f4..0000000000000000000000000000000000000000
Binary files a/figures/user_file_manager.png and /dev/null differ
diff --git a/interfaces/kits/js/BUILD.gn b/frameworks/innerkits/BUILD.gn
similarity index 32%
rename from interfaces/kits/js/BUILD.gn
rename to frameworks/innerkits/BUILD.gn
index bc9b9e5c359a90b04a2ecce5e09cd71e6726dd41..0c10968c00cac66b3a780ff5da09d7cc472ae45f 100644
--- a/interfaces/kits/js/BUILD.gn
+++ b/frameworks/innerkits/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
+# 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
@@ -12,49 +12,47 @@
# limitations under the License.
import("//build/ohos.gni")
-FMS_BASE_DIR = "//foundation/filemanagement/user_file_service/services"
-ohos_shared_library("filemanager") {
+group("frameworks_innerkits") {
+ deps = [
+ ":file_extension_hap",
+ "file_extension:file_extension_ability_kit",
+ "file_extension:file_extension_ability_module",
+ ]
+}
+
+#### file extension hap
+ohos_hap("file_extension_hap") {
+ hap_profile = "file_extension_hap/entry/src/main/module.json"
+ deps = [
+ ":file_extension_js_assets",
+ ":file_extension_resources",
+ ]
+ certificate_profile = "signature/fileextension.p7b"
+ hap_name = "file_extension"
subsystem_name = "filemanagement"
part_name = "user_file_service"
+ module_install_dir = "app/com.ohos.FileExtension"
+}
- relative_install_dir = "module"
+ohos_js_assets("file_extension_js_assets") {
+ hap_profile = "file_extension_hap/entry/src/main/module.json"
+ ets2abc = true
+ source_dir = "file_extension_hap/entry/src/main/ets"
+}
- include_dirs = [
- "//third_party/node/src",
- "//foundation/arkui/napi/interfaces/kits",
- "//utils/native/base/include",
- "//third_party/libuv/include",
- "$FMS_BASE_DIR/include",
- "$FMS_BASE_DIR/src/client",
- "$FMS_BASE_DIR/src/server",
- "$FMS_BASE_DIR/src/fileoper",
- "//foundation/distributeddatamgr/distributedfile/interfaces/kits/js/src/common/napi/n_async",
- "//foundation/distributeddatamgr/distributedfile/interfaces/kits/js/src/common/napi",
- "//foundation/distributeddatamgr/distributedfile/interfaces/kits/js/src/common",
- "//foundation/multimedia/medialibrary_standard/interfaces/inner_api/media_library_helper/include",
- ]
+ohos_app_scope("file_extension_app_profile") {
+ app_profile = "file_extension_hap/AppScope/app.json"
+ sources = [ "file_extension_hap/AppScope/resources" ]
+}
+ohos_resources("file_extension_resources") {
sources = [
- "src/file_manager_napi.cpp",
- "src/module.cpp",
+ "file_extension_hap/entry/src/main/resources",
]
-
deps = [
- "$FMS_BASE_DIR:fms_server",
- "//foundation/arkui/napi:ace_napi",
- "//foundation/distributeddatamgr/distributedfile/interfaces/kits/js:fileio",
- "//foundation/multimedia/medialibrary_standard/frameworks/services/media_library:medialibrary_data_ability",
- "//utils/native/base:utils",
- ]
- cflags = []
- if (target_cpu == "arm") {
- cflags += [ "-DBINDER_IPC_32BIT" ]
- }
- external_deps = [
- "hiviewdfx_hilog_native:libhilog",
- "ipc:ipc_core",
- "safwk:system_ability_fwk",
- "samgr_standard:samgr_proxy",
+ ":file_extension_app_profile",
]
+ hap_profile = "file_extension_hap/entry/src/main/module.json"
}
+#### file extension hap
\ No newline at end of file
diff --git a/services/BUILD.gn b/frameworks/innerkits/file_extension/BUILD.gn
similarity index 31%
rename from services/BUILD.gn
rename to frameworks/innerkits/file_extension/BUILD.gn
index 20af46633e911135823ce79c7370b7227f33c909..aba44d064430e840ce2289a01998b00d4cae28cf 100644
--- a/services/BUILD.gn
+++ b/frameworks/innerkits/file_extension/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Huawei Device Co., Ltd.
+# 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
@@ -12,80 +12,105 @@
# limitations under the License.
import("//build/ohos.gni")
-FMS_BASE_DIR = "//foundation/filemanagement/user_file_service/services"
-group("fms") {
- deps = [
- ":fms_server",
- ":fms_service.cfg",
+BASE_DIR = "//foundation/filemanagement/user_file_service"
+
+config("ability_config") {
+ visibility = [ ":*" ]
+ include_dirs = [
+ "include",
+ "${BASE_DIR}/utils",
+ "//foundation/aafwk/standard/frameworks/kits/appkit/native/app/include",
+ "//foundation/aafwk/standard/services/common/include",
+ "//foundation/aafwk/standard/frameworks/kits/ability/native/include/continuation/distributed",
+ "//foundation/aafwk/standard/frameworks/kits/ability/native/include/continuation/kits",
+ "//foundation/aafwk/standard/interfaces/kits/napi/aafwk/inner/napi_common",
+ "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base/include",
]
-}
-ohos_prebuilt_etc("fms_service.cfg") {
- source = "etc/fms_service.cfg"
- relative_install_dir = "init"
- subsystem_name = "filemanagement"
- part_name = "user_file_service"
+ cflags = []
+ if (target_cpu == "arm") {
+ cflags += [ "-DBINDER_IPC_32BIT" ]
+ }
}
-ohos_shared_library("fms_server") {
- subsystem_name = "filemanagement"
- part_name = "user_file_service"
-
+config("ability_public_config") {
+ visibility = [ ":*" ]
include_dirs = [
- "$FMS_BASE_DIR/include",
- "$FMS_BASE_DIR/src/client",
- "$FMS_BASE_DIR/src/server",
- "$FMS_BASE_DIR/src/fileoper",
- "$FMS_BASE_DIR/include/fileoper",
- "//base/hiviewdfx/hilog/interfaces/native/innerkits/include/hilog",
- "//foundation/filemanagement/storage_service/services/storage_manager/include",
- "//foundation/filemanagement/storage_service/interfaces/innerkits/storage_manager/native",
- "//foundation/aafwk/standard/interfaces/innerkits/base/include/ohos/aafwk/base",
+ "include",
+ "${BASE_DIR}/utils",
+ "//foundation/aafwk/standard/frameworks/kits/appkit/native/ability_runtime/app",
+ "//foundation/aafwk/standard/frameworks/kits/appkit/native/app/include",
+ "//foundation/aafwk/standard/frameworks/kits/appkit/native/ability_runtime/context",
]
+}
+
+ohos_shared_library("file_extension_ability_kit") {
+ include_dirs = []
sources = [
- "src/client/file_manager_proxy.cpp",
- "src/fileoper/ext_storage/ext_storage_subscriber.cpp",
- "src/fileoper/ext_storage/storage_manager_inf.cpp",
- "src/fileoper/external_storage_oper.cpp",
- "src/fileoper/external_storage_utils.cpp",
- "src/fileoper/file_info.cpp",
- "src/fileoper/media_file_oper.cpp",
- "src/fileoper/media_file_utils.cpp",
- "src/fileoper/oper_factory.cpp",
- "src/server/file_manager_service.cpp",
- "src/server/file_manager_service_stub.cpp",
+ "${BASE_DIR}/frameworks/innerkits/file_extension/src/file_access_helper.cpp",
+ "${BASE_DIR}/frameworks/innerkits/file_extension/src/file_ext_ability.cpp",
+ "${BASE_DIR}/frameworks/innerkits/file_extension/src/file_ext_connection.cpp",
+ "${BASE_DIR}/frameworks/innerkits/file_extension/src/file_ext_proxy.cpp",
+ "${BASE_DIR}/frameworks/innerkits/file_extension/src/file_ext_stub_impl.cpp",
+ "${BASE_DIR}/frameworks/innerkits/file_extension/src/file_ext_stub.cpp",
+ "${BASE_DIR}/frameworks/innerkits/file_extension/src/js_file_ext_ability.cpp",
+ ]
+ configs = [ ":ability_config" ]
+ public_configs = [
+ ":ability_public_config",
+ "//foundation/aafwk/standard/frameworks/kits/ability/ability_runtime:ability_context_public_config",
]
deps = [
- "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog",
"//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native",
- "//foundation/aafwk/standard/interfaces/innerkits/base:base",
- "//foundation/aafwk/standard/services/abilitymgr:abilityms",
- "//foundation/filemanagement/storage_service/interfaces/innerkits/storage_manager/native:storage_manager_sa_proxy",
- "//foundation/filemanagement/storage_service/services/storage_manager:storage_manager",
- "//foundation/multimedia/medialibrary_standard/frameworks/innerkitsimpl/media_library_helper:media_library",
- "//foundation/multimedia/medialibrary_standard/frameworks/services/media_library:medialibrary_data_ability",
- "//utils/native/base:utils",
+ "//foundation/aafwk/standard/frameworks/kits/appkit:app_context",
]
- cflags = []
- if (target_cpu == "arm") {
- cflags += [ "-DBINDER_IPC_32BIT" ]
- }
+
external_deps = [
"ability_base:want",
"ability_base:zuri",
+ "ability_runtime:ability_context_native",
"ability_runtime:ability_manager",
+ "ability_runtime:app_manager",
+ "ability_runtime:runtime",
"ability_runtime:wantagent_innerkits",
"access_token:libaccesstoken_sdk",
- "common_event_service:cesfwk_innerkits",
- "hiviewdfx_hilog_native:libhilog",
+ "bytrace_standard:bytrace_core",
"ipc:ipc_core",
- "native_appdatamgr:native_appdatafwk",
- "native_appdatamgr:native_dataability",
- "native_appdatamgr:native_rdb",
- "safwk:system_ability_fwk",
- "samgr_standard:samgr_proxy",
+ "ipc_js:rpc",
+ "permission_standard:libpermissionsdk_standard",
+ "utils_base:utils",
+ ]
+
+ public_deps = [
+ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog",
+ "//foundation/arkui/napi:ace_napi",
+ ]
+
+ subsystem_name = "filemanagement"
+ part_name = "user_file_service"
+}
+
+ohos_shared_library("file_extension_ability_module") {
+ sources = [ "${BASE_DIR}/frameworks/innerkits/file_extension/src/file_ext_ability_module_loader.cpp" ]
+
+ configs = [ ":ability_config" ]
+ public_configs = [ ":ability_public_config" ]
+
+ deps = [
+ ":file_extension_ability_kit",
+ "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native",
]
+
+ external_deps = [
+ "ability_base:want",
+ "ability_runtime:runtime",
+ "hiviewdfx_hilog_native:libhilog",
+ "utils_base:utils",
+ ]
+
+ subsystem_name = "filemanagement"
+ part_name = "user_file_service"
}
diff --git a/frameworks/innerkits/file_extension/include/file_access_helper.h b/frameworks/innerkits/file_extension/include/file_access_helper.h
new file mode 100644
index 0000000000000000000000000000000000000000..a3f7e3cac3a904cebdfe39bf43b019813e20798e
--- /dev/null
+++ b/frameworks/innerkits/file_extension/include/file_access_helper.h
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+
+#ifndef FOUNDATION_APPEXECFWK_OHOS_FILEACCESS_HELPER_H
+#define FOUNDATION_APPEXECFWK_OHOS_FILEACCESS_HELPER_H
+
+#include
+#include