forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
b2a8323
commit 574a6c7
Showing
4 changed files
with
22 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
18 changes: 18 additions & 0 deletions
18
ReactAndroid/src/main/java/com/facebook/react/devsupport/WindowOverlayCompat.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.facebook.react.devsupport; | ||
|
||
import android.os.Build; | ||
import android.view.WindowManager; | ||
|
||
/** | ||
* Compatibility wrapper for apps targeting API level 26 or later. | ||
* See https://developer.android.com/about/versions/oreo/android-8.0-changes.html#cwt | ||
*/ | ||
/* package */ class WindowOverlayCompat { | ||
|
||
private static final int ANDROID_OREO = 26; | ||
private static final int TYPE_APPLICATION_OVERLAY = 2038; | ||
|
||
static final int TYPE_SYSTEM_ALERT = Build.VERSION.SDK_INT < ANDROID_OREO ? WindowManager.LayoutParams.TYPE_SYSTEM_ALERT : TYPE_APPLICATION_OVERLAY; | ||
static final int TYPE_SYSTEM_OVERLAY = Build.VERSION.SDK_INT < ANDROID_OREO ? WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY : TYPE_APPLICATION_OVERLAY; | ||
|
||
} |