Merge "System MR2: Add MediaRouter2#registerRouteCallback(executor, callback)" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-03-23 12:03:36 +00:00
committed by Android (Google) Code Review
2 changed files with 19 additions and 0 deletions

View File

@@ -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();

View File

@@ -298,6 +298,24 @@ public final class MediaRouter2 {
return mClientPackageName;
}
/**
* 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>