Replace hard-coded errno values with OsConstants
Errno values have been hard-coded inside java code. On the native side
however, bionic's errno.h is used (through utils/Errors.h). Some of
the numbers are architecture dependent (EOPNOTSUPP, ETIMEDOUT...).
This causes Camera app to crash on MIPS devices. There is a check for
expected errors, in CameraBinderDecorator.throwOnError, but the error
(EOPNOTSUPP) is not recognized and an exception is thrown.
Change-Id: I8bcac8f1ced50c76614f566a6e624967a18a25e1
diff --git a/core/java/android/hardware/soundtrigger/SoundTrigger.java b/core/java/android/hardware/soundtrigger/SoundTrigger.java
index c85e97b..d490409 100644
--- a/core/java/android/hardware/soundtrigger/SoundTrigger.java
+++ b/core/java/android/hardware/soundtrigger/SoundTrigger.java
@@ -25,6 +25,8 @@
import java.util.Arrays;
import java.util.UUID;
+import static android.system.OsConstants.*;
+
/**
* The SoundTrigger class provides access via JNI to the native service managing
* the sound trigger HAL.
@@ -35,11 +37,11 @@
public static final int STATUS_OK = 0;
public static final int STATUS_ERROR = Integer.MIN_VALUE;
- public static final int STATUS_PERMISSION_DENIED = -1;
- public static final int STATUS_NO_INIT = -19;
- public static final int STATUS_BAD_VALUE = -22;
- public static final int STATUS_DEAD_OBJECT = -32;
- public static final int STATUS_INVALID_OPERATION = -38;
+ public static final int STATUS_PERMISSION_DENIED = -EPERM;
+ public static final int STATUS_NO_INIT = -ENODEV;
+ public static final int STATUS_BAD_VALUE = -EINVAL;
+ public static final int STATUS_DEAD_OBJECT = -EPIPE;
+ public static final int STATUS_INVALID_OPERATION = -ENOSYS;
/*****************************************************************************
* A ModuleProperties describes a given sound trigger hardware module