2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-31 06:05:12 +00:00

Ignore exceptions in pairingSuccessful callbacks

Bubbling up the exception to the PairingHandler makes the device become
unpaired, and we only want this if the error happens persisting device info
This commit is contained in:
Albert Vaca Cintora
2023-07-02 23:01:05 +02:00
parent dd89463d75
commit 2ebaf6ae5b

View File

@@ -197,10 +197,15 @@ public class Device implements BaseLink.PacketReceiver {
SharedPreferences preferences = context.getSharedPreferences("trusted_devices", Context.MODE_PRIVATE);
preferences.edit().putBoolean(deviceInfo.id, true).apply();
reloadPluginsFromSettings();
try {
reloadPluginsFromSettings();
for (PairingHandler.PairingCallback cb : pairingCallbacks) {
cb.pairingSuccessful();
for (PairingHandler.PairingCallback cb : pairingCallbacks) {
cb.pairingSuccessful();
}
} catch (Exception e) {
Log.e("PairingHandler", "Exception in pairingSuccessful. Not unpairing because saving the trusted device succeeded");
e.printStackTrace();
}
}