I think I have a solution for the issue. I'm currently using Sony Xperia z1. I used a pattern lock on my phone, I was also facing the same problem with the greyed out stuff in security settings and also in clear credentials.
So, here is what I did. I went to settings>security>device...