Skip to content
Commit c78a463e authored by Alex Klyubin's avatar Alex Klyubin
Browse files

Log warning when can't read from HW RNG

EntropyMixer in system_server was supposed to log a warning if HW RNG
was there but could not be read. However, this wasn't the case.
EntropyMixer relied on FileInputStream.open throwing a
FileNotFoundException only if the file wasn't actually there. In
reality, the contract of FileInputStream.open is to throw the
FileNotFoundException whenever the file could not be opened for any
reason, such as the file being there but not permitted to be opened
by the caller.

This commit fixes the issue by correctly distinguishing between HW RNG
device not being there vs issues while opening/reading from this
device.

Test: manually tested by modifiying the system image to expose
      /dev/hw_random but make it unopenable to system_server, or to
      not expose /dev/hw_random at all.
Bug: 70737352
Change-Id: I6a3c1b4cc1ff81928d40190895680c5e43244ec9
parent 01232ca5
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment