added device rotation detection