[MOD][Xposed] Knock Code (while screen on)

Search This thread

MohammadAG

Inactive Recognized Developer
Sep 7, 2009
1,080
5,504
30
Jerusalem
mohammadag.xceleo.org
Requires Xposed Framework!

This module allows you to add a knock code unlock method to your device's lock screen.
You will need to set the stock Android 3*3 grid pattern in settings, after that, set a knock code pattern in the app.

The default knock is:
1 2
3 4

If for any reason your code fails to load, use that.

If you made a mistake while entering the code, tap and hold to reset what you entered.

From a security point of view, this isn't the most secure way of locking your device. Due to the way Xposed works, the file where the code is stored is world-readable, meaning you don't even need root to read it. This means any app can read the code. A good way to reduce the exploit surface is to disable USB debugging, that way, chances of a local exploit are reduced.
The password is encrypted, but it's more of a way to make reading it harder, anyone slightly determined to get your code can.

* The module relies on the fact that a pattern is set, if any type of passcode is set, that type is shown. If Xposed is disabled through recovery or any other way, then the device falls back to this pattern method.

FAQ:
* Why can't I use this with the screen off?
That requires a custom kernel, it's very possible to do if your device already supports double tap to wake, but I won't dive into that.​
* Will you ever support 4.1 and below?
No, manufacturers had their own lock screens before 4.2, so adding support for those would be hard without an actual device. So this'll stay 4.2+ permanently.​

Video:
https://www.youtube.com/watch?v=hzUZOeD6n2Y

Screenshot:
ljo9TyZl.png


Compatibility:
4.2+ only.
Tested devices:
  • Sony Xperia 4.4
  • Samsung TouchWiz 4.4 (pre-S5, not sure if it'll work on the S5)
  • HTC Sense 6.

Download:
http://repo.xposed.info/module/com.mohammadag.knockcode

Source code:
https://github.com/MohammadAG/Xposed-Knock-Code

Support development:
If you found this mod useful, consider donating with PayPal.
 
Last edited:

MohammadAG

Inactive Recognized Developer
Sep 7, 2009
1,080
5,504
30
Jerusalem
mohammadag.xceleo.org
is not working I put a code and when I want to unlock phone it said that is incorrect!!


Sent from my SM-N900T using XDA Free mobile app

Reboot your device after the initial code is set. I've updated the first post to show that.

The default code is:
1 2
3 4

Sent from my HTC One_M8 using Tapatalk
 

sagi232123

Senior Member
Nov 3, 2009
102
8
Nice one , like it , Can use that on screen off ? i got CharizardX kernel based on franco nexus 5
 

vari9

Senior Member
May 4, 2011
1,073
95
Mumbai
Great mod!
Although beats the point of knock code if it can't work with screen off.

After several unsuccessful attempts.. It unlocks for a second automatically.
Also.. It reset my preferences of lines and fills once when I opened the app and changed nothing.. Closed locked. Also that time..knock code was changed to default.
Sent from my HTC One_M8 using Tapatalk
 
Last edited:

Tianhe

Senior Member
Mar 16, 2011
676
168
No effect on Stock Galaxy Grand Duos 4.2.2 (GT-I9082). Using Xposed 2.6 Rebooted device but it still shows pattern lock instead of Knock code lockscreen



Sent from my GT-I9082 using xda app-developers app
 
  • Like
Reactions: jokerhunter

Ahmato27

Senior Member
Mar 29, 2012
465
33
Melbourne
Pretty awesome!

But add an input resester so that if you accidently input the wrong code you can reset it to try again rather than relying the text that vaguely appears at the end of the code.

Sent from my HTC_0P6B using Tapatalk
 
  • Like
Reactions: tokkiying

RusherDude

Senior Member
Aug 24, 2012
2,013
623
Working only when the screen is on makes it even more nonsense :(. From a security point of view, normal unlock is way more secure than this.

If the app asked you to install a modified kernel (like Touchcontrol from bponury does) which permitted dp2w or something, this would become awesome.

Anyway, awesome job! :D

so ideas for making this better:
-1) Asking to install another kernel with dp2w or some and enabling it while offline.
-2) Permitting multiple combinations for different purposes (profiles? )
-3) Expanding the grid. Right now its 2x2 like the original LG feature. You could set a variable to make it 3x3, 4x4 tho it would be harder to find the tiles (refer to point 4).
-4) Make the space for the code tiles bigger (like in the LG, where the entire screen is divided into sections, the space to click right now on the lockscreen is like half screen which is really tiny for this purpose.


EDIT: Thought that Knock Code let it you have different codes for opening apps, dunno where I saw that but its not on the original code feature, my fail.

EDIT2: Just discovered that bponury went full retard and ****ed up TC. Not a good example anymore.
 
Last edited:
  • Like
Reactions: funCrash93

ykumar00

Senior Member
Jan 28, 2012
526
199
Samsung Galaxy S10+
Would is be possible to add screen off functionality for nexus 4 with franco kernel? It's one of the most popular ones, and has s2w (touchcontrol app). Thanks for this!
 

scissorscrush

Senior Member
Aug 18, 2013
382
49
Would is be possible to add screen off functionality for nexus 4 with franco kernel? It's one of the most popular ones, and has s2w (touchcontrol app). Thanks for this!

I support that. I think you guys should do a collaboration and make this feature more awesome!

Sent from my Nexus 4 using XDA Premium 4 mobile app
 

HaarisTheBoss

Senior Member
Mar 4, 2014
274
159
Bangalore
You could make it work over the lock screen for amoled devices since it doesn't use any battery for when it's black

Sent from my GT-I9300 using XDA Premium 4 mobile app
 

Ra2fet

Senior Member
Jul 5, 2013
494
1,459
Working great on S4

Sent from my GT-I9500 using XDA Premium 4 mobile app
 

Top Liked Posts