Merge "MediaRouter: clear session info when disconnected"
This commit is contained in:
committed by
Android (Google) Code Review
commit
6a1e0b72e3
@@ -247,13 +247,23 @@ public class MediaRouter2Manager {
|
||||
Objects.requireNonNull(packageName, "packageName must not be null");
|
||||
Objects.requireNonNull(route, "route must not be null");
|
||||
|
||||
boolean transferred = false;
|
||||
//TODO: instead of release all controllers, add an API to specify controllers that
|
||||
// should be released (or is the system controller).
|
||||
for (RoutingController controller : getRoutingControllers(packageName)) {
|
||||
if (controller.getSessionInfo().getTransferrableRoutes().contains(route.getId())) {
|
||||
if (!transferred && controller.getSessionInfo().getTransferrableRoutes()
|
||||
.contains(route.getId())) {
|
||||
controller.transferToRoute(route);
|
||||
return;
|
||||
transferred = true;
|
||||
} else if (!controller.getSessionInfo().isSystemSession()) {
|
||||
controller.release();
|
||||
}
|
||||
}
|
||||
|
||||
if (transferred) {
|
||||
return;
|
||||
}
|
||||
|
||||
Client client;
|
||||
synchronized (sLock) {
|
||||
client = mClient;
|
||||
|
||||
@@ -411,6 +411,12 @@ final class MediaRoute2ProviderProxy extends MediaRoute2Provider implements Serv
|
||||
mActiveConnection.dispose();
|
||||
mActiveConnection = null;
|
||||
setAndNotifyProviderState(null);
|
||||
synchronized (mLock) {
|
||||
for (RoutingSessionInfo sessionInfo : mSessionInfos) {
|
||||
mCallback.onSessionReleased(this, sessionInfo);
|
||||
}
|
||||
mSessionInfos.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user