diff options
author | 2023-04-07 23:53:09 +0000 | |
---|---|---|
committer | 2023-04-07 23:53:09 +0000 | |
commit | 9b6e5783339c00f57c8a5fdfc947fc98268a2b81 (patch) | |
tree | 3d658f9c7be5a9d2dfaea772b38a72ffc10f9fca /cmds/bootanimation/BootAnimation.cpp | |
parent | 35568ecf265994cb774c5da31410309186359f69 (diff) | |
parent | fd453a4a8aa3fc5b123228110e9fb7024eec833f (diff) |
Merge "Fix the problem of slow exit of boot animation" am: 9a0581c0c9 am: f6ecaaf536 am: fd453a4a8a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2369728
Change-Id: I886e91323a069589dd91f668bc2a363172580c50
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'cmds/bootanimation/BootAnimation.cpp')
-rw-r--r-- | cmds/bootanimation/BootAnimation.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index c4e8b0e49af3..a8b6c0b70804 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -105,6 +105,7 @@ static const char PROGRESS_PROP_NAME[] = "service.bootanim.progress"; static const char DISPLAYS_PROP_NAME[] = "persist.service.bootanim.displays"; static const char CLOCK_ENABLED_PROP_NAME[] = "persist.sys.bootanim.clock.enabled"; static const int ANIM_ENTRY_NAME_MAX = ANIM_PATH_MAX + 1; +static const int MAX_CHECK_EXIT_INTERVAL_US = 50000; static constexpr size_t TEXT_POS_LEN_MAX = 16; static const int DYNAMIC_COLOR_COUNT = 4; static const char U_TEXTURE[] = "uTexture"; @@ -1678,7 +1679,17 @@ bool BootAnimation::playAnimation(const Animation& animation) { checkExit(); } - usleep(part.pause * ns2us(frameDuration)); + int pauseDuration = part.pause * ns2us(frameDuration); + while(pauseDuration > 0 && !exitPending()){ + if (pauseDuration > MAX_CHECK_EXIT_INTERVAL_US) { + usleep(MAX_CHECK_EXIT_INTERVAL_US); + pauseDuration -= MAX_CHECK_EXIT_INTERVAL_US; + } else { + usleep(pauseDuration); + break; + } + checkExit(); + } if (exitPending() && !part.count && mCurrentInset >= mTargetInset && !part.hasFadingPhase()) { |