这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@lvonasek
Copy link
Contributor

When user opens in the headset 2D preferences screen in XR mode then it behaves like two separate apps.

In this PR I did following changes:

  • added a broadcast to close XR session from the 2D context
  • modified the condition to support going from 2D into XR
  • removed redundant getMainDisplay
  • set native calls in XrActivity to libxrio private

@twaik
Copy link
Member

twaik commented Jul 18, 2024

No need to call teardown with broadcast. Simply make protected void teardown() {} in MainActivity, make teardownprotected function with@Override` and it will be available from MainActivity...

@lvonasek
Copy link
Contributor Author

No need to call teardown with broadcast. Simply make protected void teardown() {} in MainActivity, make teardownprotected function with@Override` and it will be available from MainActivity...

I tried that, it didn't work.

@twaik
Copy link
Member

twaik commented Jul 18, 2024

It did not work with exception or it simply and silently ignored changes?

@twaik
Copy link
Member

twaik commented Jul 18, 2024

I am not so sure about this but it seems to me you should pass it to GLSurfaceView's thread with GLSurfaceView.queueEvent because it is not async.

@twaik
Copy link
Member

twaik commented Jul 18, 2024

And in clientConnectedStateChanged too.

@lvonasek
Copy link
Contributor Author

lvonasek commented Jul 18, 2024

It silently ignored the changes.

As far as I understand it. When I open the preference screen from the system notifications, it opens a new instance of the app which doesn't contain XrActivity.

@twaik
Copy link
Member

twaik commented Jul 18, 2024

That is correct, but why exactly you think it is related?

@twaik
Copy link
Member

twaik commented Jul 18, 2024

BradcastReceiver receiving notification about preferences changed is registered in runtime. So XrActivity receives it too.

@lvonasek
Copy link
Contributor Author

lvonasek commented Jul 18, 2024

It is like running two separate apps. The one with the preference screen doesn't contain instance of XrActivity.

I just tested this in XrActivity:

    @Override
    void onPreferencesChangedCallback() {
        if (oldXrMode != prefs.xrMode.get()) {
            Log.d("XXX", "XR=" + prefs.xrMode.get());
        }
        super.onPreferencesChangedCallback();
    }

and it isn't called.

@twaik
Copy link
Member

twaik commented Jul 21, 2024

It is weird.

  1. Only one activity should be available at the same time.
  2. Broadcast about preferences change should be sent to both activities. It is being broadcasted. Something is broken.

@lvonasek
Copy link
Contributor Author

  1. Only one activity should be available at the same time.

It isn't possible to mix XR and 2D content in one activity. As I start the XrActivity another activity is created. In my point of view the behavior is expected.

  1. Broadcast about preferences change should be sent to both activities. It is being broadcasted. Something is broken.

I cannot say why the broadcast doesn't work. The XR behavior in Android apps isn't documented at all.

@twaik twaik merged commit d366d40 into termux:master Aug 12, 2024
@lvonasek lvonasek deleted the hotfix-openxr-flow branch August 12, 2024 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants