Bug with cutout on Android

Cutout and GLView::getSafeAreaRect() does not support device rotation properly.

It looks like the solution is to remove the “static” keywork in the following line in CCGLViewImpl-android.cpp:

GLViewImpl::getSafeAreaRect()  {
...
int* safeInsets = JniHelper::callStaticIntArrayMethod("org/cocos2dx/lib/Cocos2dxHelper", "getSafeInsets");
...
}

Other wise the data is cached and it does not work.

It compare the Build.VERSION.SDK_INT condition,and return int[]{0, 0, 0, 0} when false, you can check this.

    public static int[] getSafeInsets() {
        final int[] safeInsets = new int[]{0, 0, 0, 0};
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {

That’s not what I meant, you misunderstood my message.
The issue comes when we rotate the device. The safeInsets returns are the original one, and it doesn’t change when the device is rotated (I’m talking about Android Pie devices with actual insets/cutouts).

BTW, my fix is live in the latest version of my game and players don’t seem to complain (about 200k active players)