Add new API Context#checkContentUriPermission

Currently, apps can't check if an app has access to a content URI. That
is because the existing checkUriPermission() API is limited to checking
permissions via URI grant flags. Hence, this change adds a new API that
focuses on content URIs and on top of grant flags, it checks for general
access to the URI's content provider.

In addition to this API, we'll be introducing Activity APIs and a
Manifest attribute to help apps with checking content URI permissions on
activity callers.

Finally, to minimise code duplication, we merged checkUriPermission()'s
implementation in ActivityManagerService and UriGrantsManagerInternal.

Bug: 293467489
Test: atest WmTests:ActivityStarterTests
Test: atest FrameworksServicesTests:com.android.server.uri
Test: atest CtsWindowManagerDeviceActivity:ActivityStarterTests
Test: atest CtsWindowManagerDeviceWindow:CrossAppDragAndDropTests
Test: atest AppEnumerationTests
Test: atest CtsContentTestCases:android.content.cts.ContextTest
Change-Id: I61a0574e3979702ed32f4d926c664f134046f555
9 files changed