Preventing Activity leak if it was passed as Context argument

As far as I remember passing application Context to initialize CastManager will eventually lead to an exception in some cases (sorry, cannot check it now) and will prevent dialogs from using application theme, so Activity is likely to be provided as an argument to initialize CastManager. If so, then Activity will leak since BaseCastManager.setContext(..) doesn't reset Context for MediaRouter, CastMediaRouterCallback and AudioManager.