Fix HdmiCecLocalDevice concurrent access

Original implementation of HdmiCecLocalDevice expected only one thread
refers ActionList. The concurrent access causes system_server crash.
To enable for each thread to refer own ActionList without any conflict.

Test: Sanity Test on Android TV connected to AVR.
      Repeat screen off and on quickly.

Change-Id: I66f42dfbbd8d193f8a02d3ec5d51783149ddfeb2
This commit is contained in:
Shuichi.Noguchi
2017-12-19 19:44:48 +09:00
committed by Shuichi Noguchi
parent 4c8fa81d17
commit c4426af9eb

View File

@@ -660,7 +660,8 @@ abstract class HdmiCecLocalDevice {
@ServiceThreadOnly
void startQueuedActions() {
assertRunOnServiceThread();
for (HdmiCecFeatureAction action : mActions) {
// Use copied action list in that start() may remove itself.
for (HdmiCecFeatureAction action : new ArrayList<>(mActions)) {
if (!action.started()) {
Slog.i(TAG, "Starting queued action:" + action);
action.start();