!261 新增DFX打点需求

Merge pull request !261 from yongxinggong/master
This commit is contained in:
openharmony_ci 2022-08-30 04:52:52 +00:00 committed by Gitee
commit 20b32343b3
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
17 changed files with 78 additions and 44 deletions

View File

@ -55,5 +55,5 @@ Launcher 采用 扩展的TS语言eTS开发主要的结构如下
## 相关仓
- [applications_hap](https://gitee.com/openharmony/applications_hap)
- [applications_systemui](https://gitee.com/openharmony/applications_systemui)
- [aafwk_standard](https://gitee.com/openharmony/applications_systemui)
- [aafwk_standard](https://gitee.com/openharmony/aafwk_standard)
- [interface_sdk-js](https://gitee.com/openharmony/interface_sdk-js)

View File

@ -302,7 +302,6 @@ class LauncherAbilityManager {
Log.showInfo(TAG, 'startApplication hiSysEvent write success');
}
})
Trace.end(Trace.CORE_METHOD_LAUNCH_APP);
}
/**

View File

@ -14,6 +14,7 @@
*/
import dataRdb from '@ohos.data.rdb';
import hiSysEvent from '@ohos.hiSysEvent';
import { Log } from '../utils/Log';
import { CheckEmptyUtils } from '../utils/CheckEmptyUtils';
import { CommonConstants } from '../constants/CommonConstants';
@ -515,9 +516,29 @@ export class RdbStoreManager {
} catch (e) {
Log.showError(TAG, 'insertDesktopApplication error:' + e);
this.mRdbStore.rollBack();
this.sendFaultEvent();
}
return result;
}
sendFaultEvent(){
const sysEventInfo = {
domain: 'LAUNCHER',
name: 'WRITE_RDB',
eventType: hiSysEvent.EventType.FAULT,
params: {
'FAULT_ID': 'ICON_LOST',
'MSG': 'read or write rdb fault',
}
};
hiSysEvent.write(sysEventInfo,
(err, value) => {
if (err) {
Log.showError(TAG, `startApplication hiSysEvent write error: ${err.code}`);
} else {
Log.showInfo(TAG, 'startApplication hiSysEvent write success');
}
})
}
async queryDesktopApplication(): Promise<AppItemInfo[]> {
const resultList: AppItemInfo[] = [];

View File

@ -15,17 +15,20 @@
import windowAnimationManager from '@ohos.animation.windowAnimationManager';
import curves from '@ohos.curves';
import { CheckEmptyUtils } from '@ohos/common';
import {
Log,
Trace,
CheckEmptyUtils,
StyleConstants,
CommonConstants,
ResourceManager
} from '@ohos/common';
import OverlayAppIcon from './OverlayAppIcon';
import RemoteConstants from '../constants/RemoteConstants';
import { CommonConstants } from '@ohos/common';
import OverlayAppIcon from './OverlayAppIcon.ets';
import { ResourceManager } from '@ohos/common';
import { StyleConstants } from '@ohos/common';
import { Log } from '@ohos/common';
import WindowAnimationControllerImpl from '../animation/remoteanimation/WindowAnimationControllerImpl';
import { localEventManager } from '../manager/LocalEventManager';
import { EventConstants } from '../constants/EventConstants';
import { CloseAppManager } from '../manager/CloseAppManager';
import WindowAnimationControllerImpl from '../animation/remoteanimation/WindowAnimationControllerImpl';
const TAG = 'RemoteWindowWrapper';
@ -211,6 +214,7 @@ export struct RemoteWindowWrapper {
private minimizeWindow(callback): void {
Log.showInfo(TAG, `minimizeWindow --- target ${JSON.stringify(this.target)}`);
Trace.start(Trace.CORE_METHOD_CLOSE_APP_ANIMATION);
this.startAppTypeFromPageDesktop = AppStorage.Get('startAppTypeFromPageDesktop');
if (this.startAppTypeFromPageDesktop === CommonConstants.OVERLAY_TYPE_CARD) {
this.closeAppIconInfo = AppStorage.Get('startAppIconInfo');
@ -237,6 +241,7 @@ export struct RemoteWindowWrapper {
onFinish: () => {
callback.onAnimationFinish();
this.closeAppIconWindowAlpha = 0;
Trace.end(Trace.CORE_METHOD_CLOSE_APP_ANIMATION);
}
}, () => {
this.remoteWindowScaleX = 1 / this.closeAppCalculateScaleX;
@ -354,6 +359,7 @@ export struct RemoteWindowWrapper {
curve: curves.springMotion(0.42, 0.99, 0),
onFinish: () => {
callback.onAnimationFinish();
Trace.end(Trace.CORE_METHOD_START_APP_ANIMATION);
}
}, () => {
this.remoteWindowScaleX = 1.0;
@ -385,16 +391,6 @@ export struct RemoteWindowWrapper {
}, () => {
this.remoteWindowWindowAlpha = 1.0;
})
// this.startAppIconWindowAlpha = 1.0;
// animateTo({
// duration: 50,
// delay: 150,
// curve: Curve.Friction,
// onFinish: () => {
// }
// }, () => {
// this.startAppIconWindowAlpha = 0.0;
// })
}
build() {

View File

@ -20,13 +20,14 @@ import { Log } from './Log';
* Add method trace. Modify RECORD_TRACE before using.
*/
export class Trace {
static readonly CORE_METHOD_LAUNCH_APP = 'launchApp';
static readonly CORE_METHOD_START_APP_CENTER = 'startAppCenter';
static readonly CORE_METHOD_START_RECENTS = 'startRecents';
static readonly CORE_METHOD_START_SETTINGS = 'startSettings';
static readonly CORE_METHOD_OPEN_FOLDER = 'openFolder';
static readonly CORE_METHOD_OPEN_FOLDER_DIALOG = 'openFolderDialog';
static readonly CORE_METHOD_CLEAR_ALL_MISSIONS = 'clearAllMissions';
static readonly CORE_METHOD_START_APP_ANIMATION = 'startAppAnimation';
static readonly CORE_METHOD_CLOSE_APP_ANIMATION = 'closeAppAnimation';
private static readonly TRACE_TAG = 'L:Trace';
private static readonly RECORD_TRACE = true;

View File

@ -107,6 +107,7 @@ export struct AppGridLayout {
open.menuText = $r('app.string.app_menu_open');
open.onMenuClick = () => {
Log.showInfo(TAG,`open.OnMenuClick--:${JSON.stringify(appInfo)}`);
Trace.start(Trace.CORE_METHOD_START_APP_ANIMATION);
this.setStartAppInfo(appInfo);
this.mAppGridViewModel.jumpTo(appInfo.abilityName, appInfo.bundleName, appInfo.moduleName);
windowManager.hideWindow(windowManager.APP_CENTER_WINDOW_NAME);
@ -163,6 +164,7 @@ export struct AppGridLayout {
appGridStyleConfig: this.mAppCenterGridStyleConfig,
onItemClick: (event, item) => {
Log.showDebug(TAG,`open.onAppGridClick--:${JSON.stringify(item)}`);
Trace.start(Trace.CORE_METHOD_START_APP_ANIMATION);
this.setStartAppInfo(item);
this.mAppGridViewModel.jumpTo(item.abilityName, item.bundleName, item.moduleName);
windowManager.hideWindow(windowManager.APP_CENTER_WINDOW_NAME);

View File

@ -523,7 +523,7 @@ struct FolderAppItem {
}
private launchApp() {
Trace.start(Trace.CORE_METHOD_LAUNCH_APP);
Trace.start(Trace.CORE_METHOD_START_APP_ANIMATION);
this.setStartAppInfo();
globalThis.PageDesktopViewModel.onAppDoubleClick(this.item.abilityName, this.item.bundleName, this.item.moduleName);
}

View File

@ -232,7 +232,7 @@ export default struct AppItem {
* When app is double clicked, call this method.
*/
private launchApp() {
Trace.start(Trace.CORE_METHOD_LAUNCH_APP);
Trace.start(Trace.CORE_METHOD_START_APP_ANIMATION);
this.setStartAppInfo();
this.mPageDesktopViewModel.onAppDoubleClick(this.item.abilityName, this.item.bundleName, this.item.moduleName);
}

View File

@ -174,6 +174,7 @@ export default struct FolderItem {
nameFontColor: this.mPageDesktopViewModel.getPageDesktopStyleConfig().mNameFontColor,
onAppIconClick: (event, appItem) => {
Log.showInfo(TAG, "onAppIconClick");
Trace.start(Trace.CORE_METHOD_START_APP_ANIMATION);
this.setStartAppInfo(appItem);
this.mPageDesktopViewModel.openApplication(appItem.abilityName, appItem.bundleName, appItem.moduleName);
},

View File

@ -15,6 +15,7 @@
import Prompt from '@ohos.prompt';
import { Log } from '@ohos/common';
import { Trace } from '@ohos/common';
import { CheckEmptyUtils } from '@ohos/common';
import { StyleConstants } from '@ohos/common';
import { EventConstants } from '@ohos/common';
@ -911,6 +912,7 @@ export default class PageDesktopViewModel extends BaseViewModel {
menu.bundleName = value.bundleName;
menu.moduleName = value.moduleName;
menu.onMenuClick = () => {
Trace.start(Trace.CORE_METHOD_START_APP_ANIMATION);
if (openClickCallback) {
openClickCallback();
}

View File

@ -14,6 +14,7 @@
*/
import image from '@ohos.multimedia.image';
import { Log } from '@ohos/common';
import { Trace } from '@ohos/common';
import { CheckEmptyUtils } from '@ohos/common';
import { windowManager } from '@ohos/common';
import { SnapShotInfo } from '@ohos/common';
@ -166,6 +167,7 @@ export default struct RecentMissionCard {
if (!globalThis.recentMode || !windowManager.isSplitWindowMode(globalThis.recentMode)) {
windowManager.hideWindow(windowManager.RECENT_WINDOW_NAME);
}
Trace.start(Trace.CORE_METHOD_START_APP_ANIMATION);
this.setStartAppInfo(event?.target?.area?.globalPosition);
this.mRecentMissionsViewModel.moveMissionToFront(this.missionId);
})

View File

@ -30,9 +30,7 @@ struct Index {
private mSettingsStage = new SettingsStage();
private mDevice = SettingsStyleConstants.DEFAULT_DEVICE_TYPE_PHONE;
onPageShow(): void {
Trace.end(Trace.CORE_METHOD_START_SETTINGS)
}
onPageShow(): void { }
aboutToAppear(): void {
this.getDeviceType();
@ -86,11 +84,18 @@ struct Index {
}
.width(this.mDevice === SettingsStyleConstants.DEFAULT_DEVICE_TYPE_PHONE ? SettingsStyleConstants.PERCENTAGE_100 : 976)
.height(SettingsStyleConstants.PERCENTAGE_100)
if (this.traceBuildEnd()) { }
}
.backgroundColor(SettingsStyleConstants.DEFAULT_BACKGROUND_COLOR)
.width(SettingsStyleConstants.PERCENTAGE_100)
.height(SettingsStyleConstants.PERCENTAGE_100)
}
private traceBuildEnd(): boolean {
Trace.end(Trace.CORE_METHOD_START_SETTINGS)
return true;
}
}
@Component

View File

@ -13,30 +13,26 @@
* limitations under the License.
*/
import { Log } from '@ohos/common';
import { Trace } from '@ohos/common';
import { CommonConstants } from '@ohos/common';
import { windowManager } from '@ohos/common';
import { ResourceManager } from '@ohos/common';
import { UninstallDialog } from '@ohos/common';
import {
Log,
CommonConstants,
ResourceManager,
UninstallDialog } from '@ohos/common';
import RecentLayout from './RecentLayout';
import ResidentLayout from './ResidentLayout';
import SmartDockViewModel from '../viewmodel/SmartDockViewModel';
import SmartDockConstants from '../common/constants/SmartDockConstants';
import ResidentLayout from './ResidentLayout.ets';
import RecentLayout from './RecentLayout.ets';
const TAG = 'SmartDock';
@Component
export struct SmartDock {
@State popup: {
popup: {
show: boolean,
showItem: string,
popup
} = { show: false, showItem: '', popup: null };
showAppCenter = () => {
Trace.start(Trace.CORE_METHOD_START_APP_CENTER);
globalThis.createWindowWithName(windowManager.APP_CENTER_WINDOW_NAME, windowManager.DESKTOP_RANK);
}
showAppCenter: Function = () => {};
@StorageLink('showDock') showDock: boolean = false;
@StorageLink('residentList') residentList: any = [];
@StorageLink('recentList') recentList: any = [];
@ -126,7 +122,7 @@ export struct SmartDock {
enableArrow: true
}
}
let dataList = await this.mSmartDockViewModel.getSnapshot(list[0].missionInfoList, list[0].appName);
await this.mSmartDockViewModel.getSnapshot(list[0].missionInfoList, list[0].appName);
}
private buildLog(): boolean {

View File

@ -91,6 +91,7 @@ export default class SmartDockViewModel extends BaseViewModel {
return;
}
// app entry
Trace.start(Trace.CORE_METHOD_START_APP_ANIMATION);
this.setStartAppInfo(item);
launcherAbilityManager.startLauncherAbility(item.abilityName, item.bundleName, item.moduleName);
}
@ -117,6 +118,7 @@ export default class SmartDockViewModel extends BaseViewModel {
let missionId = missionInfoList[i]?.missionInfoList[0]?.missionId;
amsMissionManager.moveMissionToFront(missionId).then(() => {}, () => {});
// set start app info
Trace.start(Trace.CORE_METHOD_START_APP_ANIMATION);
this.setStartAppInfo(item);
}
break;
@ -196,6 +198,7 @@ export default class SmartDockViewModel extends BaseViewModel {
menu.bundleName = value.bundleName;
menu.moduleName = value.moduleName;
menu.onMenuClick = () => {
Trace.start(Trace.CORE_METHOD_START_APP_ANIMATION);
launcherAbilityManager.startLauncherAbility(value.wants[0].targetClass, value.wants[0].targetBundle, value.wants[0].targetModule);
};
Log.showInfo(TAG, `shortcutInfo ${JSON.stringify(shortcutInfo)}`);

View File

@ -17,4 +17,8 @@ START_ABILITY:
__BASE: {type: BEHAVIOR, level: CRITICAL, desc: ""}
BUNDLE_NAME: {type: STRING, desc: "bundle name"}
ABILITY_NAME: {type: STRING, desc: "ability name"}
MODULE_NAME: {type: STRING, desc: "module name"}
MODULE_NAME: {type: STRING, desc: "module name"}
WRITE_RDB:
__BASE: {type: FAULT, level: CRITICAL, desc: ""}
FAULT_ID: {type: STRING, desc: "fault name"}
MSG: {type: STRING, desc: "fault reaseon"}

View File

@ -72,7 +72,7 @@ struct RecentView {
.fontSize(RecentsStyleConstants.DEFAULT_FONT_SIZE);
}
} else {
if (this.traceLoadData() && this.mRecentMissionsViewModel.getRecentMissionsRowType() === 'single') {
if (this.mRecentMissionsViewModel.getRecentMissionsRowType() === 'single') {
RecentMissionsSingleLayout({
recentMissionsSingleList: $recentMissionsList,
isClickSubComponent: $isClickSubComponent
@ -84,6 +84,7 @@ struct RecentView {
});
}
}
if (this.traceBuildEnd()) {}
}
.width(RecentsStyleConstants.DEFAULT_LAYOUT_PERCENTAGE)
.height(RecentsStyleConstants.DEFAULT_LAYOUT_PERCENTAGE)
@ -96,7 +97,7 @@ struct RecentView {
})
}
private traceLoadData(): boolean {
private traceBuildEnd(): boolean {
Trace.end(Trace.CORE_METHOD_START_RECENTS);
return true;
}

View File

@ -63,7 +63,7 @@ struct RecentView {
.fontSize(RecentsStyleConstants.DEFAULT_FONT_SIZE);
}
} else {
if (this.traceLoadData() && this.mRecentMissionsViewModel.getRecentMissionsRowType() === 'single') {
if (this.mRecentMissionsViewModel.getRecentMissionsRowType() === 'single') {
RecentMissionsSingleLayout({ recentMissionsSingleList: $recentMissionsList,
isClickSubComponent: $isClickSubComponent});
} else {
@ -71,6 +71,7 @@ struct RecentView {
isClickSubComponent: $isClickSubComponent});
}
}
if (this.traceBuildEnd()) { }
}
.width(RecentsStyleConstants.DEFAULT_LAYOUT_PERCENTAGE)
.height(RecentsStyleConstants.DEFAULT_LAYOUT_PERCENTAGE)
@ -83,7 +84,7 @@ struct RecentView {
})
}
private traceLoadData(): boolean {
private traceBuildEnd(): boolean {
Trace.end(Trace.CORE_METHOD_START_RECENTS);
return true;
}