Huawei phones kill apps that run in the background to reduce battery consumption. Please do the following to count your steps when screen is locked.
Launch Settings
‒ Open phone’s Settings app > Battery > Launch > tap Pedometer > tap OK. ( Auto-launch, Secondary launch, Run in background should be enabled. )
Battery Optimization Settings
‒ Open phone’s Settings app > Apps & notifications > Apps > Settings > Special access > Ignore battery optimisation > tap Allowed > tap All apps > tap Pedometer, select Allow, and tap OK.