|
113 | 113 | import com.android.internal.notification.SystemNotificationChannels; |
114 | 114 | import com.android.internal.util.DumpUtils; |
115 | 115 | import com.android.internal.util.IndentingPrintWriter; |
| 116 | +import com.android.internal.util.Preconditions; |
116 | 117 | import com.android.internal.widget.ICheckCredentialProgressCallback; |
117 | 118 | import com.android.internal.widget.ILockSettings; |
118 | 119 | import com.android.internal.widget.LockPatternUtils; |
@@ -2618,6 +2619,10 @@ private void callToAuthSecretIfNeeded(@UserIdInt int userId, |
2618 | 2619 | protected AuthenticationToken initializeSyntheticPasswordLocked(byte[] credentialHash, |
2619 | 2620 | LockscreenCredential credential, int userId) { |
2620 | 2621 | Slog.i(TAG, "Initialize SyntheticPassword for user: " + userId); |
| 2622 | + Preconditions.checkState( |
| 2623 | + getSyntheticPasswordHandleLocked(userId) == SyntheticPasswordManager.DEFAULT_HANDLE, |
| 2624 | + "Cannot reinitialize SP"); |
| 2625 | + |
2621 | 2626 | final AuthenticationToken auth = mSpManager.newSyntheticPasswordAndSid( |
2622 | 2627 | getGateKeeperService(), credentialHash, credential, userId); |
2623 | 2628 | onAuthTokenKnownForUser(userId, auth); |
@@ -2678,7 +2683,7 @@ private boolean isSyntheticPasswordBasedCredentialLocked(int userId) { |
2678 | 2683 |
|
2679 | 2684 | @VisibleForTesting |
2680 | 2685 | protected boolean shouldMigrateToSyntheticPasswordLocked(int userId) { |
2681 | | - return true; |
| 2686 | + return getSyntheticPasswordHandleLocked(userId) == SyntheticPasswordManager.DEFAULT_HANDLE; |
2682 | 2687 | } |
2683 | 2688 |
|
2684 | 2689 | private VerifyCredentialResponse spBasedDoVerifyCredential(LockscreenCredential userCredential, |
|
0 commit comments