Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -200,7 +200,7 @@ public class BluetoothEventManager { cachedDevice.setRssi(rssi); cachedDevice.setRssi(rssi); cachedDevice.setBtClass(btClass); cachedDevice.setBtClass(btClass); cachedDevice.setNewName(name); cachedDevice.setNewName(name); cachedDevice.setVisible(true); cachedDevice.setJustDiscovered(true); } } } } Loading Loading @@ -352,7 +352,7 @@ public class BluetoothEventManager { if (device != null && device.getBondState() == BluetoothDevice.BOND_NONE) { if (device != null && device.getBondState() == BluetoothDevice.BOND_NONE) { CachedBluetoothDevice cachedDevice = mDeviceManager.findDevice(device); CachedBluetoothDevice cachedDevice = mDeviceManager.findDevice(device); if (cachedDevice != null) { if (cachedDevice != null) { cachedDevice.setVisible(false); cachedDevice.setJustDiscovered(false); } } } } } } Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +6 −11 Original line number Original line Diff line number Diff line Loading @@ -65,7 +65,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> // Device supports PANU but not NAP: remove PanProfile after device disconnects from NAP // Device supports PANU but not NAP: remove PanProfile after device disconnects from NAP private boolean mLocalNapRoleConnected; private boolean mLocalNapRoleConnected; private boolean mVisible; private boolean mJustDiscovered; private int mMessageRejectionCount; private int mMessageRejectionCount; Loading Loading @@ -360,7 +360,6 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> migrateMessagePermissionChoice(); migrateMessagePermissionChoice(); fetchMessageRejectionCount(); fetchMessageRejectionCount(); mVisible = false; dispatchAttributesChanged(); dispatchAttributesChanged(); } } Loading Loading @@ -431,13 +430,9 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> dispatchAttributesChanged(); dispatchAttributesChanged(); } } public boolean isVisible() { public void setJustDiscovered(boolean justDiscovered) { return mVisible; if (mJustDiscovered != justDiscovered) { } mJustDiscovered = justDiscovered; public void setVisible(boolean visible) { if (mVisible != visible) { mVisible = visible; dispatchAttributesChanged(); dispatchAttributesChanged(); } } } } Loading Loading @@ -661,8 +656,8 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> (getBondState() == BluetoothDevice.BOND_BONDED ? 1 : 0); (getBondState() == BluetoothDevice.BOND_BONDED ? 1 : 0); if (comparison != 0) return comparison; if (comparison != 0) return comparison; // Visible above not visible // Just discovered above discovered in the past comparison = (another.mVisible ? 1 : 0) - (mVisible ? 1 : 0); comparison = (another.mJustDiscovered ? 1 : 0) - (mJustDiscovered ? 1 : 0); if (comparison != 0) return comparison; if (comparison != 0) return comparison; // Stronger signal above weaker signal // Stronger signal above weaker signal Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceManager.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -47,7 +47,7 @@ public class CachedBluetoothDeviceManager { } } public static boolean onDeviceDisappeared(CachedBluetoothDevice cachedDevice) { public static boolean onDeviceDisappeared(CachedBluetoothDevice cachedDevice) { cachedDevice.setVisible(false); cachedDevice.setJustDiscovered(false); return cachedDevice.getBondState() == BluetoothDevice.BOND_NONE; return cachedDevice.getBondState() == BluetoothDevice.BOND_NONE; } } Loading Loading @@ -131,7 +131,7 @@ public class CachedBluetoothDeviceManager { // Iterate in reverse order since devices may be removed. // Iterate in reverse order since devices may be removed. for (int i = mCachedDevices.size() - 1; i >= 0; i--) { for (int i = mCachedDevices.size() - 1; i >= 0; i--) { CachedBluetoothDevice cachedDevice = mCachedDevices.get(i); CachedBluetoothDevice cachedDevice = mCachedDevices.get(i); cachedDevice.setVisible(false); cachedDevice.setJustDiscovered(false); } } } } Loading @@ -156,7 +156,7 @@ public class CachedBluetoothDeviceManager { for (int i = mCachedDevices.size() - 1; i >= 0; i--) { for (int i = mCachedDevices.size() - 1; i >= 0; i--) { CachedBluetoothDevice cachedDevice = mCachedDevices.get(i); CachedBluetoothDevice cachedDevice = mCachedDevices.get(i); if (cachedDevice.getBondState() != BluetoothDevice.BOND_BONDED) { if (cachedDevice.getBondState() != BluetoothDevice.BOND_BONDED) { cachedDevice.setVisible(false); cachedDevice.setJustDiscovered(false); mCachedDevices.remove(i); mCachedDevices.remove(i); } else { } else { // For bonded devices, we need to clear the connection status so that // For bonded devices, we need to clear the connection status so that Loading Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -200,7 +200,7 @@ public class BluetoothEventManager { cachedDevice.setRssi(rssi); cachedDevice.setRssi(rssi); cachedDevice.setBtClass(btClass); cachedDevice.setBtClass(btClass); cachedDevice.setNewName(name); cachedDevice.setNewName(name); cachedDevice.setVisible(true); cachedDevice.setJustDiscovered(true); } } } } Loading Loading @@ -352,7 +352,7 @@ public class BluetoothEventManager { if (device != null && device.getBondState() == BluetoothDevice.BOND_NONE) { if (device != null && device.getBondState() == BluetoothDevice.BOND_NONE) { CachedBluetoothDevice cachedDevice = mDeviceManager.findDevice(device); CachedBluetoothDevice cachedDevice = mDeviceManager.findDevice(device); if (cachedDevice != null) { if (cachedDevice != null) { cachedDevice.setVisible(false); cachedDevice.setJustDiscovered(false); } } } } } } Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +6 −11 Original line number Original line Diff line number Diff line Loading @@ -65,7 +65,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> // Device supports PANU but not NAP: remove PanProfile after device disconnects from NAP // Device supports PANU but not NAP: remove PanProfile after device disconnects from NAP private boolean mLocalNapRoleConnected; private boolean mLocalNapRoleConnected; private boolean mVisible; private boolean mJustDiscovered; private int mMessageRejectionCount; private int mMessageRejectionCount; Loading Loading @@ -360,7 +360,6 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> migrateMessagePermissionChoice(); migrateMessagePermissionChoice(); fetchMessageRejectionCount(); fetchMessageRejectionCount(); mVisible = false; dispatchAttributesChanged(); dispatchAttributesChanged(); } } Loading Loading @@ -431,13 +430,9 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> dispatchAttributesChanged(); dispatchAttributesChanged(); } } public boolean isVisible() { public void setJustDiscovered(boolean justDiscovered) { return mVisible; if (mJustDiscovered != justDiscovered) { } mJustDiscovered = justDiscovered; public void setVisible(boolean visible) { if (mVisible != visible) { mVisible = visible; dispatchAttributesChanged(); dispatchAttributesChanged(); } } } } Loading Loading @@ -661,8 +656,8 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> (getBondState() == BluetoothDevice.BOND_BONDED ? 1 : 0); (getBondState() == BluetoothDevice.BOND_BONDED ? 1 : 0); if (comparison != 0) return comparison; if (comparison != 0) return comparison; // Visible above not visible // Just discovered above discovered in the past comparison = (another.mVisible ? 1 : 0) - (mVisible ? 1 : 0); comparison = (another.mJustDiscovered ? 1 : 0) - (mJustDiscovered ? 1 : 0); if (comparison != 0) return comparison; if (comparison != 0) return comparison; // Stronger signal above weaker signal // Stronger signal above weaker signal Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceManager.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -47,7 +47,7 @@ public class CachedBluetoothDeviceManager { } } public static boolean onDeviceDisappeared(CachedBluetoothDevice cachedDevice) { public static boolean onDeviceDisappeared(CachedBluetoothDevice cachedDevice) { cachedDevice.setVisible(false); cachedDevice.setJustDiscovered(false); return cachedDevice.getBondState() == BluetoothDevice.BOND_NONE; return cachedDevice.getBondState() == BluetoothDevice.BOND_NONE; } } Loading Loading @@ -131,7 +131,7 @@ public class CachedBluetoothDeviceManager { // Iterate in reverse order since devices may be removed. // Iterate in reverse order since devices may be removed. for (int i = mCachedDevices.size() - 1; i >= 0; i--) { for (int i = mCachedDevices.size() - 1; i >= 0; i--) { CachedBluetoothDevice cachedDevice = mCachedDevices.get(i); CachedBluetoothDevice cachedDevice = mCachedDevices.get(i); cachedDevice.setVisible(false); cachedDevice.setJustDiscovered(false); } } } } Loading @@ -156,7 +156,7 @@ public class CachedBluetoothDeviceManager { for (int i = mCachedDevices.size() - 1; i >= 0; i--) { for (int i = mCachedDevices.size() - 1; i >= 0; i--) { CachedBluetoothDevice cachedDevice = mCachedDevices.get(i); CachedBluetoothDevice cachedDevice = mCachedDevices.get(i); if (cachedDevice.getBondState() != BluetoothDevice.BOND_BONDED) { if (cachedDevice.getBondState() != BluetoothDevice.BOND_BONDED) { cachedDevice.setVisible(false); cachedDevice.setJustDiscovered(false); mCachedDevices.remove(i); mCachedDevices.remove(i); } else { } else { // For bonded devices, we need to clear the connection status so that // For bonded devices, we need to clear the connection status so that Loading