System MediaRouter2: Resolve API review
This CL resolves API reviews on system APIs on MediaRouter2.
1) It checks permission when registering the MediaRoute2Manager
in system server. Therefore, app cannot bypass the permission
checks via reflection.
The system api calls will be no-op without permission.
2) It adds @RequiresPermission annotations to related APIs.
Also, this CL changes the required permission
from MODIFY_AUDIO_ROUTING to MEDIA_CONTENT_CONTROL,
as the media routing can be applied to video, not only to audio.
Note that MediaRouter2#getInstance(Context, String)
does not throw SecurityException anymore.
Bug: 183428114
Test: atest android.media.cts.MediaRouter2Test
atest android.media.cts.SystemMediaRouterTest
(MediaRouter2ManagerTest is already broken, and
that will be handled out of this CL.)
Change-Id: I55013a5b4b954ca1c8e2adb586f49f01103563db
8 files changed