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

Commit b55472ed authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Only do the ble scan if association isNotifyOnDeviceNearby" into tm-dev...

Merge "Only do the ble scan if association isNotifyOnDeviceNearby" into tm-dev am: 6ad21dae am: b166f6f1

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17724033



Change-Id: I32ade8e57fbdbb8074abe93b7e5dd9b9a90a54b2
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents c6e44d6f b166f6f1
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -690,6 +690,9 @@ public class CompanionDeviceManagerService extends SystemService {
            association = AssociationInfo.builder(association)
            association = AssociationInfo.builder(association)
                    .setNotifyOnDeviceNearby(active)
                    .setNotifyOnDeviceNearby(active)
                    .build();
                    .build();
            // Do not need to call {@link BleCompanionDeviceScanner#restartScan()} since it will
            // trigger {@link BleCompanionDeviceScanner#restartScan(int, AssociationInfo)} when
            // an application sets/unsets the mNotifyOnDeviceNearby flag.
            mAssociationStore.updateAssociation(association);
            mAssociationStore.updateAssociation(association);


            // TODO(b/218615198): correctly handle the case when the device is currently present.
            // TODO(b/218615198): correctly handle the case when the device is currently present.
+2 −0
Original line number Original line Diff line number Diff line
@@ -194,6 +194,8 @@ class BleCompanionDeviceScanner implements AssociationStore.OnChangeListener {
        // Collect MAC addresses from all associations.
        // Collect MAC addresses from all associations.
        final Set<String> macAddresses = new HashSet<>();
        final Set<String> macAddresses = new HashSet<>();
        for (AssociationInfo association : mAssociationStore.getAssociations()) {
        for (AssociationInfo association : mAssociationStore.getAssociations()) {
            if (!association.isNotifyOnDeviceNearby()) continue;

            // Beware that BT stack does not consider low-case MAC addresses valid, while
            // Beware that BT stack does not consider low-case MAC addresses valid, while
            // MacAddress.toString() return a low-case String.
            // MacAddress.toString() return a low-case String.
            final String macAddress = association.getDeviceMacAddressAsString();
            final String macAddress = association.getDeviceMacAddressAsString();