diff options
Diffstat (limited to 'framework/java')
| -rw-r--r-- | framework/java/android/bluetooth/BluetoothGatt.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/framework/java/android/bluetooth/BluetoothGatt.java b/framework/java/android/bluetooth/BluetoothGatt.java index a69c8ba792..7e211b5d5b 100644 --- a/framework/java/android/bluetooth/BluetoothGatt.java +++ b/framework/java/android/bluetooth/BluetoothGatt.java @@ -44,6 +44,7 @@ import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.List; import java.util.UUID; +import java.util.concurrent.CopyOnWriteArrayList; /** * Public API for the Bluetooth GATT Profile. @@ -97,7 +98,7 @@ public final class BluetoothGatt implements BluetoothProfile { // Max length of an attribute value, defined in gatt_api.h private static final int GATT_MAX_ATTR_LEN = 512; - private List<BluetoothGattService> mServices; + private CopyOnWriteArrayList<BluetoothGattService> mServices; /** A GATT operation completed successfully */ public static final int GATT_SUCCESS = 0; @@ -1022,7 +1023,7 @@ public final class BluetoothGatt implements BluetoothProfile { mPhy = phy; mOpportunistic = opportunistic; mAttributionSource = attributionSource; - mServices = new ArrayList<BluetoothGattService>(); + mServices = new CopyOnWriteArrayList<>(); mConnState = CONN_STATE_IDLE; mAuthRetryState = AUTH_RETRY_STATE_IDLE; |