| Alex Klyubin | d23a1f7 | 2015-03-27 14:39:28 -0700 | [diff] [blame] | 1 | package android.security; |
| 2 | |
| 3 | import android.security.keymaster.KeymasterDefs; |
| 4 | |
| 5 | /** |
| 6 | * @hide |
| 7 | */ |
| 8 | public 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 | } |