gdm/util: Use fully async call to setup the fingerprint device proxy

Since fingerprint service can now be started also if a conversation has
already began, we can also initialize the proxy asynchronously, without
the risk that the service won't be started early enough.

As per this, remove the usage of FprintDeviceProxy wrapper completely
since it's just not giving us anything here.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2267>
This commit is contained in:
Marco Trevisan (Treviño) 2022-04-12 17:28:57 +02:00
parent ce03df5761
commit fa25156a6c

View File

@ -16,8 +16,8 @@ import * as SmartcardManager from '../misc/smartcardManager.js';
const FprintManagerInfo = Gio.DBusInterfaceInfo.new_for_xml( const FprintManagerInfo = Gio.DBusInterfaceInfo.new_for_xml(
loadInterfaceXML('net.reactivated.Fprint.Manager')); loadInterfaceXML('net.reactivated.Fprint.Manager'));
const FprintDeviceIface = loadInterfaceXML('net.reactivated.Fprint.Device'); const FprintDeviceInfo = Gio.DBusInterfaceInfo.new_for_xml(
const FprintDeviceProxy = Gio.DBusProxy.makeProxyWrapper(FprintDeviceIface); loadInterfaceXML('net.reactivated.Fprint.Device'));
Gio._promisify(Gdm.Client.prototype, 'open_reauthentication_channel'); Gio._promisify(Gdm.Client.prototype, 'open_reauthentication_channel');
Gio._promisify(Gdm.Client.prototype, 'get_user_verifier'); Gio._promisify(Gdm.Client.prototype, 'get_user_verifier');
@ -361,9 +361,8 @@ export class ShellUserVerifier extends Signals.EventEmitter {
const [devicePath] = fprintManager.GetDefaultDeviceSync(); const [devicePath] = fprintManager.GetDefaultDeviceSync();
this._fprintManager = fprintManager; this._fprintManager = fprintManager;
const fprintDeviceProxy = new FprintDeviceProxy(Gio.DBus.system, const fprintDeviceProxy = this._getFingerprintDeviceProxy(devicePath);
'net.reactivated.Fprint', devicePath, null, null, fprintDeviceProxy.init(null);
Gio.DBusProxyFlags.NOT_CONNECT_SIGNALS);
this._setFingerprintReaderType(fprintDeviceProxy['scan-type']); this._setFingerprintReaderType(fprintDeviceProxy['scan-type']);
} else { } else {
// Ensure fingerprint service starts, but do not wait for it // Ensure fingerprint service starts, but do not wait for it
@ -377,6 +376,17 @@ export class ShellUserVerifier extends Signals.EventEmitter {
} }
} }
_getFingerprintDeviceProxy(devicePath) {
return new Gio.DBusProxy({
g_connection: Gio.DBus.system,
g_name: 'net.reactivated.Fprint',
g_object_path: devicePath,
g_interface_name: FprintDeviceInfo.name,
g_interface_info: FprintDeviceInfo,
g_flags: Gio.DBusProxyFlags.DO_NOT_CONNECT_SIGNALS,
});
}
_handleFingerprintError(e) { _handleFingerprintError(e) {
this._fingerprintReaderType = FingerprintReaderType.NONE; this._fingerprintReaderType = FingerprintReaderType.NONE;
@ -409,9 +419,8 @@ export class ShellUserVerifier extends Signals.EventEmitter {
// Wrappers don't support null cancellable, so let's ignore it in case // Wrappers don't support null cancellable, so let's ignore it in case
const args = cancellable ? [cancellable] : []; const args = cancellable ? [cancellable] : [];
const [devicePath] = await fprintManager.GetDefaultDeviceAsync(...args); const [devicePath] = await fprintManager.GetDefaultDeviceAsync(...args);
const fprintDeviceProxy = new FprintDeviceProxy(Gio.DBus.system, const fprintDeviceProxy = this._getFingerprintDeviceProxy(devicePath);
'net.reactivated.Fprint', devicePath, null, cancellable, await fprintDeviceProxy.init_async(GLib.PRIORITY_DEFAULT, cancellable);
Gio.DBusProxyFlags.NOT_CONNECT_SIGNALS);
this._setFingerprintReaderType(fprintDeviceProxy['scan-type']); this._setFingerprintReaderType(fprintDeviceProxy['scan-type']);
this._updateDefaultService(); this._updateDefaultService();