Since we're in much worse trouble if `/data/system/packages.list` is
attacker-controlled, there doesn't seem like much benefit to having
the little bit of [incomplete] range checking we had on the uid
field (by using a wider type than `uid_t` actually is), and
apparently we're now abusing `-1` to mean "apex or sdk library",
despite `uid_t` being an unsigned type.
Bug: http://b/336659478
Change-Id: I7a270eea937d21fc1d7fcda8654054210cf631fe
I was happy to ignore this as long as it wasn't being touched, but it's
been modified twice in the last year. Time to just throw it out and
rewrite it.
Also add some basic tests and put them in presubmit.
Bug: http://b/127686429
Test: new tests
Change-Id: Ie7e9406521291de0eab3138f55068cee6aaf365a