Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f15ef4b0 authored by Jeff Brown's avatar Jeff Brown
Browse files

Remove setRemoteSubmixOn method.

The submix will be controlled automatically from now on based on
whether there is an active audio recorder.

Bug: 10265163
Change-Id: I90a8592136c6507680e70f054243df70cc82efad
parent 77b2a861
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -1315,19 +1315,6 @@ public class AudioManager {
        }
    }

    /**
     * @hide
     * Signals whether remote submix audio rerouting is enabled.
     */
    public void setRemoteSubmixOn(boolean on, int address) {
        IAudioService service = getService();
        try {
            service.setRemoteSubmixOn(on, address);
        } catch (RemoteException e) {
            Log.e(TAG, "Dead object in setRemoteSubmixOn", e);
        }
    }

    /**
     * Sets audio routing to the wired headset on or off.
     *
+0 −25
Original line number Diff line number Diff line
@@ -150,7 +150,6 @@ public class AudioService extends IAudioService.Stub {
    private static final int MSG_PERSIST_MASTER_VOLUME_MUTE = 12;
    private static final int MSG_REPORT_NEW_ROUTES = 13;
    private static final int MSG_SET_FORCE_BT_A2DP_USE = 14;
    private static final int MSG_SET_RSX_CONNECTION_STATE = 15; // change remote submix connection
    private static final int MSG_CHECK_MUSIC_ACTIVE = 16;
    private static final int MSG_BROADCAST_AUDIO_BECOMING_NOISY = 17;
    private static final int MSG_CONFIGURE_SAFE_MEDIA_VOLUME = 18;
@@ -2364,26 +2363,6 @@ public class AudioService extends IAudioService.Stub {
        }
    };

    /** see AudioManager.setRemoteSubmixOn(boolean on) */
    public void setRemoteSubmixOn(boolean on, int address) {
        sendMsg(mAudioHandler, MSG_SET_RSX_CONNECTION_STATE,
                SENDMSG_REPLACE /* replace with QUEUE when multiple addresses are supported */,
                on ? 1 : 0 /*arg1*/,
                address /*arg2*/,
                null/*obj*/, 0/*delay*/);
    }

    private void onSetRsxConnectionState(int available, int address) {
        AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_IN_REMOTE_SUBMIX,
                available == 1 ?
                        AudioSystem.DEVICE_STATE_AVAILABLE : AudioSystem.DEVICE_STATE_UNAVAILABLE,
                String.valueOf(address) /*device_address*/);
        AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_REMOTE_SUBMIX,
                available == 1 ?
                        AudioSystem.DEVICE_STATE_AVAILABLE : AudioSystem.DEVICE_STATE_UNAVAILABLE,
                String.valueOf(address) /*device_address*/);
    }

    private void onCheckMusicActive() {
        synchronized (mSafeMediaVolumeState) {
            if (mSafeMediaVolumeState == SAFE_MEDIA_VOLUME_INACTIVE) {
@@ -3571,10 +3550,6 @@ public class AudioService extends IAudioService.Stub {
                    break;
                }

                case MSG_SET_RSX_CONNECTION_STATE:
                    onSetRsxConnectionState(msg.arg1/*available*/, msg.arg2/*address*/);
                    break;

                case MSG_CHECK_MUSIC_ACTIVE:
                    onCheckMusicActive();
                    break;
+0 −2
Original line number Diff line number Diff line
@@ -110,8 +110,6 @@ interface IAudioService {

    boolean isBluetoothA2dpOn();

    oneway void setRemoteSubmixOn(boolean on, int address);

    int requestAudioFocus(int mainStreamType, int durationHint, IBinder cb,
            IAudioFocusDispatcher fd, String clientId, String callingPackageName);

+0 −22
Original line number Diff line number Diff line
@@ -83,11 +83,6 @@ final class WifiDisplayController implements DumpUtils.Dump {
    private static final int CONNECT_MAX_RETRIES = 3;
    private static final int CONNECT_RETRY_DELAY_MILLIS = 500;

    // A unique token to identify the remote submix that is managed by Wifi display.
    // It must match what the media server uses when it starts recording the submix
    // for transmission.  We use 0 although the actual value is currently ignored.
    private static final int REMOTE_SUBMIX_ADDRESS = 0;

    private final Context mContext;
    private final Handler mHandler;
    private final Listener mListener;
@@ -95,8 +90,6 @@ final class WifiDisplayController implements DumpUtils.Dump {
    private final WifiP2pManager mWifiP2pManager;
    private final Channel mWifiP2pChannel;

    private final AudioManager mAudioManager;

    private boolean mWifiP2pEnabled;
    private boolean mWfdEnabled;
    private boolean mWfdEnabling;
@@ -146,9 +139,6 @@ final class WifiDisplayController implements DumpUtils.Dump {
    // True if RTSP has connected.
    private boolean mRemoteDisplayConnected;

    // True if the remote submix is enabled.
    private boolean mRemoteSubmixOn;

    // The information we have most recently told WifiDisplayAdapter about.
    private WifiDisplay mAdvertisedDisplay;
    private Surface mAdvertisedDisplaySurface;
@@ -164,8 +154,6 @@ final class WifiDisplayController implements DumpUtils.Dump {
        mWifiP2pManager = (WifiP2pManager)context.getSystemService(Context.WIFI_P2P_SERVICE);
        mWifiP2pChannel = mWifiP2pManager.initialize(context, handler.getLooper(), null);

        mAudioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);

        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION);
        intentFilter.addAction(WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION);
@@ -211,7 +199,6 @@ final class WifiDisplayController implements DumpUtils.Dump {
        pw.println("mRemoteDisplay=" + mRemoteDisplay);
        pw.println("mRemoteDisplayInterface=" + mRemoteDisplayInterface);
        pw.println("mRemoteDisplayConnected=" + mRemoteDisplayConnected);
        pw.println("mRemoteSubmixOn=" + mRemoteSubmixOn);
        pw.println("mAdvertisedDisplay=" + mAdvertisedDisplay);
        pw.println("mAdvertisedDisplaySurface=" + mAdvertisedDisplaySurface);
        pw.println("mAdvertisedDisplayWidth=" + mAdvertisedDisplayWidth);
@@ -482,7 +469,6 @@ final class WifiDisplayController implements DumpUtils.Dump {
            mHandler.removeCallbacks(mRtspTimeout);

            mWifiP2pManager.setMiracastMode(WifiP2pManager.MIRACAST_DISABLED);
            setRemoteSubmixOn(false);
            unadvertiseDisplay();

            // continue to next step
@@ -626,7 +612,6 @@ final class WifiDisplayController implements DumpUtils.Dump {
                return; // done
            }

            setRemoteSubmixOn(true);
            mWifiP2pManager.setMiracastMode(WifiP2pManager.MIRACAST_SOURCE);

            final WifiP2pDevice oldDevice = mConnectedDevice;
@@ -677,13 +662,6 @@ 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) {
        mWifiP2pEnabled = enabled;
        updateWfdEnableState();