blob: e6e88c741dfdef6dbe5d79cafaec254c5835d8b4 [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.
16 return new KeymasterException("Invalid user authentication validity duration");
17 default:
18 return new KeymasterException(KeymasterDefs.getErrorMessage(keymasterErrorCode));
19 }
20 }
21}