[Thread] use Context#enforceCallingOrSelfPermission

Context#enforceCallingPermission always throws SecurityException if we
are not processing a Binder IPC. This specifically doesn't work with
unit tests where the service APIs are called with mocked Binder
interfaces.

Bug: 317555104
Change-Id: I50be68487fb53907dbb1e3da7815fdf305047481
1 file changed