gui: PatternPassword: allow any N*N grid

Rather than only supporting a 3x3 grid, allow for multiple grid sizes
(using the CyanogenMod method of generating passphrases for non-3x3
grids). Also fix the detection of touches, as the old code was far too
sensitive for larger grids (and also didn't make much sense).

Change-Id: I343ef654e6d29ce0cb790a28281be7c7c9b171d9
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
diff --git a/gui/devices/watch/res/watch.xml b/gui/devices/watch/res/watch.xml
index 3adf164..2dc2912 100644
--- a/gui/devices/watch/res/watch.xml
+++ b/gui/devices/watch/res/watch.xml
@@ -58,6 +58,10 @@
 			<sort name="tw_gui_sort_order" />
 		</style>
 
+		<style name="patternpassword">
+			<size name="tw_gui_pattern_grid_size" default="3" />
+		</style>
+
 		<style name="partitionlist">
 			<style name="scrolllist" />
 			<icon selected="checkbox_true" unselected="checkbox_false" />
@@ -3379,6 +3383,8 @@
 				<text>Pattern Failed, Please Try Again</text>
 			</object>
 
+			<object type="template" name="pattern_options" />
+
 			<object type="patternpassword">
 				<placement x="%pattern_x%" y="%pattern_y%" w="%pattern_width%" h="%pattern_width%" />
 				<dot color="%pattern_dot_color%" activecolor="%pattern_dot_color_active%" radius="%pattern_dot_radius%" />