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

Commit 65fd57e4 authored by Charlie Boutier's avatar Charlie Boutier
Browse files

Pandora: Remove warnings from deprecated functions

Test: atest pts-bot:A2DP/SRC and atest pts-bot:AVDTP/SRC

Change-Id: I9d3725ae0ff7e7e4e1ee4d85905221ea11931535
parent bc3995bc
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -191,9 +191,7 @@ class A2dp(val context: Context) : A2DPImplBase() {
      if (!bluetoothA2dp.isA2dpPlaying(device)) {
        flow
          .filter { it.getAction() == BluetoothA2dp.ACTION_PLAYING_STATE_CHANGED }
          .filter {
            it.getParcelableExtra<BluetoothDevice>(BluetoothDevice.EXTRA_DEVICE).address == address
          }
          .filter { it.getBluetoothDeviceExtra().address == address }
          .map { it.getIntExtra(BluetoothA2dp.EXTRA_STATE, BluetoothAdapter.ERROR) }
          .filter { it == BluetoothA2dp.STATE_PLAYING }
          .first()
@@ -221,9 +219,7 @@ class A2dp(val context: Context) : A2DPImplBase() {
      val a2dpPlayingStateFlow =
        flow
          .filter { it.getAction() == BluetoothA2dp.ACTION_PLAYING_STATE_CHANGED }
          .filter {
            it.getParcelableExtra<BluetoothDevice>(BluetoothDevice.EXTRA_DEVICE).address == address
          }
          .filter { it.getBluetoothDeviceExtra().address == address }
          .map { it.getIntExtra(BluetoothA2dp.EXTRA_STATE, BluetoothAdapter.ERROR) }

      audioTrack!!.pause()
@@ -265,9 +261,7 @@ class A2dp(val context: Context) : A2DPImplBase() {
      val a2dpConnectionStateChangedFlow =
        flow
          .filter { it.getAction() == BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED }
          .filter {
            it.getParcelableExtra<BluetoothDevice>(BluetoothDevice.EXTRA_DEVICE).address == address
          }
          .filter { it.getBluetoothDeviceExtra().address == address }
          .map { it.getIntExtra(BluetoothA2dp.EXTRA_STATE, BluetoothAdapter.ERROR) }

      bluetoothA2dp.disconnect(device)
+4 −12
Original line number Diff line number Diff line
@@ -136,14 +136,10 @@ class Host(private val context: Context, private val server: Server) : HostImplB
          val pairingRequestIntent =
            flow
              .filter { it.getAction() == BluetoothDevice.ACTION_PAIRING_REQUEST }
              .filter {
                it.getParcelableExtra<BluetoothDevice>(BluetoothDevice.EXTRA_DEVICE).address ==
                  address
              }
              .filter { it.getBluetoothDeviceExtra().address == address }
              .first()

          val bluetoothDevice =
            pairingRequestIntent.getParcelableExtra<BluetoothDevice>(BluetoothDevice.EXTRA_DEVICE)
          val bluetoothDevice = pairingRequestIntent.getBluetoothDeviceExtra()
          val pairingVariant =
            pairingRequestIntent.getIntExtra(
              BluetoothDevice.EXTRA_PAIRING_VARIANT,
@@ -163,9 +159,7 @@ class Host(private val context: Context, private val server: Server) : HostImplB
      // have been connected).
      flow
        .filter { it.getAction() == BluetoothDevice.ACTION_BOND_STATE_CHANGED }
        .filter {
          it.getParcelableExtra<BluetoothDevice>(BluetoothDevice.EXTRA_DEVICE).address == address
        }
        .filter { it.getBluetoothDeviceExtra().address == address }
        .map { it.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothAdapter.ERROR) }
        .filter { it == BluetoothDevice.BOND_BONDED }
        .first()
@@ -199,9 +193,7 @@ class Host(private val context: Context, private val server: Server) : HostImplB
      val connectionStateChangedFlow =
        flow
          .filter { it.getAction() == BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED }
          .filter {
            it.getParcelableExtra<BluetoothDevice>(BluetoothDevice.EXTRA_DEVICE).address == address
          }
          .filter { it.getBluetoothDeviceExtra().address == address }
          .map { it.getIntExtra(BluetoothAdapter.EXTRA_CONNECTION_STATE, BluetoothAdapter.ERROR) }

      bluetoothDevice.disconnect()
+4 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.pandora

import android.bluetooth.BluetoothDevice
import android.bluetooth.BluetoothManager
import android.bluetooth.BluetoothProfile
import android.content.BroadcastReceiver
@@ -133,3 +134,6 @@ fun <T> getProfileProxy(context: Context, profile: Int): T {
  }
  return proxy
}

fun Intent.getBluetoothDeviceExtra(): BluetoothDevice =
  this.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE, BluetoothDevice::class.java)