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

Commit c375f721 authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Andre Eisenbach
Browse files

Fix (again) bad scan record data length

Bug: 36530831
Test: sl4a Bt5ScanTest:test_legacy_scan_result_raw_length
Change-Id: Ie7b04c40947f6419a665a8f6c1244effa63d8a7e
parent 3be0eb23
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -688,8 +688,14 @@ public class GattService extends ProfileService {
            ScanSettings settings = client.settings;
            byte[] scan_record_data;
            // This is for compability with applications that assume fixed size scan data.
            if (settings.getLegacy() && ((event_type & ET_LEGACY_MASK) == 0)) {
            if (settings.getLegacy()) {
                if ((event_type & ET_LEGACY_MASK) == 0) {
                    // If this is legacy scan, but nonlegacy result - skip.
                    continue;
                } else {
                    // Some apps are used to fixed-size advertise data.
                    scan_record_data = legacy_adv_data;
                }
            } else {
                scan_record_data = adv_data;
            }
@@ -708,11 +714,6 @@ public class GattService extends ProfileService {
                continue;
            }

            // if this is legacy scan, return only legacy scan results
            if (settings.getLegacy() && ((event_type & ET_LEGACY_MASK) == 0)) {
                continue;
            }

            try {
                app.appScanStats.addResult();
                app.callback.onScanResult(result);