crypto: differentiate type for PIN
Change-Id: Ic3c384fcc5dc3c71b868a1b45040e74d729c63f0
diff --git a/crypto/fscrypt/Decrypt.cpp b/crypto/fscrypt/Decrypt.cpp
index 0055471..0217358 100755
--- a/crypto/fscrypt/Decrypt.cpp
+++ b/crypto/fscrypt/Decrypt.cpp
@@ -1080,15 +1080,21 @@
printf("Failed to Get_Password_Data\n");
return 0;
}
- if (pwd.password_type == 1) { // In Android this means pattern
+ // In Android type 1 is pattern
+ // In Android <11 type 2 is PIN or password
+ // In Android 11+ type 3 is PIN and type 4 is password
+ if (pwd.password_type == 2) {
+ printf("password type: password/PIN\n");
+ return 1; // In TWRP this means password or PIN (Android <11)
+ } else if (pwd.password_type == 4) {
+ printf("password type: password\n");
+ return 1; // In TWRP this means password
+ } else if (pwd.password_type == 1) {
printf("password type: pattern\n");
return 2; // In TWRP this means pattern
- }
- // In Android <11 type 2 is PIN or password
- // In Android 11 type 3 is PIN and type 4 is password
- else if (pwd.password_type > 1) {
- printf("password type: pin\n");
- return 1; // In TWRP this means PIN or password
+ } else if (pwd.password_type == 3) {
+ printf("password type: PIN\n");
+ return 3; // In TWRP this means PIN
}
printf("using default password\n");
return 0; // We'll try the default password