Setting the proxy
The packagekitd daemon sets the network proxy for the packaging backend so that packages can be downloaded when on a corporate or managed network.
The session proxy is read by a session process that is started at login time, and then relayed to PackageKit. In GNOME, this is done by gnome-software, which reads the settings from GSettings, and executes SetProxy on org.freedesktop.packagekit1.
Note: this method is on the main interface, not a transaction interface. The rationale for this is that every client using PackageKit should not have to read and set the proxy at the start of each and every transaction, as this would make each transaction slower to startup, and also require each client to read and track the session proxy configuration.
To avoid this overhead, each session can register the proxy with the daemon once, and the daemon remembers it for the login session that it came from. When each transaction method is executed, the session that executed the call is used to look up the proxy settings and this is passed to the backend. This also allows the daemon to have the correct proxy settings if the daemon times out (as it is designed to do) and is restarted by a client application using D-Bus system activation.
The settings are stored in /run/packagekit/proxy-<session>, so they never
survive a reboot, and a new login session starts without a proxy until its
session process calls SetProxy again. Calling SetProxy with all values empty
removes the stored settings. Callers without a login session, such as system
services, are keyed by their uid instead.