For an app to interact with the Android Bluetooth API, the app needs to declare permissions. Using the Bluetooth API, an app can read lots of ID-related information about the Bluetooth adapter and all of the remote devices it connects to.
https://developer.android.com/develop/connectivity/bluetooth
The overview in the "Key classes and interfaces" section outlines this:
BluetoothAdapter: Represents the local Bluetooth adapter (Bluetooth radio). The BluetoothAdapter is the entry-point for all Bluetooth interaction. Using this, you can discover other Bluetooth devices, query a list of bonded (paired) devices, instantiate a BluetoothDevice using a known MAC address, and create a BluetoothServerSocket to listen for communications from other devices.
BluetoothDevice: Represents a remote Bluetooth device. Use this to request a connection with a remote device through a BluetoothSocket or query information about the device such as its name, address, class, and bonding state.
Some relevant methods:
The documentation outlines what permissions are required for different API calls. It's important to note that Bluetooth has numerous privacy flaws that can result in passive eavesdroppers calculating and tracking identifiers of devices that are connected to each other or even an identifier of a device that is only scanning.