CachedBluetoothDevice: Rename mVisible to mJustDiscovered
* CachedBluetoothDevice's member mVisible does not mean whether the
device is visible. Instead, based on its current usage in the library,
it indicates whether the device was just discovered by SettingsLib.
* Rename the field to mJustDiscovered and associated setters and
getters.
* This paves way for future addition of mVisible to indicate whether the
device should be visible to user in the UI.
Bug: 34685932
Test: build only, no functional changes
Change-Id: I616904e6d5bb27dbae74f94819eb0e8607a16e20
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
index 4bb4b40..734f70d 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
@@ -65,7 +65,7 @@
// Device supports PANU but not NAP: remove PanProfile after device disconnects from NAP
private boolean mLocalNapRoleConnected;
- private boolean mVisible;
+ private boolean mJustDiscovered;
private int mMessageRejectionCount;
@@ -360,7 +360,6 @@
migrateMessagePermissionChoice();
fetchMessageRejectionCount();
- mVisible = false;
dispatchAttributesChanged();
}
@@ -431,13 +430,9 @@
dispatchAttributesChanged();
}
- public boolean isVisible() {
- return mVisible;
- }
-
- public void setVisible(boolean visible) {
- if (mVisible != visible) {
- mVisible = visible;
+ public void setJustDiscovered(boolean justDiscovered) {
+ if (mJustDiscovered != justDiscovered) {
+ mJustDiscovered = justDiscovered;
dispatchAttributesChanged();
}
}
@@ -661,8 +656,8 @@
(getBondState() == BluetoothDevice.BOND_BONDED ? 1 : 0);
if (comparison != 0) return comparison;
- // Visible above not visible
- comparison = (another.mVisible ? 1 : 0) - (mVisible ? 1 : 0);
+ // Just discovered above discovered in the past
+ comparison = (another.mJustDiscovered ? 1 : 0) - (mJustDiscovered ? 1 : 0);
if (comparison != 0) return comparison;
// Stronger signal above weaker signal