tomthecarrot / arcore-for-all

Google ARCore (dev preview 1) for "unsupported" Android devices
GNU General Public License v3.0
1.04k stars 145 forks source link

An UNSUPPORTED holiday gift from the ARCore team #139

Open inio opened 5 years ago

inio commented 5 years ago

Seasons greetings!

First off, I want to apologize for nerfing this project with ARCore 1.2. It was an unfortunate side effect of some important changes we had to make and wasn't intended to limit exploration. We think it's cool that users are so excited about ARCore that they're willing to jump through hoops to use it.

Now, on with the gift:

Though undocumented and totally unsupported, ARCore version 1.6 will look for a file at /data/data/com.google.ar.core/files/custom_device_profile.textproto before trying to load a profile normally from the database. This file has the same format as any other device profile and can be injected on a an unrooted device by using the backup/restore mechanism provided by adb as follows:

  1. Install the 1.6 ARCore APK.
  2. Use adb backup to back up com.google.ar.core.
  3. modify the backup to add the device profile at apps/com.google.ar.core/f/custom_device_profile.textproto. android-backup-extractor may be useful in doing the backup modifications, but be careful of the file order (see the documentation).
  4. Restore the modified backup.

Unfortunately 1.6 adds a wrinkle when figuring out the nearest profile to start from: device profile names are obfuscated. Here's a couple common places to start with (warning: these will probably change with each release):

Device Name Obfuscated Name
Pixel 1U-j16
Pixel 2 ggXzI1
S8 Exynos: zIGRDW Qualcomm: ngqwNz
S7 Exynos: Wvs3US Qualcomm: y3dvz_
S7 Edge Exynos: Qk0fSK Qualcomm: 6xH1dn

To build a bigger table, you should be able to find a logcat message that reports the name of the profile loaded, so get at it 😉.

Two final notes:

First, this only works on devices where the ARCore background process can run. We've seen some devices (mostly in China) with a security mechanism that prevents background apps without a launcher icon from running. On these devices the ARCore runtime can't access the ARCore ContentProvider, which prevents reading the profile from ARCore's data directory.

Finally, we really only intended this mechanism for internal development use. We're mentioning it here because we see users super excited about running ARCore on additional devices, and agree that having to root your phone to do that is dumb. That said, we really only want to expose this to users already familiar with adb, side-loading, rooting, and the instability and wackyness that can arise from those things. Don't go out of your way to make it easy for novice users run ARCore on unsupported devices, and don't ask for support through official channels. If either of those start happening, we may have to cripple or remove this capability, and I think that's a loss for everyone involved.

WDog367 commented 4 years ago

Got this working, can confirm it still works for the latest apk (v1.17).

Also I figured out the source of the error Physical cameras don't match device profile. Camera not found. camera_id=1, cameras count=0 some people were seeing.

Based on the log files, arCore uses the native camera libraries. Native lib requires LIMTIED or better Camera2 Api support. You can check your phone with a hardware info app (e.g. Camera2 API Probe), if it says hardware support is LEGACY, then arCore can't see the cameras, and reports 0 camera found.

Although, apparently some phones can have proper Camera2 API support enabled. Something to look into if you really need ArCore running on your phone

GMAGD commented 3 years ago

i've tried this method and it work in redmi note 8 2021 but the camera is little bit dark and the tracking isn't the best

can anyone share with me the database profile for redmi note 8 @inio ?

Thank You :)