Description: improve the start performance

IssueNo:I416OS
Feature or Bugfix: Feature
Binary Source:No

Signed-off-by: jiadexiang <jiadexiang@huawei.com>
This commit is contained in:
jiadexiang
2021-07-17 19:05:31 +08:00
parent da2ed36edb
commit 8cb63d4c34
3 changed files with 10 additions and 8 deletions
+1 -1
View File
@@ -123,7 +123,7 @@ public:
static void NotifyRenderEnd();
static const char *GetDefaultFontFamilyName();
static uint8_t GetDefaultFontSize();
static void UpdateShowingState(bool forground);
static void UpdateRenderTickAcceptable(bool acceptable);
static void GetScreenSize(uint16_t &width, uint16_t &height);
static bool SetScreenOnVisible(bool visible);
};
+4 -4
View File
@@ -59,7 +59,7 @@ static uint16_t g_screenWidth = 454;
static uint16_t g_screenHeight = 454;
// indicating if the ace application is on forground
static bool g_isAceForground = false;
static bool g_isRenderTickAcceptable = false;
void ProductAdapter::InitAceTags(uint8_t *aceTags, uint8_t tagCount)
{
@@ -150,7 +150,7 @@ void ProductAdapter::RegTEHandlers(const TEHandlingHooks &teHandlingHooks)
TEDispatchingResult ProductAdapter::DispatchTEMessage()
{
#ifdef OHOS_ACELITE_PRODUCT_WATCH // only some specific products support TE dispatching
if (!g_isAceForground) {
if (!g_isRenderTickAcceptable) {
return TEDispatchingResult::REFUSED;
}
@@ -206,9 +206,9 @@ uint8_t ProductAdapter::GetDefaultFontSize()
return g_defaultFontSize;
}
void ProductAdapter::UpdateShowingState(bool forground)
void ProductAdapter::UpdateRenderTickAcceptable(bool acceptable)
{
g_isAceForground = forground;
g_isRenderTickAcceptable = acceptable;
}
void ProductAdapter::SetScreenSize(uint16_t width, uint16_t height)
+5 -3
View File
@@ -80,6 +80,8 @@ void JSAbility::Launch(const char * const abilityPath, const char * const bundle
return;
}
START_TRACING(LAUNCH);
// mark the flag in advance to make sure we can take over render tick as soon as possible
ProductAdapter::UpdateRenderTickAcceptable(true);
JSAbilityImpl *jsAbilityImpl = CastAbilityImpl(jsAbilityImpl_);
jsAbilityImpl->InitEnvironment(abilityPath, bundleName, token);
FatalHandler::GetInstance().RegisterFatalHandler(this);
@@ -98,7 +100,7 @@ void JSAbility::Show()
JSAbilityImpl *jsAbilityImpl = CastAbilityImpl(jsAbilityImpl_);
jsAbilityImpl->Show();
AsyncTaskManager::GetInstance().SetFront(true);
ProductAdapter::UpdateShowingState(true);
ProductAdapter::UpdateRenderTickAcceptable(true);
isActived_ = true;
}
@@ -112,7 +114,7 @@ void JSAbility::Hide()
JSAbilityImpl *jsAbilityImpl = CastAbilityImpl(jsAbilityImpl_);
jsAbilityImpl->Hide();
AsyncTaskManager::GetInstance().SetFront(false);
ProductAdapter::UpdateShowingState(false);
ProductAdapter::UpdateRenderTickAcceptable(false);
isActived_ = false;
}
@@ -127,7 +129,7 @@ void JSAbility::TransferToDestroy()
jsAbilityImpl->CleanUp();
// Reset render flag or low layer task mutex in case we are during the rendering process,
// this situation might happen if the destroy function is called outside of JS thread, such as AMS.
ProductAdapter::UpdateShowingState(false);
ProductAdapter::UpdateRenderTickAcceptable(false);
FatalHandler::GetInstance().ResetRendering();
FatalHandler::GetInstance().SetExitingFlag(false);
#ifdef FEATURE_SCREEN_ON_VISIBLE