You're currently checking checking for ro.crypto.state == encrypted but you should also check for ro.crypto.type == block. Cryptfs is pointless for File-Based Encryption (FBE).
ro.crypto.state == encrypted
ro.crypto.type == block
See also here and here.