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

Commit 32305721 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove some dead code" into main

parents f0fec0bd b31519b0
Loading
Loading
Loading
Loading
+2 −38
Original line number Diff line number Diff line
@@ -47,21 +47,10 @@ import java.util.Objects;
    @Nullable
    private BluetoothLeAudio mLeAudioProfile;

    @Nullable
    private OnProfileChangedListener mOnProfileChangedListener;

    BluetoothProfileMonitor(@NonNull Context context,
            @NonNull BluetoothAdapter bluetoothAdapter) {
        Objects.requireNonNull(context);
        Objects.requireNonNull(bluetoothAdapter);

        mContext = context;
        mBluetoothAdapter = bluetoothAdapter;
    }

    /* package */ synchronized void setOnProfileChangedListener(
            @NonNull OnProfileChangedListener listener) {
        mOnProfileChangedListener = listener;
        mContext = Objects.requireNonNull(context);
        mBluetoothAdapter = Objects.requireNonNull(bluetoothAdapter);
    }

    /* package */ void start() {
@@ -115,15 +104,9 @@ import java.util.Objects;
        }
    }

    /* package */ interface OnProfileChangedListener {
        void onProfileChange(int profile);
    }

    private final class ProfileListener implements BluetoothProfile.ServiceListener {
        @Override
        public void onServiceConnected(int profile, BluetoothProfile proxy) {
            OnProfileChangedListener listener;

            synchronized (BluetoothProfileMonitor.this) {
                switch (profile) {
                    case BluetoothProfile.A2DP:
@@ -135,22 +118,12 @@ import java.util.Objects;
                    case BluetoothProfile.LE_AUDIO:
                        mLeAudioProfile = (BluetoothLeAudio) proxy;
                        break;
                    default:
                        return;
                }

                listener = mOnProfileChangedListener;
            }

            if (listener != null) {
                listener.onProfileChange(profile);
            }
        }

        @Override
        public void onServiceDisconnected(int profile) {
            OnProfileChangedListener listener;

            synchronized (BluetoothProfileMonitor.this) {
                switch (profile) {
                    case BluetoothProfile.A2DP:
@@ -162,17 +135,8 @@ import java.util.Objects;
                    case BluetoothProfile.LE_AUDIO:
                        mLeAudioProfile = null;
                        break;
                    default:
                        return;
                }

                listener = mOnProfileChangedListener;
            }

            if (listener != null) {
                listener.onProfileChange(profile);
            }
        }
    }

}