1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.cts.verifier.bluetooth;
18 
19 import static android.bluetooth.le.AdvertisingSetCallback.ADVERTISE_SUCCESS;
20 
21 import static org.junit.Assert.assertEquals;
22 import static org.junit.Assert.assertNotNull;
23 import static org.junit.Assert.assertTrue;
24 
25 import android.bluetooth.BluetoothAdapter;
26 import android.bluetooth.BluetoothManager;
27 import android.bluetooth.le.AdvertiseData;
28 import android.bluetooth.le.AdvertisingSet;
29 import android.bluetooth.le.AdvertisingSetCallback;
30 import android.bluetooth.le.AdvertisingSetParameters;
31 import android.bluetooth.le.BluetoothLeAdvertiser;
32 import android.bluetooth.le.PeriodicAdvertisingParameters;
33 import android.os.Bundle;
34 import android.os.Handler;
35 import android.os.HandlerThread;
36 import android.util.Log;
37 import android.view.View;
38 import android.widget.Button;
39 import android.widget.ListView;
40 
41 import com.android.cts.verifier.PassFailButtons;
42 import com.android.cts.verifier.R;
43 
44 import java.util.ArrayList;
45 import java.util.List;
46 import java.util.concurrent.CountDownLatch;
47 import java.util.concurrent.TimeUnit;
48 import java.util.concurrent.atomic.AtomicInteger;
49 import java.util.concurrent.atomic.AtomicReference;
50 
51 /**
52  * Tests {@link AdvertisingSet} and {@link AdvertisingSetCallback}.
53  */
54 public class BleAdvertisingSetTestActivity extends PassFailButtons.Activity {
55 
56     private static final String TAG = "BleAdvertisingSetTestActivity";
57     private static final int TIMEOUT_MS = 5000;
58 
59     private static final int PASS_FLAG_START = 0x1;
60     private static final int PASS_FLAG_ENABLE_DISABLE = 0x2;
61     private static final int PASS_FLAG_SET_ADVERTISING_DATA = 0x4;
62     private static final int PASS_FLAG_SET_ADVERTISING_PARAMS = 0x8;
63     private static final int PASS_FLAG_SET_PERIODIC_ADVERTISING_DATA = 0x10;
64     private static final int PASS_FLAG_SET_PERIODIC_ADVERTISING_ENABLED_DISABLED = 0x20;
65     private static final int PASS_FLAG_SET_PERIODIC_ADVERTISING_PARAMS = 0x40;
66     private static final int PASS_FLAG_SET_SCAN_RESPONSE_DATA = 0x80;
67     private static final int PASS_FLAG_STOP = 0x100;
68     private static final int PASS_FLAG_ALL = 0x1FF;
69 
70     private static final int TEST_ADAPTER_INDEX_START = 0;
71     private static final int TEST_ADAPTER_INDEX_ENABLE_DISABLE = 1;
72     private static final int TEST_ADAPTER_INDEX_SET_ADVERTISING_DATA = 2;
73     private static final int TEST_ADAPTER_INDEX_SET_ADVERTISING_PARAMS = 3;
74     private static final int TEST_ADAPTER_INDEX_SET_PERIODIC_ADVERTISING_DATA = 4;
75     private static final int TEST_ADAPTER_INDEX_SET_PERIODIC_ADVERTISING_ENABLED_DISABLED = 5;
76     private static final int TEST_ADAPTER_INDEX_SET_PERIODIC_ADVERTISING_PARAMS = 6;
77     private static final int TEST_ADAPTER_INDEX_SET_SCAN_RESPONSE_DATA = 7;
78     private static final int TEST_ADAPTER_INDEX_STOP = 8;
79 
80     private static final AdvertisingSetParameters ADVERTISING_SET_PARAMETERS =
81             new AdvertisingSetParameters.Builder().setLegacyMode(true).build();
82 
83     private BluetoothManager mBluetoothManager;
84     private BluetoothAdapter mBluetoothAdapter;
85     private BluetoothLeAdvertiser mAdvertiser;
86     private TestAdvertisingSetCallback mCallback;
87 
88     private TestAdapter mTestAdapter;
89     private Button mStartTestButton;
90 
91     private long mAllTestsPassed;
92 
93     @Override
onCreate(Bundle savedInstanceState)94     protected void onCreate(Bundle savedInstanceState) {
95         super.onCreate(savedInstanceState);
96         setContentView(R.layout.ble_advertising_set);
97         setPassFailButtonClickListeners();
98         setInfoResources(R.string.ble_advertising_set_test_name,
99                 R.string.ble_advertising_set_test_info, -1);
100         getPassButton().setEnabled(false);
101 
102         mTestAdapter = new TestAdapter(this, setupTestList());
103         ListView listView = findViewById(R.id.ble_advertising_set_tests);
104         listView.setAdapter(mTestAdapter);
105 
106         mStartTestButton = findViewById(R.id.ble_advertising_set_start_test);
107         mStartTestButton.setOnClickListener(new View.OnClickListener() {
108             @Override
109             public void onClick(View v) {
110                 mStartTestButton.setEnabled(false);
111                 mStartTestButton.setText(R.string.ble_advertising_set_running_test);
112 
113                 HandlerThread testHandlerThread = new HandlerThread("TestHandlerThread");
114                 testHandlerThread.start();
115                 Handler handler = new Handler(testHandlerThread.getLooper());
116                 handler.post(new Runnable() {
117                     @Override
118                     public void run() {
119                         if (!mBluetoothAdapter.isEnabled()) {
120                             // If BluetoothAdapter was previously not enabled, we need to get the
121                             // BluetoothLeAdvertiser instance again.
122                             mBluetoothAdapter.enable();
123                             mAdvertiser = mBluetoothAdapter.getBluetoothLeAdvertiser();
124                         }
125 
126                         try {
127                             startAdvertisingSet();
128                             testEnableAndDisableAdvertising();
129                             testSetAdvertisingData();
130                             testSetAdvertisingParameters();
131                             testPeriodicAdvertising();
132                             testSetScanResponseData();
133                             stopAdvertisingSet();
134                         } catch (InterruptedException e) {
135                             Log.e(TAG, "Interrupted while running tests", e);
136                         } catch (AssertionError e) {
137                             Log.e(TAG, "Test failed", e);
138                         }
139 
140                         // Disable bluetooth adapter
141                         mBluetoothAdapter.disable();
142 
143                         BleAdvertisingSetTestActivity.this.runOnUiThread(new Runnable() {
144                             @Override
145                             public void run() {
146                                 mStartTestButton.setText(
147                                         R.string.ble_advertising_set_finished_test);
148 
149                                 // Update test list to reflect whether the tests passed or not.
150                                 mTestAdapter.notifyDataSetChanged();
151 
152                                 if (mAllTestsPassed == PASS_FLAG_ALL) {
153                                     getPassButton().setEnabled(true);
154                                 }
155                             }
156                         });
157                     }
158                 });
159             }
160         });
161 
162         mAllTestsPassed = 0;
163 
164         mBluetoothManager = getSystemService(BluetoothManager.class);
165         mBluetoothAdapter = mBluetoothManager.getAdapter();
166         mAdvertiser = mBluetoothAdapter.getBluetoothLeAdvertiser();
167         mCallback = new TestAdvertisingSetCallback();
168     }
169 
startAdvertisingSet()170     private void startAdvertisingSet() throws InterruptedException {
171         mAdvertiser.startAdvertisingSet(ADVERTISING_SET_PARAMETERS,
172                 /* advertiseData= */ null, /* scanResponse= */ null,
173                 /* periodicParameters= */ null, /* periodicData= */ null,
174                 mCallback);
175         assertTrue(mCallback.mAdvertisingSetStartedLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
176         assertEquals(ADVERTISE_SUCCESS, mCallback.mAdvertisingSetStartedStatus.get());
177         assertNotNull(mCallback.mAdvertisingSet);
178 
179         mAllTestsPassed |= PASS_FLAG_START;
180         mTestAdapter.setTestPass(TEST_ADAPTER_INDEX_START);
181     }
182 
testEnableAndDisableAdvertising()183     private void testEnableAndDisableAdvertising() throws InterruptedException {
184         mCallback.reset();
185 
186         mCallback.mAdvertisingSet.get().enableAdvertising(/* enable= */ true, /* duration= */ 0,
187                 /* maxExtendedAdvertisingEvents= */ 0);
188         assertTrue(mCallback.mAdvertisingEnabledLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
189         assertEquals(ADVERTISE_SUCCESS, mCallback.mAdvertisingEnabledStatus.get());
190 
191         mCallback.mAdvertisingSet.get().enableAdvertising(/* enable= */ false, /* duration= */ 0,
192                 /* maxExtendedAdvertisingEvents= */ 0);
193         assertTrue(mCallback.mAdvertisingDisabledLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
194         assertEquals(ADVERTISE_SUCCESS, mCallback.mAdvertisingDisabledStatus.get());
195 
196 
197         mAllTestsPassed |= PASS_FLAG_ENABLE_DISABLE;
198         mTestAdapter.setTestPass(TEST_ADAPTER_INDEX_ENABLE_DISABLE);
199     }
200 
testSetAdvertisingData()201     private void testSetAdvertisingData() throws InterruptedException {
202         mCallback.reset();
203 
204         mCallback.mAdvertisingSet.get().setAdvertisingData(new AdvertiseData.Builder().build());
205         assertTrue(mCallback.mAdvertisingDataSetLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
206         assertEquals(ADVERTISE_SUCCESS, mCallback.mAdvertisingDataSetStatus.get());
207 
208         mAllTestsPassed |= PASS_FLAG_SET_ADVERTISING_DATA;
209         mTestAdapter.setTestPass(TEST_ADAPTER_INDEX_SET_ADVERTISING_DATA);
210     }
211 
testSetScanResponseData()212     private void testSetScanResponseData() throws InterruptedException {
213         mCallback.reset();
214 
215         mCallback.mAdvertisingSet.get().setScanResponseData(new AdvertiseData.Builder().build());
216         assertTrue(mCallback.mScanResponseDataSetLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
217         assertEquals(ADVERTISE_SUCCESS, mCallback.mScanResponseDataSetStatus.get());
218 
219         mAllTestsPassed |= PASS_FLAG_SET_SCAN_RESPONSE_DATA;
220         mTestAdapter.setTestPass(TEST_ADAPTER_INDEX_SET_SCAN_RESPONSE_DATA);
221     }
222 
testSetAdvertisingParameters()223     private void testSetAdvertisingParameters() throws InterruptedException {
224         mCallback.reset();
225 
226         mCallback.mAdvertisingSet.get().enableAdvertising(false, /* duration= */ 0,
227                 /* maxExtendedAdvertisingEvents= */ 0);
228         assertTrue(mCallback.mAdvertisingDisabledLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
229         assertEquals(ADVERTISE_SUCCESS, mCallback.mAdvertisingDisabledStatus.get());
230 
231         mCallback.mAdvertisingSet.get().setAdvertisingParameters(
232                 new AdvertisingSetParameters.Builder()
233                         .setLegacyMode(true)
234                         .setScannable(false)
235                         .build());
236         assertTrue(mCallback.mAdvertisingParametersUpdatedLatch.await(TIMEOUT_MS,
237                 TimeUnit.MILLISECONDS));
238         assertEquals(ADVERTISE_SUCCESS, mCallback.mAdvertisingParametersUpdatedStatus.get());
239 
240         mAllTestsPassed |= PASS_FLAG_SET_ADVERTISING_PARAMS;
241         mTestAdapter.setTestPass(TEST_ADAPTER_INDEX_SET_ADVERTISING_PARAMS);
242     }
243 
244     // The following order of commands follows the diagram of Bluetooth Core Specification,
245     // Version 5.3, Vol 6, Part D, Figure 3.7: Periodic advertising.
testPeriodicAdvertising()246     private void testPeriodicAdvertising() throws InterruptedException {
247         if (!mBluetoothAdapter.isLePeriodicAdvertisingSupported()) {
248             mAllTestsPassed |= PASS_FLAG_SET_PERIODIC_ADVERTISING_PARAMS
249                     | PASS_FLAG_SET_PERIODIC_ADVERTISING_DATA
250                     | PASS_FLAG_SET_PERIODIC_ADVERTISING_ENABLED_DISABLED;
251             mTestAdapter.setTestPass(TEST_ADAPTER_INDEX_SET_PERIODIC_ADVERTISING_PARAMS);
252             mTestAdapter.setTestPass(TEST_ADAPTER_INDEX_SET_PERIODIC_ADVERTISING_DATA);
253             mTestAdapter.setTestPass(TEST_ADAPTER_INDEX_SET_PERIODIC_ADVERTISING_ENABLED_DISABLED);
254             return;
255         }
256 
257         mCallback.reset();
258 
259         mCallback.mAdvertisingSet.get().setAdvertisingParameters(
260                 new AdvertisingSetParameters.Builder().build());
261 
262         assertTrue(mCallback.mAdvertisingParametersUpdatedLatch.await(TIMEOUT_MS,
263                 TimeUnit.MILLISECONDS));
264         assertEquals(ADVERTISE_SUCCESS, mCallback.mAdvertisingParametersUpdatedStatus.get());
265 
266         mCallback.mAdvertisingSet.get().setPeriodicAdvertisingParameters(
267                 new PeriodicAdvertisingParameters.Builder().build());
268         assertTrue(mCallback.mPeriodicAdvertisingParamsUpdatedLatch.await(TIMEOUT_MS,
269                 TimeUnit.MILLISECONDS));
270         assertEquals(ADVERTISE_SUCCESS, mCallback.mPeriodicAdvertisingParamsUpdatedStatus.get());
271 
272         mAllTestsPassed |= PASS_FLAG_SET_PERIODIC_ADVERTISING_PARAMS;
273         mTestAdapter.setTestPass(TEST_ADAPTER_INDEX_SET_PERIODIC_ADVERTISING_PARAMS);
274 
275         // Enable advertising before periodicAdvertising
276         // If the advertising set is not currently enabled (see the
277         // HCI_LE_Set_Extended_Advertising_Enable command), the periodic
278         // advertising is not started until the advertising set is enabled.
279         mCallback.mAdvertisingSet.get().enableAdvertising(true, /* duration= */ 0,
280                 /* maxExtendedAdvertisingEvents= */ 0);
281 
282         mCallback.mAdvertisingSet.get().setPeriodicAdvertisingEnabled(true);
283         assertTrue(mCallback.mPeriodicAdvertisingEnabledLatch.await(TIMEOUT_MS,
284                 TimeUnit.MILLISECONDS));
285         assertEquals(ADVERTISE_SUCCESS, mCallback.mPeriodicAdvertisingEnabledStatus.get());
286 
287         mCallback.mAdvertisingSet.get().setPeriodicAdvertisingData(new AdvertiseData.Builder()
288                 .build());
289         assertTrue(mCallback.mPeriodicAdvertisingDataSetLatch.await(TIMEOUT_MS,
290                 TimeUnit.MILLISECONDS));
291         assertEquals(ADVERTISE_SUCCESS, mCallback.mPeriodicAdvertisingDataSetStatus.get());
292 
293         mAllTestsPassed |= PASS_FLAG_SET_PERIODIC_ADVERTISING_DATA;
294         mTestAdapter.setTestPass(TEST_ADAPTER_INDEX_SET_PERIODIC_ADVERTISING_DATA);
295 
296         mCallback.mAdvertisingSet.get().setPeriodicAdvertisingEnabled(false);
297         // Disable advertising after periodicAdvertising
298         mCallback.mAdvertisingSet.get().enableAdvertising(false, /* duration= */ 0,
299                 /* maxExtendedAdvertisingEvents= */ 0);
300         assertTrue(mCallback.mPeriodicAdvertisingDisabledLatch.await(TIMEOUT_MS,
301                 TimeUnit.MILLISECONDS));
302         assertEquals(ADVERTISE_SUCCESS, mCallback.mPeriodicAdvertisingDisabledStatus.get());
303 
304         mAllTestsPassed |= PASS_FLAG_SET_PERIODIC_ADVERTISING_ENABLED_DISABLED;
305 
306         mTestAdapter.setTestPass(TEST_ADAPTER_INDEX_SET_PERIODIC_ADVERTISING_ENABLED_DISABLED);
307     }
308 
stopAdvertisingSet()309     private void stopAdvertisingSet() throws InterruptedException {
310         mAdvertiser.stopAdvertisingSet(mCallback);
311         assertTrue(mCallback.mAdvertisingSetStoppedLatch.await(TIMEOUT_MS,
312                 TimeUnit.MILLISECONDS));
313 
314         mAllTestsPassed |= PASS_FLAG_STOP;
315         mTestAdapter.setTestPass(TEST_ADAPTER_INDEX_STOP);
316     }
317 
setupTestList()318     private List<Integer> setupTestList() {
319         List<Integer> testList = new ArrayList<>();
320         testList.add(R.string.ble_advertising_set_start);
321         testList.add(R.string.ble_advertising_set_enable_disable);
322         testList.add(R.string.ble_advertising_set_advertising_data);
323         testList.add(R.string.ble_advertising_set_advertising_params);
324         testList.add(R.string.ble_advertising_set_periodic_advertising_data);
325         testList.add(R.string.ble_advertising_set_periodic_advertising_enabled_disabled);
326         testList.add(R.string.ble_advertising_set_periodic_advertising_params);
327         testList.add(R.string.ble_advertising_set_scan_response_data);
328         testList.add(R.string.ble_advertising_set_stop);
329         return testList;
330     }
331 
332     private static class TestAdvertisingSetCallback extends AdvertisingSetCallback {
333         public CountDownLatch mAdvertisingSetStartedLatch = new CountDownLatch(1);
334         public CountDownLatch mAdvertisingEnabledLatch = new CountDownLatch(1);
335         public CountDownLatch mAdvertisingDisabledLatch = new CountDownLatch(1);
336         public CountDownLatch mAdvertisingParametersUpdatedLatch = new CountDownLatch(1);
337         public CountDownLatch mAdvertisingDataSetLatch = new CountDownLatch(1);
338         public CountDownLatch mScanResponseDataSetLatch = new CountDownLatch(1);
339         public CountDownLatch mAdvertisingSetStoppedLatch = new CountDownLatch(1);
340         public CountDownLatch mPeriodicAdvertisingEnabledLatch = new CountDownLatch(1);
341         public CountDownLatch mPeriodicAdvertisingDisabledLatch = new CountDownLatch(1);
342         public CountDownLatch mPeriodicAdvertisingParamsUpdatedLatch = new CountDownLatch(1);
343         public CountDownLatch mPeriodicAdvertisingDataSetLatch = new CountDownLatch(1);
344 
345         public AtomicInteger mAdvertisingSetStartedStatus = new AtomicInteger();
346         public AtomicInteger mAdvertisingEnabledStatus = new AtomicInteger();
347         public AtomicInteger mAdvertisingDisabledStatus = new AtomicInteger();
348         public AtomicInteger mAdvertisingParametersUpdatedStatus = new AtomicInteger();
349         public AtomicInteger mAdvertisingDataSetStatus = new AtomicInteger();
350         public AtomicInteger mScanResponseDataSetStatus = new AtomicInteger();
351         public AtomicInteger mPeriodicAdvertisingEnabledStatus = new AtomicInteger();
352         public AtomicInteger mPeriodicAdvertisingDisabledStatus = new AtomicInteger();
353         public AtomicInteger mPeriodicAdvertisingParamsUpdatedStatus = new AtomicInteger();
354         public AtomicInteger mPeriodicAdvertisingDataSetStatus = new AtomicInteger();
355 
356         public AtomicReference<AdvertisingSet> mAdvertisingSet = new AtomicReference();
357 
358         @Override
onAdvertisingSetStarted(AdvertisingSet advertisingSet, int txPower, int status)359         public void onAdvertisingSetStarted(AdvertisingSet advertisingSet, int txPower,
360                 int status) {
361             super.onAdvertisingSetStarted(advertisingSet, txPower, status);
362             mAdvertisingSetStartedStatus.set(status);
363             mAdvertisingSet.set(advertisingSet);
364             mAdvertisingSetStartedLatch.countDown();
365         }
366 
367         @Override
onAdvertisingEnabled(AdvertisingSet advertisingSet, boolean enable, int status)368         public void onAdvertisingEnabled(AdvertisingSet advertisingSet, boolean enable,
369                 int status) {
370             super.onAdvertisingEnabled(advertisingSet, enable, status);
371             if (enable) {
372                 mAdvertisingEnabledStatus.set(status);
373                 mAdvertisingEnabledLatch.countDown();
374             } else {
375                 mAdvertisingDisabledStatus.set(status);
376                 mAdvertisingDisabledLatch.countDown();
377             }
378         }
379 
380         @Override
onAdvertisingParametersUpdated(AdvertisingSet advertisingSet, int txPower, int status)381         public void onAdvertisingParametersUpdated(AdvertisingSet advertisingSet, int txPower,
382                 int status) {
383             super.onAdvertisingParametersUpdated(advertisingSet, txPower, status);
384             mAdvertisingParametersUpdatedStatus.set(status);
385             mAdvertisingParametersUpdatedLatch.countDown();
386         }
387 
388         @Override
onAdvertisingDataSet(AdvertisingSet advertisingSet, int status)389         public void onAdvertisingDataSet(AdvertisingSet advertisingSet, int status) {
390             super.onAdvertisingDataSet(advertisingSet, status);
391             mAdvertisingDataSetStatus.set(status);
392             mAdvertisingDataSetLatch.countDown();
393         }
394 
395         @Override
onPeriodicAdvertisingParametersUpdated(AdvertisingSet advertisingSet, int status)396         public void onPeriodicAdvertisingParametersUpdated(AdvertisingSet advertisingSet,
397                 int status) {
398             super.onPeriodicAdvertisingParametersUpdated(advertisingSet, status);
399             mPeriodicAdvertisingParamsUpdatedStatus.set(status);
400             mPeriodicAdvertisingParamsUpdatedLatch.countDown();
401         }
402 
403         @Override
onPeriodicAdvertisingDataSet(AdvertisingSet advertisingSet, int status)404         public void onPeriodicAdvertisingDataSet(AdvertisingSet advertisingSet, int status) {
405             super.onPeriodicAdvertisingDataSet(advertisingSet, status);
406             mPeriodicAdvertisingDataSetStatus.set(status);
407             mPeriodicAdvertisingDataSetLatch.countDown();
408         }
409 
410         @Override
onPeriodicAdvertisingEnabled(AdvertisingSet advertisingSet, boolean enable, int status)411         public void onPeriodicAdvertisingEnabled(AdvertisingSet advertisingSet, boolean enable,
412                 int status) {
413             super.onPeriodicAdvertisingEnabled(advertisingSet, enable, status);
414             if (enable) {
415                 mPeriodicAdvertisingEnabledStatus.set(status);
416                 mPeriodicAdvertisingEnabledLatch.countDown();
417             } else {
418                 mPeriodicAdvertisingDisabledStatus.set(status);
419                 mPeriodicAdvertisingDisabledLatch.countDown();
420             }
421         }
422 
423         @Override
onScanResponseDataSet(AdvertisingSet advertisingSet, int status)424         public void onScanResponseDataSet(AdvertisingSet advertisingSet, int status) {
425             super.onScanResponseDataSet(advertisingSet, status);
426             mScanResponseDataSetStatus.set(status);
427             mScanResponseDataSetLatch.countDown();
428         }
429 
430         @Override
onAdvertisingSetStopped(AdvertisingSet advertisingSet)431         public void onAdvertisingSetStopped(AdvertisingSet advertisingSet) {
432             super.onAdvertisingSetStopped(advertisingSet);
433             mAdvertisingSetStoppedLatch.countDown();
434         }
435 
reset()436         public void reset() {
437             mAdvertisingSetStartedLatch = new CountDownLatch(1);
438             mAdvertisingEnabledLatch = new CountDownLatch(1);
439             mAdvertisingParametersUpdatedLatch = new CountDownLatch(1);
440             mAdvertisingDataSetLatch = new CountDownLatch(1);
441             mPeriodicAdvertisingParamsUpdatedLatch = new CountDownLatch(1);
442             mPeriodicAdvertisingDataSetLatch = new CountDownLatch(1);
443             mPeriodicAdvertisingEnabledLatch = new CountDownLatch(1);
444             mPeriodicAdvertisingDisabledLatch = new CountDownLatch(1);
445             mScanResponseDataSetLatch = new CountDownLatch(1);
446 
447             mAdvertisingSetStartedStatus = new AtomicInteger();
448             mAdvertisingEnabledStatus = new AtomicInteger();
449             mAdvertisingDisabledStatus = new AtomicInteger();
450             mAdvertisingParametersUpdatedStatus = new AtomicInteger();
451             mAdvertisingDataSetStatus = new AtomicInteger();
452             mPeriodicAdvertisingParamsUpdatedStatus = new AtomicInteger();
453             mPeriodicAdvertisingDataSetStatus = new AtomicInteger();
454             mPeriodicAdvertisingEnabledStatus = new AtomicInteger();
455             mPeriodicAdvertisingDisabledStatus = new AtomicInteger();
456             mScanResponseDataSetStatus = new AtomicInteger();
457         }
458     }
459 }
460