A little hack to unlock device from android using fingerprint authentication from QS tile
Needs ReviewPublic

Authored by bhav97 on May 14 2018, 4:26 PM.

Details

Reviewers
None
Group Reviewers
KDE Connect
Summary

It simply uses the RunCommand plugin to run commands named "unlock".

Test Plan

add command named "unlock" iin desktop app (eg "loginctl unlock-session" for plasma) > pair and connect with remote device > add tile

When device is locked
tap tile > unlock android to unlock device

When device is unlocked
tap tile > scan finger to unlock device

Diff Detail

Repository
R225 KDE Connect - Android application
Lint
Lint Skipped
Unit
Unit Tests Skipped
bhav97 created this revision.May 14 2018, 4:26 PM
Restricted Application added a subscriber: kdeconnect. · View Herald TranscriptMay 14 2018, 4:26 PM
bhav97 requested review of this revision.May 14 2018, 4:26 PM

Thanks for the patch! I left some inline comments. It's working good so far, but relying on the unlock command is too hacky IMHO. It should be no problem to port it into a proper plugin with a desktop counterpart that executes the unlocking. You can use the PingPlugin as a template for creating a plugin.

build.gradle
70 ↗(On Diff #34152)

Please remove those unrelated changes

src/org/kde/kdeconnect/Plugins/LockPlugin/LockHelper.java
181

Is this really necessary?

src/org/kde/kdeconnect/Plugins/LockPlugin/TileService.java
12 ↗(On Diff #34152)

Why not import?

14 ↗(On Diff #34152)

Could Lockhelper become a singleton?

22 ↗(On Diff #34152)

You can use a lambda here

bhav97 updated this revision to Diff 34178.May 15 2018, 7:50 AM
bhav97 marked 5 inline comments as done.
  • Added lock plugin for unlocking specifically
  • Old runcommand is still available till a desktop plugin is available
  • LockHelper is now a singleton
  • Used lambdas wherever possible
  • Revert unrelated changes in build.gradle

It seems like you just uploaded the changes to your last patch instead of all your changes. It's best to use arc to upload your patches, see https://community.kde.org/Infrastructure/Phabricator#Using_Arcanist_to_post_patches for an introduction

bhav97 updated this revision to Diff 34435.May 18 2018, 2:31 PM

I couldn't setup arcanist, so I squashed my commits into a single commit and updated using git diff. That should contain all my changes.

There already is a unlock plugin that you can use as desktop counterpart in the desktop repo. https://cgit.kde.org/kdeconnect-kde.git/tree/plugins/lockdevice To build it you must pass -DEXPERIMENTALAPP_ENABLED with the cmake command.

src/org/kde/kdeconnect/Plugins/LockPlugin/LockPlugin.java
38

I would say yes

src/org/kde/kdeconnect/Plugins/LockPlugin/LockTileService.java
77

Why two different unlockComputer()?

98

What does a do?

101

Where is the preference written?