[core] Fix critical section on send bridge (#842)

This commit is contained in:
LoveSy 2021-08-05 22:44:13 +08:00 committed by GitHub
parent 39c6802435
commit 45310fc85d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -121,7 +121,7 @@ public class BridgeService {
private static Listener listener;
// For service
private static void sendToBridge(IBinder binder, boolean isRestart) {
private static synchronized void sendToBridge(IBinder binder, boolean isRestart) {
do {
bridgeService = ServiceManager.getService(SERVICE_NAME);
if (bridgeService != null && bridgeService.pingBinder()) {
@ -160,6 +160,7 @@ public class BridgeService {
data.writeInt(ACTION.ACTION_SEND_BINDER.ordinal());
Log.v(TAG, "binder " + binder.toString());
data.writeStrongBinder(binder);
if (bridgeService == null) break;
res = bridgeService.transact(TRANSACTION_CODE, data, reply, 0);
reply.readException();
} catch (Throwable e) {