googlevr / gvr-android-sdk

Google VR SDK for Android
http://developers.google.com/vr/android/
Other
3.28k stars 1.28k forks source link

HeadMountedDisplayManager.updateGvrViewerParams fails #490

Closed Adam-VisualVocal closed 6 years ago

Adam-VisualVocal commented 6 years ago

If I try to call HeadMountedDisplayManager.updateGvrViewerParams from my app, it has no effect and I see the following message in the Logcat window:

W/VrSettingsProvider: Writes disallowed, unauthorized package: <my.package.name>

Questions:

  1. Why can't I call this documented API?
  2. Why doesn't the documentation say that authorization is required and how to get it?
jdduke commented 6 years ago

Hi @Adam-VisualVocal, this is a legacy API that unfortunately isn't well documented. We'll try to address that in the next release.

In general, programmatic switching of the headset is discouraged, and is now no longer supported. It should typically be the user's choice to select the headset with which they want to experience VR. Can I ask what specific use-case you have in mind?

Adam-VisualVocal commented 6 years ago

Hi Jared,

My company makes a VR business communication app aimed at architecture and construction and we bundle a specific VR viewer with it. Like this: http://www.visualvocal.com/

We recognize the importance of not automatically overriding the user's selected VR viewer. I totally get that. However, we'd really like to make it easy for our customers to configure our app to use the bundled viewer via a prompt and button that we show at startup. Something like, "Tap here to use the bundled viewer. [OK]". Right now the best we can do is dump them into the Android VR Settings UI which can be a bit bewildering for a first-time user.

What about introducing a new permission that allows apps to set the viewer? (e.g. CONFIGURE_VR_VIEWER) That would mostly protect against malicious apps but would allow a better user experience for business apps like Visual Vocal.

Thanks, Adam

nathanmartz commented 6 years ago

Adam, you can set the default viewer which will work as long as they haven't already paired a viewer on that phone. Will that work for you?

On Wed, Nov 8, 2017 at 9:26 AM, Adam Szofran notifications@github.com wrote:

Hi Jared,

My company makes a VR business communication app aimed at architecture and construction and we bundle a specific VR viewer with it. Like this: http://www.visualvocal.com/

We recognize the importance of not automatically overriding the user's selected VR viewer. I totally get that. However, we'd really like to make it easy for our customers to configure our app to use the bundled viewer via a prompt and button that we show at startup. Something like, "Tap here to use the bundled viewer. [OK]". Right now the best we can do is dump them into the Android VR Settings UI which can be a bit bewildering for a first-time user.

What about introducing a new permission that allows apps to set the viewer? (e.g. CONFIGURE_VR_VIEWER) That would mostly protect against malicious apps but would allow a better user experience for business apps like Visual Vocal.

Thanks, Adam

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/googlevr/gvr-android-sdk/issues/490#issuecomment-342891640, or mute the thread https://github.com/notifications/unsubscribe-auth/ANamfniM9FoNDfbl-hHDFBGTMdE_tWvEks5s0eQzgaJpZM4QVPDP .

Adam-VisualVocal commented 6 years ago

Hi Nathan,

We do set the default viewer and that's fine for some customers. However, we've found that the viewer is already set right out of the factory for some phones like the Samsung Galaxy 8 series and the original Pixel. To test, just factory reset a Pixel or S8 and try to call gvr_set_default_viewer_profile and it'll return false.

We also have trouble with people who have Daydream headsets. Any time their phone gets within NFC distance of the Daydream headset the phone automatically switches to Daydream. Then we have to send them to the VR Settings UI to switch back. It'd be so much nicer for them if we could just let them mash a button to switch back to our viewer.

Thanks, Adam

jdduke commented 6 years ago

It looks like part of the issue is that the API for setting the default profile is infrequently used, and the policy for Google VR Services has always been to reject headset injection from any untrusted source. This is probably why you're only hitting the gvr_set_default_viewer_profile issue on Daydream-ready devices, as they have Google VR Services preinstalled.

We've recently added some UI to Google VR Services to simplify switching between headsets (there's a "Recent" headset section when you go to switch the headset). Would that, together with a fix that enables gvr_set_default_viewer_profile with VR Services, be sufficient for your needs?

Adam-VisualVocal commented 6 years ago

Hi Jared,

Thanks, I'll take what I can get. :-) I think that would help streamline our user experience but only if the following assumptions are true:

  1. gvr_set_default_viewer_profile would succeed even on factory fresh/reset Daydream phones. However, it's hard to see how it could without the customer upgrading to the latest Google VR Services. Even then, I figure it would only succeed if the user hadn't already chosen another headset.
  2. Calling gvr_set_default_viewer_profile would result in that viewer being added to the "Recent" list in the GVR Services UI.

Am I correct?

Also, I don't see the "Recent" list in Google VR Services 1.10.172754103 (latest from Play Store). Is that something you'll be releasing in the near future?

Thanks, Adam

jdduke commented 6 years ago

Actually, @Adam-VisualVocal, which API(s) are you using for Cardboard support? If you're using GvrView, you can call GvrView.updateViewerParams() to override the parameters for just the local Cardboard app. Note that you'll probably have to call this after every Activity.onResume() signal, as we manually read the system viewer params after every GvrView.onResume() call.

That's probably the surest bet for now to make your app's experience consistent and self-contained. Let me know if that works for you.

In the meantime, HeadMountedDisplayManager is mostly an internal implementation detail, and it's probably a mistake for it to be documented publicly, for the reasons mentioned earlier about being a legacy API.

Adam-VisualVocal commented 6 years ago

Our app is written in Unity so we're using the Unity SDK, That limits us a bit, of course, although I'm not totally above calling into the version of the Android SDK packaged with the Unity SDK. However, it looks like GvrView isn't included with nor exposed by the Unity SDK unfortunately.

Regarding HeadMountedDisplayManager, I've stopped trying to use it. Since it's not bundled into the Unity SDK using it wasn't going to be possible without some scary hacks. ;-)

nathanmartz commented 6 years ago

Adam, you should be able to use SetViewerProfile in CardboardHelpers.cs. This will pair the viewer you specify as long as the user hasn't paired one already.

Adam-VisualVocal commented 6 years ago

Hi Nathan,

We do use SetViewerProfile but unfortunately we've found that the original Pixel and the Samsung Galaxy S8 both come from the factory with a viewer already paired. Perhaps this applies to all Daydream phones but I'm not sure.

Thanks, Adam

jdduke commented 6 years ago

This will be fixed in the next release of Google VR Services (~mid May). That is, the API should function as long as no headset has been explicitly paired by the user (or by another app).

sigmaxipi commented 6 years ago

Fixed in https://github.com/googlevr/gvr-android-sdk/releases/tag/v1.150.0