diff options
author | Robin Lee <rgl@google.com> | 2015-03-10 18:30:24 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-03-10 18:30:26 +0000 |
commit | 5ca961673355622209fad00e75734ed861ecbce5 (patch) | |
tree | 8d484b535e202441fa78abafb62eb2e7152689c7 /services | |
parent | 86bb9ba586dfb4136014d5e3072786d04c8b152e (diff) | |
parent | 68e4ba4dd0412f7923d3c22c92ebae485fc89961 (diff) | |
download | frameworks_base-5ca961673355622209fad00e75734ed861ecbce5.zip frameworks_base-5ca961673355622209fad00e75734ed861ecbce5.tar.gz frameworks_base-5ca961673355622209fad00e75734ed861ecbce5.tar.bz2 |
Merge "Move more file handling into LockSettingsStorage"
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/LockSettingsStorage.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/LockSettingsStorage.java b/services/core/java/com/android/server/LockSettingsStorage.java index c03bb58..d81daa9 100644 --- a/services/core/java/com/android/server/LockSettingsStorage.java +++ b/services/core/java/com/android/server/LockSettingsStorage.java @@ -238,12 +238,21 @@ class LockSettingsStorage { public void writePatternHash(byte[] hash, int userId) { writeFile(getLockPatternFilename(userId), hash); + clearPasswordHash(userId); + } + + private void clearPatternHash(int userId) { + writeFile(getLockPatternFilename(userId), null); } public void writePasswordHash(byte[] hash, int userId) { writeFile(getLockPasswordFilename(userId), hash); + clearPatternHash(userId); } + private void clearPasswordHash(int userId) { + writeFile(getLockPasswordFilename(userId), null); + } @VisibleForTesting String getLockPatternFilename(int userId) { @@ -279,16 +288,15 @@ class LockSettingsStorage { return userId; } - public void removeUser(int userId) { SQLiteDatabase db = mOpenHelper.getWritableDatabase(); final UserManager um = (UserManager) mContext.getSystemService(USER_SERVICE); final UserInfo parentInfo = um.getProfileParent(userId); - synchronized (mFileWriteLock) { - if (parentInfo == null) { - // This user owns its lock settings files - safe to delete them + if (parentInfo == null) { + // This user owns its lock settings files - safe to delete them + synchronized (mFileWriteLock) { String name = getLockPasswordFilename(userId); File file = new File(name); if (file.exists()) { |