[CDM Perm Sync] Fix a NPE for Perm Sync toggle

Bug: 290063372

Test: manual test on the breaking build.
Change-Id: I1f0a5c3840a4c97962fa9986d8f67ab0f652015f
This commit is contained in:
Guojing Yuan
2023-09-18 18:44:10 +00:00
parent d43d6f259a
commit 8c51d9c71d

View File

@@ -65,6 +65,7 @@ public class BluetoothDetailsDataSyncController extends BluetoothDetailsControll
mCompanionDeviceManager = context.getSystemService(CompanionDeviceManager.class); mCompanionDeviceManager = context.getSystemService(CompanionDeviceManager.class);
mCompanionDeviceManager.getAllAssociations().stream().filter( mCompanionDeviceManager.getAllAssociations().stream().filter(
a -> a.getDeviceMacAddress() != null).filter(
a -> Objects.equal(mCachedDevice.getAddress(), a -> Objects.equal(mCachedDevice.getAddress(),
a.getDeviceMacAddress().toString().toUpperCase())).max( a.getDeviceMacAddress().toString().toUpperCase())).max(
Comparator.comparingLong(AssociationInfo::getTimeApprovedMs)).ifPresent( Comparator.comparingLong(AssociationInfo::getTimeApprovedMs)).ifPresent(