{ "id": "173737", "key": "TIMOB-27141", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2019-08-20T17:00:32.000+0000", "created": "2019-06-07T21:20:38.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [ "Android9", "Orientation", "engSchedule" ], "versions": [ { "id": "20432", "name": "Release 8.0.1", "archived": false, "released": true, "releaseDate": "2019-05-15" } ], "issuelinks": [], "assignee": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2019-08-20T17:00:32.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "Hi Team, \r\n\r\nWe are observing some abnormal behavior with “orientationModes” property of Ti.UI.Window. When we set orientationModes : [Titanium.UI.PORTRAIT] during window construction, the app is rotating to landscape, when “Auto-Rotate” is turned on in real time device. This is only happening with Android 9.0 and behaving properly on OS versions less than 9.0. The issue is reproducible using SDK 8.0.1.GA and lower release. \r\n\r\nPlease find the attached sample to reproduce the issue. \r\n\r\nSteps to reproduce : \r\n\r\n1. Turn on “Auto-Rotate” in Android device with OS 9 \r\n2. Run the app on the device. \r\n3. Now hold device in landscape mode and navigate to next screen by tapping on the label. \r\n4. *A new screen will initially load in landscape mode* then turns to Portrait mode. \r\n\r\n*Expected result :*\r\nNew screen opens is Portrait mode.\r\n\r\nThen Run on Android device with OS < 9(Works as expected). \r\n\r\nThanks in advance. ", "attachment": [ { "id": "66678", "filename": "SampleApp.zip", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2019-06-07T21:18:58.000+0000", "size": 8644443, "mimeType": "application/zip" } ], "flagged": false, "summary": "Android 9: App not honoring the Orientation set for Windows.", "creator": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "subtasks": [], "reporter": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "environment": "Android 9, Ti SDK 8.0.1.GA", "comment": { "comments": [ { "id": "448937", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, I was able to reproduce the issue using the attached sample code with SDK 8.0.1.GA in Android 9.0.1 device(Nokia 6). The issue isn't occurring in Android 6.0.1 device (Galaxy J2 Prime). Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2019-06-07T21:29:39.000+0000", "updated": "2019-06-07T21:29:39.000+0000" }, { "id": "449433", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Interesting. It doesn't appear that this issue can be solved in native code. It can only be solved via the \"AndroidManifest.xml\" file. It looks like the Android OS is setting up the transition animation based on the activity's XML \"screenOrientation\" which supports all orientations by default. Other native developers are running into the same issue here...\r\nhttps://stackoverflow.com/questions/42936007/activity-orientation-changes-automatically-on-android\r\n\r\nIf all of your app's windows are supposed to be portrait only, then you can solve this via the \"tiapp.xml\" and have all Titanium activity's be \"portrait as follows. Note the \"screenOrientation\" attribute. This is what you need to set.\r\n{code:xml}\r\n\r\n\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\nIf your app uses a mix of different orientations, then you may want to try setting the activity orientation to \"behind\" in XML, which tells the Android OS to use the parent activity's orientation for the child activity. This solves the issue in your app as well. Although I don't have much experience with that setting, so, I'm not sure if there are any unexpected repercussions with it.\r\n{code:xml}\r\n\r\n\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-06-28T00:14:02.000+0000", "updated": "2019-06-28T00:28:26.000+0000" }, { "id": "449552", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello [~jquick], I got a reply from the customer on your guide,\r\n\r\nAs suggested we have mentioned the android:screenOrientation=\"portrait\" attribute to each and every activity in the tiapp.xm. When we set the \"theme\" property for the window as theme: \"Theme.AppCompat.Translucent.NoTitleBar\" and set targetSdkVersion to 28 apps is getting crashed on Android OS 8.0.0 only. It is working as expected in rest of the Android OS versions. \r\n\r\nWe are using Ti 8.0.1.GA SDK. \r\n\r\nIt is printing below error log : \r\n\r\n[ERROR] : E/ViewRootImpl@e2250eb[ScreenrotationappandroidActivity]: Surface is not valid. \r\n[DEBUG] : AndroidRuntime: Shutting down VM \r\n[ERROR] : TiExceptionHandler: (main) [134,134] Unable to start activity ComponentInfo{com.rotation.api/org.appcelerator.titanium.TiActivity}: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation \r\n[ERROR] : TiExceptionHandler: \r\n[ERROR] : TiExceptionHandler: android.app.Activity.onCreate(Activity.java:1038) \r\n[ERROR] : TiExceptionHandler: android.support.v4.app.SupportActivity.onCreate(SupportActivity.java:66) \r\n[ERROR] : TiExceptionHandler: android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:321) \r\n[ERROR] : TiExceptionHandler: android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:84) \r\n[ERROR] : TiExceptionHandler: org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:699) \r\n[ERROR] : TiExceptionHandler: org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:47) \r\n[ERROR] : TiExceptionHandler: android.app.Activity.performCreate(Activity.java:7183) \r\n[ERROR] : TiExceptionHandler: android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220) \r\n[ERROR] : TiExceptionHandler: android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2908) \r\n[ERROR] : TiExceptionHandler: android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3030) \r\n[ERROR] : TiExceptionHandler: android.app.ActivityThread.-wrap11(Unknown Source:0) \r\n[ERROR] : TiExceptionHandler: android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696) \r\n[ERROR] : TiExceptionHandler: android.os.Handler.dispatchMessage(Handler.java:105) \r\n[ERROR] : TiExceptionHandler: android.os.Looper.loop(Looper.java:164) \r\n[ERROR] : TiExceptionHandler: android.app.ActivityThread.main(ActivityThread.java:6938) \r\n[ERROR] : TiExceptionHandler: java.lang.reflect.Method.invoke(Native Method) \r\n[ERROR] : TiExceptionHandler: com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) \r\n[ERROR] : TiExceptionHandler: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374) \r\n\r\nThanks in advance.\r\n", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2019-07-02T15:41:22.000+0000", "updated": "2019-07-02T15:41:22.000+0000" }, { "id": "449556", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-07-02T17:19:39.000+0000", "updated": "2019-07-02T17:19:39.000+0000" } ], "maxResults": 14, "total": 14, "startAt": 0 } } }