# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2018-2021 Mikhail Morfikov
# Copyright (C) 2022-2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{lib}/{,at-spi2{,-core}/}at-spi2-registryd
profile at-spi2-registryd /{,usr/}lib{,exec,32,64}/{,at-spi2{,-core}/}at-spi2-registryd  flags=(attach_disconnected,complain) {
  include <abstractions/base>
  include <abstractions/bus-accessibility>
  include <abstractions/bus-session>
  include <abstractions/bus/org.gnome.SessionManager>
  include <abstractions/X-strict>

  dbus bind bus=accessibility name=org.a11y.atspi.{R,r}egistry{,.*},
  dbus receive bus=accessibility path=/org/a11y/atspi/{R,r}egistry{,/**}
       interface=org.a11y.atspi.{R,r}egistry{,.*}
       peer=(name=":1.@{int}"),
  dbus receive bus=accessibility path=/org/a11y/atspi/{R,r}egistry{,/**}
       interface=org.freedesktop.DBus.Properties
       peer=(name=":1.@{int}"),
  dbus receive bus=accessibility path=/org/a11y/atspi/{R,r}egistry{,/**}
       interface=org.freedesktop.DBus.ObjectManager
       peer=(name=":1.@{int}"),
  dbus send bus=accessibility path=/org/a11y/atspi/{R,r}egistry{,/**}
       interface=org.a11y.atspi.{R,r}egistry{,.*}
       peer=(name="{:1.@{int},org.freedesktop.DBus}"),
  dbus send bus=accessibility path=/org/a11y/atspi/{R,r}egistry{,/**}
       interface=org.freedesktop.DBus.Properties
       peer=(name="{:1.@{int},org.freedesktop.DBus}"),
  dbus send bus=accessibility path=/org/a11y/atspi/{R,r}egistry{,/**}
       interface=org.freedesktop.DBus.ObjectManager
       peer=(name="{:1.@{int},org.freedesktop.DBus}"),
  dbus receive bus=accessibility path=/org/a11y/atspi/{R,r}egistry{,/**}
       interface=org.freedesktop.DBus.Introspectable
       member=Introspect
       peer=(name=":1.@{int}"),
  dbus send bus=accessibility path=/org/a11y/atspi/accessible/root
       interface=org.freedesktop.DBus.Properties
       member=Set
       peer=(name=:*),
  dbus receive bus=accessibility path=/org/a11y/atspi/accessible/root
       interface=org.a11y.atspi.Socket
       member=Embed
       peer=(name=:*),
  dbus receive bus=accessibility path=/org/a11y/atspi/registry/deviceeventcontroller
       interface=org.a11y.atspi.DeviceEventController
       member={GetKeystrokeListeners,GetDeviceEventListeners}
       peer=(name=:*),

  dbus send bus=session path=/org/a11y/bus
       interface=org.a11y.Bus
       member=GetAddress
       peer=(name=org.a11y.Bus, label=dbus-accessibility),

  dbus receive bus=session
       interface=org.freedesktop.DBus.Introspectable
       member=Introspect
       peer=(name=:*, label=gnome-shell),

  @{exec_path} mr,

  include if exists <local/at-spi2-registryd>
}
