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
MediaFrameworkTest/
Uses instrumentation and so can be run with runtest.
It assumes /sdcard/media_api/ has been populated.
contents/media_api/
Push to /sdcard/media_api/ for use with MediaFrameworkTest:
adb shell mkdir /sdcard/media_api
adb push contents/media_api/ /sdcard/media_api/
All other subdirectories are manual tests or sample apps.