Skip new launch when the previous one is still pending (#2347)

Fixes #2346

Co-authored-by: LoveSy <shana@zju.edu.cn>
This commit is contained in:
LibXZR 2023-01-19 02:03:35 +08:00 committed by GitHub
parent 5666dca1e3
commit 5ea3db130c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -262,6 +262,11 @@ public class LSPManagerService extends ILSPManagerService.Stub {
// there's one running parasitic manager
// or it's run by ourself after killing, resume it
return true;
} else if (pendingManager) {
// Check the flag in case new launch comes before finishing
// the previous one to avoid racing.
Log.d(TAG, "manager is still on its way when new launch comes, skipping");
return false;
} else {
// new parasitic manager launch, set the flag and kill
// old processes