summaryrefslogtreecommitdiff
path: root/framework/java
diff options
context:
space:
mode:
author Omair Kamil <okamil@google.com> 2025-01-24 07:59:56 -0800
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2025-01-24 07:59:56 -0800
commit5cb7fde7204e9ac9a9a58718f1c2e8cfa06e4957 (patch)
treebb50098eb3266d54aec505e2af79a2deeabf0b7e /framework/java
parentee72780618f2f29d48201e1c82b52dccc7670d2f (diff)
parent5f7c4834909295b57cfdb394a4ad7a2f555620db (diff)
Merge "BluetoothGatt: Fix duplicate GATT services being added" into main
Diffstat (limited to 'framework/java')
-rw-r--r--framework/java/android/bluetooth/BluetoothGatt.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/framework/java/android/bluetooth/BluetoothGatt.java b/framework/java/android/bluetooth/BluetoothGatt.java
index 5e633ad64d..a69c8ba792 100644
--- a/framework/java/android/bluetooth/BluetoothGatt.java
+++ b/framework/java/android/bluetooth/BluetoothGatt.java
@@ -444,6 +444,10 @@ public final class BluetoothGatt implements BluetoothProfile {
s.setDevice(mDevice);
}
+ if (Flags.fixBluetoothGattGettingDuplicateServices()) {
+ mServices.clear();
+ }
+
mServices.addAll(services);
// Fix references to included services, as they doesn't point to right objects.
@@ -1411,7 +1415,9 @@ public final class BluetoothGatt implements BluetoothProfile {
int clientIf = mClientIf;
if (mService == null || clientIf == 0) return false;
- mServices.clear();
+ if (!Flags.fixBluetoothGattGettingDuplicateServices()) {
+ mServices.clear();
+ }
try {
mService.discoverServices(clientIf, mDevice.getAddress(), mAttributionSource);
@@ -1439,7 +1445,9 @@ public final class BluetoothGatt implements BluetoothProfile {
int clientIf = mClientIf;
if (mService == null || clientIf == 0) return false;
- mServices.clear();
+ if (!Flags.fixBluetoothGattGettingDuplicateServices()) {
+ mServices.clear();
+ }
try {
mService.discoverServiceByUuid(