            messages.append(m.androidLog.message)
          except UnicodeDecodeError:
            pass
  
        for err in ("ERROR_CRC", "ERROR_ECC", "ERROR_STREAM_UNDERFLOW", "APPLY FAILED"):
          for m in messages:
            if err not in m:
              continue
  
            csid = m.split("CSID:")[-1].split(" ")[0]
            evt = {"0": EventName.roadCameraError, "1": EventName.wideRoadCameraError,
                   "2": EventName.driverCameraError}.get(csid, None)
            if evt is not None:
              self.events.add(evt)
  
      # TODO: fix simulator
      if not SIMULATION:
        if not NOSENSOR:
          if not self.sm['liveLocationKalman'].gpsOK and (self.distance_traveled > 1000):
            # Not show in first 1 km to allow for driving out of garage. This event shows after 5 minutes
 
</s> remove       logs = messaging.drain_sock(self.log_sock, wait_for_one=False)
      messages = []
      for m in logs:
 </s> add       for m in  messaging.drain_sock(self.log_sock, wait_for_one=False): </s> remove           messages.append(m.androidLog.message)
 </s> add           msg = m.androidLog.message
          if any(err in msg for err in ("ERROR_CRC", "ERROR_ECC", "ERROR_STREAM_UNDERFLOW", "APPLY FAILED")):
            csid = msg.split("CSID:")[-1].split(" ")[0]
            evt = CSID_MAP.get(csid, None)
            if evt is not None:
              self.events.add(evt) </s> remove 
 </s> add CSID_MAP = {"0": EventName.roadCameraError, "1": EventName.wideRoadCameraError, "2": EventName.driverCameraError}
            messages.append(m.androidLog.message)
          except UnicodeDecodeError:
            pass
  











      # TODO: fix simulator
      if not SIMULATION:
        if not NOSENSOR:
          if not self.sm['liveLocationKalman'].gpsOK and (self.distance_traveled > 1000):
            # Not show in first 1 km to allow for driving out of garage. This event shows after 5 minutes
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 controlsd: cleanup parsing android log (#23421)

* cleanup parse android log

* global CSID_MAP

* use generator express

* cleanup

* no walrus

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> 
selfdrive/controls/controlsd.py