Merge changes from topic "exclusive-manager" into main
* changes: [Hide DCK devices] Hide DCK devices from settings app (other devices section). [Hide DCK devices] Hide DCK devices from settings app (saved devices page).
This commit is contained in:
@@ -24,6 +24,8 @@ import android.util.Log;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.connecteddevice.DevicePreferenceCallback;
|
||||
import com.android.settings.flags.Flags;
|
||||
import com.android.settingslib.bluetooth.BluetoothUtils;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
|
||||
/**
|
||||
@@ -95,6 +97,15 @@ public class ConnectedBluetoothDeviceUpdater extends BluetoothDeviceUpdater {
|
||||
cachedDevice.getName() + ", isFilterMatched : " + isFilterMatched);
|
||||
}
|
||||
}
|
||||
if (Flags.enableHideExclusivelyManagedBluetoothDevice()) {
|
||||
if (BluetoothUtils.isExclusivelyManagedBluetoothDevice(mContext,
|
||||
cachedDevice.getDevice())) {
|
||||
if (DBG) {
|
||||
Log.d(TAG, "isFilterMatched() hide BluetoothDevice with exclusive manager");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return isFilterMatched;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.connecteddevice.DevicePreferenceCallback;
|
||||
import com.android.settings.flags.Flags;
|
||||
import com.android.settingslib.bluetooth.BluetoothUtils;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDeviceManager;
|
||||
|
||||
@@ -99,12 +101,22 @@ public class SavedBluetoothDeviceUpdater extends BluetoothDeviceUpdater
|
||||
@Override
|
||||
public boolean isFilterMatched(CachedBluetoothDevice cachedDevice) {
|
||||
final BluetoothDevice device = cachedDevice.getDevice();
|
||||
Log.d(TAG, "isFilterMatched() device name : " + cachedDevice.getName() +
|
||||
", is connected : " + device.isConnected() + ", is profile connected : "
|
||||
+ cachedDevice.isConnected());
|
||||
return device.getBondState() == BluetoothDevice.BOND_BONDED
|
||||
&& (mShowConnectedDevice || (!device.isConnected() && isDeviceInCachedDevicesList(
|
||||
cachedDevice)));
|
||||
boolean isExclusivelyManaged = BluetoothUtils.isExclusivelyManagedBluetoothDevice(mContext,
|
||||
cachedDevice.getDevice());
|
||||
Log.d(TAG, "isFilterMatched() device name : " + cachedDevice.getName()
|
||||
+ ", is connected : " + device.isConnected() + ", is profile connected : "
|
||||
+ cachedDevice.isConnected() + ", is exclusively managed : "
|
||||
+ isExclusivelyManaged);
|
||||
if (Flags.enableHideExclusivelyManagedBluetoothDevice()) {
|
||||
return device.getBondState() == BluetoothDevice.BOND_BONDED
|
||||
&& (mShowConnectedDevice || (!device.isConnected()
|
||||
&& isDeviceInCachedDevicesList(cachedDevice)))
|
||||
&& !isExclusivelyManaged;
|
||||
} else {
|
||||
return device.getBondState() == BluetoothDevice.BOND_BONDED
|
||||
&& (mShowConnectedDevice || (!device.isConnected()
|
||||
&& isDeviceInCachedDevicesList(cachedDevice)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user