Merge branch 'quest-demo' of github.com:highfidelity/hifi into quest-demo

This commit is contained in:
Dante Ruiz 2019-02-22 15:02:01 -08:00
commit eedd54d0b1
9 changed files with 40 additions and 11 deletions

View file

@ -61,7 +61,7 @@ extern "C" {
Java_io_highfidelity_oculus_OculusMobileActivity_nativeInitOculusPlatform(JNIEnv *env, jobject obj){
initOculusPlatform(env, obj);
}
QAndroidJniObject __interfaceActivity;
QAndroidJniObject __interfaceActivity;
JNIEXPORT void JNICALL
Java_io_highfidelity_oculus_OculusMobileActivity_questNativeOnCreate(JNIEnv *env, jobject obj) {
@ -80,6 +80,10 @@ QAndroidJniObject __interfaceActivity;
});
}
JNIEXPORT void JNICALL
Java_io_highfidelity_oculus_OculusMobileActivity_questNativeAwayMode(JNIEnv *env, jobject obj) {
AndroidHelper::instance().toggleAwayMode();
}
JNIEXPORT void Java_io_highfidelity_oculus_OculusMobileActivity_questOnAppAfterLoad(JNIEnv* env, jobject obj) {

View file

@ -34,6 +34,7 @@ public class OculusMobileActivity extends QtActivity implements SurfaceHolder.Ca
private native void questNativeOnResume();
private native void questOnAppAfterLoad();
private native void questNativeAwayMode();
private SurfaceView mView;
private SurfaceHolder mSurfaceHolder;
@ -50,14 +51,13 @@ public class OculusMobileActivity extends QtActivity implements SurfaceHolder.Ca
nativeOnCreate();
questNativeOnCreate();
}
public void onAppLoadedComplete() {
Log.w(TAG, "QQQ Load Completed");
runOnUiThread(() -> {
setContentView(mView);
questOnAppAfterLoad();
});
}
@Override
@ -97,6 +97,7 @@ public class OculusMobileActivity extends QtActivity implements SurfaceHolder.Ca
protected void onStop(){
super.onStop();
Log.w(TAG, "QQQ_ Onstop called");
questNativeAwayMode();
}
@Override
@ -104,6 +105,7 @@ public class OculusMobileActivity extends QtActivity implements SurfaceHolder.Ca
super.onRestart();
Log.w(TAG, "QQQ_ onRestart called ****");
questOnAppAfterLoad();
questNativeAwayMode();
}
@Override
@ -123,8 +125,7 @@ public class OculusMobileActivity extends QtActivity implements SurfaceHolder.Ca
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
Log.w(TAG, "QQQ_ surfaceDestroyed ***************************************************");
// nativeOnSurfaceChanged(null);
// mSurfaceHolder = null;
nativeOnSurfaceChanged(null);
mSurfaceHolder = null;
}
}

View file

@ -45,6 +45,10 @@ void AndroidHelper::notifyBeforeEnterBackground() {
emit beforeEnterBackground();
}
void AndroidHelper::notifyToggleAwayMode() {
emit toggleAwayMode();
}
void AndroidHelper::notifyEnterBackground() {
emit enterBackground();
}

View file

@ -31,6 +31,7 @@ public:
void notifyEnterForeground();
void notifyBeforeEnterBackground();
void notifyEnterBackground();
void notifyToggleAwayMode();
void performHapticFeedback(int duration);
void processURL(const QString &url);
@ -55,7 +56,7 @@ signals:
void enterForeground();
void beforeEnterBackground();
void enterBackground();
void toggleAwayMode();
void hapticFeedbackRequested(int duration);
void handleSignupCompleted();

View file

@ -1756,6 +1756,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
#endif
});
// Setup the _keyboardMouseDevice, _touchscreenDevice, _touchscreenVirtualPadDevice and the user input mapper with the default bindings
userInputMapper->registerDevice(_keyboardMouseDevice->getInputDevice());
// if the _touchscreenDevice is not supported it will not be registered
@ -2411,6 +2412,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
connect(&AndroidHelper::instance(), &AndroidHelper::beforeEnterBackground, this, &Application::beforeEnterBackground);
connect(&AndroidHelper::instance(), &AndroidHelper::enterBackground, this, &Application::enterBackground);
connect(&AndroidHelper::instance(), &AndroidHelper::enterForeground, this, &Application::enterForeground);
connect(&AndroidHelper::instance(), &AndroidHelper::toggleAwayMode, this, &Application::toggleAwayMode);
AndroidHelper::instance().notifyLoadComplete();
#endif
pauseUntilLoginDetermined();
@ -9140,6 +9143,8 @@ void Application::beforeEnterBackground() {
clearDomainOctreeDetails();
}
void Application::enterBackground() {
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(),
"stop", Qt::BlockingQueuedConnection);
@ -9163,6 +9168,15 @@ void Application::enterForeground() {
auto nodeList = DependencyManager::get<NodeList>();
nodeList->setSendDomainServerCheckInEnabled(true);
}
void Application::toggleAwayMode(){
QKeyEvent event = QKeyEvent (QEvent::KeyPress, Qt::Key_Escape, Qt::NoModifier);
QCoreApplication::sendEvent (this, &event);
}
#endif
#include "Application.moc"

View file

@ -338,7 +338,8 @@ public:
void beforeEnterBackground();
void enterBackground();
void enterForeground();
#endif
void toggleAwayMode();
#endif
signals:
void svoImportRequested(const QString& url);

View file

@ -140,7 +140,11 @@ struct VrSurface : public TaskQueue {
if (vrReady != vrRunning) {
if (vrRunning) {
__android_log_write(ANDROID_LOG_WARN, "QQQ_OVR", "vrapi_LeaveVrMode");
vrapi_SetClockLevels(session, 1, 1);
vrapi_SetExtraLatencyMode(session, VRAPI_EXTRA_LATENCY_MODE_OFF);
vrapi_SetDisplayRefreshRate(session, 60);
vrapi_LeaveVrMode(session);
session = nullptr;
oculusActivity = nullptr;
} else {

View file

@ -14,8 +14,8 @@
var DEFAULT_SCRIPTS_COMBINED = [
"system/request-service.js",
"system/progress.js",
//"system/away.js",
"system/hmd.js",
"system/away.js",
//"system/hmd.js",
"system/menu.js",
"system/bubble.js",
"system/pal.js", // "system/mod.js", // older UX, if you prefer

View file

@ -154,7 +154,7 @@ function goAway(fromStartup) {
if (!isEnabled || isAway) {
return;
}
// If we're entering away mode from some other state than startup, then we create our move timer immediately.
// However if we're just stating up, we need to delay this process so that we don't think the initial teleport
// is actually a move.