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

Commit 909c36b7 authored by Evan Chen's avatar Evan Chen Committed by Automerger Merge Worker
Browse files

Merge "Update connected devices sets when app is killed" into tm-dev am: 6f8c988b am: 7cec5a96

parents f6538443 7cec5a96
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -294,6 +294,15 @@ public class CompanionDeviceManagerService extends SystemService {


    private boolean onCompanionApplicationBindingDiedInternal(
    private boolean onCompanionApplicationBindingDiedInternal(
            @UserIdInt int userId, @NonNull String packageName) {
            @UserIdInt int userId, @NonNull String packageName) {
        // Update the current connected devices sets when binderDied, so that application is able
        // to call notifyDeviceAppeared after re-launch the application.
        for (AssociationInfo ai :
                mAssociationStore.getAssociationsForPackage(userId, packageName)) {
            int id = ai.getId();
            Slog.i(TAG, "Removing association id: " + id + " for package: "
                    + packageName + " due to binderDied.");
            mDevicePresenceMonitor.removeDeviceFromMonitoring(id);
        }
        // TODO(b/218613015): implement.
        // TODO(b/218613015): implement.
        return false;
        return false;
    }
    }
+10 −3
Original line number Original line Diff line number Diff line
@@ -205,6 +205,15 @@ public class CompanionDevicePresenceMonitor implements AssociationStore.OnChange
        mCallback.onDeviceDisappeared(goneDeviceAssociationId);
        mCallback.onDeviceDisappeared(goneDeviceAssociationId);
    }
    }


    /**
     * Remove the current connected devices by associationId.
     */
    public void removeDeviceFromMonitoring(int associationId) {
        mConnectedBtDevices.remove(associationId);
        mNearbyBleDevices.remove(associationId);
        mReportedSelfManagedDevices.remove(associationId);
    }

    /**
    /**
     * Implements
     * Implements
     * {@link AssociationStore.OnChangeListener#onAssociationRemoved(AssociationInfo)}
     * {@link AssociationStore.OnChangeListener#onAssociationRemoved(AssociationInfo)}
@@ -217,9 +226,7 @@ public class CompanionDevicePresenceMonitor implements AssociationStore.OnChange
            Log.d(TAG, "  > association=" + association);
            Log.d(TAG, "  > association=" + association);
        }
        }


        mConnectedBtDevices.remove(id);
        removeDeviceFromMonitoring(id);
        mNearbyBleDevices.remove(id);
        mReportedSelfManagedDevices.remove(id);


        // Do NOT call mCallback.onDeviceDisappeared()!
        // Do NOT call mCallback.onDeviceDisappeared()!
        // CompanionDeviceManagerService will know that the association is removed, and will do
        // CompanionDeviceManagerService will know that the association is removed, and will do