Address small inefficiencies.

1. Don't hold the lock for validation checks that don't need it.
2. Put early returns ahead of other work when possible.

Bug: 203811598
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/usage
Test: atest frameworks/base/services/tests/mockingservicestests/src/com/android/server/usage
Change-Id: Ic923db1534e27e0932e594b8259fe482772b8a6a
1 file changed