!30 锁屏日志整改

Merge pull request !30 from 吕晓强/log_foramt_review
This commit is contained in:
openharmony_ci 2022-05-25 07:43:38 +00:00 committed by Gitee
commit 069d80f608
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
49 changed files with 232 additions and 203 deletions

View File

@ -23,8 +23,10 @@ const TAG = 'ReadConfigUtil';
export class ReadConfigUtil {
ReadConfigFile(fileName) {
Log.showInfo(TAG, `readConfigFile fileName:${fileName}`);
let stream;
let content : string = "";
try {
let stream = FileIo.createStreamSync(fileName, 'r');
stream = FileIo.createStreamSync(fileName, 'r');
Log.showInfo(TAG, `readConfigFile stream:` + stream);
let buf = new ArrayBuffer(DFAULT_SIZE);
let len = stream.readSync(buf);
@ -34,13 +36,15 @@ export class ReadConfigUtil {
for (let i = len;i < DFAULT_SIZE; i++) {
arr[i] = charAt;
}
let content = String.fromCharCode.apply(null, arr);
stream.closeSync();
Log.showInfo(TAG, `readConfigFile content:` + JSON.stringify(content));
return JSON.parse(content);
content = String.fromCharCode.apply(null, arr);
Log.showDebug(TAG, `readConfigFile content:` + JSON.stringify(content));
} catch (error) {
Log.showInfo(TAG, `readConfigFile error:` + JSON.stringify(error));
Log.showError(TAG, `readConfigFile error:` + JSON.stringify(error));
content = "";
} finally{
stream.closeSync();
}
return JSON.stringify(content);
}
}

View File

@ -28,6 +28,8 @@ export enum ScreenLockStatus {
export function ReadConfigFile(fileName) {
Log.showInfo(TAG, `readConfigFile fileName:${fileName}`);
let stream;
let content : string = "";
try {
let stream = FileIo.createStreamSync(fileName, 'r');
Log.showInfo(TAG, `readConfigFile stream:` + stream);
@ -39,11 +41,13 @@ export function ReadConfigFile(fileName) {
for (let i = len;i < DFAULT_SIZE; i++) {
arr[i] = charAt;
}
let content = String.fromCharCode.apply(null, arr);
stream.closeSync();
Log.showInfo(TAG, `readConfigFile content:` + JSON.stringify(content));
return JSON.parse(content);
content = String.fromCharCode.apply(null, arr);
Log.showDebug(TAG, `readConfigFile content:` + JSON.stringify(content));
} catch (error) {
Log.showInfo(TAG, `readConfigFile error:` + JSON.stringify(error));
Log.showError(TAG, `readConfigFile error:` + JSON.stringify(error));
content = "";
} finally {
stream.closeSync();
}
return JSON.stringify(content);
}

View File

@ -22,7 +22,7 @@ const AUDIO_MANAGER_KEY = 'MultiMediaAudioManager';
export default function createOrGet<T>(objectClass: { new(): T }, storageKey: string): T {
if (!globalThis[storageKey]) {
globalThis[storageKey] = new objectClass();
Log.showInfo(TAG, `Create key of ${storageKey}`);
Log.showDebug(TAG, `Create key of ${storageKey}`);
}
return globalThis[storageKey];
}

View File

@ -21,7 +21,7 @@ export class StyleManager {
mAbilityPageName: string = '';
setAbilityPageName(name: string): void{
Log.showInfo(TAG, `setAbilityPageName, name: ${name}`);
Log.showDebug(TAG, `setAbilityPageName, name: ${name}`);
this.mAbilityPageName = name;
}
@ -30,7 +30,7 @@ export class StyleManager {
if (!AppStorage.Has(newKey)) {
let defaultStyle = generateDefaultFunction();
AppStorage.SetOrCreate(newKey, defaultStyle);
Log.showInfo(TAG, `Create storageKey of ${newKey}`);
Log.showDebug(TAG, `Create storageKey of ${newKey}`);
}
return AppStorage.Get(newKey);
}

View File

@ -41,8 +41,9 @@ export class UserInfo {
async function getCurrentAccountInfo(): Promise<AccountInfo> {
let accountInfos = await AccountManager.getAccountManager().queryAllCreatedOsAccounts();
Log.showInfo(TAG, `accountInfos size:${accountInfos.length}`);
for (let accountInfo of accountInfos) {
Log.showInfo(TAG, `accountInfo: ${accountInfo.localId}, isActive: ${accountInfo.isActived}`);
Log.showDebug(TAG, `accountInfo: ${accountInfo.localId}, isActive: ${accountInfo.isActived}`);
if (accountInfo.isActived) {
return accountInfo;
}
@ -68,7 +69,7 @@ export default class SwitchUserManager {
}
constructor() {
Log.showInfo(TAG, `SwitchUserManager constructor`);
Log.showDebug(TAG, `SwitchUserManager constructor`);
AccountManager.getAccountManager().on(USER_CHANGE_EVENT, SUBSCRIBE_KEY, this.handleUserChange.bind(this));
}

View File

@ -77,7 +77,7 @@ class TimeManager {
}
private initTimeFormat(context: any) {
Log.showInfo(TAG, "initTimeFormat");
Log.showDebug(TAG, "initTimeFormat");
this.mSettingsHelper = featureAbility.acquireDataAbilityHelper(context, URI_VAR);
try {
@ -94,7 +94,7 @@ class TimeManager {
}
private handleTimeFormatChange() {
Log.showInfo(TAG, "handleTimeFormatChange")
Log.showDebug(TAG, "handleTimeFormatChange")
if (!this.mSettingsHelper) {
Log.showError(TAG, `Can't get dataAbility helper.`);
return;
@ -106,7 +106,7 @@ class TimeManager {
};
private notifyTimeChange() {
Log.showInfo(TAG, "notifyTimeChange");
Log.showDebug(TAG, "notifyTimeChange");
let args: TimeEventArgs = {
date: new Date(),
timeFormat: this.mUse24hFormat,

View File

@ -61,19 +61,30 @@ class WindowManager {
async createWindow(context: any, name: WindowType, rect: Rect, loadContent: string): Promise<WindowHandle> {
Log.showInfo(TAG, `createWindow name: ${name}, rect: ${JSON.stringify(rect)}, url: ${loadContent}`);
let winHandle = await Window.create(context, name, SYSTEM_WINDOW_TYPE_MAP[name]);
await winHandle.moveTo(rect.left, rect.top);
await winHandle.resetSize(rect.width, rect.height);
await winHandle.loadContent(loadContent);
this.mWindowInfos.set(name, { visibility: false, rect });
Log.showInfo(TAG, `create window[${name}] success.`);
let winHandle = null;
try{
winHandle = await Window.create(context, name, SYSTEM_WINDOW_TYPE_MAP[name]);
await winHandle.moveTo(rect.left, rect.top);
await winHandle.resetSize(rect.width, rect.height);
await winHandle.loadContent(loadContent);
this.mWindowInfos.set(name, { visibility: false, rect });
Log.showInfo(TAG, `create window[${name}] success.`);
} catch (err) {
Log.showError(TAG, `create window[${name}] failed. error:${JSON.stringify(err)}`);
}
return winHandle;
}
async resetSizeWindow(name: WindowType, rect: Rect): Promise<void> {
let window = await Window.find(name);
await window.moveTo(rect.left, rect.top);
await window.resetSize(rect.width, rect.height);
Log.showInfo(TAG, `resetSizeWindow name: ${name}, rect: ${JSON.stringify(rect)}`);
let window = null;
try {
window = await Window.find(name);
await window.moveTo(rect.left, rect.top);
await window.resetSize(rect.width, rect.height);
} catch(err) {
Log.showError(TAG, `resetSizeWindow failed. error:${JSON.stringify(err)}`);
}
this.mWindowInfos.set(name, { ...(this.mWindowInfos.get(name) ?? DEFAULT_WINDOW_INFO), rect });
EventManager.publish(
obtainLocalEvent(WINDOW_RESIZE_EVENT, {
@ -81,12 +92,18 @@ class WindowManager {
rect,
})
);
Log.showInfo(TAG, `resize window[${name}] success, rect: ${JSON.stringify(rect)}.`);
Log.showInfo(TAG, `resize window[${name}] success.`);
}
async showWindow(name: WindowType): Promise<void> {
let window = await Window.find(name);
await window.show();
Log.showInfo(TAG, `showWindow name: ${name}`);
let window = null;
try {
window = await Window.find(name);
await window.show();
} catch (err) {
Log.showError(TAG, `showWindow failed. error:${JSON.stringify(err)}`);
}
this.mWindowInfos.set(name, { ...(this.mWindowInfos.get(name) ?? DEFAULT_WINDOW_INFO), visibility: true });
EventManager.publish(
obtainLocalEvent(WINDOW_SHOW_HIDE_EVENT, {
@ -98,8 +115,14 @@ class WindowManager {
}
async hideWindow(name: WindowType): Promise<void> {
let window = await Window.find(name);
await window.hide();
Log.showInfo(TAG, `hideWindow name: ${name}`);
let window = null;
try {
window = await Window.find(name);
await window.hide();
} catch (err) {
Log.showError(TAG, `hideWindow failed. error:${JSON.stringify(err)}`);
}
this.mWindowInfos.set(name, { ...(this.mWindowInfos.get(name) ?? DEFAULT_WINDOW_INFO), visibility: false });
EventManager.publish(
obtainLocalEvent(WINDOW_SHOW_HIDE_EVENT, {
@ -116,7 +139,7 @@ class WindowManager {
// function need remove
setWindowInfo(configInfo) {
Log.showInfo(TAG, `setWindowInfo, configInfo ${JSON.stringify(configInfo)}`);
Log.showDebug(TAG, `setWindowInfo, configInfo ${JSON.stringify(configInfo)}`);
let maxWidth = AppStorage.SetAndLink("maxWidth", configInfo.maxWidth);
let maxHeight = AppStorage.SetAndLink("maxHeight", configInfo.maxHeight);
let minHeight = AppStorage.SetAndLink("minHeight", configInfo.minHeight);

View File

@ -30,12 +30,12 @@ export default class AbilityManager {
static ABILITY_NAME_SCREEN_LOCK = 'SystemUi_ScreenLock';
static setContext(abilityName: string, context) {
Log.showInfo(TAG, `setContext, abilityName: ${abilityName}`);
Log.showDebug(TAG, `setContext, abilityName: ${abilityName}`);
globalThis[abilityName + '_Context'] = context;
}
static getContext(abilityName?: string) {
Log.showInfo(TAG, `getContext, abilityName: ${abilityName}`);
Log.showDebug(TAG, `getContext, abilityName: ${abilityName}`);
if (!abilityName) {
abilityName = AbilityManager.ABILITY_NAME_ENTRY;
}
@ -43,17 +43,17 @@ export default class AbilityManager {
}
static setAbilityData(abilityName, key, data) {
Log.showInfo(TAG, `setAbilityData, abilityName: ${abilityName} key: ${key} data: ${JSON.stringify(data)}`);
Log.showDebug(TAG, `setAbilityData, abilityName: ${abilityName} key: ${key} data: ${JSON.stringify(data)}`);
globalThis[abilityName + '_data_' + key] = data;
}
static getAbilityData(abilityName, key) {
Log.showInfo(TAG, `getAbilityData, abilityName: ${abilityName} key: ${key} `);
Log.showDebug(TAG, `getAbilityData, abilityName: ${abilityName} key: ${key} `);
return globalThis[abilityName + '_data_' + key];
}
static startAbility(want, callback?: Function) {
Log.showInfo(TAG, `startAbility, want: ${JSON.stringify(want)}`);
Log.showDebug(TAG, `startAbility, want: ${JSON.stringify(want)}`);
let context = AbilityManager.getContext();
context.startAbility(want).then(() => {
Log.showInfo(TAG, `startAbility, then`);
@ -61,7 +61,7 @@ export default class AbilityManager {
callback(null);
}
}).catch((error) => {
Log.showInfo(TAG, `startAbility, error: ${JSON.stringify(error)}`);
Log.showError(TAG, `startAbility, error: ${JSON.stringify(error)}`);
callback(error);
})
}

View File

@ -23,7 +23,7 @@ const TAG = "BRManager";
export default class BundleManager {
static async getResourceManager(tag: string, context: Context, bundleName: string) {
Log.showInfo(TAG, `getResourceManager from: ${tag}`);
let bundleContext = await context.createBundleContext(bundleName);
let bundleContext = await context.createBundleContext(bundleName)
return await bundleContext.resourceManager;
}
@ -32,7 +32,7 @@ export default class BundleManager {
let userInfo = {
userId: requestId ?? (await SwitchUserManager.getInstance().getCurrentUserInfo()).userId,
};
Log.showInfo(TAG, `getBundleInfo from: ${tag}, userId: ${userInfo.userId}`);
Log.showDebug(TAG, `getBundleInfo from: ${tag}, userId: ${userInfo.userId}`);
return await BundleMgr.getBundleInfo(bundleName, getInfo, userInfo);
}
}

View File

@ -21,18 +21,17 @@ const TAG = 'FeatureAbilityManager';
export default class FeatureAbilityManager {
openAbility(tag, want) {
Log.showInfo(TAG, `openAbility from: ${tag}`));
Log.showInfo(TAG, `openAbility from: ${tag}`);
let result = FeatureAbility.startAbility(want)
.then(data =>
Log.showInfo(TAG, `tag: ${tag} promise then: ${JSON.stringify(data)}`))
.catch(error =>
Log.showError(TAG, `tag: ${tag} promise catch: ${JSON.stringify(error)}`));
Log.showInfo(TAG, `tag: ${tag} openAbility result: ${result}`);
Log.showError(TAG, `tag: ${tag} promise catch: ${JSON.stringify(error)}, openAbility result: ${result}`));
}
getAbilityWant(listener) {
FeatureAbility.getWant((err, data) => {
Log.showInfo(TAG, `getAbilityWant callBack err: ${JSON.stringify(err)} data: ${JSON.stringify(data)}`);
Log.showDebug(TAG, `getAbilityWant callBack err: ${JSON.stringify(err)} data: ${JSON.stringify(data)}`);
if (err.code !== 0) {
Log.showError(TAG, `failed to getAbilityWant because ${err.message}`);
return;
@ -60,7 +59,7 @@ export default class FeatureAbilityManager {
Log.showError(TAG, `failed to finishAbility because ${JSON.stringify(err)}`);
return;
}
Log.showInfo(TAG, ` finishAbility callback err: ${JSON.stringify(err)} data:${data}`);
Log.showInfo(TAG, ` finishAbility callback: data:${data}`);
});
}
}

View File

@ -48,7 +48,7 @@ export function getCommonEventManager(
let policyClearCb: Map<POLICY, ClearPolicy> | undefined = undefined;
async function subscriberCommonEvent() {
Log.showInfo(TAG, "registerSubscriber start");
Log.showDebug(TAG, "registerSubscriber start");
let subscriber = await commonEvent.createSubscriber(SUBSCRIBE_INFOS);
commonEvent.subscribe(subscriber, (err, data) => {
if (err.code != 0) {
@ -64,7 +64,7 @@ export function getCommonEventManager(
}
function unSubscriberCommonEvent() {
Log.showInfo(TAG, `UnSubcribers size: ${unSubcribers.length}`);
Log.showDebug(TAG, `UnSubcribers size: ${unSubcribers.length}`);
unSubcribers.forEach((unsubscribe) => unsubscribe());
unSubcribers.length = 0;
subscribeStateChange && subscribeStateChange(false);
@ -76,7 +76,7 @@ export function getCommonEventManager(
policys.forEach((policy) => {
if (policyClearCb) {
!policyClearCb.has(policy) && policyClearCb.set(policy, policyMap[policy](innerManager));
Log.showInfo(TAG, `apply policy: ${policy}`);
Log.showDebug(TAG, `apply policy: ${policy}`);
}
});
}

View File

@ -32,7 +32,7 @@ const SUBSCRIBE_INFO = {
};
function getChargingStatus(state: typeof BatteryInfo.BatteryChargeState): boolean {
Log.showInfo(TAG, `charging status update: ${state}`);
Log.showDebug(TAG, `charging status update: ${state}`);
let batteryStatus = false;
switch (state) {
case BatteryInfo.BatteryChargeState.DISABLE:
@ -62,7 +62,7 @@ export class BatteryModel {
() => this.updateBatteryStatus(),
(isSubscribe: boolean) => isSubscribe && this.updateBatteryStatus()
);
Log.showInfo(TAG, "initBatteryModel");
Log.showDebug(TAG, "initBatteryModel");
this.mBatterySoc = AppStorage.SetAndLink("batterySoc", 0);
this.mBatteryCharging = AppStorage.SetAndLink("batteryCharging", false);
this.mManager.subscriberCommonEvent();
@ -70,7 +70,7 @@ export class BatteryModel {
}
unInitBatteryModel() {
Log.showInfo(TAG, "unInitBatteryModel");
Log.showDebug(TAG, "unInitBatteryModel");
this.mManager?.release();
this.mManager = undefined;
}
@ -79,7 +79,7 @@ export class BatteryModel {
* Get battery status and remaining power
*/
private updateBatteryStatus() {
Log.showInfo(TAG, "updateBatteryStatus");
Log.showDebug(TAG, "updateBatteryStatus");
let batterySoc = BatteryInfo.batterySOC ?? DEFAULT_PROGRESS;
let batteryCharging = BatteryInfo.chargingStatus;
if (batterySoc <= 0) {

View File

@ -14,7 +14,7 @@
*/
import StyleManager from '../../../../../../../common/src/main/ets/default/StyleManager';
import Constants from './Constants'
import Constants from './constants'
const TAG = 'battery-StyleConfiguration';

View File

@ -22,7 +22,7 @@ import StyleConfigurationCommon from '../../../../../../../common/src/main/ets/d
import StyleConfiguration from '../common/StyleConfiguration'
import { StatusBarGroupComponentData
} from '../../../../../../screenlock/src/main/ets/com/ohos/common/Constants'
import StatusBarVM from '../../../../../../screenlock/src/main/ets/com/ohos/vM/StatusBarVM'
import StatusBarVM from '../../../../../../screenlock/src/main/ets/com/ohos/vm/StatusBarVM'
const TAG = 'BatteryComponent-batteryIcon'

View File

@ -72,7 +72,7 @@ struct BatteryPic {
}
private getBatteryColor(val, charging) {
Log.showInfo(TAG, `getBatteryColor, val: ${ val } charging: ${ charging } `);
Log.showDebug(TAG, `getBatteryColor, val: ${ val } charging: ${ charging } `);
if (charging) {
return this.style.picChargingColor;
} else if (val <= Constants.BATTERY_LEVEL_LOW) {

View File

@ -14,7 +14,7 @@
*/
import Log from '../../../../../../../common/src/main/ets/default/Log'
import StyleConfiguration from '../common/styleconfiguration'
import StyleConfiguration from '../common/StyleConfiguration'
import StyleConfigurationCommon from '../../../../../../../common/src/main/ets/default/StyleConfiguration'
import { StatusBarGroupComponentData } from '../../../../../../screenlock/src/main/ets/com/ohos/common/Constants'
import StatusBarVM from '../../../../../../screenlock/src/main/ets/com/ohos/vm/StatusBarVM'

View File

@ -44,40 +44,40 @@ export default class DateTimeViewModel {
unSubscriber?: unsubscribe;
ViewModelInit(): void{
Log.showInfo(TAG, 'ViewModelInit');
Log.showDebug(TAG, 'ViewModelInit');
this.getAndSetDateTime.bind(this)()
commonEvent.createSubscriber(mCommonEventSubscribeInfo, this.createSubscriberCallBack.bind(this));
this.unSubscriber = EventManager.subscribe(TIME_CHANGE_EVENT, (args: TimeEventArgs) => {
this.setDateTime(args.date)
});
Log.showInfo(TAG, 'ViewModelInit end');
Log.showDebug(TAG, 'ViewModelInit end');
}
private getAndSetDateTime() {
Log.showInfo(TAG, `getAndSetDateTime`)
Log.showDebug(TAG, `getAndSetDateTime`)
this.setDateTime(new Date())
}
private setDateTime(date: Date) {
Log.showInfo(TAG, `setDateTime`)
Log.showDebug(TAG, `setDateTime`)
this.timeVal = sTimeManager.formatTime(date)
this.dateVal = DateTimeCommon.getSystemDate()
this.weekVal = DateTimeCommon.getSystemWeek()
}
private createSubscriberCallBack(err, data) {
Log.showInfo(TAG, "start createSubscriberCallBack " + JSON.stringify(data))
Log.showDebug(TAG, "start createSubscriberCallBack " + JSON.stringify(data))
mEventSubscriber = data
commonEvent.subscribe(data, this.getAndSetDateTime.bind(this));
Log.showInfo(TAG, "start createSubscriberCallBack finish")
Log.showDebug(TAG, "start createSubscriberCallBack finish")
}
stopPolling() {
Log.showInfo(TAG, `stopPolling start`)
Log.showDebug(TAG, `stopPolling start`)
commonEvent.unsubscribe(mEventSubscriber);
this.unSubscriber && this.unSubscriber();
this.unSubscriber = undefined;
Log.showInfo(TAG, `stopPolling end`)
Log.showDebug(TAG, `stopPolling end`)
}
}

View File

@ -27,9 +27,9 @@ const DEFAULT_INFO = {
export default class CommonUtil {
static startWant(want, triggerInfo?: any) {
let info = (triggerInfo) ? triggerInfo : DEFAULT_INFO;
Log.showInfo(TAG, `startWant ${JSON.stringify(want)}, info ${JSON.stringify(info)}`);
Log.showDebug(TAG, `startWant ${JSON.stringify(want)}, info ${JSON.stringify(info)}`);
WantAgent.trigger(want, info, ((err, data) => {
Log.showInfo(TAG, `wantAgent trigger err ${JSON.stringify(err)} data ${JSON.stringify(data)}`);
Log.showDebug(TAG, `wantAgent trigger err ${JSON.stringify(err)} data ${JSON.stringify(data)}`);
}));
}

View File

@ -20,23 +20,23 @@ export default class ScrollbarManager {
static NotificationScrollBar = new Set<Scroller>();
static add(scroller) {
Log.showInfo(TAG, `add`);
Log.showDebug(TAG, `add`);
let res = ScrollbarManager.NotificationScrollBar.add(scroller);
Log.showInfo(TAG, `add set's size:${res.size}`);
Log.showDebug(TAG, `add set's size:${res.size}`);
}
static delete(scroller) {
Log.showInfo(TAG, `delete`);
Log.showDebug(TAG, `delete`);
ScrollbarManager.NotificationScrollBar.delete(scroller);
}
static clear() {
Log.showInfo(TAG, `clear`);
Log.showDebug(TAG, `clear`);
ScrollbarManager.NotificationScrollBar.clear();
}
static restoreOtherScroll(scroller) {
Log.showInfo(TAG, `restoreOtherScroll`);
Log.showDebug(TAG, `restoreOtherScroll`);
if (scroller.currentOffset().xOffset > 0) {
ScrollbarManager.NotificationScrollBar.forEach((item) => {
if (item !== scroller && item.currentOffset().xOffset > 0) {

View File

@ -27,39 +27,38 @@ export default class NotificationDistributionManager {
static getInstance() {
Log.showInfo(TAG, `getInstance`);
if (distributionManager == null) {
Log.showInfo(TAG, `getInstance distributionManager new`);
Log.showDebug(TAG, `getInstance distributionManager new`);
distributionManager = new NotificationDistributionManager();
distributionManager.initDeviceManager();
return distributionManager;
}
Log.showInfo(TAG, `getInstance return distributionManager`);
Log.showDebug(TAG, `getInstance return distributionManager`);
return distributionManager;
}
constructor() {
Log.showInfo(TAG, `constructor`);
Log.showDebug(TAG, `constructor`);
}
initDeviceManager() {
Log.showInfo(TAG, `initDeviceManager`);
DeviceManager.createDeviceManager("com.ohos.systemui", (err, data) => {
if (err) {
console.info("createDeviceManager err:" + JSON.stringify(err));
Log.showError(TAG, `createDeviceManager err: ${JSON.stringify(err)}`);
return;
}
console.info("createDeviceManager success");
Log.showInfo(TAG, "createDeviceManager success");
this.deviceManager = data;
});
}
getTrustedDeviceDeviceName(deviceId) {
Log.showInfo(TAG, `getTrustedDeviceDeviceName deviceId:${deviceId}`);
Log.showDebug(TAG, `getTrustedDeviceDeviceName deviceId:${deviceId}`);
let deviceName = '';
let deviceArr:any[] = this.getTrustedDeviceListSync();
Log.showInfo(TAG, `getTrustedDeviceDeviceName deviceArr:${JSON.stringify(deviceArr)}`);
Log.showDebug(TAG, `getTrustedDeviceDeviceName deviceArr:${deviceArr.length}`);
if (deviceArr && deviceArr.length > 0) {
for (let item of deviceArr) {
Log.showInfo(TAG, `getTrustedDeviceDeviceName deviceArr item:${JSON.stringify(item)}`);
if (item.deviceId == deviceId) {
deviceName = item.deviceName;
break;
@ -70,12 +69,12 @@ export default class NotificationDistributionManager {
}
getTrustedDeviceListSync(): Array<any>{
Log.showInfo(TAG, `getTrustedDeviceListSync`);
Log.showDebug(TAG, `getTrustedDeviceListSync`);
return this.deviceManager.getTrustedDeviceListSync();
}
getLocalDeviceInfoSync() {
Log.showInfo(TAG, `getLocalDeviceInfoSync`);
Log.showDebug(TAG, `getLocalDeviceInfoSync`);
return this.deviceManager.getLocalDeviceInfoSync();
}

View File

@ -117,14 +117,13 @@ export default class NotificationManager {
jsonPath: templatePath
};
Log.showInfo(TAG, `requestTemplate requestParam: ${JSON.stringify(requestParam)}`)
Log.showDebug(TAG, `requestTemplate requestParam: ${JSON.stringify(requestParam)}`)
NotificationManager.request(tag, requestParam, (err, data) => {
Log.showInfo(TAG, `request finished err: ${JSON.stringify(err)} data: ${JSON.stringify(data)}`)
Log.showInfo(TAG, `request finished templateData: ${templateName} data: ${JSON.stringify(data.componentTemplate)}`)
Log.showDebug(TAG, `request finished err: ${JSON.stringify(err)} data: ${JSON.stringify(data)}`)
if (data !== null && data !== undefined) {
Log.showInfo(TAG, `request finished data.componentTemplate.source:${JSON.stringify(data.componentTemplate.source)}`)
let templates = JSON.parse(data.componentTemplate.source);
Log.showInfo(TAG, `request templates: ${JSON.stringify(templates)}`)
Log.showDebug(TAG, `request data.componentTemplate.source:${JSON.stringify(data.componentTemplate.source)}`+
`templates: ${JSON.stringify(templates)}`)
for (let key in templates) {
NotificationManager.NotificationTemplateMap.set(key, {
"source": templates[key], "ability": ""
@ -146,18 +145,18 @@ export default class NotificationManager {
name: DEBUG_TEMPLATE_NAME,
data: reqData
};
Log.showInfo(TAG, `requestDebugTemplate requestParam: ${JSON.stringify(requestParam)}`);
Log.showDebug(TAG, `requestDebugTemplate requestParam: ${JSON.stringify(requestParam)}`);
NotificationManager.request(tag, requestParam, (err, data) => {
Log.showInfo(TAG, `requestDebugTemplate finished err: ${JSON.stringify(err)} data: ${JSON.stringify(data)}`)
Log.showDebug(TAG, `requestDebugTemplate finished err: ${JSON.stringify(err)} data: ${JSON.stringify(data)}`)
if (!!data) {
Log.showInfo(TAG, `requestDebugTemplate finished data.componentTemplate.source:${JSON.stringify(data.componentTemplate.source)}`)
Log.showDebug(TAG, `requestDebugTemplate finished data.componentTemplate.source:${JSON.stringify(data.componentTemplate.source)}`)
NotificationManager.NotificationTemplateMap.set(DEBUG_TEMPLATE_NAME, data.componentTemplate);
}
});
}
static isDebugMode(tag): boolean{
Log.showInfo(TAG, `isDebugMode from: ${tag}`);
Log.showDebug(TAG, `isDebugMode from: ${tag}`);
let debug = Systemparameter.getSync(DEBUG_SETTING_KEY, "")
Log.showInfo(TAG, `Systemparameter DEBUG_SETTING: ${debug}`);
return!!debug;

View File

@ -25,7 +25,7 @@ class NotificationWindowManager {
}
hideNotificationWindow() {
Log.showInfo(TAG, 'hide Notification window');
Log.showDebug(TAG, 'hide Notification window');
EventManager.publish(obtainLocalEvent('hideNotificationWindowEvent', ''));
}
}

View File

@ -39,8 +39,11 @@ type NotificationContent = {
}
async function getUserId(uid) {
let userId = await AccountManager.getAccountManager().getOsAccountLocalIdFromUid(uid);
Log.showInfo(TAG, `getOsAccountLocalIdFromUid uid = ${uid}, userId = ${userId}`);
let userId = await AccountManager.getAccountManager().getOsAccountLocalIdFromUid(uid)
.catch((err)=>{
Log.showError(TAG, `getOsAccountLocalIdFromUid error error: ${JSON.stringify(err)}`);
})
Log.showDebug(TAG, `getOsAccountLocalIdFromUid uid = ${uid}, userId = ${userId}`);
return userId;
}
@ -53,8 +56,8 @@ export default class ParseDataUtil {
if (!request) {
return Promise.reject('consumeCallback request is empty');
}
Log.showInfo(TAG, `parse data start, want = ${JSON.stringify(request.wantAgent)}`);
Log.showInfo(TAG, `actionButtons = ${JSON.stringify(request.actionButtons)}`);
Log.showDebug(TAG, `parse data start, want = ${JSON.stringify(request.wantAgent)}`+
`actionButtons = ${JSON.stringify(request.actionButtons)}`);
let userId = await getUserId(request.creatorUid);
let appMessage = await ParseDataUtil.getAppData(request.creatorBundleName, userId);
let notificationItem: NotificationItemData = {
@ -84,7 +87,7 @@ export default class ParseDataUtil {
deviceId: request.deviceId,
groupName: request.groupName??request.hashcode
};
Log.showInfo(TAG, `notificationItem construct over ====================`);
Log.showDebug(TAG, `notificationItem construct over`);
notificationItem = {
...notificationItem, ...ParseDataUtil.getContentByType(request?.content?.contentType, request)
}
@ -98,9 +101,9 @@ export default class ParseDataUtil {
* @return {object} appData
*/
static async getAppData(bundleName, userId) {
Log.showInfo(TAG, `getAppName start by ${bundleName}`);
Log.showDebug(TAG, `getAppName start by ${bundleName}`);
if (appDataMap.has(bundleName)) {
Log.showInfo(TAG, `getAppData success.`);
Log.showDebug(TAG, `getAppData success.`);
return appDataMap.get(bundleName);
}
let data = await BundleManager.getBundleInfo(TAG, bundleName, 0, userId);
@ -167,10 +170,10 @@ export default class ParseDataUtil {
['expandedTitle', ''], ['picture', '']], request.content.picture)
break;
default:
Log.showInfo(TAG, 'no match content type');
Log.showDebug(TAG, 'no match content type');
break;
}
Log.showInfo(TAG, `notificationType = ${notificationType}, content = ${JSON.stringify(content)}`);
Log.showDebug(TAG, `notificationType = ${notificationType}, content = ${JSON.stringify(content)}`);
return content
}
}

View File

@ -30,18 +30,18 @@ export class RuleController {
* @param {callback} Data of the type to show the notification
*/
getNotificationData(notificationItemData: NotificationItemData, callback) {
Log.showInfo(TAG, "getNotificationData start")
Log.showDebug(TAG, "getNotificationData start")
this.isAllowSendNotification(notificationItemData, (isSuccess) => {
if (!isSuccess) {
Log.showInfo(TAG, "user is not allow this to send notification");
Log.showDebug(TAG, "user is not allow this to send notification");
callback(undefined);
return;
}
this.getNotificationDataByApp(notificationItemData, (originalData) => {
Log.showInfo(TAG, `originalData = ${JSON.stringify(originalData)}`);
Log.showDebug(TAG, `originalData = ${JSON.stringify(originalData)}`);
this.updateNotificationDataBySense(originalData, (finalData) => {
Log.showInfo(TAG, `finalData = ${JSON.stringify(finalData)}`);
Log.showDebug(TAG, `finalData = ${JSON.stringify(finalData)}`);
callback(finalData);
});
});
@ -55,7 +55,7 @@ export class RuleController {
* @param {callback} The user allow the app send notification or not
*/
isAllowSendNotification(notificationItemData, callback) {
Log.showInfo(TAG, "isAllowSendNotification start");
Log.showDebug(TAG, "isAllowSendNotification start");
Notification.isNotificationEnabled({ bundle: notificationItemData.bundleName, uid: notificationItemData.uid })
.then((flag) => {
Log.showInfo(TAG, `Notification.isNotificationEnabled:` + flag)
@ -71,16 +71,16 @@ export class RuleController {
*/
SoundOrVibrate(notificationItemData, callback) {
Log.showInfo(TAG, "SoundOrVibrate start")
Log.showDebug(TAG, "SoundOrVibrate start")
let sound = false;
let vibrationValues = false;
if (!CheckEmptyUtils.checkStrIsEmpty(notificationItemData.sound)) {
sound = true;
Log.showInfo(TAG, `notificationItemData.sound is allowed = ${sound}`);
Log.showDebug(TAG, `notificationItemData.sound is allowed = ${sound}`);
}
if (!CheckEmptyUtils.isEmptyArr(notificationItemData.vibrationValues)) {
vibrationValues = true;
Log.showInfo(TAG, `notificationItemData.vibrationValues is allowed = ${vibrationValues}`);
Log.showDebug(TAG, `notificationItemData.vibrationValues is allowed = ${vibrationValues}`);
}
callback(sound, vibrationValues);
}
@ -93,7 +93,7 @@ export class RuleController {
* @param {callback} The type to show notification
*/
getNotificationDataByApp(notificationItemData, callback) {
Log.showInfo(TAG, "getNotificationDataByApp start")
Log.showDebug(TAG, "getNotificationDataByApp start")
let mNotificationItemData : NotificationItemData = notificationItemData;
mNotificationItemData.ruleData = {
isAllowBanner: false,
@ -102,7 +102,7 @@ export class RuleController {
isAllowStatusBarShow : false,
isAllowNotificationListShow : false
};
Log.showInfo(TAG, `notificationItemData.slotLevel = ${notificationItemData.slotLevel}`);
Log.showDebug(TAG, `notificationItemData.slotLevel = ${notificationItemData.slotLevel}`);
if (notificationItemData.slotLevel === SlotLevel.LEVEL_HIGH) {
mNotificationItemData.ruleData.isAllowBanner = true;
this.SoundOrVibrate(notificationItemData, (sound, vibrationValues) => {
@ -125,7 +125,7 @@ export class RuleController {
} else {
mNotificationItemData.ruleData.isAllowNotificationListShow = false;
}
Log.showInfo(TAG, `mNotificationItemData.ruleData = ${JSON.stringify(mNotificationItemData.ruleData)}`);
Log.showDebug(TAG, `mNotificationItemData.ruleData = ${JSON.stringify(mNotificationItemData.ruleData)}`);
callback(mNotificationItemData);
}
@ -138,7 +138,7 @@ export class RuleController {
* @param {callback} The final notification data
*/
updateNotificationDataBySense(notificationItemData, callback) {
Log.showInfo(TAG, "updateNotificationDataBySense start")
Log.showDebug(TAG, "updateNotificationDataBySense start")
let mNotificationItemData = notificationItemData;
callback(mNotificationItemData);
}

View File

@ -120,7 +120,7 @@ export default struct BannerNotificationItem {
})
.onClick(this.showDevicesDialog.bind(this))
.onAreaChange((e, e2) => {
Log.showInfo(TAG, `onAreaChange, e: ${JSON.stringify(e)} e2: ${JSON.stringify(e2)}`);
Log.showDebug(TAG, `onAreaChange, e: ${JSON.stringify(e)} e2: ${JSON.stringify(e2)}`);
let heightEx = parseInt(e['height']);
let heightCur = parseInt(e2['height']);
let heightWin = parseInt(this.mDefaultBannerRect['height']);
@ -154,12 +154,12 @@ export default struct BannerNotificationItem {
}
isCreateNewNotification(notificationCount:number):boolean{
Log.showInfo(TAG, `isCreateNewNotification, notificationCount: ${notificationCount}`);
Log.showDebug(TAG, `isCreateNewNotification, notificationCount: ${notificationCount}`);
return true;
}
hideWindowForTimeout() {
Log.showInfo(TAG, `check need hide window or not.`)
Log.showDebug(TAG, `check need hide window or not.`)
if ((new Date()).getTime() - this.mLastActionTime >= this.mInterval) {
if (this.mCloseEnableFlg) {
this.mLastActionTime = (new Date()).getTime();
@ -177,12 +177,12 @@ export default struct BannerNotificationItem {
}
clickCloseIcon() {
Log.showInfo(TAG, 'clickCloseIcon');
Log.showDebug(TAG, 'clickCloseIcon');
this.onBannerNoticeHide();
}
showDevicesDialog() {
Log.showInfo(TAG, `showDevicesDialog`)
Log.showDebug(TAG, `showDevicesDialog`)
if (!this.want?.distributedOption?.isDistributed) {
ViewModel.clickItem(this.want);
this.onBannerNoticeHide();
@ -203,7 +203,7 @@ export default struct BannerNotificationItem {
}
selectedDevice(deviceID) {
Log.showInfo(TAG, `selectedDevice deviceID:${deviceID}`)
Log.showDebug(TAG, `selectedDevice deviceID:${deviceID}`)
this.nowWant.deviceId = deviceID;
let triggerInfo = {
code: 0,
@ -229,8 +229,7 @@ struct ContentComponent {
itemData: any;
aboutToAppear() {
Log.showInfo(TAG, `aboutToDisappear pict: ${this.itemData.picture}`);
Log.showInfo(TAG, `NotificationItemData: ${JSON.stringify(this.itemData)}`)
Log.showDebug(TAG, `NotificationItemData: ${JSON.stringify(this.itemData)}`)
}
build() {

View File

@ -64,7 +64,7 @@ export default struct ConfirmDialog {
.fontSize($r('app.float.confirm_cont_fontsize'))
.fontColor(Color.Red)
}.onClick(() => {
Log.showInfo(TAG, `confirm button of TimeDialog on click`)
Log.showDebug(TAG, `confirm button of TimeDialog on click`)
this.controller.close();
this.action();
})

View File

@ -33,9 +33,9 @@ export default struct CustomItem {
this.template = ViewModel.getPluginTempLate(this.customItemData.template.name);
this.templateData = this.customItemData.template.data;
this.isDebugMode = NotificationManager.isDebugMode(TAG);
Log.showInfo(TAG, `template = ${JSON.stringify(this.template)}`)
Log.showInfo(TAG, `templateData = ${JSON.stringify(this.templateData)}`)
Log.showInfo(TAG, `isDebugMode = ${this.isDebugMode}`)
Log.showInfo(TAG, `template = ${JSON.stringify(this.template)},`+
`templateData = ${JSON.stringify(this.templateData)}` +
`isDebugMode = ${this.isDebugMode}`)
}
build() {
@ -47,7 +47,7 @@ export default struct CustomItem {
}).onComplete(() => {
Log.showInfo(TAG, `Complete`)
}).onError(({errcode, msg}) => {
Log.showInfo(TAG, `Error code:${errcode} message:${msg}`)
Log.showError(TAG, `Error code:${errcode} message:${msg}`)
})
.size({ width: 400, height: 130 })
}

View File

@ -86,6 +86,6 @@ export default struct DevicesDialog {
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear`)
this.deviceInfoList = DistributionManager.getInstance().getTrustedDeviceListSync();
Log.showInfo(TAG, `aboutToAppear deviceInfoList:${JSON.stringify(this.deviceInfoList)}`)
Log.showDebug(TAG, `aboutToAppear deviceInfoList size: ${this.deviceInfoList.length}`)
}
}

View File

@ -102,7 +102,7 @@ struct ContentComponent {
itemData: any;
aboutToAppear() {
Log.showInfo(TAG, `aboutToDisappear pict: ${this.itemData.picture}`);
Log.showInfo(TAG, `aboutToDisappear`);
}
build() {

View File

@ -188,6 +188,6 @@ struct ContentList {
remainderChange() {
this.remainderNum = this.groupData.length - 2;
Log.showInfo(TAG, `aboutToAppear remainderNum:${this.remainderNum}`)
Log.showDebug(TAG, `aboutToAppear remainderNum:${this.remainderNum}`)
}
}

View File

@ -64,17 +64,17 @@ export default struct IconListComponent {
{
src: $r("app.media.ic_public_settings_filled"),
callback: () => {
Log.showInfo(TAG, `click settings hashcode: ${this.itemData?.hashcode}`);
Log.showDebug(TAG, `click settings hashcode: ${this.itemData?.hashcode}`);
this.settingDialogController.open()
}
}, {
src: $r("app.media.ic_public_delete_filled"),
callback: () => {
if (!this.isGroup) {
Log.showInfo(TAG, `click delete hashcode: ${this.itemData?.hashcode}`);
Log.showDebug(TAG, `click delete hashcode: ${this.itemData?.hashcode}`);
ViewModel.removeNotificationItem(this.itemData, true)
} else {
Log.showInfo(TAG, `click delete groupName: ${this.itemData?.groupName}`);
Log.showDebug(TAG, `click delete groupName: ${this.itemData?.groupName}`);
ViewModel.removeGroupNotification(this.itemData, true)
}
}
@ -82,7 +82,7 @@ export default struct IconListComponent {
]
aboutToAppear() {
Log.showInfo(TAG, `iconConfigs: ${JSON.stringify(this.iconConfigs)}`)
Log.showInfo(TAG, `aboutToAppear iconConfigs: ${JSON.stringify(this.iconConfigs)}`)
iconSize = this.iconConfigs.length;
}

View File

@ -93,7 +93,7 @@ struct FrontItem {
}
showDevicesDialog() {
Log.showInfo(TAG, `showDevicesDialog isDistributed: ${this.itemData?.distributedOption?.isDistributed}`)
Log.showDebug(TAG, `showDevicesDialog isDistributed: ${this.itemData?.distributedOption?.isDistributed}`)
if (!this.itemData?.distributedOption?.isDistributed) {
ViewModel.clickItem(this.itemData);
return;
@ -102,7 +102,7 @@ struct FrontItem {
if (!!wantAgent) {
WantAgent.getWant(wantAgent).then((want) => {
this.nowWant = want
Log.showInfo(TAG, `showDevicesDialog want: ${JSON.stringify(this.nowWant)}`)
Log.showDebug(TAG, `showDevicesDialog want: ${JSON.stringify(this.nowWant)}`)
if (!want?.deviceId) {
this.devicesDialogController.open()
} else {
@ -115,7 +115,7 @@ struct FrontItem {
}
selectedDevice(deviceID) {
Log.showInfo(TAG, `selectedDevice deviceID:${deviceID}`)
Log.showDebug(TAG, `selectedDevice deviceID:${deviceID}`)
this.nowWant.deviceId = deviceID;
let triggerInfo = {
code: 0,

View File

@ -113,14 +113,14 @@ export default struct SettingDialog {
}
openAbility() {
Log.showInfo(TAG, ` openAbility:showNotificationManagement`)
Log.showDebug(TAG, ` openAbility:showNotificationManagement`)
EventManager.publish(obtainStartAbility('com.ohos.systemui', 'com.ohos.systemui.notificationmanagement.MainAbility',
{ 'migrateUri': 'pages/setEnable', 'migrateBundle': this.itemData.bundleName }))
this.closeAbility()
}
closeAbility() {
Log.showInfo(TAG, `closeAbility`)
Log.showDebug(TAG, `closeAbility`)
this.controller.close()
}
}

View File

@ -41,7 +41,7 @@ export class ViewModel {
mNotificationCtrl: any = {};
constructor() {
Log.showInfo(TAG, `constructor`);
Log.showDebug(TAG, `constructor`);
this.mNotificationList = [];
this.audioPlayer = media.createAudioPlayer();
// this.audioPlayer.src = 'file://system/etc/capture.ogg';
@ -67,7 +67,7 @@ export class ViewModel {
}
userChange(userInfo) {
Log.showInfo(TAG, `UserChange, userInfo: ${JSON.stringify(userInfo)}`);
Log.showDebug(TAG, `UserChange, userInfo: ${JSON.stringify(userInfo)}`);
this.unregisterCallback();
this.mNotificationList.length = 0;
this.initFlowControlInfos();
@ -83,11 +83,11 @@ export class ViewModel {
*/
onNotificationConsume(notificationItemData) {
if (notificationItemData === undefined) {
Log.showInfo(TAG, `onNotificationConsume notificationItemData is undefined`);
Log.showDebug(TAG, `onNotificationConsume notificationItemData is undefined`);
return;
}
this.onNotificationCancel(notificationItemData.hashcode)
Log.showInfo(TAG, `onNotificationConsume ${JSON.stringify(notificationItemData)}`);
Log.showDebug(TAG, `onNotificationConsume ${JSON.stringify(notificationItemData)}`);
//Verify the notifications can be displayed
if (!this.isCanShow(notificationItemData.bundleName)) {
//can not displayed
@ -98,9 +98,9 @@ export class ViewModel {
}
if (notificationItemData.ruleData.isAllowNotificationListShow) {
this.mNotificationList.unshift(notificationItemData);
Log.showInfo(TAG, `reminder start `);
Log.showDebug(TAG, `reminder start `);
this.reminderWay(notificationItemData);
Log.showInfo(TAG, `reminder end `);
Log.showDebug(TAG, `reminder end `);
this.updateFlowControlInfos(notificationItemData.bundleName, true)
}
this.updateNotification();
@ -110,13 +110,12 @@ export class ViewModel {
* notification CancelCallback
*/
onNotificationCancel(hashCode: string) {
Log.showInfo(TAG, `onNotificationCancel hashCode: ${JSON.stringify(hashCode)}`);
Log.showDebug(TAG, `onNotificationCancel hashCode: ${hashCode}`);
// Common Notification Deletion Logic Processing
for (let i = 0, len = this.mNotificationList.length; i < len; i++) {
if (this.mNotificationList[i].hashcode == hashCode) {
Log.showInfo(TAG, `removeNotificationItem i = ${i}`);
let removeItemArr = this.mNotificationList.splice(i, 1);
Log.showInfo(TAG, `onNotificationCancel removeItemArr= ${JSON.stringify(removeItemArr)}`);
Log.showDebug(TAG, `onNotificationCancel removeItemArr= ${JSON.stringify(removeItemArr)}`);
if (!CheckEmptyUtils.isEmpty(removeItemArr)) {
this.updateFlowControlInfos(removeItemArr[0].bundleName, false)
}
@ -127,15 +126,14 @@ export class ViewModel {
}
updateNotification() {
Log.showInfo(TAG, `updateNotification list: ${JSON.stringify(this.mNotificationList)}`);
Log.showInfo(TAG, `updateNotification length: ${this.mNotificationList.length}`);
Log.showDebug(TAG, `updateNotification length: ${this.mNotificationList.length}`);
this.sortNotification()
let notificationList = this.groupByGroupName();
AppStorage.SetOrCreate('notificationList', notificationList);
}
groupByGroupName(): any[]{
Log.showInfo(TAG, `groupByGroupName`);
Log.showDebug(TAG, `groupByGroupName`);
if (!this.mNotificationList || this.mNotificationList.length < 1) {
return [];
}
@ -143,14 +141,14 @@ export class ViewModel {
let groups = {};
this.mNotificationList.forEach((item) => {
const groupName = `${item.bundleName}_${item.groupName}`;
Log.showInfo(TAG, `groupByGroupName groupName:${groupName}`);
Log.showDebug(TAG, `groupByGroupName groupName:${groupName}`);
if (!groups[groupName] || groups[groupName].length < 1) {
groups[groupName] = [];
groupArr.push(groups[groupName]);
}
groups[groupName].push(item)
})
Log.showInfo(TAG, `groupByGroupName groupArr:${JSON.stringify(groupArr)}`);
Log.showDebug(TAG, `groupByGroupName groupArr:${JSON.stringify(groupArr)}`);
return groupArr;
}
@ -159,7 +157,7 @@ export class ViewModel {
* Sort the notifications.
*/
sortNotification() {
Log.showInfo(TAG, `sortNotification`);
Log.showDebug(TAG, `sortNotification`);
if (this.mNotificationList == undefined || this.mNotificationList == null || this.mNotificationList.length < 1) {
return
}
@ -184,24 +182,24 @@ export class ViewModel {
* Remove all notifications.
*/
removeAllNotifications() {
Log.showInfo(TAG, `removeAllNotifications`);
Log.showDebug(TAG, `removeAllNotifications`);
if (this.mNotificationList == undefined || this.mNotificationList == null || this.mNotificationList.length < 1) {
this.mNotificationList = []
} else {
let index = this.mNotificationList.length
while (index--) {
Log.showInfo(TAG, `removeAllNotifications isRemoveAllowed: ${index} ${this.mNotificationList[index].isRemoveAllowed} `);
Log.showInfo(TAG, `removeAllNotifications isOngoing: ${index} ${this.mNotificationList[index].isOngoing} `);
Log.showInfo(TAG, `removeAllNotifications isUnremovable: ${index} ${this.mNotificationList[index].isUnremovable} `);
Log.showDebug(TAG, `removeAllNotifications isRemoveAllowed: ${index} ${this.mNotificationList[index].isRemoveAllowed} `);
Log.showDebug(TAG, `removeAllNotifications `);
Log.showDebug(TAG, `removeAllNotifications isUnremovable: ${index} ${this.mNotificationList[index].isUnremovable} `);
//Except the Long term notifications
if (this.mNotificationList[index].isRemoveAllowed &&
!this.mNotificationList[index].isOngoing && !this.mNotificationList[index].isUnremovable) {
Log.showInfo(TAG, `mNotificationList[${index}].hashcode: ${this.mNotificationList[index].hashcode}`);
Log.showDebug(TAG, `mNotificationList[${index}].hashcode: ${this.mNotificationList[index].hashcode}`);
let hashCode = this.mNotificationList[index].hashcode
this.removeSysNotificationItem(hashCode)
let removeItemArr = this.mNotificationList.splice(index, 1)
Log.showInfo(TAG, `removeAllNotifications removeItemArr= ${JSON.stringify(removeItemArr)}`);
Log.showDebug(TAG, `removeAllNotifications removeItemArr= ${JSON.stringify(removeItemArr)}`);
if (!CheckEmptyUtils.isEmpty(removeItemArr)) {
this.updateFlowControlInfos(removeItemArr[0].bundleName, false)
}
@ -212,12 +210,12 @@ export class ViewModel {
}
removeNotificationItem(itemData, isDelSysConent) {
Log.showInfo(TAG, `removeNotificationItem, hashcode: ${itemData.hashcode}`);
Log.showDebug(TAG, `removeNotificationItem, hashcode: ${itemData.hashcode}`);
for (let i = 0, len = this.mNotificationList.length; i < len; i++) {
if (this.mNotificationList[i].hashcode == itemData.hashcode) {
Log.showInfo(TAG, `removeNotificationItem i = ${i}`);
Log.showDebug(TAG, `removeNotificationItem i = ${i}`);
let removeItemArr = this.mNotificationList.splice(i, 1);
Log.showInfo(TAG, `removeNotificationItem removeItemArr= ${JSON.stringify(removeItemArr)}`);
Log.showDebug(TAG, `removeNotificationItem removeItemArr= ${JSON.stringify(removeItemArr)}`);
if (!CheckEmptyUtils.isEmpty(removeItemArr)) {
this.updateFlowControlInfos(removeItemArr[0].bundleName, false)
}
@ -232,15 +230,15 @@ export class ViewModel {
}
removeGroupNotification(itemData, isDelSysConent) {
Log.showInfo(TAG, `removeGroupNotification, groupName: ${itemData.groupName}`);
Log.showDebug(TAG, `removeGroupNotification, groupName: ${itemData.groupName}`);
let groupName = itemData.groupName
for (let i = 0, len = this.mNotificationList.length; i < len; i++) {
if (this.mNotificationList[i].groupName == groupName) {
Log.showInfo(TAG, `removeGroupNotification i = ${i}`);
Log.showDebug(TAG, `removeGroupNotification i = ${i}`);
let id = this.mNotificationList[i].id
let hashcode = this.mNotificationList[i].hashcode
let removeItemArr = this.mNotificationList.splice(i, 1);
Log.showInfo(TAG, `removeGroupNotification removeItemArr= ${JSON.stringify(removeItemArr)}`);
Log.showDebug(TAG, `removeGroupNotification removeItemArr= ${JSON.stringify(removeItemArr)}`);
if (!CheckEmptyUtils.isEmpty(removeItemArr)) {
this.updateFlowControlInfos(removeItemArr[0].bundleName, false)
}
@ -258,14 +256,14 @@ export class ViewModel {
}
clickItem(itemData, want?: any) {
Log.showInfo(TAG, `clickItem itemId: ${itemData.id}, want: ${JSON.stringify(want)}`);
Log.showDebug(TAG, `clickItem itemId: ${itemData.id}, want: ${JSON.stringify(want)}`);
NotificationWindowManager.hideNotificationWindow();
CommonUtil.startWant((want) ? want : itemData.want);
this.removeNotificationItem(itemData, true);
}
clickReply(inputKey, content, want) {
Log.showInfo(TAG, `clickReply inputKey: ${inputKey}, content: ${content}, want: ${JSON.stringify(want)}`);
Log.showDebug(TAG, `clickReply inputKey: ${inputKey}, content: ${content}, want: ${JSON.stringify(want)}`);
let info = {
code: 0,
want: { key: inputKey, data: content },
@ -276,11 +274,11 @@ export class ViewModel {
}
initFlowControlInfos() {
Log.showInfo(TAG, 'initFlowControlInfos enter');
Log.showDebug(TAG, 'initFlowControlInfos enter');
let notificationConfig = NotificationConfig.readNotificationConfig('statusbar')
Log.showInfo(TAG, 'NotificationConfig: ' + JSON.stringify(notificationConfig));
Log.showDebug(TAG, 'NotificationConfig: ' + JSON.stringify(notificationConfig));
if (CheckEmptyUtils.isEmpty(notificationConfig)) {
Log.showInfo(TAG, 'NotificationConfig is no definition');
Log.showDebug(TAG, 'NotificationConfig is no definition');
return
}
this.mNotificationCtrl = {
@ -296,32 +294,32 @@ export class ViewModel {
}
this.mNotificationCtrl['app'].set(item.bundleName, tmp);
}
Log.showInfo(TAG, 'initFlowControlInfos end, mNotificationCtrl: ' + JSON.stringify(this.mNotificationCtrl));
Log.showDebug(TAG, 'initFlowControlInfos end, mNotificationCtrl: ' + JSON.stringify(this.mNotificationCtrl));
}
isCanShow(bundleName: string): boolean {
Log.showInfo(TAG, 'isCanShow');
Log.showDebug(TAG, 'isCanShow');
let result: boolean = true
if (!CheckEmptyUtils.isEmpty(this.mNotificationCtrl)) {
let currentTotal = this.mNotificationCtrl['currentTotal']
let limitTotal = this.mNotificationCtrl['limitTotal']
Log.showInfo(TAG, `isCanShow Total: currentTotal=${currentTotal},limitTotal=${limitTotal}`);
Log.showDebug(TAG, `isCanShow Total: currentTotal=${currentTotal},limitTotal=${limitTotal}`);
if (currentTotal + 1 > limitTotal) {
result = false
} else if (this.mNotificationCtrl['app'].has(bundleName)) {
let tmp = this.mNotificationCtrl['app'].get(bundleName)
Log.showInfo(TAG, `isCanShow appTotal: canShow=${tmp['canShow']},tmp['currentNum']=${tmp['currentNum']}`);
Log.showDebug(TAG, `isCanShow appTotal: canShow=${tmp['canShow']},tmp['currentNum']=${tmp['currentNum']}`);
if (tmp['canShow'] === false || (tmp['currentNum'] + 1 > tmp['limit'])) {
result = false
}
}
}
Log.showInfo(TAG, `isCanShow :${result}`);
Log.showDebug(TAG, `isCanShow :${result}`);
return result;
}
updateFlowControlInfos(bundleName: string, plusOrMinus: boolean): void {
Log.showInfo(TAG, `updateFlowControlInfos`);
Log.showDebug(TAG, `updateFlowControlInfos`);
if (!CheckEmptyUtils.isEmpty(this.mNotificationCtrl)) {
if (this.mNotificationCtrl['app'].has(bundleName)) {
let tmp = this.mNotificationCtrl['app'].get(bundleName)
@ -340,25 +338,25 @@ export class ViewModel {
}
}
Log.showInfo(TAG, `updateFlowControlInfos:${JSON.stringify(this.mNotificationCtrl)}`);
Log.showDebug(TAG, `updateFlowControlInfos:${JSON.stringify(this.mNotificationCtrl)}`);
}
reminderWay(itemData) {
if (itemData.ruleData.isAllowBanner) {
Log.showInfo(TAG, `banner start `);
Log.showDebug(TAG, `banner start `);
AbilityManager.setAbilityData(AbilityManager.ABILITY_NAME_BANNER_NOTICE, 'itemData', itemData);
EventManager.publish(obtainLocalEvent('onBannerNoticeShow', { 'itemData': itemData }))
Log.showInfo(TAG, `banner end `);
Log.showDebug(TAG, `banner end `);
}
if (itemData.notificationFlags?.soundEnabled != Constants.NOTIFICATION_TYPE_CLOSE) {
if (itemData.ruleData.isAllowSound) {
try {
this.audioPlayer.src = itemData.sound;
Log.showInfo(TAG, `sound start `);
Log.showDebug(TAG, `sound start `);
this.audioPlayer.play();
Log.showInfo(TAG, `sound end `);
Log.showDebug(TAG, `sound end `);
} catch (e) {
Log.showInfo(TAG, `sound notificationItem id${itemData.id} alert error: ${e.toString()}`);
Log.showError(TAG, `sound notificationItem id${itemData.id} alert error: ${JSON.stringify(e)}`);
}
}
}
@ -380,17 +378,17 @@ export class ViewModel {
}
getPluginTempLate(templateName) {
Log.showInfo(TAG, 'getPluginTempLate: ' + templateName);
Log.showDebug(TAG, 'getPluginTempLate: ' + templateName);
return NotificationService.getPluginTempLate(templateName)
}
enableNotification(itemData, enable: boolean) {
Log.showInfo(TAG, `enableNotification, bundleName: ${itemData.bundleName} uid: ${itemData.uid}`);
Log.showDebug(TAG, `enableNotification, bundleName: ${itemData.bundleName} uid: ${itemData.uid}`);
return NotificationService.enableNotification({ bundle: itemData.bundleName, uid: itemData.uid }, enable);
}
clickDistributionItem(itemData, triggerInfo) {
Log.showInfo(TAG, `clickDistributionItem wantAgen: ${JSON.stringify(itemData.want)}, triggerInfo: ${JSON.stringify(triggerInfo)}`);
Log.showDebug(TAG, `clickDistributionItem wantAgen: ${JSON.stringify(itemData.want)}, triggerInfo: ${JSON.stringify(triggerInfo)}`);
NotificationWindowManager.hideNotificationWindow();
CommonUtil.startWant(itemData.want, triggerInfo);
this.removeNotificationItem(itemData, true);
@ -398,9 +396,9 @@ export class ViewModel {
//get distributed device name
getDistributedDeviceName(itemData): Promise<string>{
Log.showInfo(TAG, `getDistributedDeviceName`);
Log.showInfo(TAG, `getDistributedDeviceName itemData want:${JSON.stringify(itemData.want)}`);
Log.showInfo(TAG, `getDistributedDeviceName itemData deviceId:${itemData.deviceId}`);
Log.showDebug(TAG, `getDistributedDeviceName`);
Log.showDebug(TAG, `getDistributedDeviceName itemData want:${JSON.stringify(itemData.want)}`);
Log.showDebug(TAG, `getDistributedDeviceName itemData deviceId:${itemData.deviceId}`);
return new Promise((resolve) => {
let deviceName: string = '';

View File

@ -15,7 +15,7 @@
import Log from '../../../../../../../../common/src/main/ets/default/Log'
import ScreenLockMar from '@ohos.screenlock';
import windowManager from '@ohos.window'
import Constants from '../common/constants'
import Constants from '../common/Constants'
import { Callback } from 'basic';
const TAG = 'ScreenLock-ScreenLockModel';

View File

@ -15,7 +15,7 @@
import Log from '../../../../../../../../../common/src/main/ets/default/Log'
import ViewModel from '../../vm/accountsViewModel'
import Constants from '../../common/constants'
import Constants from '../../common/Constants'
import {UserData} from '../../data/userData'
const TAG = 'ScreenLock-Accounts'

View File

@ -14,7 +14,7 @@
*/
import Log from '../../../../../../../../../common/src/main/ets/default/Log'
import Constants from '../../common/constants'
import Constants from '../../common/Constants'
const TAG = 'ScreenLock-BatterySoc'

View File

@ -14,7 +14,7 @@
*/
import Log from '../../../../../../../../../common/src/main/ets/default/Log'
import Constants from '../../common/constants'
import Constants from '../../common/Constants'
import NumkeyBoard from './numkeyBoard'
import ViewModel from '../../vm/customPSDViewModel'
import deviceInfo from '@ohos.deviceInfo';

View File

@ -14,7 +14,7 @@
*/
import Log from '../../../../../../../../../common/src/main/ets/default/Log'
import Constants from '../../common/constants'
import Constants from '../../common/Constants'
import NumkeyBoard from './numkeyBoard'
import ViewModel from '../../vm/digitalPSDViewModel'

View File

@ -16,7 +16,7 @@
import Log from '../../../../../../../../../common/src/main/ets/default/Log'
import {ScreenLockStatus} from '../../../../../../../../../common/src/main/ets/default/ScreenLockCommon'
import ViewModel from '../../vm/lockIconViewModel'
import Constants from '../../common/constants'
import Constants from '../../common/Constants'
const TAG = 'ScreenLock-LockIcon'

View File

@ -14,7 +14,7 @@
*/
import Log from '../../../../../../../../../common/src/main/ets/default/Log'
import Constants from '../../common/constants'
import Constants from '../../common/Constants'
import ViewModel from '../../vm/mixedPSDViewModel'
const TAG = 'ScreenLock-MixedPSD'

View File

@ -14,7 +14,7 @@
*/
import Log from '../../../../../../../../../common/src/main/ets/default/Log'
import Constants from '../../common/constants'
import Constants from '../../common/Constants'
import BaseViewModel from '../../vm/baseViewModel'
import deviceInfo from '@ohos.deviceInfo';

View File

@ -15,7 +15,7 @@
import Log from '../../../../../../../../../common/src/main/ets/default/Log'
import ViewModel from '../../vm/StatusBarVM'
import Constants from '../../common/constants'
import Constants from '../../common/Constants'
import BatteryIcon from '../../../../../../../../../features/batterycomponent/src/main/ets/default/pages/batteryIcon.ets'
import ClockIcon from '../../../../../../../../../features/clockcomponent/src/main/ets/default/pages/clockIcon.ets'
import WifiIcon from '../../../../../../../../../features/wificomponent/src/main/ets/default/pages/wifiIcon.ets'

View File

@ -14,7 +14,7 @@
*/
import Log from '../../../../../../../../common/src/main/ets/default/Log'
import Constants from '../common/constants'
import Constants from '../common/Constants'
import service, {UnlockResult, AuthType, AuthSubType} from '../model/screenLockService'
import {Callback} from 'basic';

View File

@ -14,7 +14,7 @@
*/
import Log from '../../../../../../../../common/src/main/ets/default/Log'
import Constants from '../common/constants'
import Constants from '../common/Constants'
import BaseViewModel, {service, AuthType, AuthSubType} from './baseViewModel'
import {Callback} from 'basic';

View File

@ -14,7 +14,7 @@
*/
import Log from '../../../../../../../../common/src/main/ets/default/Log'
import Constants from '../common/constants'
import Constants from '../common/Constants'
import BaseViewModel, {service, AuthType, AuthSubType} from './baseViewModel'
import {Callback} from 'basic';

View File

@ -18,7 +18,7 @@ import windowManager from '@ohos.window'
import WindowManagers, { WindowType } from "../../../../../../common/src/main/ets/default/WindowManager";
import display from '@ohos.display'
import Log from '../../../../../../common/src/main/ets/default/Log'
import Constants from '../../../../../../features/screenlock/src/main/ets/com/ohos/common/constants'
import Constants from '../../../../../../features/screenlock/src/main/ets/com/ohos/common/Constants'
import AbilityManager from '../../../../../../common/src/main/ets/default/abilitymanager/abilityManager'
import sTimeManager from '../../../../../../common/src/main/ets/default/TimeManager'

View File

@ -17,7 +17,7 @@ import ServiceExtension from '@ohos.application.ServiceExtensionAbility'
import windowManager from '@ohos.window'
import display from '@ohos.display'
import Log from '../../../../../../common/src/main/ets/default/Log'
import Constants from '../../../../../../features/screenlock/src/main/ets/com/ohos/common/constants'
import Constants from '../../../../../../features/screenlock/src/main/ets/com/ohos/common/Constants'
import AbilityManager from '../../../../../../common/src/main/ets/default/abilitymanager/abilityManager'
import sTimeManager from '../../../../../../common/src/main/ets/default/TimeManager'