Also fix a couple of issues in the code:
1. Check that fields are static before attempting to read them.
Currently, if a non-static field's name starts with one of the
specified constant prefixes (by default, "CMD_" and "EVENT_")
we'd get an NPE.
2. Only read final fields.
Change-Id: I0e07c4c27a66180cbaf7f2b1c235daafc080863b