diff options
| author | 2021-03-23 11:50:31 +0900 | |
|---|---|---|
| committer | 2021-03-23 09:46:54 +0000 | |
| commit | 96ab01b44fafc0959c1960f348c9fb2ea28a36d5 (patch) | |
| tree | a08be2c45cafa312edfcbef29779350b1140f001 | |
| parent | 2a12cfadb44a5c84855b297bb5a761926836a438 (diff) | |
System MR2: Add MediaRouter2#registerRouteCallback(executor, callback)
This CL adds registerCallback(executor, callback) as @SystemApi
for system MediaRouter2.
Bug: 183453134
Test: Passed CTS
Change-Id: I50e942714946ae8af7ad69432cefcd8015040d4d
| -rw-r--r-- | core/api/system-current.txt | 1 | ||||
| -rw-r--r-- | media/java/android/media/MediaRouter2.java | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 1b3edcf28d65..d05e10d55a5d 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -5228,6 +5228,7 @@ package android.media { method @Nullable public String getClientPackageName(); method @Nullable public android.media.MediaRouter2.RoutingController getController(@NonNull String); method @Nullable public static android.media.MediaRouter2 getInstance(@NonNull android.content.Context, @NonNull String); + method public void registerRouteCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.MediaRouter2.RouteCallback); method public void setRouteVolume(@NonNull android.media.MediaRoute2Info, int); method public void startScan(); method public void stopScan(); diff --git a/media/java/android/media/MediaRouter2.java b/media/java/android/media/MediaRouter2.java index 02fa0401e586..8daa30389012 100644 --- a/media/java/android/media/MediaRouter2.java +++ b/media/java/android/media/MediaRouter2.java @@ -299,6 +299,24 @@ public final class MediaRouter2 { } /** + * Registers a callback to receive route related events when they change. + * <p> + * If the specified callback is already registered, its registration will be updated for the + * given {@link Executor executor}. + * <p> + * This will be no-op for non-system routers. + * @hide + */ + @SystemApi + public void registerRouteCallback(@NonNull @CallbackExecutor Executor executor, + @NonNull RouteCallback routeCallback) { + if (!isSystemRouter()) { + return; + } + registerRouteCallback(executor, routeCallback, RouteDiscoveryPreference.EMPTY); + } + + /** * Registers a callback to discover routes and to receive events when they change. * <p> * If the specified callback is already registered, its registration will be updated for the |