You see an abruptly disconnection in Android with the error message "E/bt_btif_sock_rfcomm" and a half printed receipt. The printer has a limited internal memory buffer in which the printer data is temporarily stored. In this case, full = full. If the buffer is about to become full, the printer will send an XOFF command with the intention to directly stop receiving more incommoding data. If an OS is more efficient at processing the printer data, sending it faster, or Bluetooth than the printer can print, the printer's internal buffer becomes full.
When the buffer can receive data again, it sends an XON character. If your program does not stop sending printer data after an XOFF message, the printer will hang. Only what is in the buffer is still printed and the printer stops immediately (thats why you see a half receipt). If that is in the middle of a printer control command, my experience is that almost no printer survives this without a power off/on action (thats why you must hard reset the printer).
What I am missing in the program is checking whether the printer has an XOFF status message with the character Pause transmission code XOFF, ASCII codec DC3, 19 decimal or 13 Hexadecimal. The XON Resume transmission ASCII code is DC1, ASCII code 17 or 11 Hexadecimal. All this is missing from the program.
This so-called XON/XOFF printer handshake could of course be hidden in either the OS or the printer driver. Another possibility is that the XON/XOFF printer handshake is turned off in the printer setting because, for example, the printer setting is based on a serial or parallel interface hardware printer handshake.
My question is how the printer settings are. This can often be printed out by pressing the on/off line feed button or a reset button for some time when switching on the printer. See the user manual for the correct actions.