From 13272e02e90905b9b43fcd61a344a83532cf381a Mon Sep 17 00:00:00 2001 From: xuqian Date: Wed, 30 Aug 2023 07:43:55 +0000 Subject: [PATCH] remove xts and docs Signed-off-by: xuqian --- docs/@ohos.dlpPermission.d.ts | 1335 -------- docs/README_zh.md | 112 - docs/errorcodes-dlp.md | 353 --- docs/js-apis-dlppermission.md | 2717 ----------------- xts/AppScope/app.json | 21 - .../resources/base/element/string.json | 8 - .../resources/base/media/app_icon.png | Bin 6790 -> 0 bytes xts/BUILD.gn | 41 - xts/Test.json | 20 - .../src/main/ets/Application/AbilityStage.ts | 9 - .../src/main/ets/MainAbility/MainAbility.ts | 38 - .../ets/MainAbility/pages/index/index.ets | 44 - .../src/main/ets/TestAbility/TestAbility.ts | 50 - .../src/main/ets/TestAbility/pages/index.ets | 48 - .../ets/TestRunner/OpenHarmonyTestRunner.ts | 79 - xts/entry/src/main/ets/common/utils.ets | 16 - .../GetDLPFileAccessRecordsCallback.ets | 43 - .../GetDLPFileAccessRecordsPromise.ets | 42 - .../GetRetentionSandboxListCallback.ets | 43 - .../GetRetentionSandboxListPromise.ets | 42 - .../GetDLPPermissionInfoCallback.ets | 43 - .../GetDLPPermissionInfoPromise.ets | 42 - .../IsInSandboxCallback.ets | 48 - .../isinsandboxpromise/IsInSandboxPromise.ets | 47 - .../main/ets/onopendlpfile/OnOpenDlpFile.ets | 41 - .../SetRetentionStateCallback.ets | 49 - .../SetRetentionStatePromise.ets | 48 - xts/entry/src/main/ets/test/DlpTest.test.ets | 1590 ---------- xts/entry/src/main/ets/test/List.test.ets | 20 - xts/entry/src/main/module.json | 146 - .../main/resources/base/element/color.json | 12 - .../main/resources/base/element/float.json | 12 - .../main/resources/base/element/string.json | 156 - .../src/main/resources/base/media/icon.png | Bin 6790 -> 0 bytes .../resources/base/profile/main_pages.json | 5 - xts/signature/openharmony_sx.p7b | Bin 3544 -> 0 bytes 36 files changed, 7320 deletions(-) delete mode 100644 docs/@ohos.dlpPermission.d.ts delete mode 100644 docs/README_zh.md delete mode 100644 docs/errorcodes-dlp.md delete mode 100644 docs/js-apis-dlppermission.md delete mode 100644 xts/AppScope/app.json delete mode 100644 xts/AppScope/resources/base/element/string.json delete mode 100644 xts/AppScope/resources/base/media/app_icon.png delete mode 100644 xts/BUILD.gn delete mode 100644 xts/Test.json delete mode 100644 xts/entry/src/main/ets/Application/AbilityStage.ts delete mode 100644 xts/entry/src/main/ets/MainAbility/MainAbility.ts delete mode 100644 xts/entry/src/main/ets/MainAbility/pages/index/index.ets delete mode 100644 xts/entry/src/main/ets/TestAbility/TestAbility.ts delete mode 100644 xts/entry/src/main/ets/TestAbility/pages/index.ets delete mode 100644 xts/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts delete mode 100644 xts/entry/src/main/ets/common/utils.ets delete mode 100644 xts/entry/src/main/ets/getDLPFileAccessRecordscallback/GetDLPFileAccessRecordsCallback.ets delete mode 100644 xts/entry/src/main/ets/getDLPFileAccessRecordspromise/GetDLPFileAccessRecordsPromise.ets delete mode 100644 xts/entry/src/main/ets/getRetentionSandboxListcallback/GetRetentionSandboxListCallback.ets delete mode 100644 xts/entry/src/main/ets/getRetentionSandboxListpromise/GetRetentionSandboxListPromise.ets delete mode 100644 xts/entry/src/main/ets/getdlppermissioninfocallback/GetDLPPermissionInfoCallback.ets delete mode 100644 xts/entry/src/main/ets/getdlppermissioninfopromise/GetDLPPermissionInfoPromise.ets delete mode 100644 xts/entry/src/main/ets/isinsandboxcallback/IsInSandboxCallback.ets delete mode 100644 xts/entry/src/main/ets/isinsandboxpromise/IsInSandboxPromise.ets delete mode 100644 xts/entry/src/main/ets/onopendlpfile/OnOpenDlpFile.ets delete mode 100644 xts/entry/src/main/ets/setRetentionStatecallback/SetRetentionStateCallback.ets delete mode 100644 xts/entry/src/main/ets/setRetentionStatepromise/SetRetentionStatePromise.ets delete mode 100644 xts/entry/src/main/ets/test/DlpTest.test.ets delete mode 100644 xts/entry/src/main/ets/test/List.test.ets delete mode 100644 xts/entry/src/main/module.json delete mode 100644 xts/entry/src/main/resources/base/element/color.json delete mode 100644 xts/entry/src/main/resources/base/element/float.json delete mode 100644 xts/entry/src/main/resources/base/element/string.json delete mode 100644 xts/entry/src/main/resources/base/media/icon.png delete mode 100644 xts/entry/src/main/resources/base/profile/main_pages.json delete mode 100644 xts/signature/openharmony_sx.p7b diff --git a/docs/@ohos.dlpPermission.d.ts b/docs/@ohos.dlpPermission.d.ts deleted file mode 100644 index 5bcb81b9..00000000 --- a/docs/@ohos.dlpPermission.d.ts +++ /dev/null @@ -1,1335 +0,0 @@ -/* - * Copyright (c) 2023 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 type { AsyncCallback } from '@ohos.base'; - -/** - * Provides the capability to access the data loss prevention (DLP) files. - * - * @namespace dlpPermission - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ -declare namespace dlpPermission { - /** - * Enumerates the types of actions that can be performed on a DLP file. - * - * @enum { number } - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - export enum ActionFlagType { - /** - * View a DLP file. - * - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - ACTION_VIEW = 0x00000001, - - /** - * Save a DLP file. - * - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - ACTION_SAVE = 0x00000002, - - /** - * Save a DLP file as another file. - * - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - ACTION_SAVE_AS = 0x00000004, - - /** - * Edit a DLP file. - * - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - ACTION_EDIT = 0x00000008, - - /** - * Take a screenshot of a DLP file. - * - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - ACTION_SCREEN_CAPTURE = 0x00000010, - - /** - * Share the screen, on which a DLP file is opened. - * - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - ACTION_SCREEN_SHARE = 0x00000020, - - /** - * Record the screen, on which a DLP file is opened. - * - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - ACTION_SCREEN_RECORD = 0x00000040, - - /** - * Copy a DLP file. - * - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - ACTION_COPY = 0x00000080, - - /** - * Print a DLP file. - * - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - ACTION_PRINT = 0x00000100, - - /** - * Export a DLP file. - * - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - ACTION_EXPORT = 0x00000200, - - /** - * Change the permissions for a DLP file. - * - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - ACTION_PERMISSION_CHANGE = 0x00000400 - } - - /** - * Enumerates the access permissions for a DLP file. - * - * @enum { number } - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - export enum DLPFileAccess { - /** - * No permission. - * - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - NO_PERMISSION = 0, - - /** - * Read-only. - * - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - READ_ONLY = 1, - - /** - * Edit. - * - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - CONTENT_EDIT = 2, - - /** - * Full control. - * - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - FULL_CONTROL = 3 - } - - /** - * Represents the permission info of a DLP file. - * - * @interface DLPPermissionInfo - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - export interface DLPPermissionInfo { - /** - * Access permission for the DLP file. - * - * @type { DLPFileAccess } - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - dlpFileAccess: DLPFileAccess; - - /** - * Actions allowed for the DLP file. The value is a combination of flags in {@code ActionFlagType}. - * - * @type { number } - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - flags: number; - } - - /** - * Represents the visited DLP file info. - * - * @interface VisitedDLPFileInfo - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - export interface VisitedDLPFileInfo { - /** - * URI of the DLP file. - * - * @type { string } - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - uri: string; - - /** - * Time when the DLP file was last opened. - * - * @type { number } - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - recentOpenTime: number; - } - - /** - * Represents the retention sandbox info. - * - * @interface RetentionSandboxInfo - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - export interface RetentionSandboxInfo { - /** - * Application index of the DLP sandbox. - * - * @type { number } - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - appIndex: number; - - /** - * Bundle name of the application. - * - * @type { string } - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - bundleName: string; - - /** - * List of file URIs. - * - * @type { Array } - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - docUris: Array; - } - - /** - * Checks whether a file is a DLP file. This method uses a promise to return the result. - * - * @param { number } fd - Indicates the file descriptor of the file to check. - * @returns { Promise } Returns {@code true} if {@code fd} is a DLP file; returns {@code false} otherwise. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function isDLPFile(fd: number): Promise; - - /** - * Checks whether a file is a DLP file. This method uses an asynchronous callback to return the result. - * - * @param { number } fd - Indicates the file descriptor of the file to check. - * @param { AsyncCallback } callback - Indicates the callback invoked to return the result. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function isDLPFile(fd: number, callback: AsyncCallback): void; - - /** - * Obtains the permission info of this DLP file. This method uses a promise to return the result. - * - * @returns { Promise } Returns a {@code DLPPermissionInfo} object. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100006 - No permission to invoke this api, which is for DLP sandbox application. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function getDLPPermissionInfo(): Promise; - - /** - * Obtains the permission info of this DLP file. This method uses an asynchronous callback to return the result. - * - * @param { AsyncCallback } callback - Indicates the callback invoked to return the result. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100006 - No permission to invoke this api, which is for DLP sandbox application. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function getDLPPermissionInfo(callback: AsyncCallback): void; - - /** - * Obtains the original file name from a DLP file name. This method removes the DLP file name extension from the DLP file name. - * - * @param { string } fileName - Indicates DLP file name. - * @returns { string } Returns the original file name obtained. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function getOriginalFileName(fileName: string): string; - - /** - * Obtains the DLP file name extension. - * - * @returns { string } Returns the DLP file name extension obtained. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function getDLPSuffix(): string; - - /** - * Subscribes to the event reported when a DLP file is opened by the given application. - * - * @param { 'openDLPFile' } type - Indicates the type of the event to subscribe to. - * @param { Callback } listener - Indicates the callback invoked when a DLP file is opened by the given application. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100007 - No permission to invoke this api, which is not for DLP sandbox application. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function on(type: 'openDLPFile', listener: Callback): void; - - /** - * Unsubscribes from the event reported when a DLP file is opened by the given application. - * - * @param { 'openDLPFile' } type - Indicates the type of the event to unsubscribe from. - * @param { Callback } listener - Indicates the callback invoked when a DLP file is opened by the given application. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100007 - No permission to invoke this api, which is not for DLP sandbox application. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function off(type: 'openDLPFile', listener?: Callback): void; - - /** - * Checks whether this application is in the DLP sandbox. This method uses a promise to return the result. - * - * @returns { Promise } Returns {@code true} if the application is in a DLP sandbox; returns {@code false} otherwise. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function isInSandbox(): Promise; - - /** - * Checks whether this application is in the DLP sandbox. This method uses an asynchronous callback to return the result. - * - * @param { AsyncCallback } callback - Indicates the callback invoked to return the result. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function isInSandbox(callback: AsyncCallback): void; - - /** - * Obtains the file types supported by DLP. This method uses a promise to return the result. - * - * @returns { Promise> } Returns the list of file types supported. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function getDLPSupportedFileTypes(): Promise>; - - /** - * Obtains the file types supported by DLP. This method uses an asynchronous callback to return the result. - * - * @param { AsyncCallback> } callback - Indicates the callback invoked to return the result. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function getDLPSupportedFileTypes(callback: AsyncCallback>): void; - - /** - * Sets the retention status for the files specified by {@code dorUri}. This method uses an asynchronous callback to return the result. - * - * @param { Array } docUris - Indicates the URIs of the files, for which the retention status is to set. - * @param { AsyncCallback } callback - Indicates the callback invoked to return the result. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100006 - No permission to invoke this api, which is for DLP sandbox application. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function setRetentionState(docUris: Array, callback: AsyncCallback): void; - - /** - * Sets the retention status for the files specified by {@code dorUri}. This method uses a promise to return the result. - * - * @param { Array } docUris - Indicates the URIs of the files, for which the retention status is to set. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100006 - No permission to invoke this api, which is for DLP sandbox application. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function setRetentionState(docUris: Array): Promise; - - /** - * Cancels the retention status for the files specified by {@code dorUri}. This method uses an asynchronous callback to return the result. - * - * @param { Array } docUris - Indicates the list of the file URIs. - * @param { AsyncCallback } callback - Indicates the callback invoked to return the result. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function cancelRetentionState(docUris: Array, callback: AsyncCallback): void; - - /** - * Cancels the retention status for the files specified by {@code dorUri}. This method uses a promise to return the result. - * - * @param { Array } docUris - Indicates the list of the file URIs. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function cancelRetentionState(docUris: Array): Promise; - - /** - * Obtains information about the retained DLP sandboxes of an application. This method uses a promise to return the result. - * - * @param { string } bundleName - Indicates the bundle name of the application. - * @returns { Promise> } Returns a list of {@code RetentionSandboxInfo}. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100007 - No permission to invoke this api, which is not for DLP sandbox application. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function getRetentionSandboxList(bundleName?: string): Promise>; - - /** - * Obtains information about the retained DLP sandboxes of an application. This method uses an asynchronous callback to return the result. - * - * @param { string } bundleName - Indicates the bundle name of the application. - * @param { AsyncCallback> } callback - Indicates the callback invoked to return the result. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100007 - No permission to invoke this api, which is not for DLP sandbox application. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function getRetentionSandboxList(bundleName: string, callback: AsyncCallback>): void; - - /** - * Obtains information about retained DLP sandboxes. This method uses an asynchronous callback to return the result. - * - * @param { AsyncCallback> } callback - Indicates the callback invoked to return the result. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100007 - No permission to invoke this api, which is not for DLP sandbox application. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function getRetentionSandboxList(callback: AsyncCallback>): void; - - /** - * Obtains the DLP file visit records. This method uses a promise to return the result. - * - * @returns { Promise> } Returns a list of DLP files visited recently. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100007 - No permission to invoke this api, which is not for DLP sandbox application. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function getDLPFileVisitRecords(): Promise>; - - /** - * Obtains the DLP file visit records. This method uses an asynchronous callback to return the result. - * - * @param { AsyncCallback> } callback - Indicates the callback invoked to return the result. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100007 - No permission to invoke this api, which is not for DLP sandbox application. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @since 10 - */ - function getDLPFileVisitRecords(callback: AsyncCallback>): void; - - /** - * Enumerates the gathering policy types for DLP files. - * - * @enum { number } - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - export enum GatheringPolicyType { - /** - * Gathering, which allows multiple DLP files to be opened in a sandbox. - * - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - GATHERING = 1, - - /** - * Non-gathering, which allows only one DLP file to be opened in a sandbox. - * - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - NON_GATHERING = 2 - } - - /** - * Obtains the DLP sandbox gathering policy. This method uses a promise to return the result. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @returns { Promise } Returns a {@code GatheringPolicyType} object. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - function getDLPGatheringPolicy(): Promise; - - /** - * Obtains the DLP sandbox gathering policy. This method uses an asynchronous callback to return the result. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { AsyncCallback } callback - Indicates the callback invoked to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - function getDLPGatheringPolicy(callback: AsyncCallback): void; - - /** - * Represents the installed DLP sandbox application info. - * - * @interface DLPSandboxInfo - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - export interface DLPSandboxInfo { - /** - * Index of the installed DLP sandbox application. - * - * @type { number } - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - appIndex: number; - - /** - * Token ID of the installed DLP sandbox application.. - * - * @type { number } - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - tokenID: number; - } - - /** - * Installs a DLP sandbox application. This method uses a promise to return the result. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { string } bundleName - Indicates the bundle name of the application. - * @param { DLPFileAccess } access - Indicates the access permission for the DLP file. - * @param { number } userId - Indicates the user ID. - * @param { string } uri - Indicates the URI of the file. - * @returns { Promise } Returns the {@code DLPSandboxInfo} of the installed sandbox application. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - function installDLPSandbox( - bundleName: string, - access: DLPFileAccess, - userId: number, - uri: string - ): Promise; - - /** - * Installs a DLP sandbox application. This method uses an asynchronous callback to return the result. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { string } bundleName - Indicates the bundle name of the application. - * @param { DLPFileAccess } access - Indicates the access permission for the DLP file. - * @param { number } userId - Indicates the user ID. - * @param { string } uri - Indicates the URI of the file. - * @param { AsyncCallback } callback - Indicates the callback invoked to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - function installDLPSandbox( - bundleName: string, - access: DLPFileAccess, - userId: number, - uri: string, - callback: AsyncCallback - ): void; - - /** - * Uninstalls a DLP sandbox application. This method uses a promise to return the result. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { string } bundleName - Indicates the bundle name of the application. - * @param { number } userId - Indicates the user ID. - * @param { number } appIndex - Indicates the index of DLP sandbox. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - function uninstallDLPSandbox(bundleName: string, userId: number, appIndex: number): Promise; - - /** - * Uninstalls a DLP sandbox application. This method uses an asynchronous callback to return the result. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { string } bundleName - Indicates the bundle name of the application. - * @param { number } userId - Indicates the user ID. - * @param { number } appIndex - Indicates the index of DLP sandbox. - * @param { AsyncCallback } callback - Indicates the callback invoked to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - function uninstallDLPSandbox( - bundleName: string, - userId: number, - appIndex: number, - callback: AsyncCallback - ): void; - - /** - * Represents the DLP sandbox state. - * - * @interface DLPSandboxState - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - export interface DLPSandboxState { - /** - * Bundle name of the application. - * - * @type { string } - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - bundleName: string; - - /** - * Application index of the DLP sandbox. - * - * @type { number } - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - appIndex: number; - } - - /** - * Subscribes to the event reported when a DLP sandbox application is uninstalled. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { 'uninstallDLPSandbox' } type - Indicates the type of the event to subscribe to. - * @param { Callback } listener - Indicates the callback for the DLP sandbox application uninstall event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - function on(type: 'uninstallDLPSandbox', listener: Callback): void; - - /** - * Unsubscribes from the event reported when a DLP sandbox application is uninstalled. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { 'uninstallDLPSandbox' } type - Indicates the type of the event to unsubscribe from. - * @param { Callback } listener - Indicates the callback for the DLP sandbox application uninstall event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - function off(type: 'uninstallDLPSandbox', listener?: Callback): void; - - /** - * Enumerates the account types for a DLP file. - * - * @enum { number } - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - export enum AccountType { - /** - * Cloud account. - * - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - CLOUD_ACCOUNT = 1, - - /** - * Domain account. - * - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - DOMAIN_ACCOUNT = 2, - - /** - * Application account. - * - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - APPLICATION_ACCOUNT = 3 - } - - /** - * Represents the authorized user information. - * - * @interface AuthUser - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - export interface AuthUser { - /** - * Authorized account of the DLP file. - * - * @type { string } - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - authAccount: string; - - /** - * Type of the authorized account. - * - * @type { AccountType } - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - authAccountType: AccountType; - - /** - * Authorized permission for the DLP file. - * - * @type { DLPFileAccess } - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - dlpFileAccess: DLPFileAccess; - - /** - * Authorization expiration time of the DLP file. - * - * @type { number } - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - permExpiryTime: number; - } - - /** - * Represents the DLP file property. - * - * @interface DLPProperty - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - export interface DLPProperty { - /** - * Owner account of the DLP file. - * - * @type { string } - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - ownerAccount: string; - - /** - * Owner account ID of the DLP file. - * - * @type { string } - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - ownerAccountID: string; - - /** - * Authorized users of the DLP file. - * - * @type { Array? } - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - authUserList?: Array; - - /** - * Contact account of the DLP file. - * - * @type { string } - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - contractAccount: string; - - /** - * Type of the owner account of the DLP file. - * - * @type { AccountType } - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - ownerAccountType: AccountType; - - /** - * Whether the DLP file can be accessed offline. - * If the DLP file supports offline access, the credential server needs to be connected to the network only when the DLP file is opened for the first time. - * - * @type { boolean } - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - offlineAccess: boolean; - - /** - * Everyone access list for the DLP file. - * - * @type { Array } - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - everyoneAccessList: Array; - - /** - * Everyone Access support - * - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - supportEveryone: boolean; - - /** - * Everyone's Access permission - * - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - everyonePerm: DLPFileAccess; - } - - /** - * Defines the DLP file object. - * - * @interface DLPFile - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - export interface DLPFile { - /** - * DLP file property. - * - * @type { DLPProperty } - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - dlpProperty: DLPProperty; - - /** - * Adds a link file for the DLP file. This method uses a promise to return the result. - * The link file is implemented through the Filesystem in Userspace (FUSE). - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { string } linkFileName - Indicates the name of link file to add. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100009 - Failed to operate the DLP file. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - addDLPLinkFile(linkFileName: string): Promise; - - /** - * Adds a link file for the DLP file. This method uses an asynchronous callback to return the result. - * The link file is implemented through the FUSE. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { string } linkFileName - Indicates the name of link file to add. - * @param { AsyncCallback } callback - Indicates the callback invoked to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100009 - Failed to operate the DLP file. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - addDLPLinkFile(linkFileName: string, callback: AsyncCallback): void; - - /** - * Stops the FUSE link between the DLP file and a link life. This method uses a promise to return the result. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { string } linkFileName - Indicates the name of link file. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100009 - Failed to operate the DLP file. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - stopFuseLink(linkFileName: string): Promise; - - /** - * Stops the FUSE link between the DLP file and a link life. This method uses an asynchronous callback to return the result. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { string } linkFileName - Indicates the name of link file. - * @param { AsyncCallback } callback - Indicates the callback of stopFuseLink. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100009 - Failed to operate the DLP file. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - stopFuseLink(linkFileName: string, callback: AsyncCallback): void; - - /** - * Resumes the FUSE link between the DLP file and a link life. This method uses a promise to return the result. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { string } linkFileName - Indicates the name of link file. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100009 - Failed to operate the DLP file. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - resumeFuseLink(linkFileName: string): Promise; - - /** - * Resumes the FUSE link between the DLP file and a link life. This method uses an asynchronous callback to return the result. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { string } linkFileName - Indicates the name of link file. - * @param { AsyncCallback } callback - Indicates the callback of resumeFuseLink. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100009 - Failed to operate the DLP file. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - resumeFuseLink(linkFileName: string, callback: AsyncCallback): void; - - /** - * Replaces the link file of the DLP file. This method uses a promise to return the result. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { string } linkFileName - Indicates the name of link file. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100009 - Failed to operate the DLP file. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - replaceDLPLinkFile(linkFileName: string): Promise; - - /** - * Replaces the link file of the DLP file. This method uses an asynchronous callback to return the result. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { string } linkFileName - Indicates the name of link file. - * @param { AsyncCallback } callback - Indicates the callback invoked to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100009 - Failed to operate the DLP file. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - replaceDLPLinkFile(linkFileName: string, callback: AsyncCallback): void; - - /** - * Deletes a link file of the DLP file. This method uses a promise to return the result. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { string } linkFileName - Indicates the name of link file to delete. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100009 - Failed to operate the DLP file. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - deleteDLPLinkFile(linkFileName: string): Promise; - - /** - * Deletes a link file of the DLP file. This method uses an asynchronous callback to return the result. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { string } linkFileName - Indicates the name of link file to delete. - * @param { AsyncCallback } callback - Indicates the callback invoked to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100009 - Failed to operate the DLP file. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - deleteDLPLinkFile(linkFileName: string, callback: AsyncCallback): void; - - /** - * Recovers the file in plaintext from the DLP file. This method uses a promise to return the result. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { number } plainFd - Indicates the file descriptor of the file in plaintext. - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100002 - Credential task error. - * @throws { BusinessError } 19100003 - Credential task timed out. - * @throws { BusinessError } 19100004 - Credential service error. - * @throws { BusinessError } 19100005 - Remote credential server error. - * @throws { BusinessError } 19100008 - Not DLP file. - * @throws { BusinessError } 19100009 - Failed to operate the DLP file. - * @throws { BusinessError } 19100010 - DLP file is read-only. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - recoverDLPFile(plainFd: number): Promise; - - /** - * Recovers the file in plaintext from the DLP file. This method uses an asynchronous callback to return the result. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { number } plainFd - Indicates the file descriptor of the file in plaintext. - * @param { AsyncCallback } callback - Indicates the callback invoked to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100002 - Credential task error. - * @throws { BusinessError } 19100003 - Credential task timed out. - * @throws { BusinessError } 19100004 - Credential service error. - * @throws { BusinessError } 19100005 - Remote credential server error. - * @throws { BusinessError } 19100008 - Not DLP file. - * @throws { BusinessError } 19100009 - Failed to operate the DLP file. - * @throws { BusinessError } 19100010 - DLP file is read-only. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - recoverDLPFile(plainFd: number, callback: AsyncCallback): void; - - /** - * Closes the DLP file when the object is no longer used. This method uses a promise to return the result. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @returns { Promise } Promise used to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 19100009 - Failed to operate the DLP file. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - closeDLPFile(): Promise; - - /** - * Closes the DLP file when the object is no longer used. This method uses an asynchronous callback to return the result. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { AsyncCallback } callback - Indicates the callback invoked to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100009 - Failed to operate the DLP file. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - closeDLPFile(callback: AsyncCallback): void; - } - - /** - * Generates a DLP file. This method uses a promise to return the result. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { number } plainTextFd Indicates the file descriptor of the file in plaintext. - * @param { number } cipherTextFd Indicates the file descriptor of the DLP file. - * @param { DLPProperty } property - Indicates the property of the DLP file. - * @returns { Promise } Returns a {@code DLPFile} object. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100002 - Credential task error. - * @throws { BusinessError } 19100003 - Credential task timed out. - * @throws { BusinessError } 19100004 - Credential service error. - * @throws { BusinessError } 19100005 - Remote credential server error. - * @throws { BusinessError } 19100009 - Failed to operate the DLP file. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - function generateDLPFile(plainTextFd: number, cipherTextFd: number, property: DLPProperty): Promise; - - /** - * Generates a DLP file. This method uses an asynchronous callback to return the result. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { number } plainTextFd Indicates the file descriptor of the file in plaintext. - * @param { number } cipherTextFd - Indicates the file descriptor of the DLP file. - * @param { DLPProperty } property Indicates the property of the DLP file. - * @param { AsyncCallback } callback - Indicates the callback invoked to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100002 - Credential task error. - * @throws { BusinessError } 19100003 - Credential task timed out. - * @throws { BusinessError } 19100004 - Credential service error. - * @throws { BusinessError } 19100005 - Remote credential server error. - * @throws { BusinessError } 19100009 - Failed to operate the DLP file. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - function generateDLPFile( - plainTextFd: number, - cipherTextFd: number, - property: DLPProperty, - callback: AsyncCallback - ): void; - - /** - * Opens a DLP file. This method uses a promise to return a {@code DLPFile} object. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { number } cipherTextFd - Indicates the file descriptor of the DLP file to open. - * @returns { Promise } Returns a {@code DLPFile} object. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100002 - Credential task error. - * @throws { BusinessError } 19100003 - Credential task timed out. - * @throws { BusinessError } 19100004 - Credential service error. - * @throws { BusinessError } 19100005 - Remote credential server error. - * @throws { BusinessError } 19100008 - Not DLP file. - * @throws { BusinessError } 19100009 - Failed to operate the DLP file. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - function openDLPFile(cipherTextFd: number): Promise; - - /** - * Opens a DLP file. This method uses an asynchronous callback to return a {@code DLPFile} object. - * - * @permission ohos.permission.ACCESS_DLP_FILE - * @param { number } cipherTextFd - Indicates the file descriptor of the DLP file to open. - * @param { AsyncCallback } callback - Indicates the callback invoked to return the result. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Non-system applications use system APIs. - * @throws { BusinessError } 401 - Parameter error. - * @throws { BusinessError } 19100001 - Invalid parameter value. - * @throws { BusinessError } 19100002 - Credential task error. - * @throws { BusinessError } 19100003 - Credential task timed out. - * @throws { BusinessError } 19100004 - Credential service error. - * @throws { BusinessError } 19100005 - Remote credential server error. - * @throws { BusinessError } 19100008 - Not DLP file. - * @throws { BusinessError } 19100009 - Failed to operate the DLP file. - * @throws { BusinessError } 19100011 - System service exception. - * @syscap SystemCapability.Security.DataLossPrevention - * @systemapi Hide this for inner system use. - * @since 10 - */ - function openDLPFile(cipherTextFd: number, callback: AsyncCallback): void; -} -export default dlpPermission; diff --git a/docs/README_zh.md b/docs/README_zh.md deleted file mode 100644 index 9779c7e0..00000000 --- a/docs/README_zh.md +++ /dev/null @@ -1,112 +0,0 @@ -# DLP权限管理部件 - -## 简介 - -数据防泄漏(DLP)是通过一系列安全保护技术,实现文档的权限管理功能,保证权限文档的安全性。 - -## 架构图 - -**图 1** DLP权限管理部件架构图 - -![](figures/zh-cn_image_dlp_struct.png) - -## 目录 - -``` -/base/security/dlp_permission_service -├── figures # README图片存放目录 -├── frameworks # 框架层,基础功能代码存放目录 -│   ├── access_config # 访问权限配置存放目录 -│   ├── common # 框架公共代码存放目录 -│   ├── dlp_permission # DLP权限管理框架代码存放目录 -│   └── test # 框架层测试代码存放目录 -├── interfaces # 接口层 -│   ├── inner_api # 内部接口层 -│   │   ├── dlp_fuse # link文件及用户态文件系统实现代码存放目录 -│   │   ├── dlp_parse # dlp文件代码存放目录 -│   │   └── dlp_permission # DLP权限管理内部接口代码存放目录 -│   └── kits # 外部接口层 -│   ├── dlp_permission # DLP权限管理外部接口代码存放目录 -│   └── napi_common # 外部接口公共代码存放目录 -├── services # 服务层 -│   └── dlp_permission # 服务层代码存放目录 -│   └── sa # 服务层代码存放目录 -│   ├── adapt # 数据适配相关代码存放目录 -│   ├── callback # 监听回调代码存放目录 -│   ├── etc # 配置文件存放目录 -│   ├── sa_common # 服务层公共代码存放目录 -│   ├── sa_main # DLP权限管理服务代码存放目录 -│   ├── sa_profile # DLP权限管理SA配置文件定义存放目录 -│   └── test # 服务层单元测试代码存放目录 -└── test # 模糊测试代码存放目录 -``` - -## 说明 - -### 接口说明 - -**表 1** DLP权限管理模块说明 -| **模块名** | **模块描述** | -| --- | --- | -|dlpPermission                                                                   |提供dlp权限管理模块方法| -||| - -**表 2** DLP权限管理模块类说明 - -| **类名** | **描述** | -| --- | --- | -|ActionFlagType                                                                |枚举DLP文件执行的操作类型| -|DLPFileAccess|枚举DLP文件的访问权限| -|DLPPermissionInfo|DLP文件的权限信息| -|AccessedDLPFileInfo|访问的DLP文件信息| -|RetentionSandboxInfo|保留沙箱信息| -|GatheringPolicyType|枚举DLP文件的收集策略类型| -|DLPSandboxInfo|已安装的DLP沙盒应用程序信息| -|DLPSandboxState|DLP沙箱状态| -|AccountType|枚举生成DLP文件时的帐户类型| -|AuthUser|授权用户信息| -|DLPProperty|DLP文件属性| -|DLPFile|DLP文件对象| -||| - -**表 3** DLP权限管理模块方法说明 -| **方法** | **描述** | -| --- | --- | -|isDLPFile(fd: number): Promise\;
isDLPFile(fd: number, callback: AsyncCallback\): void;|检查文件是否为DLP文件| -|getDLPPermissionInfo(): Promise\;
getDLPPermissionInfo(callback: AsyncCallback\): void;|获取该DLP文件的权限信息| -|getOriginalFileName(fileName: string): string;|从DLP文件名中获取原始文件名,此方法从DLP文件名中删除DLP文件扩展名| -|getDLPSuffix(): string;|获取DLP文件扩展名| -|on(type: 'openDLPFile', listener: Callback\): void;|订阅当前应用程序打开DLP文件时报告的事件| -|off(type: 'openDLPFile', listener?: Callback\): void;|取消订阅当前应用程序打开DLP文件时报告的事件| -|isInSandbox(): Promise\;
isInSandbox(callback: AsyncCallback\): void;|检查当前应用程序是否在DLP沙箱中| -|getDLPSupportedFileTypes(): Promise>;
getDLPSupportedFileTypes(callback: AsyncCallback>): void;|获取DLP支持的文件类型| -|setRetentionState(docUris: Array\): Promise\;
setRetentionState(docUris: Array\, callback: AsyncCallback\): void;|根据URI列表设置对应的文件的沙箱保留状态| -|cancelRetentionState(docUris: Array\): Promise\;
cancelRetentionState(docUris: Array\, callback: AsyncCallback\): void;|根据URI列表取消对应的文件的沙箱保留状态| -|getRetentionSandboxList(bundleName?: string): Promise>;
getRetentionSandboxList(bundleName: string, callback: AsyncCallback>): void;
getRetentionSandboxList(callback: AsyncCallback>): void;|获取DLP保留的沙箱应用信息| -|getDLPFileAccessRecords(): Promise>;
getDLPFileAccessRecords(callback: AsyncCallback>): void;|获取DLP文件的访问记录| -|getDLPGatheringPolicy(): Promise\;
getDLPGatheringPolicy(callback: AsyncCallback\): void;|获取DLP沙箱收集策略| -|installDLPSandbox(bundleName: string, access: DLPFileAccess, userId: number, uri: string): Promise\;
installDLPSandbox(bundleName: string, access: DLPFileAccess, userId: number, uri: string, callback: AsyncCallback\): void;|安装DLP沙箱应用程序| -|uninstallDLPSandbox(bundleName: string, userId: number, appIndex: number): Promise\;
uninstallDLPSandbox(bundleName: string, userId: number, appIndex: number, callback: AsyncCallback\): void;|卸载DLP沙箱应用程序| -|on(type: 'uninstallDLPSandbox', listener: Callback\): void;|订阅DLP沙箱应用卸载时上报的事件| -|off(type: 'uninstallDLPSandbox', listener?: Callback\): void;|取消订阅DLP沙箱应用卸载时上报的事件| -|generateDLPFile(plaintextFd: number, ciphertextFd: number, property: DLPProperty): Promise\;
generateDLPFile(plaintextFd: number, ciphertextFd: number, property: DLPProperty, callback: AsyncCallback\): void;|生成DLP文件| -|openDLPFile(ciphertextFd: number): Promise\;
openDLPFile(ciphertextFd: number, callback: AsyncCallback\): void;|打开DLP文件| -||| - -**表 3** DLPFile方法说明 -| **方法** | **描述** | -| --- | --- | -|addDLPLinkFile(linkFileName: string): Promise\;
addDLPLinkFile(linkFileName: string, callback: AsyncCallback\): void;|为DLP文件添加link文件| -|stopFuseLink(): Promise\;
stopFuseLink(callback: AsyncCallback\): void;|停止DLP文件与link文件之间的FUSE链接| -|resumeFuseLink(): Promise\;
resumeFuseLink(callback: AsyncCallback\): void;|恢复DLP文件与link文件之间的FUSE链接| -|replaceDLPLinkFile(linkFileName: string): Promise\;
replaceDLPLinkFile(linkFileName: string, callback: AsyncCallback\): void;|替换DLP文件的link文件| -|deleteDLPLinkFile(linkFileName: string): Promise\;
deleteDLPLinkFile(linkFileName: string, callback: AsyncCallback\): void;|删除DLP文件的link文件| -|recoverDLPFile(plaintextFd: number): Promise\;
recoverDLPFile(plaintextFd: number, callback: AsyncCallback\): void;|从DLP文件恢复明文文件| -|closeDLPFile(): Promise\;
closeDLPFile(callback: AsyncCallback\): void;|关闭DLP文件| -||| - -## 相关仓 - -DLP权限管理部件 - -**security\_dlp\_permission\_service** \ No newline at end of file diff --git a/docs/errorcodes-dlp.md b/docs/errorcodes-dlp.md deleted file mode 100644 index feabec22..00000000 --- a/docs/errorcodes-dlp.md +++ /dev/null @@ -1,353 +0,0 @@ -# DLP服务错误码 - - -> **说明:** -> 当前DLP中部分错误码为预留字段,接口调用时将不会返回错误码。错误码将在后续版本中支持。 - - -## 201 拒绝许可 - -**错误信息** - -The application does not have permission to use the api. - -**错误描述** - -应用没有权限访问当前接口,系统会产生此错误码。 - -**可能原因** - -应用没有申请当前接口所需的权限。 - -**处理步骤** - -请检查是否申请了接口所需对应权限。 - - -## 202 非系统应用 - -**错误信息** - -Non-system applications use system APIs. - -**错误描述** - -访问此接口的应用不是系统应用。 - -**可能原因** - -请求应用为非系统应用,此接口只提供给系统应用访问。 - -**处理步骤** - -申请成为系统应用。 - - -## 401 参数校验失败 - -**错误信息** - -Invalid input parameter. - -**错误描述** - -输入参数类型错误时,系统会产生此错误码。 - -**可能原因** - -1. 输入参数的类型错误 - -2. 输入参数的个数错误 - -3. 输入参数的数组大小错误 - -**处理步骤** - -请检查输入的参数。 - - -## 801 SystemCapability不支持 - -**错误信息** - -The specified SystemCapability name was not found. - -**错误描述** - -设备上指定的SystemCapability不支持。 - -**可能原因** - -设备上没有对应的SystemCapability。 - -**处理步骤** - -请确认设备上是否有对应的SystemCapability。 - - -## 19100001 入参错误 - -**错误信息** - -Invalid parameter. - -**错误描述** - -非法参数。 - -**可能原因** - -1. 账号长度为空或长度大于1024 - -2. 账号类型错误 - -3. aeskey或iv非法 - -4. 授权到期时间低于系统时间 - -5.Fd小于0 - -6. tokenid等于0 - -7. 包名为空 - -8. appinde小于0 - -9. userId小于0 - -**处理步骤** - -请传入正确的参数。 - - -## 19100002 加解密出错 - -**错误信息** - -Begin encryption or decryption error. - -**错误描述** - -启动加解密出错。 - -**可能原因** - -1. 当前运行的加解密任务数大于100 - -2. 加解密任务重复 - -**处理步骤** - -请等待一段时间后重试。 - - -## 19100003 加解密超时 - -**错误信息** - -Encryption or decryption timeout. - -**错误描述** - -加解密超时。 - -**可能原因** - -DLP文件加解密时间超过10秒。 - -**处理步骤** - -请等待一段时间后重试。 - - -## 19100004 凭据服务错误 - -**错误信息** - -Credential service error. - -**错误描述** - -凭据服务错误。 - -**可能原因** - -1.DLP凭据服务不存在 - -2.DLP凭据服务异常 - -**处理步骤** - -请等待一段时间后重试,或者重启设备。 - - -## 19100005 凭据认证服务器错误 - -**错误信息** - -Credential server error. - -**错误描述** - -凭据认证服务器错误。 - -**可能原因** - -1. 凭据认证服务器无法连接 - -2. 凭据认证服务器不存在 - -**处理步骤** - -请检查凭据认证服务器后重试。 - - -## 19100006 非DLP沙箱应用 - -**错误信息** - -No permission to invoke this api, it is for DLP sandbox app. - -**错误描述** - -调用方不是DLP沙箱应用。 - -**可能原因** - -调用方不是DLP沙箱应用。 - -**处理步骤** - -请确认调用场景后重试。 - - -## 19100007 需DLP沙箱应用 - -**错误信息** - -No permission to invoke this api, it is not for DLP sandbox app. - -**错误描述** - -调用方不可以是DLP沙箱应用。 - -**可能原因** - -调用方不可以是DLP沙箱应用。 - -**处理步骤** - -请确认调用场景后重试。 - - -## 19100008 非DLP文件 - -**错误信息** - -File is not DLP file. - -**错误描述** - -文件不是DLP文件。 - -**可能原因** - -操作非DLP文件格式文件 - -**处理步骤** - -请使用经过DLP加密的DLP文件。 - - -## 19100009 操作DLP文件失败 - -**错误信息** - -Operate DLP file fail. - -**错误描述** - -操作DLP文件失败。 - -**可能原因** - -1. 当前用户不在授权范围内 - -2. 安装沙箱应用失败 - -3. 关联link文件失败 - -4.打开DLP文件数大于1000 - -**处理步骤** - -step1:请确认访问权限 - -step2:请等待一段时间或重启后重试 - - -## 19100010 只读DLP文件 - -**错误信息** - -DLP file is read only. - -**错误描述** - -DLP文件只读。 - -**可能原因** - -1. 尝试去掉只读DLP文件的权限 - -2. 尝试写只读DLP文件 - -**处理步骤** - -1. 请确认文件权限 - - -## 19100011 系统服务工作异常 - -**错误信息** - -The system ability work abnormally. - -**错误描述** - -系统服务工作异常。 - -**可能原因** - -1. DLP权限服务无法正常启动; - -2. DLP权限服务的RPC对象无法获取; - -3. DLP权限服务依赖的其他服务无法正常启动; - -4. IPC数据读取写入失败; - -5. 服务未初始化; - -**处理步骤** - -系统服务内部工作异常,请稍后重试,或者重启设备尝试。 - - -## 19100012 内存申请失败 - -**错误信息** - -Out of memory. - -**错误描述** - -内存申请失败。 - -**可能原因** - -系统内存不足。 - -**处理步骤** - -系统内存不足,请稍后重试,或者重启设备。 diff --git a/docs/js-apis-dlppermission.md b/docs/js-apis-dlppermission.md deleted file mode 100644 index 1728be7a..00000000 --- a/docs/js-apis-dlppermission.md +++ /dev/null @@ -1,2717 +0,0 @@ -# \@ohos.dlpPermission (数据防泄漏) - - -数据防泄漏(DLP)是OpenHarmony提供的系统级的数据防泄漏解决方案,提供跨设备的文件的权限管理、加密存储、授权访问等能力。 - - -**起始版本:**10 - - -## 导入模块 - -``` -import dlpPermission from '@ohos.dlpPermission'; -``` - - -## ActionFlagType - -可以对DLP文件进行的操作类型枚举。例如:DLP沙箱应用可以根据是否具有操作权限,对其按钮进行置灰 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** - -| 名称 | 默认值 | 说明 | -| -------- | -------- | -------- | -| ACTION_VIEW | 0x00000001 | 表示文件的查看权限。 | -| ACTION_SAVE | 0x00000002 | 表示文件的保存权限。 | -| ACTION_SAVE_AS | 0x00000004 | 表示文件的另存为权限。 | -| ACTION_EDIT | 0x00000008 | 表示文件的编辑权限。 | -| ACTION_SCREEN_CAPTURE | 0x00000010 | 表示文件的截屏权限。 | -| ACTION_SCREEN_SHARE | 0x00000020 | 表示文件的共享屏幕权限。 | -| ACTION_SCREEN_RECORD | 0x00000040 | 表示文件的录屏权限。 | -| ACTION_COPY | 0x00000080 | 表示文件的复制权限。 | -| ACTION_PRINT | 0x00000100 | 表示文件的打印权限。 | -| ACTION_EXPORT | 0x00000200 | 表示文件的导出权限。 | -| ACTION_PERMISSION_CHANGE | 0x00000400 | 表示文件的修改文件权限。 | - - -## DLPFileAccess - -DLP文件授权类型的枚举。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** - -| 名称 | 默认值 | 说明 | -| -------- | -------- | -------- | -| NO_PERMISSION | 0 | 表示无文件权限。 | -| READ_ONLY | 1 | 表示文件的只读权限。 | -| CONTENT_EDIT | 2 | 表示文件的编辑权限。 | -| FULL_CONTROL | 3 | 表示文件的完全控制权限。 | - - -## DLPPermissionInfo - -表示DLP文件的权限信息。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -| 名称 | 类型 | 只读 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -------- | -| dlpFileAccess | [DLPFileAccess](#dlpfileaccess) | 否 | NA | 表示DLP文件针对用户的授权类型,例如:只读 | -| flags | number | 否 | NA | 表示DLP文件的详细操作权限,是不同[ActionFlagType](#actionflagtype)的组合。 | - - -## AccessedDLPFileInfo - -表示被打开的DLP文件的信息。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -| 名称 | 类型 | 只读 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -------- | -| uri | string | 否 | 是 | 表示DLP文件的uri。 | -| lastOpenTime | number | 否 | 是 | 表示DLP文最近打开时间。 | - - -## RetentionSandboxInfo - -保留沙箱的沙箱信息。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -| 名称 | 类型 | 只读 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -------- | -| appIndex | number | 否 | NA | 表示DLP沙箱应用索引。 | -| bundleName | string | 否 | NA | 表示应用包名。 | -| docUris | Array<string> | 否 | NA | 表示DLP文件的URI列表。 | - - -## isDLPFile - -isDLPFile(fd: number): Promise<boolean> - -根据文件的fd,查询该文件是否是DLP文件,使用Promise方式异步返回结果。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| fd | number | 是 | 文件的fd(file descriptor, 文件描述符)。 | - -**返回值:** -| 类型 | 说明 | -| -------- | -------- | -| Promise<boolean> | Promise对象。返回true表示是DLP文件,返回false表示非DLP文件。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; -import fs from '@ohos.file.fs'; - -async func(uri) { - let file = fs.openSync(uri); - try { - let res = await dlpPermission.isDLPFile(file.fd); // 是否加密DLP文件 - console.info('res', res); - } catch (err) { - console.error('error', err.code, err.message); // 失败报错 - } - fs.closeSync(file); -} -``` - - -## isDLPFile - -isDLPFile(fd: number, callback: AsyncCallback<boolean>): void - -根据文件的fd,查询该文件是否是DLP文件,使用callback方式异步返回结果。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| fd | number | 是 | 文件的fd。 | -| callback | AsyncCallback<boolean> | 是 | 回调函数。true表示是DLP文件,返回false表示非DLP文件。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; -import fs from '@ohos.file.fs'; - -async func(uri) { - let file = fs.openSync(uri); - try { - dlpPermission.isDLPFile(file.fd, (err, res) => { - if (err != undefined) { - console.error('isDLPFile error,', err.code, err.message); - } else { - console.info('res', res); - } - fs.closeSync(file); - }); - } catch (err) { - console.error('isDLPFile error,', err.code, err.message); - fs.closeSync(file); - } -} -``` - - -## getDLPPermissionInfo - -getDLPPermissionInfo(): Promise<DLPPermissionInfo> - -查询当前DLP沙箱的权限信息。使用Promise方式异步返回结果。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Promise<[DLPPermissionInfo](#dlppermissioninfo)> | Promise对象。返回查询的DLP文件的权限信息,无异常则表明查询成功。 | - - -**错误码:** - - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 19100001 | Invalid parameter value. | -| 19100006 | No permission to invoke this API, which is for DLP sandbox application. | -| 19100011 | System service exception. | - - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; -async func() { - try { - let inSandbox = await dlpPermission.isInSandbox(); // 是否在沙箱内 - if (inSandbox) { - let res: dlpPermission.DLPPermissionInfo = await dlpPermission.getDLPPermissionInfo(); // 获取当前权限信息 - console.info('res', JSON.stringify(res)); - } - } catch (err) { - console.error('error', err.code, err.message); // 失败报错 - } -} -``` - - -## getDLPPermissionInfo - -getDLPPermissionInfo(callback: AsyncCallback<DLPPermissionInfo>): void; - -查询当前DLP沙箱的权限信息。使用callback方式异步返回结果。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<[DLPPermissionInfo](#dlppermissioninfo)> | 是 | 查询当前DLP文件的权限。当查询成功时,err为undefined;否则为错误对象。 | - - -**错误码:** - - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100006 | No permission to invoke this API, which is for DLP sandbox application. | -| 19100011 | System service exception. | - - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; -import fs from '@ohos.file.fs'; - -async func() { - try { - let inSandbox = await dlpPermission.isInSandbox(); // 是否在沙箱内 - if (inSandbox) { - dlpPermission.getDLPPermissionInfo((err, res) => { - if (err != undefined) { - console.error('getDLPPermissionInfo error,', err.code, err.message); - } else { - console.info('res', JSON.stringify(res)); - } - }); // 获取当前权限信息 - } - } catch (err) { - console.error('getDLPPermissionInfo error,', err.code, err.message); - } -} -``` - - -## getOriginalFileName - -getOriginalFileName(fileName: string): string - -获取指定DLP文件名的原始文件名。接口为同步接口。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| fileName | string | 是 | 指定要查询的文件名。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| string | 返回DLP文件的原始文件名。例如:DLP文件名为test.txt.dlp,则返回的原始文件名为test.txt。 | - - -**错误码:** - - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 19100001 | Invalid parameter value. | -| 19100011 | System service exception. | - - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; -async func() { - try { - let res = dlpPermission.getOriginalFileName('test.txt.dlp'); // 获取原始文件名 - console.info('res', res); - } catch (err) { - console.error('error', err.code, err.message); // 失败报错 - } -} -``` - - -## getDLPSuffix - -getDLPSuffix(): string - -获取DLP文件扩展名。接口为同步接口。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| string | 返回DLP文件扩展名。例如:返回拓展名为".dlp",加密后的DLP文件名为"test.txt.dlp"。 | - - -**错误码:** - - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 19100011 | System service exception. | - - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; -async func() { - try { - let res = dlpPermission.getDLPSuffix(); // 获取DLP拓展名 - console.info('res', res); - } catch (err) { - console.error('error', err.code, err.message); // 失败报错 - } -} -``` - - -## on('openDLPFile') - -on(type: 'openDLPFile', listener: Callback<AccessedDLPFileInfo>): void - -监听打开DLP文件。在当前应用的沙箱应用打开DLP文件时,通知当前应用。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| type | string | 是 | 监听事件类型。'openDLPFile':打开DLP文件。 | -| listener | Callback<AccessedDLPFileInfo> | 是 | DLP文件打开事件的回调。在当前应用的沙箱应用打开DLP文件时,通知当前应用。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100007 | No permission to invoke this API, which is not for DLP sandbox application. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; -event(info: dlpPermission.VisitedDLPFileInfo) { - console.info('openDlpFile event', info.uri, info.recentOpenTime) -} -subscribe() { - try { - dlpPermission.on('openDLPFile', this.event); // 订阅 - } catch (err) { - console.error('error', err.code, err.message); // 失败报错 - } -} -async func() { - this.subscribe(); -} -``` - - -## off('openDLPFile') - -off(type: 'openDLPFile', listener?: Callback<AccessedDLPFileInfo>): void - -取消监听打开DLP文件。在当前应用的沙箱应用打开DLP文件时,取消通知当前应用。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| type | string | 是 | 监听事件类型。'openDLPFile':打开DLP文件。 | -| listener | Callback<AccessedDLPFileInfo> | 否 | DLP文件被打开的事件的回调。在当前应用的沙箱应用打开DLP文件时,取消通知当前应用。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100007 | No permission to invoke this API, which is not for DLP sandbox application. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; -event(info: dlpPermission.VisitedDLPFileInfo) { - console.info('openDlpFile event', info.uri, info.recentOpenTime) -} -unSubscribe() { - try { - dlpPermission.off('openDLPFile', this.event); // 取消订阅 - } catch (err) { - console.error('error', err.code, err.message); // 失败报错 - } -} -subscribe() { - try { - dlpPermission.on('openDLPFile', this.event); // 订阅 - } catch (err) { - console.error('error', err.code, err.message); // 失败报错 - } -} -async func() { - this.subscribe(); - this.unSubscribe(); -} -``` - - -## isInSandbox - -isInSandbox(): Promise<boolean> - -查询当前应用是否运行在DLP沙箱环境。使用Promise方式异步返回结果。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Promise<boolean> | Promise对象。返回当前应用是否运行在沙箱中。 | - - -**错误码:** - - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 19100001 | Invalid parameter value. | -| 19100011 | System service exception. | - - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; -async func() { - try { - let inSandbox = await dlpPermission.isInSandbox(); // 是否在沙箱内 - console.info('res', inSandbox); - } catch (err) { - console.error('error', err.code, err.message); // 失败报错 - } -} -``` - - -## isInSandbox - -isInSandbox(callback: AsyncCallback<boolean>): void - -查询当前应用是否运行在DLP沙箱环境。使用callback方式异步返回结果。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | 是 | 查询当前应用是否运行在沙箱中。当查询成功时,err为undefined;否则为错误对象。 | - - -**错误码:** - - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100011 | System service exception. | - - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; - -try { - dlpPermission.isInSandbox((err, data) => { - if (err) { - console.error('isInSandbox error,', err.code, err.message); - } else { - console.info('isInSandbox, data); - } - }); // 是否在沙箱内 -} catch (err) { - console.error('isInSandbox error,', err.code, err.message); -} -``` - - -## getDLPSupportedFileTypes - -getDLPSupportedFileTypes(): Promise<Array<string>> - -查询当前可支持权限设置和校验的文件扩展名类型列表。使用Promise方式异步返回结果。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Promise<Array<string>> | Promise对象。返回当前可支持权限设置和校验的文件扩展名类型列表。 | - - -**错误码:** - - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 19100001 | Invalid parameter value. | -| 19100011 | System service exception. | - - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; -async func() { - try { - let res = await dlpPermission.getDLPSupportedFileTypes(); // 获取支持DLP的文件类型 - console.info('res', JSON.stringify(res)); - } catch (err) { - console.error('error', err.code, err.message); // 失败报错 - } -} -``` - - -## getDLPSupportedFileTypes - -getDLPSupportedFileTypes(callback: AsyncCallback<Array<string>>): void - -查询当前可支持权限设置和校验的文件扩展名类型列表。使用callback方式异步返回结果。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<Array<string>> | 是 | 查询当前可支持权限设置和校验的文件扩展名类型列表。当查询成功时,err为undefined;否则为错误对象。 | - - -**错误码:** - - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100011 | System service exception. | - - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; - -async func() { - try { - dlpPermission.getDLPSupportedFileTypes((err, res) => { - if (err != undefined) { - console.error('getDLPSupportedFileTypes error,', err.code, err.message); - } else { - console.info('res', JSON.stringify(res)); - } - }); // 获取支持DLP的文件类型 - } catch (err) { - console.error('getDLPSupportedFileTypes error,', err.code, err.message); - } -} -``` - - - -## setRetentionState - -setRetentionState(docUris: Array<string>): Promise<void> - -设置沙箱保留状态。使用Promise方式异步返回结果。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| docUris | Array<string> | 是 | 表示需要设置保留状态的文件uri列表。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Promise<void> | Promise对象。无返回结果的Promise对象。 | - - -**错误码:** - - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100006 | No permission to invoke this API, which is for DLP sandbox application. | -| 19100011 | System service exception. | - - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; -async func(uri) { - try { - let inSandbox = await dlpPermission.isInSandbox(); // 是否在沙箱内 - if (inSandbox) { - await dlpPermission.setRetentionState([uri]); // 设置沙箱保留 - } - } catch (err) { - console.error('error', err.code, err.message); // 失败报错 - } -} -``` - - -## setRetentionState - -setRetentionState(docUris: Array<string>, callback: AsyncCallback<void>): void - -设置沙箱保留状态。使用callback方式异步返回结果。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| docUris | Array<string> | 是 | 表示需要设置保留状态的文件uri列表。 | -| callback | AsyncCallback<void> | 是 | 设置沙箱保留状态。当设置成功时,err为undefined;否则为错误对象。 | - - -**错误码:** - - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100006 | No permission to invoke this API, which is for DLP sandbox application. | -| 19100011 | System service exception. | - - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; - -async func(uri) { - try { - dlpPermission.setRetentionState([uri], (err, res) => { - if (err != undefined) { - console.error('setRetentionState error,', err.code, err.message); - } else { - console.info('setRetentionState success'); - } - }); // 设置沙箱保留 - } catch (err) { - console.error('setRetentionState error,', err.code, err.message); - } -} -``` - - - -## cancelRetentionState - -cancelRetentionState(docUris: Array<string>): Promise<void> - -取消沙箱保留状态。使用Promise方式异步返回结果。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Promise<void> | Promise对象。无返回结果的Promise对象。 | - - -**错误码:** - - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100011 | System service exception. | - - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' -async func(uri) { - try { - await dlpPermission.cancelRetentionState([uri]); // 取消沙箱保留 - } catch (err) { - console.error('error', err.code, err.message); // 失败报错 - } -} -``` - - -## cancelRetentionState - -cancelRetentionState(docUris: Array<string>, callback: AsyncCallback<void>): void - -取消沙箱保留状态。使用callback方式异步返回结果。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<void> | 是 | 取消沙箱保留状态。当设置成功时,err为undefined;否则为错误对象。 | - - -**错误码:** - - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100011 | System service exception. | - - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; - -async func(uri) { - try { - dlpPermission.cancelRetentionState([uri], (err, res) => { - if (err != undefined) { - console.error('cancelRetentionState error,', err.code, err.message); - } else { - console.info('cancelRetentionState success'); - } - }); // 取消沙箱保留 - } catch (err) { - console.error('cancelRetentionState error,', err.code, err.message); - } -} -``` - - - -## getRetentionSandboxList - -getRetentionSandboxList(bundleName?: string): Promise<Array<RetentionSandboxInfo>> - -查询指定应用的保留沙箱信息列表。使用Promise方式异步返回结果。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| bundleName | string | 否 | 指定应用包名。默认为空,查询当前应用的保留沙箱信息列表。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Promise<RetentionSandboxInfo> | Promise对象。返回查询的沙箱信息列表。 | - - -**错误码:** - - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100007 | No permission to invoke this API, which is not for DLP sandbox application. | -| 19100011 | System service exception. | - - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' -async func() { - try { - let res:Array = await dlpPermission.getRetentionSandboxList(); // 获取沙箱保留列表 - console.info('res', JSON.stringify(res)) - } catch (err) { - console.error('error', err.code, err.message); // 失败报错 - } -} -``` - - -## getRetentionSandboxList - -getRetentionSandboxList(bundleName: string, callback: AsyncCallback<Array<RetentionSandboxInfo>>): void - -查询指定应用的保留沙箱信息列表。使用callback方式异步返回结果。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| bundleName | string | 是 | 指定应用包名。 | -| callback | AsyncCallback<RetentionSandboxInfo> | 是 | 查询指定应用的沙箱信息列表。当设置成功时,err为undefined;否则为错误对象。 | - - -**错误码:** - - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100007 | No permission to invoke this API, which is not for DLP sandbox application. | -| 19100011 | System service exception. | - - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; - -async func(bundleName) { - try { - dlpPermission.getRetentionSandboxList(bundleName, (err, res) => { - if (err != undefined) { - console.error('getRetentionSandboxList error,', err.code, err.message); - } else { - console.info('res', JSON.stringify(res)); - } - }); // 获取沙箱保留列表 - } catch (err) { - console.error('getRetentionSandboxList error,', err.code, err.message); - } -} -``` - - -## getRetentionSandboxList - -getRetentionSandboxList(callback: AsyncCallback<Array<RetentionSandboxInfo>>): void - -查询指定应用的保留沙箱信息列表。使用callback方式异步返回结果。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<RetentionSandboxInfo> | 是 | 查询指定应用的沙箱信息列表。当设置成功时,err为undefined;否则为错误对象。 | - - -**错误码:** - - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100007 | No permission to invoke this API, which is not for DLP sandbox application. | -| 19100011 | System service exception. | - - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; - -async func() { - try { - dlpPermission.getRetentionSandboxList((err, res) => { - if (err != undefined) { - console.error('getRetentionSandboxList error,', err.code, err.message); - } else { - console.info('res', JSON.stringify(res)); - } - }); // 获取沙箱保留列表 - } catch (err) { - console.error('getRetentionSandboxList error,', err.code, err.message); - } -} -``` - - - -## getDLPFileAccessRecords - -getDLPFileAccessRecords(): Promise<AccessedDLPFileInfo> - -查询最近访问的DLP文件列表。使用Promise方式异步返回结果。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Promise<AccessedDLPFileInfo> | Promise对象。返回最近访问的DLP文件列表。 | - - -**错误码:** - - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 19100001 | Invalid parameter value. | -| 19100007 | No permission to invoke this API, which is not for DLP sandbox application. | -| 19100011 | System service exception. | - - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' -async func() { - try { - let res:Array = await dlpPermission.getDLPFileAccessRecords(); // 获取DLP访问列表 - console.info('res', JSON.stringify(res)) - } catch (err) { - console.error('error', err.code, err.message); // 失败报错 - } -} -``` - - - -## getDLPFileAccessRecords - -getDLPFileAccessRecords(callback: AsyncCallback<AccessedDLPFileInfo>): void - -查询最近访问的DLP文件列表。使用callback方式异步返回结果。 - -**起始版本:**10 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<AccessedDLPFileInfo> | 是 | 查询最近访问的DLP文件列表。当查询成功时,err为undefined;否则为错误对象。 | - - -**错误码:** - - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100007 | No permission to invoke this API, which is not for DLP sandbox application. | -| 19100011 | System service exception. | - - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; - -async func() { - try { - dlpPermission.getDLPFileAccessRecords((err, res) => { - if (err != undefined) { - console.error('getDLPFileAccessRecords error,', err.code, err.message); - } else { - console.info('res', JSON.stringify(res)); - } - }); // 获取DLP访问列表 - } catch (err) { - console.error('getDLPFileAccessRecords error,', err.code, err.message); - } -} -``` - - -## GatheringPolicyType - -DLP沙箱聚合策略类型的枚举。沙箱聚合表示同一权限类型的DLP文件,在同一个沙箱内打开,例如在同一个沙箱内使用不同tab页打开;沙箱非聚合表示不同DLP文件在不同沙箱打开。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** - -| 名称 | 默认值 | 说明 | -| -------- | -------- | -------- | -| GATHERING | 1 | 表示沙箱聚合。 | -| NON_GATHERING | 2 | 表示沙箱非聚合。 | - - -## getDLPGatheringPolicy - -getDLPGatheringPolicy(): Promise<GatheringPolicyType> - -查询DLP沙箱聚合策略。使用Promise方式异步返回结果。 - -**系统接口:** 此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Promise<GatheringPolicyType> | Promise对象。返回当前DLP沙箱聚合策略。 | - - -**错误码:** - - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 19100001 | Invalid parameter value. | -| 19100011 | System service exception. | - - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' - -async func() { - try { - let res: dlpPermission.GatheringPolicyType = await dlpPermission.getDLPGatheringPolicy(); // 获取沙箱聚合策略 - console.info('res', JSON.stringify(res)); - } catch (err) { - console.error('error', err.code, err.message); // 失败报错 - } -} -``` - - -## getDLPGatheringPolicy - -getDLPGatheringPolicy(callback: AsyncCallback<GatheringPolicyType>): void - -查询DLP沙箱聚合策略。使用callback方式异步返回结果。 - -**系统接口:** 此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<GatheringPolicyType> | 是 | 查询当前DLP沙箱聚合策略。当查询成功时,err为undefined;否则为错误对象。 | - - -**错误码:** - - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100011 | System service exception. | - - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; - -async func() { - try { - dlpPermission.getDLPGatheringPolicy((err, res) => { - if (err != undefined) { - console.error('getDLPGatheringPolicy error,', err.code, err.message); - } else { - console.info('res', JSON.stringify(res)); - } - }); // 获取沙箱聚合策略 - } catch (err) { - console.error('getDLPGatheringPolicy error,', err.code, err.message); - } -} -``` - - - -## DLPSandboxInfo - -表示DLP沙箱的信息。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -| 名称 | 类型 | 只读 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -------- | -| appIndex | number | 否 | 是 | 表示DLP沙箱号。 | -| tokenID | number | 否 | 是 | 表示DLP沙箱应用的tokenID。 | - - -## installDLPSandbox - -installDLPSandbox(bundleName: string, dlpFileAccess: DLPFileAccess, userId: number, uri: string): Promise<DLPSandboxInfo> - -安装一个应用的DLP沙箱。使用Promise方式异步返回结果返回应用沙箱信息。 - -**系统接口:** 此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| bundleName | string | 是 | 应用包名。 | -| dlpFileAccess | [DLPFileAccess](#dlpfileaccess) | 是 | DLP文件授权类型。 | -| userId | number | 是 | 当前的用户ID,通过帐号子系统获取的OS帐号ID,默认主用户ID:100。 | -| uri | string | 是 | DLP文件的URI。 | - -**返回值:** -| 类型 | 说明 | -| -------- | -------- | -| Promise<[DLPSandboxInfo](#dlpsandboxinfo)> | Promise对象。安装沙箱应用,返回应用沙箱信息。 | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' -async func(uri) { - try { - let res: dlpPermission.DLPSandboxInfo = await dlpPermission.installDLPSandbox('com.ohos.note', dlpPermission.DLPFileAccess.READ_ONLY, 100, uri); // 安装DLP沙箱 - console.info('res', JSON.stringify(res)); - } catch (err) { - console.error('error', err.code, err.message); // 失败报错 - } -} -``` - - -## installDLPSandbox - -installDLPSandbox(bundleName: string, dlpFileAccess: DLPFileAccess, userId: number, callback: AsyncCallback<DLPSandboxInfo>): void - -安装一个应用的DLP沙箱。使用callback方式异步返回应用沙箱信息。 - -**系统接口:** 此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| bundleName | string | 是 | 应用包名。 | -| dlpFileAccess | [DLPFileAccess](#dlpfileaccess) | 是 | DLP文件授权类型。 | -| userId | number | 是 | 当前的用户ID,通过帐号子系统获取的系帐号ID,默认主用户ID:100。 | -| uri | string | 是 | DLP文件的URI。 | -| callback | AsyncCallback<[DLPSandboxInfo](#dlpsandboxinfo)> | 是 | 获取应用沙箱信息的回调。 | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; - -async func(uri) { - try { - dlpPermission.installDLPSandbox('com.ohos.note', dlpPermission.DLPFileAccess.READ_ONLY, 100, uri, (err, res) => { - if (err != undefined) { - console.error('installDLPSandbox error,', err.code, err.message); - } else { - console.info('res', JSON.stringify(res)); - } - }); // 安装DLP沙箱 - } catch (err) { - console.error('installDLPSandbox error,', err.code, err.message); - } -} -``` - - -## uninstallDLPSandbox - -uninstallDLPSandbox(bundleName: string, userId: number, appIndex: number): Promise<void> - -卸载一个应用的DLP沙箱。使用Promise方式异步返回结果。 - -**系统接口:** 此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| bundleName | string | 是 | 应用包名。 | -| userId | number | 是 | 当前的用户ID,通过帐号子系统获取的系统帐号ID,默认主用户ID:100 | -| appIndex | number | 是 | DLP沙箱号。 | - -**返回值:** -| 类型 | 说明 | -| -------- | -------- | -| Promise<void> | Promise对象。无返回结果的Promise对象。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' -async func(uri) { - try { - let res: dlpPermission.DLPSandboxInfo = await dlpPermission.installDLPSandbox('com.ohos.note', dlpPermission.DLPFileAccess.READ_ONLY, 100, uri); // 安装DLP沙箱 - console.info('res', JSON.stringify(res)); - await dlpPermission.uninstallDLPSandbox('com.ohos.note', 100, res.appIndex); // 卸载DLP沙箱 - } catch (err) { - console.error('error', err.code, err.message); // 失败报错 - } -} -``` - - -## uninstallDLPSandbox - -uninstallDLPSandbox(bundleName: string, userId: number, appIndex: number, callback: AsyncCallback<void>): void - -卸载一个应用的DLP沙箱。使用callback方式异步返回结果。 - -**系统接口:** 此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| bundleName | string | 是 | 应用包名。 | -| userId | number | 是 | 当前的用户ID,通过帐号子系统获取的系统帐号ID,默认主用户ID:100。 | -| appIndex | number | 是 | DLP沙箱号,即installDLPSandbox接口调用成功后的返回值。 | -| callback | AsyncCallback<void> | 是 | 获取卸载结果的回调。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; - -async func(uri) { - try { - let res: dlpPermission.DLPSandboxInfo = await dlpPermission.installDLPSandbox('com.ohos.note', dlpPermission.DLPFileAccess.READ_ONLY, 100, uri); // 安装DLP沙箱 - console.info('res', JSON.stringify(res)); - dlpPermission.uninstallDLPSandbox('com.ohos.note', 100, res.appIndex, (err, res) => { - if (err != undefined) { - console.error('uninstallDLPSandbox error,', err.code, err.message); - } else { - console.info('res', JSON.stringify(res)); - } - }); - } catch (err) { - console.error('uninstallDLPSandbox error,', err.code, err.message); - } -} -``` - - -## DLPSandboxState - -DLP沙箱状态。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -| 名称 | 类型 | 只读 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -------- | -| bundleName | string | 否 | NA | 表示应用包名。 | -| userId | number | 否 | NA | 当前的用户ID,通过帐号子系统获取的OS帐号ID,默认主用户ID:100。 | -| appIndex | number | 否 | NA | 表示DLP沙箱应用索引。 | - - -## on('uninstallDLPSandbox') - -on(type: 'uninstallDLPSandbox', listener: Callback<DLPSandboxState>): void - -注册监听DLP沙箱卸载事件。 - -**系统接口:**此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| type | 'uninstallDLPSandbox' | 是 | 监听事件类型。 | -| listener | Callback<DLPSandboxState> | 是 | 沙箱应用卸载事件的回调。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' -event(info: dlpPermission.DLPSandboxState) { - console.info('uninstallDLPSandbox event', info.appIndex, info.bundleName) -} -subscribe() { - try { - dlpPermission.on('uninstallDLPSandbox', this.event); // 订阅 - } catch (err) { - console.error('error', err.code, err.message); // 失败报错 - } -} -async func() { - this.subscribe(); -} -``` - - - -## off('uninstallDLPSandbox') - -off(type: 'uninstallDLPSandbox', listener?: Callback<DLPSandboxState>): void - -取消监听DLP沙箱卸载事件。 - -**系统接口:**此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| type | 'uninstallDLPSandbox' | 是 | 监听事件类型。 | -| listener | Callback<DLPSandboxState> | 否 | 沙箱应用卸载事件的回调。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' -event(info: dlpPermission.DLPSandboxState) { - console.info('uninstallDLPSandbox event', info.appIndex, info.bundleName) -} -subscribe() { - try { - dlpPermission.on('uninstallDLPSandbox', this.event); // 订阅 - } catch (err) { - console.error('error', err.code, err.message); // 失败报错 - } -} -unSubscribe() { - try { - dlpPermission.off('uninstallDLPSandbox', this.event); // 取消订阅 - } catch (err) { - console.error('error', err.code, err.message); // 失败报错 - } -} -async func() { - this.subscribe(); - this.unSubscribe(); -} -``` - - - -## AccountType - -授权帐号类型的枚举。 - -**系统接口:**此接口为系统接口。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -| 名称 | 默认值 | 说明 | -| -------- | -------- | -------- | -| CLOUD_ACCOUNT | 1 | 表示云帐号。 | -| DOMAIN_ACCOUNT | 2 | 表示域帐号。 | - - -## AuthUser - -表示授权用户数据。 - -**系统接口:**此接口为系统接口。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -| 名称 | 类型 | 只读 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -------- | -| authAccount | string | 否 | 是 | 表示被授权用户帐号。 | -| authAccountType | [AccountType](#accounttype) | 否 | 是 | 表示被授权用户帐号类型。 | -| dlpFileAccess | [DLPFileAccess](#dlpfileaccess) | 否 | 是 | 表示被授予的权限。 | -| permExpiryTime | number | 否 | 是 | 表示授权到期时间。 | - - -## DLPProperty - -表示授权相关信息。 - -**系统接口:**此接口为系统接口。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -| 名称 | 类型 | 只读 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -------- | -| ownerAccount | string | 否 | 是 | 表示权限设置者帐号。 | -| ownerAccountID | string | 否 | 是 | 表示权限设置者帐号的ID。 | -| ownerAccountType | [AccountType](#accounttype) | 否 | 是 | 表示权限设置者帐号类型。 | -| authUserList | Array<[AuthUser](#authuser)> | 否 | 否 | 表示授权用户列表。 | -| contractAccount | string | 否 | 是 | 表示联系人帐号。 | -| offlineAccess | boolean | 否 | 是 | 表示是否是离线打开。 | -| everyoneAccessList | Array<[DLPFileAccess](#dlpfileaccess)> | 否 | 否 | 表示授予所有人的权限。 | - - -## DLPFile - -管理DLPFile的实例,表示一个DLP文件对象,需要通过generateDLPFile/openDLPFile 获取 DLPFile的示例。 - -**系统接口:**此接口为系统接口。 - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**属性:** - -| 名称 | 类型 | 只读 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -------- | -| dlpProperty | [DLPProperty](#dlpproperty) | 否 | 是 | 表示DLP文件授权相关信息 | - - -### addDLPLinkFile - -addDLPLinkFile(linkFileName: string): Promise<void> - -在FUSE文件系统(Filesystem in Userspace)添加link文件(FUSE文件系统中映射到密文的虚拟文件,对该文件的读写操作会同步到DLP文件)。使用Promise方式异步返回结果。 - -**系统接口:**此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| linkFileName | string | 是 | 用于fuse文件系统的link文件名。 | - -**返回值:** -| 类型 | 说明 | -| -------- | -------- | -| Promise<void> | Promise对象。无返回结果的Promise对象。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100009 | Operate DLP file fail. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' -import fs from '@ohos.file.fs'; -async func(uri) { - let file = fs.openSync(uri); - try { - let dlpFile: dlpPermission.DLPFile = await dlpPermission.openDLPFile(file.fd); // 打开DLP文件 - await dlpFile.addDLPLinkFile('test.txt.dlp.link'); // 添加link文件 - await dlpFile.closeDLPFile(); //关闭DLP对象 - } catch(err) { - console.error('error', err.code, err.message); // 失败报错 - } - fs.closeSync(file); -} -``` - - -### addDLPLinkFile - -addDLPLinkFile(linkFileName: string, callback: AsyncCallback<void>): void - -在FUSE中添加link文件,使用callback方式异步返回结果。 - -**系统接口:**此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| linkFileName | string | 是 | 用于fuse文件系统的link文件名。 | -| callback | AsyncCallback<void> | 是 | 获取添加结果的回调。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100009 | Operate DLP file fail. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; -import fs from '@ohos.file.fs'; -async func(uri) { - let file = fs.openSync(uri); - try { - let dlpFile: dlpPermission.DLPFile = await dlpPermission.openDLPFile(file.fd); // 打开DLP文件 - dlpFile.addDLPLinkFile('test.txt.dlp.link', (err, res) => { - if (err != undefined) { - console.error('addDLPLinkFile error,', err.code, err.message); - await dlpFile.closeDLPFile(); //关闭DLP对象 - } else { - console.info('res', JSON.stringify(res)); - } - }); - } catch (err) { - console.error('addDLPLinkFile error,', err.code, err.message); - } -} -``` - - - -### stopFuseLink - -stopFuseLink(): Promise<void>; - -停止FUSE关联读写。使用Promise方式异步返回结果。 - -**系统接口:**此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**返回值:** -| 类型 | 说明 | -| -------- | -------- | -| Promise<void> | Promise对象。无返回结果的Promise对象。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100009 | Operate DLP file fail. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' -import fs from '@ohos.file.fs'; -async func(uri) { - let file = fs.openSync(uri); - try { - let dlpFile: dlpPermission.DLPFile = await dlpPermission.openDLPFile(file.fd); // 打开DLP文件 - await dlpFile.addDLPLinkFile('test.txt.dlp.link'); // 添加link文件 - await dlpFile.stopFuseLink(); // 暂停link读写 - await dlpFile.closeDLPFile(); //关闭DLP对象 - } catch(err) { - console.error('error', err.code, err.message); // 失败报错 - } - fs.closeSync(file); -} -``` - - -### stopFuseLink - -stopFuseLink(callback: AsyncCallback<void>): void - -停止FUSE关联读写,使用callback方式异步返回结果。 - -**系统接口:**此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<void> | 是 | 获取添加结果的回调。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100009 | Operate DLP file fail. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; -import fs from '@ohos.file.fs'; -async func(uri) { - let file = fs.openSync(uri); - try { - let dlpFile: dlpPermission.DLPFile = await dlpPermission.openDLPFile(file.fd); // 打开DLP文件 - await dlpFile.addDLPLinkFile('test.txt.dlp.link'); // 添加link文件 - dlpFile.stopFuseLink((err, res) => { - if (err != undefined) { - console.error('stopFuseLink error,', err.code, err.message); - await dlpFile.closeDLPFile(); //关闭DLP对象 - } else { - console.info('res', JSON.stringify(res)); - } - }); - } catch (err) { - console.error('stopFuseLink error,', err.code, err.message); - } -} -``` - - - -### resumeFuseLink - -resumeFuseLink(): Promise<void> - -恢复FUSE关联读写。使用Promise方式异步返回结果。 - -**系统接口:**此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**返回值:** -| 类型 | 说明 | -| -------- | -------- | -| Promise<void> | Promise对象。无返回结果的Promise对象。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100009 | Operate DLP file fail. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' -import fs from '@ohos.file.fs'; -async func(uri) { - let file = fs.openSync(uri); - try { - let dlpFile: dlpPermission.DLPFile = await dlpPermission.openDLPFile(file.fd); // 打开DLP文件 - await dlpFile.addDLPLinkFile('test.txt.dlp.link'); // 添加link文件 - await dlpFile.stopFuseLink(); // 暂停link读写 - await dlpFile.resumeFuseLink(); // 恢复link读写 - await dlpFile.closeDLPFile(); //关闭DLP对象 - } catch(err) { - console.error('error', err.code, err.message); // 失败报错 - } - fs.closeSync(file); -} -``` - - -### resumeFuseLink - -resumeFuseLink(callback: AsyncCallback<void>): void - -恢复FUSE关联读写,使用callback方式异步返回结果。 - -**系统接口:**此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| linkFileName | string | 是 | 用于fuse文件系统的link文件名。 | -| callback | AsyncCallback<void> | 是 | 获取添加结果的回调。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100009 | Operate DLP file fail. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; -import fs from '@ohos.file.fs'; -async func(uri) { - let file = fs.openSync(uri); - try { - let dlpFile: dlpPermission.DLPFile = await dlpPermission.openDLPFile(file.fd); // 打开DLP文件 - await dlpFile.addDLPLinkFile('test.txt.dlp.link'); // 添加link文件 - await dlpFile.stopFuseLink(); // 暂停link读写 - dlpFile.resumeFuseLink((err, res) => { - if (err != undefined) { - console.error('resumeFuseLink error,', err.code, err.message); - await dlpFile.closeDLPFile(); //关闭DLP对象 - } else { - console.info('res', JSON.stringify(res)); - } - }); - } catch (err) { - console.error('resumeFuseLink error,', err.code, err.message); - } -} -``` - - - -### replaceDLPLinkFile - -replaceDLPLinkFile(linkFileName: string): Promise<void> - -替换link文件。使用Promise方式异步返回结果。 - -**系统接口:**此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| linkFileName | string | 是 | 用于fuse文件系统的link文件名。 | - -**返回值:** -| 类型 | 说明 | -| -------- | -------- | -| Promise<void> | Promise对象。无返回结果的Promise对象。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100009 | Operate DLP file fail. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' -import fs from '@ohos.file.fs'; -async func(uri) { - let file = fs.openSync(uri); - try { - let dlpFile: dlpPermission.DLPFile = await dlpPermission.openDLPFile(file.fd); // 打开DLP文件 - await dlpFile.addDLPLinkFile('test.txt.dlp.link'); // 添加link文件 - await dlpFile.stopFuseLink(); // 暂停link读写 - await dlpFile.replaceDLPLinkFile('test_new.txt.dlp.link'); // 替换link文件 - await dlpFile.resumeFuseLink(); // 恢复link读写 - await dlpFile.closeDLPFile(); //关闭DLP对象 - } catch(err) { - console.error('error', err.code, err.message); // 失败报错 - } - fs.closeSync(file); -} -``` - - - -### replaceDLPLinkFile - -replaceDLPLinkFile(linkFileName: string, callback: AsyncCallback<void>): void - -替换link文件,使用callback方式异步返回结果。 - -**系统接口:**此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| linkFileName | string | 是 | 用于fuse文件系统的link文件名。 | -| callback | AsyncCallback<void> | 是 | 获取添加结果的回调。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100009 | Operate DLP file fail. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; -import fs from '@ohos.file.fs'; -async func(uri) { - let file = fs.openSync(uri); - try { - let dlpFile: dlpPermission.DLPFile = await dlpPermission.openDLPFile(file.fd); // 打开DLP文件 - await dlpFile.addDLPLinkFile('test.txt.dlp.link'); // 添加link文件 - await dlpFile.stopFuseLink(); // 暂停link读写 - dlpFile.replaceDLPLinkFile('test_new.txt.dlp.link', (err, res) => { // 替换link文件 - if (err != undefined) { - console.error('replaceDLPLinkFile error,', err.code, err.message); - await dlpFile.closeDLPFile(); //关闭DLP对象 - } else { - console.info('res', JSON.stringify(res)); - await dlpFile.resumeFuseLink(); // 恢复link读写 - } - }); - } catch (err) { - console.error('error,', err.code, err.message); - } -} -``` - - - -### deleteDLPLinkFile - -deleteDLPLinkFile(linkFileName: string): Promise<void> - -删除fuse文件系统中创建的link文件。使用Promise方式异步返回结果。 - -**系统接口:**此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| linkFileName | string | 是 | 用于fuse文件系统的link文件名。 | - -**返回值:** -| 类型 | 说明 | -| -------- | -------- | -| Promise<void> | Promise对象。无返回结果的Promise对象。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100009 | Operate DLP file fail. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' -import fs from '@ohos.file.fs'; -async func(uri) { - let file = fs.openSync(uri); - try { - let dlpFile: dlpPermission.DLPFile = await dlpPermission.openDLPFile(file.fd); // 打开DLP文件 - await dlpFile.addDLPLinkFile('test.txt.dlp.link'); // 添加link文件 - await dlpFile.deleteDLPLinkFile('test.txt.dlp.link'); // 删除link文件 - await dlpFile.closeDLPFile(); //关闭DLP对象 - } catch(err) { - console.error('error', err.code, err.message); // 失败报错 - } - fs.closeSync(file); -} -``` - - -### deleteDLPLinkFile - -deleteDLPLinkFile(linkFileName: string, callback: AsyncCallback<void>): void - -删除link文件,使用callback方式异步返回结果。 - -**系统接口:**此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| linkFileName | string | 是 | 用于fuse文件系统的link文件名。 | -| callback | AsyncCallback<void> | 是 | 获取添加结果的回调。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100009 | Operate DLP file fail. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission'; -import fs from '@ohos.file.fs'; -async func(uri) { - let file = fs.openSync(uri); - try { - let dlpFile: dlpPermission.DLPFile = await dlpPermission.openDLPFile(file.fd); // 打开DLP文件 - await dlpFile.addDLPLinkFile('test.txt.dlp.link'); // 添加link文件 - dlpFile.deleteDLPLinkFile('test.txt.dlp.link', (err, res) => { // 删除link文件 - if (err != undefined) { - console.error('replaceDLPLinkFile error,', err.code, err.message); - await dlpFile.closeDLPFile(); //关闭DLP对象 - } else { - console.info('res', JSON.stringify(res)); - } - }); - } catch (err) { - console.error('error,', err.code, err.message); - } -} -``` - - - -### recoverDLPFile - -recoverDLPFile(plaintextFd: number): Promise<void>; - -移除DLP文件的权限控制,恢复成明文文件。使用Promise方式异步返回结果。 - -**系统接口:**此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| plaintextFd | number | 是 | 目标明文文件的fd。 | - -**返回值:** -| 类型 | 说明 | -| -------- | -------- | -| Promise<void> | Promise对象。无返回结果的Promise对象。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100002 | Credential task error. | -| 19100003 | Credential task timeout. | -| 19100004 | Credential service error. | -| 19100005 | Credential remote server error. | -| 19100008 | Not DLP file. | -| 19100009 | Operate DLP file fail. | -| 19100010 | DLP file is read only. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' -import fs from '@ohos.file.fs'; -async func(uri, destUri) { - let file = fs.openSync(uri); - let destFile = fs.openSync(destUri); - try { - let dlpFile: dlpPermission.DLPFile = await dlpPermission.openDLPFile(file.fd); // 打开DLP文件 - await dlpFile.recoverDLPFile(destFile.fd); // 还原DLP文件 - await dlpFile.closeDLPFile(); //关闭DLP对象 - } catch(err) { - console.error('error', err.code, err.message); // 失败报错 - } - fs.closeSync(file); - fs.closeSync(destFile); -} -``` - - -### recoverDLPFile - -recoverDLPFile(plaintextFd: number, callback: AsyncCallback<void>): void - -移除DLP文件的权限控制,恢复成明文文件,使用callback方式异步返回结果。 - -**系统接口:**此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| plaintextFd | number | 是 | 目标明文文件的fd。 | -| callback | AsyncCallback<void> | 是 | 获取添加结果的回调。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100002 | Credential task error. | -| 19100003 | Credential task timeout. | -| 19100004 | Credential service error. | -| 19100005 | Credential remote server error. | -| 19100008 | Not DLP file. | -| 19100009 | Operate DLP file fail. | -| 19100010 | DLP file is read only. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' -import fs from '@ohos.file.fs'; -async func(uri, destUri) { - let file = fs.openSync(uri); - let destFile = fs.openSync(destUri); - try { - let dlpFile: dlpPermission.DLPFile = await dlpPermission.openDLPFile(file.fd); // 打开DLP文件 - dlpFile.recoverDLPFile(destFile.fd, (err, res) => { // 还原DLP文件 - if (err != undefined) { - console.error('recoverDLPFile error,', err.code, err.message); - await dlpFile.closeDLPFile(); //关闭DLP对象 - } else { - console.info('res', JSON.stringify(res)); - } - }); - } catch (err) { - console.error('error,', err.code, err.message); - } -} -``` - - -### closeDLPFile - -closeDLPFile(): Promise<void> - -关闭DLPFile,释放对象。使用Promise方式异步返回结果。 - -**系统接口:**此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -> **说明:** -> dlpFile不再使用,应该关闭释放内存,且对象不应继续使用。 - -**返回值:** -| 类型 | 说明 | -| -------- | -------- | -| Promise<void> | Promise对象。无返回结果的Promise对象。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 19100009 | Operate DLP file fail. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' -import fs from '@ohos.file.fs'; -async func(uri) { - let file = fs.openSync(uri); - try { - let dlpFile: dlpPermission.DLPFile = await dlpPermission.openDLPFile(file.fd); // 打开DLP文件 - await dlpFile.closeDLPFile(); //关闭DLP对象 - } catch(err) { - console.error('error', err.code, err.message); // 失败报错 - } - fs.closeSync(file); -} -``` - - -### closeDLPFile - -closeDLPFile(callback: AsyncCallback<void>): void - -关闭DLPFile,释放对象,使用callback方式异步返回结果。 - -**系统接口:**此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -> **说明:** -> dlpFile不再使用,应该关闭释放内存,且对象不应继续使用。 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<void> | 是 | 获取添加结果的回调。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 19100001 | Invalid parameter value. | -| 19100009 | Operate DLP file fail. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' -import fs from '@ohos.file.fs'; -async func(uri) { - let file = fs.openSync(uri); - try { - let dlpFile: dlpPermission.DLPFile = await dlpPermission.openDLPFile(file.fd); // 打开DLP文件 - dlpFile.closeDLPFile((err, res) => { // 还原DLP文件 - if (err != undefined) { - console.error('closeDLPFile error,', err.code, err.message); - } else { - console.info('res', JSON.stringify(res)); - } - fs.closeSync(file); - }); - } catch (err) { - console.error('error,', err.code, err.message); - fs.closeSync(file); - } -} -``` - - -## generateDLPFile - -generateDLPFile(plaintextFd: number, ciphertextFd: number, property: DLPProperty): Promise<DLPFile> - -将明文文件加密生成权限受控文件,仅在授权列表内的用户可以打开,授权又分为完全控制权限和只读权限。获取DLPFile管理对象,使用Promise方式异步返回结果。 - -**系统接口:**此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| plaintextFd | number | 是 | 待加密明文文件的fd。 | -| ciphertextFd | number | 是 | 目标加密文件的fd。 | -| property | [DLPProperty](#dlpproperty) | 是 | 授权用户信息:授权用户列表、owner帐号、联系人帐号。 | - -**返回值:** -| 类型 | 说明 | -| -------- | -------- | -| Promise<[DLPFile](#dlpfile)> | Promise对象。返回对象表示成功生成DLP文件,返回null表示失败。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100002 | Credential task error. | -| 19100003 | Credential task timeout. | -| 19100004 | Credential service error. | -| 19100005 | Credential remote server error. | -| 19100009 | Operate DLP file fail. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' -import fs from '@ohos.file.fs'; -async func(uri, dlpUri) { - let file = fs.openSync(uri); - let dlp = fs.openSync(dlpUri); - try { - let dlpProperty: dlpPermission.DLPProperty = { - ownerAccount: 'zhangsan', - ownerAccountType: dlpPermission.AccountType.DOMAIN_ACCOUNT, - authUserList: [], - contactAccount: 'zhangsan', - offlineAccess: true, - ownerAccountID: 'xxxxxxx', - everyoneAccessList: [] - }; - let dlpFile: dlpPermission.DLPFile = await dlpPermission.generateDLPFile(file.fd, dlp.fd, dlpProperty); // 生成DLP文件 - await dlpFile.closeDLPFile(); //关闭DLP对象 - } catch(err) { - console.error('error', err.code, err.message); // 失败报错 - } - fs.closeSync(file); - fs.closeSync(dlp); -} -``` - - -## generateDLPFile - -generateDLPFile(plaintextFd: number, ciphertextFd: number, property: DLPProperty, callback: AsyncCallback<DLPFile>): void - -DLP管理应用调用该接口,将明文文件加密生成权限受控文件,仅在授权列表内的用户可以打开,授权又分为完全控制权限和只读权限。获取DLPFile管理对象,使用callback方式异步返回结果。 - -**系统接口:**此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| plaintextFd | number | 是 | 待加密明文文件的fd。 | -| ciphertextFd | number | 是 | 目标加密文件的fd。 | -| property | [DLPProperty](#dlpproperty) | 是 | 授权用户信息:授权用户列表、owner帐号、联系人帐号。 | -| callback | AsyncCallback<[DLPFile](#dlpfile)> | 是 | 回调函数。返回DLPFile对象。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100002 | Credential task error. | -| 19100003 | Credential task timeout. | -| 19100004 | Credential service error. | -| 19100005 | Credential remote server error. | -| 19100009 | Operate DLP file fail. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' -import fs from '@ohos.file.fs'; -async func(uri, dlpUri) { - let file = fs.openSync(uri); - let dlp = fs.openSync(dlpUri); - try { - let dlpProperty: dlpPermission.DLPProperty = { - ownerAccount: 'zhangsan', - ownerAccountType: dlpPermission.AccountType.DOMAIN_ACCOUNT, - authUserList: [], - contactAccount: 'zhangsan', - offlineAccess: true, - ownerAccountID: 'xxxxxxx', - everyoneAccessList: [] - }; - dlpPermission.generateDLPFile(file.fd, dlp.fd, dlpProperty, (err, res) => { // 生成DLP文件 - if (err != undefined) { - console.error('generateDLPFile error,', err.code, err.message); - } else { - console.info('res', JSON.stringify(res)); - } - }); - } catch (err) { - console.error('error,', err.code, err.message); - fs.closeSync(file); - } -} -``` - - -## openDLPFile - -openDLPFile(ciphertextFd: number): Promise<DLPFile> - -打开DLP文件。获取DLPFile管理对象,使用Promise方式异步返回结果。 - -**系统接口:**此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| ciphertextFd | number | 是 | 加密文件的fd。 | - -**返回值:** -| 类型 | 说明 | -| -------- | -------- | -| Promise<[DLPFile](#dlpfile)> | Promise对象。返回对象表示成功生成DLP文件,返回null表示失败。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100002 | Credential task error. | -| 19100003 | Credential task timeout. | -| 19100004 | Credential service error. | -| 19100005 | Credential remote server error. | -| 19100008 | Not DLP file. | -| 19100009 | Operate DLP file fail. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' -import fs from '@ohos.file.fs'; -async func(uri) { - let file = fs.openSync(uri); - try { - let dlpFile: dlpPermission.DLPFile = await dlpPermission.openDLPFile(file.fd); // 打开DLP文件 - await dlpFile.closeDLPFile(); //关闭DLP对象 - } catch(err) { - console.error('error', err.code, err.message); // 失败报错 - } - fs.closeSync(file); -} -``` - - -## openDLPFile - -openDLPFile(ciphertextFd: number, callback: AsyncCallback<DLPFile>): void - -DLP管理应用调用该接口,打开DLP文件。获取DLPFile管理对象,使用callback方式异步返回结果。 - -**系统接口:**此接口为系统接口。 - -**需要权限:**ohos.permission.ACCESS_DLP_FILE - -**系统能力:**SystemCapability.Security.DataLossPrevention - -**起始版本:**10 - -**参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| ciphertextFd | number | 是 | 加密文件的fd。 | -| callback | AsyncCallback<[DLPFile](#dlpfile)> | 是 | 回调函数。返回DLPFile对象。 | - -**错误码:** - -以下错误码的详细介绍请参见[DLP服务错误码](errorcodes-dlp.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 201 | Permission denied. | -| 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | -| 19100001 | Invalid parameter value. | -| 19100002 | Credential task error. | -| 19100003 | Credential task timeout. | -| 19100004 | Credential service error. | -| 19100005 | Credential remote server error. | -| 19100008 | Not DLP file. | -| 19100009 | Operate DLP file fail. | -| 19100011 | System service exception. | - -**示例:** -``` -import dlpPermission from '@ohos.dlpPermission' -import fs from '@ohos.file.fs'; -async func(uri) { - let file = fs.openSync(uri); - try { - dlpPermission.openDLPFile(file.fd, (err, res) => { // 打开DLP文件 - if (err != undefined) { - console.error('openDLPFile error,', err.code, err.message); - } else { - console.info('res', JSON.stringify(res)); - } - }); - } catch (err) { - console.error('error,', err.code, err.message); - fs.closeSync(file); - } -} -``` - - diff --git a/xts/AppScope/app.json b/xts/AppScope/app.json deleted file mode 100644 index de02c730..00000000 --- a/xts/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.dlp_xts", - "vendor": "huawei", - "versionCode": 1000000, - "versionName": "1.0.0", - "debug": false, - "icon": "$media:icon", - "label": "$string:app_name", - "description": "$string:description_application", - "distributedNotificationEnabled": true, - "keepAlive": true, - "singleUser": true, - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} \ No newline at end of file diff --git a/xts/AppScope/resources/base/element/string.json b/xts/AppScope/resources/base/element/string.json deleted file mode 100644 index 633100a6..00000000 --- a/xts/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string":[ - { - "name":"app_name", - "value":"ohosProject" - } - ] -} \ No newline at end of file diff --git a/xts/AppScope/resources/base/media/app_icon.png b/xts/AppScope/resources/base/media/app_icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6790 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 { - if (err.code) { - console.error('Failed to load the content. Cause:' + JSON.stringify(err)); - return; - } - console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) - }); - - globalThis.abilityContext = this.context; - } - - onWindowStageDestroy() { - console.log('TestAbility onWindowStageDestroy') - } - - onForeground() { - console.log('TestAbility onForeground') - } - - onBackground() { - console.log('TestAbility onBackground') - } -}; \ No newline at end of file diff --git a/xts/entry/src/main/ets/TestAbility/pages/index.ets b/xts/entry/src/main/ets/TestAbility/pages/index.ets deleted file mode 100644 index 441f2405..00000000 --- a/xts/entry/src/main/ets/TestAbility/pages/index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2023 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 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/xts/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/xts/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100644 index 09ab7f05..00000000 --- a/xts/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,79 +0,0 @@ -// @ts-nocheck -/** - * Copyright (c) 2023 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.app.ability.abilityDelegatorRegistry' - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -function translateParamsToString(parameters) { - const keySet = new Set([ - '-s class', '-s notClass', '-s suite', '-s it', - '-s level', '-s testType', '-s size', '-s timeout', - '-s dryRun' - ]) - let targetParams = ''; - for (const key in parameters) { - if (keySet.has(key)) { - targetParams = `${targetParams} ${key} ${parameters[key]}` - } - } - return targetParams.trim() -} - -async function onAbilityCreateCallback() { - console.log("onAbilityCreateCallback"); -} - -async function addAbilityMonitorCallback(err: any) { - console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - console.info("OpenHarmonyTestRunner OnPrepare ") - } - - async onRun() { - console.log('OpenHarmonyTestRunner onRun run') - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a com.ohos.dlp_xts.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName - cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) - var debug = abilityDelegatorArguments.parameters["-D"] - if (debug == 'true') - { - cmd += ' -D' - } - console.info('cmd : '+cmd) - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - 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/xts/entry/src/main/ets/common/utils.ets b/xts/entry/src/main/ets/common/utils.ets deleted file mode 100644 index 25abea7a..00000000 --- a/xts/entry/src/main/ets/common/utils.ets +++ /dev/null @@ -1,16 +0,0 @@ - -function terminateSelfWithResult(resultCode: number, info?): void { - let abilityResult = { - resultCode: resultCode, - want: { - parameters: { - info: info - } - }, - }; - globalThis.context.terminateSelfWithResult(abilityResult); -} - -export { - terminateSelfWithResult -}; diff --git a/xts/entry/src/main/ets/getDLPFileAccessRecordscallback/GetDLPFileAccessRecordsCallback.ets b/xts/entry/src/main/ets/getDLPFileAccessRecordscallback/GetDLPFileAccessRecordsCallback.ets deleted file mode 100644 index 6e3dd94a..00000000 --- a/xts/entry/src/main/ets/getDLPFileAccessRecordscallback/GetDLPFileAccessRecordsCallback.ets +++ /dev/null @@ -1,43 +0,0 @@ -import AbilityConstant from '@ohos.app.ability.AbilityConstant'; -import hilog from '@ohos.hilog'; -import UIAbility from '@ohos.app.ability.UIAbility'; -import Want from '@ohos.app.ability.Want'; -import window from '@ohos.window'; -import dlpPermission from '@ohos.dlpPermission'; -import {terminateSelfWithResult} from '../common/utils'; - -const TAG = "DLP_XTS_GetDLPFileAccessRecordsCallback"; - -export default class GetDLPFileAccessRecordsCallback extends UIAbility { - onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { - globalThis.context = this.context; - } - - onDestroy() { - } - - onWindowStageCreate(windowStage: window.WindowStage) { - // Main window is created, set main page for this ability - dlpPermission.getDLPFileAccessRecords(async (error, data) => { - if (error) { - console.error(TAG, "getDLPFileAccessRecords callback fail", error.code, error.message); - terminateSelfWithResult(error.code); - } else { - console.info(TAG, "getDLPFileAccessRecords callback pass"); - terminateSelfWithResult(0); - } - }); - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - } - - onForeground() { - // Ability has brought to foreground - } - - onBackground() { - // Ability has back to background - } -} diff --git a/xts/entry/src/main/ets/getDLPFileAccessRecordspromise/GetDLPFileAccessRecordsPromise.ets b/xts/entry/src/main/ets/getDLPFileAccessRecordspromise/GetDLPFileAccessRecordsPromise.ets deleted file mode 100644 index 33820ae3..00000000 --- a/xts/entry/src/main/ets/getDLPFileAccessRecordspromise/GetDLPFileAccessRecordsPromise.ets +++ /dev/null @@ -1,42 +0,0 @@ -import AbilityConstant from '@ohos.app.ability.AbilityConstant'; -import hilog from '@ohos.hilog'; -import UIAbility from '@ohos.app.ability.UIAbility'; -import Want from '@ohos.app.ability.Want'; -import window from '@ohos.window'; -import dlpPermission from '@ohos.dlpPermission'; -import {terminateSelfWithResult} from '../common/utils'; - -const TAG = "DLP_XTS_GetDLPFileAccessRecordsPromise"; - -export default class GetDLPFileAccessRecordsPromise extends UIAbility { - onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { - globalThis.context = this.context; - } - - onDestroy() { - } - - async onWindowStageCreate(windowStage: window.WindowStage) { - // Main window is created, set main page for this ability - try { - var date = await dlpPermission.getDLPFileAccessRecords(); - console.info(TAG, "getDLPFileAccessRecords promise pass"); - terminateSelfWithResult(0); - } catch (error) { - console.error(TAG, "getDLPFileAccessRecords promise fail", error.code, error.message); - terminateSelfWithResult(error.code); - } - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - } - - onForeground() { - // Ability has brought to foreground - } - - onBackground() { - // Ability has back to background - } -} diff --git a/xts/entry/src/main/ets/getRetentionSandboxListcallback/GetRetentionSandboxListCallback.ets b/xts/entry/src/main/ets/getRetentionSandboxListcallback/GetRetentionSandboxListCallback.ets deleted file mode 100644 index 47a7156e..00000000 --- a/xts/entry/src/main/ets/getRetentionSandboxListcallback/GetRetentionSandboxListCallback.ets +++ /dev/null @@ -1,43 +0,0 @@ -import AbilityConstant from '@ohos.app.ability.AbilityConstant'; -import hilog from '@ohos.hilog'; -import UIAbility from '@ohos.app.ability.UIAbility'; -import Want from '@ohos.app.ability.Want'; -import window from '@ohos.window'; -import dlpPermission from '@ohos.dlpPermission'; -import {terminateSelfWithResult} from '../common/utils'; - -const TAG = "DLP_XTS_GetRetentionSandboxListCallback"; - -export default class GetRetentionSandboxListCallback extends UIAbility { - onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { - globalThis.context = this.context; - } - - onDestroy() { - } - - onWindowStageCreate(windowStage: window.WindowStage) { - // Main window is created, set main page for this ability - dlpPermission.getRetentionSandboxList(async (error, dlpPermInfo) => { - if (error) { - console.error(TAG, "getRetentionSandboxList callback fail", error.code, error.message); - terminateSelfWithResult(error.code); - } else { - console.info(TAG, "getRetentionSandboxList callback pass"); - terminateSelfWithResult(0, dlpPermInfo); - } - }); - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - } - - onForeground() { - // Ability has brought to foreground - } - - onBackground() { - // Ability has back to background - } -} diff --git a/xts/entry/src/main/ets/getRetentionSandboxListpromise/GetRetentionSandboxListPromise.ets b/xts/entry/src/main/ets/getRetentionSandboxListpromise/GetRetentionSandboxListPromise.ets deleted file mode 100644 index 9be5c062..00000000 --- a/xts/entry/src/main/ets/getRetentionSandboxListpromise/GetRetentionSandboxListPromise.ets +++ /dev/null @@ -1,42 +0,0 @@ -import AbilityConstant from '@ohos.app.ability.AbilityConstant'; -import hilog from '@ohos.hilog'; -import UIAbility from '@ohos.app.ability.UIAbility'; -import Want from '@ohos.app.ability.Want'; -import window from '@ohos.window'; -import dlpPermission from '@ohos.dlpPermission'; -import {terminateSelfWithResult} from '../common/utils'; - -const TAG = "DLP_XTS_GetRetentionSandboxListPromise"; - -export default class GetRetentionSandboxListPromise extends UIAbility { - onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { - globalThis.context = this.context; - } - - onDestroy() { - } - - async onWindowStageCreate(windowStage: window.WindowStage) { - // Main window is created, set main page for this ability - try { - var date = await dlpPermission.getDLPFileAccessRecords(); - console.info(TAG, "GetRetentionSandboxListPromise promise pass"); - terminateSelfWithResult(0); - } catch (error) { - console.error(TAG, "GetRetentionSandboxListPromise promise fail", error.code, error.message); - terminateSelfWithResult(error.code); - } - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - } - - onForeground() { - // Ability has brought to foreground - } - - onBackground() { - // Ability has back to background - } -} diff --git a/xts/entry/src/main/ets/getdlppermissioninfocallback/GetDLPPermissionInfoCallback.ets b/xts/entry/src/main/ets/getdlppermissioninfocallback/GetDLPPermissionInfoCallback.ets deleted file mode 100644 index dfe83735..00000000 --- a/xts/entry/src/main/ets/getdlppermissioninfocallback/GetDLPPermissionInfoCallback.ets +++ /dev/null @@ -1,43 +0,0 @@ -import AbilityConstant from '@ohos.app.ability.AbilityConstant'; -import hilog from '@ohos.hilog'; -import UIAbility from '@ohos.app.ability.UIAbility'; -import Want from '@ohos.app.ability.Want'; -import window from '@ohos.window'; -import dlpPermission from '@ohos.dlpPermission'; -import {terminateSelfWithResult} from '../common/utils'; - -const TAG = "GetDLPPermissionInfoCallback"; - -export default class GetDLPPermissionInfoCallback extends UIAbility { - onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { - globalThis.context = this.context; - } - - onDestroy() { - } - - onWindowStageCreate(windowStage: window.WindowStage) { - // Main window is created, set main page for this ability - dlpPermission.getDLPPermissionInfo(async (error, dlpPermInfo) => { - if (error) { - console.error(TAG, "getDLPPermissionInfo callback fail", error.code, error.message); - terminateSelfWithResult(error.code); - } else { - console.info(TAG, "getDLPPermissionInfo callback pass"); - terminateSelfWithResult(0); - } - }); - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - } - - onForeground() { - // Ability has brought to foreground - } - - onBackground() { - // Ability has back to background - } -} diff --git a/xts/entry/src/main/ets/getdlppermissioninfopromise/GetDLPPermissionInfoPromise.ets b/xts/entry/src/main/ets/getdlppermissioninfopromise/GetDLPPermissionInfoPromise.ets deleted file mode 100644 index 81590e5b..00000000 --- a/xts/entry/src/main/ets/getdlppermissioninfopromise/GetDLPPermissionInfoPromise.ets +++ /dev/null @@ -1,42 +0,0 @@ -import AbilityConstant from '@ohos.app.ability.AbilityConstant'; -import hilog from '@ohos.hilog'; -import UIAbility from '@ohos.app.ability.UIAbility'; -import Want from '@ohos.app.ability.Want'; -import window from '@ohos.window'; -import dlpPermission from '@ohos.dlpPermission'; -import {terminateSelfWithResult} from '../common/utils'; - -const TAG = "GetDLPPermissionInfoPromise"; - -export default class GetDLPPermissionInfoPromise extends UIAbility { - onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { - globalThis.context = this.context; - } - - onDestroy() { - } - - async onWindowStageCreate(windowStage: window.WindowStage) { - // Main window is created, set main page for this ability - try { - var dlpPermInfo = await dlpPermission.getDLPPermissionInfo(); - console.info(TAG, "getDLPPermissionInfo promise pass"); - terminateSelfWithResult(0, dlpPermInfo); - } catch (error) { - console.error(TAG, "getDLPPermissionInfo promise fail", error.code, error.message); - terminateSelfWithResult(error.code); - } - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - } - - onForeground() { - // Ability has brought to foreground - } - - onBackground() { - // Ability has back to background - } -} diff --git a/xts/entry/src/main/ets/isinsandboxcallback/IsInSandboxCallback.ets b/xts/entry/src/main/ets/isinsandboxcallback/IsInSandboxCallback.ets deleted file mode 100644 index 3dacb174..00000000 --- a/xts/entry/src/main/ets/isinsandboxcallback/IsInSandboxCallback.ets +++ /dev/null @@ -1,48 +0,0 @@ -import AbilityConstant from '@ohos.app.ability.AbilityConstant'; -import hilog from '@ohos.hilog'; -import UIAbility from '@ohos.app.ability.UIAbility'; -import Want from '@ohos.app.ability.Want'; -import window from '@ohos.window'; -import dlpPermission from '@ohos.dlpPermission'; -import {terminateSelfWithResult} from '../common/utils'; - -const TAG = "IsInSandboxPromise"; - -export default class IsInSandboxCallback extends UIAbility { - onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { - globalThis.context = this.context; - } - - onDestroy() { - } - - onWindowStageCreate(windowStage: window.WindowStage) { - // Main window is created, set main page for this ability - dlpPermission.isInSandbox(async (error, isInSandbox) => { - if (error) { - console.error(TAG, "isInSandbox callback fail", error.code, error.message); - terminateSelfWithResult(error.code); - } else { - if (isInSandbox == true) { - console.info(TAG, "isInSandbox callback pass"); - terminateSelfWithResult(0); - } else { - console.error(TAG, "isInSandbox callback fail"); - terminateSelfWithResult(-1); - } - } - }); - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - } - - onForeground() { - // Ability has brought to foreground - } - - onBackground() { - // Ability has back to background - } -} diff --git a/xts/entry/src/main/ets/isinsandboxpromise/IsInSandboxPromise.ets b/xts/entry/src/main/ets/isinsandboxpromise/IsInSandboxPromise.ets deleted file mode 100644 index e516e877..00000000 --- a/xts/entry/src/main/ets/isinsandboxpromise/IsInSandboxPromise.ets +++ /dev/null @@ -1,47 +0,0 @@ -import AbilityConstant from '@ohos.app.ability.AbilityConstant'; -import hilog from '@ohos.hilog'; -import UIAbility from '@ohos.app.ability.UIAbility'; -import Want from '@ohos.app.ability.Want'; -import window from '@ohos.window'; -import dlpPermission from '@ohos.dlpPermission'; -import {terminateSelfWithResult} from '../common/utils'; - -const TAG = "IsInSandboxPromise"; - -export default class IsInSandboxPromise extends UIAbility { - onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { - globalThis.context = this.context; - } - - onDestroy() { - } - - async onWindowStageCreate(windowStage: window.WindowStage) { - // Main window is created, set main page for this ability - try { - var isInSandbox = await dlpPermission.isInSandbox(); - if (isInSandbox == true) { - console.info(TAG, "isInSandbox promise pass"); - terminateSelfWithResult(0); - } else { - console.error(TAG, "isInSandbox promise fail"); - terminateSelfWithResult(-1); - } - } catch (error) { - console.error(TAG, "isInSandbox promise fail", error.code, error.message); - terminateSelfWithResult(error.code); - } - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - } - - onForeground() { - // Ability has brought to foreground - } - - onBackground() { - // Ability has back to background - } -} diff --git a/xts/entry/src/main/ets/onopendlpfile/OnOpenDlpFile.ets b/xts/entry/src/main/ets/onopendlpfile/OnOpenDlpFile.ets deleted file mode 100644 index 57b486bc..00000000 --- a/xts/entry/src/main/ets/onopendlpfile/OnOpenDlpFile.ets +++ /dev/null @@ -1,41 +0,0 @@ -import AbilityConstant from '@ohos.app.ability.AbilityConstant'; -import hilog from '@ohos.hilog'; -import UIAbility from '@ohos.app.ability.UIAbility'; -import Want from '@ohos.app.ability.Want'; -import window from '@ohos.window'; -import dlpPermission from '@ohos.dlpPermission'; -import {terminateSelfWithResult} from '../common/utils'; - -const TAG = "OnOpenDlpFile"; - -export default class OnOpenDlpFile extends UIAbility { - onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { - globalThis.context = this.context; - } - - onDestroy() { - } - - onWindowStageCreate(windowStage: window.WindowStage) { - // Main window is created, set main page for this ability - let func = (dlpFileInfo) => {} - try { - dlpPermission.on('openDLPFile', func); - terminateSelfWithResult(0); - } catch (err) { - terminateSelfWithResult(err.code); - } - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - } - - onForeground() { - // Ability has brought to foreground - } - - onBackground() { - // Ability has back to background - } -} diff --git a/xts/entry/src/main/ets/setRetentionStatecallback/SetRetentionStateCallback.ets b/xts/entry/src/main/ets/setRetentionStatecallback/SetRetentionStateCallback.ets deleted file mode 100644 index 099b2988..00000000 --- a/xts/entry/src/main/ets/setRetentionStatecallback/SetRetentionStateCallback.ets +++ /dev/null @@ -1,49 +0,0 @@ -import AbilityConstant from '@ohos.app.ability.AbilityConstant'; -import hilog from '@ohos.hilog'; -import UIAbility from '@ohos.app.ability.UIAbility'; -import Want from '@ohos.app.ability.Want'; -import window from '@ohos.window'; -import dlpPermission from '@ohos.dlpPermission'; -import {terminateSelfWithResult} from '../common/utils'; - -const TAG = "DLP_XTS_SetRetentionStateCallback"; - -export default class SetRetentionStateCallback extends UIAbility { - onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { - globalThis.context = this.context; - globalThis.want = want; - } - - onDestroy() { - } - - onWindowStageCreate(windowStage: window.WindowStage) { - // Main window is created, set main page for this ability - var success = globalThis.want.parameters['ohos.dlp.params.success']; - var uriArray=[]; - if(success){ - uriArray = ['uri']; - } - dlpPermission.setRetentionState(uriArray,async (error, data) => { - if (error) { - console.error(TAG, "SetRetentionState callback fail", error.code, error.message); - terminateSelfWithResult(error.code); - } else { - console.info(TAG, "SetRetentionState callback pass"); - terminateSelfWithResult(0); - } - }); - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - } - - onForeground() { - // Ability has brought to foreground - } - - onBackground() { - // Ability has back to background - } -} diff --git a/xts/entry/src/main/ets/setRetentionStatepromise/SetRetentionStatePromise.ets b/xts/entry/src/main/ets/setRetentionStatepromise/SetRetentionStatePromise.ets deleted file mode 100644 index a06ec5c1..00000000 --- a/xts/entry/src/main/ets/setRetentionStatepromise/SetRetentionStatePromise.ets +++ /dev/null @@ -1,48 +0,0 @@ -import AbilityConstant from '@ohos.app.ability.AbilityConstant'; -import hilog from '@ohos.hilog'; -import UIAbility from '@ohos.app.ability.UIAbility'; -import Want from '@ohos.app.ability.Want'; -import window from '@ohos.window'; -import dlpPermission from '@ohos.dlpPermission'; -import {terminateSelfWithResult} from '../common/utils'; - -const TAG = "DLP_XTS_SetRetentionStatePromise"; - -export default class SetRetentionStatePromise extends UIAbility { - onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { - globalThis.context = this.context; - globalThis.want = want; - } - - onDestroy() { - } - - async onWindowStageCreate(windowStage: window.WindowStage) { - // Main window is created, set main page for this ability - var success = globalThis.want.parameters['ohos.dlp.params.success']; - var uriArray=[]; - if(success){ - uriArray = ['uri']; - } - try { - await dlpPermission.setRetentionState(uriArray); - console.info(TAG, "SetRetentionState promise pass"); - terminateSelfWithResult(0); - } catch (error) { - console.error(TAG, "SetRetentionState promise fail", error.code, error.message); - terminateSelfWithResult(error.code); - } - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - } - - onForeground() { - // Ability has brought to foreground - } - - onBackground() { - // Ability has back to background - } -} diff --git a/xts/entry/src/main/ets/test/DlpTest.test.ets b/xts/entry/src/main/ets/test/DlpTest.test.ets deleted file mode 100644 index 8fb7f189..00000000 --- a/xts/entry/src/main/ets/test/DlpTest.test.ets +++ /dev/null @@ -1,1590 +0,0 @@ -/** - * Copyright (c) 2023 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 dlpPermission from '@ohos.dlpPermission'; -import fs from '@ohos.file.fs'; -import account from '@ohos.account.distributedAccount' -import account_osAccount from '@ohos.account.osAccount'; -import type Want from '@ohos.app.ability.Want'; -import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from '@ohos/hypium' -import bundle from '@ohos.bundle'; - -var DLPErrCode = { - DLP_OK: 0, - ERR_JS_PERMISSION_DENY: 201, - ERR_JS_NOT_SYSTEM_APP: 202, - ERR_JS_PARAMETER_ERROR: 401, - ERR_JS_INVALID_PARAMETER: 19100001, - ERR_JS_BEGIN_CREDENTIAL_FAIL: 19100002, - ERR_JS_CREDENTIAL_TIMEOUT: 19100003, - ERR_JS_CREDENTIAL_SERVICE_ERROR: 19100004, - ERR_JS_CREDENTIAL_SERVER_ERROR: 19100005, - ERR_JS_API_FOR_SANDBOX_ERROR: 19100006, - ERR_JS_API_NOT_FOR_SANDBOX_ERROR: 19100007, - ERR_JS_NOT_DLP_FILE: 19100008, - ERR_JS_OPERATE_DLP_FILE_FAIL: 19100009, - ERR_JS_DLP_FILE_READ_ONLY: 19100010, - ERR_JS_SYSTEM_SERVICE_EXCEPTION: 19100011, - ERR_JS_OUT_OF_MEMORY: 19100012, -}; - -export class TestDlpFileInfo { - dlpFile: dlpPermission.DLPFile = null; - plaintextPath: string = ''; - ciphertextPath: string = ''; - plaintextFd: number = -1; - ciphertextFd: number = -1; -} - -const TAG = "DLP_XTS "; -var user1: dlpPermission.AuthUser = { - "authAccount": "123@ohos.com", - "authAccountType": dlpPermission.AccountType.CLOUD_ACCOUNT, - "dlpFileAccess": dlpPermission.DLPFileAccess.READ_ONLY, - "permExpiryTime": 8888520175, -}; -var user2: dlpPermission.AuthUser = { - "authAccount": "456@ohos.com", - "authAccountType": dlpPermission.AccountType.CLOUD_ACCOUNT, - "dlpFileAccess": dlpPermission.DLPFileAccess.FULL_CONTROL, - "permExpiryTime": 8888520175, -}; - -var userList = new Array(2); -userList[0] = user1; -userList[1] = user2; - -var userId; - -const accountAbility = account.getDistributedAccountAbility() -const bundleName = "com.ohos.dlp_xts" -const rootDir = "/data/storage/el1/base/" - -export default function dlpTest() { - describe('dlpTest', function () { - // 获取帐号信息 - async function getOsAccountInfo(): Promise { - try { - let accountMgr = account_osAccount.getAccountManager(); - return await accountMgr.getCurrentOsAccount(); - } catch (err) { - console.error(TAG, 'getCurrentOsAccount failed', err.code, err.message); - expect(false).assertTrue(); - } - } - - // 帐号登录 - async function AccountLogin(accountName) { - await AccountLogout() - var info = { - name: "", - id: "1234", - event: "Ohos.account.event.LOGIN", - nickname: "nickname", - avatar: "avatar" - } - info.name = accountName - info.event = "Ohos.account.event.LOGIN" - try { - await accountAbility.setOsAccountDistributedInfo(info) - } catch (err) { - console.error(TAG, "setOsAccountDistributedInfo LOGIN failed", err.code, err.message); - expect(null).assertFail() - return - } - var user = await accountAbility.getOsAccountDistributedInfo() - expect(user.name).assertEqual(accountName) - } - - // 帐号登出 - async function AccountLogout() { - try { - var accountInfo = await accountAbility.getOsAccountDistributedInfo(); - } catch (err) { - console.error(TAG, "getOsAccountDistributedInfo failed", err.code, err.message); - expect(null).assertFail(); - return - } - var info = { - name: "", - id: "1234", - event: "Ohos.account.event.LOGIN", - nickname: "nickname", - avatar: "avatar" - } - if (accountInfo.name === "ohosAnonymousName") { - return - } - info.name = accountInfo.name - info.event = "Ohos.account.event.LOGOUT" - try { - await accountAbility.setOsAccountDistributedInfo(info) - } catch (err) { - console.error(TAG, "setOsAccountDistributedInfo LOGOUT failed", err.code, err.message); - expect(null).assertFail() - return - } - var user = await accountAbility.getOsAccountDistributedInfo() - expect(user.name).assertEqual("ohosAnonymousName") - } - - // 生成文件 - function genFile(path, content?) { - try { - var file = fs.openSync(path, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE); - let fd = file.fd; - if (content !== undefined) { - fs.writeSync(fd, content); - } - return fd; - } catch (err) { - console.error(TAG, 'openSync', path, 'failed', err.code, err.message); - return -1; - } - } - - // 生成可选参数的DLP策略 - async function genTestOptionalDlpProperty(): Promise { - var accountInfo = await getOsAccountInfo(); - var property: dlpPermission.DLPProperty = { - "ownerAccount": accountInfo.distributedInfo.name, - "ownerAccountID": accountInfo.distributedInfo.id, - "ownerAccountType": dlpPermission.AccountType.CLOUD_ACCOUNT, - "contactAccount": accountInfo.distributedInfo.name, - "offlineAccess": true, - }; - return property; - } - - // 生成DLP策略 - async function genTestDlpProperty(): Promise { - var accountInfo = await getOsAccountInfo(); - var property: dlpPermission.DLPProperty = { - "ownerAccount": accountInfo.distributedInfo.name, - "ownerAccountID": accountInfo.distributedInfo.id, - "ownerAccountType": dlpPermission.AccountType.CLOUD_ACCOUNT, - "authUserList": userList, - "contactAccount": accountInfo.distributedInfo.name, - "offlineAccess": true, - "everyoneAccessList": [], - }; - return property; - } - - // 生成测试DLP文件 - async function genTestDlpFile(): Promise { - let dlpInfo: TestDlpFileInfo = new TestDlpFileInfo(); - dlpInfo.plaintextPath = rootDir + "test_dlp.txt"; - dlpInfo.ciphertextPath = rootDir + "test_dlp.txt.dlp"; - var writeContent = "123456"; - dlpInfo.plaintextFd = genFile(dlpInfo.plaintextPath, writeContent); - expect(dlpInfo.plaintextFd >= 0).assertTrue(); - dlpInfo.ciphertextFd = genFile(dlpInfo.ciphertextPath); - expect(dlpInfo.ciphertextFd >= 0).assertTrue(); - - var property = await genTestDlpProperty(); - - try { - var dlpFile = await dlpPermission.generateDLPFile(dlpInfo.plaintextFd, dlpInfo.ciphertextFd, property); - expect(true).assertTrue() - dlpInfo.dlpFile = dlpFile; - return dlpInfo; - } catch (err) { - console.error(TAG, "generateDLPFile failed", err.code, err.message); - fs.closeSync(dlpInfo.plaintextFd); - fs.closeSync(dlpInfo.ciphertextFd); - fs.unlinkSync(dlpInfo.ciphertextPath); - fs.unlinkSync(dlpInfo.plaintextPath); - expect(false).assertTrue() - return null; - } - } - - // 关闭测试DLP文件 - async function closeTestDlpFile(dlpInfo: TestDlpFileInfo) { - try { - await dlpInfo.dlpFile.closeDLPFile(); - } catch (err) { - console.error(TAG, "closeDLPFile failed", err.code, err.message); - } - fs.closeSync(dlpInfo.plaintextFd); - fs.closeSync(dlpInfo.ciphertextFd); - fs.unlinkSync(dlpInfo.ciphertextPath); - fs.unlinkSync(dlpInfo.plaintextPath); - } - - function timeOut() { - return new Promise((resolve) => { - setTimeout(() => { - resolve('') - }, 200) - }) - } - - beforeAll(async function () { - // Presets an action, which is performed only once before all test cases of the test suite start. - // This API supports only one parameter: preset action function. - await AccountLogin("owner@ohos.com"); - const accountMgr = account_osAccount.getAccountManager(); - userId = await accountMgr.getOsAccountLocalIdFromProcess(); - }) - beforeEach(function () { - // Presets an action, which is performed before each unit test case starts. - // The number of execution times is the same as the number of test cases defined by **it**. - // This API supports only one parameter: preset action function. - }) - afterEach(function () { - // Presets a clear action, which is performed after each unit test case ends. - // The number of execution times is the same as the number of test cases defined by **it**. - // This API supports only one parameter: clear action function. - let files = fs.listFileSync(rootDir); - if (files.length != 0) { - console.error(TAG, "tmp file need delete", files); - } - }) - afterAll(async function () { - // Presets a clear action, which is performed after all test cases of the test suite end. - // This API supports only one parameter: clear action function. - await AccountLogout(); - }) - - /** - * @tc.number Test_getDLPSupportedFileTypes_001 - * @tc.name Test dlpPermission.getDLPSupportedFileTypes. - * @tc.desc generateDLPFile success (Promise). - */ - it('Test_getDLPSupportedFileTypes_001', 0, async function () { - var curTag = TAG + "Test_getDLPSupportedFileTypes_001"; - console.info(curTag, "start"); - - try { - var fileTypes = await dlpPermission.getDLPSupportedFileTypes(); - expect(typeof (fileTypes)).assertEqual("object"); - } catch (err) { - console.error(TAG, "getDLPSupportedFileTypes failed", err.code, err.message); - - console.info(curTag, "end"); - expect(false).assertTrue(); - return; - } - - console.info(curTag, "end"); - return; - }) - - /** - * @tc.number Test_getDLPSupportedFileTypes_002 - * @tc.name Test dlpPermission.getDLPSupportedFileTypes. - * @tc.desc generateDLPFile success (Callback). - */ - it('Test_getDLPSupportedFileTypes_002', 0, async function (done) { - var curTag = TAG + "Test_generateDLPFile_002"; - console.info(curTag, "start"); - - dlpPermission.getDLPSupportedFileTypes(async (err, fileTypes) => { - expect(err).assertEqual(null); - expect(typeof (fileTypes)).assertEqual("object"); - - console.info(curTag, "end"); - done(); - }); - }) - - /** - * @tc.number Test_setRetentionState_001 - * @tc.name Test dlpPermission.setRetentionState. - * @tc.desc setRetentionState not from sandbox fail with code 19100006 (Promise). - */ - it('Test_setRetentionState_001', 0, async function () { - var curTag = TAG + "Test_setRetentionState_001"; - console.info(curTag, "start"); - - try { - var uriArray = ['uri']; - await dlpPermission.setRetentionState(uriArray); - expect(false).assertTrue(); - } catch (err) { - expect(err.code).assertEqual(DLPErrCode.ERR_JS_API_FOR_SANDBOX_ERROR); - } - - console.info(curTag, "end"); - return; - }) - - /** - * @tc.number Test_setRetentionState_002 - * @tc.name Test dlpPermission.setRetentionState. - * @tc.desc setRetentionState not from sandbox fail with code 19100006 (Callback). - */ - it('Test_setRetentionState_002', 0, async function (done) { - var curTag = TAG + "Test_setRetentionState_002"; - console.info(curTag, "start"); - - var uriArray = ['uri']; - dlpPermission.setRetentionState(uriArray, async (err) => { - expect(err.code).assertEqual(DLPErrCode.ERR_JS_API_FOR_SANDBOX_ERROR); - console.info(curTag, "end"); - done(); - }); - }); - - /** - * @tc.number Test_setRetentionState_003 - * @tc.name Test dlpPermission.setRetentionState. - * @tc.desc setRetentionState sandbox call success (Callback). - */ - it('Test_setRetentionState_003', 0, async function (done) { - var curTag = TAG + "Test_setRetentionState_003"; - console.info(curTag, "start"); - var sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, 'uri'); - let want: Want = { - "abilityName": "SetRetentionStateCallback", - "bundleName": bundleName, - "parameters": { - 'ohos.dlp.params.index': sandboxInfo.appIndex, - 'ohos.dlp.params.success': true - } - } - let result; - try { - result = await globalThis.context.startAbilityForResult(want); - } catch (err) { - console.info(curTag, "startAbility failed", err.code, err.message); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - expect(false).assertTrue(); - console.info(curTag, "end"); - return; - } - var uriArray = ['uri']; - await dlpPermission.cancelRetentionState(uriArray); - try { - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.info(curTag, "uninstallDLPSandbox failed", err.code, err.message); - } - expect(result.resultCode).assertEqual(0); - console.info(curTag, "end"); - done(); - }) - - /** - * @tc.number Test_setRetentionState_004 - * @tc.name Test dlpPermission.setRetentionState. - * @tc.desc setRetentionState sandbox call success (Promise). - */ - it('Test_setRetentionState_004', 0, async function (done) { - var curTag = TAG + "Test_setRetentionState_004"; - console.info(curTag, "start", bundleName); - var sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, 'uri'); - let want: Want = { - "abilityName": "SetRetentionStatePromise", - "bundleName": bundleName, - "parameters": { - 'ohos.dlp.params.index': sandboxInfo.appIndex, - 'ohos.dlp.params.success': true - } - }; - let result; - try { - result = await globalThis.context.startAbilityForResult(want); - } catch (err) { - console.info(curTag, "startAbility failed", err.code, err.message); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - expect(false).assertTrue(); - console.info(curTag, "end"); - return; - } - var uriArray = ['uri']; - await dlpPermission.cancelRetentionState(uriArray); - try { - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.info(curTag, "uninstallDLPSandbox failed", err.code, err.message); - } - expect(result.resultCode).assertEqual(0); - console.info(curTag, "end"); - done(); - }) - - /** - * @tc.number Test_setRetentionState_005 - * @tc.name Test dlpPermission.setRetentionState. - * @tc.desc setRetentionState sandbox call parameter error (Callback). - */ - it('Test_setRetentionState_005', 0, async function (done) { - var curTag = TAG + "Test_setRetentionState_005"; - console.info(curTag, "start"); - var sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, 'uri'); - let want: Want = { - "abilityName": "SetRetentionStateCallback", - "bundleName": bundleName, - "parameters": { - 'ohos.dlp.params.index': sandboxInfo.appIndex, - 'ohos.dlp.params.success': false - } - } - let result; - try { - result = await globalThis.context.startAbilityForResult(want); - } catch (err) { - console.info(curTag, "startAbility failed", err.code, err.message); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - expect(false).assertTrue(); - console.info(curTag, "end"); - return; - } - expect(result.resultCode).assertEqual(DLPErrCode.ERR_JS_INVALID_PARAMETER); - try { - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.info(curTag, "uninstallDLPSandbox failed", err.code, err.message); - } - console.info(curTag, "end"); - done(); - }) - - /** - * @tc.number Test_setRetentionState_006 - * @tc.name Test dlpPermission.setRetentionState. - * @tc.desc setRetentionState sandbox call parameter error (Promise). - */ - it('Test_setRetentionState_006', 0, async function (done) { - var curTag = TAG + "Test_setRetentionState_006"; - console.info(curTag, "start", bundleName); - var sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, 'uri'); - let want: Want = { - "abilityName": "SetRetentionStatePromise", - "bundleName": bundleName, - "parameters": { - 'ohos.dlp.params.index': sandboxInfo.appIndex, - 'ohos.dlp.params.success': false - } - }; - let result; - try { - result = await globalThis.context.startAbilityForResult(want); - } catch (err) { - console.info(curTag, "startAbility failed", err.code, err.message); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - expect(false).assertTrue(); - console.info(curTag, "end"); - return; - } - expect(result.resultCode).assertEqual(DLPErrCode.ERR_JS_INVALID_PARAMETER); - try { - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.info(curTag, "uninstallDLPSandbox failed", err.code, err.message); - } - console.info(curTag, "end"); - done(); - }) - - /** - * @tc.number Test_cancelRetentionState_001 - * @tc.name Test dlpPermission.cancelRetentionState. - * @tc.desc cancelRetentionState success (Promise). - */ - it('Test_cancelRetentionState_001', 0, async function () { - var curTag = TAG + "Test_cancelRetentionState_001"; - console.info(curTag, "start"); - - try { - var uriArray = ['uri']; - await dlpPermission.cancelRetentionState(uriArray); - expect(true).assertTrue(); - } catch (err) { - console.error(curTag, "cancelRetentionState failed", err.code, err.message); - expect(false).assertTrue(); - } - - console.info(curTag, "end"); - return; - }) - - /** - * @tc.number Test_cancelRetentionState_002 - * @tc.name Test dlpPermission.cancelRetentionState. - * @tc.desc cancelRetentionState success (Callback). - */ - it('Test_cancelRetentionState_002', 0, async function (done) { - var curTag = TAG + "Test_cancelRetentionState_002"; - console.info(curTag, "start"); - - var uriArray = ['uri']; - dlpPermission.cancelRetentionState(uriArray, async (err) => { - expect(err).assertEqual(null); - console.info(curTag, "end"); - done(); - }); - }) - - /** - * @tc.number Test_cancelRetentionState_003 - * @tc.name Test dlpPermission.cancelRetentionState. - * @tc.desc cancelRetentionState invalid docUris (Promise). - */ - it('Test_cancelRetentionState_003', 0, async function () { - var curTag = TAG + "Test_cancelRetentionState_003"; - console.info(curTag, "start"); - - try { - var docUris = []; - await dlpPermission.cancelRetentionState(docUris); - expect(false).assertTrue(); - } catch (err) { - expect(err.code === DLPErrCode.ERR_JS_INVALID_PARAMETER).assertTrue(); - } - - console.info(curTag, "end"); - return; - }) - - /** - * @tc.number Test_cancelRetentionState_004 - * @tc.name Test dlpPermission.cancelRetentionState. - * @tc.desc cancelRetentionState invalid docUris (Callback). - */ - it('Test_cancelRetentionState_004', 0, async function (done) { - var curTag = TAG + "Test_cancelRetentionState_004"; - console.info(curTag, "start"); - - var docUris = []; - dlpPermission.cancelRetentionState(docUris, async (err) => { - expect(err.code === DLPErrCode.ERR_JS_INVALID_PARAMETER).assertTrue(); - - console.info(curTag, "end"); - done(); - }); - }) - - /** - * @tc.number Test_getRetentionSandboxList_001 - * @tc.name Test dlpPermission.getRetentionSandboxList - * @tc.desc getRetentionSandboxList with bundle name success (Promise). - */ - it('Test_getRetentionSandboxList_001', 0, async function () { - var curTag = TAG + "Test_getRetentionSandboxList_001"; - console.info(curTag, "start"); - let uri = 'uri'; - var sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, uri); - let want: Want = { - "abilityName": "SetRetentionStatePromise", - "bundleName": bundleName, - "parameters": { - 'ohos.dlp.params.index': sandboxInfo.appIndex, - 'ohos.dlp.params.success': true - } - }; - let result; - try { - result = await globalThis.context.startAbilityForResult(want); - expect(result.resultCode).assertEqual(0); - } catch (err) { - console.info(curTag, "startAbility failed", err.code, err.message); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - expect(false).assertTrue(); - console.info(curTag, "end"); - return; - } - - try { - var uriArray = await dlpPermission.getRetentionSandboxList(bundleName); - expect(typeof (uriArray)).assertEqual("object"); - expect(JSON.stringify(uriArray[0].docUris)).assertEqual(JSON.stringify([uri])); - } catch (err) { - console.error(curTag, "setRetentionState failed", err.code, err.message); - expect(false).assertTrue(); - } - - try { - await dlpPermission.cancelRetentionState([uri]); - expect(true).assertTrue(); - } catch (err) { - console.error(curTag, "cancelRetentionState failed", err.code, err.message); - expect(false).assertTrue(); - } - - try { - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.info(curTag, "uninstallDLPSandbox failed", err.code, err.message); - } - - console.info(curTag, "end"); - return; - }) - - /** - * @tc.number Test_getRetentionSandboxList_002 - * @tc.name Test dlpPermission.getRetentionSandboxList. - * @tc.desc getRetentionSandboxList with bundleName success (Callback). - */ - it('Test_getRetentionSandboxList_002', 0, async function (done) { - var curTag = TAG + "Test_getRetentionSandboxList_002"; - console.info(curTag, "start"); - - let uri = 'uri'; - var sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, uri); - let want: Want = { - "abilityName": "SetRetentionStatePromise", - "bundleName": bundleName, - "parameters": { - 'ohos.dlp.params.index': sandboxInfo.appIndex, - 'ohos.dlp.params.success': true - } - }; - let result; - try { - result = await globalThis.context.startAbilityForResult(want); - expect(result.resultCode).assertEqual(0); - } catch (err) { - console.info(curTag, "startAbility failed", err.code, err.message); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - expect(false).assertTrue(); - console.info(curTag, "end"); - return; - } - - dlpPermission.getRetentionSandboxList(bundleName, async (err, data) => { - expect(err).assertEqual(null); - try { - await dlpPermission.cancelRetentionState([uri]); - expect(true).assertTrue(); - } catch (err) { - console.error(curTag, "cancelRetentionState failed", err.code, err.message); - expect(false).assertTrue(); - } - - try { - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.info(curTag, "uninstallDLPSandbox failed", err.code, err.message); - } - console.info(curTag, "end"); - done(); - }); - }) - - /** - * @tc.number Test_getRetentionSandboxList_003 - * @tc.name Test dlpPermission.getRetentionSandboxList - * @tc.desc getRetentionSandboxList without bundle name success (Promise). - */ - it('Test_getRetentionSandboxList_003', 0, async function () { - var curTag = TAG + "Test_getRetentionSandboxList_003"; - console.info(curTag, "start"); - - try { - var uriArray = await dlpPermission.getRetentionSandboxList(); - expect(typeof (uriArray)).assertEqual("object"); - } catch (err) { - console.error(curTag, "getRetentionSandboxList failed", err.code, err.message); - expect(false).assertTrue(); - } - - console.info(curTag, "end"); - return; - }) - - /** - * @tc.number Test_getRetentionSandboxList_004 - * @tc.name Test dlpPermission.getRetentionSandboxList. - * @tc.desc getRetentionSandboxList without bundleName success (Callback). - */ - it('Test_getRetentionSandboxList_004', 0, async function (done) { - var curTag = TAG + "Test_getRetentionSandboxList_004"; - console.info(curTag, "start"); - - dlpPermission.getRetentionSandboxList(async (err, data) => { - expect(err).assertEqual(null); - - console.info(curTag, "end"); - done(); - }); - }) - - /** - * @tc.number Test_getRetentionSandboxList_005 - * @tc.name Test dlpPermission.getRetentionSandboxList. - * @tc.desc getRetentionSandboxList sandbox not allow call error (Callback). - */ - it('Test_getRetentionSandboxList_005', 0, async function (done) { - var curTag = TAG + "Test_getRetentionSandboxList_005"; - console.info(curTag, "start"); - var sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, 'uri'); - let want: Want = { - "abilityName": "GetRetentionSandboxListCallback", - "bundleName": bundleName, - "parameters": { - 'ohos.dlp.params.index': sandboxInfo.appIndex, - } - } - - try { - let result = await globalThis.context.startAbilityForResult(want); - expect(result.resultCode).assertEqual(DLPErrCode.ERR_JS_API_NOT_FOR_SANDBOX_ERROR); - } catch (err) { - console.info(curTag, "startAbility failed", err.code, err.message); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - expect(false).assertTrue(); - console.info(curTag, "end"); - return; - } - try { - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.info(curTag, "uninstallDLPSandbox failed", err.code, err.message); - } - console.info(curTag, "end"); - done(); - }) - - /** - * @tc.number Test_getRetentionSandboxList_006 - * @tc.name Test dlpPermission.getRetentionSandboxList. - * @tc.desc getRetentionSandboxList sandbox not allow call error (Promise). - */ - it('Test_getRetentionSandboxList_006', 0, async function (done) { - var curTag = TAG + "Test_getRetentionSandboxList_006"; - console.info(curTag, "start"); - var sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, 'uri'); - let want: Want = { - "abilityName": "GetRetentionSandboxListPromise", - "bundleName": bundleName, - "parameters": { - 'ohos.dlp.params.index': sandboxInfo.appIndex, - } - } - let result; - try { - result = await globalThis.context.startAbilityForResult(want); - } catch (err) { - console.info(curTag, "startAbility failed", err.code, err.message); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - expect(false).assertTrue(); - console.info(curTag, "end"); - return; - } - try { - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.info(curTag, "uninstallDLPSandbox failed", err.code, err.message); - } - expect(result.resultCode).assertEqual(DLPErrCode.ERR_JS_API_NOT_FOR_SANDBOX_ERROR); - console.info(curTag, "end"); - done(); - }) - - /** - * @tc.number Test_getRetentionSandboxList_007 - * @tc.name Test dlpPermission.getRetentionSandboxList - * @tc.desc getRetentionSandboxList invalid parameter (Promise). - */ - it('Test_getRetentionSandboxList_007', 0, async function () { - var curTag = TAG + "Test_getRetentionSandboxList_007"; - console.info(curTag, "start"); - try { - // @ts-ignore - var uriArray = await dlpPermission.getRetentionSandboxList(-1); - expect(false).assertEqual(true); - } catch (err) { - expect(true).assertTrue(); - } - console.info(curTag, "end"); - return; - }) - - /** - * @tc.number Test_getRetentionSandboxList_008 - * @tc.name Test dlpPermission.getRetentionSandboxList. - * @tc.desc getRetentionSandboxList without bundleName success (Callback). - */ - it('Test_getRetentionSandboxList_008', 0, async function (done) { - var curTag = TAG + "Test_getRetentionSandboxList_008"; - console.info(curTag, "start"); - try { - // @ts-ignore - dlpPermission.getRetentionSandboxList(-1, async (err, data) => { - expect(false).assertTrue(); - console.info(curTag, "end"); - done(); - }); - } catch (err) { - expect(err.code).assertEqual(DLPErrCode.ERR_JS_PARAMETER_ERROR); - console.info(curTag, "end"); - done(); - return; - } - expect(false).assertTrue(); - console.info(curTag, "end"); - return; - }) - - /** - * @tc.number Test_getDLPFileAccessRecords_001 - * @tc.name Test dlpPermission.getDLPFileAccessRecords - * @tc.desc getDLPFileAccessRecords success (Promise). - */ - it('Test_getDLPFileAccessRecords_001', 0, async function () { - var curTag = TAG + "Test_getDLPFileAccessRecords_001"; - console.info(curTag, "start"); - var sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, 'uri'); - try { - var accessRecords = await dlpPermission.getDLPFileAccessRecords(); - expect(typeof (accessRecords)).assertEqual("object"); - expect(accessRecords.length).assertLarger(0); - expect(accessRecords[accessRecords.length - 1].lastOpenTime).assertLarger(0); - expect(accessRecords[accessRecords.length - 1].uri).assertEqual('uri'); - } catch (err) { - console.error(curTag, "getDLPFileAccessRecords failed", err.code, err.message); - expect(false).assertTrue(); - } - try { - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.info(curTag, "uninstallDLPSandbox failed", err.code, err.message); - } - console.info(curTag, "end"); - return; - }) - - /** - * @tc.number Test_getDLPFileAccessRecords_002 - * @tc.name Test dlpPermission.getDLPFileAccessRecords. - * @tc.desc getDLPFileAccessRecords success (Callback). - */ - it('Test_getDLPFileAccessRecords_002', 0, async function (done) { - var curTag = TAG + "Test_getRetentionSandboxList_002"; - console.info(curTag, "start"); - var sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, 'uri'); - dlpPermission.getDLPFileAccessRecords(async (err, accessRecords) => { - expect(err).assertEqual(null); - expect(accessRecords.length).assertLarger(0); - expect(accessRecords[accessRecords.length - 1].lastOpenTime).assertLarger(0); - expect(accessRecords[accessRecords.length - 1].uri).assertEqual('uri'); - try { - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.info(curTag, "uninstallDLPSandbox failed", err.code, err.message); - } - console.info(curTag, "end"); - done(); - }); - }) - - /** - * @tc.number Test_getDLPFileAccessRecords_003 - * @tc.name Test dlpPermission.getDLPFileAccessRecords. - * @tc.desc getDLPFileAccessRecords sandbox not allow call error (Callback). - */ - it('Test_getDLPFileAccessRecords_003', 0, async function (done) { - var curTag = TAG + "Test_getDLPFileAccessRecords_003"; - console.info(curTag, "start"); - var sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, 'uri'); - let want: Want = { - "abilityName": "GetDLPFileAccessRecordsCallback", - "bundleName": bundleName, - "parameters": { - 'ohos.dlp.params.index': sandboxInfo.appIndex, - } - } - let result; - try { - result = await globalThis.context.startAbilityForResult(want); - } catch (err) { - console.info(curTag, "startAbility failed", err.code, err.message); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - expect(false).assertTrue(); - console.info(curTag, "end"); - return; - } - try { - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.info(curTag, "uninstallDLPSandbox failed", err.code, err.message); - } - expect(result.resultCode).assertEqual(DLPErrCode.ERR_JS_API_NOT_FOR_SANDBOX_ERROR); - console.info(curTag, "end"); - done(); - }) - - /** - * @tc.number Test_getDLPFileAccessRecords_004 - * @tc.name Test dlpPermission.getDLPFileAccessRecords. - * @tc.desc getDLPFileAccessRecords sandbox not allow call error (Promise). - */ - it('Test_getDLPFileAccessRecords_004', 0, async function (done) { - var curTag = TAG + "Test_getDLPFileAccessRecords_004"; - console.info(curTag, "start"); - var sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, 'uri'); - let want: Want = { - "abilityName": "GetDLPFileAccessRecordsPromise", - "bundleName": bundleName, - "parameters": { - 'ohos.dlp.params.index': sandboxInfo.appIndex, - } - } - let result; - try { - result = await globalThis.context.startAbilityForResult(want); - } catch (err) { - console.info(curTag, "startAbility failed", err.code, err.message); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - expect(false).assertTrue(); - console.info(curTag, "end"); - return; - } - try { - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.info(curTag, "uninstallDLPSandbox failed", err.code, err.message); - } - expect(result.resultCode).assertEqual(DLPErrCode.ERR_JS_API_NOT_FOR_SANDBOX_ERROR); - console.info(curTag, "end"); - done(); - }) - - /** - * @tc.number Test_isDLPFile_001 - * @tc.name Test dlpPermission.isDLPFile. - * @tc.desc isDLPFile success (Promise). - */ - it('Test_isDLPFile_001', 0, async function () { - var curTag = TAG + "Test_isDLPFile_001"; - console.info(curTag, "start"); - - let dlpInfo = await genTestDlpFile(); - - try { - await dlpPermission.isDLPFile(dlpInfo.ciphertextFd); - expect(true).assertTrue(); - } catch (err) { - console.error(curTag, "isDLPFile failed", err.code, err.message); - expect(false).assertTrue(); - return; - } - - await closeTestDlpFile(dlpInfo); - console.info(curTag, "end"); - return; - }) - - /** - * @tc.number Test_isDLPFile_002 - * @tc.name Test dlpPermission.isDLPFile. - * @tc.desc isDLPFile success (Callback). - */ - it('Test_isDLPFile_002', 0, async function (done) { - var curTag = TAG + "Test_isDLPFile_002"; - console.info(curTag, "start"); - let dlpInfo = await genTestDlpFile(); - - dlpPermission.isDLPFile(dlpInfo.ciphertextFd, async (err, data) => { - expect(err).assertEqual(null); - await closeTestDlpFile(dlpInfo); - console.info(curTag, "end"); - done(); - }); - }) - - /* - * @tc.number Test_isDLPFile_003 - * @tc.name Test dlpPermission.isDLPFile. - * @tc.desc isDLPFile invalid fd (Promise). - */ - it('Test_isDLPFile_003', 0, async function () { - var curTag = TAG + "Test_isDLPFile_003"; - console.info(curTag, "start"); - - try { - await dlpPermission.isDLPFile(-1); - expect(false).assertTrue(); - } catch (err) { - expect(err.code).assertEqual(DLPErrCode.ERR_JS_INVALID_PARAMETER); - expect(true).assertTrue(); - } - - console.info(curTag, "end"); - return; - }) - - /** - * @tc.number Test_isDLPFile_004 - * @tc.name Test dlpPermission.isDLPFile. - * @tc.desc isDLPFile success (Callback). - */ - it('Test_isDLPFile_004', 0, async function (done) { - var curTag = TAG + "Test_isDLPFile_004"; - console.info(curTag, "start"); - try { - dlpPermission.isDLPFile(-1, (err, data) => { - }); - } catch (err) { - expect(err.code).assertEqual(DLPErrCode.ERR_JS_INVALID_PARAMETER); - console.info(curTag, "end"); - done(); - } - }) - - /** - * @tc.number Test_getDLPPermissionInfo_001 - * @tc.name Test dlpPermission.getDLPPermissionInfo. - * @tc.desc test getDLPPermissionInfo in sandbox (Promise). - */ - it('Test_getDLPPermissionInfo_001', 0, async function () { - var curTag = TAG + "Test_getDLPPermissionInfo_001"; - console.info(curTag, "start"); - - var sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, 'uri'); - let want: Want = { - "abilityName": "GetDLPPermissionInfoPromise", - "bundleName": bundleName, - "parameters": { - 'ohos.dlp.params.index': sandboxInfo.appIndex, - } - } - let result; - try { - result = await globalThis.context.startAbilityForResult(want); - } catch (err) { - console.info(curTag, "startAbility failed", err.code, err.message); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - expect(false).assertTrue(); - console.info(curTag, "end"); - return; - } - try { - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.info(curTag, "uninstallDLPSandbox failed", err.code, err.message); - } - expect(result.resultCode).assertEqual(0); - - console.info(curTag, "end"); - }) - - /** - * @tc.number Test_getDLPPermissionInfo_002 - * @tc.name Test dlpPermission.getDLPPermissionInfo. - * @tc.desc test getDLPPermissionInfo in sandbox (Callback). - */ - it('Test_getDLPPermissionInfo_002', 0, async function () { - var curTag = TAG + "Test_getDLPPermissionInfo_002"; - console.info(curTag, "start"); - - var sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, 'uri'); - let want: Want = { - "abilityName": "GetDLPPermissionInfoCallback", - "bundleName": bundleName, - "parameters": { - 'ohos.dlp.params.index': sandboxInfo.appIndex, - } - } - let result; - try { - result = await globalThis.context.startAbilityForResult(want); - } catch (err) { - console.error(curTag, "startAbility failed", err.code, err.message); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - expect(false).assertTrue(); - console.info(curTag, "end"); - return; - } - try { - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.info(curTag, "uninstallDLPSandbox failed", err.code, err.message); - } - expect(result.resultCode).assertEqual(0); - - console.info(curTag, "end"); - }) - - /** - * @tc.number Test_getDLPPermissionInfo_003 - * @tc.name Test dlpPermission.getDLPPermissionInfo. - * @tc.desc test getDLPPermissionInfo in not sandbox (Promise) - */ - it('Test_getDLPPermissionInfo_003', 0, async function () { - var curTag = TAG + "Test_getDLPPermissionInfo_003"; - console.info(curTag, "start"); - - try { - var dlpPermInfo = await dlpPermission.getDLPPermissionInfo(); - expect(false).assertTrue(); - } catch (err) { - expect(err.code).assertEqual(DLPErrCode.ERR_JS_API_FOR_SANDBOX_ERROR); - } - - console.info(curTag, "end"); - }) - - /** - * @tc.number Test_getDLPPermissionInfo_004 - * @tc.name Test dlpPermission.getDLPPermissionInfo. - * @tc.desc test getDLPPermissionInfo in not sandbox (Callback) - */ - it('Test_getDLPPermissionInfo_004', 0, async function () { - var curTag = TAG + "Test_getDLPPermissionInfo_004"; - console.info(curTag, "start"); - - dlpPermission.getDLPPermissionInfo(async (err, dlpPermInfo) => { - expect(err.code).assertEqual(DLPErrCode.ERR_JS_API_FOR_SANDBOX_ERROR); - }); - - console.info(curTag, "end"); - }) - - /** - * @tc.number Test_getDLPPermissionInfo_005 - * @tc.name Test dlpPermission.getDLPPermissionInfo. - * @tc.desc test getDLPPermissionInfo in read only sandbox (Promise) - */ - it('Test_getDLPPermissionInfo_005', 0, async function () { - var curTag = TAG + "Test_getDLPPermissionInfo_005"; - console.info(curTag, "start"); - - var sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, 'uri'); - let want: Want = { - "abilityName": "GetDLPPermissionInfoPromise", - "bundleName": bundleName, - "parameters": { - 'ohos.dlp.params.index': sandboxInfo.appIndex, - } - } - let result; - try { - result = await globalThis.context.startAbilityForResult(want); - } catch (err) { - console.info(curTag, "startAbility failed", err.code, err.message); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - expect(false).assertTrue(); - console.info(curTag, "end"); - return; - } - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_VIEW).assertEqual(dlpPermission.ActionFlagType.ACTION_VIEW); - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_SAVE).assertEqual(0); - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_SAVE_AS).assertEqual(0); - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_EDIT).assertEqual(0); - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_SCREEN_CAPTURE).assertEqual(0); - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_SCREEN_SHARE).assertEqual(0); - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_SCREEN_RECORD).assertEqual(0); - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_COPY).assertEqual(0); - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_PRINT).assertEqual(0); - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_EXPORT).assertEqual(0); - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_PERMISSION_CHANGE).assertEqual(0); - expect(result.want.parameters.info.dlpFileAccess).assertEqual(dlpPermission.DLPFileAccess.READ_ONLY); - try { - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.info(curTag, "uninstallDLPSandbox failed", err.code, err.message); - } - expect(result.resultCode).assertEqual(0); - - console.info(curTag, "end"); - }) - - /** - * @tc.number Test_getDLPPermissionInfo_006 - * @tc.name Test dlpPermission.getDLPPermissionInfo. - * @tc.desc test getDLPPermissionInfo in content edit sandbox (Promise) - */ - it('Test_getDLPPermissionInfo_006', 0, async function () { - var curTag = TAG + "Test_getDLPPermissionInfo_006"; - console.info(curTag, "start"); - - var sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.CONTENT_EDIT, userId, 'uri'); - let want: Want = { - "abilityName": "GetDLPPermissionInfoPromise", - "bundleName": bundleName, - "parameters": { - 'ohos.dlp.params.index': sandboxInfo.appIndex, - } - } - let result; - try { - result = await globalThis.context.startAbilityForResult(want); - } catch (err) { - console.info(curTag, "startAbility failed", err.code, err.message); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - expect(false).assertTrue(); - console.info(curTag, "end"); - return; - } - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_VIEW).assertEqual(dlpPermission.ActionFlagType.ACTION_VIEW); - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_SAVE).assertEqual(dlpPermission.ActionFlagType.ACTION_SAVE); - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_SAVE_AS).assertEqual(dlpPermission.ActionFlagType.ACTION_SAVE_AS); - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_EDIT).assertEqual(dlpPermission.ActionFlagType.ACTION_EDIT); - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_SCREEN_CAPTURE).assertEqual(dlpPermission.ActionFlagType.ACTION_SCREEN_CAPTURE); - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_SCREEN_SHARE).assertEqual(dlpPermission.ActionFlagType.ACTION_SCREEN_SHARE); - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_SCREEN_RECORD).assertEqual(dlpPermission.ActionFlagType.ACTION_SCREEN_RECORD); - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_COPY).assertEqual(dlpPermission.ActionFlagType.ACTION_COPY); - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_PRINT).assertEqual(0); - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_EXPORT).assertEqual(0); - expect(result.want.parameters.info.flags & dlpPermission.ActionFlagType.ACTION_PERMISSION_CHANGE).assertEqual(0); - expect(result.want.parameters.info.dlpFileAccess).assertEqual(dlpPermission.DLPFileAccess.CONTENT_EDIT); - try { - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.info(curTag, "uninstallDLPSandbox failed", err.code, err.message); - } - expect(result.resultCode).assertEqual(0); - - console.info(curTag, "end"); - }) - - /** - * @tc.number Test_getDLPPermissionInfo_007 - * @tc.name Test dlpPermission.getDLPPermissionInfo. - * @tc.desc test getDLPPermissionInfo in read only sandbox (Promise) - */ - it('Test_getDLPPermissionInfo_007', 0, async function () { - var curTag = TAG + "Test_getDLPPermissionInfo_007"; - console.info(curTag, "start"); - - var sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, 'uri'); - let want: Want = { - "abilityName": "GetDLPPermissionInfoPromise", - "bundleName": bundleName, - "parameters": { - 'ohos.dlp.params.index': sandboxInfo.appIndex, - } - } - let result; - try { - result = await globalThis.context.startAbilityForResult(want); - } catch (err) { - console.info(curTag, "startAbility failed", err.code, err.message); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - expect(false).assertTrue(); - console.info(curTag, "end"); - return; - } - expect(result.want.parameters.info.dlpFileAccess).not().assertEqual(dlpPermission.DLPFileAccess.NO_PERMISSION); - try { - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.info(curTag, "uninstallDLPSandbox failed", err.code, err.message); - } - expect(result.resultCode).assertEqual(0); - - console.info(curTag, "end"); - }) - - /** - * @tc.number Test_getOriginalFileName_001 - * @tc.name Test dlpPermission.getOriginalFileName. - * @tc.desc test getOriginalFileName - */ - it('Test_getOriginalFileName_001', 0, async function () { - var curTag = TAG + "Test_getOriginalFileName_001"; - console.info(curTag, "start"); - - try { - var name = dlpPermission.getOriginalFileName('1.txt.dlp'); - expect(name).assertEqual('1.txt'); - } catch (err) { - console.error(curTag, "getOriginalFileName failed", err.code, err.message); - expect(false).assertTrue(); - } - - console.info(curTag, "end"); - }) - - /** - * @tc.number Test_getOriginalFileName_002 - * @tc.name Test dlpPermission.getOriginalFileName. - * @tc.desc test getOriginalFileName invalid fileName - */ - it('Test_getOriginalFileName_002', 0, async function () { - var curTag = TAG + "Test_getOriginalFileName_002"; - console.info(curTag, "start"); - - try { - var name = dlpPermission.getOriginalFileName(''); - expect(false).assertTrue(); - } catch (err) { - expect(err.code).assertEqual(DLPErrCode.ERR_JS_INVALID_PARAMETER); - expect(true).assertTrue(); - } - - console.info(curTag, "end"); - }) - - /** - * @tc.number Test_getDLPSuffix_001 - * @tc.name Test dlpPermission.getDLPSuffix. - * @tc.desc test getDLPSuffix - */ - it('Test_getDLPSuffix_001', 0, async function () { - var curTag = TAG + "Test_getDLPSuffix_001"; - console.info(curTag, "start"); - - try { - var name = dlpPermission.getDLPSuffix(); - expect(name).assertEqual('.dlp'); - } catch (err) { - console.error(curTag, "getDLPSuffix failed", err.code, err.message); - expect(false).assertTrue(); - } - - console.info(curTag, "end"); - }) - - /** - * @tc.number Test_on_openDLPFile_001 - * @tc.name Test dlpPermission.on('openDLPFile'). - * @tc.desc test on('openDLPFile') success. - */ - it('Test_on_openDLPFile_001', 0, async function () { - var curTag = TAG + "Test_on_openDLPFile_001"; - console.info(curTag, "start"); - - var called = false; - var srcUri = '123456' - try { - dlpPermission.on('openDLPFile', (dlpFileInfo) => { - expect(dlpFileInfo.uri).assertEqual(srcUri); - called = true; - }); - } catch (err) { - console.error(curTag, 'on openDLPFile failed', err.code, err.message); - expect(false).assertTrue(); - } - - try { - var sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, '123456'); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.error(curTag, 'installDLPSandbox failed', err.code, err.message); - dlpPermission.off('openDLPFile'); - expect(false).assertTrue(); - } - - expect(called).assertEqual(true); - dlpPermission.off('openDLPFile'); - console.info(curTag, "end"); - }) - - /** - * @tc.number Test_on_openDLPFile_002 - * @tc.name Test dlpPermission.on('openDLPFile'). - * @tc.desc test on('openDLPFile') in sandbox. - */ - it('Test_on_openDLPFile_002', 0, async function () { - var curTag = TAG + "Test_on_openDLPFile_002"; - console.info(curTag, "start"); - - var sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, 'uri'); - let want: Want = { - "abilityName": "OnOpenDlpFile", - "bundleName": bundleName, - "parameters": { - 'ohos.dlp.params.index': sandboxInfo.appIndex, - } - } - let result; - try { - result = await globalThis.context.startAbilityForResult(want); - } catch (err) { - console.error(curTag, "startAbility failed", err.code, err.message); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - expect(false).assertTrue(); - console.info(curTag, "end"); - return; - } - try { - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.info(curTag, "uninstallDLPSandbox failed", err.code, err.message); - } - expect(result.resultCode).assertEqual(DLPErrCode.ERR_JS_API_NOT_FOR_SANDBOX_ERROR); - - console.info(curTag, "end"); - }) - - /** - * @tc.number Test_on_openDLPFile_003 - * @tc.name Test dlpPermission.on('openDLPFile'). - * @tc.desc test on('openDLPFile') invalid param. - */ - it('Test_on_openDLPFile_003', 0, async function () { - var curTag = TAG + "Test_on_openDLPFile_003"; - console.info(curTag, "start"); - - try { - // @ts-ignore - dlpPermission.on('openDLPFile1', (dlpFileInfo) => { - }); - } catch (err) { - expect(err.code).assertEqual(DLPErrCode.ERR_JS_PARAMETER_ERROR); - } - - console.info(curTag, "end"); - }) - - - /** - * @tc.number Test_off_openDLPFile_001 - * @tc.name Test dlpPermission.off('openDLPFile'). - * @tc.desc test off('openDLPFile') success. - */ - it('Test_off_openDLPFile_001', 0, async function () { - var curTag = TAG + "Test_off_openDLPFile_001"; - console.info(curTag, "start"); - - var called1 = 0; - let func1 = (dlpFileInfo) => { - expect(dlpFileInfo.uri).assertEqual(srcUri); - called1++; - } - var called2 = 0; - let func2 = (dlpFileInfo) => { - expect(dlpFileInfo.uri).assertEqual(srcUri); - called2++; - } - - var srcUri = '123456' - try { - dlpPermission.on('openDLPFile', func1); - } catch (err) { - console.error(curTag, 'on openDLPFile failed', err.code, err.message); - expect(false).assertTrue(); - } - try { - dlpPermission.on('openDLPFile', func2); - } catch (err) { - console.error(curTag, 'on openDLPFile failed', err.code, err.message); - dlpPermission.off('openDLPFile'); - expect(false).assertTrue(); - } - - try { - let sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, '123456'); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.error(curTag, 'installDLPSandbox failed', err.code, err.message); - dlpPermission.off('openDLPFile'); - expect(false).assertTrue(); - } - expect(called1).assertEqual(1); - expect(called2).assertEqual(1); - - try { - dlpPermission.off('openDLPFile', func1); - } catch (err) { - console.error(curTag, 'off openDLPFile failed', err.code, err.message); - expect(false).assertTrue(); - } - try { - let sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, '123456'); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.error(curTag, 'installDLPSandbox failed', err.code, err.message); - dlpPermission.off('openDLPFile'); - expect(false).assertTrue(); - } - dlpPermission.off('openDLPFile'); - expect(called1).assertEqual(1); - expect(called2).assertEqual(2); - console.info(curTag, "end"); - }) - - /** - * @tc.number Test_off_openDLPFile_002 - * @tc.name Test dlpPermission.off('openDLPFile'). - * @tc.desc test off('openDLPFile') all callback success. - */ - it('Test_off_openDLPFile_002', 0, async function () { - var curTag = TAG + "Test_off_openDLPFile_002"; - console.info(curTag, "start"); - - var called1 = 0; - let func1 = (dlpFileInfo) => { - expect(dlpFileInfo.uri).assertEqual(srcUri); - called1++; - } - var called2 = 0; - let func2 = (dlpFileInfo) => { - expect(dlpFileInfo.uri).assertEqual(srcUri); - called2++; - } - - var srcUri = '123456' - try { - dlpPermission.on('openDLPFile', func1); - } catch (err) { - console.error(curTag, 'on openDLPFile failed', err.code, err.message); - expect(false).assertTrue(); - } - try { - dlpPermission.on('openDLPFile', func2); - } catch (err) { - console.error(curTag, 'on openDLPFile failed', err.code, err.message); - dlpPermission.off('openDLPFile'); - expect(false).assertTrue(); - } - - try { - let sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, '123456'); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.error(curTag, 'installDLPSandbox failed', err.code, err.message); - dlpPermission.off('openDLPFile'); - expect(false).assertTrue(); - } - expect(called1).assertEqual(1); - expect(called2).assertEqual(1); - - try { - dlpPermission.off('openDLPFile'); - } catch (err) { - console.error(curTag, 'off openDLPFile failed', err.code, err.message); - expect(false).assertTrue(); - } - try { - let sandboxInfo = await dlpPermission.installDLPSandbox(bundleName, dlpPermission.DLPFileAccess.READ_ONLY, userId, '123456'); - await dlpPermission.uninstallDLPSandbox(bundleName, userId, sandboxInfo.appIndex); - } catch (err) { - console.error(curTag, 'installDLPSandbox failed', err.code, err.message); - dlpPermission.off('openDLPFile'); - expect(false).assertTrue(); - } - expect(called1).assertEqual(1); - expect(called2).assertEqual(1); - console.info(curTag, "end"); - }) - - /** - * @tc.number Test_off_openDLPFile_003 - * @tc.name Test dlpPermission.off('openDLPFile'). - * @tc.desc test off('openDLPFile') invalid param. - */ - it('Test_off_openDLPFile_003', 0, async function () { - var curTag = TAG + "Test_off_openDLPFile_003"; - console.info(curTag, "start"); - - try { - // @ts-ignore - dlpPermission.off('openDLPFile1', (dlpFileInfo) => { - }); - } catch (err) { - expect(err.code).assertEqual(DLPErrCode.ERR_JS_PARAMETER_ERROR); - } - - console.info(curTag, "end"); - }) - }) -} diff --git a/xts/entry/src/main/ets/test/List.test.ets b/xts/entry/src/main/ets/test/List.test.ets deleted file mode 100644 index 2395e5b3..00000000 --- a/xts/entry/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) 2023 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 dlpTest from './DlpTest.test.ets'; - -export default function testsuite() { - dlpTest() -} \ No newline at end of file diff --git a/xts/entry/src/main/module.json b/xts/entry/src/main/module.json deleted file mode 100644 index 375c21c1..00000000 --- a/xts/entry/src/main/module.json +++ /dev/null @@ -1,146 +0,0 @@ -{ - "module": { - "name": "phone", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "tablet", - "default", - "phone", - "2in1" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "metadata": [ - { - "name": "ArkTSPartialUpdate", - "value": "true" - } - ], - "requestPermissions": [ - { - "name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS" - }, - { - "name": "ohos.permission.ACCESS_DLP_FILE" - }, - { - "name": "ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS" - } - ], - "abilities": [ - { - "name": "com.ohos.dlp_xts.MainAbility", - "srcEntrance": "./ets/MainAbility/MainAbility.ts", - "description": "$string:phone_entry_main", - "icon": "$media:icon", - "label": "$string:entry_label", - "visible": true, - "orientation": "portrait", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - }, - { - "name": "IsInSandboxPromise", - "srcEntrance": "./ets/isinsandboxpromise/IsInSandboxPromise.ets", - "description": "$string:IsInSandboxPromise_desc", - "icon": "$media:icon", - "label": "$string:IsInSandboxPromise_label", - "visible": true, - "orientation": "portrait" - }, - { - "name": "IsInSandboxCallback", - "srcEntry": "./ets/isinsandboxcallback/IsInSandboxCallback.ets", - "description": "$string:IsInSandboxCallback_desc", - "icon": "$media:icon", - "label": "$string:IsInSandboxCallback_label", - "visible": true - }, - { - "name": "GetDLPPermissionInfoPromise", - "srcEntry": "./ets/getdlppermissioninfopromise/GetDLPPermissionInfoPromise.ets", - "description": "$string:GetDLPPermissionInfoPromise_desc", - "icon": "$media:icon", - "label": "$string:GetDLPPermissionInfoPromise_label", - "visible": true - }, - { - "name": "GetDLPPermissionInfoCallback", - "srcEntry": "./ets/getdlppermissioninfocallback/GetDLPPermissionInfoCallback.ets", - "description": "$string:GetDLPPermissionInfoCallback_desc", - "icon": "$media:icon", - "label": "$string:GetDLPPermissionInfoCallback_label", - "visible": true - }, - { - "name": "OnOpenDlpFile", - "srcEntry": "./ets/onopendlpfile/OnOpenDlpFile.ets", - "description": "$string:OnOpenDlpFile_desc", - "icon": "$media:icon", - "label": "$string:OnOpenDlpFile_label", - "visible": true - }, - { - "name": "GetDLPFileAccessRecordsCallback", - "srcEntry": "./ets/getDLPFileAccessRecordscallback/GetDLPFileAccessRecordsCallback.ets", - "description": "$string:GetDLPFileAccessRecordsCallback_desc", - "icon": "$media:icon", - "label": "$string:GetDLPFileAccessRecordsCallback_label", - "visible": true - }, - { - "name": "GetDLPFileAccessRecordsPromise", - "srcEntry": "./ets/getDLPFileAccessRecordspromise/GetDLPFileAccessRecordsPromise.ets", - "description": "$string:GetDLPFileAccessRecordsPromise_desc", - "icon": "$media:icon", - "label": "$string:GetDLPFileAccessRecordsPromise_label", - "visible": true - }, - { - "name": "GetRetentionSandboxListCallback", - "srcEntry": "./ets/getRetentionSandboxListcallback/GetRetentionSandboxListCallback.ets", - "description": "$string:GetRetentionSandboxListCallback_desc", - "icon": "$media:icon", - "label": "$string:GetRetentionSandboxListCallback_label", - "visible": true - }, - { - "name": "GetRetentionSandboxListPromise", - "srcEntry": "./ets/getRetentionSandboxListpromise/GetRetentionSandboxListPromise.ets", - "description": "$string:GetRetentionSandboxListPromise_desc", - "icon": "$media:icon", - "label": "$string:GetRetentionSandboxListPromise_label", - "visible": true - }, - { - "name": "SetRetentionStateCallback", - "srcEntry": "./ets/setRetentionStatecallback/SetRetentionStateCallback.ets", - "description": "$string:SetRetentionStateCallback_desc", - "icon": "$media:icon", - "label": "$string:SetRetentionStateCallback_label", - "visible": true - }, - { - "name": "SetRetentionStatePromise", - "srcEntry": "./ets/setRetentionStatepromise/SetRetentionStatePromise.ets", - "description": "$string:SetRetentionStatePromise_desc", - "icon": "$media:icon", - "label": "$string:SetRetentionStatePromise_label", - "visible": true - } - ] - } -} \ No newline at end of file diff --git a/xts/entry/src/main/resources/base/element/color.json b/xts/entry/src/main/resources/base/element/color.json deleted file mode 100644 index 07a14d2b..00000000 --- a/xts/entry/src/main/resources/base/element/color.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "color": [ - { - "name": "color_hello", - "value": "#ffff0000" - }, - { - "name": "color_world", - "value": "#ff0000ff" - } - ] -} \ No newline at end of file diff --git a/xts/entry/src/main/resources/base/element/float.json b/xts/entry/src/main/resources/base/element/float.json deleted file mode 100644 index 26a0491a..00000000 --- a/xts/entry/src/main/resources/base/element/float.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "float":[ - { - "name":"font_hello", - "value":"28.0fp" - }, - { - "name":"font_world", - "value":"20.0fp" - } - ] -} \ No newline at end of file diff --git a/xts/entry/src/main/resources/base/element/string.json b/xts/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 5eff253a..00000000 --- a/xts/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,156 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - }, - { - "name": "TestAbility_desc", - "value": "description" - }, - { - "name": "TestAbility_label", - "value": "label" - }, - { - "name":"string_hello", - "value":"Hello" - }, - { - "name":"string_world", - "value":"World" - }, - { - "name":"message_arrive", - "value":"We will arrive at %s." - }, - { - "name": "phone_entry_dsc", - "value": "i am an entry for phone" - }, - { - "name": "phone_entry_main", - "value": "the phone entry ability" - }, - { - "name": "entry_label", - "value": "ActsContextTest" - }, - { - "name": "form_description", - "value": "my form" - }, - { - "name": "serviceability_description", - "value": "my whether" - }, - { - "name": "description_application", - "value": "demo for test" - }, - { - "name": "app_name", - "value": "Demo" - }, - { - "name": "IsInSandboxPromise_desc", - "value": "description" - }, - { - "name": "IsInSandboxPromise_label", - "value": "label" - }, - { - "name": "IsInSandboxCallback_desc", - "value": "description" - }, - { - "name": "IsInSandboxCallback_label", - "value": "label" - }, - { - "name": "GetDLPPermissionInfoPromise_desc", - "value": "description" - }, - { - "name": "GetDLPPermissionInfoPromise_label", - "value": "label" - }, - { - "name": "GetDLPPermissionInfoCallback_desc", - "value": "description" - }, - { - "name": "GetDLPPermissionInfoCallback_label", - "value": "label" - }, - { - "name": "OnOpenDlpFile_desc", - "value": "description" - }, - { - "name": "OnOpenDlpFile_label", - "value": "label" - }, - { - "name": "OffOpenDlpFile_desc", - "value": "description" - }, - { - "name": "OffOpenDlpFile_label", - "value": "label" - }, - { - "name": "GetDLPFileAccessRecordsCallback_desc", - "value": "description" - }, - { - "name": "GetDLPFileAccessRecordsCallback_label", - "value": "label" - }, - { - "name": "GetDLPFileAccessRecordsPromise_desc", - "value": "description" - }, - { - "name": "GetDLPFileAccessRecordsPromise_label", - "value": "label" - }, - { - "name": "GetRetentionSandboxListCallback_desc", - "value": "description" - }, - { - "name": "GetRetentionSandboxListCallback_label", - "value": "label" - }, - { - "name": "GetRetentionSandboxListPromise_desc", - "value": "description" - }, - { - "name": "GetRetentionSandboxListPromise_label", - "value": "label" - }, - { - "name": "SetRetentionStateCallback_desc", - "value": "description" - }, - { - "name": "SetRetentionStateCallback_label", - "value": "label" - }, - { - "name": "SetRetentionStatePromise_desc", - "value": "description" - }, - { - "name": "SetRetentionStatePromise_label", - "value": "label" - } - ] -} \ No newline at end of file diff --git a/xts/entry/src/main/resources/base/media/icon.png b/xts/entry/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6790 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 afxoS~b(?A)a*%j`^{h?qL8>83jsFE~2XjjR -- Gitee