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

Commit 285f6af3 authored by Jack He's avatar Jack He
Browse files

HFP: Remove dead code in native interface

The following hidden API methods are not implemented by the stack and
should be removed:
  - getBatteryUsageHint()
  - acceptIncomingConnect()
  - rejectIncomingConnect()

The following hidden API methods are no longer needed due to lack of
usage and should be removed:
  - enableWBS()
  - disableWBS()
  - bindResponse()

Bug: 70336991
Test: make
Change-Id: Ifa0d3cbdf4487465782144b84a2bed5e4f7acc4e
parent 21ce81a6
Loading
Loading
Loading
Loading
+9 −14
Original line number Diff line number Diff line
@@ -21,17 +21,17 @@ import android.bluetooth.BluetoothDevice;
/**
 * API for Bluetooth Headset service
 *
 * Note before adding anything new:
 *   Internal interactions within com.android.bluetooth should be handled through
 *   HeadsetService directly instead of going through binder
 *
 * {@hide}
 */
interface IBluetoothHeadset {
    // Public API
    boolean connect(in BluetoothDevice device);
    boolean disconnect(in BluetoothDevice device);
    List<BluetoothDevice> getConnectedDevices();
    List<BluetoothDevice> getDevicesMatchingConnectionStates(in int[] states);
    int getConnectionState(in BluetoothDevice device);
    boolean setPriority(in BluetoothDevice device, int priority);
    int getPriority(in BluetoothDevice device);
    boolean startVoiceRecognition(in BluetoothDevice device);
    boolean stopVoiceRecognition(in BluetoothDevice device);
    boolean isAudioConnected(in BluetoothDevice device);
@@ -39,14 +39,12 @@ interface IBluetoothHeadset {
                                         in String command,
                                         in String arg);

    // APIs that can be made public in future
    int getBatteryUsageHint(in BluetoothDevice device);

    // Internal functions, not be made public
    boolean acceptIncomingConnect(in BluetoothDevice device);
    boolean rejectIncomingConnect(in BluetoothDevice device);
    // Hidden API
    boolean connect(in BluetoothDevice device);
    boolean disconnect(in BluetoothDevice device);
    boolean setPriority(in BluetoothDevice device, int priority);
    int getPriority(in BluetoothDevice device);
    int getAudioState(in BluetoothDevice device);

    boolean isAudioOn();
    boolean connectAudio();
    boolean disconnectAudio();
@@ -58,7 +56,4 @@ interface IBluetoothHeadset {
    oneway void phoneStateChanged(int numActive, int numHeld, int callState, String number, int type);
    void clccResponse(int index, int direction, int status, int mode, boolean mpty,
                      String number, int type);
    boolean enableWBS();
    boolean disableWBS();
    void bindResponse(int ind_id, boolean ind_status);
}
+0 −62
Original line number Diff line number Diff line
@@ -1072,33 +1072,6 @@ static bt_status_t cind_response(int svc, int num_active, int num_held,
  return BT_STATUS_FAIL;
}

/*******************************************************************************
 *
 * Function         bind_response
 *
 * Description      Send +BIND response
 *
 * Returns          bt_status_t
 *
 ******************************************************************************/
static bt_status_t bind_response(bthf_hf_ind_type_t ind_id,
                                 bthf_hf_ind_status_t ind_status,
                                 RawAddress* bd_addr) {
  CHECK_BTHF_INIT();

  int index = btif_hf_idx_by_bdaddr(bd_addr);
  if (!is_connected(bd_addr) || index == BTIF_HF_INVALID_IDX)
    return BT_STATUS_FAIL;

  tBTA_AG_RES_DATA ag_res;
  memset(&ag_res, 0, sizeof(ag_res));
  ag_res.ind.id = ind_id;
  ag_res.ind.on_demand = (ind_status == BTHF_HF_IND_ENABLED);

  BTA_AgResult(btif_hf_cb[index].handle, BTA_AG_BIND_RES, &ag_res);
  return BT_STATUS_SUCCESS;
}

static bt_status_t set_sco_allowed(bool value) {
  CHECK_BTHF_INIT();

@@ -1535,39 +1508,6 @@ static void cleanup(void) {
  }
}

/*******************************************************************************
 *
 * Function         configure_wbs
 *
 * Description      set to over-ride the current WBS configuration.
 *                  It will not send codec setting cmd to the controller now.
 *                  It just change the configure.
 *
 * Returns          bt_status_t
 *
 ******************************************************************************/
static bt_status_t configure_wbs(RawAddress* bd_addr,
                                 bthf_wbs_config_t config) {
  CHECK_BTHF_INIT();

  int idx = btif_hf_idx_by_bdaddr(bd_addr);

  if ((idx < 0) || (idx >= BTIF_HF_NUM_CB)) {
    BTIF_TRACE_ERROR("%s: Invalid index %d", __func__, idx);
    return BT_STATUS_FAIL;
  }

  BTIF_TRACE_EVENT("%s config is %d", __func__, config);
  if (config == BTHF_WBS_YES)
    BTA_AgSetCodec(btif_hf_cb[idx].handle, BTA_AG_CODEC_MSBC);
  else if (config == BTHF_WBS_NO)
    BTA_AgSetCodec(btif_hf_cb[idx].handle, BTA_AG_CODEC_CVSD);
  else
    BTA_AgSetCodec(btif_hf_cb[idx].handle, BTA_AG_CODEC_NONE);

  return BT_STATUS_SUCCESS;
}

static const bthf_interface_t bthfInterface = {
    sizeof(bthfInterface),
    init,
@@ -1586,8 +1526,6 @@ static const bthf_interface_t bthfInterface = {
    clcc_response,
    phone_state_change,
    cleanup,
    configure_wbs,
    bind_response,
    set_sco_allowed,
};

+0 −8
Original line number Diff line number Diff line
@@ -317,14 +317,6 @@ typedef struct {
  /** Closes the interface. */
  void (*cleanup)(void);

  /** configuration for the SCO codec */
  bt_status_t (*configure_wbs)(RawAddress* bd_addr, bthf_wbs_config_t config);

  /** Response for HF Indicator change (+BIND) */
  bt_status_t (*bind_response)(bthf_hf_ind_type_t ind_id,
                               bthf_hf_ind_status_t ind_status,
                               RawAddress* bd_addr);

  /** Whether we will initiate SCO or not **/
  bt_status_t (*set_sco_allowed)(bool value);
} bthf_interface_t;