From 6eb55fdc60b7b142001fa739678a58d333ec0701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B0=B8=E5=BF=A0?= Date: Sat, 10 Aug 2024 09:16:35 +0000 Subject: [PATCH 01/12] add ndk for dlp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王永忠 --- DataProtectionKit/ dlp_permission_api.h | 182 +++++++++++++++++++++ DataProtectionKit/BUILD.gn | 28 ++++ DataProtectionKit/libdlpperission.ndk.json | 30 ++++ 3 files changed, 240 insertions(+) create mode 100644 DataProtectionKit/ dlp_permission_api.h create mode 100644 DataProtectionKit/BUILD.gn create mode 100644 DataProtectionKit/libdlpperission.ndk.json diff --git a/DataProtectionKit/ dlp_permission_api.h b/DataProtectionKit/ dlp_permission_api.h new file mode 100644 index 000000000..8e3418a92 --- /dev/null +++ b/DataProtectionKit/ dlp_permission_api.h @@ -0,0 +1,182 @@ +/* + * 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. + */ + +/** + * @addtogroup DlpPermissionApi + * @{ + * + * @brief Provides the capability to access the data loss prevention (DLP) files. + * + * @since 12 + */ + +/** + * @file dlp_permission_api.h + * + * @brief Declares the APIs for accessing the data loss prevention (DLP) files. + * + * @library libohdlp_permission.so + * @kit DataProtectionKit + * @syscap SystemCapability.Security.DataLossPrevention + * @since 12 + */ + +#ifndef DLP_PERMISSION_API_H +#define DLP_PERMISSION_API_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerates the error codes. + * + * @since 12 + */ +typedef enum { + /** The operation is successful. */ + ERR_OH_SUCCESS = 0, + /** Invalid parameter value. */ + ERR_OH_INVALID_PARAMETER = 19100001, + /** No permission to call this API, which is available only for DLP sandbox applications. */ + ERR_OH_API_ONLY_FOR_SANDBOX_ERROR = 19100006, + /** No permission to call this API, which is available only for non-DLP sandbox applications. */ + ERR_OH_API_NOT_FOR_SANDBOX_ERROR = 19100007, + /** The system ability works abnormally. */ + ERR_OH_SYSTEM_SERVICE_EXCEPTION = 19100011, + /** Indicates the memory error. */ + ERR_OH_OUT_OF_MEMORY = 19100012, + /** DisplayName missing in want. */ + ERR_OH_APPLICATION_NOT_AUTHORIZED = 19100018 +} DLP_ErrCode; + +/** + * @brief Enumerates the access permissions for a DLP file. + * + * @since 12 + */ +typedef enum { + /** No permission. */ + NO_PERMISSION = 0, + /** Read-only. */ + READ_ONLY = 1, + /** Edit. */ + CONTENT_EDIT = 2, + /** Full control. */ + FULL_CONTROL = 3 +} DLP_FileAccess; + +/** + * @brief Obtains the permission info of this DLP file. + * + * @param dlpFileAccess - Indicates the access permission for the DLP file + * @param flags - Indicates the actions allowed for the DLP file. + * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. + * {@link DLP_ErrCode#ERR_OH_INVALID_PARAMETER} 19100001 - If the parameter value is invalid. + * {@link DLP_ErrCode#ERR_OH_API_ONLY_FOR_SANDBOX_ERROR} 19100006 - If No permission to + * call this API, which is available only for DLP sandbox applications. + * {@link DLP_ErrCode#ERR_OH_SYSTEM_SERVICE_EXCEPTION} 19100011 - If the system ability + * works abnormally. + * @since 12 + */ +DLP_ErrCode OH_DLP_GetDLPPermissionInfo(DLP_FileAccess *dlpFileAccess, uint32_t *flags); + +/** + * @brief Obtains the original file name from a DLP file name. + * This method removes the DLP file name extension from the DLP file name. + * + * @param fileName - Indicates the DLP file name. + * @param originalFileName - Indicates the original file name obtained. + * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. + * {@link DLP_ErrCode#ERR_OH_INVALID_PARAMS} 19100001 - If the parameter value is invalid. + * @since 12 + */ +DLP_ErrCode OH_DLP_GetOriginalFileName(const char *fileName, char *originalFileName); + +/** + * @brief Obtains the original file name from a DLP file name. + * This method removes the DLP file name extension from the DLP file name. + * + * @param fileName - Indicates the DLP file name. + * @param suffixFileName - Indicates the suffix file name obtained. + * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. + * {@link DLP_ErrCode#ERR_OH_OUT_OF_MEMORY} 19100012 - If the memory error. + * @since 12 + */ +DLP_ErrCode OH_DLP_GetDLPSuffix(char *suffixFileName); + +/** + * @brief Checks whether current application is in the DLP sandbox. This method uses a promise to return the result. + * + * @param isInSandbox - Indicates output parameter; + {@code true} if current application is in a DLP sandbox, {@code false} otherwise. + * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. + * {@link DLP_ErrCode#ERR_OH_SYSTEM_SERVICE_EXCEPTION} 19100011 - If the system ability + * works abnormally. + * {@link DLP_ErrCode#ERR_OH_OUT_OF_MEMORY} 19100012 - If the memory error. + * @since 12 + */ +DLP_ErrCode OH_DLP_IsInSandbox(bool *isInSandbox); + +/** + * @brief Sets sandbox application configuration. This method uses a promise to return the result. + * + * @param configInfo - Configuration of the sandbox application. + * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. + * {@link DLP_ErrCode#ERR_OH_INVALID_PARAMETER} 19100001 - If the parameter value is invalid. + * {@link DLP_ErrCode#ERR_OH_API_NOT_FOR_SANDBOX_ERROR} 19100007 - If No permission to + * call this API, which is available only for non-DLP sandbox applications. + * {@link DLP_ErrCode#ERR_OH_SYSTEM_SERVICE_EXCEPTION} 19100011 - If the system ability + * works abnormally. + * {@link DLP_ErrCode#ERR_OH_APPLICATION_NOT_AUTHORIZED} 19100018 - Not authorized application. + * @since 12 + */ +DLP_ErrCode OH_DLP_SetSandboxAppConfig(const char *configInfo); + +/** + * @brief Obtains sandbox application configuration. This method uses a promise to return the result. + * + * @param configInfo - Configuration of the sandbox application. + * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. + * {@link DLP_ErrCode#ERR_OH_SYSTEM_SERVICE_EXCEPTION} 19100011 - If the system ability + * works abnormally. + * {@link DLP_ErrCode#ERR_OH_OUT_OF_MEMORY} 19100012 - If the memory error. + * {@link DLP_ErrCode#ERR_OH_APPLICATION_NOT_AUTHORIZED} 19100018 - Not authorized application. + * @since 12 + */ +DLP_ErrCode OH_DLP_GetSandboxAppConfig(char *configInfo); + +/** + * @brief Cleans sandbox application configuration. This method uses a promise to return the result. + * + * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. + * {@link DLP_ErrCode#ERR_OH_API_NOT_FOR_SANDBOX_ERROR} 19100007 - If No permission to + * call this API, which is available only for non-DLP sandbox applications. + * {@link DLP_ErrCode#ERR_OH_SYSTEM_SERVICE_EXCEPTION} 19100011 - If the system ability + * works abnormally. + * {@link DLP_ErrCode#ERR_OH_APPLICATION_NOT_AUTHORIZED} 19100018 - Not authorized application. + * @since 12 + */ +DLP_ErrCode OH_DLP_CleanSandboxAppConfig(); + +#ifdef __cplusplus +} +#endif + +/** @} */ +#endif /* DLP_PERMISSION_API_H */ \ No newline at end of file diff --git a/DataProtectionKit/BUILD.gn b/DataProtectionKit/BUILD.gn new file mode 100644 index 000000000..344f9969b --- /dev/null +++ b/DataProtectionKit/BUILD.gn @@ -0,0 +1,28 @@ +# 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("//build/ohos/ndk/ndk.gni") + +ohos_ndk_headers("dlppermission_capi_header") { + dest_dir = "$ndk_headers_out_dir/DataProtectionKit" + sources = [ "./dlp_permission_api.h" ] +} + +ohos_ndk_library("libohdlp_permission") { + output_name = "ohdlp_permission" + output_extension = "so" + ndk_description_file = "./libdlppermission.ndk.json" + system_capability = "SystemCapability.Security.DataLossPrevention" + system_capability_headers = [ "DataProtectionKit/dlp_permission_api.h" ] +} \ No newline at end of file diff --git a/DataProtectionKit/libdlpperission.ndk.json b/DataProtectionKit/libdlpperission.ndk.json new file mode 100644 index 000000000..7860a53d1 --- /dev/null +++ b/DataProtectionKit/libdlpperission.ndk.json @@ -0,0 +1,30 @@ +[ + { + "first_introduced": "12", + "name": "OH_DLP_GetDLPPermissionInfo" + }, + { + "first_introduced": "12", + "name": "OH_DLP_GetOriginalFileName" + }, + { + "first_introduced": "12", + "name": "OH_DLP_GetDLPSuffix" + }, + { + "first_introduced": "12", + "name": "OH_DLP_IsInSandbox" + }, + { + "first_introduced": "12", + "name": "OH_DLP_SetSandboxAppConfig" + }, + { + "first_introduced": "12", + "name": "OH_DLP_GetSandboxAppConfig" + }, + { + "first_introduced": "12", + "name": "OH_DLP_CleanSandboxAppConfig" + } +] \ No newline at end of file -- Gitee From 1162bfb109190af8eb8b1a5a4ccb48ff89f37e1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B0=B8=E5=BF=A0?= Date: Sat, 10 Aug 2024 09:29:54 +0000 Subject: [PATCH 02/12] update DataProtectionKit/ dlp_permission_api.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王永忠 --- DataProtectionKit/ dlp_permission_api.h | 1 + 1 file changed, 1 insertion(+) diff --git a/DataProtectionKit/ dlp_permission_api.h b/DataProtectionKit/ dlp_permission_api.h index 8e3418a92..5fd2c4e6b 100644 --- a/DataProtectionKit/ dlp_permission_api.h +++ b/DataProtectionKit/ dlp_permission_api.h @@ -104,6 +104,7 @@ DLP_ErrCode OH_DLP_GetDLPPermissionInfo(DLP_FileAccess *dlpFileAccess, uint32_t * @param originalFileName - Indicates the original file name obtained. * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. * {@link DLP_ErrCode#ERR_OH_INVALID_PARAMS} 19100001 - If the parameter value is invalid. + * {@link DLP_ErrCode#ERR_OH_OUT_OF_MEMORY} 19100012 - If the memory error. * @since 12 */ DLP_ErrCode OH_DLP_GetOriginalFileName(const char *fileName, char *originalFileName); -- Gitee From aeb5e14f66e1b249af924499a0663e7c6dfb5c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B0=B8=E5=BF=A0?= Date: Sat, 10 Aug 2024 09:32:27 +0000 Subject: [PATCH 03/12] update DataProtectionKit/ dlp_permission_api.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王永忠 --- DataProtectionKit/ dlp_permission_api.h | 1 + 1 file changed, 1 insertion(+) diff --git a/DataProtectionKit/ dlp_permission_api.h b/DataProtectionKit/ dlp_permission_api.h index 5fd2c4e6b..9f488d5cb 100644 --- a/DataProtectionKit/ dlp_permission_api.h +++ b/DataProtectionKit/ dlp_permission_api.h @@ -92,6 +92,7 @@ typedef enum { * call this API, which is available only for DLP sandbox applications. * {@link DLP_ErrCode#ERR_OH_SYSTEM_SERVICE_EXCEPTION} 19100011 - If the system ability * works abnormally. + * {@link DLP_ErrCode#ERR_OH_OUT_OF_MEMORY} 19100012 - If the memory error. * @since 12 */ DLP_ErrCode OH_DLP_GetDLPPermissionInfo(DLP_FileAccess *dlpFileAccess, uint32_t *flags); -- Gitee From fc92a2220905edfd5aab416c3c5ae896df69dbc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B0=B8=E5=BF=A0?= Date: Mon, 12 Aug 2024 03:53:03 +0000 Subject: [PATCH 04/12] update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王永忠 --- DataProtectionKit/ dlp_permission_api.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/DataProtectionKit/ dlp_permission_api.h b/DataProtectionKit/ dlp_permission_api.h index 9f488d5cb..6e04f36fb 100644 --- a/DataProtectionKit/ dlp_permission_api.h +++ b/DataProtectionKit/ dlp_permission_api.h @@ -84,11 +84,11 @@ typedef enum { /** * @brief Obtains the permission info of this DLP file. * - * @param dlpFileAccess - Indicates the access permission for the DLP file + * @param dlpFileAccess - Indicates the access permission for the DLP file. * @param flags - Indicates the actions allowed for the DLP file. * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. * {@link DLP_ErrCode#ERR_OH_INVALID_PARAMETER} 19100001 - If the parameter value is invalid. - * {@link DLP_ErrCode#ERR_OH_API_ONLY_FOR_SANDBOX_ERROR} 19100006 - If No permission to + * {@link DLP_ErrCode#ERR_OH_API_ONLY_FOR_SANDBOX_ERROR} 19100006 - If no permission to * call this API, which is available only for DLP sandbox applications. * {@link DLP_ErrCode#ERR_OH_SYSTEM_SERVICE_EXCEPTION} 19100011 - If the system ability * works abnormally. @@ -123,9 +123,9 @@ DLP_ErrCode OH_DLP_GetOriginalFileName(const char *fileName, char *originalFileN DLP_ErrCode OH_DLP_GetDLPSuffix(char *suffixFileName); /** - * @brief Checks whether current application is in the DLP sandbox. This method uses a promise to return the result. + * @brief Checks whether current application is in the DLP sandbox. * - * @param isInSandbox - Indicates output parameter; + * @param isInSandbox - Indicates output parameter, {@code true} if current application is in a DLP sandbox, {@code false} otherwise. * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. * {@link DLP_ErrCode#ERR_OH_SYSTEM_SERVICE_EXCEPTION} 19100011 - If the system ability @@ -136,42 +136,42 @@ DLP_ErrCode OH_DLP_GetDLPSuffix(char *suffixFileName); DLP_ErrCode OH_DLP_IsInSandbox(bool *isInSandbox); /** - * @brief Sets sandbox application configuration. This method uses a promise to return the result. + * @brief Sets sandbox application configuration. * * @param configInfo - Configuration of the sandbox application. * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. * {@link DLP_ErrCode#ERR_OH_INVALID_PARAMETER} 19100001 - If the parameter value is invalid. - * {@link DLP_ErrCode#ERR_OH_API_NOT_FOR_SANDBOX_ERROR} 19100007 - If No permission to + * {@link DLP_ErrCode#ERR_OH_API_NOT_FOR_SANDBOX_ERROR} 19100007 - If no permission to * call this API, which is available only for non-DLP sandbox applications. * {@link DLP_ErrCode#ERR_OH_SYSTEM_SERVICE_EXCEPTION} 19100011 - If the system ability * works abnormally. - * {@link DLP_ErrCode#ERR_OH_APPLICATION_NOT_AUTHORIZED} 19100018 - Not authorized application. + * {@link DLP_ErrCode#ERR_OH_APPLICATION_NOT_AUTHORIZED} 19100018 - If not authorized application. * @since 12 */ DLP_ErrCode OH_DLP_SetSandboxAppConfig(const char *configInfo); /** - * @brief Obtains sandbox application configuration. This method uses a promise to return the result. + * @brief Obtains sandbox application configuration. * * @param configInfo - Configuration of the sandbox application. * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. * {@link DLP_ErrCode#ERR_OH_SYSTEM_SERVICE_EXCEPTION} 19100011 - If the system ability * works abnormally. * {@link DLP_ErrCode#ERR_OH_OUT_OF_MEMORY} 19100012 - If the memory error. - * {@link DLP_ErrCode#ERR_OH_APPLICATION_NOT_AUTHORIZED} 19100018 - Not authorized application. + * {@link DLP_ErrCode#ERR_OH_APPLICATION_NOT_AUTHORIZED} 19100018 - If not authorized application. * @since 12 */ DLP_ErrCode OH_DLP_GetSandboxAppConfig(char *configInfo); /** - * @brief Cleans sandbox application configuration. This method uses a promise to return the result. + * @brief Cleans sandbox application configuration. * * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. - * {@link DLP_ErrCode#ERR_OH_API_NOT_FOR_SANDBOX_ERROR} 19100007 - If No permission to + * {@link DLP_ErrCode#ERR_OH_API_NOT_FOR_SANDBOX_ERROR} 19100007 - If no permission to * call this API, which is available only for non-DLP sandbox applications. * {@link DLP_ErrCode#ERR_OH_SYSTEM_SERVICE_EXCEPTION} 19100011 - If the system ability * works abnormally. - * {@link DLP_ErrCode#ERR_OH_APPLICATION_NOT_AUTHORIZED} 19100018 - Not authorized application. + * {@link DLP_ErrCode#ERR_OH_APPLICATION_NOT_AUTHORIZED} 19100018 - If not authorized application. * @since 12 */ DLP_ErrCode OH_DLP_CleanSandboxAppConfig(); -- Gitee From 2d0da42123269d53afc0c2c1e1d28b20e07eec19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B0=B8=E5=BF=A0?= Date: Mon, 12 Aug 2024 06:34:11 +0000 Subject: [PATCH 05/12] update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王永忠 --- DataProtectionKit/ dlp_permission_api.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/DataProtectionKit/ dlp_permission_api.h b/DataProtectionKit/ dlp_permission_api.h index 6e04f36fb..2888715fd 100644 --- a/DataProtectionKit/ dlp_permission_api.h +++ b/DataProtectionKit/ dlp_permission_api.h @@ -49,19 +49,19 @@ extern "C" { * @since 12 */ typedef enum { - /** The operation is successful. */ + /** @error The operation is successful. */ ERR_OH_SUCCESS = 0, - /** Invalid parameter value. */ + /** @error Invalid parameter value. */ ERR_OH_INVALID_PARAMETER = 19100001, - /** No permission to call this API, which is available only for DLP sandbox applications. */ + /** @error No permission to call this API, which is available only for DLP sandbox applications. */ ERR_OH_API_ONLY_FOR_SANDBOX_ERROR = 19100006, - /** No permission to call this API, which is available only for non-DLP sandbox applications. */ + /** @error No permission to call this API, which is available only for non-DLP sandbox applications. */ ERR_OH_API_NOT_FOR_SANDBOX_ERROR = 19100007, - /** The system ability works abnormally. */ + /** @error The system ability works abnormally. */ ERR_OH_SYSTEM_SERVICE_EXCEPTION = 19100011, - /** Indicates the memory error. */ + /** @error Indicates the memory error. */ ERR_OH_OUT_OF_MEMORY = 19100012, - /** DisplayName missing in want. */ + /** @error DisplayName missing in want. */ ERR_OH_APPLICATION_NOT_AUTHORIZED = 19100018 } DLP_ErrCode; @@ -95,7 +95,7 @@ typedef enum { * {@link DLP_ErrCode#ERR_OH_OUT_OF_MEMORY} 19100012 - If the memory error. * @since 12 */ -DLP_ErrCode OH_DLP_GetDLPPermissionInfo(DLP_FileAccess *dlpFileAccess, uint32_t *flags); +DLP_ErrCode OH_DLP_GetDlpPermissionInfo(DLP_FileAccess *dlpFileAccess, uint32_t *flags); /** * @brief Obtains the original file name from a DLP file name. @@ -120,7 +120,7 @@ DLP_ErrCode OH_DLP_GetOriginalFileName(const char *fileName, char *originalFileN * {@link DLP_ErrCode#ERR_OH_OUT_OF_MEMORY} 19100012 - If the memory error. * @since 12 */ -DLP_ErrCode OH_DLP_GetDLPSuffix(char *suffixFileName); +DLP_ErrCode OH_DLP_GetDlpSuffix(char *suffixFileName); /** * @brief Checks whether current application is in the DLP sandbox. -- Gitee From 250c12ab227d52790bc81c3f3be85913fccfe200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B0=B8=E5=BF=A0?= Date: Mon, 12 Aug 2024 07:46:15 +0000 Subject: [PATCH 06/12] update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王永忠 --- DataProtectionKit/ dlp_permission_api.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/DataProtectionKit/ dlp_permission_api.h b/DataProtectionKit/ dlp_permission_api.h index 2888715fd..76c97f68e 100644 --- a/DataProtectionKit/ dlp_permission_api.h +++ b/DataProtectionKit/ dlp_permission_api.h @@ -114,7 +114,6 @@ DLP_ErrCode OH_DLP_GetOriginalFileName(const char *fileName, char *originalFileN * @brief Obtains the original file name from a DLP file name. * This method removes the DLP file name extension from the DLP file name. * - * @param fileName - Indicates the DLP file name. * @param suffixFileName - Indicates the suffix file name obtained. * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. * {@link DLP_ErrCode#ERR_OH_OUT_OF_MEMORY} 19100012 - If the memory error. @@ -126,7 +125,7 @@ DLP_ErrCode OH_DLP_GetDlpSuffix(char *suffixFileName); * @brief Checks whether current application is in the DLP sandbox. * * @param isInSandbox - Indicates output parameter, - {@code true} if current application is in a DLP sandbox, {@code false} otherwise. + * {@code true} if current application is in a DLP sandbox, {@code false} otherwise. * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. * {@link DLP_ErrCode#ERR_OH_SYSTEM_SERVICE_EXCEPTION} 19100011 - If the system ability * works abnormally. -- Gitee From 7ec703444aa59b67d8078ffcc01c9ac31c979031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B0=B8=E5=BF=A0?= Date: Mon, 12 Aug 2024 09:00:21 +0000 Subject: [PATCH 07/12] update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王永忠 --- DataProtectionKit/libdlpperission.ndk.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DataProtectionKit/libdlpperission.ndk.json b/DataProtectionKit/libdlpperission.ndk.json index 7860a53d1..27c1047cf 100644 --- a/DataProtectionKit/libdlpperission.ndk.json +++ b/DataProtectionKit/libdlpperission.ndk.json @@ -1,7 +1,7 @@ [ { "first_introduced": "12", - "name": "OH_DLP_GetDLPPermissionInfo" + "name": "OH_DLP_GetDlpPermissionInfo" }, { "first_introduced": "12", @@ -9,7 +9,7 @@ }, { "first_introduced": "12", - "name": "OH_DLP_GetDLPSuffix" + "name": "OH_DLP_GetDlpSuffix" }, { "first_introduced": "12", -- Gitee From 52658a4a6ff9bba136971b7543fc28eb251022c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B0=B8=E5=BF=A0?= Date: Mon, 12 Aug 2024 09:02:10 +0000 Subject: [PATCH 08/12] update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王永忠 --- DataProtectionKit/ dlp_permission_api.h | 1 - 1 file changed, 1 deletion(-) diff --git a/DataProtectionKit/ dlp_permission_api.h b/DataProtectionKit/ dlp_permission_api.h index 76c97f68e..9463e5c29 100644 --- a/DataProtectionKit/ dlp_permission_api.h +++ b/DataProtectionKit/ dlp_permission_api.h @@ -112,7 +112,6 @@ DLP_ErrCode OH_DLP_GetOriginalFileName(const char *fileName, char *originalFileN /** * @brief Obtains the original file name from a DLP file name. - * This method removes the DLP file name extension from the DLP file name. * * @param suffixFileName - Indicates the suffix file name obtained. * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. -- Gitee From f05d3b27cffc805d193db1f2a9abdb01129f0830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B0=B8=E5=BF=A0?= Date: Mon, 12 Aug 2024 16:16:36 +0000 Subject: [PATCH 09/12] update DataProtectionKit/ dlp_permission_api.h. update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王永忠 --- DataProtectionKit/ dlp_permission_api.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DataProtectionKit/ dlp_permission_api.h b/DataProtectionKit/ dlp_permission_api.h index 9463e5c29..409440844 100644 --- a/DataProtectionKit/ dlp_permission_api.h +++ b/DataProtectionKit/ dlp_permission_api.h @@ -108,7 +108,7 @@ DLP_ErrCode OH_DLP_GetDlpPermissionInfo(DLP_FileAccess *dlpFileAccess, uint32_t * {@link DLP_ErrCode#ERR_OH_OUT_OF_MEMORY} 19100012 - If the memory error. * @since 12 */ -DLP_ErrCode OH_DLP_GetOriginalFileName(const char *fileName, char *originalFileName); +DLP_ErrCode OH_DLP_GetOriginalFileName(const char *fileName, char **originalFileName); /** * @brief Obtains the original file name from a DLP file name. @@ -118,7 +118,7 @@ DLP_ErrCode OH_DLP_GetOriginalFileName(const char *fileName, char *originalFileN * {@link DLP_ErrCode#ERR_OH_OUT_OF_MEMORY} 19100012 - If the memory error. * @since 12 */ -DLP_ErrCode OH_DLP_GetDlpSuffix(char *suffixFileName); +DLP_ErrCode OH_DLP_GetDlpSuffix(char **suffixFileName); /** * @brief Checks whether current application is in the DLP sandbox. @@ -159,7 +159,7 @@ DLP_ErrCode OH_DLP_SetSandboxAppConfig(const char *configInfo); * {@link DLP_ErrCode#ERR_OH_APPLICATION_NOT_AUTHORIZED} 19100018 - If not authorized application. * @since 12 */ -DLP_ErrCode OH_DLP_GetSandboxAppConfig(char *configInfo); +DLP_ErrCode OH_DLP_GetSandboxAppConfig(char **configInfo); /** * @brief Cleans sandbox application configuration. -- Gitee From da14ce6215ea3476c02030a93f6bf3daa23ad6f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B0=B8=E5=BF=A0?= Date: Tue, 13 Aug 2024 07:25:55 +0000 Subject: [PATCH 10/12] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20DataProtect?= =?UTF-8?q?ionKit/=20dlp=5Fpermission=5Fapi.h=20=E4=B8=BA=20DataProtection?= =?UTF-8?q?Kit/dlp=5Fpermission=5Fapi.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DataProtectionKit/{ dlp_permission_api.h => dlp_permission_api.h} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename DataProtectionKit/{ dlp_permission_api.h => dlp_permission_api.h} (100%) diff --git a/DataProtectionKit/ dlp_permission_api.h b/DataProtectionKit/dlp_permission_api.h similarity index 100% rename from DataProtectionKit/ dlp_permission_api.h rename to DataProtectionKit/dlp_permission_api.h -- Gitee From 9b6da6da2370aef8b36b8a23a183668d2971d058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B0=B8=E5=BF=A0?= Date: Fri, 16 Aug 2024 08:14:41 +0000 Subject: [PATCH 11/12] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20DataProtect?= =?UTF-8?q?ionKit/libdlpperission.ndk.json=20=E4=B8=BA=20DataProtectionKit?= =?UTF-8?q?/libdlppermission.ndk.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{libdlpperission.ndk.json => libdlppermission.ndk.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename DataProtectionKit/{libdlpperission.ndk.json => libdlppermission.ndk.json} (100%) diff --git a/DataProtectionKit/libdlpperission.ndk.json b/DataProtectionKit/libdlppermission.ndk.json similarity index 100% rename from DataProtectionKit/libdlpperission.ndk.json rename to DataProtectionKit/libdlppermission.ndk.json -- Gitee From 4c72782ee2f3e39df4e247d6260e667ffcdb8f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B0=B8=E5=BF=A0?= Date: Fri, 16 Aug 2024 09:01:37 +0000 Subject: [PATCH 12/12] update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王永忠 --- DataProtectionKit/dlp_permission_api.h | 40 ++++++++++---------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/DataProtectionKit/dlp_permission_api.h b/DataProtectionKit/dlp_permission_api.h index 409440844..6919626b8 100644 --- a/DataProtectionKit/dlp_permission_api.h +++ b/DataProtectionKit/dlp_permission_api.h @@ -19,7 +19,7 @@ * * @brief Provides the capability to access the data loss prevention (DLP) files. * - * @since 12 + * @since 13 */ /** @@ -30,7 +30,7 @@ * @library libohdlp_permission.so * @kit DataProtectionKit * @syscap SystemCapability.Security.DataLossPrevention - * @since 12 + * @since 13 */ #ifndef DLP_PERMISSION_API_H @@ -46,7 +46,7 @@ extern "C" { /** * @brief Enumerates the error codes. * - * @since 12 + * @since 13 */ typedef enum { /** @error The operation is successful. */ @@ -54,9 +54,9 @@ typedef enum { /** @error Invalid parameter value. */ ERR_OH_INVALID_PARAMETER = 19100001, /** @error No permission to call this API, which is available only for DLP sandbox applications. */ - ERR_OH_API_ONLY_FOR_SANDBOX_ERROR = 19100006, + ERR_OH_API_ONLY_FOR_SANDBOX = 19100006, /** @error No permission to call this API, which is available only for non-DLP sandbox applications. */ - ERR_OH_API_NOT_FOR_SANDBOX_ERROR = 19100007, + ERR_OH_API_NOT_FOR_SANDBOX = 19100007, /** @error The system ability works abnormally. */ ERR_OH_SYSTEM_SERVICE_EXCEPTION = 19100011, /** @error Indicates the memory error. */ @@ -68,7 +68,7 @@ typedef enum { /** * @brief Enumerates the access permissions for a DLP file. * - * @since 12 + * @since 13 */ typedef enum { /** No permission. */ @@ -88,12 +88,12 @@ typedef enum { * @param flags - Indicates the actions allowed for the DLP file. * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. * {@link DLP_ErrCode#ERR_OH_INVALID_PARAMETER} 19100001 - If the parameter value is invalid. - * {@link DLP_ErrCode#ERR_OH_API_ONLY_FOR_SANDBOX_ERROR} 19100006 - If no permission to + * {@link DLP_ErrCode#ERR_OH_API_ONLY_FOR_SANDBOX} 19100006 - If no permission to * call this API, which is available only for DLP sandbox applications. * {@link DLP_ErrCode#ERR_OH_SYSTEM_SERVICE_EXCEPTION} 19100011 - If the system ability * works abnormally. * {@link DLP_ErrCode#ERR_OH_OUT_OF_MEMORY} 19100012 - If the memory error. - * @since 12 + * @since 13 */ DLP_ErrCode OH_DLP_GetDlpPermissionInfo(DLP_FileAccess *dlpFileAccess, uint32_t *flags); @@ -106,20 +106,10 @@ DLP_ErrCode OH_DLP_GetDlpPermissionInfo(DLP_FileAccess *dlpFileAccess, uint32_t * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. * {@link DLP_ErrCode#ERR_OH_INVALID_PARAMS} 19100001 - If the parameter value is invalid. * {@link DLP_ErrCode#ERR_OH_OUT_OF_MEMORY} 19100012 - If the memory error. - * @since 12 + * @since 13 */ DLP_ErrCode OH_DLP_GetOriginalFileName(const char *fileName, char **originalFileName); -/** - * @brief Obtains the original file name from a DLP file name. - * - * @param suffixFileName - Indicates the suffix file name obtained. - * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. - * {@link DLP_ErrCode#ERR_OH_OUT_OF_MEMORY} 19100012 - If the memory error. - * @since 12 - */ -DLP_ErrCode OH_DLP_GetDlpSuffix(char **suffixFileName); - /** * @brief Checks whether current application is in the DLP sandbox. * @@ -129,7 +119,7 @@ DLP_ErrCode OH_DLP_GetDlpSuffix(char **suffixFileName); * {@link DLP_ErrCode#ERR_OH_SYSTEM_SERVICE_EXCEPTION} 19100011 - If the system ability * works abnormally. * {@link DLP_ErrCode#ERR_OH_OUT_OF_MEMORY} 19100012 - If the memory error. - * @since 12 + * @since 13 */ DLP_ErrCode OH_DLP_IsInSandbox(bool *isInSandbox); @@ -139,12 +129,12 @@ DLP_ErrCode OH_DLP_IsInSandbox(bool *isInSandbox); * @param configInfo - Configuration of the sandbox application. * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. * {@link DLP_ErrCode#ERR_OH_INVALID_PARAMETER} 19100001 - If the parameter value is invalid. - * {@link DLP_ErrCode#ERR_OH_API_NOT_FOR_SANDBOX_ERROR} 19100007 - If no permission to + * {@link DLP_ErrCode#ERR_OH_API_NOT_FOR_SANDBOX} 19100007 - If no permission to * call this API, which is available only for non-DLP sandbox applications. * {@link DLP_ErrCode#ERR_OH_SYSTEM_SERVICE_EXCEPTION} 19100011 - If the system ability * works abnormally. * {@link DLP_ErrCode#ERR_OH_APPLICATION_NOT_AUTHORIZED} 19100018 - If not authorized application. - * @since 12 + * @since 13 */ DLP_ErrCode OH_DLP_SetSandboxAppConfig(const char *configInfo); @@ -157,7 +147,7 @@ DLP_ErrCode OH_DLP_SetSandboxAppConfig(const char *configInfo); * works abnormally. * {@link DLP_ErrCode#ERR_OH_OUT_OF_MEMORY} 19100012 - If the memory error. * {@link DLP_ErrCode#ERR_OH_APPLICATION_NOT_AUTHORIZED} 19100018 - If not authorized application. - * @since 12 + * @since 13 */ DLP_ErrCode OH_DLP_GetSandboxAppConfig(char **configInfo); @@ -165,12 +155,12 @@ DLP_ErrCode OH_DLP_GetSandboxAppConfig(char **configInfo); * @brief Cleans sandbox application configuration. * * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. - * {@link DLP_ErrCode#ERR_OH_API_NOT_FOR_SANDBOX_ERROR} 19100007 - If no permission to + * {@link DLP_ErrCode#ERR_OH_API_NOT_FOR_SANDBOX} 19100007 - If no permission to * call this API, which is available only for non-DLP sandbox applications. * {@link DLP_ErrCode#ERR_OH_SYSTEM_SERVICE_EXCEPTION} 19100011 - If the system ability * works abnormally. * {@link DLP_ErrCode#ERR_OH_APPLICATION_NOT_AUTHORIZED} 19100018 - If not authorized application. - * @since 12 + * @since 13 */ DLP_ErrCode OH_DLP_CleanSandboxAppConfig(); -- Gitee