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

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

View file

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

View file

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

View file

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

View file

@ -338,6 +338,7 @@ public:
void beforeEnterBackground(); void beforeEnterBackground();
void enterBackground(); void enterBackground();
void enterForeground(); void enterForeground();
void toggleAwayMode();
#endif #endif
signals: signals:

View file

@ -140,7 +140,11 @@ struct VrSurface : public TaskQueue {
if (vrReady != vrRunning) { if (vrReady != vrRunning) {
if (vrRunning) { if (vrRunning) {
__android_log_write(ANDROID_LOG_WARN, "QQQ_OVR", "vrapi_LeaveVrMode"); __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); vrapi_LeaveVrMode(session);
session = nullptr; session = nullptr;
oculusActivity = nullptr; oculusActivity = nullptr;
} else { } else {

View file

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