Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import android.hardware.SensorManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.view.WindowManager;
import android.widget.Toast;

Expand Down Expand Up @@ -94,6 +95,12 @@ public class DevSupportManagerImpl implements
PackagerCommandListener,
DevInternalSettings.Listener {

/*
* Adds support for Android O. See https://developer.android.com/preview/behavior-changes.html#cwt for more info
*/
private static final int O_TYPE_APPLICATION_OVERLAY = 2038;
private static final int WINDOW_TYPE = "O".equals(Build.VERSION.CODENAME) ? O_TYPE_APPLICATION_OVERLAY : WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;

private static final int JAVA_ERROR_COOKIE = -1;
private static final int JSEXCEPTION_ERROR_COOKIE = -1;
private static final String JS_BUNDLE_FILE_NAME = "ReactNativeDevBundle.js";
Expand Down Expand Up @@ -322,7 +329,7 @@ private void showNewError(
public void run() {
if (mRedBoxDialog == null) {
mRedBoxDialog = new RedBoxDialog(mApplicationContext, DevSupportManagerImpl.this, mRedBoxHandler);
mRedBoxDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
mRedBoxDialog.getWindow().setType(WINDOW_TYPE);
}
if (mRedBoxDialog.isShowing()) {
// Sometimes errors cause multiple errors to be thrown in JS in quick succession. Only
Expand Down Expand Up @@ -464,7 +471,7 @@ public void onCancel(DialogInterface dialog) {
}
})
.create();
mDevOptionsDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
mDevOptionsDialog.getWindow().setType(WINDOW_TYPE);
mDevOptionsDialog.show();
}

Expand Down