From ec6a8b6743dcda64ac0b26c13ea5c30b3a8bf5a0 Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Sat, 28 Jan 2017 22:52:22 +0100 Subject: [PATCH] MI: some more logging --- .../gadgetbridge/activities/DiscoveryActivity.java | 2 ++ .../devices/miband/MiBandPairingActivity.java | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DiscoveryActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DiscoveryActivity.java index 8016041e2..e42f1bd85 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DiscoveryActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DiscoveryActivity.java @@ -293,6 +293,7 @@ public class DiscoveryActivity extends GBActivity implements AdapterView.OnItemC DeviceType deviceType = DeviceHelper.getInstance().getSupportedType(candidate); if (deviceType.isSupported()) { candidate.setDeviceType(deviceType); + LOG.info("Recognized supported device: " + candidate); int index = deviceCandidates.indexOf(candidate); if (index >= 0) { deviceCandidates.set(index, candidate); // replace @@ -506,6 +507,7 @@ public class DiscoveryActivity extends GBActivity implements AdapterView.OnItemC stopDiscovery(); DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(deviceCandidate); + LOG.info("Using device candidate " + deviceCandidate + " with coordinator: " + coordinator.getClass()); Class pairingActivity = coordinator.getPairingActivity(); if (pairingActivity != null) { Intent intent = new Intent(this, pairingActivity); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandPairingActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandPairingActivity.java index 9f825a7b2..1aae81608 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandPairingActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandPairingActivity.java @@ -33,7 +33,7 @@ public class MiBandPairingActivity extends GBActivity { private static final Logger LOG = LoggerFactory.getLogger(MiBandPairingActivity.class); private static final int REQ_CODE_USER_SETTINGS = 52; - private static final String STATE_MIBAND_ADDRESS = "mibandMacAddress"; + private static final String STATE_DEVICE_CANDIDATE = "stateDeviceCandidate"; private static final long DELAY_AFTER_BONDING = 1000; // 1s private TextView message; private boolean isPairing; @@ -103,7 +103,7 @@ public class MiBandPairingActivity extends GBActivity { Intent intent = getIntent(); deviceCandidate = intent.getParcelableExtra(DeviceCoordinator.EXTRA_DEVICE_CANDIDATE); if (deviceCandidate == null && savedInstanceState != null) { - deviceCandidate = savedInstanceState.getParcelable(STATE_MIBAND_ADDRESS); + deviceCandidate = savedInstanceState.getParcelable(STATE_DEVICE_CANDIDATE); } if (deviceCandidate == null) { Toast.makeText(this, getString(R.string.message_cannot_pair_no_mac), Toast.LENGTH_SHORT).show(); @@ -125,13 +125,13 @@ public class MiBandPairingActivity extends GBActivity { @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); - outState.putParcelable(STATE_MIBAND_ADDRESS, deviceCandidate); + outState.putParcelable(STATE_DEVICE_CANDIDATE, deviceCandidate); } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); - deviceCandidate = savedInstanceState.getParcelable(STATE_MIBAND_ADDRESS); + deviceCandidate = savedInstanceState.getParcelable(STATE_DEVICE_CANDIDATE); } @Override