Project: titanium
Issue TIMOB-18789: iOS: Can not Get Correct Orientation Information when orientation is not portrait
h5.Description: Using window.getOrientation() can't get correct info if orientationModes is not portrait. h5.Reproduce Step: Simply run the test case in classic project. (force Orientation to Landscape_Right) {code:title=app.js} var self = Ti.UI.createWindow({ backgroundColor:'#ffffff', orientationModes : [Ti.UI.LANDSCAPE_RIGHT]	}); Ti.API.debug('Reference'); Ti.API.debug('Ti.UI.LANDSCAPE_RIGHT:' + Ti.UI.LANDSCAPE_RIGHT); Ti.API.debug('Ti.UI.LANDSCAPE_LEFT:' + Ti.UI.LANDSCAPE_LEFT); Ti.API.debug('Ti.UI.PORTRAIT:' + Ti.UI.PORTRAIT); Ti.API.debug('Ti.UI.UPSIDE_PORTRAIT:' + Ti.UI.UPSIDE_PORTRAIT); var label = Ti.UI.createLabel({	text: "Test Window for Orientation!",	Top: '30%', }); self.add(label); //construct UI self.addEventListener('open', function(e) { Ti.API.debug('When Opened, Window Orientation:' + self.getOrientation() + ", Gesture Orientaiton:" + Ti.Gesture.getOrientation()); }); self.addEventListener('focus', function(e) { Ti.API.debug('When Focussed, Window Orientation:' + self.getOrientation() + ", Gesture Orientaiton:" + Ti.Gesture.getOrientation()); }); Ti.Gesture.addEventListener('orientationchange', function(e) { Ti.API.debug('Window Orientation:' + self.getOrientation() + ", Gesture Orientaiton:" + Ti.Gesture.getOrientation()); }); self.open(); {code} h5.Expect Result: Should get the correct information about orientation. h5.Actual Result: Window opens in landscape mode as expected, but none of the event listeners configured as in the above code log the correct orientation {code:title=iOS log} [DEBUG] : Reference [DEBUG] : Ti.UI.LANDSCAPE_RIGHT:3 [DEBUG] : Ti.UI.LANDSCAPE_LEFT:4 [DEBUG] : Ti.UI.PORTRAIT:1 [DEBUG] : Ti.UI.UPSIDE_PORTRAIT:2 [DEBUG] : Loading: /Users/achyutjoshi/Library/Developer/CoreSimulator/Devices/DEE57654-B959-4BB6-942A-370CD35E6CDC/data/Containers/Bundle/Application/EEFFC1D4-C8D4-48F0-9783-C26BAC2992EE/orientation.app/_app_props_.json, Resource: _app_props__json [DEBUG] : Forcing rotation to 3. Current Orientation 1. This is not good UI design. Please reconsider. [DEBUG] : Application booted in 130.232036 ms [DEBUG] : When Opened, Window Orientation:1, Gesture Orientaiton:1 [DEBUG] : When Focussed, Window Orientation:1, Gesture Orientaiton:1 {code} h5.Note: If run the test code on Android device, the result will show the orientation change. like this: {code:title=Android Log} [DEBUG] : Reference [DEBUG] : Ti.UI.LANDSCAPE_RIGHT:4 [DEBUG] : Ti.UI.LANDSCAPE_LEFT:2 [DEBUG] : Ti.UI.PORTRAIT:1 [DEBUG] : Ti.UI.UPSIDE_PORTRAIT:3 [INFO] : TiRootActivity: (main) [0,0] checkpoint, on root activity resume. activity = com.orientation.OrientationActivity@421c5c30 [INFO] : I/Adreno-EGL: : EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LNX.LA.3.5.1_RB1.04.04.02.048.018_msm8226_LNX.LA.3.5.1_RB1__release_AU () [INFO] : I/Adreno-EGL: OpenGL ES Shader Compiler Version: E031.24.00.08 [INFO] : I/Adreno-EGL: Build Date: 03/07/14 Fri [INFO] : I/Adreno-EGL: Local Branch: [INFO] : I/Adreno-EGL: Remote Branch: quic/LNX.LA.3.5.1_RB1.1 [INFO] : I/Adreno-EGL: Local Patches: NONE [INFO] : I/Adreno-EGL: Reconstruct Branch: AU_LINUX_ANDROID_LNX.LA.3.5.1_RB1.04.04.02.048.018 + f2fd134 + NOTHING [DEBUG] : OpenGLRenderer: Enabling debug mode 0 [DEBUG] : Window: Checkpoint: postWindowCreated() [DEBUG] : When Opened, Window Orientation:1, Gesture Orientaiton:1 [DEBUG] : When Focussed, Window Orientation:1, Gesture Orientaiton:1 [DEBUG] : Window Orientation:2, Gesture Orientaiton:2 {code}
Story points: 5