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

Commit f8a7ac8f authored by Lawrance Liu's avatar Lawrance Liu Committed by Jakub Pawlowski
Browse files

Improve HOGP input report error handling

This fixes com.android.bluetooth crash when receiving HOGP input report
for unknown characteristic.

Test: Pair/Unpair BLE mouse/keyboard devices.
(cherry picked from commit 7307dc2f)
Bug: 33257618
Change-Id: I4bb3fb02cffdcc5b1273f8ace281826eccce6639
parent 2b9be1e3
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -2155,12 +2155,19 @@ void bta_hh_le_input_rpt_notify(tBTA_GATTC_NOTIFY *p_data)

    if (p_dev_cb == NULL)
    {
        APPL_TRACE_ERROR("notification received from Unknown device");
        APPL_TRACE_ERROR("%s: notification received from Unknown device, conn_id: 0x%04x",
            __func__, p_data->conn_id);
        return;
    }

    const tBTA_GATTC_CHARACTERISTIC *p_char = BTA_GATTC_GetCharacteristic(p_dev_cb->conn_id,
                                                                          p_data->handle);
    if (p_char == NULL)
    {
        APPL_TRACE_ERROR("%s: notification received for Unknown Characteristic, conn_id: 0x%04x, handle: 0x%04x",
            __func__, p_dev_cb->conn_id, p_data->handle);
        return;
    }

    app_id= p_dev_cb->app_id;

@@ -2170,7 +2177,8 @@ void bta_hh_le_input_rpt_notify(tBTA_GATTC_NOTIFY *p_data)
                                        p_char->handle);
    if (p_rpt == NULL)
    {
        APPL_TRACE_ERROR("notification received for Unknown Report");
        APPL_TRACE_ERROR("%s: notification received for Unknown Report, uuid: 0x%04x, handle: 0x%04x",
            __func__, p_char->uuid.uu.uuid16, p_char->handle);
        return;
    }