Skip to main content
Up and Coming
March 9, 2016

[GearVR] Oculus Patched UE4 4.10.2 Back Button Issues

Greetings!

I'm using the 4.10-0.8 branch from https://github.com/Oculus-VR/UnrealEngine as I need to be on Mobile SDk 1.x to launch my GearVR title. However, it looks like the Back button now behaves quite differently in this version compared to the standard UE4 4.10.4.

It is now not possible for the application to receive a Back button event, and it always attempts to quit the application. To test this out, I just recompiled by Circumpaint application using the Oculus branch. Now any short press of the Back button brings up the standard "Are you sure you want to quit" dialog.

In going through the new code in Engine/Plugins/Runtime/GearVR/Source/GearVR/Private/GearVR.cpp there are added HandleBackButtonAction() and HandleInputKey() methods. Within HandleInputKey(), if the Back button is released before BACK_BUTTON_SHORT_PRESS_TIME_IN_SECONDS is up, then we enter a short press state. So far, so good.

But then within HandleBackButtonAction() a pending Back button short press state has the following code:

	else if (BackButtonState == BACK_BUTTON_STATE_PENDING_SHORT_PRESS && !BackButtonDown)
{
if ( ( vrapi_GetTimeInSeconds() - BackButtonDownStartTime ) > BACK_BUTTON_DOUBLE_TAP_TIME_IN_SECONDS )
{
UE_LOG(LogHMD, Log, TEXT("back button short press"));

PushBlackFinal();

UE_LOG(LogHMD, Log, TEXT(" SystemActivities_StartSystemActivity( %s )"), ANSI_TO_TCHAR(PUI_CONFIRM_QUIT));
SystemActivities_StartSystemActivity( &JavaGT, PUI_CONFIRM_QUIT, NULL );
BackButtonState = BACK_BUTTON_STATE_NONE;
}
}


With this code, a Back button short press will always pop up the quit confirmation activity. This means that an application or game can never make use of the Back button to navigate back through its menus.

Is there a reason this is now forced on us? Or is it just an error? If it is an error, what would be the fix to pass a short press Back button back into UE4's input stream like we have in the standard 4.10.4?

Thanks!

- Dave
    This topic has been closed for replies.

    15 replies

    New Participant
    March 23, 2016
    Sorry, I've installed a wrong one (with no debug info).

    The UE4 filtered: https://www.dropbox.com/s/a037madv3h9n2 ... 4.txt?dl=0
    The full one: https://www.dropbox.com/s/drlng2g66ve8g ... l.txt?dl=0
    Up and Coming
    March 23, 2016
    Sorry, it still looks incomplete, it doesn't have beginning and the ending is quite strange and abrupt. Let me try my test proj with Preview7, will see if I can repro the issue.
    Up and Coming
    March 23, 2016
    Good news (kinda): I got the issue reproduced. It seems like a regression in SystemActivities, will investigate. Thanks for the report!
    Up and Coming
    March 23, 2016
    Actually, I take back the part about SystemActivities, it seems more like an issue in Epic's integration (since my 4.10 + 1.0 doesn't crash, using the same SystemActivities). In any case, investigating.
    Up and Coming
    March 25, 2016
    Good news! Found a bug in 4.11 integration.
    The fix is pretty simple. Find AndroidEGL.cpp in Engine\Source\Runtime\OpenGLDrv\Private\Android\, open it in the text editor, find the method void AndroidEGL::ReInit() and change it by the following way:

    extern bool AndroidThunkCpp_IsGearVRApplication(); // ADD THIS

    void AndroidEGL::ReInit()
    {
    FPlatformMisc::LowLevelOutputDebugString(TEXT("AndroidEGL::ReInit()"));
    SetCurrentContext(EGL_NO_CONTEXT, EGL_NO_SURFACE);
    bool bCreateSurface = !AndroidThunkCpp_IsGearVRApplication(); // ADD THIS
    InitSurface(false, bCreateSurface); // CHANGE THIS LINE
    SetCurrentSharedContext();
    }

    This should fix the issue.

    This will be reported to Epic ASAP.