summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Jang <zachjang@google.com>2016-11-22 17:47:18 +0000
committergitbuildkicker <android-build@google.com>2016-11-22 10:16:48 -0800
commit3570784fa5e7975a1bd8e01883b58676546b8d90 (patch)
tree21d3a09258706e2399a7111cf5270e056a34cf91
parent867ef61d235690e4a5ca6ae56b8f0cd8bba118d3 (diff)
downloadbase-3570784fa5e7975a1bd8e01883b58676546b8d90.tar.gz
Revert "Catch KeyStoreException for setting profile lock"android-7.1.1_r4
This reverts commit c8fa5ed8f2d492aa5e005fcdb5991c3f980de045. Change-Id: Ia1425e649e102cb79280d75e5f49db670214cec3 (cherry picked from commit e61672ab087df4857a4f0923258b945800046589)
-rw-r--r--services/core/java/com/android/server/LockSettingsService.java16
1 files changed, 4 insertions, 12 deletions
diff --git a/services/core/java/com/android/server/LockSettingsService.java b/services/core/java/com/android/server/LockSettingsService.java
index 846551f7f119..a91e2053c01d 100644
--- a/services/core/java/com/android/server/LockSettingsService.java
+++ b/services/core/java/com/android/server/LockSettingsService.java
@@ -245,16 +245,13 @@ public class LockSettingsService extends ILockSettings.Stub {
try {
randomLockSeed = SecureRandom.getInstance("SHA1PRNG").generateSeed(40);
String newPassword = String.valueOf(HexEncoding.encode(randomLockSeed));
- tieProfileLockToParent(managedUserId, newPassword);
setLockPasswordInternal(newPassword, managedUserPassword, managedUserId);
// We store a private credential for the managed user that's unlocked by the primary
// account holder's credential. As such, the user will never be prompted to enter this
// password directly, so we always store a password.
setLong(LockPatternUtils.PASSWORD_TYPE_KEY,
DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC, managedUserId);
- } catch (KeyStoreException e) {
- // Bug: 32490092
- Slog.e(TAG, "Not able to set keys to keystore", e);
+ tieProfileLockToParent(managedUserId, newPassword);
} catch (NoSuchAlgorithmException | RemoteException e) {
Slog.e(TAG, "Fail to tie managed profile", e);
// Nothing client can do to fix this issue, so we do not throw exception out
@@ -761,7 +758,6 @@ public class LockSettingsService extends ILockSettings.Stub {
}
private void unlockChildProfile(int profileHandle) throws RemoteException {
- if (DEBUG) Slog.v(TAG, "Unlock child profile");
try {
doVerifyPassword(getDecryptedPasswordForTiedProfile(profileHandle), false,
0 /* no challenge */, profileHandle, null /* progressCallback */);
@@ -1021,7 +1017,7 @@ public class LockSettingsService extends ILockSettings.Stub {
}
}
- private void tieProfileLockToParent(int userId, String password) throws KeyStoreException {
+ private void tieProfileLockToParent(int userId, String password) {
if (DEBUG) Slog.v(TAG, "tieProfileLockToParent for user: " + userId);
byte[] randomLockSeed = password.getBytes(StandardCharsets.UTF_8);
byte[] encryptionResult;
@@ -1063,7 +1059,7 @@ public class LockSettingsService extends ILockSettings.Stub {
keyStore.deleteEntry(LockPatternUtils.PROFILE_KEY_NAME_ENCRYPT + userId);
}
} catch (CertificateException | UnrecoverableKeyException
- | IOException | BadPaddingException | IllegalBlockSizeException
+ | IOException | BadPaddingException | IllegalBlockSizeException | KeyStoreException
| NoSuchPaddingException | NoSuchAlgorithmException | InvalidKeyException e) {
throw new RuntimeException("Failed to encrypt key", e);
}
@@ -1205,11 +1201,7 @@ public class LockSettingsService extends ILockSettings.Stub {
} finally {
if (managedUserId != -1 && managedUserDecryptedPassword != null) {
if (DEBUG) Slog.v(TAG, "Restore tied profile lock");
- try {
- tieProfileLockToParent(managedUserId, managedUserDecryptedPassword);
- } catch (KeyStoreException e) {
- throw new RuntimeException("Failed to tie profile lock", e);
- }
+ tieProfileLockToParent(managedUserId, managedUserDecryptedPassword);
}
}
}