From 0b6f36047e23f5cb03ff0e212330ad2794f00248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rebelo?= Date: Sat, 14 Sep 2024 13:36:58 +0100 Subject: [PATCH] FwAppInstallerActivity: Ignore updates from unrelated devices --- .../gadgetbridge/activities/FwAppInstallerActivity.java | 4 ++-- .../freeyourgadget/gadgetbridge/impl/GBDevice.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/FwAppInstallerActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/FwAppInstallerActivity.java index 530c281f8..1d9a4ef72 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/FwAppInstallerActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/FwAppInstallerActivity.java @@ -85,8 +85,8 @@ public class FwAppInstallerActivity extends AbstractGBActivity implements Instal public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (GBDevice.ACTION_DEVICE_CHANGED.equals(action)) { - device = intent.getParcelableExtra(GBDevice.EXTRA_DEVICE); - if (device != null) { + final GBDevice changedDevice = intent.getParcelableExtra(GBDevice.EXTRA_DEVICE); + if (changedDevice != null && changedDevice.equals(device)) { refreshBusyState(device); if (!device.isInitialized()) { setInstallEnabled(false); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/impl/GBDevice.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/impl/GBDevice.java index 66d304ec3..06b803ddf 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/impl/GBDevice.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/impl/GBDevice.java @@ -491,13 +491,13 @@ public class GBDevice implements Parcelable { if (obj == this) { return true; } + if (obj == null) { + return false; + } if (!(obj instanceof GBDevice)) { return false; } - if (((GBDevice) obj).getAddress().equals(this.mAddress)) { - return true; - } - return false; + return ((GBDevice) obj).getAddress().equals(this.mAddress); } @Override