mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
android_stub: avoid vending in unused headers
Drop the redundant headers from libsystem and libnativewindow: - include/android_stub/android/hdr_metadata.h - include/android_stub/system/camera.h - include/android_stub/system/radio.h - include/android_stub/system/thread_defs.h Acked-by: Valentine Burley <valentine.burley@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41373>
This commit is contained in:
parent
9a01a5590a
commit
4193314295
5 changed files with 6 additions and 720 deletions
|
|
@ -31,14 +31,13 @@ rm -rf ${dest}
|
|||
mkdir ${dest}
|
||||
|
||||
|
||||
# These directories contains mostly only the files we need, so copy wholesale
|
||||
# These directories contains only the files we need, so copy wholesale
|
||||
|
||||
cp -av \
|
||||
platform-frameworks-native/libs/nativewindow/include/vndk \
|
||||
platform-frameworks-native/libs/nativebase/include/nativebase \
|
||||
platform-system-core/libsync/include/ndk \
|
||||
platform-system-core/libsync/include/sync \
|
||||
platform-system-core/libsystem/include/system \
|
||||
platform-system-unwinding/libbacktrace/include/backtrace \
|
||||
${dest}
|
||||
|
||||
|
|
@ -52,14 +51,16 @@ cp -av platform-frameworks-native/vulkan/include/hardware/hwvulkan.h ${dest}/har
|
|||
mkdir ${dest}/cutils
|
||||
cp -av platform-system-core/libcutils/include/cutils/native_handle.h ${dest}/cutils
|
||||
|
||||
mkdir ${dest}/system
|
||||
cp -av platform-system-core/libsystem/include/system/{graphics*,window.h} ${dest}/system
|
||||
|
||||
# include/android has files from a few different projects
|
||||
|
||||
mkdir ${dest}/android
|
||||
cp -av \
|
||||
platform-frameworks-native/libs/nativewindow/include/android/* \
|
||||
platform-frameworks-native/libs/arect/include/android/* \
|
||||
platform-system-core/libsync/include/android/* \
|
||||
platform-frameworks-native/libs/nativewindow/include/android/{data_space,hardware_buffer,native_window}.h \
|
||||
platform-frameworks-native/libs/arect/include/android/rect.h \
|
||||
platform-system-core/libsync/include/android/sync.h \
|
||||
platform-system-logging/liblog/include/android/log.h \
|
||||
${dest}/android
|
||||
|
||||
|
|
|
|||
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file hdr_metadata.h
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HDR_METADATA_H
|
||||
#define ANDROID_HDR_METADATA_H
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* These structures are used to define the display's capabilities for HDR content.
|
||||
* They can be used to better tone map content to user's display.
|
||||
*/
|
||||
|
||||
/**
|
||||
* HDR metadata standards that are supported by Android.
|
||||
*/
|
||||
enum AHdrMetadataType : uint32_t {
|
||||
HDR10_SMPTE2086 = 1,
|
||||
HDR10_CTA861_3 = 2,
|
||||
HDR10PLUS_SEI = 3,
|
||||
};
|
||||
|
||||
/**
|
||||
* Color is defined in CIE XYZ coordinates.
|
||||
*/
|
||||
struct AColor_xy {
|
||||
float x;
|
||||
float y;
|
||||
};
|
||||
|
||||
/**
|
||||
* SMPTE ST 2086 "Mastering Display Color Volume" static metadata
|
||||
*/
|
||||
struct AHdrMetadata_smpte2086 {
|
||||
struct AColor_xy displayPrimaryRed;
|
||||
struct AColor_xy displayPrimaryGreen;
|
||||
struct AColor_xy displayPrimaryBlue;
|
||||
struct AColor_xy whitePoint;
|
||||
float maxLuminance;
|
||||
float minLuminance;
|
||||
};
|
||||
|
||||
/**
|
||||
* CTA 861.3 "HDR Static Metadata Extension" static metadata
|
||||
*/
|
||||
struct AHdrMetadata_cta861_3 {
|
||||
float maxContentLightLevel;
|
||||
float maxFrameAverageLightLevel;
|
||||
};
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif // ANDROID_HDR_METADATA_H
|
||||
|
|
@ -1,307 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SYSTEM_CORE_INCLUDE_ANDROID_CAMERA_H
|
||||
#define SYSTEM_CORE_INCLUDE_ANDROID_CAMERA_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <cutils/native_handle.h>
|
||||
#include <hardware/hardware.h>
|
||||
#include <hardware/gralloc.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* A set of bit masks for specifying how the received preview frames are
|
||||
* handled before the previewCallback() call.
|
||||
*
|
||||
* The least significant 3 bits of an "int" value are used for this purpose:
|
||||
*
|
||||
* ..... 0 0 0
|
||||
* ^ ^ ^
|
||||
* | | |---------> determine whether the callback is enabled or not
|
||||
* | |-----------> determine whether the callback is one-shot or not
|
||||
* |-------------> determine whether the frame is copied out or not
|
||||
*
|
||||
* WARNING: When a frame is sent directly without copying, it is the frame
|
||||
* receiver's responsiblity to make sure that the frame data won't get
|
||||
* corrupted by subsequent preview frames filled by the camera. This flag is
|
||||
* recommended only when copying out data brings significant performance price
|
||||
* and the handling/processing of the received frame data is always faster than
|
||||
* the preview frame rate so that data corruption won't occur.
|
||||
*
|
||||
* For instance,
|
||||
* 1. 0x00 disables the callback. In this case, copy out and one shot bits
|
||||
* are ignored.
|
||||
* 2. 0x01 enables a callback without copying out the received frames. A
|
||||
* typical use case is the Camcorder application to avoid making costly
|
||||
* frame copies.
|
||||
* 3. 0x05 is enabling a callback with frame copied out repeatedly. A typical
|
||||
* use case is the Camera application.
|
||||
* 4. 0x07 is enabling a callback with frame copied out only once. A typical
|
||||
* use case is the Barcode scanner application.
|
||||
*/
|
||||
|
||||
enum {
|
||||
CAMERA_FRAME_CALLBACK_FLAG_ENABLE_MASK = 0x01,
|
||||
CAMERA_FRAME_CALLBACK_FLAG_ONE_SHOT_MASK = 0x02,
|
||||
CAMERA_FRAME_CALLBACK_FLAG_COPY_OUT_MASK = 0x04,
|
||||
/** Typical use cases */
|
||||
CAMERA_FRAME_CALLBACK_FLAG_NOOP = 0x00,
|
||||
CAMERA_FRAME_CALLBACK_FLAG_CAMCORDER = 0x01,
|
||||
CAMERA_FRAME_CALLBACK_FLAG_CAMERA = 0x05,
|
||||
CAMERA_FRAME_CALLBACK_FLAG_BARCODE_SCANNER = 0x07
|
||||
};
|
||||
|
||||
/** msgType in notifyCallback and dataCallback functions */
|
||||
enum {
|
||||
CAMERA_MSG_ERROR = 0x0001, // notifyCallback
|
||||
CAMERA_MSG_SHUTTER = 0x0002, // notifyCallback
|
||||
CAMERA_MSG_FOCUS = 0x0004, // notifyCallback
|
||||
CAMERA_MSG_ZOOM = 0x0008, // notifyCallback
|
||||
CAMERA_MSG_PREVIEW_FRAME = 0x0010, // dataCallback
|
||||
CAMERA_MSG_VIDEO_FRAME = 0x0020, // data_timestamp_callback
|
||||
CAMERA_MSG_POSTVIEW_FRAME = 0x0040, // dataCallback
|
||||
CAMERA_MSG_RAW_IMAGE = 0x0080, // dataCallback
|
||||
CAMERA_MSG_COMPRESSED_IMAGE = 0x0100, // dataCallback
|
||||
CAMERA_MSG_RAW_IMAGE_NOTIFY = 0x0200, // dataCallback
|
||||
// Preview frame metadata. This can be combined with
|
||||
// CAMERA_MSG_PREVIEW_FRAME in dataCallback. For example, the apps can
|
||||
// request FRAME and METADATA. Or the apps can request only FRAME or only
|
||||
// METADATA.
|
||||
CAMERA_MSG_PREVIEW_METADATA = 0x0400, // dataCallback
|
||||
// Notify on autofocus start and stop. This is useful in continuous
|
||||
// autofocus - FOCUS_MODE_CONTINUOUS_VIDEO and FOCUS_MODE_CONTINUOUS_PICTURE.
|
||||
CAMERA_MSG_FOCUS_MOVE = 0x0800, // notifyCallback
|
||||
CAMERA_MSG_ALL_MSGS = 0xFFFF
|
||||
};
|
||||
|
||||
/** cmdType in sendCommand functions */
|
||||
enum {
|
||||
CAMERA_CMD_START_SMOOTH_ZOOM = 1,
|
||||
CAMERA_CMD_STOP_SMOOTH_ZOOM = 2,
|
||||
|
||||
/**
|
||||
* Set the clockwise rotation of preview display (setPreviewDisplay) in
|
||||
* degrees. This affects the preview frames and the picture displayed after
|
||||
* snapshot. This method is useful for portrait mode applications. Note
|
||||
* that preview display of front-facing cameras is flipped horizontally
|
||||
* before the rotation, that is, the image is reflected along the central
|
||||
* vertical axis of the camera sensor. So the users can see themselves as
|
||||
* looking into a mirror.
|
||||
*
|
||||
* This does not affect the order of byte array of
|
||||
* CAMERA_MSG_PREVIEW_FRAME, CAMERA_MSG_VIDEO_FRAME,
|
||||
* CAMERA_MSG_POSTVIEW_FRAME, CAMERA_MSG_RAW_IMAGE, or
|
||||
* CAMERA_MSG_COMPRESSED_IMAGE. This is allowed to be set during preview
|
||||
* since API level 14.
|
||||
*/
|
||||
CAMERA_CMD_SET_DISPLAY_ORIENTATION = 3,
|
||||
|
||||
/**
|
||||
* cmdType to disable/enable shutter sound. In sendCommand passing arg1 =
|
||||
* 0 will disable, while passing arg1 = 1 will enable the shutter sound.
|
||||
*/
|
||||
CAMERA_CMD_ENABLE_SHUTTER_SOUND = 4,
|
||||
|
||||
/* cmdType to play recording sound */
|
||||
CAMERA_CMD_PLAY_RECORDING_SOUND = 5,
|
||||
|
||||
/**
|
||||
* Start the face detection. This should be called after preview is started.
|
||||
* The camera will notify the listener of CAMERA_MSG_FACE and the detected
|
||||
* faces in the preview frame. The detected faces may be the same as the
|
||||
* previous ones. Apps should call CAMERA_CMD_STOP_FACE_DETECTION to stop
|
||||
* the face detection. This method is supported if CameraParameters
|
||||
* KEY_MAX_NUM_HW_DETECTED_FACES or KEY_MAX_NUM_SW_DETECTED_FACES is
|
||||
* bigger than 0. Hardware and software face detection should not be running
|
||||
* at the same time. If the face detection has started, apps should not send
|
||||
* this again.
|
||||
*
|
||||
* In hardware face detection mode, CameraParameters KEY_WHITE_BALANCE,
|
||||
* KEY_FOCUS_AREAS and KEY_METERING_AREAS have no effect.
|
||||
*
|
||||
* arg1 is the face detection type. It can be CAMERA_FACE_DETECTION_HW or
|
||||
* CAMERA_FACE_DETECTION_SW. If the type of face detection requested is not
|
||||
* supported, the HAL must return BAD_VALUE.
|
||||
*/
|
||||
CAMERA_CMD_START_FACE_DETECTION = 6,
|
||||
|
||||
/**
|
||||
* Stop the face detection.
|
||||
*/
|
||||
CAMERA_CMD_STOP_FACE_DETECTION = 7,
|
||||
|
||||
/**
|
||||
* Enable/disable focus move callback (CAMERA_MSG_FOCUS_MOVE). Passing
|
||||
* arg1 = 0 will disable, while passing arg1 = 1 will enable the callback.
|
||||
*/
|
||||
CAMERA_CMD_ENABLE_FOCUS_MOVE_MSG = 8,
|
||||
|
||||
/**
|
||||
* Ping camera service to see if camera hardware is released.
|
||||
*
|
||||
* When any camera method returns error, the client can use ping command
|
||||
* to see if the camera has been taken away by other clients. If the result
|
||||
* is OK, it means the camera hardware is not released. If the result
|
||||
* is not OK, the camera has been released and the existing client
|
||||
* 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,
|
||||
|
||||
/**
|
||||
* Configure an explicit format to use for video recording metadata mode.
|
||||
* This can be used to switch the format from the
|
||||
* default IMPLEMENTATION_DEFINED gralloc format to some other
|
||||
* device-supported format, and the default dataspace from the BT_709 color
|
||||
* space to some other device-supported dataspace. arg1 is the HAL pixel
|
||||
* format, and arg2 is the HAL dataSpace. This command returns
|
||||
* INVALID_OPERATION error if it is sent after video recording is started,
|
||||
* or the command is not supported at all.
|
||||
*
|
||||
* If the gralloc format is set to a format other than
|
||||
* IMPLEMENTATION_DEFINED, then HALv3 devices will use gralloc usage flags
|
||||
* of SW_READ_OFTEN.
|
||||
*/
|
||||
CAMERA_CMD_SET_VIDEO_FORMAT = 11
|
||||
};
|
||||
|
||||
/** camera fatal errors */
|
||||
enum {
|
||||
CAMERA_ERROR_UNKNOWN = 1,
|
||||
/**
|
||||
* Camera was released because another client has connected to the camera.
|
||||
* The original client should call Camera::disconnect immediately after
|
||||
* getting this notification. Otherwise, the camera will be released by
|
||||
* camera service in a short time. The client should not call any method
|
||||
* (except disconnect and sending CAMERA_CMD_PING) after getting this.
|
||||
*/
|
||||
CAMERA_ERROR_RELEASED = 2,
|
||||
|
||||
/**
|
||||
* Camera was released because device policy change or the client application
|
||||
* is going to background. The client should call Camera::disconnect
|
||||
* immediately after getting this notification. Otherwise, the camera will be
|
||||
* released by camera service in a short time. The client should not call any
|
||||
* method (except disconnect and sending CAMERA_CMD_PING) after getting this.
|
||||
*/
|
||||
CAMERA_ERROR_DISABLED = 3,
|
||||
CAMERA_ERROR_SERVER_DIED = 100
|
||||
};
|
||||
|
||||
enum {
|
||||
/** The facing of the camera is opposite to that of the screen. */
|
||||
CAMERA_FACING_BACK = 0,
|
||||
/** The facing of the camera is the same as that of the screen. */
|
||||
CAMERA_FACING_FRONT = 1,
|
||||
/**
|
||||
* The facing of the camera is not fixed relative to the screen.
|
||||
* The cameras with this facing are external cameras, e.g. USB cameras.
|
||||
*/
|
||||
CAMERA_FACING_EXTERNAL = 2
|
||||
};
|
||||
|
||||
enum {
|
||||
/** Hardware face detection. It does not use much CPU. */
|
||||
CAMERA_FACE_DETECTION_HW = 0,
|
||||
/**
|
||||
* Software face detection. It uses some CPU. Applications must use
|
||||
* Camera.setPreviewTexture for preview in this mode.
|
||||
*/
|
||||
CAMERA_FACE_DETECTION_SW = 1
|
||||
};
|
||||
|
||||
/**
|
||||
* The information of a face from camera face detection.
|
||||
*/
|
||||
typedef struct camera_face {
|
||||
/**
|
||||
* Bounds of the face [left, top, right, bottom]. (-1000, -1000) represents
|
||||
* the top-left of the camera field of view, and (1000, 1000) represents the
|
||||
* bottom-right of the field of view. The width and height cannot be 0 or
|
||||
* negative. This is supported by both hardware and software face detection.
|
||||
*
|
||||
* The direction is relative to the sensor orientation, that is, what the
|
||||
* sensor sees. The direction is not affected by the rotation or mirroring
|
||||
* of CAMERA_CMD_SET_DISPLAY_ORIENTATION.
|
||||
*/
|
||||
int32_t rect[4];
|
||||
|
||||
/**
|
||||
* The confidence level of the face. The range is 1 to 100. 100 is the
|
||||
* highest confidence. This is supported by both hardware and software
|
||||
* face detection.
|
||||
*/
|
||||
int32_t score;
|
||||
|
||||
/**
|
||||
* An unique id per face while the face is visible to the tracker. If
|
||||
* the face leaves the field-of-view and comes back, it will get a new
|
||||
* id. If the value is 0, id is not supported.
|
||||
*/
|
||||
int32_t id;
|
||||
|
||||
/**
|
||||
* The coordinates of the center of the left eye. The range is -1000 to
|
||||
* 1000. -2000, -2000 if this is not supported.
|
||||
*/
|
||||
int32_t left_eye[2];
|
||||
|
||||
/**
|
||||
* The coordinates of the center of the right eye. The range is -1000 to
|
||||
* 1000. -2000, -2000 if this is not supported.
|
||||
*/
|
||||
int32_t right_eye[2];
|
||||
|
||||
/**
|
||||
* The coordinates of the center of the mouth. The range is -1000 to 1000.
|
||||
* -2000, -2000 if this is not supported.
|
||||
*/
|
||||
int32_t mouth[2];
|
||||
|
||||
} camera_face_t;
|
||||
|
||||
/**
|
||||
* The metadata of the frame data.
|
||||
*/
|
||||
typedef struct camera_frame_metadata {
|
||||
/**
|
||||
* The number of detected faces in the frame.
|
||||
*/
|
||||
int32_t number_of_faces;
|
||||
|
||||
/**
|
||||
* An array of the detected faces. The length is number_of_faces.
|
||||
*/
|
||||
camera_face_t *faces;
|
||||
} camera_frame_metadata_t;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* SYSTEM_CORE_INCLUDE_ANDROID_CAMERA_H */
|
||||
|
|
@ -1,254 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_RADIO_H
|
||||
#define ANDROID_RADIO_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
#define RADIO_NUM_BANDS_MAX 16
|
||||
#define RADIO_NUM_SPACINGS_MAX 16
|
||||
#define RADIO_STRING_LEN_MAX 128
|
||||
|
||||
/*
|
||||
* Radio hardware module class. A given radio hardware module HAL is of one class
|
||||
* only. The platform can not have more than one hardware module of each class.
|
||||
* Current version of the framework only supports RADIO_CLASS_AM_FM.
|
||||
*/
|
||||
typedef enum {
|
||||
RADIO_CLASS_AM_FM = 0, /* FM (including HD radio) and AM */
|
||||
RADIO_CLASS_SAT = 1, /* Satellite Radio */
|
||||
RADIO_CLASS_DT = 2, /* Digital Radio (DAB) */
|
||||
} radio_class_t;
|
||||
|
||||
/* value for field "type" of radio band described in struct radio_hal_band_config */
|
||||
typedef enum {
|
||||
RADIO_BAND_AM = 0, /* Amplitude Modulation band: LW, MW, SW */
|
||||
RADIO_BAND_FM = 1, /* Frequency Modulation band: FM */
|
||||
RADIO_BAND_FM_HD = 2, /* FM HD Radio / DRM (IBOC) */
|
||||
RADIO_BAND_AM_HD = 3, /* AM HD Radio / DRM (IBOC) */
|
||||
} radio_band_t;
|
||||
|
||||
/* RDS variant implemented. A struct radio_hal_fm_band_config can list none or several. */
|
||||
enum {
|
||||
RADIO_RDS_NONE = 0x0,
|
||||
RADIO_RDS_WORLD = 0x01,
|
||||
RADIO_RDS_US = 0x02,
|
||||
};
|
||||
typedef unsigned int radio_rds_t;
|
||||
|
||||
/* FM deemphasis variant implemented. A struct radio_hal_fm_band_config can list one or more. */
|
||||
enum {
|
||||
RADIO_DEEMPHASIS_50 = 0x1,
|
||||
RADIO_DEEMPHASIS_75 = 0x2,
|
||||
};
|
||||
typedef unsigned int radio_deemphasis_t;
|
||||
|
||||
/* Region a particular radio band configuration corresponds to. Not used at the HAL.
|
||||
* Derived by the framework when converting the band descriptors retrieved from the HAL to
|
||||
* individual band descriptors for each supported region. */
|
||||
typedef enum {
|
||||
RADIO_REGION_NONE = -1,
|
||||
RADIO_REGION_ITU_1 = 0,
|
||||
RADIO_REGION_ITU_2 = 1,
|
||||
RADIO_REGION_OIRT = 2,
|
||||
RADIO_REGION_JAPAN = 3,
|
||||
RADIO_REGION_KOREA = 4,
|
||||
} radio_region_t;
|
||||
|
||||
/* scanning direction for scan() and step() tuner APIs */
|
||||
typedef enum {
|
||||
RADIO_DIRECTION_UP,
|
||||
RADIO_DIRECTION_DOWN
|
||||
} radio_direction_t;
|
||||
|
||||
/* unique handle allocated to a radio module */
|
||||
typedef uint32_t radio_handle_t;
|
||||
|
||||
/* Opaque meta data structure used by radio meta data API (see system/radio_metadata.h) */
|
||||
typedef struct radio_metadata radio_metadata_t;
|
||||
|
||||
|
||||
/* Additional attributes for an FM band configuration */
|
||||
typedef struct radio_hal_fm_band_config {
|
||||
radio_deemphasis_t deemphasis; /* deemphasis variant */
|
||||
bool stereo; /* stereo supported */
|
||||
radio_rds_t rds; /* RDS variants supported */
|
||||
bool ta; /* Traffic Announcement supported */
|
||||
bool af; /* Alternate Frequency supported */
|
||||
bool ea; /* Emergency announcements supported */
|
||||
} radio_hal_fm_band_config_t;
|
||||
|
||||
/* Additional attributes for an AM band configuration */
|
||||
typedef struct radio_hal_am_band_config {
|
||||
bool stereo; /* stereo supported */
|
||||
} radio_hal_am_band_config_t;
|
||||
|
||||
/* Radio band configuration. Describes a given band supported by the radio module.
|
||||
* The HAL can expose only one band per type with the the maximum range supported and all options.
|
||||
* THe framework will derive the actual regions were this module can operate and expose separate
|
||||
* band configurations for applications to chose from. */
|
||||
typedef struct radio_hal_band_config {
|
||||
radio_band_t type;
|
||||
bool antenna_connected;
|
||||
uint32_t lower_limit;
|
||||
uint32_t upper_limit;
|
||||
uint32_t num_spacings;
|
||||
uint32_t spacings[RADIO_NUM_SPACINGS_MAX];
|
||||
union {
|
||||
radio_hal_fm_band_config_t fm;
|
||||
radio_hal_am_band_config_t am;
|
||||
};
|
||||
} radio_hal_band_config_t;
|
||||
|
||||
/* Used internally by the framework to represent a band for s specific region */
|
||||
typedef struct radio_band_config {
|
||||
radio_region_t region;
|
||||
radio_hal_band_config_t band;
|
||||
} radio_band_config_t;
|
||||
|
||||
|
||||
/* Exposes properties of a given hardware radio module.
|
||||
* NOTE: current framework implementation supports only one audio source (num_audio_sources = 1).
|
||||
* The source corresponds to AUDIO_DEVICE_IN_FM_TUNER.
|
||||
* If more than one tuner is supported (num_tuners > 1), only one can be connected to the audio
|
||||
* source. */
|
||||
typedef struct radio_hal_properties {
|
||||
radio_class_t class_id; /* Class of this module. E.g RADIO_CLASS_AM_FM */
|
||||
char implementor[RADIO_STRING_LEN_MAX]; /* implementor name */
|
||||
char product[RADIO_STRING_LEN_MAX]; /* product name */
|
||||
char version[RADIO_STRING_LEN_MAX]; /* product version */
|
||||
char serial[RADIO_STRING_LEN_MAX]; /* serial number (for subscription services) */
|
||||
uint32_t num_tuners; /* number of tuners controllable independently */
|
||||
uint32_t num_audio_sources; /* number of audio sources driven simultaneously */
|
||||
bool supports_capture; /* the hardware supports capture of audio source audio HAL */
|
||||
uint32_t num_bands; /* number of band descriptors */
|
||||
radio_hal_band_config_t bands[RADIO_NUM_BANDS_MAX]; /* band descriptors */
|
||||
} radio_hal_properties_t;
|
||||
|
||||
/* Used internally by the framework. Same information as in struct radio_hal_properties plus a
|
||||
* unique handle and one band configuration per region. */
|
||||
typedef struct radio_properties {
|
||||
radio_handle_t handle;
|
||||
radio_class_t class_id;
|
||||
char implementor[RADIO_STRING_LEN_MAX];
|
||||
char product[RADIO_STRING_LEN_MAX];
|
||||
char version[RADIO_STRING_LEN_MAX];
|
||||
char serial[RADIO_STRING_LEN_MAX];
|
||||
uint32_t num_tuners;
|
||||
uint32_t num_audio_sources;
|
||||
bool supports_capture;
|
||||
uint32_t num_bands;
|
||||
radio_band_config_t bands[RADIO_NUM_BANDS_MAX];
|
||||
} radio_properties_t;
|
||||
|
||||
/* Radio program information. Returned by the HAL with event RADIO_EVENT_TUNED.
|
||||
* Contains information on currently tuned channel.
|
||||
*/
|
||||
typedef struct radio_program_info {
|
||||
uint32_t channel; /* current channel. (e.g kHz for band type RADIO_BAND_FM) */
|
||||
uint32_t sub_channel; /* current sub channel. (used for RADIO_BAND_FM_HD) */
|
||||
bool tuned; /* tuned to a program or not */
|
||||
bool stereo; /* program is stereo or not */
|
||||
bool digital; /* digital program or not (e.g HD Radio program) */
|
||||
uint32_t signal_strength; /* signal strength from 0 to 100 */
|
||||
/* meta data (e.g PTY, song title ...), must not be NULL */
|
||||
__attribute__((aligned(8))) radio_metadata_t *metadata;
|
||||
} radio_program_info_t;
|
||||
|
||||
|
||||
/* Events sent to the framework via the HAL callback. An event can notify the completion of an
|
||||
* asynchronous command (configuration, tune, scan ...) or a spontaneous change (antenna connection,
|
||||
* failure, AF switching, meta data reception... */
|
||||
enum {
|
||||
RADIO_EVENT_HW_FAILURE = 0, /* hardware module failure. Requires reopening the tuner */
|
||||
RADIO_EVENT_CONFIG = 1, /* configuration change completed */
|
||||
RADIO_EVENT_ANTENNA = 2, /* Antenna connected, disconnected */
|
||||
RADIO_EVENT_TUNED = 3, /* tune, step, scan completed */
|
||||
RADIO_EVENT_METADATA = 4, /* New meta data received */
|
||||
RADIO_EVENT_TA = 5, /* Traffic announcement start or stop */
|
||||
RADIO_EVENT_AF_SWITCH = 6, /* Switch to Alternate Frequency */
|
||||
RADIO_EVENT_EA = 7, /* Emergency announcement start or stop */
|
||||
// begin framework only events
|
||||
RADIO_EVENT_CONTROL = 100, /* loss/gain of tuner control */
|
||||
RADIO_EVENT_SERVER_DIED = 101, /* radio service died */
|
||||
};
|
||||
typedef unsigned int radio_event_type_t;
|
||||
|
||||
/* Event passed to the framework by the HAL callback */
|
||||
typedef struct radio_hal_event {
|
||||
radio_event_type_t type; /* event type */
|
||||
int32_t status; /* used by RADIO_EVENT_CONFIG, RADIO_EVENT_TUNED */
|
||||
union {
|
||||
/* RADIO_EVENT_ANTENNA, RADIO_EVENT_TA, RADIO_EVENT_EA */
|
||||
bool on;
|
||||
radio_hal_band_config_t config; /* RADIO_EVENT_CONFIG */
|
||||
radio_program_info_t info; /* RADIO_EVENT_TUNED, RADIO_EVENT_AF_SWITCH */
|
||||
radio_metadata_t *metadata; /* RADIO_EVENT_METADATA */
|
||||
};
|
||||
} radio_hal_event_t;
|
||||
|
||||
/* Used internally by the framework. Same information as in struct radio_hal_event */
|
||||
typedef struct radio_event {
|
||||
radio_event_type_t type;
|
||||
int32_t status;
|
||||
union {
|
||||
bool on;
|
||||
radio_band_config_t config;
|
||||
radio_program_info_t info;
|
||||
/* meta data (e.g PTY, song title ...), must not be NULL */
|
||||
__attribute__((aligned(8))) radio_metadata_t *metadata;
|
||||
};
|
||||
} radio_event_t;
|
||||
|
||||
|
||||
static inline
|
||||
radio_rds_t radio_rds_for_region(bool rds, radio_region_t region) {
|
||||
if (!rds)
|
||||
return RADIO_RDS_NONE;
|
||||
switch(region) {
|
||||
case RADIO_REGION_ITU_1:
|
||||
case RADIO_REGION_OIRT:
|
||||
case RADIO_REGION_JAPAN:
|
||||
case RADIO_REGION_KOREA:
|
||||
return RADIO_RDS_WORLD;
|
||||
case RADIO_REGION_ITU_2:
|
||||
return RADIO_RDS_US;
|
||||
default:
|
||||
return RADIO_REGION_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
static inline
|
||||
radio_deemphasis_t radio_demephasis_for_region(radio_region_t region) {
|
||||
switch(region) {
|
||||
case RADIO_REGION_KOREA:
|
||||
case RADIO_REGION_ITU_2:
|
||||
return RADIO_DEEMPHASIS_75;
|
||||
case RADIO_REGION_ITU_1:
|
||||
case RADIO_REGION_OIRT:
|
||||
case RADIO_REGION_JAPAN:
|
||||
default:
|
||||
return RADIO_DEEMPHASIS_50;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // ANDROID_RADIO_H
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2013 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_THREAD_DEFS_H
|
||||
#define ANDROID_THREAD_DEFS_H
|
||||
|
||||
#include "graphics.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
/*
|
||||
* ***********************************************
|
||||
* ** Keep in sync with android.os.Process.java **
|
||||
* ***********************************************
|
||||
*
|
||||
* This maps directly to the "nice" priorities we use in Android.
|
||||
* A thread priority should be chosen inverse-proportionally to
|
||||
* the amount of work the thread is expected to do. The more work
|
||||
* a thread will do, the less favorable priority it should get so that
|
||||
* it doesn't starve the system. Threads not behaving properly might
|
||||
* be "punished" by the kernel.
|
||||
* Use the levels below when appropriate. Intermediate values are
|
||||
* acceptable, preferably use the {MORE|LESS}_FAVORABLE constants below.
|
||||
*/
|
||||
ANDROID_PRIORITY_LOWEST = 19,
|
||||
|
||||
/* use for background tasks */
|
||||
ANDROID_PRIORITY_BACKGROUND = 10,
|
||||
|
||||
/* most threads run at normal priority */
|
||||
ANDROID_PRIORITY_NORMAL = 0,
|
||||
|
||||
/* threads currently running a UI that the user is interacting with */
|
||||
ANDROID_PRIORITY_FOREGROUND = -2,
|
||||
|
||||
/* the main UI thread has a slightly more favorable priority */
|
||||
ANDROID_PRIORITY_DISPLAY = -4,
|
||||
|
||||
/* ui service treads might want to run at a urgent display (uncommon) */
|
||||
ANDROID_PRIORITY_URGENT_DISPLAY = HAL_PRIORITY_URGENT_DISPLAY,
|
||||
|
||||
/* all normal video threads */
|
||||
ANDROID_PRIORITY_VIDEO = -10,
|
||||
|
||||
/* all normal audio threads */
|
||||
ANDROID_PRIORITY_AUDIO = -16,
|
||||
|
||||
/* service audio threads (uncommon) */
|
||||
ANDROID_PRIORITY_URGENT_AUDIO = -19,
|
||||
|
||||
/* should never be used in practice. regular process might not
|
||||
* be allowed to use this level */
|
||||
ANDROID_PRIORITY_HIGHEST = -20,
|
||||
|
||||
ANDROID_PRIORITY_DEFAULT = ANDROID_PRIORITY_NORMAL,
|
||||
ANDROID_PRIORITY_MORE_FAVORABLE = -1,
|
||||
ANDROID_PRIORITY_LESS_FAVORABLE = +1,
|
||||
};
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ANDROID_THREAD_DEFS_H */
|
||||
Loading…
Add table
Reference in a new issue