Skip to content
This repository was archived by the owner on Nov 8, 2021. It is now read-only.

Commit

Permalink
Add more logs on Entering/Leaving VR mode.
Browse files Browse the repository at this point in the history
Try to fix the new black screen issue. #67
  • Loading branch information
polygraphene committed Jun 20, 2018
1 parent 7b165cf commit 50989d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions app/src/main/cpp/vr_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
void VrContext::onVrModeChange() {
if (Resumed && window != NULL) {
if (Ovr == NULL) {
LOG("Entering VR mode.");
LOGI("Entering VR mode.");
ovrModeParms parms = vrapi_DefaultModeParms(&java);

parms.Flags |= VRAPI_MODE_FLAG_RESET_WINDOW_FULLSCREEN;
Expand All @@ -46,8 +46,10 @@ void VrContext::onVrModeChange() {
}
} else {
if (Ovr != NULL) {
LOG("Leaving VR mode.");
LOGI("Leaving VR mode.");
vrapi_LeaveVrMode(Ovr);

LOGI("Leaved VR mode.");
Ovr = NULL;
}
}
Expand Down Expand Up @@ -466,6 +468,7 @@ void VrContext::onSurfaceChanged(jobject surface){
LOG("onSurfaceChanged called. Resumed=%d Window=%p Ovr=%p", Resumed, window, Ovr);
ANativeWindow *newWindow = ANativeWindow_fromSurface(env, surface);
if (newWindow != window) {
LOG("Replacing ANativeWindow. %p != %p", newWindow, window);
ANativeWindow_release(window);
window = NULL;
onVrModeChange();
Expand All @@ -475,6 +478,7 @@ void VrContext::onSurfaceChanged(jobject surface){
onVrModeChange();
}
} else if (newWindow != NULL) {
LOG("Got same ANativeWindow. %p == %p", newWindow, window);
ANativeWindow_release(newWindow);
}
}
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/polygraphene/alvr/VrThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public VrThread(MainActivity mainActivity) {

public void onSurfaceCreated(final Surface surface) {
Log.v(TAG, "VrThread.onSurfaceCreated.");
post(new Runnable() {
send(new Runnable() {
@Override
public void run() {
mVrContext.onSurfaceCreated(surface);
Expand All @@ -69,7 +69,7 @@ public void run() {

public void onSurfaceChanged(final Surface surface) {
Log.v(TAG, "VrThread.onSurfaceChanged.");
post(new Runnable() {
send(new Runnable() {
@Override
public void run() {
mVrContext.onSurfaceChanged(surface);
Expand All @@ -79,7 +79,7 @@ public void run() {

public void onSurfaceDestroyed() {
Log.v(TAG, "VrThread.onSurfaceDestroyed.");
post(new Runnable() {
send(new Runnable() {
@Override
public void run() {
mVrContext.onSurfaceDestroyed();
Expand Down

0 comments on commit 50989d9

Please # to comment.