Core recovery files for the Team Win Recovery Project (T.W.R.P) - this is not up to date, please see https://github.com/TeamWin/android_bootable_recovery/
Can mDots[dot_idx].active be used instead? It gets set by ConnectDot and reset whenever the TOUCH_RELEASE event is fired. This will give you an instant lookup.
Even if this could be improved, it won't make any difference. The grid is tiny. Other things that are happening in every frame (like painting the actual dots) are several orders of magnitude more expensive.
Code in question: https://github.com/TeamWin/Team-Win-Recovery-Project/blob/7a48a664fd00a188044da348f34cc2e800b8a3fe/gui/patternpassword.cpp#L254
This code runs through the entire set of possible dots (mGridSize ^2) to check if the dot at index i is 'used' in the current pattern.
DotUsed
is called everyTOUCH_DRAG
event, which seems like it can quickly add up and slow things down:https://github.com/TeamWin/Team-Win-Recovery-Project/blob/7a48a664fd00a188044da348f34cc2e800b8a3fe/gui/patternpassword.cpp#L365
Can
mDots[dot_idx].active
be used instead? It gets set byConnectDot
and reset whenever theTOUCH_RELEASE
event is fired. This will give you an instant lookup.