diff --git a/src/com/android/settings/accessibility/HearingDevicePairingFragment.java b/src/com/android/settings/accessibility/HearingDevicePairingFragment.java
index e9ea71a..0b762f3 100644
--- a/src/com/android/settings/accessibility/HearingDevicePairingFragment.java
+++ b/src/com/android/settings/accessibility/HearingDevicePairingFragment.java
@@ -192,7 +192,7 @@
     public void onDeviceBondStateChanged(@NonNull CachedBluetoothDevice cachedDevice,
             int bondState) {
         if (DEBUG) {
-            Log.d(TAG, "onDeviceBondStateChanged: " + cachedDevice.getName() + ", state = "
+            Log.d(TAG, "onDeviceBondStateChanged: " + cachedDevice.getDevice() + ", state = "
                     + bondState);
         }
         if (bondState == BluetoothDevice.BOND_BONDED) {
@@ -276,13 +276,13 @@
         }
         mDevicePreferenceMap.put(cachedDevice, preference);
         if (DEBUG) {
-            Log.d(TAG, "Add device. device: " + cachedDevice);
+            Log.d(TAG, "Add device. device: " + cachedDevice.getDevice());
         }
     }
 
     void removeDevice(CachedBluetoothDevice cachedDevice) {
         if (DEBUG) {
-            Log.d(TAG, "removeDevice: " + cachedDevice);
+            Log.d(TAG, "removeDevice: " + cachedDevice.getDevice());
         }
         BluetoothDevicePreference preference = mDevicePreferenceMap.remove(cachedDevice);
         if (mAvailableHearingDeviceGroup != null && preference != null) {
@@ -329,10 +329,15 @@
         CachedBluetoothDevice cachedDevice = mCachedDeviceManager.findDevice(device);
         if (cachedDevice == null) {
             cachedDevice = mCachedDeviceManager.addDevice(device);
+        } else if (cachedDevice.getBondState() == BluetoothDevice.BOND_BONDED) {
+            if (DEBUG) {
+                Log.d(TAG, "Skip this device, already bonded: " + cachedDevice.getDevice());
+            }
+            return;
         }
         if (cachedDevice.getHearingAidInfo() == null) {
             if (DEBUG) {
-                Log.d(TAG, "Set hearing aid info on device: " + cachedDevice);
+                Log.d(TAG, "Set hearing aid info on device: " + cachedDevice.getDevice());
             }
             cachedDevice.setHearingAidInfo(new HearingAidInfo.Builder().build());
         }
@@ -450,7 +455,7 @@
 
     void discoverServices(CachedBluetoothDevice cachedDevice) {
         if (DEBUG) {
-            Log.d(TAG, "connectGattToCheckCompatibility, device: " + cachedDevice);
+            Log.d(TAG, "connectGattToCheckCompatibility, device: " + cachedDevice.getDevice());
         }
         BluetoothGatt gatt = cachedDevice.getDevice().connectGatt(getContext(), false,
                 new BluetoothGattCallback() {
@@ -460,7 +465,7 @@
                         super.onConnectionStateChange(gatt, status, newState);
                         if (DEBUG) {
                             Log.d(TAG, "onConnectionStateChange, status: " + status + ", newState: "
-                                    + newState + ", device: " + cachedDevice);
+                                    + newState + ", device: " + cachedDevice.getDevice());
                         }
                         if (status == GATT_SUCCESS
                                 && newState == BluetoothProfile.STATE_CONNECTED) {
@@ -476,13 +481,14 @@
                         super.onServicesDiscovered(gatt, status);
                         if (DEBUG) {
                             Log.d(TAG, "onServicesDiscovered, status: " + status + ", device: "
-                                    + cachedDevice);
+                                    + cachedDevice.getDevice());
                         }
                         if (status == GATT_SUCCESS) {
                             if (gatt.getService(BluetoothUuid.HEARING_AID.getUuid()) != null
                                     || gatt.getService(BluetoothUuid.HAS.getUuid()) != null) {
                                 if (DEBUG) {
-                                    Log.d(TAG, "compatible with Android, device: " + cachedDevice);
+                                    Log.d(TAG, "compatible with Android, device: "
+                                            + cachedDevice.getDevice());
                                 }
                                 addDevice(cachedDevice);
                             }
