When your bearded dragon inflates it's stomach what is it doing?

It feels threatened so it will make itself look bigger by doing that and when they make their throat black, that is to make them seem scary.