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

Commit 0b5b213d authored by William Escande's avatar William Escande Committed by Gerrit Code Review
Browse files

Merge changes Ic6ca2e6d,I6193498b

* changes:
  Only broadcast inquiried devices with a name
  Only report connectable devices when inquiry
parents 294466d7 8f629fbe
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.os.Looper;
import android.os.Message;
import android.os.ParcelUuid;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.util.Log;

import com.android.bluetooth.BluetoothStatsLog;
@@ -860,6 +861,12 @@ final class RemoteDevices {
            errorLog("Device Properties is null for Device:" + device);
            return;
        }
        boolean restrict_device_found =
                SystemProperties.getBoolean("bluetooth.restrict_discovered_device.enabled", false);
        if (restrict_device_found && (deviceProp.mName == null || deviceProp.mName.isEmpty())) {
            debugLog("Device name is null or empty: " + device);
            return;
        }

        Intent intent = new Intent(BluetoothDevice.ACTION_FOUND);
        intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
+2 −0
Original line number Diff line number Diff line
@@ -1914,6 +1914,8 @@ static void bta_dm_inq_results_cb(tBTM_INQ_RESULTS* p_inq, const uint8_t* p_eir,
  result.inq_res.p_eir = const_cast<uint8_t*>(p_eir);
  result.inq_res.eir_len = eir_len;

  result.inq_res.ble_evt_type = p_inq->ble_evt_type;

  p_inq_info = BTM_InqDbRead(p_inq->remote_bd_addr);
  if (p_inq_info != NULL) {
    /* initialize remt_name_not_required to false so that we get the name by
+11 −0
Original line number Diff line number Diff line
@@ -1401,6 +1401,17 @@ static void btif_dm_search_devices_evt(tBTA_DM_SEARCH_EVT event,
        status = btif_storage_set_remote_addr_type(&bdaddr, addr_type);
        ASSERTC(status == BT_STATUS_SUCCESS,
                "failed to save remote addr type (inquiry)", status);

        bool restrict_report = osi_property_get_bool(
            "bluetooth.restrict_discovered_device.enabled", false);
        if (restrict_report &&
            p_search_data->inq_res.device_type == BT_DEVICE_TYPE_BLE &&
            !(p_search_data->inq_res.ble_evt_type & BTM_BLE_CONNECTABLE_MASK)) {
          LOG_INFO("%s: Ble device is not connectable",
                   ADDRESS_TO_LOGGABLE_CSTR(bdaddr));
          break;
        }

        /* Callback to notify upper layer of device */
        GetInterfaceToProfiles()->events->invoke_device_found_cb(num_properties,
                                                                 properties);