Merge "Swap remote submix initialization order." into jb-mr1-dev
This commit is contained in:
@ -129,6 +129,9 @@ final class WifiDisplayController implements DumpUtils.Dump {
|
||||
// True if RTSP has connected.
|
||||
private boolean mRemoteDisplayConnected;
|
||||
|
||||
// True if the remote submix is enabled.
|
||||
private boolean mRemoteSubmixOn;
|
||||
|
||||
public WifiDisplayController(Context context, Handler handler, Listener listener) {
|
||||
mContext = context;
|
||||
mHandler = handler;
|
||||
@ -160,6 +163,7 @@ final class WifiDisplayController implements DumpUtils.Dump {
|
||||
pw.println("mRemoteDisplay=" + mRemoteDisplay);
|
||||
pw.println("mRemoteDisplayInterface=" + mRemoteDisplayInterface);
|
||||
pw.println("mRemoteDisplayConnected=" + mRemoteDisplayConnected);
|
||||
pw.println("mRemoteSubmixOn=" + mRemoteSubmixOn);
|
||||
|
||||
pw.println("mKnownWifiDisplayPeers: size=" + mKnownWifiDisplayPeers.size());
|
||||
for (WifiP2pDevice device : mKnownWifiDisplayPeers) {
|
||||
@ -390,16 +394,14 @@ final class WifiDisplayController implements DumpUtils.Dump {
|
||||
Slog.i(TAG, "Stopped listening for RTSP connection on " + mRemoteDisplayInterface
|
||||
+ " from Wifi display: " + mConnectedDevice.deviceName);
|
||||
|
||||
if (mRemoteDisplayConnected) {
|
||||
mAudioManager.setRemoteSubmixOn(false, REMOTE_SUBMIX_ADDRESS);
|
||||
}
|
||||
|
||||
mRemoteDisplay.dispose();
|
||||
mRemoteDisplay = null;
|
||||
mRemoteDisplayInterface = null;
|
||||
mRemoteDisplayConnected = false;
|
||||
mHandler.removeCallbacks(mRtspTimeout);
|
||||
|
||||
setRemoteSubmixOn(false);
|
||||
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -527,6 +529,8 @@ final class WifiDisplayController implements DumpUtils.Dump {
|
||||
return; // done
|
||||
}
|
||||
|
||||
setRemoteSubmixOn(true);
|
||||
|
||||
final WifiP2pDevice oldDevice = mConnectedDevice;
|
||||
final int port = getPortNumber(mConnectedDevice);
|
||||
final String iface = addr.getHostAddress() + ":" + port;
|
||||
@ -545,8 +549,6 @@ final class WifiDisplayController implements DumpUtils.Dump {
|
||||
mRemoteDisplayConnected = true;
|
||||
mHandler.removeCallbacks(mRtspTimeout);
|
||||
|
||||
mAudioManager.setRemoteSubmixOn(true, REMOTE_SUBMIX_ADDRESS);
|
||||
|
||||
final WifiDisplay display = createWifiDisplay(mConnectedDevice);
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
@ -583,6 +585,13 @@ final class WifiDisplayController implements DumpUtils.Dump {
|
||||
}
|
||||
}
|
||||
|
||||
private void setRemoteSubmixOn(boolean on) {
|
||||
if (mRemoteSubmixOn != on) {
|
||||
mRemoteSubmixOn = on;
|
||||
mAudioManager.setRemoteSubmixOn(on, REMOTE_SUBMIX_ADDRESS);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleStateChanged(boolean enabled) {
|
||||
if (mWifiP2pEnabled != enabled) {
|
||||
mWifiP2pEnabled = enabled;
|
||||
|
Reference in New Issue
Block a user