fix removal of unpaired device

Two uses of remove() were passing different info. So pass the other one
from the other use.
This commit is contained in:
Eric House 2020-10-29 08:39:50 -07:00
parent 1019271c94
commit a5b98c483c

View file

@ -351,8 +351,6 @@ public class BTInviteDelegate extends InviteDelegate
private static void removeNotPaired( Persisted prs ) private static void removeNotPaired( Persisted prs )
{ {
Log.d( TAG, "removeNotPaired()" ); Log.d( TAG, "removeNotPaired()" );
BluetoothAdapter adapter = BTUtils.getAdapterIf();
if ( null != adapter ) {
Set<BluetoothDevice> pairedDevs = BTUtils.getCandidates(); Set<BluetoothDevice> pairedDevs = BTUtils.getCandidates();
Set<String> paired = new HashSet<>(); Set<String> paired = new HashSet<>();
for ( BluetoothDevice dev : pairedDevs ) { for ( BluetoothDevice dev : pairedDevs ) {
@ -365,7 +363,7 @@ public class BTInviteDelegate extends InviteDelegate
String name = pair.str2; String name = pair.str2;
if ( ! paired.contains( name ) ) { if ( ! paired.contains( name ) ) {
Log.d( TAG, "%s no longer paired; removing", name ); Log.d( TAG, "%s no longer paired; removing", name );
toRemove.add( name ); toRemove.add( pair.getDev() );
} else { } else {
Log.d( TAG, "%s STILL paired", name ); Log.d( TAG, "%s STILL paired", name );
} }
@ -374,9 +372,6 @@ public class BTInviteDelegate extends InviteDelegate
if ( ! toRemove.isEmpty() ) { if ( ! toRemove.isEmpty() ) {
prs.remove( toRemove ); prs.remove( toRemove );
} }
} else {
Log.e( TAG, "removeNotPaired(): adapter null" );
}
} }
private void updateListIn( final long inSecs ) private void updateListIn( final long inSecs )