Merge "Adds back hasFlag check for DeviceState toString method" into 24D1-dev