summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-03-17 23:06:43 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-03-17 23:06:43 +0000
commit9752f1712a94e29ea74118e0e8112dcee4c3cbe9 (patch)
tree9a2fb5e6c1890b9ec2ee77e3bfc4ec6868e7367d
parent313a37c3b957f4a99226e0ec36ebf51a762aa824 (diff)
parent993b7d15bacdad04c574b334160a7ce8676511a9 (diff)
downloadservices-android12-qpr3-s1-release.tar.gz
Change-Id: I0ae9c7f085cf10cf2ba8880cdac2b56cc5a9aa3e
-rw-r--r--src/com/android/internal/car/CarServiceHelperService.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/com/android/internal/car/CarServiceHelperService.java b/src/com/android/internal/car/CarServiceHelperService.java
index 20e53b8..84e1e5c 100644
--- a/src/com/android/internal/car/CarServiceHelperService.java
+++ b/src/com/android/internal/car/CarServiceHelperService.java
@@ -448,12 +448,17 @@ public class CarServiceHelperService extends SystemService
Slogf.i(TAG, "**CarService connected**");
}
- sendSetSystemServerConnectionsCall();
-
mHandler.removeMessages(WHAT_SERVICE_UNRESPONSIVE);
mHandler.sendMessageDelayed(
obtainMessage(CarServiceHelperService::handleCarServiceUnresponsive, this)
.setWhat(WHAT_SERVICE_UNRESPONSIVE), CAR_SERVICE_BINDER_CALL_TIMEOUT);
+
+ // Post WHAT_SERVICE_UNRESPONSIVE message before setting system server connection
+ // because CarService may respond before the sendSetSystemServerConnectionsCall call
+ // returns and try to remove WHAT_SERVICE_UNRESPONSIVE message from the handler.
+ // Thus, posting this message after setting system server connection may result in a race
+ // condition where the message is never removed from the handler.
+ sendSetSystemServerConnectionsCall();
}
private TimingsTraceAndSlog newTimingsTraceAndSlog() {