diff --git a/cmake/android/AndroidManifest.xml.in b/cmake/android/AndroidManifest.xml.in index 354da4fbc1..9f29411590 100755 --- a/cmake/android/AndroidManifest.xml.in +++ b/cmake/android/AndroidManifest.xml.in @@ -9,7 +9,7 @@ +#include +#include #include -#include #include -#include -#include #include "GVRMainWindow.h" #include "RenderingClient.h" @@ -27,6 +27,13 @@ GVRInterface::GVRInterface(int argc, char* argv[]) : _client = new RenderingClient(this); connect(this, &QGuiApplication::applicationStateChanged, this, &GVRInterface::handleApplicationStateChange); + + QAndroidJniEnvironment jniEnv; + + QPlatformNativeInterface* interface = QApplication::platformNativeInterface(); + jobject activity = (jobject) interface->nativeResourceForIntegration("QtActivity"); + + ovr_RegisterHmtReceivers(&*jniEnv, activity); } void GVRInterface::handleApplicationStateChange(Qt::ApplicationState state) { @@ -47,35 +54,27 @@ void GVRInterface::handleApplicationStateChange(Qt::ApplicationState state) { void GVRInterface::resumeOVR() { // Reload local preferences, in case we are coming back from a // switch to the dashboard that changed them. - ovr_UpdateLocalPreferences(); - - // Default vrModeParms - ovrModeParms vrModeParms; - ovrHmdInfo hmdInfo; - - vrModeParms.AsynchronousTimeWarp = true; - vrModeParms.AllowPowerSave = true; - vrModeParms.DistortionFileName = NULL; - vrModeParms.EnableImageServer = false; - vrModeParms.CpuLevel = 2; - vrModeParms.GpuLevel = 2; - vrModeParms.GameThreadTid = 0; - - const char* cpuLevelStr = ovr_GetLocalPreferenceValueForKey( LOCAL_PREF_DEV_CPU_LEVEL, "-1" ); - const int cpuLevel = atoi( cpuLevelStr ); - if ( cpuLevel >= 0 ) { - vrModeParms.CpuLevel = cpuLevel; - qDebug() << "Local Preferences: Setting cpuLevel" << vrModeParms.CpuLevel; - } - - const char* gpuLevelStr = ovr_GetLocalPreferenceValueForKey( LOCAL_PREF_DEV_GPU_LEVEL, "-1" ); - const int gpuLevel = atoi( gpuLevelStr ); - if ( gpuLevel >= 0 ) { - vrModeParms.GpuLevel = gpuLevel; - qDebug() << "Local Preferences: Setting gpuLevel" << vrModeParms.GpuLevel; - } - - ovr_EnterVrMode(vrModeParms, &hmdInfo); + // ovr_UpdateLocalPreferences(); +// +// // Default vrModeParms +// ovrModeParms vrModeParms; +// ovrHmdInfo hmdInfo; +// +// const char* cpuLevelStr = ovr_GetLocalPreferenceValueForKey( LOCAL_PREF_DEV_CPU_LEVEL, "-1" ); +// const int cpuLevel = atoi( cpuLevelStr ); +// if ( cpuLevel >= 0 ) { +// vrModeParms.CpuLevel = cpuLevel; +// qDebug() << "Local Preferences: Setting cpuLevel" << vrModeParms.CpuLevel; +// } +// +// const char* gpuLevelStr = ovr_GetLocalPreferenceValueForKey( LOCAL_PREF_DEV_GPU_LEVEL, "-1" ); +// const int gpuLevel = atoi( gpuLevelStr ); +// if ( gpuLevel >= 0 ) { +// vrModeParms.GpuLevel = gpuLevel; +// qDebug() << "Local Preferences: Setting gpuLevel" << vrModeParms.GpuLevel; +// } +// +// ovr_EnterVrMode(vrModeParms, &hmdInfo); } void GVRInterface::pauseOVR() {