When i hold it upwards isFlat becomes false, but when i hold the phone upwards in landscape mode isFlat stays true. Why do i need to keep the phone flat? Doesn't that depend on the rotation of the earth?
I think there are ways to use the other sensors to more accurately estimate the phone's orientation even when it's not perfectly flat, but maybe this developer just didn't get around to it.