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

Commit 26b9d812 authored by Ajay Panicker's avatar Ajay Panicker Committed by android-build-merger
Browse files

Merge "Remove the old AVRCP code" am: af3ef2ce

am: 9b477530

Change-Id: Ic550a8338884d1b4fcdd7d65faeb1fdd929e42c8
parents b97f5176 9b477530
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@ cc_library_shared {
        "com_android_bluetooth_hfpclient.cpp",
        "com_android_bluetooth_a2dp.cpp",
        "com_android_bluetooth_a2dp_sink.cpp",
        "com_android_bluetooth_avrcp.cpp",
        "com_android_bluetooth_avrcp_controller.cpp",
        "com_android_bluetooth_avrcp_target.cpp",
        "com_android_bluetooth_hid_host.cpp",
+0 −1529

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −6
Original line number Diff line number Diff line
@@ -1306,12 +1306,6 @@ jint JNI_OnLoad(JavaVM* jvm, void* reserved) {
    return JNI_ERR;
  }

  status = android::register_com_android_bluetooth_avrcp(e);
  if (status < 0) {
    ALOGE("jni avrcp target registration failure: %d", status);
    return JNI_ERR;
  }

  status = android::register_com_android_bluetooth_avrcp_target(e);
  if (status < 0) {
    ALOGE("jni new avrcp target registration failure: %d", status);
+10 −34
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ import android.util.Log;

import com.android.bluetooth.BluetoothMetricsProto;
import com.android.bluetooth.Utils;
import com.android.bluetooth.avrcp.Avrcp;
import com.android.bluetooth.avrcp.AvrcpTargetService;
import com.android.bluetooth.btservice.AdapterService;
import com.android.bluetooth.btservice.MetricsLogger;
@@ -63,7 +62,6 @@ public class A2dpService extends ProfileService {
    private BluetoothAdapter mAdapter;
    private AdapterService mAdapterService;
    private HandlerThread mStateMachinesThread;
    private Avrcp mAvrcp;

    @VisibleForTesting
    A2dpNativeInterface mA2dpNativeInterface;
@@ -118,28 +116,25 @@ public class A2dpService extends ProfileService {
        mMaxConnectedAudioDevices = mAdapterService.getMaxConnectedAudioDevices();
        Log.i(TAG, "Max connected audio devices set to " + mMaxConnectedAudioDevices);

        // Step 3: Setup AVRCP
        mAvrcp = Avrcp.make(this);

        // Step 4: Start handler thread for state machines
        // Step 3: Start handler thread for state machines
        mStateMachines.clear();
        mStateMachinesThread = new HandlerThread("A2dpService.StateMachines");
        mStateMachinesThread.start();

        // Step 5: Setup codec config
        // Step 4: Setup codec config
        mA2dpCodecConfig = new A2dpCodecConfig(this, mA2dpNativeInterface);

        // Step 6: Initialize native interface
        // Step 5: Initialize native interface
        mA2dpNativeInterface.init(mMaxConnectedAudioDevices,
                                  mA2dpCodecConfig.codecConfigPriorities());

        // Step 7: Check if A2DP is in offload mode
        // Step 6: Check if A2DP is in offload mode
        mA2dpOffloadEnabled = mAdapterService.isA2dpOffloadEnabled();
        if (DBG) {
            Log.d(TAG, "A2DP offload flag set to " + mA2dpOffloadEnabled);
        }

        // Step 8: Setup broadcast receivers
        // Step 7: Setup broadcast receivers
        IntentFilter filter = new IntentFilter();
        filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
        mBondStateChangedReceiver = new BondStateChangedReceiver();
@@ -149,10 +144,10 @@ public class A2dpService extends ProfileService {
        mConnectionStateChangedReceiver = new ConnectionStateChangedReceiver();
        registerReceiver(mConnectionStateChangedReceiver, filter);

        // Step 9: Mark service as started
        // Step 8: Mark service as started
        setA2dpService(this);

        // Step 10: Clear active device
        // Step 9: Clear active device
        setActiveDevice(null);

        return true;
@@ -201,11 +196,6 @@ public class A2dpService extends ProfileService {
        mStateMachinesThread.quitSafely();
        mStateMachinesThread = null;

        // Step 3: Cleanup AVRCP
        mAvrcp.doQuit();
        mAvrcp.cleanup();
        mAvrcp = null;

        // Step 2: Reset maximum number of connected audio devices
        mMaxConnectedAudioDevices = 1;

@@ -580,11 +570,12 @@ public class A2dpService extends ProfileService {
        return priority;
    }

    /* Absolute volume implementation */
    public boolean isAvrcpAbsoluteVolumeSupported() {
        return mAvrcp.isAbsoluteVolumeSupported();
        // TODO (apanicke): Add a hook here for the AvrcpTargetService.
        return false;
    }


    public void setAvrcpAbsoluteVolume(int volume) {
        // TODO (apanicke): Instead of using A2DP as a middleman for volume changes, add a binder
        // service to the new AVRCP Profile and have the audio manager use that instead.
@@ -592,18 +583,6 @@ public class A2dpService extends ProfileService {
            AvrcpTargetService.get().sendVolumeChanged(volume);
            return;
        }

        mAvrcp.setAbsoluteVolume(volume);
    }

    public void setAvrcpAudioState(int state) {
        mAvrcp.setA2dpAudioState(state);
    }

    public void resetAvrcpBlacklist(BluetoothDevice device) {
        if (mAvrcp != null) {
            mAvrcp.resetBlackList(device.getAddress());
        }
    }

    boolean isA2dpPlaying(BluetoothDevice device) {
@@ -1207,8 +1186,5 @@ public class A2dpService extends ProfileService {
        for (A2dpStateMachine sm : mStateMachines.values()) {
            sm.dump(sb);
        }
        if (mAvrcp != null) {
            mAvrcp.dump(sb);
        }
    }
}
+0 −4
Original line number Diff line number Diff line
@@ -130,7 +130,6 @@ final class A2dpStateMachine extends StateMachine {
            // Stop if auido is still playing
            log("doQuit: stopped playing " + mDevice);
            mIsPlaying = false;
            mA2dpService.setAvrcpAudioState(BluetoothA2dp.STATE_NOT_PLAYING);
            broadcastAudioState(BluetoothA2dp.STATE_NOT_PLAYING,
                                BluetoothA2dp.STATE_PLAYING);
        }
@@ -158,7 +157,6 @@ final class A2dpStateMachine extends StateMachine {
                if (mIsPlaying) {
                    Log.i(TAG, "Disconnected: stopped playing: " + mDevice);
                    mIsPlaying = false;
                    mA2dpService.setAvrcpAudioState(BluetoothA2dp.STATE_NOT_PLAYING);
                    broadcastAudioState(BluetoothA2dp.STATE_NOT_PLAYING,
                                        BluetoothA2dp.STATE_PLAYING);
                }
@@ -559,7 +557,6 @@ final class A2dpStateMachine extends StateMachine {
                        if (!mIsPlaying) {
                            Log.i(TAG, "Connected: started playing: " + mDevice);
                            mIsPlaying = true;
                            mA2dpService.setAvrcpAudioState(BluetoothA2dp.STATE_PLAYING);
                            broadcastAudioState(BluetoothA2dp.STATE_PLAYING,
                                                BluetoothA2dp.STATE_NOT_PLAYING);
                        }
@@ -571,7 +568,6 @@ final class A2dpStateMachine extends StateMachine {
                        if (mIsPlaying) {
                            Log.i(TAG, "Connected: stopped playing: " + mDevice);
                            mIsPlaying = false;
                            mA2dpService.setAvrcpAudioState(BluetoothA2dp.STATE_NOT_PLAYING);
                            broadcastAudioState(BluetoothA2dp.STATE_NOT_PLAYING,
                                                BluetoothA2dp.STATE_PLAYING);
                        }
Loading