Check whether the correct callingUid has the necessary permissions

Using callingUid from the Binder may not always check the correct
caller's permission - like when the calling identity is cleared or when
the check is initiated from the system server. Thus explicitly pass the
callingUid to check permissions.

Also update tests afftected by this change - by adding methods to mocked
objects

Bug: 334024639
Test: presubmits
Flag: EXEMPT. Bug fix only
Change-Id: I215e391016970b2aae197f98e387b8973c8e68ea
3 files changed