summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/api/system-current.txt1
-rw-r--r--media/java/android/media/MediaRouter2.java18
2 files changed, 19 insertions, 0 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index 4c6d653d8211..a0e0f7133a25 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -5231,6 +5231,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