Make GetState() handle overflowed state and 0 path to root

Fix GetState() so that it deals correctly with an overflowed state in
which the path to root is entirely zero. We don't try to salvage
the DCHECK for now. Fix the stated invariants to be more consistent
with the code.

Bug: 69564627
Test: AOSP builds & runs. Host tests pass.
Change-Id: Idd975f03d4292e4fc52ad7714bbb2b1b98e17f96
2 files changed