FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: crash at application launch on Android P by vchimev · Pull Request #5831 · NativeScript/NativeScript · GitHub

fix: crash at application launch on Android P - #5831

Merged
vchimev merged 4 commits into
masterfrom
vchimev/android-p
May 23, 2018
Merged

vchimev merged 4 commits into
masterfrom
vchimev/android-p

Conversation

vchimev commented May 18, 2018
edited
Loading

Copy link
Copy Markdown
Contributor

Reference: https://developer.android.com/preview/restrictions-non-sdk-interfaces

Android P introduces new restrictions on the use of non-SDK interfaces, whether directly, via reflection, or via JNI. These restrictions are applied whenever an app references a non-SDK interface or attempts to obtain its handle using reflection or JNI.

In particular, fallback default transition to fade transition.

What is the current behavior?

We use reflection to obtain a non-SDK interface and initialize default transition.

What is the new behavior?

Fallback default transition to fade transition.

Fixes #5798.

ghost assigned vchimev May 18, 2018
ghost added the in progress label May 18, 2018
vchimev added this to the 4.1 milestone May 21, 2018

Copy link
Copy Markdown
Contributor

test tests_app_transitions

NativeScript deleted a comment from SvetoslavTsenov May 21, 2018
transition = new NoTransition(0, null);
} else if (name === "default") {
transition = new DefaultTransition(0, null);
transition = new FadeTransition(0, null);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Does this create a meaningful fade transition? Duration 0 and nativeCurve = null seem to be adequate for NoTransition but for Fade?

dtopuzov May 21, 2018
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Are we sure Fade is default on all api levels and across all vendors.
If for example Sony have different default value and we force Fade app will not look natural on this device.

Can we at get old behavior for api < 27 and fallback to Fade only on Api27?
Can we also check if api27 expose some public apis to get default transition?

vchimev May 21, 2018
edited
Loading

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can we at get old behavior for api < 27 and fallback to Fade only on Api27?
Android P Beta SDK version returns 27, which is API level for Android 8.1.

Can we also check if api27 expose some public apis to get default transition?
I am afraid there is no public APIs. I have submitted a request in their issue tracker.

vchimev May 21, 2018
edited
Loading

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@manoldonev, the same question is valid for the default transition.
I have verified that it executes with duration -1.

Copy link
Copy Markdown
Contributor

test tests_app_transitions

vchimev force-pushed the vchimev/android-p branch 3 times, most recently from c5f65f8 to 7aca528 Compare May 22, 2018 10:48
}

initDefaultAnimations(manager);
// NOTE: Android P Beta SDK version returns 27, which is API level for Android 8.1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The next three lines are repeated multiple times. This can be moved to a method called isAndroidP or something like that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks.

if (sdkVersion() < 27) {
transition = new DefaultTransition(0, null);
} else {
transition = new FadeTransition(150, null);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

If 150 is some constant you can move it to a variable.

ghost assigned dtopuzov May 22, 2018

Copy link
Copy Markdown
Contributor

test tests_app_transitions

vchimev added 3 commits May 23, 2018 13:26
Reference: https://developer.android.com/preview/restrictions-non-sdk-interfaces

Android P introduces new restrictions on the use of non-SDK interfaces, whether directly, via reflection, or via JNI. These restrictions are applied whenever an app references a non-SDK interface or attempts to obtain its handle using reflection or JNI.

In particular, remove reflection via Class.getDeclaredField() and fallback default transition to fade transition.
Create default transition and setup default animations based on SDK version.
This is to avoid reflection via Class.getDeclaredMethod() for Android P where it throws.
vchimev force-pushed the vchimev/android-p branch from faf8eaa to e62ab97 Compare May 23, 2018 10:26
vchimev merged commit 7851629 into master May 23, 2018
ghost removed the in progress label May 23, 2018
vchimev deleted the vchimev/android-p branch May 23, 2018 11:59

lock Bot commented Aug 26, 2019

Copy link
Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock Bot locked and limited conversation to collaborators Aug 26, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't open the app on Android P

6 participants


Back | FazBrowse Home | New Git URL