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

App crashes after showing permission request dialog #822

Closed
sienc opened this issue Dec 26, 2017 · 21 comments
Closed

App crashes after showing permission request dialog #822

sienc opened this issue Dec 26, 2017 · 21 comments

Comments

@sienc
Copy link

sienc commented Dec 26, 2017

Application always crashes after showing a permission request dialog by calling GvrPermissionsRequester.RequestPermissions().

Found using:

  • Google VR SDK version: v1.110.0
  • Unity version: 2017.3.0f3
  • Phone manufacturer, model, and O/S version: Google Pixel, Android Oreo 8.1.0
  • Viewer manufacturer & model: Google Daydream View

Steps to reproduce the issue:

  1. Creating a new Unity project and import Google VR SDK
  2. Build and run the PermissionsDemo scene
  3. Click on "Request Permission"
  4. Click on either Allow or Deny
  5. Application crash

Logcat recorded the following exception:

12-25 21:37:12.139: E/AndroidRuntime(5878): FATAL EXCEPTION: main
12-25 21:37:12.139: E/AndroidRuntime(5878): Process: com.test.permission, PID: 5878
12-25 21:37:12.139: E/AndroidRuntime(5878): java.lang.IllegalArgumentException: Argument 'pendingVrExitIntent' cannot be null
12-25 21:37:12.139: E/AndroidRuntime(5878): 	at android.os.Parcel.readException(Parcel.java:2008)
12-25 21:37:12.139: E/AndroidRuntime(5878): 	at android.os.Parcel.readException(Parcel.java:1950)
12-25 21:37:12.139: E/AndroidRuntime(5878): 	at com.google.android.aidl.BaseProxy.transactAndReadException(BaseProxy.java:46)
12-25 21:37:12.139: E/AndroidRuntime(5878): 	at com.google.vr.vrcore.common.api.IDaydreamManager$Stub$Proxy.exitFromVr(IDaydreamManager.java:539)
12-25 21:37:12.139: E/AndroidRuntime(5878): 	at com.google.vr.ndk.base.DaydreamApi$8.run(DaydreamApi.java:702)
12-25 21:37:12.139: E/AndroidRuntime(5878): 	at com.google.vr.ndk.base.DaydreamApi$1.onServiceConnected(DaydreamApi.java:109)
12-25 21:37:12.139: E/AndroidRuntime(5878): 	at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1652)
12-25 21:37:12.139: E/AndroidRuntime(5878): 	at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1681)
12-25 21:37:12.139: E/AndroidRuntime(5878): 	at android.os.Handler.handleCallback(Handler.java:790)
12-25 21:37:12.139: E/AndroidRuntime(5878): 	at android.os.Handler.dispatchMessage(Handler.java:99)
12-25 21:37:12.139: E/AndroidRuntime(5878): 	at android.os.Looper.loop(Looper.java:164)
12-25 21:37:12.139: E/AndroidRuntime(5878): 	at android.app.ActivityThread.main(ActivityThread.java:6494)
12-25 21:37:12.139: E/AndroidRuntime(5878): 	at java.lang.reflect.Method.invoke(Native Method)
12-25 21:37:12.139: E/AndroidRuntime(5878): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
12-25 21:37:12.139: E/AndroidRuntime(5878): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
@iheartgardens
Copy link

Bump. Can anyone help with this? We're trying to qualify our app as a Daydream app and this is blocking. Thanks!

@sienc
Copy link
Author

sienc commented Jan 16, 2018

Update, workaround found:

This problem seems to only happen when building with Target API Level 27. Selecting Target API Level to 24 or 25 fixes the issue.

@mikejohnstn
Copy link

We're seeing this too (Unity 2017.3.0p4, GVR 1.120.0). Thanks for the workaround.

If it helps, it looks like just before the crash, the permissions screen gets cancelled and called a second time when targeting API Level 27.

@Marina-J
Copy link

We're having the same issue and the workaround does not work (unity 2017.3.1p4, GVR 1.130.1).
The app crash after asking for permissions.
Is there any update on this ?

Thanks !

@rusmaxham
Copy link
Contributor

Can you run adb bugreport right after the issue occurs and post the bugreport file here?

@Marina-J
Copy link

Marina-J commented Mar 22, 2018

This one ?

Also during runtime the main error seems to be this one :
ActivityThread: Activity com.google.gvr.permissionsupport.TransitionVRActivity has leaked ServiceConnection com.google.vr.ndk.base.DaydreamApi$1@4058656 that was originally bound here android.app.ServiceConnectionLeaked: Activity com.google.gvr.permissionsupport.TransitionVRActivity has leaked ServiceConnection com.google.vr.ndk.base.DaydreamApi$1@4058656 that was originally bound here at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:1536) at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:1428) at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1622) at android.app.ContextImpl.bindService(ContextImpl.java:1574) at android.content.ContextWrapper.bindService(ContextWrapper.java:697) at com.google.vr.ndk.base.DaydreamApi.init(DaydreamApi.java:957) at com.google.vr.ndk.base.DaydreamApi.create(DaydreamApi.java:144) at com.google.gvr.permissionsupport.TransitionVRActivity.onCreate(TransitionVRActivity.java:71) at android.app.Activity.performCreate(Activity.java:7174) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2908) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3030) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6938) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

bugreport-2018-03-22-09-34-50.zip

@rusmaxham
Copy link
Contributor

Are you sure you're using GVR SDK for Unity 1.130.1? We fixed the leaked ServiceConnection issue in that release. I'm only able to reproduce it with 1.120, but not 1.130.1.

@rusmaxham rusmaxham added the bug label Mar 22, 2018
@Marina-J
Copy link

Strange... I just downloaded it again to be sure, launched the PermissionsDemo scene on my S8 and crash again. It asks for permission, and after a few second without doing anything it crash. This time I got this error :
bugreport-2018-03-23-17-03-30.zip

FATAL EXCEPTION: main Process: com.oculus.SampleFramework, PID: 25130 java.lang.SecurityException: Caller is not the active VR component. at android.os.Parcel.readException(Parcel.java:1958) at android.os.Parcel.readException(Parcel.java:1904) at com.google.vr.sdk.common.deps.a.transactAndReadException(SourceFile:11) at com.google.vr.vrcore.common.api.IDaydreamManager$Stub$Proxy.exitFromVr(SourceFile:57) at com.google.vr.ndk.base.DaydreamApi$8.run(SourceFile:6) at com.google.vr.ndk.base.DaydreamApi$1.onServiceConnected(SourceFile:10) at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1656) at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1685) at android.os.Handler.handleCallback(Handler.java:789) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6938) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

Here is the bugreport in case it can help.

@rusmaxham
Copy link
Contributor

That's interesting. Do you have the Oculus VR SDK enabled as well as Daydream?

@Marina-J
Copy link

No, only Daydream, but I have the Oculus program on my phone, maybe it's related ? I also have the OVR plugin in this project (that's why it's called com.oculus.SampleFramework)

@carreraSilvio
Copy link

Any news on this issue? I'm getting something similar and I also have the oculus plugin in my project. Though I disable it before making a build for daydream.

Attaching log below:
Crash_Log_Request_Dialog_2018_04_02.txt

@hshapley
Copy link

hshapley commented Apr 3, 2018

The original issue still happens for me with Unity 2017.3 and GVR SDK 1.130.1. If I change the Target API to 24, then the app doesn't crash. However, there are still some bugs in the PermissionsFlowManager code - the results callback is executed in a separate thread, so you cannot call any Unity APIs, such as setting the text or color. I worked around this by setting a boolean to trigger the desired actions in the Update() method. Not ideal, but gets the job done for now.

It would be nice to have this work out of the box and not have to set the target API.

@jdduke
Copy link

jdduke commented Apr 6, 2018

To those of you that are able to repro, can you try adding uiMode as an additional entry to the android:configChanges attribute of the permission Activity's manifest? For the S8, you might need to also add density to the same attribute. If we can get confirmation that this resolves the issue, we'll be sure to update the permission samples. Thanks.

You might need to unpack the gvr-permissionsupport-release.aar, modify its AndroidManifest.xml in-place, then re-archive it, e.g., for TransitionVRActivity change

android:configChanges="orientation|screenSize|"

to

android:configChanges="orientation|screenSize|uiMode|density"

@carreraSilvio
Copy link

@jdduke solution worked for me. I tried it on an empty project, imported GoogleDaydreamPackage and just ran the Permission Scene. I'm on Unity 5.6.5f1. Tried it multiple times, no crash :).

I had to change both manifest files as mentioned. Just changing the one inside the project didn't do much by itself. Attaching the gvr-permissionsupport-release.aar in a zip with the manifest modified for anyone who wants to try this out quickly.

gvr-permissionsupport-release.zip

@areong
Copy link

areong commented Apr 22, 2018

Another solution is not to use the Runtime Permissions, which is not supported by Unity as described in https://docs.unity3d.com/Manual/android-manifest.html, but to let the app request permissions on startup by adding the following line in the manifest:

<meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="false" />

(You can follow the section Overriding the Android Manifest in the link to modify the manifest.)

Unity sets the value to true by default. Setting false makes the permissions dialog show up at startup and thus users can accept permission requests. Though this method is not considered a good practice in Android 6.0 and above.

@mhaemmerle
Copy link

Is there an ETA for the next version that includes the fix mentioned a couple of posts earlier?

Also with the Mirage Solo having been released ~a week ago: are you working on a way to handle permissions solely in VR anytime soon? The current permission flow is very immersion breaking and the need to actually remove your phone from the Daydream View only adds on top of that... :)

@rusmaxham
Copy link
Contributor

This fix should be out in the next three weeks.

The permissions flow works seamlessly on the Mirage Solo if you are using the latest GVR SDK for Unity.

@Marina-J
Copy link

Any update about the next release ?

@rusmaxham
Copy link
Contributor

Next release is in testing, expected release in two weeks.

@rusmaxham
Copy link
Contributor

This is now fixed in the latest release.

@play123
Copy link

play123 commented Aug 9, 2018

in Miraz solo app crash after permission dialog. I'm using unity 2018.1.0f2 and latest SDK

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests