-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Android Oreo (8.0) Support #15601
Android Oreo (8.0) Support #15601
Conversation
Without the changes in this PR you will see the following crash:
|
@facebook-github-bot label Core Team Generated by 🚫 dangerJS |
class WindowOverlayCompat { | ||
|
||
private static final int ANDROID_OREO = 26; | ||
private static final int TYPE_APPLICATION_OVERLAY = 2038; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot use the Android constants because react native doesn't compile to v26 yet, it currently uses v23.
* Compatibility wrapper for apps targeting API level 26 or later. | ||
* See https://developer.android.com/about/versions/o/android-8.0-changes.html#cwt | ||
*/ | ||
class WindowOverlayCompat { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it could be useful to make this public, if you prefer not to let's just add a /* package */ comment like here for example https://github.com/AndrewJack/react-native/blob/f1cf378cf4ef3e5473fe2ace6d564be897e56a0e/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxDialog.java#L51
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it needs to be public. It's only needed in the devsupport
package and I wouldn't like to encourage app developers to use this either.
I'll add /* package */
@shergin Looks good to me if you want to ship. |
Any update on this? Definitely seeing this crash and the patch looks good. The CI failure seems to be unrelated to this code unless I am missing something |
@shergin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Thanks @AndrewJack for the PR and @shergin for shipping 🎉 |
Summary: Apps targeting Android 8.0 (API level 26) cannot use `TYPE_SYSTEM_OVERLAY ` and `TYPE_SYSTEM_OVERLAY `. Targeting 26 will cause the app to crash when in `DEV_MODE`. https://developer.android.com/about/versions/oreo/android-8.0-changes.html#cwt This PR replaces uses of these overlay flags with the new `TYPE_APPLICATION_OVERLAY` when running on a device with Android 8.0 or later. When using `TYPE_APPLICATION_OVERLAY` it still requires the `SYSTEM_ALERT_WINDOW` permission, just like previous android versions. https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#TYPE_APPLICATION_OVERLAY https://github.com/AndrewJack/react-native-android-oreo tested here Closes facebook#15601 Reviewed By: achen1 Differential Revision: D5801619 Pulled By: shergin fbshipit-source-id: 27d1b9bb64018e7f12f9c3d3d222f1fda468b124
Summary: Apps targeting Android 8.0 (API level 26) cannot use `TYPE_SYSTEM_OVERLAY ` and `TYPE_SYSTEM_OVERLAY `. Targeting 26 will cause the app to crash when in `DEV_MODE`. https://developer.android.com/about/versions/oreo/android-8.0-changes.html#cwt This PR replaces uses of these overlay flags with the new `TYPE_APPLICATION_OVERLAY` when running on a device with Android 8.0 or later. When using `TYPE_APPLICATION_OVERLAY` it still requires the `SYSTEM_ALERT_WINDOW` permission, just like previous android versions. https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#TYPE_APPLICATION_OVERLAY https://github.com/AndrewJack/react-native-android-oreo tested here Closes #15601 Reviewed By: achen1 Differential Revision: D5801619 Pulled By: shergin fbshipit-source-id: 27d1b9bb64018e7f12f9c3d3d222f1fda468b124
Summary: Apps targeting Android 8.0 (API level 26) cannot use `TYPE_SYSTEM_OVERLAY ` and `TYPE_SYSTEM_OVERLAY `. Targeting 26 will cause the app to crash when in `DEV_MODE`. https://developer.android.com/about/versions/oreo/android-8.0-changes.html#cwt This PR replaces uses of these overlay flags with the new `TYPE_APPLICATION_OVERLAY` when running on a device with Android 8.0 or later. When using `TYPE_APPLICATION_OVERLAY` it still requires the `SYSTEM_ALERT_WINDOW` permission, just like previous android versions. https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#TYPE_APPLICATION_OVERLAY https://github.com/AndrewJack/react-native-android-oreo tested here Closes facebook#15601 Reviewed By: achen1 Differential Revision: D5801619 Pulled By: shergin fbshipit-source-id: 27d1b9bb64018e7f12f9c3d3d222f1fda468b124
Summary: Apps targeting Android 8.0 (API level 26) cannot use `TYPE_SYSTEM_OVERLAY ` and `TYPE_SYSTEM_OVERLAY `. Targeting 26 will cause the app to crash when in `DEV_MODE`. https://developer.android.com/about/versions/oreo/android-8.0-changes.html#cwt This PR replaces uses of these overlay flags with the new `TYPE_APPLICATION_OVERLAY` when running on a device with Android 8.0 or later. When using `TYPE_APPLICATION_OVERLAY` it still requires the `SYSTEM_ALERT_WINDOW` permission, just like previous android versions. https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#TYPE_APPLICATION_OVERLAY https://github.com/AndrewJack/react-native-android-oreo tested here Closes facebook#15601 Reviewed By: achen1 Differential Revision: D5801619 Pulled By: shergin fbshipit-source-id: 27d1b9bb64018e7f12f9c3d3d222f1fda468b124
Summary: Apps targeting Android 8.0 (API level 26) cannot use `TYPE_SYSTEM_OVERLAY ` and `TYPE_SYSTEM_OVERLAY `. Targeting 26 will cause the app to crash when in `DEV_MODE`. https://developer.android.com/about/versions/oreo/android-8.0-changes.html#cwt This PR replaces uses of these overlay flags with the new `TYPE_APPLICATION_OVERLAY` when running on a device with Android 8.0 or later. When using `TYPE_APPLICATION_OVERLAY` it still requires the `SYSTEM_ALERT_WINDOW` permission, just like previous android versions. https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#TYPE_APPLICATION_OVERLAY https://github.com/AndrewJack/react-native-android-oreo tested here Closes facebook#15601 Reviewed By: achen1 Differential Revision: D5801619 Pulled By: shergin fbshipit-source-id: 27d1b9bb64018e7f12f9c3d3d222f1fda468b124
@AndrewJack @janicduplessis Any update on this?? I'm facing this issue. FATAL EXCEPTION: main |
@rekha110254 What version are you using? This was only shipped in RN 0.50. |
@AndrewJack thanks for this PR, this bug is kicking my project in the shins. I am using |
is navigator.geolocation.getCurrentPosition working in Android 8? Could someone with actual device test it, whether it always returns error 3 (location timeout) or actually works with permission allowed, location services enabled and using both gps and wireless? |
@AndrewJack RN 0.51.1 |
Summary: Apps targeting Android 8.0 (API level 26) cannot use `TYPE_SYSTEM_OVERLAY ` and `TYPE_SYSTEM_OVERLAY `. Targeting 26 will cause the app to crash when in `DEV_MODE`. https://developer.android.com/about/versions/oreo/android-8.0-changes.html#cwt This PR replaces uses of these overlay flags with the new `TYPE_APPLICATION_OVERLAY` when running on a device with Android 8.0 or later. When using `TYPE_APPLICATION_OVERLAY` it still requires the `SYSTEM_ALERT_WINDOW` permission, just like previous android versions. https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#TYPE_APPLICATION_OVERLAY https://github.com/AndrewJack/react-native-android-oreo tested here Closes facebook#15601 Reviewed By: achen1 Differential Revision: D5801619 Pulled By: shergin fbshipit-source-id: 27d1b9bb64018e7f12f9c3d3d222f1fda468b124
Apps targeting Android 8.0 (API level 26) cannot use
TYPE_SYSTEM_OVERLAY
andTYPE_SYSTEM_OVERLAY
. Targeting 26 will cause the app to crash when inDEV_MODE
.https://developer.android.com/about/versions/oreo/android-8.0-changes.html#cwt
This PR replaces uses of these overlay flags with the new
TYPE_APPLICATION_OVERLAY
when running on a device with Android 8.0 or later.When using
TYPE_APPLICATION_OVERLAY
it still requires theSYSTEM_ALERT_WINDOW
permission, just like previous android versions.https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#TYPE_APPLICATION_OVERLAY
Test Plan
https://github.com/AndrewJack/react-native-android-oreo tested here