Skip to content

Commit

Permalink
Update external camera app to use USB camera permission
Browse files Browse the repository at this point in the history
Summary: Add support for `horizonos.permission.USB_CAMERA` to the external camera app.

Reviewed By: enpe

Differential Revision: D66715046

fbshipit-source-id: ef866aa6c0172335ad985d825b0008a27f4836cf
  • Loading branch information
thorntondr authored and facebook-github-bot committed Dec 20, 2024
1 parent 1d5807b commit efa2aab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<uses-feature android:name="android.hardware.vr.headtracking" android:required="false" />

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="horizonos.permission.USB_CAMERA"/>

<uses-feature android:name="android.hardware.usb.host" />
<uses-feature android:name="android.hardware.camera" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,22 @@

using namespace Platform::Meta::Quest;

static std::string getUsbCameraPermissionName(struct android_app* androidApp)
{
if (androidApp->activity->sdkVersion >= 34)
{
return "horizonos.permission.USB_CAMERA";
}

return "android.permission.CAMERA";
}

ExternalCameraApplication::ExternalCameraApplication(struct android_app* androidApp) :
VRNativeApplicationAdvanced(androidApp)
{
Media::USB::registerUSBLibrary();

requestAndroidPermission("android.permission.CAMERA");
requestAndroidPermission(getUsbCameraPermissionName(androidApp));
}

XrSpace ExternalCameraApplication::baseSpace() const
Expand All @@ -34,7 +44,7 @@ void ExternalCameraApplication::onAndroidPermissionGranted(const std::string& pe
{
VRNativeApplicationAdvanced::onAndroidPermissionGranted(permission);

if (permission == "android.permission.CAMERA")
if (permission == getUsbCameraPermissionName(androidApp_))
{
Log::info() << "Camera permission granted";

Expand Down

0 comments on commit efa2aab

Please sign in to comment.