文件最后提交记录最后更新时间
fix monitor pass undefined Signed-off-by: jiyujia926 <jiyujia3@huawei.com> Co-Authored-By: Agent 3 天前
UT补充 Signed-off-by: weixin_43821244 <zhushilin5@huawei.com> Co-Authored-By: Agent 1 个月前
Dfx and Performance profiler Features Change-Id: I3e4bad17250ffd9a4f3af8cafbf890fe635cf00d Signed-off-by: tatu tomppo <tatu.tomppo@huawei.com> 2 年前
蓝黄差异拉齐 Signed-off-by: hwx1119949 <huyisuo@huawei.com> 9 个月前
add protection for statemgmt npm Signed-off-by: jiyujia926 <jiyujia3@huawei.com> Co-Authored-By: Agent 1 个月前
Merge code to master Signed-off-by: sunfei <sunfei.sun@huawei.com> Change-Id: I8d97d06f7ec17e888c86c651070e8d20ffa22b69 4 年前
fix :字符串使用单引号 Signed-off-by: yangziyong <nsyangziyong@huawei.com> Change-Id: I2c1f74977a753e3b9ea3c8dcca6f721afc8ef793 1 年前
Merge remote-tracking branch 'origin/master' into dfx_and_performance Change-Id: I7bf1b9916be470ab8027d6a7ba1ef3a12deb0a35 2 年前
customEnv接口变更及检视意见修改 Signed-off-by: yuxiaofei <yuxiaofei9@huawei-partners.com> Change-Id: Ia981436e11d8f3cdaa693a6a2539c751a90f730a 17 天前
stateMgmt.js auto generation The stateMgmt.js file previously located in the engine folder is now auto-generated and managed by the build system. The build script now automatically runs npm install if the node_modules folder is missing. A rebuild is triggered based on files_to_watch.gni the state_mgmt folder. Its generated by npm run build_release command from tsconfig.release.json stateMgmt.js in ./out/rk3568/obj/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/ Actions for developers: Do not commit or manually copy stateMgmt.js to the engine folder; it is auto-generated. Update your scripts that interact with stateMgmt.js to use state_mgmt/distRelease/stateMgmt.js as the input file instead of engine/stateMgmt.js. For further details, refer to the README.md file in the state_mgmt folder. Signed-off-by: Tatu Tomppo <tatu.tomppo1@huawei.com> Change-Id: I9063998fd9657f10e5ca49a6a7379ea4c5a1b0a2 1 年前
New API generated shape for ArkUI. Change-Id: Ia2215b735fed4f82d86e859a187447f2cb7b6558 Signed-off-by: guozejun <guozejun@huawei.com> 1 年前
PersistenceV2 support for more container types Co-authored-by: Denis Pikalov<denis.pikalov@huawei.com> 5 个月前
Rebase UI Node Cleanup registry Change-Id: If66e1e62b43beb0ba311dd17760c450bd1f004a9 Added fix for stateMgmt build error with classObject Change-Id: I14850692917cc0c0a87b049ab79894024f6d140d Signed-off-by: Vidhya Pria Arunkumar <vidhya.pria.arunkumar@huawei.com> Code checkup clean errors Signed-off-by: Vidhya Pria Arunkumar <vidhya.pria.arunkumar@huawei.com> Change-Id: I5a71f4c13814c1dd43274a9ff4f91be72732ca3c 2 年前
customEnv接口变更及检视意见修改 Signed-off-by: yuxiaofei <yuxiaofei9@huawei-partners.com> Change-Id: Ia981436e11d8f3cdaa693a6a2539c751a90f730a 17 天前
stateMgmt.js auto generation The stateMgmt.js file previously located in the engine folder is now auto-generated and managed by the build system. The build script now automatically runs npm install if the node_modules folder is missing. A rebuild is triggered based on files_to_watch.gni the state_mgmt folder. Its generated by npm run build_release command from tsconfig.release.json stateMgmt.js in ./out/rk3568/obj/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/ Actions for developers: Do not commit or manually copy stateMgmt.js to the engine folder; it is auto-generated. Update your scripts that interact with stateMgmt.js to use state_mgmt/distRelease/stateMgmt.js as the input file instead of engine/stateMgmt.js. For further details, refer to the README.md file in the state_mgmt folder. Signed-off-by: Tatu Tomppo <tatu.tomppo1@huawei.com> Change-Id: I9063998fd9657f10e5ca49a6a7379ea4c5a1b0a2 1 年前
stateMgmt.js auto generation The stateMgmt.js file previously located in the engine folder is now auto-generated and managed by the build system. The build script now automatically runs npm install if the node_modules folder is missing. A rebuild is triggered based on files_to_watch.gni the state_mgmt folder. Its generated by npm run build_release command from tsconfig.release.json stateMgmt.js in ./out/rk3568/obj/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/ Actions for developers: Do not commit or manually copy stateMgmt.js to the engine folder; it is auto-generated. Update your scripts that interact with stateMgmt.js to use state_mgmt/distRelease/stateMgmt.js as the input file instead of engine/stateMgmt.js. For further details, refer to the README.md file in the state_mgmt folder. Signed-off-by: Tatu Tomppo <tatu.tomppo1@huawei.com> Change-Id: I9063998fd9657f10e5ca49a6a7379ea4c5a1b0a2 1 年前
stateMgmt.js auto generation The stateMgmt.js file previously located in the engine folder is now auto-generated and managed by the build system. The build script now automatically runs npm install if the node_modules folder is missing. A rebuild is triggered based on files_to_watch.gni the state_mgmt folder. Its generated by npm run build_release command from tsconfig.release.json stateMgmt.js in ./out/rk3568/obj/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/ Actions for developers: Do not commit or manually copy stateMgmt.js to the engine folder; it is auto-generated. Update your scripts that interact with stateMgmt.js to use state_mgmt/distRelease/stateMgmt.js as the input file instead of engine/stateMgmt.js. For further details, refer to the README.md file in the state_mgmt folder. Signed-off-by: Tatu Tomppo <tatu.tomppo1@huawei.com> Change-Id: I9063998fd9657f10e5ca49a6a7379ea4c5a1b0a2 1 年前
CI review fixes updated Global Reuse: V1 and V2 support with API declarations Change-Id: Iaa3284f2f74fa6099f79ef3ecb16e9e2591721a1 Signed-off-by: Vidhya Pria <vidhya.pria.arunkumar@huawei.com> Signed-off-by: Vidhya Pria <vidhya.pria.arunkumar@huawei.com> Change-Id: I2b18ad1f83c7f725d3cba4e429be04d2eb065491 Review comments fixed and rebased to latest Signed-off-by: Vidhya Pria <vidhya.pria.arunkumar@huawei.com> Change-Id: I58d5d0ddcfc1cb8322a5037b1a383088030237bd Signed-off-by: Vidhya Pria <vidhya.pria.arunkumar@huawei.com> 1 个月前
README.md

ArkUI Declarative State Management

State management TypeScript library for ArkUI declarative front-end. Supports both older 'full update' for Component to Element classes and newer 'partial update' for minimal scope NG UINode updates.

Building just state mgmt

The implementation is in Typescript.

Before first build: npm install

For every debug build npm run build

The output is one JS file: ./dist/stateMgmt.js

For every release build (default by build system) npm run build_release

The output is one JS file: ./distRelease/stateMgmt.js

For profiler build. See StateMgmt Profiler. npm run build_profile

The output is one JS file: ./distProfile/stateMgmt.js

The difference between debug build and release build is the removal of all stateMgmtConsole.log/.debug/.info statements from the release version JS output code.

NOTE: Output folder is one of following (dist, distRelease or distProfile). In ace_engine build distRelease output is copied to

./out/rk3568/obj/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/stateMgmt.js

To get all logs

Change selected aceConsole.debug to aceConsole.error. At least from public statig debug. In file state_mgmt_console_trace.ts Enable debug: hdc shell param set persist.ace.debug.enabled 1 Build debug version npm run build Generate .abc from dist/stateMgmt.js and copy to device and reboot.

File Organising into Directories

  • ./src/lib/*.ts - implementation
    • ./src/lib/sdk/*.ts - all files that include SDK definitons
    • ./src/lib/common/*.ts - common files that do not include any SDK functionality
    • ./src/lib/full_update/*.ts - files specific to the older version of state mgmt for full Component to Element update
    • ./src/lib/partial_update/*.ts - files specfic to the newer version of state mgmt for NG UINode minimal scope updates
    • ./src/lib/v2/*.ts - files specfic to V2 implementation -./src/index.ts - implementation 'main' creates singletons.

How to Develop - StateMgmt

  • Change files .ts in src/lib folder
  • Do npm install once after repo sync in state_mgmt folder... Then after that 'npm run build_release'
  • Output file is in distRelease/stateMgmt.js
  • Do script to convers stateMgmt.js to .abc and copy that to device.
# Make target RK3568 writable
hdc target mount
# Remove old file
hdc shell rm -rf /etc/abc/framework/stateMgmt.abc
# Use es2abc.exe with output parameter --output stateMgmt.abc
# Then copy stateMgmt.abc from build server to local disk and send to /etc/abc/framework
hdc file send stateMgmt.abc /etc/abc/framework
# Reboot device and it will load stateMgmt.abc at start up
hdc shell reboot

StateMgmt Profiler

Building

Execute follwing commands in framework/bridge/declarative_frontend/state_mgmt.

npm install
npm run build_profile
Adjust your script to copy stateMgmt.js from distProfile folder.

Then compile SW and flash / update .so

Initialization for App (DevEco)

By default you can see timing infor from framework. If you want to add something to your App then... First, initialize an instance of the profiler in your ETS, at the top. NOTE: The class declarations provided below are needed for DevEco apps

// Native class
declare class StateMgmtProfiler {
  constructor(suite: string);
  begin(block: string): void;
  end(): void;
  report(): void;
  clear(): void;
}

// JS global object
declare class stateMgmtProfiler {
  static begin(blockName: string) : void;
  static end() : void;
  static report() : void;
  static clear(): void;
  static init(instance: StateMgmtProfiler) : void;
}

stateMgmtProfiler.init(new StateMgmtProfiler("MyProfiler"));

Placing blocks in code

In your JS code, wrap the code to be measured between stateMgmtProfiler.begin("blockNameHere") and stateMgmtProfiler.end():

stateMgmtProfiler.begin("HeavyMethodCall");
myObject.myVeryHeavyMethodCall();
// Nested blocks also work:
{
    stateMgmtProfiler.begin("EvenHeavierMethodCall");
    myObject.evenHeavierMethodCall();
    stateMgmtProfiler.end();
}
stateMgmtProfiler.end();

To print the results, you can use this script. You need to replace the package ID with your own and also see the WindowID of your package. The last command invokes DFX log. The argument -jsdump is to invoke JS DFX logging and -profiler is the arg to dump profiler results.

#! /bin/bash
hdc shell param set persist.ace.debug.enabled 0 (needs to be done once)
Start the Test application NOW
hdc shell "hidumper -s WindowManagerService -a '-a'"
Check WinId of your app. Lets say its 11. Put it to -w arg.
hdc shell "hidumper -s WindowManagerService -a '-w 11 -jsdump -profiler'"

The output will be like this: Total include children.

============================================================================================================
Block name                                                                #Calls          Self         Total
============================================================================================================
MyProfiler
 HeavyMethodCall                                                              1        1.465ms       1.465ms
  EvenHeavierMethodCall                                                       1        1.417ms       1.417ms
============================================================================================================
  • Calling stateMgmtProfiler.clear() will clear the results.
  • Calling stateMgmtProfiler.report() will print the results and then clear them.

DFX Debug Log

DFX Debug Log is built to work on top of hidumper, which is OHOS info dump tool. The DFX Debug Log is used to request information from the process in a shell.

Commands

  • -jsdump
    • Requests JS debug logging from the hidumper service. It is followed by additional commands and arguments to format the output. See below.

Two output modifiers are defined in order to facilitate the usage of the commands:

  • -viewId
    • Specifies the view for which information is obtaineed. It acts as an aditional argument to the command providing the view ID in the following format viewId=##. where ## is the numerical ID of the target view.
  • -r
    • Specifies whether the output of the command should be recursive or not. Non-recursive prints the information for the target view ommiting the same information about it's decendants.

For the purpose of logging the following commands are accepted as input:

  • -dumpAll
    • Prints all information about the view. This combines the output of all other commands for the specified view. Default print is for root view if no view is specified.
  • -viewHierarchy
    • Prints the view hierarchy of a particular view, namely the custom component children. Accepts -viewId argument and -r flag. Depending on the flags provided it can be either recursive, from a specific view downwards, or just the immediate children of the view. Default print is for root view non-recursive if no flags are provided. It also indicates the freeze state of the component if it is configured to be frozen while inactive.
  • -stateVariables
    • Prints the variables dependencies of the view, and their respective owners and sync peers. Accepts -viewId argument. Default print is for root view if no view is specified.
  • -registeredElementIds
    • Prints a list of components, namely JS classes such as Column, TapGesture etc. and their ID-s owned by the view. Accepts -viewId argument. Default print is for root view if not specified otherwise.
  • -dirtyElementIds
    • Prints a list of dependent elmtIds that need partial update in next re-render. Accepts -viewId argument. Default print is for root view if not specified otherwise.
  • -inactiveComponents
    • Prints the list of the components that are presently in an inactive or frozen state. These components are not actively processing updates and will stay inactive while in the background.

The application must be running and visible in order to receive commands. The hidumper service delivers the commands through the WindowManagerService. and the window ID is used to target a specific application.

#! /bin/bash
hdc shell "param set persist.ace.debug.enabled 0" (needs to be done once)
Start the Test application NOW
hdc shell "hidumper -s WindowManagerService -a '-a'"
Check WinId of your app. Lets say its 11. Put it to -w arg.
hdc shell "hidumper -s WindowManagerService -a '-w 11 -jsdump -dumpAll'"
hdc shell "hidumper -s WindowManagerService -a '-w 11 -jsdump -viewHierarchy'"
hdc shell "hidumper -s WindowManagerService -a '-w 11 -jsdump -viewHierarchy -inactiveComponents'"

Important for Profiler and JSDump

PartialUpdateMode MUST be configured for your application. This can be made for example by changing following. For API10...\OpenHarmony\Sdk\10\ets\build-tools\ets-loader\main.js and change const partialUpdateConfig = { partialUpdateMode: true, // from false

RK3568 /etc/acenewpipe.config must have application name under EANBLED to use newpipeline. Example content of acenewpipe.config

ENABLED
com.example.myapplication

Usefull examples

All the following commands concern a hypothetical window with ID 11 and view with ID 42. Note that -viewId is optional.

Info Shell command
Dump all info hidumper -s WindowManagerService -a '-w 11 -jsdump -dumpAll -viewId=42'
Dump view hierarchy recursively hidumper -s WindowManagerService -a '-w 11 -jsdump -viewHierarchy -viewId=42 -r'
Dump view hierarchy only for the target view hidumper -s WindowManagerService -a '-w 11 -jsdump -viewHierarchy -viewId=42'
Dump the list of all registered element ids hidumper -s WindowManagerService -a '-w 11 -jsdump -registeredElementIds -viewId=42'
Dump the list of all dirty element ids hidumper -s WindowManagerService -a '-w 11 -jsdump -dirtyElementIds -viewId=42'

Example with dependent elements

hidumper -s WindowManagerService -a '-w 11 -jsdump -dumpAll'

Showing dependent elements for Link "stringValue".

@State/@Provide 'stringValue'[..]
 |--Dependent elements: 'Text[..]'; @Component 'Child1'[..], 'Text[..]'; @Component 'Child2'[..], Text[..]';