I enabled and chose LDAC as bluetooth code from developer settings menu. But after disconnecting and reconnecting my phone, the codec switches back to aptX. The solution is to go to bluetooth settings and enable LDAC for paired headphones.