summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/hardware/audio.h28
-rw-r--r--include/hardware/audio_amplifier.h142
-rw-r--r--include/hardware/bluetooth.h16
-rw-r--r--include/hardware/bt_av.h32
-rw-r--r--include/hardware/bt_hd.h129
-rw-r--r--include/hardware/bt_hf.h47
-rw-r--r--include/hardware/bt_hf_client.h12
-rw-r--r--include/hardware/bt_hh.h8
-rw-r--r--include/hardware/bt_rc.h281
-rw-r--r--include/hardware/bt_sock.h19
-rw-r--r--include/hardware/gralloc.h17
-rw-r--r--include/hardware/hwcomposer_defs.h8
-rw-r--r--include/hardware/lights.h20
-rw-r--r--include/hardware/nfc.h1
-rw-r--r--include/hardware/power.h24
-rw-r--r--include/hardware/tv_input.h3
-rw-r--r--include/hardware/wipower.h119
-rw-r--r--modules/audio/Android.mk13
-rw-r--r--modules/audio/audio_amplifier.c146
-rw-r--r--modules/audio_remote_submix/audio_hw.cpp55
-rw-r--r--modules/sensors/Android.mk4
-rw-r--r--modules/sensors/multihal.cpp46
22 files changed, 1087 insertions, 83 deletions
diff --git a/include/hardware/audio.h b/include/hardware/audio.h
index 2389c09..22e7419 100644
--- a/include/hardware/audio.h
+++ b/include/hardware/audio.h
@@ -28,6 +28,9 @@
#include <hardware/hardware.h>
#include <system/audio.h>
#include <hardware/audio_effect.h>
+#ifdef AUDIO_LISTEN_ENABLED
+#include <listen_types.h>
+#endif
__BEGIN_DECLS
@@ -117,6 +120,9 @@ __BEGIN_DECLS
* or no HW sync is available. */
#define AUDIO_PARAMETER_HW_AV_SYNC "hw_av_sync"
+/* Device state*/
+#define AUDIO_PARAMETER_KEY_DEV_SHUTDOWN "dev_shutdown"
+
/**
* audio stream parameters
*/
@@ -649,6 +655,28 @@ struct audio_hw_device {
int (*set_audio_port_config)(struct audio_hw_device *dev,
const struct audio_port_config *config);
+#ifdef AUDIO_LISTEN_ENABLED
+ /** This method creates the listen session and returns handle */
+ int (*open_listen_session)(struct audio_hw_device *dev,
+ listen_open_params_t *params,
+ struct listen_session** handle);
+
+ /** This method closes the listen session */
+ int (*close_listen_session)(struct audio_hw_device *dev,
+ struct listen_session* handle);
+
+ /** This method sets the mad observer callback */
+ int (*set_mad_observer)(struct audio_hw_device *dev,
+ listen_callback_t cb_func);
+
+ /**
+ * This method is used for setting listen hal specfic parameters.
+ * If multiple paramets are set in one call and setting any one of them
+ * fails it will return failure.
+ */
+ int (*listen_set_parameters)(struct audio_hw_device *dev,
+ const char *kv_pairs);
+#endif
};
typedef struct audio_hw_device audio_hw_device_t;
diff --git a/include/hardware/audio_amplifier.h b/include/hardware/audio_amplifier.h
new file mode 100644
index 0000000..4305094
--- /dev/null
+++ b/include/hardware/audio_amplifier.h
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2015, The CyanogenMod 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 CM_AUDIO_AMPLIFIER_INTERFACE_H
+#define CM_AUDIO_AMPLIFIER_INTERFACE_H
+
+#include <stdint.h>
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <hardware/audio.h>
+#include <hardware/hardware.h>
+
+#include <system/audio.h>
+
+__BEGIN_DECLS
+
+#define AMPLIFIER_HARDWARE_MODULE_ID "audio_amplifier"
+
+#define AMPLIFIER_HARDWARE_INTERFACE "audio_amplifier_hw_if"
+
+#define AMPLIFIER_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1)
+
+#define AMPLIFIER_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0)
+#define AMPLIFIER_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0)
+#define AMPLIFIER_DEVICE_API_VERSION_CURRENT AMPLIFIER_DEVICE_API_VERSION_2_0
+
+typedef struct amplifier_device {
+ /**
+ * Common methods of the amplifier device. This *must* be the first member
+ * of amplifier_device as users of this structure will cast a hw_device_t
+ * to amplifier_device pointer in contexts where it's known
+ * the hw_device_t references a amplifier_device.
+ */
+ struct hw_device_t common;
+
+ /**
+ * Notify amplifier device of current input devices
+ *
+ * This function should handle only input devices.
+ */
+ int (*set_input_devices)(struct amplifier_device *device, uint32_t devices);
+
+ /**
+ * Notify amplifier device of current output devices
+ *
+ * This function should handle only output devices.
+ */
+ int (*set_output_devices)(struct amplifier_device *device, uint32_t devices);
+
+ /**
+ * Notify amplifier device of output device enable/disable
+ *
+ * This function should handle only output devices.
+ */
+ int (*enable_output_devices)(struct amplifier_device *device,
+ uint32_t devices, bool enable);
+
+ /**
+ * Notify amplifier device of input device enable/disable
+ *
+ * This function should handle only input devices.
+ */
+ int (*enable_input_devices)(struct amplifier_device *device,
+ uint32_t devices, bool enable);
+
+ /**
+ * Notify amplifier device about current audio mode
+ */
+ int (*set_mode)(struct amplifier_device *device, audio_mode_t mode);
+
+ /**
+ * Notify amplifier device that an output stream has started
+ */
+ int (*output_stream_start)(struct amplifier_device *device,
+ struct audio_stream_out *stream, bool offload);
+
+ /**
+ * Notify amplifier device that an input stream has started
+ */
+ int (*input_stream_start)(struct amplifier_device *device,
+ struct audio_stream_in *stream);
+
+ /**
+ * Notify amplifier device that an output stream has stopped
+ */
+ int (*output_stream_standby)(struct amplifier_device *device,
+ struct audio_stream_out *stream);
+
+ /**
+ * Notify amplifier device that an input stream has stopped
+ */
+ int (*input_stream_standby)(struct amplifier_device *device,
+ struct audio_stream_in *stream);
+
+ /**
+ * set/get output audio device parameters.
+ */
+ int (*set_parameters)(struct amplifier_device *device,
+ struct str_parms *parms);
+} amplifier_device_t;
+
+typedef struct amplifier_module {
+ /**
+ * Common methods of the amplifier module. This *must* be the first member
+ * of amplifier_module as users of this structure will cast a hw_module_t
+ * to amplifier_module pointer in contexts where it's known
+ * the hw_module_t references a amplifier_module.
+ */
+ struct hw_module_t common;
+} amplifier_module_t;
+
+/** convenience API for opening and closing a supported device */
+
+static inline int amplifier_device_open(const struct hw_module_t *module,
+ struct amplifier_device **device)
+{
+ return module->methods->open(module, AMPLIFIER_HARDWARE_INTERFACE,
+ (struct hw_device_t **) device);
+}
+
+static inline int amplifier_device_close(struct amplifier_device *device)
+{
+ return device->common.close(&device->common);
+}
+
+__END_DECLS
+
+#endif // CM_AUDIO_AMPLIFIER_INTERFACE_H
diff --git a/include/hardware/bluetooth.h b/include/hardware/bluetooth.h
index 3427213..2cba754 100644
--- a/include/hardware/bluetooth.h
+++ b/include/hardware/bluetooth.h
@@ -44,11 +44,13 @@ __BEGIN_DECLS
#define BT_PROFILE_HEALTH_ID "health"
#define BT_PROFILE_SOCKETS_ID "socket"
#define BT_PROFILE_HIDHOST_ID "hidhost"
+#define BT_PROFILE_HIDDEV_ID "hiddev"
#define BT_PROFILE_PAN_ID "pan"
#define BT_PROFILE_MAP_CLIENT_ID "map_client"
#define BT_PROFILE_SDP_CLIENT_ID "sdp"
#define BT_PROFILE_GATT_ID "gatt"
#define BT_PROFILE_AV_RC_ID "avrcp"
+#define WIPOWER_PROFILE_ID "wipower"
#define BT_PROFILE_AV_RC_CTRL_ID "avrcp_ctrl"
/** Bluetooth Address */
@@ -355,6 +357,10 @@ typedef void (*callback_thread_event)(bt_cb_thread_evt evt);
/* Receive any HCI event from controller. Must be in DUT Mode for this callback to be received */
typedef void (*dut_mode_recv_callback)(uint16_t opcode, uint8_t *buf, uint8_t len);
+/** Bluetooth HCI event Callback */
+/* Receive any HCI event from controller for raw commands */
+typedef void (*hci_event_recv_callback)(uint8_t event_code, uint8_t *buf, uint8_t len);
+
/* LE Test mode callbacks
* This callback shall be invoked whenever the le_tx_test, le_rx_test or le_test_end is invoked
* The num_packets is valid only for le_test_end command */
@@ -388,6 +394,7 @@ typedef struct {
dut_mode_recv_callback dut_mode_recv_cb;
le_test_mode_callback le_test_mode_cb;
energy_info_callback energy_info_cb;
+ hci_event_recv_callback hci_event_recv_cb;
} bt_callbacks_t;
typedef void (*alarm_cb)(void *data);
@@ -446,6 +453,9 @@ typedef struct {
/** Closes the interface. */
void (*cleanup)(void);
+ /** SSR cleanup. */
+ void (*ssrcleanup)(void);
+
/** Get all Bluetooth Adapter properties at init */
int (*get_adapter_properties)(void);
@@ -520,6 +530,10 @@ typedef struct {
/* Send any test HCI (vendor-specific) command to the controller. Must be in DUT Mode */
int (*dut_mode_send)(uint16_t opcode, uint8_t *buf, uint8_t len);
+
+ /* Send any test HCI command to the controller. */
+ int (*hci_cmd_send)(uint16_t opcode, uint8_t *buf, uint8_t len);
+
/** BLE Test Mode APIs */
/* opcode MUST be one of: LE_Receiver_Test, LE_Transmitter_Test, LE_Test_End */
int (*le_test_mode)(uint16_t opcode, uint8_t *buf, uint8_t len);
@@ -548,6 +562,8 @@ typedef struct {
*/
int (*config_clear)(void);
+ /** BT stack Test interface */
+ const void* (*get_testapp_interface)(int test_app_profile);
} bt_interface_t;
/** TODO: Need to add APIs for Service Discovery, Service authorization and
diff --git a/include/hardware/bt_av.h b/include/hardware/bt_av.h
index 5252a17..be82fbe 100644
--- a/include/hardware/bt_av.h
+++ b/include/hardware/bt_av.h
@@ -1,4 +1,7 @@
/*
+ * Copyright (C) 2013-2014, The Linux Foundation. All rights reserved.
+ * Not a Contribution.
+ *
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -47,6 +50,11 @@ typedef void (* btav_connection_state_callback)(btav_connection_state_t state,
typedef void (* btav_audio_state_callback)(btav_audio_state_t state,
bt_bdaddr_t *bd_addr);
+/** Callback for connection priority of device for incoming connection
+ * btav_connection_priority_t
+ */
+typedef void (* btav_connection_priority_callback)(bt_bdaddr_t *bd_addr);
+
/** Callback for audio configuration change.
* Used only for the A2DP sink interface.
* state will have one of the values from btav_audio_state_t
@@ -57,6 +65,18 @@ typedef void (* btav_audio_config_callback)(bt_bdaddr_t *bd_addr,
uint32_t sample_rate,
uint8_t channel_count);
+/** Callback for updating apps for A2dp multicast state.
+ */
+
+typedef void (* btav_is_multicast_enabled_callback)(int state);
+
+/*
+ * Callback for audio focus request to be used only in
+ * case of A2DP Sink. This is required because we are using
+ * AudioTrack approach for audio data rendering.
+ */
+typedef void (* btav_audio_focus_request_callback)(bt_bdaddr_t *bd_addr);
+
/** BT-AV callback structure. */
typedef struct {
/** set to sizeof(btav_callbacks_t) */
@@ -64,6 +84,9 @@ typedef struct {
btav_connection_state_callback connection_state_cb;
btav_audio_state_callback audio_state_cb;
btav_audio_config_callback audio_config_cb;
+ btav_connection_priority_callback connection_priority_cb;
+ btav_is_multicast_enabled_callback multicast_state_cb;
+ btav_audio_focus_request_callback audio_focus_request_cb;
} btav_callbacks_t;
/**
@@ -86,7 +109,8 @@ typedef struct {
/**
* Register the BtAv callbacks
*/
- bt_status_t (*init)( btav_callbacks_t* callbacks );
+ bt_status_t (*init)( btav_callbacks_t* callbacks , int max_a2dp_connections,
+ int a2dp_multicast_state);
/** connect to headset */
bt_status_t (*connect)( bt_bdaddr_t *bd_addr );
@@ -96,6 +120,12 @@ typedef struct {
/** Closes the interface. */
void (*cleanup)( void );
+
+ /** Send priority of device to stack*/
+ void (*allow_connection)( int is_valid , bt_bdaddr_t *bd_addr);
+
+ /** Sends Audio Focus State. */
+ void (*audio_focus_state)( int focus_state );
} btav_interface_t;
__END_DECLS
diff --git a/include/hardware/bt_hd.h b/include/hardware/bt_hd.h
new file mode 100644
index 0000000..6ba5b09
--- /dev/null
+++ b/include/hardware/bt_hd.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ * Not a Contribution
+ * Copyright (C) 2012 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_INCLUDE_BT_HD_H
+#define ANDROID_INCLUDE_BT_HD_H
+
+#include <stdint.h>
+
+__BEGIN_DECLS
+
+typedef enum
+{
+ BTHD_REPORT_TYPE_OTHER = 0,
+ BTHD_REPORT_TYPE_INPUT,
+ BTHD_REPORT_TYPE_OUTPUT,
+ BTHD_REPORT_TYPE_FEATURE,
+ BTHD_REPORT_TYPE_INTRDATA // special value for reports to be sent on INTR (INPUT is assumed)
+} bthd_report_type_t;
+
+typedef enum
+{
+ BTHD_APP_STATE_NOT_REGISTERED,
+ BTHD_APP_STATE_REGISTERED
+} bthd_application_state_t;
+
+typedef enum
+{
+ BTHD_CONN_STATE_CONNECTED,
+ BTHD_CONN_STATE_CONNECTING,
+ BTHD_CONN_STATE_DISCONNECTED,
+ BTHD_CONN_STATE_DISCONNECTING,
+ BTHD_CONN_STATE_UNKNOWN
+} bthd_connection_state_t;
+
+typedef struct
+{
+ const char *name;
+ const char *description;
+ const char *provider;
+ uint8_t subclass;
+ uint8_t *desc_list;
+ int desc_list_len;
+} bthd_app_param_t;
+
+typedef struct
+{
+ uint8_t service_type;
+ uint32_t token_rate;
+ uint32_t token_bucket_size;
+ uint32_t peak_bandwidth;
+ uint32_t access_latency;
+ uint32_t delay_variation;
+} bthd_qos_param_t;
+
+typedef void (* bthd_application_state_callback)(bt_bdaddr_t *bd_addr, bthd_application_state_t state);
+typedef void (* bthd_connection_state_callback)(bt_bdaddr_t *bd_addr, bthd_connection_state_t state);
+typedef void (* bthd_get_report_callback)(uint8_t type, uint8_t id, uint16_t buffer_size);
+typedef void (* bthd_set_report_callback)(uint8_t type, uint8_t id, uint16_t len, uint8_t *p_data);
+typedef void (* bthd_set_protocol_callback)(uint8_t protocol);
+typedef void (* bthd_intr_data_callback)(uint8_t report_id, uint16_t len, uint8_t *p_data);
+typedef void (* bthd_vc_unplug_callback)(void);
+
+/** BT-HD callbacks */
+typedef struct {
+ size_t size;
+
+ bthd_application_state_callback application_state_cb;
+ bthd_connection_state_callback connection_state_cb;
+ bthd_get_report_callback get_report_cb;
+ bthd_set_report_callback set_report_cb;
+ bthd_set_protocol_callback set_protocol_cb;
+ bthd_intr_data_callback intr_data_cb;
+ bthd_vc_unplug_callback vc_unplug_cb;
+} bthd_callbacks_t;
+
+/** BT-HD interface */
+typedef struct {
+
+ size_t size;
+
+ /** init interface and register callbacks */
+ bt_status_t (*init)(bthd_callbacks_t* callbacks);
+
+ /** close interface */
+ void (*cleanup)(void);
+
+ /** register application */
+ bt_status_t (*register_app)(bthd_app_param_t *app_param, bthd_qos_param_t *in_qos,
+ bthd_qos_param_t *out_qos);
+
+ /** unregister application */
+ bt_status_t (*unregister_app)(void);
+
+ /** connects to host with virtual cable */
+ bt_status_t (*connect)(void);
+
+ /** disconnects from currently connected host */
+ bt_status_t (*disconnect)(void);
+
+ /** send report */
+ bt_status_t (*send_report)(bthd_report_type_t type, uint8_t id, uint16_t len, uint8_t *p_data);
+
+ /** notifies error for invalid SET_REPORT */
+ bt_status_t (*report_error)(uint8_t error);
+
+ /** send Virtual Cable Unplug */
+ bt_status_t (*virtual_cable_unplug)(void);
+
+} bthd_interface_t;
+
+__END_DECLS
+
+#endif /* ANDROID_INCLUDE_BT_HD_H */
+
diff --git a/include/hardware/bt_hf.h b/include/hardware/bt_hf.h
index 7dcb40a..dbac061 100644
--- a/include/hardware/bt_hf.h
+++ b/include/hardware/bt_hf.h
@@ -65,6 +65,15 @@ typedef enum
BTHF_WBS_YES
}bthf_wbs_config_t;
+/* BIND type*/
+typedef enum
+{
+ BTHF_BIND_SET,
+ BTHF_BIND_READ,
+ BTHF_BIND_TEST
+}bthf_bind_type_t;
+
+
/* CHLD - Call held handling */
typedef enum
{
@@ -152,6 +161,15 @@ typedef void (* bthf_unknown_at_cmd_callback)(char *at_string, bt_bdaddr_t *bd_a
*/
typedef void (* bthf_key_pressed_cmd_callback)(bt_bdaddr_t *bd_addr);
+/** Callback for HF indicators (BIND)
+ */
+typedef void (* bthf_bind_cmd_callback)(char* hf_ind, bthf_bind_type_t type, bt_bdaddr_t *bd_addr);
+
+/** Callback for HF indicator value (BIEV)
+ */
+typedef void (* bthf_biev_cmd_callback)(char* hf_ind_val, bt_bdaddr_t *bd_addr);
+
+
/** BT-HF callback structure. */
typedef struct {
/** set to sizeof(BtHfCallbacks) */
@@ -173,6 +191,8 @@ typedef struct {
bthf_clcc_cmd_callback clcc_cmd_cb;
bthf_unknown_at_cmd_callback unknown_at_cmd_cb;
bthf_key_pressed_cmd_callback key_pressed_cmd_cb;
+ bthf_bind_cmd_callback bind_cmd_cb;
+ bthf_biev_cmd_callback biev_cmd_cb;
} bthf_callbacks_t;
/** Network Status */
@@ -216,9 +236,25 @@ typedef enum {
} bthf_call_mpty_type_t;
typedef enum {
+ BTHF_HF_INDICATOR_STATE_DISABLED = 0,
+ BTHF_HF_INDICATOR_STATE_ENABLED
+} bthf_hf_indicator_status_t;
+
+typedef enum {
BTHF_CALL_ADDRTYPE_UNKNOWN = 0x81,
BTHF_CALL_ADDRTYPE_INTERNATIONAL = 0x91
} bthf_call_addrtype_t;
+
+typedef enum {
+ BTHF_VOIP_CALL_NETWORK_TYPE_MOBILE = 0,
+ BTHF_VOIP_CALL_NETWORK_TYPE_WIFI
+} bthf_voip_call_network_type_t;
+
+typedef enum {
+ BTHF_VOIP_STATE_STOPPED = 0,
+ BTHF_VOIP_STATE_STARTED
+} bthf_voip_state_t;
+
/** Represents the standard BT-HF interface. */
typedef struct {
@@ -294,6 +330,17 @@ typedef struct {
/** configureation for the SCO codec */
bt_status_t (*configure_wbs)( bt_bdaddr_t *bd_addr ,bthf_wbs_config_t config );
+
+ /** Response for BIND READ command and activation/deactivation of HF indicator */
+ bt_status_t (*bind_response) (int anum, bthf_hf_indicator_status_t status,
+ bt_bdaddr_t *bd_addr);
+
+ /** Response for BIND TEST command */
+ bt_status_t (*bind_string_response) (const char* result, bt_bdaddr_t *bd_addr);
+
+ /** Sends connectivity network type used by Voip currently to stack */
+ bt_status_t (*voip_network_type_wifi) (bthf_voip_state_t is_voip_started,
+ bthf_voip_call_network_type_t is_network_wifi);
} bthf_interface_t;
__END_DECLS
diff --git a/include/hardware/bt_hf_client.h b/include/hardware/bt_hf_client.h
index 8acf1b2..0577e97 100644
--- a/include/hardware/bt_hf_client.h
+++ b/include/hardware/bt_hf_client.h
@@ -266,6 +266,16 @@ typedef void (* bthf_client_last_voice_tag_number_callback) (const char *number)
*/
typedef void (* bthf_client_ring_indication_callback) (void);
+/**
+ * Callback for sending cgmi indication to app
+ */
+typedef void (* bthf_client_cgmi_indication_callback) (const char *str);
+
+/**
+ * Callback for sending cgmm indication to app
+ */
+typedef void (* bthf_client_cgmm_indication_callback) (const char *str);
+
/** BT-HF callback structure. */
typedef struct {
/** set to sizeof(BtHfClientCallbacks) */
@@ -291,6 +301,8 @@ typedef struct {
bthf_client_in_band_ring_tone_callback in_band_ring_tone_cb;
bthf_client_last_voice_tag_number_callback last_voice_tag_number_callback;
bthf_client_ring_indication_callback ring_indication_cb;
+ bthf_client_cgmi_indication_callback cgmi_cb;
+ bthf_client_cgmm_indication_callback cgmm_cb;
} bthf_client_callbacks_t;
/** Represents the standard BT-HF interface. */
diff --git a/include/hardware/bt_hh.h b/include/hardware/bt_hh.h
index dad9586..ece3c11 100644
--- a/include/hardware/bt_hh.h
+++ b/include/hardware/bt_hh.h
@@ -165,6 +165,12 @@ typedef struct {
/** Set the HID proto mode. */
bt_status_t (*set_protocol)(bt_bdaddr_t *bd_addr, bthh_protocol_mode_t protocolMode);
+ /** Get the HID Idle Time */
+ bt_status_t (*get_idle_time)(bt_bdaddr_t *bd_addr);
+
+ /** Set the HID Idle Time */
+ bt_status_t (*set_idle_time)(bt_bdaddr_t *bd_addr, uint8_t idleTime);
+
/** Send a GET_REPORT to HID device. */
bt_status_t (*get_report)(bt_bdaddr_t *bd_addr, bthh_report_type_t reportType, uint8_t reportId, int bufferSize);
@@ -174,7 +180,7 @@ typedef struct {
/** Send data to HID device. */
bt_status_t (*send_data)(bt_bdaddr_t *bd_addr, char* data);
- /** Closes the interface. */
+ /** Closes the interface. */
void (*cleanup)( void );
} bthh_interface_t;
diff --git a/include/hardware/bt_rc.h b/include/hardware/bt_rc.h
index c565c48..6e1109d 100644
--- a/include/hardware/bt_rc.h
+++ b/include/hardware/bt_rc.h
@@ -1,4 +1,7 @@
/*
+ * Copyright (C) 2013-2014, The Linux Foundation. All rights reserved.
+ * Not a Contribution.
+ *
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -26,6 +29,7 @@ __BEGIN_DECLS
#define BTRC_MAX_FOLDER_DEPTH 4
#define BTRC_MAX_APP_ATTR_SIZE 16
#define BTRC_MAX_ELEM_ATTR_SIZE 7
+#define BTRC_CHARSET_UTF8 0x006A
typedef uint8_t btrc_uid_t[BTRC_UID_SIZE];
@@ -52,11 +56,24 @@ typedef enum {
BTRC_EVT_TRACK_REACHED_START = 0x04,
BTRC_EVT_PLAY_POS_CHANGED = 0x05,
BTRC_EVT_APP_SETTINGS_CHANGED = 0x08,
+ BTRC_EVT_NOW_PLAYING_CONTENT_CHANGED = 0x09,
+ BTRC_EVT_AVAILABLE_PLAYERS_CHANGED = 0x0a,
+ BTRC_EVT_ADDRESSED_PLAYER_CHANGED = 0x0b,
} btrc_event_id_t;
+//used for Scope
+typedef enum {
+ BTRC_EVT_MEDIA_PLAYLIST = 0,
+ BTRC_EVT_MEDIA_VIRTUALFILESYST = 1,
+ BTRC_EVT_SEARCH = 2,
+ BTRC_EVT_NOWPLAYING = 3,
+ BTRC_EVT_MAX_BROWSE = 4,
+} btrc_browse_folderitem_t;
+
typedef enum {
BTRC_NOTIFICATION_TYPE_INTERIM = 0,
BTRC_NOTIFICATION_TYPE_CHANGED = 1,
+ BTRC_NOTIFICATION_TYPE_REJECT = 2,
} btrc_notification_type_t;
typedef enum {
@@ -97,18 +114,33 @@ typedef enum {
BTRC_STS_NO_ERROR = 0x04 /* Operation Success */
} btrc_status_t;
+typedef enum {
+ BTRC_TYPE_MEDIA_PLAYER = 0x01,
+ BTRC_TYPE_FOLDER = 0x02,
+ BTRC_TYPE_MEDIA_ELEMENT = 0x03
+} btrc_folder_list_item_type_t;
+
typedef struct {
uint8_t num_attr;
uint8_t attr_ids[BTRC_MAX_APP_SETTINGS];
uint8_t attr_values[BTRC_MAX_APP_SETTINGS];
} btrc_player_settings_t;
+typedef struct {
+ uint32_t start_item;
+ uint32_t end_item;
+ uint32_t size;
+ uint32_t attrs[BTRC_MAX_ELEM_ATTR_SIZE];
+ uint8_t attr_count;
+}btrc_getfolderitem_t;
+
typedef union
{
btrc_play_status_t play_status;
btrc_uid_t track; /* queue position in NowPlaying */
uint32_t song_pos;
btrc_player_settings_t player_setting;
+ uint16_t player_id;
} btrc_register_notification_t;
typedef struct {
@@ -124,54 +156,156 @@ typedef struct {
/** Callback for the controller's supported feautres */
typedef void (* btrc_remote_features_callback)(bt_bdaddr_t *bd_addr,
btrc_remote_features_t features);
+#define BTRC_FEATURE_MASK_SIZE 16
+
+typedef uint8_t btrc_feature_mask_t[BTRC_FEATURE_MASK_SIZE];
+
+typedef struct {
+ uint16_t charset_id;
+ uint16_t str_len;
+ uint8_t *p_str;
+} btrc_player_full_name_t;
+
+typedef struct
+{
+ uint32_t sub_type;
+ uint16_t player_id;
+ uint8_t major_type;
+ uint8_t play_status;
+ btrc_feature_mask_t features; /* Supported feature bit mask*/
+ btrc_player_full_name_t name; /* The player name, name length and character set id.*/
+} btrc_folder_list_item_player_t;
+
+typedef struct
+{
+ uint64_t uid;
+ uint8_t type;
+ uint8_t playable;
+ btrc_player_full_name_t name;
+} btrc_folder_list_item_folder_t;
+
+typedef struct
+{
+ uint32_t attr_id;
+ btrc_player_full_name_t name;
+} btrc_attr_entry_t;
+
+typedef struct
+{
+ uint64_t uid;
+ uint8_t type;
+ uint8_t attr_count;
+ btrc_player_full_name_t name;
+ btrc_attr_entry_t* p_attr_list;
+} btrc_folder_list_item_media_t;
+
+typedef struct {
+ uint16_t str_len;
+ uint8_t *p_str;
+} btrc_name_t;
+
+/* SetBrowsedPlayer */
+typedef struct
+{
+ uint32_t num_items;
+ uint16_t uid_counter;
+ uint16_t charset_id;
+ uint8_t status;
+ uint8_t folder_depth;
+ btrc_name_t *p_folders;
+} btrc_set_browsed_player_rsp_t;
+
+typedef struct
+{
+ uint8_t item_type;
+ union
+ {
+ btrc_folder_list_item_player_t player;
+ btrc_folder_list_item_folder_t folder;
+ btrc_folder_list_item_media_t media;
+ } u;
+} btrc_folder_list_item_t;
+
+/* GetFolderItems */
+typedef struct
+{
+ uint16_t uid_counter;
+ uint16_t item_count;
+ uint8_t status;
+ btrc_folder_list_item_t *p_item_list;
+} btrc_folder_list_entries_t;
/** Callback for play status request */
-typedef void (* btrc_get_play_status_callback)();
+typedef void (* btrc_get_play_status_callback)(bt_bdaddr_t *bd_addr);
/** Callback for list player application attributes (Shuffle, Repeat,...) */
-typedef void (* btrc_list_player_app_attr_callback)();
+typedef void (* btrc_list_player_app_attr_callback)(bt_bdaddr_t *bd_addr);
/** Callback for list player application attributes (Shuffle, Repeat,...) */
-typedef void (* btrc_list_player_app_values_callback)(btrc_player_attr_t attr_id);
+typedef void (* btrc_list_player_app_values_callback)(btrc_player_attr_t attr_id,
+ bt_bdaddr_t *bd_addr);
/** Callback for getting the current player application settings value
** num_attr: specifies the number of attribute ids contained in p_attrs
*/
-typedef void (* btrc_get_player_app_value_callback) (uint8_t num_attr, btrc_player_attr_t *p_attrs);
+typedef void (* btrc_get_player_app_value_callback) (uint8_t num_attr, btrc_player_attr_t *p_attrs,
+ bt_bdaddr_t *bd_addr);
/** Callback for getting the player application settings attributes' text
** num_attr: specifies the number of attribute ids contained in p_attrs
*/
-typedef void (* btrc_get_player_app_attrs_text_callback) (uint8_t num_attr, btrc_player_attr_t *p_attrs);
+typedef void (* btrc_get_player_app_attrs_text_callback) (uint8_t num_attr,
+ btrc_player_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
/** Callback for getting the player application settings values' text
** num_attr: specifies the number of value ids contained in p_vals
*/
-typedef void (* btrc_get_player_app_values_text_callback) (uint8_t attr_id, uint8_t num_val, uint8_t *p_vals);
+typedef void (* btrc_get_player_app_values_text_callback) (uint8_t attr_id,
+ uint8_t num_val, uint8_t *p_vals, bt_bdaddr_t *bd_addr);
/** Callback for setting the player application settings values */
-typedef void (* btrc_set_player_app_value_callback) (btrc_player_settings_t *p_vals);
+typedef void (* btrc_set_player_app_value_callback) (btrc_player_settings_t *p_vals,
+ bt_bdaddr_t *bd_addr);
/** Callback to fetch the get element attributes of the current song
** num_attr: specifies the number of attributes requested in p_attrs
*/
-typedef void (* btrc_get_element_attr_callback) (uint8_t num_attr, btrc_media_attr_t *p_attrs);
+typedef void (* btrc_get_element_attr_callback) (uint8_t num_attr, btrc_media_attr_t *p_attrs,
+ bt_bdaddr_t *bd_addr);
/** Callback for register notification (Play state change/track change/...)
** param: Is only valid if event_id is BTRC_EVT_PLAY_POS_CHANGED
*/
-typedef void (* btrc_register_notification_callback) (btrc_event_id_t event_id, uint32_t param);
+typedef void (* btrc_register_notification_callback) (btrc_event_id_t event_id, uint32_t param,
+ bt_bdaddr_t *bd_addr);
/* AVRCP 1.4 Enhancements */
/** Callback for volume change on CT
** volume: Current volume setting on the CT (0-127)
*/
-typedef void (* btrc_volume_change_callback) (uint8_t volume, uint8_t ctype);
+typedef void (* btrc_volume_change_callback) (uint8_t volume, uint8_t ctype, bt_bdaddr_t *bd_addr);
/** Callback for passthrough commands */
-typedef void (* btrc_passthrough_cmd_callback) (int id, int key_state);
+typedef void (* btrc_passthrough_cmd_callback) (int id, int key_state, bt_bdaddr_t *bd_addr);
/** BT-RC Target callback structure. */
+
+typedef void (* btrc_get_folder_items_callback) (btrc_browse_folderitem_t id,
+ btrc_getfolderitem_t *param, bt_bdaddr_t *bd_addr);
+
+typedef void (* btrc_set_addressed_player_callback) (uint32_t player_id, bt_bdaddr_t *bd_addr);
+
+typedef void (* btrc_set_browsed_player_callback) (uint32_t player_id, bt_bdaddr_t *bd_addr);
+
+typedef void (* btrc_change_path_callback) (uint8_t direction, uint64_t uid, bt_bdaddr_t *bd_addr);
+
+typedef void (* btrc_play_item_callback) (uint8_t scope, uint64_t uid, bt_bdaddr_t *bd_addr);
+
+typedef void (* btrc_get_item_attr_callback) (uint8_t scope, uint64_t uid,
+ uint8_t num_attr, btrc_media_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
+
+typedef void (* btrc_connection_state_callback) (bool state, bt_bdaddr_t *bd_addr);
+
typedef struct {
/** set to sizeof(BtRcCallbacks) */
size_t size;
@@ -187,6 +321,13 @@ typedef struct {
btrc_register_notification_callback register_notification_cb;
btrc_volume_change_callback volume_change_cb;
btrc_passthrough_cmd_callback passthrough_cmd_cb;
+ btrc_get_folder_items_callback get_folderitems_cb;
+ btrc_set_addressed_player_callback set_addrplayer_cb;
+ btrc_set_browsed_player_callback set_browsed_player_cb;
+ btrc_change_path_callback change_path_cb;
+ btrc_play_item_callback play_item_cb;
+ btrc_get_item_attr_callback get_item_attr_cb;
+ btrc_connection_state_callback connection_state_cb;
} btrc_callbacks_t;
/** Represents the standard BT-RC AVRCP Target interface. */
@@ -197,47 +338,54 @@ typedef struct {
/**
* Register the BtRc callbacks
*/
- bt_status_t (*init)( btrc_callbacks_t* callbacks );
+ bt_status_t (*init)( btrc_callbacks_t* callbacks , int max_avrcp_connections);
/** Respose to GetPlayStatus request. Contains the current
** 1. Play status
** 2. Song duration/length
** 3. Song position
*/
- bt_status_t (*get_play_status_rsp)( btrc_play_status_t play_status, uint32_t song_len, uint32_t song_pos);
+ bt_status_t (*get_play_status_rsp)( btrc_play_status_t play_status, uint32_t song_len,
+ uint32_t song_pos, bt_bdaddr_t *bd_addr);
/** Lists the support player application attributes (Shuffle/Repeat/...)
** num_attr: Specifies the number of attributes contained in the pointer p_attrs
*/
- bt_status_t (*list_player_app_attr_rsp)( int num_attr, btrc_player_attr_t *p_attrs);
+ bt_status_t (*list_player_app_attr_rsp)( uint8_t num_attr, btrc_player_attr_t *p_attrs,
+ bt_bdaddr_t *bd_addr);
/** Lists the support player application attributes (Shuffle Off/On/Group)
** num_val: Specifies the number of values contained in the pointer p_vals
*/
- bt_status_t (*list_player_app_value_rsp)( int num_val, uint8_t *p_vals);
+ bt_status_t (*list_player_app_value_rsp)( uint8_t num_val, uint8_t *p_vals,
+ bt_bdaddr_t *bd_addr);
/** Returns the current application attribute values for each of the specified attr_id */
- bt_status_t (*get_player_app_value_rsp)( btrc_player_settings_t *p_vals);
+ bt_status_t (*get_player_app_value_rsp)( btrc_player_settings_t *p_vals,
+ bt_bdaddr_t *bd_addr);
/** Returns the application attributes text ("Shuffle"/"Repeat"/...)
** num_attr: Specifies the number of attributes' text contained in the pointer p_attrs
*/
- bt_status_t (*get_player_app_attr_text_rsp)( int num_attr, btrc_player_setting_text_t *p_attrs);
+ bt_status_t (*get_player_app_attr_text_rsp)( int num_attr, btrc_player_setting_text_t *p_attrs,
+ bt_bdaddr_t *bd_addr);
/** Returns the application attributes text ("Shuffle"/"Repeat"/...)
** num_attr: Specifies the number of attribute values' text contained in the pointer p_vals
*/
- bt_status_t (*get_player_app_value_text_rsp)( int num_val, btrc_player_setting_text_t *p_vals);
+ bt_status_t (*get_player_app_value_text_rsp)( int num_val, btrc_player_setting_text_t *p_vals,
+ bt_bdaddr_t *bd_addr);
/** Returns the current songs' element attributes text ("Title"/"Album"/"Artist")
** num_attr: Specifies the number of attributes' text contained in the pointer p_attrs
*/
- bt_status_t (*get_element_attr_rsp)( uint8_t num_attr, btrc_element_attr_val_t *p_attrs);
+ bt_status_t (*get_element_attr_rsp)( uint8_t num_attr, btrc_element_attr_val_t *p_attrs,
+ bt_bdaddr_t *bd_addr);
/** Response to set player attribute request ("Shuffle"/"Repeat")
** rsp_status: Status of setting the player attributes for the current media player
*/
- bt_status_t (*set_player_app_value_rsp)(btrc_status_t rsp_status);
+ bt_status_t (*set_player_app_value_rsp)(btrc_status_t rsp_status, bt_bdaddr_t *bd_addr);
/* Response to the register notification request (Play state change/track change/...).
** event_id: Refers to the event_id this notification change corresponds too
@@ -246,7 +394,8 @@ typedef struct {
*/
bt_status_t (*register_notification_rsp)(btrc_event_id_t event_id,
btrc_notification_type_t type,
- btrc_register_notification_t *p_param);
+ btrc_register_notification_t *p_param,
+ bt_bdaddr_t *bd_addr);
/* AVRCP 1.4 enhancements */
@@ -255,7 +404,18 @@ typedef struct {
** With RelateVolume, we will send VOLUME_UP/VOLUME_DOWN opposed to absolute volume level
** volume: Should be in the range 0-127. bit7 is reseved and cannot be set
*/
- bt_status_t (*set_volume)(uint8_t volume);
+ bt_status_t (*set_volume)(uint8_t volume, bt_bdaddr_t *bd_addr);
+ bt_status_t (*get_folder_items_rsp) (btrc_folder_list_entries_t *p_param, bt_bdaddr_t *bd_addr);
+
+ bt_status_t (*set_addressed_player_rsp) (btrc_status_t status_code, bt_bdaddr_t *bd_addr);
+ bt_status_t (*set_browsed_player_rsp) (btrc_set_browsed_player_rsp_t *p_param,
+ bt_bdaddr_t *bd_addr);
+ bt_status_t (*change_path_rsp) (uint8_t status_code, uint32_t item_count,
+ bt_bdaddr_t *bd_addr);
+ bt_status_t (*play_item_rsp) (uint8_t status_code, bt_bdaddr_t *bd_addr);
+ bt_status_t (*get_item_attr_rsp)( uint8_t num_attr, btrc_element_attr_val_t *p_attrs,
+ bt_bdaddr_t *bd_addr);
+ bt_status_t (*is_device_active_in_handoff) (bt_bdaddr_t *bd_addr);
/** Closes the interface. */
void (*cleanup)( void );
@@ -266,12 +426,51 @@ typedef void (* btrc_passthrough_rsp_callback) (int id, int key_state);
typedef void (* btrc_connection_state_callback) (bool state, bt_bdaddr_t *bd_addr);
+typedef void (* btrc_ctrl_getrcfeatures_callback) (bt_bdaddr_t *bd_addr, int features);
+
+typedef void (* btrc_ctrl_getcapability_rsp_callback) (bt_bdaddr_t *bd_addr, int cap_id,
+ uint32_t* supported_values, int num_supported, uint8_t rsp_type);
+
+typedef void (* btrc_ctrl_listplayerappsettingattrib_rsp_callback) (bt_bdaddr_t *bd_addr,
+ uint8_t* supported_attribs, int num_attrib, uint8_t rsp_type);
+
+typedef void (* btrc_ctrl_listplayerappsettingvalue_rsp_callback) (bt_bdaddr_t *bd_addr,
+ uint8_t* supported_val, uint8_t num_supported, uint8_t rsp_type);
+
+typedef void (* btrc_ctrl_currentplayerappsetting_rsp_callback) (bt_bdaddr_t *bd_addr,uint8_t* supported_ids,
+ uint8_t* supported_val, uint8_t num_attrib, uint8_t rsp_type);
+
+typedef void (* btrc_ctrl_setplayerapplicationsetting_rsp_callback) (bt_bdaddr_t *bd_addr,uint8_t rsp_type);
+
+typedef void (* btrc_ctrl_notification_rsp_callback) (bt_bdaddr_t *bd_addr, uint8_t rsp_type,
+ int rsp_len, uint8_t* notification_rsp);
+
+typedef void (* btrc_ctrl_getelementattrib_rsp_callback) (bt_bdaddr_t *bd_addr, uint8_t num_attributes,
+ int rsp_len, uint8_t* attrib_rsp, uint8_t rsp_type);
+
+typedef void (* btrc_ctrl_getplaystatus_rsp_callback) (bt_bdaddr_t *bd_addr, int param_len, uint8_t* play_status_rsp
+ ,uint8_t rsp_type);
+
+typedef void (* btrc_ctrl_setabsvol_cmd_callback) (bt_bdaddr_t *bd_addr, uint8_t abs_vol);
+
+typedef void (* btrc_ctrl_registernotification_abs_vol_callback) (bt_bdaddr_t *bd_addr);
/** BT-RC Controller callback structure. */
typedef struct {
/** set to sizeof(BtRcCallbacks) */
size_t size;
- btrc_passthrough_rsp_callback passthrough_rsp_cb;
- btrc_connection_state_callback connection_state_cb;
+ btrc_passthrough_rsp_callback passthrough_rsp_cb;
+ btrc_connection_state_callback connection_state_cb;
+ btrc_ctrl_getrcfeatures_callback getrcfeatures_cb;
+ btrc_ctrl_getcapability_rsp_callback getcap_rsp_cb;
+ btrc_ctrl_listplayerappsettingattrib_rsp_callback listplayerappsettingattrib_rsp_cb;
+ btrc_ctrl_listplayerappsettingvalue_rsp_callback listplayerappsettingvalue_rsp_cb;
+ btrc_ctrl_currentplayerappsetting_rsp_callback currentplayerappsetting_rsp_cb;
+ btrc_ctrl_setplayerapplicationsetting_rsp_callback setplayerappsetting_rsp_cb;
+ btrc_ctrl_notification_rsp_callback notification_rsp_cb;
+ btrc_ctrl_getelementattrib_rsp_callback getelementattrib_rsp_cb;
+ btrc_ctrl_getplaystatus_rsp_callback getplaystatus_rsp_cb;
+ btrc_ctrl_setabsvol_cmd_callback setabsvol_cmd_cb;
+ btrc_ctrl_registernotification_abs_vol_callback registernotification_absvol_cb;
} btrc_ctrl_callbacks_t;
/** Represents the standard BT-RC AVRCP Controller interface. */
@@ -285,7 +484,39 @@ typedef struct {
bt_status_t (*init)( btrc_ctrl_callbacks_t* callbacks );
/** send pass through command to target */
- bt_status_t (*send_pass_through_cmd) ( bt_bdaddr_t *bd_addr, uint8_t key_code, uint8_t key_state );
+ bt_status_t (*send_pass_through_cmd) ( bt_bdaddr_t *bd_addr, uint8_t key_code,
+ uint8_t key_state );
+
+ /** send get_cap command to target */
+ bt_status_t (*getcapabilities_cmd) (uint8_t cap_id);
+
+ /** send command to get supported player application settings to target */
+ bt_status_t (*list_player_app_setting_attrib_cmd) (void);
+
+ /** send command to get supported values of player application settings for a
+ * particular attribute to target */
+ bt_status_t (*list_player_app_setting_value_cmd) (uint8_t attrib_id);
+
+ /** send command to get current player attributes to target */
+ bt_status_t (*get_player_app_setting_cmd) (uint8_t num_attrib, uint8_t* attrib_ids);
+
+ /** send command to set player applicaiton setting attributes to target */
+ bt_status_t (*set_player_app_setting_cmd) (uint8_t num_attrib, uint8_t* attrib_ids, uint8_t* attrib_vals);
+
+ /** send command to register for supported notificaiton events to target */
+ bt_status_t (*register_notification_cmd) (uint8_t event_id, uint32_t event_value);
+
+ /** send command to get element attribute to target */
+ bt_status_t (*get_element_attribute_cmd) (uint8_t num_attribute, uint32_t attribute_id);
+
+ /** send command to get play status to target */
+ bt_status_t (*get_play_status_cmd) (void);
+
+ /** send rsp to set_abs_vol received from target */
+ bt_status_t (*send_abs_vol_rsp) (uint8_t abs_vol);
+
+ /** send notificaiton rsp for abs vol to target */
+ bt_status_t (*send_register_abs_vol_rsp) (uint8_t rsp_type, uint8_t abs_vol);
/** Closes the interface. */
void (*cleanup)( void );
diff --git a/include/hardware/bt_sock.h b/include/hardware/bt_sock.h
index 5d206d7..9dd83bb 100644
--- a/include/hardware/bt_sock.h
+++ b/include/hardware/bt_sock.h
@@ -30,6 +30,12 @@ typedef enum {
BTSOCK_L2CAP = 3
} btsock_type_t;
+typedef enum {
+ BTSOCK_OPT_GET_MODEM_BITS = 1,
+ BTSOCK_OPT_SET_MODEM_BITS = 2,
+ BTSOCK_OPT_CLR_MODEM_BITS = 3,
+} btsock_option_type_t;
+
/** Represents the standard BT SOCKET interface. */
typedef struct {
short size;
@@ -66,6 +72,19 @@ typedef struct {
*/
bt_status_t (*connect)(const bt_bdaddr_t *bd_addr, btsock_type_t type, const uint8_t* uuid,
int channel, int* sock_fd, int flags);
+
+ /*
+ * get socket option of rfcomm channel socket.
+ */
+ bt_status_t (*get_sock_opt)(btsock_type_t type, int channel, btsock_option_type_t option_name,
+ void *option_value, int *option_len);
+ /*
+
+ * set socket option of rfcomm channel socket.
+ */
+ bt_status_t (*set_sock_opt)(btsock_type_t type, int channel, btsock_option_type_t option_name,
+ void *option_value, int option_len);
+
} btsock_interface_t;
__END_DECLS
diff --git a/include/hardware/gralloc.h b/include/hardware/gralloc.h
index ef86f90..07ac029 100644
--- a/include/hardware/gralloc.h
+++ b/include/hardware/gralloc.h
@@ -143,6 +143,19 @@ enum {
GRALLOC_USAGE_PRIVATE_2 = 0x40000000,
GRALLOC_USAGE_PRIVATE_3 = 0x80000000,
GRALLOC_USAGE_PRIVATE_MASK = 0xF0000000,
+
+#ifdef EXYNOS4_ENHANCEMENTS
+ /* SAMSUNG */
+ GRALLOC_USAGE_PRIVATE_NONECACHE = 0x00800000,
+
+ GRALLOC_USAGE_HW_FIMC1 = 0x01000000,
+ GRALLOC_USAGE_HW_ION = 0x02000000,
+ GRALLOC_USAGE_YUV_ADDR = 0x04000000,
+ GRALLOC_USAGE_CAMERA = 0x08000000,
+
+ /* SEC Private usage , for Overlay path at HWC */
+ GRALLOC_USAGE_HWC_HWOVERLAY = 0x20000000,
+#endif
};
/*****************************************************************************/
@@ -237,6 +250,10 @@ typedef struct gralloc_module_t {
int (*unlock)(struct gralloc_module_t const* module,
buffer_handle_t handle);
+#ifdef EXYNOS4_ENHANCEMENTS
+ int (*getphys) (struct gralloc_module_t const* module,
+ buffer_handle_t handle, void** paddr);
+#endif
/* reserved for future use */
int (*perform)(struct gralloc_module_t const* module,
diff --git a/include/hardware/hwcomposer_defs.h b/include/hardware/hwcomposer_defs.h
index a19a26c..9c7d790 100644
--- a/include/hardware/hwcomposer_defs.h
+++ b/include/hardware/hwcomposer_defs.h
@@ -207,15 +207,17 @@ enum {
enum {
HWC_DISPLAY_PRIMARY = 0,
HWC_DISPLAY_EXTERNAL = 1, // HDMI, DP, etc.
- HWC_DISPLAY_VIRTUAL = 2,
+ HWC_DISPLAY_TERTIARY = 2,
+ HWC_DISPLAY_VIRTUAL = 3,
- HWC_NUM_PHYSICAL_DISPLAY_TYPES = 2,
- HWC_NUM_DISPLAY_TYPES = 3,
+ HWC_NUM_PHYSICAL_DISPLAY_TYPES = 3,
+ HWC_NUM_DISPLAY_TYPES = 4,
};
enum {
HWC_DISPLAY_PRIMARY_BIT = 1 << HWC_DISPLAY_PRIMARY,
HWC_DISPLAY_EXTERNAL_BIT = 1 << HWC_DISPLAY_EXTERNAL,
+ HWC_DISPLAY_TERTIARY_BIT = 1 << HWC_DISPLAY_TERTIARY,
HWC_DISPLAY_VIRTUAL_BIT = 1 << HWC_DISPLAY_VIRTUAL,
};
diff --git a/include/hardware/lights.h b/include/hardware/lights.h
index 2cf5519..777c915 100644
--- a/include/hardware/lights.h
+++ b/include/hardware/lights.h
@@ -51,6 +51,12 @@ __BEGIN_DECLS
#define LIGHT_ID_BLUETOOTH "bluetooth"
#define LIGHT_ID_WIFI "wifi"
+/*
+ * Additional hardware-specific lights
+ */
+#define LIGHT_ID_CAPS "caps"
+#define LIGHT_ID_FUNC "func"
+
/* ************************************************************************
* Flash modes for the flashMode field of light_state_t.
*/
@@ -82,6 +88,11 @@ __BEGIN_DECLS
#define BRIGHTNESS_MODE_SENSOR 1
/**
+ * Light mode allows multiple LEDs
+ */
+#define LIGHT_MODE_MULTIPLE_LEDS 0x01
+
+/**
* The parameters that can be set for a given light.
*
* Not all lights must support all parameters. If you
@@ -101,6 +112,9 @@ struct light_state_t {
*
* The high byte should be ignored. Callers will set it to 0xff (which
* would correspond to 255 alpha).
+ *
+ * CyanogenMod: The high byte value can be implemented to control the LEDs
+ * Brightness from the Lights settings. The value goes from 0x01 to 0xFF.
*/
unsigned int color;
@@ -116,6 +130,12 @@ struct light_state_t {
* Currently the values are BRIGHTNESS_MODE_USER and BRIGHTNESS_MODE_SENSOR.
*/
int brightnessMode;
+
+ /**
+ * Define the LEDs modes (multiple, ...).
+ * See the LIGHTS_MODE_* mask constants.
+ */
+ unsigned int ledsModes;
};
struct light_device_t {
diff --git a/include/hardware/nfc.h b/include/hardware/nfc.h
index 58d33d9..6002e34 100644
--- a/include/hardware/nfc.h
+++ b/include/hardware/nfc.h
@@ -54,6 +54,7 @@ __BEGIN_DECLS
*/
#define NFC_NCI_HARDWARE_MODULE_ID "nfc_nci"
#define NFC_NCI_BCM2079X_HARDWARE_MODULE_ID "nfc_nci.bcm2079x"
+#define NFC_NCI_NXP_PN54X_HARDWARE_MODULE_ID "nfc_nci.pn54x"
#define NFC_NCI_CONTROLLER "nci"
/*
diff --git a/include/hardware/power.h b/include/hardware/power.h
index 10612f3..c266d8b 100644
--- a/include/hardware/power.h
+++ b/include/hardware/power.h
@@ -46,11 +46,19 @@ typedef enum {
*/
POWER_HINT_VIDEO_ENCODE = 0x00000003,
POWER_HINT_VIDEO_DECODE = 0x00000004,
- POWER_HINT_LOW_POWER = 0x00000005
+ POWER_HINT_LOW_POWER = 0x00000005,
+ POWER_HINT_CAM_PREVIEW = 0x00000006,
+
+ POWER_HINT_CPU_BOOST = 0x00000010,
+ POWER_HINT_LAUNCH_BOOST = 0x00000011,
+ POWER_HINT_AUDIO = 0x00000020,
+ POWER_HINT_SET_PROFILE = 0x00000030
+
} power_hint_t;
typedef enum {
- POWER_FEATURE_DOUBLE_TAP_TO_WAKE = 0x00000001
+ POWER_FEATURE_DOUBLE_TAP_TO_WAKE = 0x00000001,
+ POWER_FEATURE_SUPPORTED_PROFILES = 0x00001000
} feature_t;
/**
@@ -126,6 +134,12 @@ typedef struct power_module {
* parameter is non-zero when low power mode is activated, and zero
* when deactivated.
*
+ * POWER_HINT_CPU_BOOST
+ *
+ * An operation is happening where it would be ideal for the CPU to
+ * be boosted for a specific duration. The data parameter is an
+ * integer value of the boost duration in microseconds.
+ *
* A particular platform may choose to ignore any hint.
*
* availability: version 0.2
@@ -148,6 +162,12 @@ typedef struct power_module {
*/
void (*setFeature)(struct power_module *module, feature_t feature, int state);
+ /*
+ * (*getFeature) is called to get the current value of a particular
+ * feature or capability from the hardware or PowerHAL
+ */
+ int (*getFeature)(struct power_module *module, feature_t feature);
+
} power_module_t;
diff --git a/include/hardware/tv_input.h b/include/hardware/tv_input.h
index ed3fafb..456b06e 100644
--- a/include/hardware/tv_input.h
+++ b/include/hardware/tv_input.h
@@ -278,6 +278,9 @@ typedef struct buffer_producer_stream {
/* OUT: Client must allocate a buffer with this format. */
uint32_t format;
+
+ /* OUT: Client must allocate buffers based on this count. */
+ uint32_t buffer_count;
} buffer_producer_stream_t;
typedef struct tv_stream {
diff --git a/include/hardware/wipower.h b/include/hardware/wipower.h
new file mode 100644
index 0000000..eb3a0ee
--- /dev/null
+++ b/include/hardware/wipower.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ANDROID_INCLUDE_WIPOWER_H
+#define ANDROID_INCLUDE_WIPOWER_H
+
+#include <stdint.h>
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <stdbool.h>
+
+#include <hardware/hardware.h>
+#include <hardware/bluetooth.h>
+
+__BEGIN_DECLS
+
+typedef enum {
+ OFF =0,
+ ON
+} wipower_state_t;
+
+
+typedef struct {
+
+unsigned char optional;
+unsigned short rect_voltage;
+unsigned short rect_current;
+unsigned short out_voltage;
+unsigned short out_current;
+unsigned char temp;
+unsigned short rect_voltage_min;
+unsigned short rect_voltage_set;
+unsigned short rect_voltage_max;
+unsigned char alert;
+unsigned short rfu1;
+unsigned char rfu2;
+
+}__attribute__((packed)) wipower_dyn_data_t;
+
+/** Bluetooth Enable/Disable Callback. */
+typedef void (*wipower_state_changed_callback)(wipower_state_t state);
+
+
+typedef void (*wipower_alerts)(unsigned char alert);
+
+
+typedef void (*wipower_dynamic_data)(wipower_dyn_data_t* alert_data);
+
+
+typedef void (*wipower_power_apply)(unsigned char power_flag);
+
+typedef void (*callback_thread_event)(bt_cb_thread_evt evt);
+
+/** Bluetooth DM callback structure. */
+typedef struct {
+ /** set to sizeof(wipower_callbacks_t) */
+ size_t size;
+ wipower_state_changed_callback wipower_state_changed_cb;
+ wipower_alerts wipower_alert;
+ wipower_dynamic_data wipower_data;
+ wipower_power_apply wipower_power_event;
+ callback_thread_event callback_thread_event;
+} wipower_callbacks_t;
+
+
+/** Represents the standard Wipower interface. */
+typedef struct {
+ /** set to sizeof(wipower_interface_t) */
+ size_t size;
+
+ /** Initialize Wipower modules*/
+ int (*init)(wipower_callbacks_t *wp_callbacks);
+
+ /** Enable/Disable Wipower charging */
+ int (*enable)(bool enable);
+
+ int (*set_current_limit)(short value);
+
+ unsigned char (*get_current_limit)(void);
+
+ wipower_state_t (*get_state)(void);
+
+ /** Enable/Disable Wipower charging */
+ int (*enable_alerts)(bool enable);
+
+ int (*enable_data_notify)(bool enable);
+ int (*enable_power_apply)(bool enable, bool on, bool time_flag);
+} wipower_interface_t;
+
+
+__END_DECLS
+
+#endif /* ANDROID_INCLUDE_WIPOWER_H */
diff --git a/modules/audio/Android.mk b/modules/audio/Android.mk
index ef4b8f5..8dfda57 100644
--- a/modules/audio/Android.mk
+++ b/modules/audio/Android.mk
@@ -60,3 +60,16 @@ LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS := -Wno-unused-parameter
include $(BUILD_SHARED_LIBRARY)
+
+# The stub audio amplifier HAL module that can be used as a skeleton for
+# new implementations.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := audio_amplifier.default
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := audio_amplifier.c
+LOCAL_SHARED_LIBRARIES := liblog libcutils
+LOCAL_MODULE_TAGS := optional
+LOCAL_CFLAGS := -Wno-unused-parameter
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/audio/audio_amplifier.c b/modules/audio/audio_amplifier.c
new file mode 100644
index 0000000..9b92356
--- /dev/null
+++ b/modules/audio/audio_amplifier.c
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2015 The CyanogenMod 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.
+ */
+
+#define LOG_TAG "amplifier_default"
+//#define LOG_NDEBUG 0
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <sys/types.h>
+
+#include <cutils/log.h>
+#include <cutils/str_parms.h>
+
+#include <hardware/audio_amplifier.h>
+#include <hardware/hardware.h>
+
+static int amp_set_input_devices(amplifier_device_t *device, uint32_t devices)
+{
+ return 0;
+}
+
+static int amp_set_output_devices(amplifier_device_t *device, uint32_t devices)
+{
+ return 0;
+}
+
+static int amp_enable_output_devices(amplifier_device_t *device,
+ uint32_t devices, bool enable)
+{
+ return 0;
+}
+
+static int amp_enable_input_devices(amplifier_device_t *device,
+ uint32_t devices, bool enable)
+{
+ return 0;
+}
+
+static int amp_set_mode(amplifier_device_t *device, audio_mode_t mode)
+{
+ return 0;
+}
+
+static int amp_output_stream_start(amplifier_device_t *device,
+ struct audio_stream_out *stream, bool offload)
+{
+ return 0;
+}
+
+static int amp_input_stream_start(amplifier_device_t *device,
+ struct audio_stream_in *stream)
+{
+ return 0;
+}
+
+static int amp_output_stream_standby(amplifier_device_t *device,
+ struct audio_stream_out *stream)
+{
+ return 0;
+}
+
+static int amp_input_stream_standby(amplifier_device_t *device,
+ struct audio_stream_in *stream)
+{
+ return 0;
+}
+
+static int amp_set_parameters(struct amplifier_device *device,
+ struct str_parms *parms)
+{
+ return 0;
+}
+
+static int amp_dev_close(hw_device_t *device)
+{
+ if (device)
+ free(device);
+
+ return 0;
+}
+
+static int amp_module_open(const hw_module_t *module, const char *name,
+ hw_device_t **device)
+{
+ if (strcmp(name, AMPLIFIER_HARDWARE_INTERFACE)) {
+ ALOGE("%s:%d: %s does not match amplifier hardware interface name\n",
+ __func__, __LINE__, name);
+ return -ENODEV;
+ }
+
+ amplifier_device_t *amp_dev = calloc(1, sizeof(amplifier_device_t));
+ if (!amp_dev) {
+ ALOGE("%s:%d: Unable to allocate memory for amplifier device\n",
+ __func__, __LINE__);
+ return -ENOMEM;
+ }
+
+ amp_dev->common.tag = HARDWARE_DEVICE_TAG;
+ amp_dev->common.module = (hw_module_t *) module;
+ amp_dev->common.version = HARDWARE_DEVICE_API_VERSION(1, 0);
+ amp_dev->common.close = amp_dev_close;
+
+ amp_dev->set_input_devices = amp_set_input_devices;
+ amp_dev->set_output_devices = amp_set_output_devices;
+ amp_dev->enable_output_devices = amp_enable_output_devices;
+ amp_dev->enable_input_devices = amp_enable_input_devices;
+ amp_dev->set_mode = amp_set_mode;
+ amp_dev->output_stream_start = amp_output_stream_start;
+ amp_dev->input_stream_start = amp_input_stream_start;
+ amp_dev->output_stream_standby = amp_output_stream_standby;
+ amp_dev->input_stream_standby = amp_input_stream_standby;
+ amp_dev->set_parameters = amp_set_parameters;
+
+ *device = (hw_device_t *) amp_dev;
+
+ return 0;
+}
+
+static struct hw_module_methods_t hal_module_methods = {
+ .open = amp_module_open,
+};
+
+amplifier_module_t HAL_MODULE_INFO_SYM = {
+ .common = {
+ .tag = HARDWARE_MODULE_TAG,
+ .module_api_version = AMPLIFIER_MODULE_API_VERSION_0_1,
+ .hal_api_version = HARDWARE_HAL_API_VERSION,
+ .id = AMPLIFIER_HARDWARE_MODULE_ID,
+ .name = "Default audio amplifier HAL",
+ .author = "The CyanogenMod Open Source Project",
+ .methods = &hal_module_methods,
+ },
+};
diff --git a/modules/audio_remote_submix/audio_hw.cpp b/modules/audio_remote_submix/audio_hw.cpp
index ed3d311..515f150 100644
--- a/modules/audio_remote_submix/audio_hw.cpp
+++ b/modules/audio_remote_submix/audio_hw.cpp
@@ -159,11 +159,11 @@ typedef struct route_config {
// destroyed if both and input and output streams are destroyed.
struct submix_stream_out *output;
struct submix_stream_in *input;
-#if ENABLE_RESAMPLING
- // Buffer used as temporary storage for resampled data prior to returning data to the output
+#if (ENABLE_RESAMPLING || ENABLE_CHANNEL_CONVERSION)
+ // Buffer used as temporary storage for audio data prior to returning data to the output
// stream.
- int16_t resampler_buffer[DEFAULT_PIPE_SIZE_IN_FRAMES];
-#endif // ENABLE_RESAMPLING
+ int16_t processor_buffer[DEFAULT_PIPE_SIZE_IN_FRAMES];
+#endif
} route_config_t;
struct submix_audio_device {
@@ -474,8 +474,8 @@ static void submix_audio_device_release_pipe_l(struct submix_audio_device * cons
rsxadev->routes[route_idx].rsxSource = 0;
}
memset(rsxadev->routes[route_idx].address, 0, AUDIO_DEVICE_MAX_ADDRESS_LEN);
-#ifdef ENABLE_RESAMPLING
- memset(rsxadev->routes[route_idx].resampler_buffer, 0,
+#if (ENABLE_RESAMPLING || ENABLE_CHANNEL_CONVERSION)
+ memset(rsxadev->routes[route_idx].processor_buffer, 0,
sizeof(int16_t) * DEFAULT_PIPE_SIZE_IN_FRAMES);
#endif
}
@@ -1147,13 +1147,14 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer,
}
#endif // ENABLE_CHANNEL_CONVERSION
+#if (ENABLE_RESAMPLING || ENABLE_CHANNEL_CONVERSION)
+ const size_t processor_buffer_size_frames =
+ sizeof(rsxadev->routes[in->route_handle].processor_buffer) / frame_size;
+#endif
#if ENABLE_RESAMPLING
const uint32_t input_sample_rate = in_get_sample_rate(&stream->common);
const uint32_t output_sample_rate =
rsxadev->routes[in->route_handle].config.output_sample_rate;
- const size_t resampler_buffer_size_frames =
- sizeof(rsxadev->routes[in->route_handle].resampler_buffer) /
- sizeof(rsxadev->routes[in->route_handle].resampler_buffer[0]);
float resampler_ratio = 1.0f;
// Determine whether resampling is required.
if (input_sample_rate != output_sample_rate) {
@@ -1170,16 +1171,18 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer,
while ((remaining_frames > 0) && (attempts < MAX_READ_ATTEMPTS)) {
ssize_t frames_read = -1977;
size_t read_frames = remaining_frames;
-#if ENABLE_RESAMPLING
+#if (ENABLE_RESAMPLING || ENABLE_CHANNEL_CONVERSION)
char* const saved_buff = buff;
+#endif
+#if ENABLE_RESAMPLING
if (resampler_ratio != 1.0f) {
// Calculate the number of frames from the pipe that need to be read to generate
// the data for the input stream read.
const size_t frames_required_for_resampler = (size_t)(
(float)read_frames * (float)resampler_ratio);
- read_frames = min(frames_required_for_resampler, resampler_buffer_size_frames);
+ read_frames = min(frames_required_for_resampler, processor_buffer_size_frames);
// Read into the resampler buffer.
- buff = (char*)rsxadev->routes[in->route_handle].resampler_buffer;
+ buff = (char*)rsxadev->routes[in->route_handle].processor_buffer;
}
#endif // ENABLE_RESAMPLING
#if ENABLE_CHANNEL_CONVERSION
@@ -1187,6 +1190,13 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer,
// Need to read half the requested frames since the converted output
// data will take twice the space (mono->stereo).
read_frames /= 2;
+ } else if (output_channels == 2 && input_channels == 1) {
+ // If the resampler is active, we already swapped for the processor_buffer
+ if (resampler_ratio == 1.0f) {
+ buff = (char*)rsxadev->routes[in->route_handle].processor_buffer;
+ }
+
+ read_frames = min(read_frames, processor_buffer_size_frames/2);
}
#endif // ENABLE_CHANNEL_CONVERSION
@@ -1205,11 +1215,17 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer,
if (output_channels == 2 && input_channels == 1) {
// Offset into the output stream data in samples.
ssize_t output_stream_offset = 0;
+ // If resampler is active, continue writing to the temporary buffer
+ int16_t *mixed_buffer =
+ (resampler_ratio == 1.0f) ? (int16_t*)saved_buff : (int16_t*)buff;
for (ssize_t input_stream_frame = 0; input_stream_frame < frames_read;
input_stream_frame++, output_stream_offset += 2) {
// Average the content from both channels.
- data[input_stream_frame] = ((int32_t)data[output_stream_offset] +
- (int32_t)data[output_stream_offset + 1]) / 2;
+ mixed_buffer[input_stream_frame] = ((int32_t)data[output_stream_offset] +
+ (int32_t)data[output_stream_offset + 1]) / 2;
+ }
+ if (resampler_ratio == 1.0f) {
+ buff = saved_buff;
}
} else if (output_channels == 1 && input_channels == 2) {
// Offset into the input stream data in samples.
@@ -1233,13 +1249,20 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer,
// sampled at a different rate this will result in very nasty aliasing.
const float output_stream_frames = (float)frames_read;
size_t input_stream_frame = 0;
+ size_t input_buf_offset = 0, output_buf_offset = 0;
for (float output_stream_frame = 0.0f;
output_stream_frame < output_stream_frames &&
input_stream_frame < remaining_frames;
output_stream_frame += resampler_ratio, input_stream_frame++) {
- resampled_buffer[input_stream_frame] = data[(size_t)output_stream_frame];
+ input_buf_offset = input_stream_frame * input_channels;
+ output_buf_offset = (size_t)output_stream_frame * input_channels;
+ resampled_buffer[input_buf_offset] = data[output_buf_offset];
+ if (input_channels == 2) {
+ // copy second channel in the frame
+ resampled_buffer[input_buf_offset + 1] = data[output_buf_offset + 1];
+ }
}
- ALOG_ASSERT(input_stream_frame <= (ssize_t)resampler_buffer_size_frames);
+ ALOG_ASSERT(input_stream_frame <= (ssize_t)processor_buffer_size_frames);
SUBMIX_ALOGV("in_read(): resampler produced %zd frames", input_stream_frame);
frames_read = input_stream_frame;
buff = saved_buff;
diff --git a/modules/sensors/Android.mk b/modules/sensors/Android.mk
index 445f69e..94d100b 100644
--- a/modules/sensors/Android.mk
+++ b/modules/sensors/Android.mk
@@ -20,9 +20,9 @@ ifeq ($(USE_SENSOR_MULTI_HAL),true)
include $(CLEAR_VARS)
-LOCAL_MODULE := sensors.$(TARGET_DEVICE)
+LOCAL_MODULE := sensors.$(TARGET_BOARD_PLATFORM)
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
+LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_CFLAGS := -DLOG_TAG=\"MultiHal\"
diff --git a/modules/sensors/multihal.cpp b/modules/sensors/multihal.cpp
index cd67f6d..5fedd4d 100644
--- a/modules/sensors/multihal.cpp
+++ b/modules/sensors/multihal.cpp
@@ -27,6 +27,8 @@
#include <cutils/log.h>
#include <vector>
+#include <string>
+#include <fstream>
#include <map>
#include <string>
@@ -36,8 +38,6 @@
static const char* CONFIG_FILENAME = "/system/etc/sensors/hals.conf";
-static const char* LEGAL_SUBHAL_PATH_PREFIX = "/system/lib/hw/";
-static const char* LEGAL_SUBHAL_ALTERNATE_PATH_PREFIX = "/system/vendor/lib/";
static const int MAX_CONF_LINE_LENGTH = 1024;
static pthread_mutex_t init_modules_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -463,39 +463,19 @@ static bool starts_with(const char* s, const char* prefix) {
* Adds valid paths from the config file to the vector passed in.
* The vector must not be null.
*/
-static void get_so_paths(std::vector<char*> *so_paths) {
- FILE *conf_file = fopen(CONFIG_FILENAME, "r");
- if (conf_file == NULL) {
+static void get_so_paths(std::vector<std::string> *so_paths) {
+ std::string line;
+ std::ifstream conf_file(CONFIG_FILENAME);
+
+ if(!conf_file) {
ALOGW("No multihal config file found at %s", CONFIG_FILENAME);
return;
}
ALOGV("Multihal config file found at %s", CONFIG_FILENAME);
- char *line = NULL;
- size_t len = 0;
- int line_count = 0;
- while (getline(&line, &len, conf_file) != -1) {
- // overwrite trailing eoln with null char
- char* pch = strchr(line, '\n');
- if (pch != NULL) {
- *pch = '\0';
- }
- ALOGV("config file line #%d: '%s'", ++line_count, line);
- char *real_path = realpath(line, NULL);
- if (starts_with(real_path, LEGAL_SUBHAL_PATH_PREFIX) ||
- starts_with(real_path, LEGAL_SUBHAL_ALTERNATE_PATH_PREFIX)) {
- ALOGV("accepting valid path '%s'", real_path);
- char* compact_line = new char[strlen(real_path) + 1];
- strcpy(compact_line, real_path);
- so_paths->push_back(compact_line);
- } else {
- ALOGW("rejecting path '%s' because it does not start with '%s' or '%s'",
- real_path, LEGAL_SUBHAL_PATH_PREFIX, LEGAL_SUBHAL_ALTERNATE_PATH_PREFIX);
- }
- free(real_path);
+ while (std::getline(conf_file, line)) {
+ ALOGV("config file line: '%s'", line.c_str());
+ so_paths->push_back(line);
}
- free(line);
- fclose(conf_file);
- ALOGV("hals.conf contained %d lines", line_count);
}
/*
@@ -508,15 +488,15 @@ static void lazy_init_modules() {
pthread_mutex_unlock(&init_modules_mutex);
return;
}
- std::vector<char*> *so_paths = new std::vector<char*>();
+ std::vector<std::string> *so_paths = new std::vector<std::string>();
get_so_paths(so_paths);
// dlopen the module files and cache their module symbols in sub_hw_modules
sub_hw_modules = new std::vector<hw_module_t *>();
dlerror(); // clear any old errors
const char* sym = HAL_MODULE_INFO_SYM_AS_STR;
- for (std::vector<char*>::iterator it = so_paths->begin(); it != so_paths->end(); it++) {
- char* path = *it;
+ for (std::vector<std::string>::iterator it = so_paths->begin(); it != so_paths->end(); it++) {
+ const char* path = it->c_str();
void* lib_handle = dlopen(path, RTLD_LAZY);
if (lib_handle == NULL) {
ALOGW("dlerror(): %s", dlerror());