Browse Source

Settings: forward port lock pattern grid size (2/2)

Fingerprint: Forward challenge extras

The forward port of custom pattern sizes introduced a bug that would
cause an NPE when trying to add a fingerprint for security. This patch
forwards the extras associated with the challenge that would have
normally been passed directly in to the ChooseLockPattern fragment.

TICKET: CYNGNOS-1490

Settings: forward decrypt required on boot flag

This wasn't being pass forward and all of the defaults had it set to
true.

Ticket: CYNGNOS-2270
Signed-off-by: Roman Birg <roman@cyngn.com>

Settings: allow rotation while setting new pattern

Signed-off-by: Roman Birg <roman@cyngn.com>

Settings: use the actual user id to set pattern size

Ticket: CYNGNOS-2462

Settings: handle decrypting larger pattern sizes

Signed-off-by: Roman Birg <roman@cyngn.com>

CryptKeeper: pattern unlock displays incorrect pw when correct

fakeUnlockAttempt() gets called when the user inputs any pattern length
< 4 which queues up the 'incorrect error' message. The message needs to
be cleared before trying to actually check the password so it never goes
through in case the password was correct.

Signed-off-by: Roman Birg <roman@cyngn.com>

Settings: fix non lock pattern CryptKeeper crash

Signed-off-by: Roman Birg <roman@cyngn.com>

CryptKeeper: layout whole screen in bounds

Add flags to make the screen layout properly on devices with the
navigation bar visible

Signed-off-by: Roman Birg <roman@cyngn.com>

CryptKeeper improvements

- Status text was used enough to warrant it being a field variable
  instead of looking for the view every time

- Display proper text after changing pattern sizes (to input a pattern,
  not a password)

- Disable changing pattern sizes while validaing pattern

REFS: LETTUCE-557, LETTUCE-352
Signed-off-by: Roman Birg <roman@cyngn.com>

Settings: Use GLIF Theme for missing Settings > Screen lock Activities

Icons by Asher

Change-Id: Icf1627b41ef604302a5819ad3b1bdfd6d8479202

Change-Id: I7078d703c218cd096d9b77c003a94b52fbce6322
Michael Bestas 5 years ago
parent
commit
94930fe590

+ 4
- 0
AndroidManifest.xml View File

@@ -1776,6 +1776,10 @@
1776 1776
             android:label="@string/lockpassword_choose_lock_generic_header"
1777 1777
             android:excludeFromRecents="true" />
1778 1778
 
1779
+        <activity android:name=".password.ChooseLockPatternSize"
1780
+            android:exported="false"
1781
+            android:theme="@style/GlifTheme.Light" />
1782
+
1779 1783
         <activity android:name=".password.SetupChooseLockPattern"
1780 1784
             android:exported="false"
1781 1785
             android:taskAffinity="com.android.wizard"

+ 26
- 0
res/drawable/ic_security_pattern_3x3.xml View File

@@ -0,0 +1,26 @@
1
+<!--
2
+     Copyright (C) 2016 The CyanogenMod Project
3
+
4
+     Licensed under the Apache License, Version 2.0 (the "License");
5
+     you may not use this file except in compliance with the License.
6
+     You may obtain a copy of the License at
7
+
8
+          http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+     Unless required by applicable law or agreed to in writing, software
11
+     distributed under the License is distributed on an "AS IS" BASIS,
12
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+     See the License for the specific language governing permissions and
14
+     limitations under the License.
15
+-->
16
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
17
+        android:width="24dp"
18
+        android:height="24dp"
19
+        android:viewportWidth="24.0"
20
+        android:viewportHeight="24.0">
21
+    <path
22
+        android:pathData="M4,17.268C3.402,17.613 3,18.26 3,19C3,20.105 3.895,21 5,21C5.74,21 6.387,20.598 6.732,20L9.268,20C9.613,20.598 10.26,21 11,21C12.105,21 13,20.105 13,19C13,17.895 12.105,17 11,17C10.26,17 9.613,17.402 9.268,18L6.732,18C6.557,17.696 6.304,17.443 6,17.268L6,14.732C6.598,14.387 7,13.74 7,13C7,11.895 6.105,11 5,11C3.895,11 3,11.895 3,13C3,13.74 3.402,14.387 4,14.732L4,17.268ZM21,11L21,9.5C21,8.67 20.33,8 19.5,8C20.33,8 21,7.33 21,6.5L21,5C21,3.89 20.1,3 19,3L15,3L15,5L19,5L19,7L17,7L17,9L19,9L19,11L15,11L15,13L19,13C20.1,13 21,12.11 21,11ZM5,9C6.105,9 7,8.105 7,7C7,5.895 6.105,5 5,5C3.895,5 3,5.895 3,7C3,8.105 3.895,9 5,9ZM11,9C12.105,9 13,8.105 13,7C13,5.895 12.105,5 11,5C9.895,5 9,5.895 9,7C9,8.105 9.895,9 11,9ZM11,15C12.105,15 13,14.105 13,13C13,11.895 12.105,11 11,11C9.895,11 9,11.895 9,13C9,14.105 9.895,15 11,15ZM17,21C18.105,21 19,20.105 19,19C19,17.895 18.105,17 17,17C15.895,17 15,17.895 15,19C15,20.105 15.895,21 17,21Z"
23
+        android:strokeColor="#00000000"
24
+        android:fillColor="#777777"
25
+        android:strokeWidth="1"/>
26
+</vector>

+ 26
- 0
res/drawable/ic_security_pattern_4x4.xml View File

@@ -0,0 +1,26 @@
1
+<!--
2
+     Copyright (C) 2016 The CyanogenMod Project
3
+
4
+     Licensed under the Apache License, Version 2.0 (the "License");
5
+     you may not use this file except in compliance with the License.
6
+     You may obtain a copy of the License at
7
+
8
+          http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+     Unless required by applicable law or agreed to in writing, software
11
+     distributed under the License is distributed on an "AS IS" BASIS,
12
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+     See the License for the specific language governing permissions and
14
+     limitations under the License.
15
+-->
16
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
17
+        android:width="24dp"
18
+        android:height="24dp"
19
+        android:viewportWidth="24.0"
20
+        android:viewportHeight="24.0">
21
+    <path
22
+        android:pathData="M4,17.268C3.402,17.613 3,18.26 3,19C3,20.105 3.895,21 5,21C5.74,21 6.387,20.598 6.732,20L9.268,20C9.613,20.598 10.26,21 11,21C12.105,21 13,20.105 13,19C13,17.895 12.105,17 11,17C10.26,17 9.613,17.402 9.268,18L6.732,18C6.557,17.696 6.304,17.443 6,17.268L6,14.732C6.598,14.387 7,13.74 7,13C7,11.895 6.105,11 5,11C3.895,11 3,11.895 3,13C3,13.74 3.402,14.387 4,14.732L4,17.268ZM21,13L21,3L19,3L19,7L17,7L17,3L15,3L15,9L19,9L19,13L21,13ZM5,9C6.105,9 7,8.105 7,7C7,5.895 6.105,5 5,5C3.895,5 3,5.895 3,7C3,8.105 3.895,9 5,9ZM11,9C12.105,9 13,8.105 13,7C13,5.895 12.105,5 11,5C9.895,5 9,5.895 9,7C9,8.105 9.895,9 11,9ZM11,15C12.105,15 13,14.105 13,13C13,11.895 12.105,11 11,11C9.895,11 9,11.895 9,13C9,14.105 9.895,15 11,15ZM17,21C18.105,21 19,20.105 19,19C19,17.895 18.105,17 17,17C15.895,17 15,17.895 15,19C15,20.105 15.895,21 17,21Z"
23
+        android:strokeColor="#00000000"
24
+        android:fillColor="#777777"
25
+        android:strokeWidth="1"/>
26
+</vector>

+ 26
- 0
res/drawable/ic_security_pattern_5x5.xml View File

@@ -0,0 +1,26 @@
1
+<!--
2
+     Copyright (C) 2016 The CyanogenMod Project
3
+
4
+     Licensed under the Apache License, Version 2.0 (the "License");
5
+     you may not use this file except in compliance with the License.
6
+     You may obtain a copy of the License at
7
+
8
+          http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+     Unless required by applicable law or agreed to in writing, software
11
+     distributed under the License is distributed on an "AS IS" BASIS,
12
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+     See the License for the specific language governing permissions and
14
+     limitations under the License.
15
+-->
16
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
17
+        android:width="24dp"
18
+        android:height="24dp"
19
+        android:viewportWidth="24.0"
20
+        android:viewportHeight="24.0">
21
+    <path
22
+        android:pathData="M4,17.268C3.402,17.613 3,18.26 3,19C3,20.105 3.895,21 5,21C5.74,21 6.387,20.598 6.732,20L9.268,20C9.613,20.598 10.26,21 11,21C12.105,21 13,20.105 13,19C13,17.895 12.105,17 11,17C10.26,17 9.613,17.402 9.268,18L6.732,18C6.557,17.696 6.304,17.443 6,17.268L6,14.732C6.598,14.387 7,13.74 7,13C7,11.895 6.105,11 5,11C3.895,11 3,11.895 3,13C3,13.74 3.402,14.387 4,14.732L4,17.268ZM21,11L21,9C21,7.89 20.1,7 19,7L17,7L17,5L21,5L21,3L15,3L15,9L19,9L19,11L15,11L15,13L19,13C20.1,13 21,12.11 21,11ZM5,9C6.105,9 7,8.105 7,7C7,5.895 6.105,5 5,5C3.895,5 3,5.895 3,7C3,8.105 3.895,9 5,9ZM11,9C12.105,9 13,8.105 13,7C13,5.895 12.105,5 11,5C9.895,5 9,5.895 9,7C9,8.105 9.895,9 11,9ZM11,15C12.105,15 13,14.105 13,13C13,11.895 12.105,11 11,11C9.895,11 9,11.895 9,13C9,14.105 9.895,15 11,15ZM17,21C18.105,21 19,20.105 19,19C19,17.895 18.105,17 17,17C15.895,17 15,17.895 15,19C15,20.105 15.895,21 17,21Z"
23
+        android:strokeColor="#00000000"
24
+        android:fillColor="#777777"
25
+        android:strokeWidth="1"/>
26
+</vector>

+ 26
- 0
res/drawable/ic_security_pattern_6x6.xml View File

@@ -0,0 +1,26 @@
1
+<!--
2
+     Copyright (C) 2016 The CyanogenMod Project
3
+
4
+     Licensed under the Apache License, Version 2.0 (the "License");
5
+     you may not use this file except in compliance with the License.
6
+     You may obtain a copy of the License at
7
+
8
+          http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+     Unless required by applicable law or agreed to in writing, software
11
+     distributed under the License is distributed on an "AS IS" BASIS,
12
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+     See the License for the specific language governing permissions and
14
+     limitations under the License.
15
+-->
16
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
17
+        android:width="24dp"
18
+        android:height="24dp"
19
+        android:viewportWidth="24.0"
20
+        android:viewportHeight="24.0">
21
+    <path
22
+        android:pathData="M17,13L19,13C20.1,13 21,12.11 21,11L21,9C21,7.89 20.1,7 19,7L17,7L17,5L21,5L21,3L17,3C15.9,3 15,3.89 15,5L15,11C15,12.11 15.9,13 17,13L17,13ZM4,17.268C3.402,17.613 3,18.26 3,19C3,20.105 3.895,21 5,21C5.74,21 6.387,20.598 6.732,20L9.268,20C9.613,20.598 10.26,21 11,21C12.105,21 13,20.105 13,19C13,17.895 12.105,17 11,17C10.26,17 9.613,17.402 9.268,18L6.732,18C6.557,17.696 6.304,17.443 6,17.268L6,14.732C6.598,14.387 7,13.74 7,13C7,11.895 6.105,11 5,11C3.895,11 3,11.895 3,13C3,13.74 3.402,14.387 4,14.732L4,17.268ZM17,9L19,9L19,11L17,11L17,9ZM5,9C6.105,9 7,8.105 7,7C7,5.895 6.105,5 5,5C3.895,5 3,5.895 3,7C3,8.105 3.895,9 5,9ZM11,9C12.105,9 13,8.105 13,7C13,5.895 12.105,5 11,5C9.895,5 9,5.895 9,7C9,8.105 9.895,9 11,9ZM11,15C12.105,15 13,14.105 13,13C13,11.895 12.105,11 11,11C9.895,11 9,11.895 9,13C9,14.105 9.895,15 11,15ZM17,21C18.105,21 19,20.105 19,19C19,17.895 18.105,17 17,17C15.895,17 15,17.895 15,19C15,20.105 15.895,21 17,21Z"
23
+        android:strokeColor="#00000000"
24
+        android:fillColor="#777777"
25
+        android:strokeWidth="1"/>
26
+</vector>

+ 11
- 0
res/layout-sw600dp/crypt_keeper_pattern_entry.xml View File

@@ -36,6 +36,17 @@
36 36
 
37 37
     </LinearLayout>
38 38
 
39
+    <LinearLayout
40
+        android:id="@+id/pattern_sizes"
41
+        android:layout_width="@dimen/crypt_keeper_pattern_size"
42
+        android:layout_height="@dimen/crypt_keeper_pattern_size"
43
+        android:orientation="horizontal"
44
+        android:layout_gravity="center_horizontal">
45
+
46
+        <include layout="@layout/crypt_keeper_pattern_sizes" />
47
+
48
+    </LinearLayout>
49
+
39 50
     <include layout="@layout/crypt_keeper_emergency_button" />
40 51
 
41 52
 </LinearLayout>

+ 25
- 0
res/layout/choose_lock_pattern_size_header.xml View File

@@ -0,0 +1,25 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<!-- Copyright (C) 2016 The CyanogenMod Project
3
+
4
+     Licensed under the Apache License, Version 2.0 (the "License");
5
+     you may not use this file except in compliance with the License.
6
+     You may obtain a copy of the License at
7
+
8
+          http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+     Unless required by applicable law or agreed to in writing, software
11
+     distributed under the License is distributed on an "AS IS" BASIS,
12
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+     See the License for the specific language governing permissions and
14
+     limitations under the License.
15
+-->
16
+
17
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
18
+    android:layout_width="match_parent"
19
+    android:layout_height="wrap_content"
20
+    android:gravity="center_vertical"
21
+    android:minHeight="56dp"
22
+    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
23
+    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
24
+    android:text="@string/lock_settings_picker_pattern_size_message"
25
+    style="@style/LockPatternSizeHeaderStyle" />

+ 12
- 0
res/layout/crypt_keeper_pattern_entry.xml View File

@@ -36,6 +36,18 @@
36 36
 
37 37
     </LinearLayout>
38 38
 
39
+    <LinearLayout
40
+        android:id="@+id/pattern_sizes"
41
+        android:layout_width="match_parent"
42
+        android:layout_height="wrap_content"
43
+        android:layout_marginStart="@dimen/crypt_keeper_pattern_margin"
44
+        android:layout_marginEnd="@dimen/crypt_keeper_pattern_margin"
45
+        android:orientation="horizontal">
46
+
47
+        <include layout="@layout/crypt_keeper_pattern_sizes" />
48
+
49
+    </LinearLayout>
50
+
39 51
     <include layout="@layout/crypt_keeper_emergency_button" />
40 52
 
41 53
 </LinearLayout>

+ 69
- 0
res/layout/crypt_keeper_pattern_sizes.xml View File

@@ -0,0 +1,69 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<!--
3
+     Copyright (C) 2015 The CyanogenMod Project
4
+
5
+     Licensed under the Apache License, Version 2.0 (the "License");
6
+     you may not use this file except in compliance with the License.
7
+     You may obtain a copy of the License at
8
+
9
+          http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+     Unless required by applicable law or agreed to in writing, software
12
+     distributed under the License is distributed on an "AS IS" BASIS,
13
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+     See the License for the specific language governing permissions and
15
+     limitations under the License.
16
+-->
17
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
18
+
19
+    <Button
20
+            android:id="@+id/lock_pattern_size_3"
21
+            android:layout_width="0dp"
22
+            android:layout_height="wrap_content"
23
+            android:layout_gravity="center_horizontal"
24
+            android:textSize="14sp"
25
+            android:fontFamily="sans-serif"
26
+            android:text="@string/lock_pattern_size_3"
27
+            android:textColor="@android:color/white"
28
+            android:layout_weight="1"
29
+            style="?android:attr/borderlessButtonStyle"/>
30
+
31
+    <Button
32
+            android:id="@+id/lock_pattern_size_4"
33
+            android:layout_width="0dp"
34
+            android:layout_height="wrap_content"
35
+            android:layout_gravity="center_horizontal"
36
+            android:textSize="14sp"
37
+            android:fontFamily="sans-serif"
38
+            android:text="@string/lock_pattern_size_4"
39
+            android:textColor="@android:color/white"
40
+            android:layout_weight="1"
41
+            style="?android:attr/borderlessButtonStyle"/>
42
+
43
+    <Button
44
+            android:id="@+id/lock_pattern_size_5"
45
+            android:layout_width="0dp"
46
+            android:layout_height="wrap_content"
47
+            android:layout_gravity="center_horizontal"
48
+            android:textSize="14sp"
49
+            android:fontFamily="sans-serif"
50
+            android:text="@string/lock_pattern_size_5"
51
+            android:textColor="@android:color/white"
52
+            android:layout_weight="1"
53
+            style="?android:attr/borderlessButtonStyle"/>
54
+
55
+    <Button
56
+            android:id="@+id/lock_pattern_size_6"
57
+            android:layout_width="0dp"
58
+            android:layout_height="wrap_content"
59
+            android:layout_gravity="center_horizontal"
60
+            android:textSize="14sp"
61
+            android:fontFamily="sans-serif"
62
+            android:text="@string/lock_pattern_size_6"
63
+            android:textColor="@android:color/white"
64
+            android:layout_weight="1"
65
+            style="?android:attr/borderlessButtonStyle"/>
66
+
67
+
68
+</merge >
69
+

+ 16
- 0
res/values/cm_strings.xml View File

@@ -20,6 +20,22 @@
20 20
     <string name="advanced_reboot_title">Advanced restart</string>
21 21
     <string name="advanced_reboot_summary">When unlocked, include options in the power menu for restarting into recovery or bootloader</string>
22 22
 
23
+    <!-- Sizes for pattern lockscreen -->
24
+    <string name="lock_pattern_size_3" translatable="false">3 \u00d7 3</string>
25
+    <string name="lock_pattern_size_4" translatable="false">4 \u00d7 4</string>
26
+    <string name="lock_pattern_size_5" translatable="false">5 \u00d7 5</string>
27
+    <string name="lock_pattern_size_6" translatable="false">6 \u00d7 6</string>
28
+
29
+    <string name="lock_settings_picker_pattern_size_message">Choose a pattern size</string>
30
+    <!-- Whether a visible red line will be drawn after the user has drawn the unlock pattern incorrectly -->
31
+    <string name="lockpattern_settings_enable_error_path_title">Show pattern error</string>
32
+    <!-- Whether the dots will be drawn when using the lockscreen pattern -->
33
+    <string name="lockpattern_settings_enable_dots_title">Show pattern dots</string>
34
+
35
+    <!-- Lock screen vibrate settings -->
36
+    <string name="lockscreen_vibrate_enabled_title">Vibrate</string>
37
+    <string name="lockscreen_vibrate_enabled_head">Vibrate when unlocking</string>
38
+
23 39
     <!-- Android debugging -->
24 40
     <string name="adb_enable">Android debugging</string>
25 41
     <string name="adb_enable_summary">Enable the Android Debug Bridge (ADB) interface</string>

+ 23
- 0
res/values/lineage_styles.xml View File

@@ -0,0 +1,23 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<!--
3
+     Copyright (C) 2018 The LineageOS Project
4
+
5
+     Licensed under the Apache License, Version 2.0 (the "License");
6
+     you may not use this file except in compliance with the License.
7
+     You may obtain a copy of the License at
8
+
9
+          http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+     Unless required by applicable law or agreed to in writing, software
12
+     distributed under the License is distributed on an "AS IS" BASIS,
13
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+     See the License for the specific language governing permissions and
15
+     limitations under the License.
16
+-->
17
+<resources>
18
+    <style name="LockPatternSizeHeaderStyle" parent="android:style/TextAppearance.Material.Subhead">
19
+        <item name="android:paddingTop">16dp</item>
20
+        <item name="android:textColor">@color/primary_dark_material_light</item>
21
+        <item name="android:lineSpacingMultiplier">1.2</item>
22
+    </style>
23
+</resources>

+ 44
- 0
res/xml/security_settings_pattern_size.xml View File

@@ -0,0 +1,44 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<!--
3
+     Copyright (C) 2012-2013 The CyanogenMod Project
4
+
5
+     Licensed under the Apache License, Version 2.0 (the "License");
6
+     you may not use this file except in compliance with the License.
7
+     You may obtain a copy of the License at
8
+
9
+          http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+     Unless required by applicable law or agreed to in writing, software
12
+     distributed under the License is distributed on an "AS IS" BASIS,
13
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+     See the License for the specific language governing permissions and
15
+     limitations under the License.
16
+-->
17
+<PreferenceScreen
18
+    xmlns:android="http://schemas.android.com/apk/res/android">
19
+
20
+    <Preference
21
+        android:icon="@drawable/ic_security_pattern_3x3"
22
+        android:key="lock_pattern_size_3"
23
+        android:title="@string/lock_pattern_size_3"
24
+        android:persistent="false"/>
25
+
26
+    <Preference
27
+        android:icon="@drawable/ic_security_pattern_4x4"
28
+        android:key="lock_pattern_size_4"
29
+        android:title="@string/lock_pattern_size_4"
30
+        android:persistent="false"/>
31
+
32
+    <Preference
33
+        android:icon="@drawable/ic_security_pattern_5x5"
34
+        android:key="lock_pattern_size_5"
35
+        android:title="@string/lock_pattern_size_5"
36
+        android:persistent="false"/>
37
+
38
+    <Preference
39
+        android:icon="@drawable/ic_security_pattern_6x6"
40
+        android:key="lock_pattern_size_6"
41
+        android:title="@string/lock_pattern_size_6"
42
+        android:persistent="false"/>
43
+
44
+</PreferenceScreen>

+ 88
- 19
src/com/android/settings/CryptKeeper.java View File

@@ -51,6 +51,7 @@ import android.view.View;
51 51
 import android.view.View.OnClickListener;
52 52
 import android.view.View.OnKeyListener;
53 53
 import android.view.View.OnTouchListener;
54
+import android.view.ViewGroup;
54 55
 import android.view.WindowManager;
55 56
 import android.view.inputmethod.EditorInfo;
56 57
 import android.view.inputmethod.InputMethodInfo;
@@ -67,6 +68,7 @@ import com.android.internal.widget.LockPatternView.Cell;
67 68
 import com.android.internal.widget.LockPatternView.DisplayMode;
68 69
 import com.android.settings.widget.ImeAwareEditText;
69 70
 
71
+import java.util.ArrayList;
70 72
 import java.util.List;
71 73
 
72 74
 /**
@@ -83,7 +85,7 @@ import java.util.List;
83 85
  * </pre>
84 86
  */
85 87
 public class CryptKeeper extends Activity implements TextView.OnEditorActionListener,
86
-        OnKeyListener, OnTouchListener, TextWatcher {
88
+        OnKeyListener, OnTouchListener, TextWatcher, OnClickListener {
87 89
     private static final String TAG = "CryptKeeper";
88 90
 
89 91
     private static final String DECRYPT_STATE = "trigger_restart_framework";
@@ -124,6 +126,15 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
124 126
     PowerManager.WakeLock mWakeLock;
125 127
     private ImeAwareEditText mPasswordEntry;
126 128
     private LockPatternView mLockPatternView;
129
+    private TextView mStatusText;
130
+    private List<Button> mLockPatternButtons = new ArrayList<>();
131
+    private static final int[] LOCK_BUTTON_IDS = new int[] {
132
+            R.id.lock_pattern_size_3,
133
+            R.id.lock_pattern_size_4,
134
+            R.id.lock_pattern_size_5,
135
+            R.id.lock_pattern_size_6
136
+    };
137
+
127 138
     /** Number of calls to {@link #notifyUser()} to ignore before notifying. */
128 139
     private int mNotificationCountdown = 0;
129 140
     /** Number of calls to {@link #notifyUser()} before we release the wakelock */
@@ -177,6 +188,9 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
177 188
         @Override
178 189
         protected void onPreExecute() {
179 190
             super.onPreExecute();
191
+            if (mLockPatternView != null) {
192
+                mLockPatternView.removeCallbacks(mFakeUnlockAttemptRunnable);
193
+            }
180 194
             beginAttempt();
181 195
         }
182 196
 
@@ -200,13 +214,13 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
200 214
                     mLockPatternView.removeCallbacks(mClearPatternRunnable);
201 215
                     mLockPatternView.postDelayed(mClearPatternRunnable, RIGHT_PATTERN_CLEAR_TIMEOUT_MS);
202 216
                 }
203
-                final TextView status = (TextView) findViewById(R.id.status);
204
-                status.setText(R.string.starting_android);
217
+                mStatusText.setText(R.string.starting_android);
205 218
                 hide(R.id.passwordEntry);
206 219
                 hide(R.id.switch_ime_button);
207 220
                 hide(R.id.lockPattern);
208 221
                 hide(R.id.owner_info);
209 222
                 hide(R.id.emergencyCallButton);
223
+                hide(R.id.pattern_sizes);
210 224
             } else if (failedAttempts == MAX_FAILED_ATTEMPTS) {
211 225
                 // Factory reset the device.
212 226
                 Intent intent = new Intent(Intent.ACTION_FACTORY_RESET);
@@ -226,8 +240,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
226 240
     }
227 241
 
228 242
     private void beginAttempt() {
229
-        final TextView status = (TextView) findViewById(R.id.status);
230
-        status.setText(R.string.checking_decryption);
243
+        mStatusText.setText(R.string.checking_decryption);
231 244
     }
232 245
 
233 246
     private void handleBadAttempt(Integer failedAttempts) {
@@ -243,14 +256,12 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
243 256
             // at this point.
244 257
             cooldown();
245 258
         } else {
246
-            final TextView status = (TextView) findViewById(R.id.status);
247
-
248 259
             int remainingAttempts = MAX_FAILED_ATTEMPTS - failedAttempts;
249 260
             if (remainingAttempts < COOL_DOWN_ATTEMPTS) {
250 261
                 CharSequence warningTemplate = getText(R.string.crypt_keeper_warn_wipe);
251 262
                 CharSequence warning = TextUtils.expandTemplate(warningTemplate,
252 263
                         Integer.toString(remainingAttempts));
253
-                status.setText(warning);
264
+                mStatusText.setText(warning);
254 265
             } else {
255 266
                 int passwordType = StorageManager.CRYPT_TYPE_PASSWORD;
256 267
                 try {
@@ -261,17 +272,18 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
261 272
                 }
262 273
 
263 274
                 if (passwordType == StorageManager.CRYPT_TYPE_PIN) {
264
-                    status.setText(R.string.cryptkeeper_wrong_pin);
275
+                    mStatusText.setText(R.string.cryptkeeper_wrong_pin);
265 276
                 } else if (passwordType == StorageManager.CRYPT_TYPE_PATTERN) {
266
-                    status.setText(R.string.cryptkeeper_wrong_pattern);
277
+                    mStatusText.setText(R.string.cryptkeeper_wrong_pattern);
267 278
                 } else {
268
-                    status.setText(R.string.cryptkeeper_wrong_password);
279
+                    mStatusText.setText(R.string.cryptkeeper_wrong_password);
269 280
                 }
270 281
             }
271 282
 
272 283
             if (mLockPatternView != null) {
273 284
                 mLockPatternView.setDisplayMode(DisplayMode.Wrong);
274 285
                 mLockPatternView.setEnabled(true);
286
+                setPatternButtonsEnabled(true);
275 287
             }
276 288
 
277 289
             // Reenable the password entry
@@ -399,6 +411,13 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
399 411
     public void onCreate(Bundle savedInstanceState) {
400 412
         super.onCreate(savedInstanceState);
401 413
 
414
+        getWindow().getDecorView().setSystemUiVisibility(
415
+                View.SYSTEM_UI_FLAG_LAYOUT_STABLE
416
+                        | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
417
+                        | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
418
+                        | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
419
+                        | View.SYSTEM_UI_FLAG_IMMERSIVE);
420
+
402 421
         // If we are not encrypted or encrypting, get out quickly.
403 422
         final String state = SystemProperties.get("vold.decrypt");
404 423
         if (!isDebugView() && ("".equals(state) || DECRYPT_STATE.equals(state))) {
@@ -510,8 +529,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
510 529
                         setContentView(R.layout.crypt_keeper_password_entry);
511 530
                         mStatusString = R.string.enter_password;
512 531
                     }
513
-                    final TextView status = (TextView) findViewById(R.id.status);
514
-                    status.setText(mStatusString);
532
+                    mStatusText.setText(mStatusString);
515 533
 
516 534
                     final TextView ownerInfo = (TextView) findViewById(R.id.owner_info);
517 535
                     ownerInfo.setText(owner_info);
@@ -570,6 +588,12 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
570 588
         }
571 589
     }
572 590
 
591
+    @Override
592
+    public void setContentView(int layoutResID) {
593
+        super.setContentView(layoutResID);
594
+        mStatusText = (TextView) findViewById(R.id.status);
595
+    }
596
+
573 597
     /**
574 598
      * Start encrypting the device.
575 599
      */
@@ -669,9 +693,8 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
669 693
             // Will happen if no time etc - show percentage
670 694
         }
671 695
 
672
-        final TextView tv = (TextView) findViewById(R.id.status);
673
-        if (tv != null) {
674
-            tv.setText(TextUtils.expandTemplate(status, progress));
696
+        if (mStatusText != null) {
697
+            mStatusText.setText(TextUtils.expandTemplate(status, progress));
675 698
         }
676 699
 
677 700
         // Check the progress every 1 seconds
@@ -689,10 +712,10 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
689 712
         }
690 713
         if (mLockPatternView != null) {
691 714
             mLockPatternView.setEnabled(false);
715
+            setPatternButtonsEnabled(false);
692 716
         }
693 717
 
694
-        final TextView status = (TextView) findViewById(R.id.status);
695
-        status.setText(R.string.crypt_keeper_force_power_cycle);
718
+        mStatusText.setText(R.string.crypt_keeper_force_power_cycle);
696 719
     }
697 720
 
698 721
     /**
@@ -717,18 +740,21 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
717 740
 
718 741
         @Override
719 742
         public void onPatternStart() {
743
+            setPatternButtonsEnabled(false);
720 744
             mLockPatternView.removeCallbacks(mClearPatternRunnable);
721 745
         }
722 746
 
723 747
         @Override
724 748
         public void onPatternCleared() {
749
+            setPatternButtonsEnabled(true);
725 750
         }
726 751
 
727 752
         @Override
728 753
         public void onPatternDetected(List<LockPatternView.Cell> pattern) {
729 754
             mLockPatternView.setEnabled(false);
730 755
             if (pattern.size() >= MIN_LENGTH_BEFORE_REPORT) {
731
-                new DecryptTask().execute(LockPatternUtils.patternToString(pattern));
756
+                byte patternSize = mLockPatternView.getLockPatternSize();
757
+                new DecryptTask().execute(LockPatternUtils.patternToString(pattern, patternSize));
732 758
             } else {
733 759
                 // Allow user to make as many of these as they want.
734 760
                 fakeUnlockAttempt(mLockPatternView);
@@ -753,9 +779,17 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
753 779
         }
754 780
 
755 781
         // Pattern case
782
+        mLockPatternButtons.clear();
756 783
         mLockPatternView = (LockPatternView) findViewById(R.id.lockPattern);
757 784
         if (mLockPatternView != null) {
758 785
             mLockPatternView.setOnPatternListener(mChooseNewLockPatternListener);
786
+            for (int id : LOCK_BUTTON_IDS) {
787
+                Button btn = (Button) findViewById(id);
788
+                if (btn != null) {
789
+                    btn.setOnClickListener(this);
790
+                    mLockPatternButtons.add(btn);
791
+                }
792
+            }
759 793
         }
760 794
 
761 795
         // Disable the Emergency call button if the device has no voice telephone capability
@@ -1027,6 +1061,41 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
1027 1061
         return;
1028 1062
     }
1029 1063
 
1064
+    @Override
1065
+    public void onClick(View v) {
1066
+        if (mLockPatternView == null || !mLockPatternView.isEnabled()) {
1067
+            return;
1068
+        }
1069
+        byte size;
1070
+        switch (v.getId()) {
1071
+            default:
1072
+            case R.id.lock_pattern_size_3:
1073
+                size = 3;
1074
+                break;
1075
+            case R.id.lock_pattern_size_4:
1076
+                size = 4;
1077
+                break;
1078
+            case R.id.lock_pattern_size_5:
1079
+                size = 5;
1080
+                break;
1081
+            case R.id.lock_pattern_size_6:
1082
+                size = 6;
1083
+                break;
1084
+        }
1085
+        setContentView(R.layout.crypt_keeper_pattern_entry);
1086
+        passwordEntryInit();
1087
+
1088
+        mStatusText.setText(mStatusString = R.string.enter_pattern);
1089
+        mLockPatternView.setLockPatternSize(size);
1090
+        mLockPatternView.postInvalidate();
1091
+    }
1092
+
1093
+    private void setPatternButtonsEnabled(boolean enabled) {
1094
+        for (Button btn : mLockPatternButtons) {
1095
+            btn.setEnabled(enabled);
1096
+        }
1097
+    }
1098
+
1030 1099
     private static void disableCryptKeeperComponent(Context context) {
1031 1100
         PackageManager pm = context.getPackageManager();
1032 1101
         ComponentName name = new ComponentName(context, CryptKeeper.class);

+ 34
- 14
src/com/android/settings/password/ChooseLockPattern.java View File

@@ -94,7 +94,7 @@ public class ChooseLockPattern extends SettingsActivity {
94 94
         private final Intent mIntent;
95 95
 
96 96
         public IntentBuilder(Context context) {
97
-            mIntent = new Intent(context, ChooseLockPattern.class);
97
+            mIntent = new Intent(context, ChooseLockPatternSize.class);
98 98
             mIntent.putExtra(EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, false);
99 99
             mIntent.putExtra(ChooseLockGeneric.CONFIRM_CREDENTIALS, false);
100 100
             mIntent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, false);
@@ -182,6 +182,7 @@ public class ChooseLockPattern extends SettingsActivity {
182 182
         private TextView mFooterRightButton;
183 183
         protected List<LockPatternView.Cell> mChosenPattern = null;
184 184
         private boolean mHideDrawer = false;
185
+        private byte mPatternSize = LockPatternUtils.PATTERN_SIZE_DEFAULT;
185 186
         private ColorStateList mDefaultHeaderColorList;
186 187
 
187 188
         // ScrollView that contains title and header, only exist in land mode
@@ -190,13 +191,7 @@ public class ChooseLockPattern extends SettingsActivity {
190 191
         /**
191 192
          * The patten used during the help screen to show how to draw a pattern.
192 193
          */
193
-        private final List<LockPatternView.Cell> mAnimatePattern =
194
-                Collections.unmodifiableList(Lists.newArrayList(
195
-                        LockPatternView.Cell.of(0, 0),
196
-                        LockPatternView.Cell.of(0, 1),
197
-                        LockPatternView.Cell.of(1, 1),
198
-                        LockPatternView.Cell.of(2, 1)
199
-                ));
194
+        private List<LockPatternView.Cell> mAnimatePattern;
200 195
 
201 196
         @Override
202 197
         public void onActivityResult(int requestCode, int resultCode,
@@ -245,7 +240,12 @@ public class ChooseLockPattern extends SettingsActivity {
245 240
                     if (mUiStage == Stage.NeedToConfirm || mUiStage == Stage.ConfirmWrong) {
246 241
                         if (mChosenPattern == null) throw new IllegalStateException(
247 242
                                 "null chosen pattern in stage 'need to confirm");
248
-                        if (mChosenPattern.equals(pattern)) {
243
+                        final String chosenPatternStr = LockPatternUtils.patternToString(
244
+                                mChosenPattern, mPatternSize);
245
+                        final String potentialPatternStr = LockPatternUtils.patternToString(
246
+                                pattern, mPatternSize);
247
+
248
+                        if (chosenPatternStr.equals(potentialPatternStr)) {
249 249
                             updateStage(Stage.ChoiceConfirmed);
250 250
                         } else {
251 251
                             updateStage(Stage.ConfirmWrong);
@@ -446,7 +446,8 @@ public class ChooseLockPattern extends SettingsActivity {
446 446
                 w.setBlocking(true);
447 447
                 w.setListener(this);
448 448
                 w.start(mChooseLockSettingsHelper.utils(), required,
449
-                        false, 0, LockPatternUtils.stringToPattern(current), current, mUserId);
449
+                        false, 0, LockPatternUtils.stringToPattern(current, mPatternSize),
450
+                        current, mUserId, mPatternSize);
450 451
             }
451 452
             mHideDrawer = getActivity().getIntent().getBooleanExtra(EXTRA_HIDE_DRAWER, false);
452 453
             mForFingerprint = intent.getBooleanExtra(
@@ -469,6 +470,17 @@ public class ChooseLockPattern extends SettingsActivity {
469 470
                     layout.setIcon(getActivity().getDrawable(R.drawable.ic_fingerprint_header));
470 471
                 }
471 472
             }
473
+
474
+            mPatternSize = getActivity().getIntent().getByteExtra("pattern_size",
475
+                    LockPatternUtils.PATTERN_SIZE_DEFAULT);
476
+            LockPatternView.Cell.updateSize(mPatternSize);
477
+            mAnimatePattern = Collections.unmodifiableList(Lists.newArrayList(
478
+                    LockPatternView.Cell.of(0, 0, mPatternSize),
479
+                    LockPatternView.Cell.of(0, 1, mPatternSize),
480
+                    LockPatternView.Cell.of(1, 1, mPatternSize),
481
+                    LockPatternView.Cell.of(2, 1, mPatternSize)
482
+                    ));
483
+
472 484
             return layout;
473 485
         }
474 486
 
@@ -485,6 +497,8 @@ public class ChooseLockPattern extends SettingsActivity {
485 497
             mLockPatternView.setTactileFeedbackEnabled(
486 498
                     mChooseLockSettingsHelper.utils().isTactileFeedbackEnabled());
487 499
             mLockPatternView.setFadePattern(false);
500
+            mLockPatternView.setLockPatternUtils(mChooseLockSettingsHelper.utils());
501
+            mLockPatternView.setLockPatternSize(mPatternSize);
488 502
 
489 503
             mFooterText = (TextView) view.findViewById(R.id.footerText);
490 504
 
@@ -532,7 +546,8 @@ public class ChooseLockPattern extends SettingsActivity {
532 546
                 // restore from previous state
533 547
                 final String patternString = savedInstanceState.getString(KEY_PATTERN_CHOICE);
534 548
                 if (patternString != null) {
535
-                    mChosenPattern = LockPatternUtils.stringToPattern(patternString);
549
+                    mChosenPattern = LockPatternUtils.stringToPattern(patternString, mPatternSize);
550
+                    mLockPatternView.setPattern(DisplayMode.Correct, mChosenPattern);
536 551
                 }
537 552
 
538 553
                 if (mCurrentPattern == null) {
@@ -633,7 +648,7 @@ public class ChooseLockPattern extends SettingsActivity {
633 648
             outState.putInt(KEY_UI_STAGE, mUiStage.ordinal());
634 649
             if (mChosenPattern != null) {
635 650
                 outState.putString(KEY_PATTERN_CHOICE,
636
-                        LockPatternUtils.patternToString(mChosenPattern));
651
+                        LockPatternUtils.patternToString(mChosenPattern, mPatternSize));
637 652
             }
638 653
 
639 654
             if (mCurrentPattern != null) {
@@ -777,7 +792,8 @@ public class ChooseLockPattern extends SettingsActivity {
777 792
             final boolean required = getActivity().getIntent().getBooleanExtra(
778 793
                     EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true);
779 794
             mSaveAndFinishWorker.start(mChooseLockSettingsHelper.utils(), required,
780
-                    mHasChallenge, mChallenge, mChosenPattern, mCurrentPattern, mUserId);
795
+                    mHasChallenge, mChallenge, mChosenPattern, mCurrentPattern,
796
+                    mUserId, mPatternSize);
781 797
         }
782 798
 
783 799
         @Override
@@ -800,15 +816,18 @@ public class ChooseLockPattern extends SettingsActivity {
800 816
         private List<LockPatternView.Cell> mChosenPattern;
801 817
         private String mCurrentPattern;
802 818
         private boolean mLockVirgin;
819
+        private byte mPatternSize;
803 820
 
804 821
         public void start(LockPatternUtils utils, boolean credentialRequired,
805 822
                 boolean hasChallenge, long challenge,
806
-                List<LockPatternView.Cell> chosenPattern, String currentPattern, int userId) {
823
+                List<LockPatternView.Cell> chosenPattern, String currentPattern,
824
+                int userId, byte patternSize) {
807 825
             prepare(utils, credentialRequired, hasChallenge, challenge, userId);
808 826
 
809 827
             mCurrentPattern = currentPattern;
810 828
             mChosenPattern = chosenPattern;
811 829
             mUserId = userId;
830
+            mPatternSize = patternSize;
812 831
 
813 832
             mLockVirgin = !mUtils.isPatternEverChosen(mUserId);
814 833
 
@@ -819,6 +838,7 @@ public class ChooseLockPattern extends SettingsActivity {
819 838
         protected Intent saveAndVerifyInBackground() {
820 839
             Intent result = null;
821 840
             final int userId = mUserId;
841
+            mUtils.setLockPatternSize(mPatternSize, userId);
822 842
             mUtils.saveLockPattern(mChosenPattern, mCurrentPattern, userId);
823 843
 
824 844
             if (mHasChallenge) {

+ 151
- 0
src/com/android/settings/password/ChooseLockPatternSize.java View File

@@ -0,0 +1,151 @@
1
+/*
2
+ * Copyright (C) 2012-2013 The CyanogenMod Project
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *      http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+package com.android.settings.password;
18
+
19
+import android.content.Intent;
20
+import android.content.res.Resources.Theme;
21
+import android.os.Bundle;
22
+import android.preference.PreferenceActivity;
23
+import android.support.v7.preference.Preference;
24
+import android.support.v7.preference.PreferenceScreen;
25
+import android.support.v7.widget.RecyclerView;
26
+import android.view.LayoutInflater;
27
+import android.view.View;
28
+import android.view.ViewGroup;
29
+
30
+import com.android.internal.widget.LockPatternUtils;
31
+import com.android.settings.EncryptionInterstitial;
32
+import com.android.settings.R;
33
+import com.android.settings.SetupWizardUtils;
34
+import com.android.settings.SettingsPreferenceFragment;
35
+import com.android.settings.utils.SettingsDividerItemDecoration;
36
+import com.android.setupwizardlib.GlifPreferenceLayout;
37
+
38
+import org.lineageos.internal.logging.LineageMetricsLogger;
39
+
40
+public class ChooseLockPatternSize extends PreferenceActivity {
41
+
42
+    @Override
43
+    public Intent getIntent() {
44
+        Intent modIntent = new Intent(super.getIntent());
45
+        modIntent.putExtra(EXTRA_SHOW_FRAGMENT, ChooseLockPatternSizeFragment.class.getName());
46
+        modIntent.putExtra(EXTRA_NO_HEADERS, true);
47
+        return modIntent;
48
+    }
49
+
50
+    @Override
51
+    protected void onApplyThemeResource(Theme theme, int resid, boolean first) {
52
+        resid = SetupWizardUtils.getTheme(getIntent());
53
+        super.onApplyThemeResource(theme, resid, first);
54
+    }
55
+
56
+    @Override
57
+    protected boolean isValidFragment(String fragmentName) {
58
+        if (ChooseLockPatternSizeFragment.class.getName().equals(fragmentName)) return true;
59
+        return false;
60
+    }
61
+
62
+    public static class ChooseLockPatternSizeFragment extends SettingsPreferenceFragment {
63
+        private ChooseLockSettingsHelper mChooseLockSettingsHelper;
64
+
65
+        @Override
66
+        public void onCreate(Bundle savedInstanceState) {
67
+            super.onCreate(savedInstanceState);
68
+            mChooseLockSettingsHelper = new ChooseLockSettingsHelper(this.getActivity());
69
+            if (!(getActivity() instanceof ChooseLockPatternSize)) {
70
+                throw new SecurityException("Fragment contained in wrong activity");
71
+            }
72
+            addPreferencesFromResource(R.xml.security_settings_pattern_size);
73
+            setHeaderView(R.layout.choose_lock_pattern_size_header);
74
+        }
75
+
76
+        @Override
77
+        public boolean onPreferenceTreeClick(Preference preference) {
78
+            final String key = preference.getKey();
79
+
80
+            byte patternSize;
81
+            if ("lock_pattern_size_4".equals(key)) {
82
+                patternSize = 4;
83
+            } else if ("lock_pattern_size_5".equals(key)) {
84
+                patternSize = 5;
85
+            } else if ("lock_pattern_size_6".equals(key)) {
86
+                patternSize = 6;
87
+            } else {
88
+                patternSize = 3;
89
+            }
90
+
91
+            final boolean isFallback = getActivity().getIntent()
92
+                .getBooleanExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
93
+
94
+            Intent intent = new Intent(getActivity(), ChooseLockPattern.class);
95
+            intent.putExtra("pattern_size", patternSize);
96
+            intent.putExtra("key_lock_method", "pattern");
97
+            intent.putExtra("confirm_credentials", false);
98
+            intent.putExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK,
99
+                    isFallback);
100
+
101
+            Intent originatingIntent = getActivity().getIntent();
102
+            // Forward the challenge extras if available in originating intent.
103
+            if (originatingIntent.hasExtra(ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE)) {
104
+                intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE,
105
+                        originatingIntent.getBooleanExtra(
106
+                                ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, false));
107
+
108
+                intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE,
109
+                        originatingIntent.getLongExtra(
110
+                                ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, 0));
111
+            }
112
+            // Forward the Encryption interstitial required password selection
113
+            if (originatingIntent.hasExtra(EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD)) {
114
+                intent.putExtra(EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, originatingIntent
115
+                        .getBooleanExtra(EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true));
116
+            }
117
+            intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD,
118
+                    originatingIntent.getStringExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD));
119
+            intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
120
+            startActivity(intent);
121
+
122
+            finish();
123
+            return true;
124
+        }
125
+
126
+        @Override
127
+        public void onViewCreated(View view, Bundle savedInstanceState) {
128
+            super.onViewCreated(view, savedInstanceState);
129
+            GlifPreferenceLayout layout = (GlifPreferenceLayout) view;
130
+            layout.setDividerItemDecoration(new SettingsDividerItemDecoration(getContext()));
131
+
132
+            layout.setIcon(getContext().getDrawable(R.drawable.ic_lock));
133
+
134
+            // Use the dividers in SetupWizardRecyclerLayout. Suppress the dividers in
135
+            // PreferenceFragment.
136
+            setDivider(null);
137
+        }
138
+
139
+        @Override
140
+        public RecyclerView onCreateRecyclerView(LayoutInflater inflater, ViewGroup parent,
141
+                Bundle savedInstanceState) {
142
+            GlifPreferenceLayout layout = (GlifPreferenceLayout) parent;
143
+            return layout.onCreateRecyclerView(inflater, parent, savedInstanceState);
144
+        }
145
+
146
+        @Override
147
+        public int getMetricsCategory() {
148
+            return LineageMetricsLogger.CHOOSE_LOCK_PATTERN_SIZE;
149
+        }
150
+    }
151
+}

+ 7
- 2
src/com/android/settings/password/ConfirmLockPattern.java View File

@@ -22,6 +22,7 @@ import android.os.AsyncTask;
22 22
 import android.os.Bundle;
23 23
 import android.os.CountDownTimer;
24 24
 import android.os.SystemClock;
25
+import android.os.UserHandle;
25 26
 import android.os.UserManager;
26 27
 import android.os.storage.StorageManager;
27 28
 import android.view.LayoutInflater;
@@ -139,6 +140,8 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
139 140
                     mLockPatternUtils.isTactileFeedbackEnabled());
140 141
             mLockPatternView.setInStealthMode(!mLockPatternUtils.isVisiblePatternEnabled(
141 142
                     mEffectiveUserId));
143
+            mLockPatternView.setLockPatternSize(
144
+                    mLockPatternUtils.getLockPatternSize(mEffectiveUserId));
142 145
             mLockPatternView.setOnPatternListener(mConfirmExistingLockPatternListener);
143 146
             updateStage(Stage.NeedToUnlock);
144 147
 
@@ -462,7 +465,9 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
462 465
                                 mLockPatternUtils, pattern, challenge, localUserId,
463 466
                                 onVerifyCallback)
464 467
                         : LockPatternChecker.verifyTiedProfileChallenge(
465
-                                mLockPatternUtils, LockPatternUtils.patternToString(pattern),
468
+                                mLockPatternUtils,
469
+                                LockPatternUtils.patternToString(pattern,
470
+                                    mLockPatternUtils.getLockPatternSize(mEffectiveUserId)),
466 471
                                 true, challenge, localUserId, onVerifyCallback);
467 472
             }
468 473
 
@@ -487,7 +492,7 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
487 492
                                     intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_TYPE,
488 493
                                                     StorageManager.CRYPT_TYPE_PATTERN);
489 494
                                     intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD,
490
-                                                    LockPatternUtils.patternToString(pattern));
495
+                                                    mLockPatternUtils.patternToString(pattern, localEffectiveUserId));
491 496
                                 }
492 497
                                 mCredentialCheckResultTracker.setResult(matched, intent, timeoutMs,
493 498
                                         localEffectiveUserId);

+ 2
- 1
src/com/android/settings/security/LockUnificationPreferenceController.java View File

@@ -191,8 +191,9 @@ public class LockUnificationPreferenceController extends AbstractPreferenceContr
191 191
         int profileQuality =
192 192
                 mLockPatternUtils.getKeyguardStoredPasswordQuality(mProfileChallengeUserId);
193 193
         if (profileQuality == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) {
194
+            byte patternSize = mLockPatternUtils.getLockPatternSize(MY_USER_ID);
194 195
             mLockPatternUtils.saveLockPattern(
195
-                    LockPatternUtils.stringToPattern(mCurrentProfilePassword),
196
+                    LockPatternUtils.stringToPattern(mCurrentProfilePassword, patternSize),
196 197
                     mCurrentDevicePassword, MY_USER_ID);
197 198
         } else {
198 199
             mLockPatternUtils.saveLockPassword(