summaryrefslogtreecommitdiffstats
path: root/include/system
diff options
context:
space:
mode:
Diffstat (limited to 'include/system')
-rw-r--r--include/system/audio.h77
-rw-r--r--include/system/audio_policy.h2
-rw-r--r--include/system/camera.h11
-rw-r--r--include/system/graphics.h31
-rw-r--r--include/system/window.h125
5 files changed, 220 insertions, 26 deletions
diff --git a/include/system/audio.h b/include/system/audio.h
index 3807317..d246070 100644
--- a/include/system/audio.h
+++ b/include/system/audio.h
@@ -63,7 +63,10 @@ typedef enum {
AUDIO_SOURCE_CAMCORDER = 5,
AUDIO_SOURCE_VOICE_RECOGNITION = 6,
AUDIO_SOURCE_VOICE_COMMUNICATION = 7,
-
+ AUDIO_SOURCE_REMOTE_SUBMIX = 8, /* Source for the mix to be presented remotely. */
+ /* An example of remote presentation is Wifi Display */
+ /* where a dongle attached to a TV can be used to */
+ /* play the mix captured by this audio source. */
AUDIO_SOURCE_CNT,
AUDIO_SOURCE_MAX = AUDIO_SOURCE_CNT - 1,
} audio_source_t;
@@ -152,7 +155,7 @@ typedef enum {
AUDIO_FORMAT_PCM_SUB_8_24_BIT),
} audio_format_t;
-typedef enum {
+enum {
/* output channels */
AUDIO_CHANNEL_OUT_FRONT_LEFT = 0x1,
AUDIO_CHANNEL_OUT_FRONT_RIGHT = 0x2,
@@ -275,7 +278,11 @@ typedef enum {
AUDIO_IN_ACOUSTICS_TX_DISABLE = 0,
} audio_in_acoustics_t;
-typedef enum {
+enum {
+ AUDIO_DEVICE_NONE = 0x0,
+ /* reserved bits */
+ AUDIO_DEVICE_BIT_IN = 0x80000000,
+ AUDIO_DEVICE_BIT_DEFAULT = 0x40000000,
/* output devices */
AUDIO_DEVICE_OUT_EARPIECE = 0x1,
AUDIO_DEVICE_OUT_SPEAKER = 0x2,
@@ -292,7 +299,8 @@ typedef enum {
AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET = 0x1000,
AUDIO_DEVICE_OUT_USB_ACCESSORY = 0x2000,
AUDIO_DEVICE_OUT_USB_DEVICE = 0x4000,
- AUDIO_DEVICE_OUT_DEFAULT = 0x8000,
+ AUDIO_DEVICE_OUT_REMOTE_SUBMIX = 0x8000,
+ AUDIO_DEVICE_OUT_DEFAULT = AUDIO_DEVICE_BIT_DEFAULT,
AUDIO_DEVICE_OUT_ALL = (AUDIO_DEVICE_OUT_EARPIECE |
AUDIO_DEVICE_OUT_SPEAKER |
AUDIO_DEVICE_OUT_WIRED_HEADSET |
@@ -308,6 +316,7 @@ typedef enum {
AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET |
AUDIO_DEVICE_OUT_USB_ACCESSORY |
AUDIO_DEVICE_OUT_USB_DEVICE |
+ AUDIO_DEVICE_OUT_REMOTE_SUBMIX |
AUDIO_DEVICE_OUT_DEFAULT),
AUDIO_DEVICE_OUT_ALL_A2DP = (AUDIO_DEVICE_OUT_BLUETOOTH_A2DP |
AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES |
@@ -319,15 +328,20 @@ typedef enum {
AUDIO_DEVICE_OUT_USB_DEVICE),
/* input devices */
- AUDIO_DEVICE_IN_COMMUNICATION = 0x10000,
- AUDIO_DEVICE_IN_AMBIENT = 0x20000,
- AUDIO_DEVICE_IN_BUILTIN_MIC = 0x40000,
- AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET = 0x80000,
- AUDIO_DEVICE_IN_WIRED_HEADSET = 0x100000,
- AUDIO_DEVICE_IN_AUX_DIGITAL = 0x200000,
- AUDIO_DEVICE_IN_VOICE_CALL = 0x400000,
- AUDIO_DEVICE_IN_BACK_MIC = 0x800000,
- AUDIO_DEVICE_IN_DEFAULT = 0x80000000,
+ AUDIO_DEVICE_IN_COMMUNICATION = AUDIO_DEVICE_BIT_IN | 0x1,
+ AUDIO_DEVICE_IN_AMBIENT = AUDIO_DEVICE_BIT_IN | 0x2,
+ AUDIO_DEVICE_IN_BUILTIN_MIC = AUDIO_DEVICE_BIT_IN | 0x4,
+ AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET = AUDIO_DEVICE_BIT_IN | 0x8,
+ AUDIO_DEVICE_IN_WIRED_HEADSET = AUDIO_DEVICE_BIT_IN | 0x10,
+ AUDIO_DEVICE_IN_AUX_DIGITAL = AUDIO_DEVICE_BIT_IN | 0x20,
+ AUDIO_DEVICE_IN_VOICE_CALL = AUDIO_DEVICE_BIT_IN | 0x40,
+ AUDIO_DEVICE_IN_BACK_MIC = AUDIO_DEVICE_BIT_IN | 0x80,
+ AUDIO_DEVICE_IN_REMOTE_SUBMIX = AUDIO_DEVICE_BIT_IN | 0x100,
+ AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET = AUDIO_DEVICE_BIT_IN | 0x200,
+ AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET = AUDIO_DEVICE_BIT_IN | 0x400,
+ AUDIO_DEVICE_IN_USB_ACCESSORY = AUDIO_DEVICE_BIT_IN | 0x800,
+ AUDIO_DEVICE_IN_USB_DEVICE = AUDIO_DEVICE_BIT_IN | 0x1000,
+ AUDIO_DEVICE_IN_DEFAULT = AUDIO_DEVICE_BIT_IN | AUDIO_DEVICE_BIT_DEFAULT,
AUDIO_DEVICE_IN_ALL = (AUDIO_DEVICE_IN_COMMUNICATION |
AUDIO_DEVICE_IN_AMBIENT |
@@ -337,9 +351,16 @@ typedef enum {
AUDIO_DEVICE_IN_AUX_DIGITAL |
AUDIO_DEVICE_IN_VOICE_CALL |
AUDIO_DEVICE_IN_BACK_MIC |
+ AUDIO_DEVICE_IN_REMOTE_SUBMIX |
+ AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET |
+ AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET |
+ AUDIO_DEVICE_IN_USB_ACCESSORY |
+ AUDIO_DEVICE_IN_USB_DEVICE |
AUDIO_DEVICE_IN_DEFAULT),
AUDIO_DEVICE_IN_ALL_SCO = AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET,
-} audio_devices_t;
+};
+
+typedef uint32_t audio_devices_t;
/* the audio output flags serve two purposes:
* - when an AudioTrack is created they indicate a "wish" to be connected to an
@@ -366,7 +387,8 @@ typedef enum {
static inline bool audio_is_output_device(audio_devices_t device)
{
- if ((popcount(device) == 1) && ((device & ~AUDIO_DEVICE_OUT_ALL) == 0))
+ if (((device & AUDIO_DEVICE_BIT_IN) == 0) &&
+ (popcount(device) == 1) && ((device & ~AUDIO_DEVICE_OUT_ALL) == 0))
return true;
else
return false;
@@ -374,12 +396,20 @@ static inline bool audio_is_output_device(audio_devices_t device)
static inline bool audio_is_input_device(audio_devices_t device)
{
- if ((popcount(device) == 1) && ((device & ~AUDIO_DEVICE_IN_ALL) == 0))
- return true;
- else
- return false;
+ if ((device & AUDIO_DEVICE_BIT_IN) != 0) {
+ device &= ~AUDIO_DEVICE_BIT_IN;
+ if ((popcount(device) == 1) && ((device & ~AUDIO_DEVICE_IN_ALL) == 0))
+ return true;
+ }
+ return false;
}
+static inline bool audio_is_output_devices(audio_devices_t device)
+{
+ return (device & AUDIO_DEVICE_BIT_IN) == 0;
+}
+
+
static inline bool audio_is_a2dp_device(audio_devices_t device)
{
if ((popcount(device) == 1) && (device & AUDIO_DEVICE_OUT_ALL_A2DP))
@@ -390,6 +420,7 @@ static inline bool audio_is_a2dp_device(audio_devices_t device)
static inline bool audio_is_bluetooth_sco_device(audio_devices_t device)
{
+ device &= ~AUDIO_DEVICE_BIT_IN;
if ((popcount(device) == 1) && (device & (AUDIO_DEVICE_OUT_ALL_SCO |
AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET)))
return true;
@@ -405,6 +436,14 @@ static inline bool audio_is_usb_device(audio_devices_t device)
return false;
}
+static inline bool audio_is_remote_submix_device(audio_devices_t device)
+{
+ if ((popcount(device) == 1) && (device & AUDIO_DEVICE_OUT_REMOTE_SUBMIX))
+ return true;
+ else
+ return false;
+}
+
static inline bool audio_is_input_channel(uint32_t channel)
{
if ((channel & ~AUDIO_CHANNEL_IN_ALL) == 0)
diff --git a/include/system/audio_policy.h b/include/system/audio_policy.h
index 91b8e9c..a6554de 100644
--- a/include/system/audio_policy.h
+++ b/include/system/audio_policy.h
@@ -43,6 +43,7 @@ typedef enum {
AUDIO_POLICY_FORCE_ANALOG_DOCK,
AUDIO_POLICY_FORCE_DIGITAL_DOCK,
AUDIO_POLICY_FORCE_NO_BT_A2DP, /* A2DP sink is not preferred to speaker or wired HS */
+ AUDIO_POLICY_FORCE_SYSTEM_ENFORCED,
AUDIO_POLICY_FORCE_CFG_CNT,
AUDIO_POLICY_FORCE_CFG_MAX = AUDIO_POLICY_FORCE_CFG_CNT - 1,
@@ -56,6 +57,7 @@ typedef enum {
AUDIO_POLICY_FORCE_FOR_MEDIA,
AUDIO_POLICY_FORCE_FOR_RECORD,
AUDIO_POLICY_FORCE_FOR_DOCK,
+ AUDIO_POLICY_FORCE_FOR_SYSTEM,
AUDIO_POLICY_FORCE_USE_CNT,
AUDIO_POLICY_FORCE_USE_MAX = AUDIO_POLICY_FORCE_USE_CNT - 1,
diff --git a/include/system/camera.h b/include/system/camera.h
index e4cacc5..7a4dd53 100644
--- a/include/system/camera.h
+++ b/include/system/camera.h
@@ -163,6 +163,17 @@ enum {
* can silently finish itself or show a dialog.
*/
CAMERA_CMD_PING = 9,
+
+ /**
+ * Configure the number of video buffers used for recording. The intended
+ * video buffer count for recording is passed as arg1, which must be
+ * greater than 0. This command must be sent before recording is started.
+ * This command returns INVALID_OPERATION error if it is sent after video
+ * recording is started, or the command is not supported at all. This
+ * command also returns a BAD_VALUE error if the intended video buffer
+ * count is non-positive or too big to be realized.
+ */
+ CAMERA_CMD_SET_VIDEO_BUFFER_COUNT = 10,
};
/** camera fatal errors */
diff --git a/include/system/graphics.h b/include/system/graphics.h
index 24e2bfb..82b5fcc 100644
--- a/include/system/graphics.h
+++ b/include/system/graphics.h
@@ -109,6 +109,37 @@ enum {
*/
HAL_PIXEL_FORMAT_RAW_SENSOR = 0x20,
+ /*
+ * Android binary blob graphics buffer format:
+ *
+ * This format is used to carry task-specific data which does not have a
+ * standard image structure. The details of the format are left to the two
+ * endpoints.
+ *
+ * A typical use case is for transporting JPEG-compressed images from the
+ * Camera HAL to the framework or to applications.
+ *
+ * Buffers of this format must have a height of 1, and width equal to their
+ * size in bytes.
+ */
+ HAL_PIXEL_FORMAT_BLOB = 0x21,
+
+ /*
+ * Android format indicating that the choice of format is entirely up to the
+ * device-specific Gralloc implementation.
+ *
+ * The Gralloc implementation should examine the usage bits passed in when
+ * allocating a buffer with this format, and it should derive the pixel
+ * format from those usage flags. This format will never be used with any
+ * of the GRALLOC_USAGE_SW_* usage flags.
+ *
+ * If a buffer of this format is to be used as an OpenGL ES texture, the
+ * framework will assume that sampling the texture will always return an
+ * alpha value of 1.0 (i.e. the buffer contains only opaque pixel values).
+ *
+ */
+ HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED = 0x22,
+
/* Legacy formats (deprecated), used by ImageFormat.java */
HAL_PIXEL_FORMAT_YCbCr_422_SP = 0x10, // NV16
HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21
diff --git a/include/system/window.h b/include/system/window.h
index 8e00bcd..4698fb3 100644
--- a/include/system/window.h
+++ b/include/system/window.h
@@ -17,11 +17,15 @@
#ifndef SYSTEM_CORE_INCLUDE_ANDROID_WINDOW_H
#define SYSTEM_CORE_INCLUDE_ANDROID_WINDOW_H
+#include <cutils/native_handle.h>
+#include <errno.h>
+#include <limits.h>
#include <stdint.h>
#include <string.h>
+#include <sync/sync.h>
#include <sys/cdefs.h>
#include <system/graphics.h>
-#include <cutils/native_handle.h>
+#include <unistd.h>
__BEGIN_DECLS
@@ -38,6 +42,14 @@ __BEGIN_DECLS
// ---------------------------------------------------------------------------
+// This #define may be used to conditionally compile device-specific code to
+// support either the prior ANativeWindow interface, which did not pass libsync
+// fences around, or the new interface that does. This #define is only present
+// when the ANativeWindow interface does include libsync support.
+#define ANDROID_NATIVE_WINDOW_HAS_SYNC 1
+
+// ---------------------------------------------------------------------------
+
typedef const native_handle_t* buffer_handle_t;
// ---------------------------------------------------------------------------
@@ -379,8 +391,12 @@ struct ANativeWindow
* allowed if a specific buffer count has been set.
*
* Returns 0 on success or -errno on error.
+ *
+ * XXX: This function is deprecated. It will continue to work for some
+ * time for binary compatibility, but the new dequeueBuffer function that
+ * outputs a fence file descriptor should be used in its place.
*/
- int (*dequeueBuffer)(struct ANativeWindow* window,
+ int (*dequeueBuffer_DEPRECATED)(struct ANativeWindow* window,
struct ANativeWindowBuffer** buffer);
/*
@@ -389,9 +405,14 @@ struct ANativeWindow
* dequeueBuffer first.
*
* Returns 0 on success or -errno on error.
+ *
+ * XXX: This function is deprecated. It will continue to work for some
+ * time for binary compatibility, but it is essentially a no-op, and calls
+ * to it should be removed.
*/
- int (*lockBuffer)(struct ANativeWindow* window,
+ int (*lockBuffer_DEPRECATED)(struct ANativeWindow* window,
struct ANativeWindowBuffer* buffer);
+
/*
* Hook called by EGL when modifications to the render buffer are done.
* This unlocks and post the buffer.
@@ -405,8 +426,13 @@ struct ANativeWindow
* Buffers MUST be queued in the same order than they were dequeued.
*
* Returns 0 on success or -errno on error.
+ *
+ * XXX: This function is deprecated. It will continue to work for some
+ * time for binary compatibility, but the new queueBuffer function that
+ * takes a fence file descriptor should be used in its place (pass a value
+ * of -1 for the fence file descriptor if there is no valid one to pass).
*/
- int (*queueBuffer)(struct ANativeWindow* window,
+ int (*queueBuffer_DEPRECATED)(struct ANativeWindow* window,
struct ANativeWindowBuffer* buffer);
/*
@@ -463,12 +489,86 @@ struct ANativeWindow
* reference if they might use the buffer after queueing or canceling it.
* Holding a reference to a buffer after queueing or canceling it is only
* allowed if a specific buffer count has been set.
+ *
+ * XXX: This function is deprecated. It will continue to work for some
+ * time for binary compatibility, but the new cancelBuffer function that
+ * takes a fence file descriptor should be used in its place (pass a value
+ * of -1 for the fence file descriptor if there is no valid one to pass).
*/
- int (*cancelBuffer)(struct ANativeWindow* window,
+ int (*cancelBuffer_DEPRECATED)(struct ANativeWindow* window,
struct ANativeWindowBuffer* buffer);
+ /*
+ * Hook called by EGL to acquire a buffer. This call may block if no
+ * buffers are available.
+ *
+ * The window holds a reference to the buffer between dequeueBuffer and
+ * either queueBuffer or cancelBuffer, so clients only need their own
+ * reference if they might use the buffer after queueing or canceling it.
+ * Holding a reference to a buffer after queueing or canceling it is only
+ * allowed if a specific buffer count has been set.
+ *
+ * The libsync fence file descriptor returned in the int pointed to by the
+ * fenceFd argument will refer to the fence that must signal before the
+ * dequeued buffer may be written to. A value of -1 indicates that the
+ * caller may access the buffer immediately without waiting on a fence. If
+ * a valid file descriptor is returned (i.e. any value except -1) then the
+ * caller is responsible for closing the file descriptor.
+ *
+ * Returns 0 on success or -errno on error.
+ */
+ int (*dequeueBuffer)(struct ANativeWindow* window,
+ struct ANativeWindowBuffer** buffer, int* fenceFd);
- void* reserved_proc[2];
+ /*
+ * Hook called by EGL when modifications to the render buffer are done.
+ * This unlocks and post the buffer.
+ *
+ * The window holds a reference to the buffer between dequeueBuffer and
+ * either queueBuffer or cancelBuffer, so clients only need their own
+ * reference if they might use the buffer after queueing or canceling it.
+ * Holding a reference to a buffer after queueing or canceling it is only
+ * allowed if a specific buffer count has been set.
+ *
+ * The fenceFd argument specifies a libsync fence file descriptor for a
+ * fence that must signal before the buffer can be accessed. If the buffer
+ * can be accessed immediately then a value of -1 should be used. The
+ * caller must not use the file descriptor after it is passed to
+ * queueBuffer, and the ANativeWindow implementation is responsible for
+ * closing it.
+ *
+ * Returns 0 on success or -errno on error.
+ */
+ int (*queueBuffer)(struct ANativeWindow* window,
+ struct ANativeWindowBuffer* buffer, int fenceFd);
+
+ /*
+ * Hook used to cancel a buffer that has been dequeued.
+ * No synchronization is performed between dequeue() and cancel(), so
+ * either external synchronization is needed, or these functions must be
+ * called from the same thread.
+ *
+ * The window holds a reference to the buffer between dequeueBuffer and
+ * either queueBuffer or cancelBuffer, so clients only need their own
+ * reference if they might use the buffer after queueing or canceling it.
+ * Holding a reference to a buffer after queueing or canceling it is only
+ * allowed if a specific buffer count has been set.
+ *
+ * The fenceFd argument specifies a libsync fence file decsriptor for a
+ * fence that must signal before the buffer can be accessed. If the buffer
+ * can be accessed immediately then a value of -1 should be used.
+ *
+ * Note that if the client has not waited on the fence that was returned
+ * from dequeueBuffer, that same fence should be passed to cancelBuffer to
+ * ensure that future uses of the buffer are preceded by a wait on that
+ * fence. The caller must not use the file descriptor after it is passed
+ * to cancelBuffer, and the ANativeWindow implementation is responsible for
+ * closing it.
+ *
+ * Returns 0 on success or -errno on error.
+ */
+ int (*cancelBuffer)(struct ANativeWindow* window,
+ struct ANativeWindowBuffer* buffer, int fenceFd);
};
/* Backwards compatibility: use ANativeWindow (struct ANativeWindow in C).
@@ -551,7 +651,7 @@ static inline int native_window_set_post_transform_crop(
/*
* native_window_set_active_rect(..., active_rect)
*
- * This function is deprectated and will be removed soon. For now it simply
+ * This function is deprecated and will be removed soon. For now it simply
* sets the post-transform crop for compatibility while multi-project commits
* get checked.
*/
@@ -717,6 +817,17 @@ static inline int native_window_api_disconnect(
return window->perform(window, NATIVE_WINDOW_API_DISCONNECT, api);
}
+/*
+ * native_window_dequeue_buffer_and_wait(...)
+ * Dequeue a buffer and wait on the fence associated with that buffer. The
+ * buffer may safely be accessed immediately upon this function returning. An
+ * error is returned if either of the dequeue or the wait operations fail.
+ */
+static inline int native_window_dequeue_buffer_and_wait(ANativeWindow *anw,
+ struct ANativeWindowBuffer** anb) {
+ return anw->dequeueBuffer_DEPRECATED(anw, anb);
+}
+
__END_DECLS