Skip to content

Commit

Permalink
camera: Document why we currently use the empty app id for host apps
Browse files Browse the repository at this point in the history
The app id detection is still unreliable and some backends do check if
the window matches the app id. Because that app id for host apps comes
from the app itself through wayland, the checks can fail.

For now we just disable app id detection for host apps for the camera
portal entirely. This should be removed when app id detection has become
more reliable.
  • Loading branch information
swick committed Dec 3, 2024
1 parent 6cd99b0 commit 7f47912
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ query_permission_sync (XdpRequest *request)
const char *app_id;
gboolean allowed;

/* The app id detection is still unreliable and some backends do check if the
* window matches the app id. Because that app id for host apps comes from the
* app itself through wayland, the checks can fail.
* This should be removed when app id detection has become more reliable.
*/
if (xdp_app_info_is_host (request->app_info))
app_id = "";
else
Expand Down
8 changes: 7 additions & 1 deletion tests/camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@ extern gchar *appid;
static void
set_camera_permissions (const char *permission)
{
const char *permission_app_id;
const char *permissions[2] = { NULL, NULL };
g_autoptr(GError) error = NULL;

/* x-d-p currently defaults to the empty app id for the camera portal for
* host XdpAppInfos (which the XdpAppInfoTest is). So instead of using the
* `extern gchar *appid` we have to use "" for now. */
permission_app_id = "";

permissions[0] = permission;
xdp_dbus_impl_permission_store_call_set_permission_sync (permission_store,
"devices",
TRUE,
"camera",
"",
permission_app_id,
permissions,
NULL,
&error);
Expand Down

0 comments on commit 7f47912

Please sign in to comment.