blob: 4f175864a9df8d1b0b0fa14859ac1c2e88992b71 [file] [log] [blame]
Alex Klyubind23a1f72015-03-27 14:39:28 -07001package android.security;
2
3import android.security.keymaster.KeymasterDefs;
4
5/**
6 * @hide
7 */
8public abstract class KeymasterUtils {
9 private KeymasterUtils() {}
10
11 public static KeymasterException getExceptionForKeymasterError(int keymasterErrorCode) {
12 switch (keymasterErrorCode) {
13 case KeymasterDefs.KM_ERROR_INVALID_AUTHORIZATION_TIMEOUT:
14 // The name of this parameter significantly differs between Keymaster and framework
15 // APIs. Use the framework wording to make life easier for developers.
Alex Klyubin4ab8ea42015-03-27 16:53:44 -070016 return new KeymasterException(keymasterErrorCode,
17 "Invalid user authentication validity duration");
Alex Klyubind23a1f72015-03-27 14:39:28 -070018 default:
Alex Klyubin4ab8ea42015-03-27 16:53:44 -070019 return new KeymasterException(keymasterErrorCode,
20 KeymasterDefs.getErrorMessage(keymasterErrorCode));
Alex Klyubind23a1f72015-03-27 14:39:28 -070021 }
22 }
23}