HiLog中告警处理

Signed-off-by: li-li-wang <wangliliang5@huawei.com>
This commit is contained in:
li-li-wang 2024-04-11 14:46:11 +08:00
parent 50691a846b
commit 62dac87130
7 changed files with 58 additions and 82 deletions

View File

@ -28,7 +28,7 @@ import ability from '@ohos.ability.ability';
import dlpPermission from '@ohos.dlpPermission';
import fs from '@ohos.file.fs';
import abilityManager from '@ohos.app.ability.abilityManager';
import { getFileUriByPath, getFileFd, getAppId, isValidPath } from '../common/utils';
import { getFileUriByPath, getFileFd, getAppId, isValidPath, defaultDlpFile } from '../common/utils';
import Constants from '../common/constant';
import GlobalContext from '../common/GlobalContext';
import zlib from '@ohos.zlib';
@ -47,28 +47,6 @@ class ChangeOption {
public length: number = 0
}
let defaultDlpProperty: dlpPermission.DLPProperty = {
ownerAccount: '',
ownerAccountType: GlobalContext.load('domainAccount') as boolean ?
dlpPermission.AccountType.DOMAIN_ACCOUNT : dlpPermission.AccountType.CLOUD_ACCOUNT,
authUserList: [],
contactAccount: '',
offlineAccess: true,
ownerAccountID: '',
everyoneAccessList: []
}
let defaultDlpFile: dlpPermission.DLPFile = {
dlpProperty: defaultDlpProperty,
recoverDLPFile: async () => {},
closeDLPFile: async () => {},
addDLPLinkFile: async () => {},
stopFuseLink: async () => {},
resumeFuseLink: async () => {},
replaceDLPLinkFile: async () => {},
deleteDLPLinkFile: async () => {}
};
const SUFFIX_INDEX = 2;
const HEAD_LENGTH_IN_BYTE = 20;
const HEAD_LENGTH_IN_U32 = 5;

View File

@ -38,7 +38,8 @@ import {
DLPInfo,
getDLPInfo,
sendDlpFileOpenEvent,
isValidPath
isValidPath,
defaultDlpFile
} from '../common/utils';
import Constants from '../common/constant';
import GlobalContext from '../common/GlobalContext';
@ -49,28 +50,6 @@ import { HiLog } from '../common/HiLog';
const TAG = 'View';
const SUFFIX_INDEX = 2;
let defaultDlpProperty: dlpPermission.DLPProperty = {
ownerAccount: '',
ownerAccountType: GlobalContext.load('domainAccount') as boolean ?
dlpPermission.AccountType.DOMAIN_ACCOUNT : dlpPermission.AccountType.CLOUD_ACCOUNT,
authUserList: [],
contactAccount: '',
offlineAccess: true,
ownerAccountID: '',
everyoneAccessList: []
}
let defaultDlpFile: dlpPermission.DLPFile = {
dlpProperty: defaultDlpProperty,
recoverDLPFile: async () => {},
closeDLPFile: async () => {},
addDLPLinkFile: async () => {},
stopFuseLink: async () => {},
resumeFuseLink: async () => {},
replaceDLPLinkFile: async () => {},
deleteDLPLinkFile: async () => {}
};
let opening: boolean = false;
export default class ViewAbility extends ServiceExtensionAbility {
private dlpFd: number = -1;

View File

@ -47,9 +47,9 @@ export class HiLog {
* @param tag Tag
* @param message
*/
public static debug(tag: string, message: string, ...args: any[]): void {
public static debug(tag: string, message: string): void {
if (LogVersion.Debug >= HiLog.LOG_LEVEL) {
hilog.debug(HiLog.LOG_DOMAIN, `[${HiLog.APP_TAG}_${tag}]`, message, args);
hilog.debug(HiLog.LOG_DOMAIN, `[${HiLog.APP_TAG}_${tag}]`, message);
}
}
@ -58,9 +58,9 @@ export class HiLog {
* @param tag Tag
* @param message
*/
public static info(tag: string, message: string, ...args: any[]): void {
public static info(tag: string, message: string): void {
if (LogVersion.Info >= HiLog.LOG_LEVEL) {
hilog.info(HiLog.LOG_DOMAIN, `[${HiLog.APP_TAG}_${tag}]`, message, args);
hilog.info(HiLog.LOG_DOMAIN, `[${HiLog.APP_TAG}_${tag}]`, message);
}
}
@ -69,9 +69,9 @@ export class HiLog {
* @param tag Tag
* @param message
*/
public static warn(tag: string, message: string, ...args: any[]): void {
public static warn(tag: string, message: string): void {
if (LogVersion.Warn >= HiLog.LOG_LEVEL) {
hilog.warn(HiLog.LOG_DOMAIN, `[${HiLog.APP_TAG}_${tag}]`, message, args);
hilog.warn(HiLog.LOG_DOMAIN, `[${HiLog.APP_TAG}_${tag}]`, message);
}
}
@ -80,9 +80,9 @@ export class HiLog {
* @param tag Tag
* @param message
*/
public static error(tag: string, message: string, ...args: any[]): void {
public static error(tag: string, message: string): void {
if (LogVersion.Error >= HiLog.LOG_LEVEL) {
hilog.error(HiLog.LOG_DOMAIN, `[${HiLog.APP_TAG}_${tag}]`, message, args);
hilog.error(HiLog.LOG_DOMAIN, `[${HiLog.APP_TAG}_${tag}]`, message);
}
}
@ -91,9 +91,9 @@ export class HiLog {
* @param tag Tag
* @param message
*/
public static fatal(tag: string, message: string, ...args: any[]): void {
public static fatal(tag: string, message: string): void {
if (LogVersion.Fatal >= HiLog.LOG_LEVEL) {
hilog.fatal(HiLog.LOG_DOMAIN, `[${HiLog.APP_TAG}_${tag}]`, message, args);
hilog.fatal(HiLog.LOG_DOMAIN, `[${HiLog.APP_TAG}_${tag}]`, message);
}
}
}

View File

@ -30,12 +30,32 @@ import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSessi
import Constants from '../common/constant';
import GlobalContext from './GlobalContext';
import hiSysEvent from '@ohos.hiSysEvent';
import display from '@ohos.display';
import StartOptions from '@ohos.app.ability.StartOptions';
import { HiLog } from '../common/HiLog';
const TAG = 'Utils';
let defaultDlpProperty: dlpPermission.DLPProperty = {
ownerAccount: '',
ownerAccountType: GlobalContext.load('domainAccount') as boolean ?
dlpPermission.AccountType.DOMAIN_ACCOUNT : dlpPermission.AccountType.CLOUD_ACCOUNT,
authUserList: [],
contactAccount: '',
offlineAccess: true,
ownerAccountID: '',
everyoneAccessList: []
}
let defaultDlpFile: dlpPermission.DLPFile = {
dlpProperty: defaultDlpProperty,
recoverDLPFile: async () => {},
closeDLPFile: async () => {},
addDLPLinkFile: async () => {},
stopFuseLink: async () => {},
resumeFuseLink: async () => {},
replaceDLPLinkFile: async () => {},
deleteDLPLinkFile: async () => {}
};
interface AuthAccount {
authAccount: string;
textContent?: string;
@ -476,5 +496,6 @@ export {
DLPInfo,
isValidPath,
measureTextSizeWidth,
colorStatus
colorStatus,
defaultDlpFile
};

View File

@ -229,7 +229,8 @@ struct PermissionStatus {
Scroll() {
Column() {
Row() {
Text(this.authPerm === Constants.FOOTER_OPACITY_ONE ? $r('app.string.permission_status_readOnly') : $r('app.string.permission_status_title'))
Text(this.authPerm === Constants.FOOTER_OPACITY_ONE ?
$r('app.string.permission_status_readOnly') : $r('app.string.permission_status_title'))
.fontWeight(FontWeight.Regular)
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
.fontSize($r('sys.float.ohos_id_text_size_body1'))
@ -288,11 +289,16 @@ struct PermissionStatus {
})
Row() {
Text($r('app.string.apply_for_the_permission', this.accountId))
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
.fontSize($r('sys.float.ohos_id_text_size_body1'))
.align(Alignment.Start)
.fontWeight(FontWeight.Regular)
Text() {
Span($r('app.string.apply_for_the_subject'))
if (this.authPerm === Constants.FOOTER_OPACITY_ONE) {
Span($r('app.string.apply_for_the_permission', this.accountId))
}
}
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
.fontSize($r('sys.float.ohos_id_text_size_body1'))
.align(Alignment.Start)
.fontWeight(FontWeight.Regular)
}
.width(Constants.HEADER_COLUMN_WIDTH)
.margin({ top: Constants.DA_MARGIN_TOP, bottom: Constants.DU_LINE_MARGIN_TOP2 })

View File

@ -56,10 +56,6 @@
"name": "export",
"value": "Export"
},
{
"name": "modifying_the_permissions_of_a_document",
"value": "Modify permissions"
},
{
"name": "sure",
"value": "Ok"
@ -72,10 +68,6 @@
"name": "perm_list_title_read_only",
"value": "Read-only"
},
{
"name": "perm_list_title_full_control",
"value": "Full control"
},
{
"name": "da_button",
"value": "OK"
@ -236,6 +228,10 @@
"name": "apply_for_the_permission",
"value": "To request permissions, contact %s."
},
{
"name": "apply_for_the_subject",
"value": "The specific permissions are subject to the actual functions of the app."
},
{
"name": "delete_account",
"value": "Delete"

View File

@ -56,10 +56,6 @@
"name": "export",
"value": "导出"
},
{
"name": "modifying_the_permissions_of_a_document",
"value": "修改文档的权限"
},
{
"name": "sure",
"value": "确定"
@ -72,10 +68,6 @@
"name": "perm_list_title_read_only",
"value": "只读"
},
{
"name": "perm_list_title_full_control",
"value": "完全控制"
},
{
"name": "da_button",
"value": "知道了"
@ -234,7 +226,11 @@
},
{
"name": "apply_for_the_permission",
"value": "申请权限请联系:%s"
"value": "如需申请权限,请联系 %s"
},
{
"name": "apply_for_the_subject",
"value": "具体权限以应用实际功能为准。"
},
{
"name": "delete_account",