Unity-Technologies / arfoundation-samples

Example content for Unity projects based on AR Foundation
Other
3.07k stars 1.15k forks source link

[Bug] Installation of AR Services on ARCore devices that do not support ARCore results in a black screen #695

Closed weacw closed 3 years ago

weacw commented 3 years ago

Describe the bug Installation of AR Services on ARCore devices that do not support ARCore results in a black screen. ARSession.CheckAvailability(); always return Ready State. And #640

Smartphone (please complete the following information):

image

tdmowrer commented 3 years ago

Installation of AR Services on ARCore devices that do not support ARCore results in a black screen.

How are you installing "AR Services" if ARCore is not supported in the first place?

Note that if ARCore finds itself on a device, it assumes it is supported (because app stores are not supposed to allow installation on unsupported devices). Therefore, if you side load, i.e., install an APK manually or by building from Unity, then ARCore assumes it is running on a supported device.

weacw commented 3 years ago

Installation of AR Services on ARCore devices that do not support ARCore results in a black screen.

How are you installing "AR Services" if ARCore is not supported in the first place?

Note that if ARCore finds itself on a device, it assumes it is supported (because app stores are not supposed to allow installation on unsupported devices). Therefore, if you side load, i.e., install an APK manually or by building from Unity, then ARCore assumes it is running on a supported device.

thank you for your reply. Yes, I'll side load! Is there any way to avoid black screens in not support devices (or provide users with some status/tips)?

tdmowrer commented 3 years ago

Is there any way to avoid black screens in not support devices

If you change ARCore to "optional" (the default is "required"), then it will not assume your device is supported. See https://docs.unity3d.com/Packages/com.unity.xr.arcore@4.1/manual/index.html#build-settings for instructions on how to do this.

Why do you need to be able to side-load an APK onto an unsupported device?

weacw commented 3 years ago

Is there any way to avoid black screens in not support devices

If you change ARCore to "optional" (the default is "required"), then it will not assume your device is supported. See https://docs.unity3d.com/Packages/com.unity.xr.arcore@4.1/manual/index.html#build-settings for instructions on how to do this.

Why do you need to be able to side-load an APK onto an unsupported device?

ARCore is optional now.

“Why do you need to be able to side-load an APK onto an unsupported device?”

I’m testing the app and the ARCore is optional. This is one of the rules of the Android App Stores in our country (China)

tdmowrer commented 3 years ago

I’m testing the app and the ARCore is optional.

Okay, that makes sense. Does it correctly detect that ARCore is not supported now?

weacw commented 3 years ago

I’m testing the app and the ARCore is optional.

Okay, that makes sense. Does it correctly detect that ARCore is not supported now?

No. I set it as optional but still black screen on Not Supported Devices (Installed ARCore Services)

tdmowrer commented 3 years ago

Okay, let's back up.

ARSession.CheckAvailability(); always return Ready State.

CheckAvailability is a coroutine. Can you post some code showing how you are using it?

weacw commented 3 years ago

Okay, let's back up.

ARSession.CheckAvailability(); always return Ready State.

CheckAvailability is a coroutine. Can you post some code showing how you are using it?

This is my code:

        public IEnumerator CheckAvailability(Action<ARSessionState> _callback)
        {
            if ((ARSession.state == ARSessionState.None) ||
                (ARSession.state == ARSessionState.CheckingAvailability))
            {
                yield return ARSession.CheckAvailability();
            }

            _callback?.Invoke(ARSession.state);
            Debug.Log($"Current AR Session State:{ARSession.state.ToString()}");
        }

the code working on Supported devices(iOS working pretty). But It can not get the Not Install ARCore Services state.

tdmowrer commented 3 years ago

That means that ARCore is telling us it is both installed and supported. Otherwise, you would get the state Unsupported, not NeedsInstall.

Indeed, according to Google's list of supported devices, the Huawei P30 Pro is supported. Is that not expected?

weacw commented 3 years ago

That means that ARCore is telling us it is both installed and supported. Otherwise, you would get the state Unsupported, not NeedsInstall.

Indeed, according to Google's list of supported devices, the Huawei P30 Pro is supported. Is that not expected?

Ohhh Sorry, The device is Honor 30 pro . Honor 30 pro is Not Supported.


Below are the issues I am currently facing

  1. The device supports ARCore, but what kind of status should be returned if the ARcore service is not installed?
  2. Devices that are not supported by installing the ARCore service via side load cannot detect that the device is a device that does not support ARCore
tdmowrer commented 3 years ago

The device supports ARCore, but what kind of status should be returned if the ARcore service is not installed?

It should be ARSessionState.NeedsInstall

Devices that are not supported by installing the ARCore service via side load cannot detect that the device is a device that does not support ARCore

That's true if AR is "required". AR "optional" apps should be able to detect this correctly.

If the Honor 30 pro is reporting it is supported when it is not, please provide the output of adb shell getprop ro.build.fingerprint.

weacw commented 3 years ago

fingerprint: HONOR/EBG-AN00/HWEBG:10/HUAWEIEBG-AN00/11.0.0.145C00:user/release-keys

weacw commented 3 years ago

The device supports ARCore, but what kind of status should be returned if the ARcore service is not installed?

It should be ARSessionState.NeedsInstall

Devices that are not supported by installing the ARCore service via side load cannot detect that the device is a device that does not support ARCore

That's true if AR is "required". AR "optional" apps should be able to detect this correctly.

If the Honor 30 pro is reporting it is supported when it is not, please provide the output of adb shell getprop ro.build.fingerprint.

Here's another device:Huawei DRA-AL00 ARCore has been installed.

I/native: arpresto_api.cc:30 ArPresto::ArPresto_initialize
I/native: arpresto_api.cc:77 ArPresto::ArPresto_checkApkAvailability
E/ActivityThread: Failed to find provider info for com.google.ar.core.services.arcorecontentprovider
I/ARCore-SetupContentResolver: Post-install failed
    java.lang.IllegalArgumentException: Unknown URI content://com.google.ar.core.services.arcorecontentprovider
        at android.content.ContentResolver.call(ContentResolver.java:1705)
        at com.google.ar.core.a.a(Unknown Source:38)
        at com.google.ar.core.k.checkAvailability(ArCoreApkImpl.java:7)
        at com.google.ar.core.ArCoreApkJniAdapter.checkAvailability(ArCoreApkJniAdapter.java:16)
        at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
        at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
        at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:166)
        at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
weacw commented 3 years ago

Supported device testing

The device supports ARCore, but what kind of status should be returned if the ARcore service is not installed?

Test Results:

The status is not ARSessionState.NeedsInstall, it's ARSessuiState.Unsupported. The result of checking availability is incorrect.

Logs of devices that support ARCore but not ARCore service installed:

I/native: arpresto_api.cc:30 ArPresto::ArPresto_initialize
D/AudioManager: getStreamVolume isRestricted mode = 0
I/native: arpresto_api.cc:77 ArPresto::ArPresto_checkApkAvailability
W/ARCore-InstallService: bindService returned false.
E/ARCore-InstallService: Play Store install service could not be bound.

Not Supported device testing

Devices that are not supported by installing the ARCore service via side load cannot detect that the device is a device that does not support ARCore AR "optional" apps should be able to detect this correctly.

Test Results:

Incorrect, When I install ARCore Services via side load, The result status of checking availability is ARSessuiState.Installing or ARSessuiState.Ready.

Testing Summary table:

Support Not Support
Installed Ready Ready/Installing/SessionInitializing
Not Installed Unsupported Unsupported
tdmowrer commented 3 years ago

When you side load an ARCore apk ("Google Play Services for AR"), then the app will always report that ARCore is at least supported, if not installed.

From the ARCore documentation:

Note: A result AR_AVAILABILITY_SUPPORTED_INSTALLED only indicates presence of a suitably versioned ARCore APK. Session creation may still fail if the ARCore APK has been side-loaded onto an unsupported device.

What is it exactly that you are trying to do? I'm not sure what you are trying to accomplish by side loading an ARCore APK onto an unsupported device.

weacw commented 3 years ago

When you side load an ARCore apk ("Google Play Services for AR"), then the app will always report that ARCore is at least supported, if not installed.

From the ARCore documentation:

Note: A result AR_AVAILABILITY_SUPPORTED_INSTALLED only indicates presence of a suitably versioned ARCore APK. Session creation may still fail if the ARCore APK has been side-loaded onto an unsupported device.

What is it exactly that you are trying to do? I'm not sure what you are trying to accomplish by side loading an ARCore APK onto an unsupported device.

Thank you for your reply and help.

I use ARFoundation as a module of native app, So the function of ARFoundation is optional. Of course, devices that do not support ARCore can also use the APP, When the user wants to use the ARFoundation module, the app needs to inform the user that your device does not support ARCore, and the device without ARCore needs to install ARCore(when support). But now, When users try to install the ARCore service by side load, a bug appears(black screen).

tdmowrer commented 3 years ago

Of course, devices that do not support ARCore can also use the APP, When the user wants to use the ARFoundation module, the app needs to inform the user that your device does not support ARCore, and the device without ARCore needs to install ARCore(when support).

That is true, and you should be able to test this flow without side loading the ARCore apk onto the device.

But now, When users try to install the ARCore service by side load, a bug appears(black screen).

If users side load ARCore onto an unsupported device, that will not work, and the behavior you are seeing is the expected behavior.

weacw commented 3 years ago

Of course, devices that do not support ARCore can also use the APP, When the user wants to use the ARFoundation module, the app needs to inform the user that your device does not support ARCore, and the device without ARCore needs to install ARCore(when support).

That is true, and you should be able to test this flow without side loading the ARCore apk onto the device.

But now, When users try to install the ARCore service by side load, a bug appears(black screen).

If users side load ARCore onto an unsupported device, that will not work, and the behavior you are seeing is the expected behavior.

Yep, I think this is an ARCore problem, not an ARFoundation problem. I found the same problem in arcore-unity-sdk

Thank you tdmowrer

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.