Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-26157] Android: Avoid Android 8.0 crash when applying fixed orientation to semi-transparent or modal window #10134

Merged
merged 2 commits into from
Jun 27, 2018

Conversation

jquick-axway
Copy link
Contributor

JIRA:
https://jira.appcelerator.org/browse/TIMOB-26157

Summary:

  • As of Android 8.0, Google no longer supports assigning a fixed orientation (ie: portrait-only or landscape-only) to a semi-transparent/translucent window. Will now catch Google's exception when attempting to do so and log it as an error.
  • Removed API Level 9 checks when assigning orientation. No longer relevant.
  • The variable activityOrientationMode used to be initialized to -1 which happened to exactly match the value assigned to Android constant SCREEN_ORIENTATION_UNSPECIFIED. Simplified code to use the constant.

Test:

  1. Build and run the below code on an Android 8.x device.
  2. Verify that a semi-transparent orange window is displayed over the splash screen. (It used to crash here.)
  3. Verify that you see the following message in the Android log, [ERROR]: TiWindowProxy: (main) [57,57] Only fullscreen activities can request orientation.
  4. Note that the window orientation is not portrait-only and allows you to rotate the app to landscape. This is because fixed-orientation translucent windows are no longer supported.
var window = Ti.UI.createWindow({
	opacity: 0.5,
//	modal: true,
	orientationModes: [Ti.UI.PORTRAIT],
	backgroundColor: "orange",
});
window.add(Ti.UI.createLabel({ text: "Translucent Window Test" }));
window.open();

…orientation to a semi-transparent or modal window.

- No longer supported by the Android OS. Now catches the exception and logs an error when attempting to do so.
- Removed API Level 9 checks when assigning orientation. (Min supported API Level is currently 16.)
@build
Copy link
Contributor

build commented Jun 27, 2018

Messages
📖

💾 Here's the generated SDK zipfile.

Generated by 🚫 dangerJS

Copy link
Contributor

@garymathews garymathews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: PASS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants