Project: titanium
Issue TIMOB-7259: Android: Gesture - orientation change fires on app start when initial orientation is landscape
h2. Problem If initial orientation of the emulator is landscape, two orientationchange events are fired when re-orienting to portrait. Thereafter, it works as expected. The same does not happen when initial orientation is portrait. h2. Test case * set emulator to landscape (CTRL+F11) * launch app with code below {code:lang=javascript|title=app.js} var win = Ti.UI.createWindow({ title: 'Rotate device to test', backgroundColor: 'white', orientationModes: [ Titanium.UI.PORTRAIT, Titanium.UI.UPSIDE_PORTRAIT, Titanium.UI.LANDSCAPE_LEFT, Titanium.UI.LANDSCAPE_RIGHT ], fullscreen: false, // same results regardless of whether its a heavyweight window exitOnClose: true }); Ti.Gesture.addEventListener('orientationchange',function(e){ Titanium.API.info("orientation changed = " + Ti.Gesture.orientation + ", is portrait? " + e.source.isPortrait() + ", is landscape? " + e.source.isLandscape()); }); win.open(); {code} h2. Logs {code:lang=none} 421 AndroidRuntime D >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<< 421 AndroidRuntime D CheckJNI is ON 422 TiApplication I (main) [0,0] checkpoint, app created. 421 AndroidRuntime D --- registering native functions --- 422 TiApplication I (main) [399,399] Titanium 2.0.0 (2012/03/01 14:01 0ccdf63) 422 TiFastDev D (main) [276,675] Enabling Fastdev on port 46158 422 TiFastDev D (main) [21,696] sent tokens successfully 422 TiFastDev D (main) [1,697] Fastdev session handshake succesful. 422 TiApplication I (main) [24,721] Titanium Javascript runtime: v8 422 TiRootActivity I (main) [0,0] checkpoint, on root activity create, savedInstanceState: Bundle[mParcelledData.dataSize=204] 61 ActivityManager I Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.appcelerator.testing10/.Testing10Activity } 421 AndroidRuntime D Shutting down VM 421 AndroidRuntime I NOTE: attach of thread 'Binder Thread #3' failed 422 TiApplication E (KrollRuntimeThread) [1126,1126] APP PROXY: ti.modules.titanium.app.AppModule@44fc8058 422 TiAssetHelper D Fetching "app.js" with Fastdev... 61 ActivityManager I Starting activity: Intent { cmp=com.appcelerator.testing10/org.appcelerator.titanium.TiActivity (has extras) } 422 TiRootActivity I (main) [0,0] checkpoint, on root activity resume. activity = com.appcelerator.testing10.Testing10Activity@44f60a88 422 TiUIView D (main) [440,440] Nativeview is null 422 TiUIView D (main) [44,484] Nativeview is null 61 InputManagerService W Got RemoteException sending setActive(false) notification to pid 401 uid 10040 61 NotificationService W Object died trying to hide notification android.app.ITransientNotification$Stub$Proxy@4509fef8 in package com.appcelerator.testing10 61 ActivityManager W setProcessForeground called on unknown pid: 401 61 ActivityManager I Displayed activity com.appcelerator.testing10/.Testing10Activity: 14070 ms (total 3531 ms) 61 ActivityManager I Displayed activity com.appcelerator.testing10/org.appcelerator.titanium.TiActivity: 701 ms (total 701 ms) 61 ActivityManager I Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=3/1 orien=2 layout=34 uiMode=17 seq=27} 422 TiAPI I orientation changed = 2, is portrait? false, is landscape? true 61 WindowManager I Setting rotation to 0, animFlags=0 61 ActivityManager I Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=3/1 orien=1 layout=34 uiMode=17 seq=28} 422 TiAPI I orientation changed = 1, is portrait? true, is landscape? false {code}
Story points: 1