docs: public synchronized void connected(BluetoothSocket socket, BluetoothDevice
              device, final String socketType) {
          // Cancel the thread that completed the connection
          if (mConnectThread != null) {mConnectThread.cancel(); mConnectThread = null;}
  
          // Cancel any thread currently running a connection
          if (mConnectedThread != null) {mConnectedThread.cancel(); mConnectedThread = null;}
  
          // Cancel the accept thread because we only want to connect to one device
          if (mSecureAcceptThread != null) {
              mSecureAcceptThread.cancel();
              mSecureAcceptThread = null;
          }
  
          // Start the thread to manage the connection and perform transmissions
          mConnectedThread = new ConnectedThread(socket, socketType);
          mConnectedThread.start();
  
          // Send the name of the connected device back to the UI Activity
          Message msg = mHandler.obtainMessage(BluetoothState.MESSAGE_DEVICE_NAME);
          Bundle bundle = new Bundle();
          bundle.putString(BluetoothState.DEVICE_NAME, device.getName());
          bundle.putString(BluetoothState.DEVICE_ADDRESS, device.getAddress());
          msg.setData(bundle);
          mHandler.sendMessage(msg);
  
          setState(BluetoothState.STATE_CONNECTED);
      }