DO NOT MERGE ANYWHERE Provide HFP API to set AG SCO policy am: bf47a8ec52 -s ours
am: c739a0dd03 -s ours
Change-Id: I9203a1cfd2e17e301245fb17266099fe90dd4aae
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..f6aacd2
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,38 @@
+// Copyright 2006 The Android Open Source Project
+
+cc_library_headers {
+ name: "libhardware_headers",
+ header_libs: [
+ "libaudio_system_headers",
+ "libsystem_headers",
+ ],
+ export_header_lib_headers: [
+ "libaudio_system_headers",
+ "libsystem_headers"
+ ],
+
+ export_include_dirs: ["include"],
+ vendor_available: true,
+}
+
+cc_library_shared {
+ name: "libhardware",
+
+ srcs: ["hardware.c"],
+ shared_libs: [
+ "libcutils",
+ "liblog",
+ "libdl",
+ ],
+ cflags: ["-DQEMU_HARDWARE"],
+
+ header_libs: ["libhardware_headers"],
+ export_header_lib_headers: ["libhardware_headers"],
+
+ vendor_available: true,
+}
+
+subdirs = [
+ "modules/*",
+ "tests/*",
+]
diff --git a/Android.mk b/Android.mk
index aec6781..8744f46 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,24 +1,3 @@
# Copyright 2006 The Android Open Source Project
-# Setting LOCAL_PATH will mess up all-subdir-makefiles, so do it beforehand.
-SUBDIR_MAKEFILES := $(call all-named-subdir-makefiles,modules tests)
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SHARED_LIBRARIES := libcutils liblog
-
-LOCAL_INCLUDES += $(LOCAL_PATH)
-
-LOCAL_CFLAGS += -DQEMU_HARDWARE
-QEMU_HARDWARE := true
-
-LOCAL_SHARED_LIBRARIES += libdl
-
-LOCAL_SRC_FILES += hardware.c
-
-LOCAL_MODULE:= libhardware
-
-include $(BUILD_SHARED_LIBRARY)
-
-include $(SUBDIR_MAKEFILES)
+include $(call all-named-subdir-makefiles,modules tests)
diff --git a/hardware.c b/hardware.c
index 5394787..7e4debe 100644
--- a/hardware.c
+++ b/hardware.c
@@ -23,9 +23,11 @@
#include <pthread.h>
#include <errno.h>
#include <limits.h>
+#include <stdio.h>
+#include <unistd.h>
#define LOG_TAG "HAL"
-#include <utils/Log.h>
+#include <log/log.h>
/** Base path of the hal modules */
#if defined(__LP64__)
diff --git a/include/hardware/audio.h b/include/hardware/audio.h
index ec7fd4b..c95ad09 100644
--- a/include/hardware/audio.h
+++ b/include/hardware/audio.h
@@ -679,7 +679,7 @@
struct audio_hw_device** device)
{
return module->methods->open(module, AUDIO_HARDWARE_INTERFACE,
- (struct hw_device_t**)device);
+ TO_HW_DEVICE_T_OPEN(device));
}
static inline int audio_hw_device_close(struct audio_hw_device* device)
diff --git a/include/hardware/audio_alsaops.h b/include/hardware/audio_alsaops.h
index 0d266ff..f83941e 100644
--- a/include/hardware/audio_alsaops.h
+++ b/include/hardware/audio_alsaops.h
@@ -22,7 +22,8 @@
#ifndef ANDROID_AUDIO_ALSAOPS_H
#define ANDROID_AUDIO_ALSAOPS_H
-#include <cutils/log.h>
+#include <log/log.h>
+
#include <system/audio.h>
#include <tinyalsa/asoundlib.h>
diff --git a/include/hardware/ble_advertiser.h b/include/hardware/ble_advertiser.h
new file mode 100644
index 0000000..02d553f
--- /dev/null
+++ b/include/hardware/ble_advertiser.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2016 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_BLE_ADVERTISER_H
+#define ANDROID_INCLUDE_BLE_ADVERTISER_H
+
+#include <base/callback_forward.h>
+#include <stdint.h>
+#include <vector>
+#include "bt_common_types.h"
+#include "bt_gatt_types.h"
+
+struct AdvertiseParameters {
+ uint16_t advertising_event_properties;
+ uint32_t min_interval;
+ uint32_t max_interval;
+ uint8_t channel_map;
+ int8_t tx_power;
+ uint8_t primary_advertising_phy;
+ uint8_t secondary_advertising_phy;
+ uint8_t scan_request_notification_enable;
+};
+
+struct PeriodicAdvertisingParameters {
+ uint8_t enable;
+ uint16_t min_interval;
+ uint16_t max_interval;
+ uint16_t periodic_advertising_properties;
+};
+
+class BleAdvertiserInterface {
+ public:
+ virtual ~BleAdvertiserInterface() = default;
+
+ /** Callback invoked when multi-adv operation has completed */
+ using StatusCallback = base::Callback<void(uint8_t /* status */)>;
+ using IdStatusCallback =
+ base::Callback<void(uint8_t /* advertiser_id */, uint8_t /* status */)>;
+ using IdTxPowerStatusCallback =
+ base::Callback<void(uint8_t /* advertiser_id */, int8_t /* tx_power */, uint8_t /* status */)>;
+ using ParametersCallback =
+ base::Callback<void(uint8_t /* status */, int8_t /* tx_power */)>;
+
+ /** Registers an advertiser with the stack */
+ virtual void RegisterAdvertiser(IdStatusCallback) = 0;
+
+ using GetAddressCallback = base::Callback<void(uint8_t /* address_type*/, bt_bdaddr_t /*address*/)>;
+ virtual void GetOwnAddress(uint8_t advertiser_id, GetAddressCallback cb) = 0;
+
+ /* Set the parameters as per spec, user manual specified values */
+ virtual void SetParameters(uint8_t advertiser_id, AdvertiseParameters params,
+ ParametersCallback cb) = 0;
+
+ /* Setup the data */
+ virtual void SetData(int advertiser_id, bool set_scan_rsp,
+ std::vector<uint8_t> data, StatusCallback cb) = 0;
+
+ /* Enable the advertising instance */
+ virtual void Enable(uint8_t advertiser_id, bool enable, StatusCallback cb,
+ uint16_t duration, uint8_t maxExtAdvEvents,
+ StatusCallback timeout_cb) = 0;
+
+ /* Unregisters an advertiser */
+ virtual void Unregister(uint8_t advertiser_id) = 0;
+
+ virtual void StartAdvertising(uint8_t advertiser_id, StatusCallback cb,
+ AdvertiseParameters params,
+ std::vector<uint8_t> advertise_data,
+ std::vector<uint8_t> scan_response_data,
+ int timeout_s, StatusCallback timeout_cb) = 0;
+
+ /** Start the advertising set. This include registering, setting all
+ * parameters and data, and enabling it. |register_cb| is called when the set
+ * is advertising. |timeout_cb| is called when the timeout_s have passed */
+ virtual void StartAdvertisingSet(
+ IdTxPowerStatusCallback register_cb, AdvertiseParameters params,
+ std::vector<uint8_t> advertise_data,
+ std::vector<uint8_t> scan_response_data,
+ PeriodicAdvertisingParameters periodic_params,
+ std::vector<uint8_t> periodic_data, uint16_t duration,
+ uint8_t maxExtAdvEvents, IdStatusCallback timeout_cb) = 0;
+
+ virtual void SetPeriodicAdvertisingParameters(
+ int advertiser_id, PeriodicAdvertisingParameters parameters,
+ StatusCallback cb) = 0;
+
+ virtual void SetPeriodicAdvertisingData(int advertiser_id,
+ std::vector<uint8_t> data,
+ StatusCallback cb) = 0;
+
+ virtual void SetPeriodicAdvertisingEnable(int advertiser_id, bool enable,
+ StatusCallback cb) = 0;
+};
+
+#endif /* ANDROID_INCLUDE_BLE_ADVERTISER_H */
diff --git a/include/hardware/ble_scanner.h b/include/hardware/ble_scanner.h
new file mode 100644
index 0000000..c8f9ec2
--- /dev/null
+++ b/include/hardware/ble_scanner.h
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2016 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_BLE_SCANNER_H
+#define ANDROID_INCLUDE_BLE_SCANNER_H
+
+#include <stdint.h>
+#include <vector>
+#include "bt_common_types.h"
+#include "bt_gatt_client.h"
+#include "bt_gatt_types.h"
+
+/** Callback invoked when batchscan reports are obtained */
+typedef void (*batchscan_reports_callback)(int client_if, int status,
+ int report_format, int num_records,
+ std::vector<uint8_t> data);
+
+/** Callback invoked when batchscan storage threshold limit is crossed */
+typedef void (*batchscan_threshold_callback)(int client_if);
+
+/** Track ADV VSE callback invoked when tracked device is found or lost */
+typedef void (*track_adv_event_callback)(
+ btgatt_track_adv_info_t *p_track_adv_info);
+
+/** Callback for scan results */
+typedef void (*scan_result_callback)(uint16_t event_type, uint8_t addr_type,
+ bt_bdaddr_t *bda, uint8_t primary_phy,
+ uint8_t secondary_phy,
+ uint8_t advertising_sid, int8_t tx_power,
+ int8_t rssi, uint16_t periodic_adv_int,
+ std::vector<uint8_t> adv_data);
+
+typedef struct {
+ scan_result_callback scan_result_cb;
+ batchscan_reports_callback batchscan_reports_cb;
+ batchscan_threshold_callback batchscan_threshold_cb;
+ track_adv_event_callback track_adv_event_cb;
+} btgatt_scanner_callbacks_t;
+
+class BleScannerInterface {
+ public:
+ virtual ~BleScannerInterface() = default;
+
+ using RegisterCallback =
+ base::Callback<void(uint8_t /* scanner_id */, uint8_t /* status */)>;
+
+ using Callback = base::Callback<void(uint8_t /* status */)>;
+
+ using EnableCallback =
+ base::Callback<void(uint8_t /* action */, uint8_t /* status */)>;
+
+ using FilterParamSetupCallback =
+ base::Callback<void(uint8_t /* avbl_space */, uint8_t /* action_type */,
+ uint8_t /* status */)>;
+
+ using FilterConfigCallback =
+ base::Callback<void(uint8_t /* filt_type */, uint8_t /* avbl_space */,
+ uint8_t /* action */, uint8_t /* status */)>;
+
+ /** Registers a scanner with the stack */
+ virtual void RegisterScanner(RegisterCallback) = 0;
+
+ /** Unregister a scanner from the stack */
+ virtual void Unregister(int scanner_id) = 0;
+
+ /** Start or stop LE device scanning */
+ virtual void Scan(bool start) = 0;
+
+ /** Setup scan filter params */
+ virtual void ScanFilterParamSetup(
+ uint8_t client_if, uint8_t action, uint8_t filt_index,
+ std::unique_ptr<btgatt_filt_param_setup_t> filt_param,
+ FilterParamSetupCallback cb) = 0;
+
+ /** Configure a scan filter condition */
+ virtual void ScanFilterAddRemove(int action, int filt_type, int filt_index,
+ int company_id, int company_id_mask,
+ const bt_uuid_t *p_uuid,
+ const bt_uuid_t *p_uuid_mask,
+ const bt_bdaddr_t *bd_addr, char addr_type,
+ std::vector<uint8_t> data,
+ std::vector<uint8_t> p_mask,
+ FilterConfigCallback cb) = 0;
+
+ /** Clear all scan filter conditions for specific filter index*/
+ virtual void ScanFilterClear(int filt_index, FilterConfigCallback cb) = 0;
+
+ /** Enable / disable scan filter feature*/
+ virtual void ScanFilterEnable(bool enable, EnableCallback cb) = 0;
+
+ /** Sets the LE scan interval and window in units of N*0.625 msec */
+ virtual void SetScanParameters(int scan_interval, int scan_window,
+ Callback cb) = 0;
+
+ /* Configure the batchscan storage */
+ virtual void BatchscanConfigStorage(int client_if, int batch_scan_full_max,
+ int batch_scan_trunc_max,
+ int batch_scan_notify_threshold,
+ Callback cb) = 0;
+
+ /* Enable batchscan */
+ virtual void BatchscanEnable(int scan_mode, int scan_interval,
+ int scan_window, int addr_type, int discard_rule,
+ Callback cb) = 0;
+
+ /* Disable batchscan */
+ virtual void BatchscanDisable(Callback cb) = 0;
+
+ /* Read out batchscan reports */
+ virtual void BatchscanReadReports(int client_if, int scan_mode) = 0;
+
+ using StartSyncCb =
+ base::Callback<void(uint8_t status, uint16_t sync_handle,
+ uint8_t advertising_sid, uint8_t address_type,
+ bt_bdaddr_t address, uint8_t phy, uint16_t interval)>;
+ using SyncReportCb =
+ base::Callback<void(uint16_t sync_handle, int8_t tx_power, int8_t rssi,
+ uint8_t status, std::vector<uint8_t> data)>;
+ using SyncLostCb = base::Callback<void(uint16_t sync_handle)>;
+ virtual void StartSync(uint8_t sid, bt_bdaddr_t address, uint16_t skip,
+ uint16_t timeout, StartSyncCb start_cb,
+ SyncReportCb report_cb, SyncLostCb lost_cb) = 0;
+ virtual void StopSync(uint16_t handle) = 0;
+};
+
+#endif /* ANDROID_INCLUDE_BLE_SCANNER_H */
\ No newline at end of file
diff --git a/include/hardware/bluetooth.h b/include/hardware/bluetooth.h
index dd5ea8a..5d69ab3 100644
--- a/include/hardware/bluetooth.h
+++ b/include/hardware/bluetooth.h
@@ -44,6 +44,7 @@
#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"
@@ -162,6 +163,11 @@
uint16_t total_trackable_advertisers;
bool extended_scan_support;
bool debug_logging_supported;
+ bool le_2m_phy_supported;
+ bool le_coded_phy_supported;
+ bool le_extended_advertising_supported;
+ bool le_periodic_advertising_supported;
+ uint16_t le_maximum_advertising_data_length;
}bt_local_le_features_t;
/* Bluetooth Adapter and Remote Device property types */
@@ -273,7 +279,7 @@
uint8_t c256[16]; /* Simple Pairing Hash C-256 */
uint8_t r256[16]; /* Simple Pairing Randomizer R-256 */
uint8_t sm_tk[16]; /* Security Manager TK Value */
- uint8_t le_sc_c[16]; /* LE Secure Connections Random Value */
+ uint8_t le_sc_c[16]; /* LE Secure Connections Confirmation Value */
uint8_t le_sc_r[16]; /* LE Secure Connections Random Value */
} bt_out_of_band_data_t;
diff --git a/include/hardware/bt_av.h b/include/hardware/bt_av.h
index 9b32216..91ae2ac 100644
--- a/include/hardware/bt_av.h
+++ b/include/hardware/bt_av.h
@@ -17,6 +17,10 @@
#ifndef ANDROID_INCLUDE_BT_AV_H
#define ANDROID_INCLUDE_BT_AV_H
+#include <vector>
+
+#include <hardware/bluetooth.h>
+
__BEGIN_DECLS
/* Bluetooth AV connection states */
@@ -34,6 +38,93 @@
BTAV_AUDIO_STATE_STARTED,
} btav_audio_state_t;
+/*
+ * Enum values for each A2DP supported codec.
+ * There should be a separate entry for each A2DP codec that is supported
+ * for encoding (SRC), and for decoding purpose (SINK).
+ */
+typedef enum {
+ BTAV_A2DP_CODEC_INDEX_SOURCE_MIN = 0,
+
+ // Add an entry for each source codec here.
+ // NOTE: The values should be same as those listed in the following file:
+ // BluetoothCodecConfig.java
+ BTAV_A2DP_CODEC_INDEX_SOURCE_SBC = 0,
+ BTAV_A2DP_CODEC_INDEX_SOURCE_AAC,
+ BTAV_A2DP_CODEC_INDEX_SOURCE_APTX,
+ BTAV_A2DP_CODEC_INDEX_SOURCE_APTX_HD,
+ BTAV_A2DP_CODEC_INDEX_SOURCE_LDAC,
+
+ BTAV_A2DP_CODEC_INDEX_SOURCE_MAX,
+
+ BTAV_A2DP_CODEC_INDEX_SINK_MIN = BTAV_A2DP_CODEC_INDEX_SOURCE_MAX,
+
+ // Add an entry for each sink codec here
+ BTAV_A2DP_CODEC_INDEX_SINK_SBC = BTAV_A2DP_CODEC_INDEX_SINK_MIN,
+
+ BTAV_A2DP_CODEC_INDEX_SINK_MAX,
+
+ BTAV_A2DP_CODEC_INDEX_MIN = BTAV_A2DP_CODEC_INDEX_SOURCE_MIN,
+ BTAV_A2DP_CODEC_INDEX_MAX = BTAV_A2DP_CODEC_INDEX_SINK_MAX
+} btav_a2dp_codec_index_t;
+
+typedef enum {
+ // Disable the codec.
+ // NOTE: This value can be used only during initialization when
+ // function btav_source_interface_t::init() is called.
+ BTAV_A2DP_CODEC_PRIORITY_DISABLED = -1,
+
+ // Reset the codec priority to its default value.
+ BTAV_A2DP_CODEC_PRIORITY_DEFAULT = 0,
+
+ // Highest codec priority.
+ BTAV_A2DP_CODEC_PRIORITY_HIGHEST = 1000 * 1000
+} btav_a2dp_codec_priority_t;
+
+typedef enum {
+ BTAV_A2DP_CODEC_SAMPLE_RATE_NONE = 0x0,
+ BTAV_A2DP_CODEC_SAMPLE_RATE_44100 = 0x1 << 0,
+ BTAV_A2DP_CODEC_SAMPLE_RATE_48000 = 0x1 << 1,
+ BTAV_A2DP_CODEC_SAMPLE_RATE_88200 = 0x1 << 2,
+ BTAV_A2DP_CODEC_SAMPLE_RATE_96000 = 0x1 << 3,
+ BTAV_A2DP_CODEC_SAMPLE_RATE_176400 = 0x1 << 4,
+ BTAV_A2DP_CODEC_SAMPLE_RATE_192000 = 0x1 << 5
+} btav_a2dp_codec_sample_rate_t;
+
+typedef enum {
+ BTAV_A2DP_CODEC_BITS_PER_SAMPLE_NONE = 0x0,
+ BTAV_A2DP_CODEC_BITS_PER_SAMPLE_16 = 0x1 << 0,
+ BTAV_A2DP_CODEC_BITS_PER_SAMPLE_24 = 0x1 << 1,
+ BTAV_A2DP_CODEC_BITS_PER_SAMPLE_32 = 0x1 << 2
+} btav_a2dp_codec_bits_per_sample_t;
+
+typedef enum {
+ BTAV_A2DP_CODEC_CHANNEL_MODE_NONE = 0x0,
+ BTAV_A2DP_CODEC_CHANNEL_MODE_MONO = 0x1 << 0,
+ BTAV_A2DP_CODEC_CHANNEL_MODE_STEREO = 0x1 << 1
+} btav_a2dp_codec_channel_mode_t;
+
+/*
+ * Structure for representing codec capability or configuration.
+ * It is used for configuring A2DP codec preference, and for reporting back
+ * current configuration or codec capability.
+ * For codec capability, fields "sample_rate", "bits_per_sample" and
+ * "channel_mode" can contain bit-masks with all supported features.
+ */
+typedef struct {
+ btav_a2dp_codec_index_t codec_type;
+ btav_a2dp_codec_priority_t codec_priority; // Codec selection priority
+ // relative to other codecs: larger value
+ // means higher priority. If 0, reset to
+ // default.
+ btav_a2dp_codec_sample_rate_t sample_rate;
+ btav_a2dp_codec_bits_per_sample_t bits_per_sample;
+ btav_a2dp_codec_channel_mode_t channel_mode;
+ int64_t codec_specific_1; // Codec-specific value 1
+ int64_t codec_specific_2; // Codec-specific value 2
+ int64_t codec_specific_3; // Codec-specific value 3
+ int64_t codec_specific_4; // Codec-specific value 4
+} btav_a2dp_codec_config_t;
/** Callback for connection state change.
* state will have one of the values from btav_connection_state_t
@@ -48,23 +139,39 @@
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
+ * Used only for the A2DP Source interface.
+ */
+typedef void (* btav_audio_source_config_callback)(
+ btav_a2dp_codec_config_t codec_config,
+ std::vector<btav_a2dp_codec_config_t> codecs_local_capabilities,
+ std::vector<btav_a2dp_codec_config_t> codecs_selectable_capabilities);
+
+/** Callback for audio configuration change.
+ * Used only for the A2DP Sink interface.
* sample_rate: sample rate in Hz
* channel_count: number of channels (1 for mono, 2 for stereo)
*/
-typedef void (* btav_audio_config_callback)(bt_bdaddr_t *bd_addr,
- uint32_t sample_rate,
- uint8_t channel_count);
+typedef void (* btav_audio_sink_config_callback)(bt_bdaddr_t *bd_addr,
+ uint32_t sample_rate,
+ uint8_t channel_count);
-/** BT-AV callback structure. */
+/** BT-AV A2DP Source callback structure. */
typedef struct {
- /** set to sizeof(btav_callbacks_t) */
+ /** set to sizeof(btav_source_callbacks_t) */
size_t size;
btav_connection_state_callback connection_state_cb;
btav_audio_state_callback audio_state_cb;
- btav_audio_config_callback audio_config_cb;
-} btav_callbacks_t;
+ btav_audio_source_config_callback audio_config_cb;
+} btav_source_callbacks_t;
+
+/** BT-AV A2DP Sink callback structure. */
+typedef struct {
+ /** set to sizeof(btav_sink_callbacks_t) */
+ size_t size;
+ btav_connection_state_callback connection_state_cb;
+ btav_audio_state_callback audio_state_cb;
+ btav_audio_sink_config_callback audio_config_cb;
+} btav_sink_callbacks_t;
/**
* NOTE:
@@ -76,17 +183,43 @@
* android_audio_hw library and the Bluetooth stack.
*
*/
-/** Represents the standard BT-AV interface.
- * Used for both the A2DP source and sink interfaces.
+
+/** Represents the standard BT-AV A2DP Source interface.
*/
typedef struct {
- /** set to sizeof(btav_interface_t) */
+ /** set to sizeof(btav_source_interface_t) */
+ size_t size;
+ /**
+ * Register the BtAv callbacks.
+ */
+ bt_status_t (*init)(btav_source_callbacks_t* callbacks,
+ std::vector<btav_a2dp_codec_config_t> codec_priorities);
+
+ /** connect to headset */
+ bt_status_t (*connect)( bt_bdaddr_t *bd_addr );
+
+ /** dis-connect from headset */
+ bt_status_t (*disconnect)( bt_bdaddr_t *bd_addr );
+
+ /** configure the codecs settings preferences */
+ bt_status_t (*config_codec)(std::vector<btav_a2dp_codec_config_t> codec_preferences);
+
+ /** Closes the interface. */
+ void (*cleanup)( void );
+
+} btav_source_interface_t;
+
+/** Represents the standard BT-AV A2DP Sink interface.
+ */
+typedef struct {
+
+ /** set to sizeof(btav_sink_interface_t) */
size_t size;
/**
* Register the BtAv callbacks
*/
- bt_status_t (*init)( btav_callbacks_t* callbacks );
+ bt_status_t (*init)( btav_sink_callbacks_t* callbacks );
/** connect to headset */
bt_status_t (*connect)( bt_bdaddr_t *bd_addr );
@@ -102,7 +235,7 @@
/** Sets the audio track gain. */
void (*set_audio_track_gain)( float gain );
-} btav_interface_t;
+} btav_sink_interface_t;
__END_DECLS
diff --git a/include/hardware/bt_common_types.h b/include/hardware/bt_common_types.h
index 01b5256..cff3072 100644
--- a/include/hardware/bt_common_types.h
+++ b/include/hardware/bt_common_types.h
@@ -70,6 +70,22 @@
* the characteristic.
*/
uint8_t properties;
+ uint16_t permissions;
} btgatt_db_element_t;
+typedef struct
+{
+ uint16_t feat_seln;
+ uint16_t list_logic_type;
+ uint8_t filt_logic_type;
+ uint8_t rssi_high_thres;
+ uint8_t rssi_low_thres;
+ uint8_t dely_mode;
+ uint16_t found_timeout;
+ uint16_t lost_timeout;
+ uint8_t found_timeout_cnt;
+ uint16_t num_of_tracking_entries;
+} btgatt_filt_param_setup_t;
+
+
#endif /* ANDROID_INCLUDE_BT_COMMON_TYPES_H */
diff --git a/include/hardware/bt_gatt.h b/include/hardware/bt_gatt.h
index 42e14c2..393d1a5 100644
--- a/include/hardware/bt_gatt.h
+++ b/include/hardware/bt_gatt.h
@@ -19,6 +19,8 @@
#define ANDROID_INCLUDE_BT_GATT_H
#include <stdint.h>
+#include "ble_advertiser.h"
+#include "ble_scanner.h"
#include "bt_gatt_client.h"
#include "bt_gatt_server.h"
@@ -34,6 +36,9 @@
/** GATT Server callbacks */
const btgatt_server_callbacks_t* server;
+
+ /** LE scanner callbacks */
+ const btgatt_scanner_callbacks_t* scanner;
} btgatt_callbacks_t;
/** Represents the standard Bluetooth GATT interface. */
@@ -54,6 +59,12 @@
/** Pointer to the GATT server interface methods.*/
const btgatt_server_interface_t* server;
+
+ /** Pointer to the LE scanner interface methods.*/
+ BleScannerInterface* scanner;
+
+ /** Pointer to the advertiser interface methods.*/
+ BleAdvertiserInterface* advertiser;
} btgatt_interface_t;
__END_DECLS
diff --git a/include/hardware/bt_gatt_client.h b/include/hardware/bt_gatt_client.h
index e2c8a92..33a6825 100644
--- a/include/hardware/bt_gatt_client.h
+++ b/include/hardware/bt_gatt_client.h
@@ -19,6 +19,7 @@
#define ANDROID_INCLUDE_BT_GATT_CLIENT_H
#include <stdint.h>
+#include <vector>
#include "bt_gatt_types.h"
#include "bt_common_types.h"
@@ -67,23 +68,6 @@
typedef struct
{
- uint8_t client_if;
- uint8_t action;
- uint8_t filt_index;
- uint16_t feat_seln;
- uint16_t list_logic_type;
- uint8_t filt_logic_type;
- uint8_t rssi_high_thres;
- uint8_t rssi_low_thres;
- uint8_t dely_mode;
- uint16_t found_timeout;
- uint16_t lost_timeout;
- uint8_t found_timeout_cnt;
- uint16_t num_of_tracking_entries;
-} btgatt_filt_param_setup_t;
-
-typedef struct
-{
bt_bdaddr_t *bda1;
bt_uuid_t *uuid1;
uint16_t u1;
@@ -118,9 +102,6 @@
typedef void (*register_client_callback)(int status, int client_if,
bt_uuid_t *app_uuid);
-/** Callback for scan results */
-typedef void (*scan_result_callback)(bt_bdaddr_t* bda, int rssi, uint8_t* adv_data);
-
/** GATT open callback invoked in response to open */
typedef void (*connect_callback)(int conn_id, int status, int client_if, bt_bdaddr_t* bda);
@@ -165,36 +146,9 @@
typedef void (*read_remote_rssi_callback)(int client_if, bt_bdaddr_t* bda,
int rssi, int status);
-/**
- * Callback indicating the status of a listen() operation
- */
-typedef void (*listen_callback)(int status, int server_if);
-
/** Callback invoked when the MTU for a given connection changes */
typedef void (*configure_mtu_callback)(int conn_id, int status, int mtu);
-/** Callback invoked when a scan filter configuration command has completed */
-typedef void (*scan_filter_cfg_callback)(int action, int client_if, int status, int filt_type,
- int avbl_space);
-
-/** Callback invoked when scan param has been added, cleared, or deleted */
-typedef void (*scan_filter_param_callback)(int action, int client_if, int status,
- int avbl_space);
-
-/** Callback invoked when a scan filter configuration command has completed */
-typedef void (*scan_filter_status_callback)(int enable, int client_if, int status);
-
-/** Callback invoked when multi-adv enable operation has completed */
-typedef void (*multi_adv_enable_callback)(int client_if, int status);
-
-/** Callback invoked when multi-adv param update operation has completed */
-typedef void (*multi_adv_update_callback)(int client_if, int status);
-
-/** Callback invoked when multi-adv instance data set operation has completed */
-typedef void (*multi_adv_data_callback)(int client_if, int status);
-
-/** Callback invoked when multi-adv disable operation has completed */
-typedef void (*multi_adv_disable_callback)(int client_if, int status);
/**
* Callback notifying an application that a remote device connection is currently congested
@@ -202,25 +156,6 @@
* a further callback is received indicating the congestion status has been cleared.
*/
typedef void (*congestion_callback)(int conn_id, bool congested);
-/** Callback invoked when batchscan storage config operation has completed */
-typedef void (*batchscan_cfg_storage_callback)(int client_if, int status);
-
-/** Callback invoked when batchscan enable / disable operation has completed */
-typedef void (*batchscan_enable_disable_callback)(int action, int client_if, int status);
-
-/** Callback invoked when batchscan reports are obtained */
-typedef void (*batchscan_reports_callback)(int client_if, int status, int report_format,
- int num_records, int data_len, uint8_t* rep_data);
-
-/** Callback invoked when batchscan storage threshold limit is crossed */
-typedef void (*batchscan_threshold_callback)(int client_if);
-
-/** Track ADV VSE callback invoked when tracked device is found or lost */
-typedef void (*track_adv_event_callback)(btgatt_track_adv_info_t *p_track_adv_info);
-
-/** Callback invoked when scan parameter setup has completed */
-typedef void (*scan_parameter_setup_completed_callback)(int client_if,
- btgattc_error_t status);
/** GATT get database callback */
typedef void (*get_gatt_db_callback)(int conn_id, btgatt_db_element_t *db, int count);
@@ -231,9 +166,17 @@
/** GATT services were added */
typedef void (*services_added_callback)(int conn_id, btgatt_db_element_t *added, int added_count);
+/** Callback invoked when the PHY for a given connection changes */
+typedef void (*phy_updated_callback)(int conn_id, uint8_t tx_phy,
+ uint8_t rx_phy, uint8_t status);
+
+/** Callback invoked when the connection parameters for a given connection changes */
+typedef void (*conn_updated_callback)(int conn_id, uint16_t interval,
+ uint16_t latency, uint16_t timeout,
+ uint8_t status);
+
typedef struct {
register_client_callback register_client_cb;
- scan_result_callback scan_result_cb;
connect_callback open_cb;
disconnect_callback close_cb;
search_complete_callback search_complete_cb;
@@ -245,25 +188,13 @@
write_descriptor_callback write_descriptor_cb;
execute_write_callback execute_write_cb;
read_remote_rssi_callback read_remote_rssi_cb;
- listen_callback listen_cb;
configure_mtu_callback configure_mtu_cb;
- scan_filter_cfg_callback scan_filter_cfg_cb;
- scan_filter_param_callback scan_filter_param_cb;
- scan_filter_status_callback scan_filter_status_cb;
- multi_adv_enable_callback multi_adv_enable_cb;
- multi_adv_update_callback multi_adv_update_cb;
- multi_adv_data_callback multi_adv_data_cb;
- multi_adv_disable_callback multi_adv_disable_cb;
congestion_callback congestion_cb;
- batchscan_cfg_storage_callback batchscan_cfg_storage_cb;
- batchscan_enable_disable_callback batchscan_enb_disable_cb;
- batchscan_reports_callback batchscan_reports_cb;
- batchscan_threshold_callback batchscan_threshold_cb;
- track_adv_event_callback track_adv_event_cb;
- scan_parameter_setup_completed_callback scan_parameter_setup_completed_cb;
get_gatt_db_callback get_gatt_db_cb;
services_removed_callback services_removed_cb;
services_added_callback services_added_cb;
+ phy_updated_callback phy_updated_cb;
+ conn_updated_callback conn_updated_cb;
} btgatt_client_callbacks_t;
/** Represents the standard BT-GATT client interface. */
@@ -275,20 +206,14 @@
/** Unregister a client application from the stack */
bt_status_t (*unregister_client)(int client_if );
- /** Start or stop LE device scanning */
- bt_status_t (*scan)( bool start );
-
/** Create a connection to a remote LE or dual-mode device */
- bt_status_t (*connect)( int client_if, const bt_bdaddr_t *bd_addr,
- bool is_direct, int transport );
+ bt_status_t (*connect)(int client_if, const bt_bdaddr_t *bd_addr,
+ bool is_direct, int transport, int initiating_phys);
/** Disconnect a remote device or cancel a pending connection */
bt_status_t (*disconnect)( int client_if, const bt_bdaddr_t *bd_addr,
int conn_id);
- /** Start or stop advertisements to listen for incoming connections */
- bt_status_t (*listen)(int client_if, bool start);
-
/** Clear the attribute cache for a given device */
bt_status_t (*refresh)( int client_if, const bt_bdaddr_t *bd_addr );
@@ -299,21 +224,25 @@
bt_status_t (*search_service)(int conn_id, bt_uuid_t *filter_uuid );
/** Read a characteristic on a remote device */
- bt_status_t (*read_characteristic)( int conn_id, uint16_t handle,
- int auth_req );
+ bt_status_t (*read_characteristic)(int conn_id, uint16_t handle,
+ int auth_req);
+
+ /** Read a characteristic on a remote device */
+ bt_status_t (*read_using_characteristic_uuid)(
+ int conn_id, bt_uuid_t *uuid, uint16_t s_handle,
+ uint16_t e_handle, int auth_req);
/** Write a remote characteristic */
bt_status_t (*write_characteristic)(int conn_id, uint16_t handle,
- int write_type, int len, int auth_req,
- char* p_value);
+ int write_type, int auth_req,
+ std::vector<uint8_t> value);
/** Read the descriptor for a given characteristic */
bt_status_t (*read_descriptor)(int conn_id, uint16_t handle, int auth_req);
/** Write a remote descriptor for a given characteristic */
bt_status_t (*write_descriptor)( int conn_id, uint16_t handle,
- int write_type, int len,
- int auth_req, char* p_value);
+ int auth_req, std::vector<uint8_t> value);
/** Execute a prepared write operation */
bt_status_t (*execute_write)(int conn_id, int execute);
@@ -332,34 +261,9 @@
/** Request RSSI for a given remote device */
bt_status_t (*read_remote_rssi)( int client_if, const bt_bdaddr_t *bd_addr);
- /** Setup scan filter params */
- bt_status_t (*scan_filter_param_setup)(btgatt_filt_param_setup_t filt_param);
-
-
- /** Configure a scan filter condition */
- bt_status_t (*scan_filter_add_remove)(int client_if, int action, int filt_type,
- int filt_index, int company_id,
- int company_id_mask, const bt_uuid_t *p_uuid,
- const bt_uuid_t *p_uuid_mask, const bt_bdaddr_t *bd_addr,
- char addr_type, int data_len, char* p_data, int mask_len,
- char* p_mask);
-
- /** Clear all scan filter conditions for specific filter index*/
- bt_status_t (*scan_filter_clear)(int client_if, int filt_index);
-
- /** Enable / disable scan filter feature*/
- bt_status_t (*scan_filter_enable)(int client_if, bool enable);
-
/** Determine the type of the remote device (LE, BR/EDR, Dual-mode) */
int (*get_device_type)( const bt_bdaddr_t *bd_addr );
- /** Set the advertising data or scan response data */
- bt_status_t (*set_adv_data)(int client_if, bool set_scan_rsp, bool include_name,
- bool include_txpower, int min_interval, int max_interval, int appearance,
- uint16_t manufacturer_len, char* manufacturer_data,
- uint16_t service_data_len, char* service_data,
- uint16_t service_uuid_len, char* service_uuid);
-
/** Configure the MTU for a given connection */
bt_status_t (*configure_mtu)(int conn_id, int mtu);
@@ -367,39 +271,13 @@
bt_status_t (*conn_parameter_update)(const bt_bdaddr_t *bd_addr, int min_interval,
int max_interval, int latency, int timeout);
- /** Sets the LE scan interval and window in units of N*0.625 msec */
- bt_status_t (*set_scan_parameters)(int client_if, int scan_interval, int scan_window);
+ bt_status_t (*set_preferred_phy)(int conn_id, uint8_t tx_phy,
+ uint8_t rx_phy, uint16_t phy_options);
- /* Setup the parameters as per spec, user manual specified values and enable multi ADV */
- bt_status_t (*multi_adv_enable)(int client_if, int min_interval,int max_interval,int adv_type,
- int chnl_map, int tx_power, int timeout_s);
-
- /* Update the parameters as per spec, user manual specified values and restart multi ADV */
- bt_status_t (*multi_adv_update)(int client_if, int min_interval,int max_interval,int adv_type,
- int chnl_map, int tx_power, int timeout_s);
-
- /* Setup the data for the specified instance */
- bt_status_t (*multi_adv_set_inst_data)(int client_if, bool set_scan_rsp, bool include_name,
- bool incl_txpower, int appearance, int manufacturer_len,
- char* manufacturer_data, int service_data_len,
- char* service_data, int service_uuid_len, char* service_uuid);
-
- /* Disable the multi adv instance */
- bt_status_t (*multi_adv_disable)(int client_if);
-
- /* Configure the batchscan storage */
- bt_status_t (*batchscan_cfg_storage)(int client_if, int batch_scan_full_max,
- int batch_scan_trunc_max, int batch_scan_notify_threshold);
-
- /* Enable batchscan */
- bt_status_t (*batchscan_enb_batch_scan)(int client_if, int scan_mode,
- int scan_interval, int scan_window, int addr_type, int discard_rule);
-
- /* Disable batchscan */
- bt_status_t (*batchscan_dis_batch_scan)(int client_if);
-
- /* Read out batchscan reports */
- bt_status_t (*batchscan_read_reports)(int client_if, int scan_mode);
+ bt_status_t (*read_phy)(
+ int conn_id,
+ base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)>
+ cb);
/** Test mode interface */
bt_status_t (*test_command)( int command, btgatt_test_params_t* params);
diff --git a/include/hardware/bt_gatt_server.h b/include/hardware/bt_gatt_server.h
index 0d6cc1e..36259a1 100644
--- a/include/hardware/bt_gatt_server.h
+++ b/include/hardware/bt_gatt_server.h
@@ -19,6 +19,7 @@
#define ANDROID_INCLUDE_BT_GATT_SERVER_H
#include <stdint.h>
+#include <vector>
#include "bt_gatt_types.h"
@@ -53,23 +54,7 @@
/** Callback invoked in response to create_service */
typedef void (*service_added_callback)(int status, int server_if,
- btgatt_srvc_id_t *srvc_id, int srvc_handle);
-
-/** Callback indicating that an included service has been added to a service */
-typedef void (*included_service_added_callback)(int status, int server_if,
- int srvc_handle, int incl_srvc_handle);
-
-/** Callback invoked when a characteristic has been added to a service */
-typedef void (*characteristic_added_callback)(int status, int server_if,
- bt_uuid_t *uuid, int srvc_handle, int char_handle);
-
-/** Callback invoked when a descriptor has been added to a characteristic */
-typedef void (*descriptor_added_callback)(int status, int server_if,
- bt_uuid_t *uuid, int srvc_handle, int descr_handle);
-
-/** Callback invoked in response to start_service */
-typedef void (*service_started_callback)(int status, int server_if,
- int srvc_handle);
+ std::vector<btgatt_db_element_t> service);
/** Callback invoked in response to stop_service */
typedef void (*service_stopped_callback)(int status, int server_if,
@@ -91,8 +76,8 @@
* characteristic or descriptor.
*/
typedef void (*request_write_callback)(int conn_id, int trans_id, bt_bdaddr_t *bda,
- int attr_handle, int offset, int length,
- bool need_rsp, bool is_prep, uint8_t* value);
+ int attr_handle, int offset, bool need_rsp,
+ bool is_prep, std::vector<uint8_t> value);
/** Callback invoked when a previously prepared write is to be executed */
typedef void (*request_exec_write_callback)(int conn_id, int trans_id,
@@ -120,23 +105,31 @@
/** Callback invoked when the MTU for a given connection changes */
typedef void (*mtu_changed_callback)(int conn_id, int mtu);
+/** Callback invoked when the PHY for a given connection changes */
+typedef void (*phy_updated_callback)(int conn_id, uint8_t tx_phy,
+ uint8_t rx_phy, uint8_t status);
+
+/** Callback invoked when the connection parameters for a given connection changes */
+typedef void (*conn_updated_callback)(int conn_id, uint16_t interval,
+ uint16_t latency, uint16_t timeout,
+ uint8_t status);
typedef struct {
register_server_callback register_server_cb;
connection_callback connection_cb;
service_added_callback service_added_cb;
- included_service_added_callback included_service_added_cb;
- characteristic_added_callback characteristic_added_cb;
- descriptor_added_callback descriptor_added_cb;
- service_started_callback service_started_cb;
service_stopped_callback service_stopped_cb;
service_deleted_callback service_deleted_cb;
- request_read_callback request_read_cb;
- request_write_callback request_write_cb;
+ request_read_callback request_read_characteristic_cb;
+ request_read_callback request_read_descriptor_cb;
+ request_write_callback request_write_characteristic_cb;
+ request_write_callback request_write_descriptor_cb;
request_exec_write_callback request_exec_write_cb;
response_confirmation_callback response_confirmation_cb;
indication_sent_callback indication_sent_cb;
congestion_callback congestion_cb;
mtu_changed_callback mtu_changed_cb;
+ phy_updated_callback phy_updated_cb;
+ conn_updated_callback conn_updated_cb;
} btgatt_server_callbacks_t;
/** Represents the standard BT-GATT server interface. */
@@ -156,23 +149,7 @@
int conn_id );
/** Create a new service */
- bt_status_t (*add_service)( int server_if, btgatt_srvc_id_t *srvc_id, int num_handles);
-
- /** Assign an included service to it's parent service */
- bt_status_t (*add_included_service)( int server_if, int service_handle, int included_handle);
-
- /** Add a characteristic to a service */
- bt_status_t (*add_characteristic)( int server_if,
- int service_handle, bt_uuid_t *uuid,
- int properties, int permissions);
-
- /** Add a descriptor to a given service */
- bt_status_t (*add_descriptor)(int server_if, int service_handle,
- bt_uuid_t *uuid, int permissions);
-
- /** Starts a local service */
- bt_status_t (*start_service)(int server_if, int service_handle,
- int transport);
+ bt_status_t (*add_service)(int server_if, std::vector<btgatt_db_element_t> service);
/** Stops a local service */
bt_status_t (*stop_service)(int server_if, int service_handle);
@@ -182,13 +159,21 @@
/** Send value indication to a remote device */
bt_status_t (*send_indication)(int server_if, int attribute_handle,
- int conn_id, int len, int confirm,
- char* p_value);
+ int conn_id, int confirm,
+ std::vector<uint8_t> value);
/** Send a response to a read/write operation */
bt_status_t (*send_response)(int conn_id, int trans_id,
int status, btgatt_response_t *response);
+ bt_status_t (*set_preferred_phy)(int conn_id, uint8_t tx_phy,
+ uint8_t rx_phy, uint16_t phy_options);
+
+ bt_status_t (*read_phy)(
+ int conn_id,
+ base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)>
+ cb);
+
} btgatt_server_interface_t;
__END_DECLS
diff --git a/include/hardware/bt_hd.h b/include/hardware/bt_hd.h
new file mode 100644
index 0000000..263f29f
--- /dev/null
+++ b/include/hardware/bt_hd.h
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2016 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)(bt_bdaddr_t *bd_addr);
+
+ /** 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 0a77675..892fbdb 100644
--- a/include/hardware/bt_hf.h
+++ b/include/hardware/bt_hf.h
@@ -252,7 +252,7 @@
/**
* Register the BtHf callbacks
*/
- bt_status_t (*init)( bthf_callbacks_t* callbacks, int max_hf_clients);
+ bt_status_t (*init)( bthf_callbacks_t* callbacks, int max_hf_clients, bool inband_ringing_supported);
/** connect to headset */
bt_status_t (*connect)( bt_bdaddr_t *bd_addr );
@@ -295,7 +295,7 @@
*/
bt_status_t (*at_response) (bthf_at_response_t response_code, int error_code, bt_bdaddr_t *bd_addr );
- /** response for CLCC command
+ /** response for CLCC command
* Can be iteratively called for each call index
* Call index of 0 will be treated as NULL termination (Completes response)
*/
@@ -305,7 +305,7 @@
bthf_call_addrtype_t type, bt_bdaddr_t *bd_addr );
/** notify of a call state change
- * Each update notifies
+ * Each update notifies
* 1. Number of active/held/ringing calls
* 2. call_state: This denotes the state change that triggered this msg
* This will take one of the values from BtHfCallState
@@ -317,7 +317,7 @@
/** Closes the interface. */
void (*cleanup)( void );
- /** configureation for the SCO codec */
+ /** configuration for the SCO codec */
bt_status_t (*configure_wbs)( bt_bdaddr_t *bd_addr ,bthf_wbs_config_t config );
/** Response for HF Indicator change (+BIND) */
diff --git a/include/hardware/bt_hf_client.h b/include/hardware/bt_hf_client.h
index 8acf1b2..b728be3 100644
--- a/include/hardware/bt_hf_client.h
+++ b/include/hardware/bt_hf_client.h
@@ -167,104 +167,120 @@
* state will have one of the values from BtHfConnectionState
* peer/chld_features are valid only for BTHF_CLIENT_CONNECTION_STATE_SLC_CONNECTED state
*/
-typedef void (* bthf_client_connection_state_callback)(bthf_client_connection_state_t state,
+typedef void (* bthf_client_connection_state_callback)(const bt_bdaddr_t *bd_addr,
+ bthf_client_connection_state_t state,
unsigned int peer_feat,
- unsigned int chld_feat,
- bt_bdaddr_t *bd_addr);
+ unsigned int chld_feat);
/** Callback for audio connection state change.
* state will have one of the values from BtHfAudioState
*/
-typedef void (* bthf_client_audio_state_callback)(bthf_client_audio_state_t state,
- bt_bdaddr_t *bd_addr);
+typedef void (* bthf_client_audio_state_callback)(const bt_bdaddr_t *bd_addr,
+ bthf_client_audio_state_t state);
/** Callback for VR connection state change.
* state will have one of the values from BtHfVRState
*/
-typedef void (* bthf_client_vr_cmd_callback)(bthf_client_vr_state_t state);
+typedef void (* bthf_client_vr_cmd_callback)(const bt_bdaddr_t *bd_addr, bthf_client_vr_state_t state);
/** Callback for network state change
*/
-typedef void (* bthf_client_network_state_callback) (bthf_client_network_state_t state);
+typedef void (* bthf_client_network_state_callback) (const bt_bdaddr_t *bd_addr,
+ bthf_client_network_state_t state);
/** Callback for network roaming status change
*/
-typedef void (* bthf_client_network_roaming_callback) (bthf_client_service_type_t type);
+typedef void (* bthf_client_network_roaming_callback) (const bt_bdaddr_t *bd_addr,
+ bthf_client_service_type_t type);
/** Callback for signal strength indication
*/
-typedef void (* bthf_client_network_signal_callback) (int signal_strength);
+typedef void (* bthf_client_network_signal_callback) (const bt_bdaddr_t *bd_addr,
+ int signal_strength);
/** Callback for battery level indication
*/
-typedef void (* bthf_client_battery_level_callback) (int battery_level);
+typedef void (* bthf_client_battery_level_callback) (const bt_bdaddr_t *bd_addr,
+ int battery_level);
/** Callback for current operator name
*/
-typedef void (* bthf_client_current_operator_callback) (const char *name);
+typedef void (* bthf_client_current_operator_callback) (const bt_bdaddr_t *bd_addr,
+ const char *name);
/** Callback for call indicator
*/
-typedef void (* bthf_client_call_callback) (bthf_client_call_t call);
+typedef void (* bthf_client_call_callback) (const bt_bdaddr_t *bd_addr, bthf_client_call_t call);
/** Callback for callsetup indicator
*/
-typedef void (* bthf_client_callsetup_callback) (bthf_client_callsetup_t callsetup);
+typedef void (* bthf_client_callsetup_callback) (const bt_bdaddr_t *bd_addr,
+ bthf_client_callsetup_t callsetup);
/** Callback for callheld indicator
*/
-typedef void (* bthf_client_callheld_callback) (bthf_client_callheld_t callheld);
+typedef void (* bthf_client_callheld_callback) (const bt_bdaddr_t *bd_addr,
+ bthf_client_callheld_t callheld);
/** Callback for response and hold
*/
-typedef void (* bthf_client_resp_and_hold_callback) (bthf_client_resp_and_hold_t resp_and_hold);
+typedef void (* bthf_client_resp_and_hold_callback) (const bt_bdaddr_t *bd_addr,
+ bthf_client_resp_and_hold_t resp_and_hold);
/** Callback for Calling Line Identification notification
* Will be called only when there is an incoming call and number is provided.
*/
-typedef void (* bthf_client_clip_callback) (const char *number);
+typedef void (* bthf_client_clip_callback) (const bt_bdaddr_t *bd_addr, const char *number);
/**
* Callback for Call Waiting notification
*/
-typedef void (* bthf_client_call_waiting_callback) (const char *number);
+typedef void (* bthf_client_call_waiting_callback) (const bt_bdaddr_t *bd_addr, const char *number);
/**
* Callback for listing current calls. Can be called multiple time.
* If number is unknown NULL is passed.
*/
-typedef void (*bthf_client_current_calls) (int index, bthf_client_call_direction_t dir,
+typedef void (*bthf_client_current_calls) (const bt_bdaddr_t *bd_addr, int index,
+ bthf_client_call_direction_t dir,
bthf_client_call_state_t state,
bthf_client_call_mpty_type_t mpty,
const char *number);
/** Callback for audio volume change
*/
-typedef void (*bthf_client_volume_change_callback) (bthf_client_volume_type_t type, int volume);
+typedef void (*bthf_client_volume_change_callback) (const bt_bdaddr_t *bd_addr,
+ bthf_client_volume_type_t type,
+ int volume);
/** Callback for command complete event
* cme is valid only for BTHF_CLIENT_CMD_COMPLETE_ERROR_CME type
*/
-typedef void (*bthf_client_cmd_complete_callback) (bthf_client_cmd_complete_t type, int cme);
+typedef void (*bthf_client_cmd_complete_callback) (const bt_bdaddr_t *bd_addr,
+ bthf_client_cmd_complete_t type,
+ int cme);
/** Callback for subscriber information
*/
-typedef void (* bthf_client_subscriber_info_callback) (const char *name,
+typedef void (* bthf_client_subscriber_info_callback) (const bt_bdaddr_t *bd_addr,
+ const char *name,
bthf_client_subscriber_service_type_t type);
/** Callback for in-band ring tone settings
*/
-typedef void (* bthf_client_in_band_ring_tone_callback) (bthf_client_in_band_ring_state_t state);
+typedef void (* bthf_client_in_band_ring_tone_callback) (const bt_bdaddr_t *bd_addr,
+ bthf_client_in_band_ring_state_t state);
/**
* Callback for requested number from AG
*/
-typedef void (* bthf_client_last_voice_tag_number_callback) (const char *number);
+typedef void (* bthf_client_last_voice_tag_number_callback) (const bt_bdaddr_t *bd_addr,
+ const char *number);
/**
* Callback for sending ring indication to app
*/
-typedef void (* bthf_client_ring_indication_callback) (void);
+typedef void (* bthf_client_ring_indication_callback) (const bt_bdaddr_t *bd_addr);
/** BT-HF callback structure. */
typedef struct {
@@ -307,55 +323,59 @@
bt_status_t (*connect)(bt_bdaddr_t *bd_addr);
/** disconnect from audio gateway */
- bt_status_t (*disconnect)(bt_bdaddr_t *bd_addr);
+ bt_status_t (*disconnect)(const bt_bdaddr_t *bd_addr);
/** create an audio connection */
- bt_status_t (*connect_audio)(bt_bdaddr_t *bd_addr);
+ bt_status_t (*connect_audio)(const bt_bdaddr_t *bd_addr);
/** close the audio connection */
- bt_status_t (*disconnect_audio)(bt_bdaddr_t *bd_addr);
+ bt_status_t (*disconnect_audio)(const bt_bdaddr_t *bd_addr);
/** start voice recognition */
- bt_status_t (*start_voice_recognition)(void);
+ bt_status_t (*start_voice_recognition)(const bt_bdaddr_t *bd_addr);
/** stop voice recognition */
- bt_status_t (*stop_voice_recognition)(void);
+ bt_status_t (*stop_voice_recognition)(const bt_bdaddr_t *bd_addr);
/** volume control */
- bt_status_t (*volume_control) (bthf_client_volume_type_t type, int volume);
+ bt_status_t (*volume_control) (const bt_bdaddr_t *bd_addr,
+ bthf_client_volume_type_t type,
+ int volume);
/** place a call with number a number
* if number is NULL last called number is called (aka re-dial)*/
- bt_status_t (*dial) (const char *number);
+ bt_status_t (*dial) (const bt_bdaddr_t *bd_addr, const char *number);
/** place a call with number specified by location (speed dial) */
- bt_status_t (*dial_memory) (int location);
+ bt_status_t (*dial_memory) (const bt_bdaddr_t *bd_addr, int location);
/** perform specified call related action
* idx is limited only for enhanced call control related action
*/
- bt_status_t (*handle_call_action) (bthf_client_call_action_t action, int idx);
+ bt_status_t (*handle_call_action) (const bt_bdaddr_t *bd_addr,
+ bthf_client_call_action_t action,
+ int idx);
/** query list of current calls */
- bt_status_t (*query_current_calls) (void);
+ bt_status_t (*query_current_calls) (const bt_bdaddr_t *bd_addr);
/** query name of current selected operator */
- bt_status_t (*query_current_operator_name) (void);
+ bt_status_t (*query_current_operator_name) (const bt_bdaddr_t *bd_addr);
/** Retrieve subscriber information */
- bt_status_t (*retrieve_subscriber_info) (void);
+ bt_status_t (*retrieve_subscriber_info) (const bt_bdaddr_t *bd_addr);
/** Send DTMF code*/
- bt_status_t (*send_dtmf) (char code);
+ bt_status_t (*send_dtmf) (const bt_bdaddr_t *bd_addr, char code);
/** Request a phone number from AG corresponding to last voice tag recorded */
- bt_status_t (*request_last_voice_tag_number) (void);
+ bt_status_t (*request_last_voice_tag_number) (const bt_bdaddr_t *bd_addr);
/** Closes the interface. */
void (*cleanup)(void);
/** Send AT Command. */
- bt_status_t (*send_at_cmd) (int cmd, int val1, int val2, const char *arg);
+ bt_status_t (*send_at_cmd) (const bt_bdaddr_t *bd_addr, int cmd, int val1, int val2, const char *arg);
} bthf_client_interface_t;
__END_DECLS
diff --git a/include/hardware/bt_rc.h b/include/hardware/bt_rc.h
index 1e2c293..ee99d91 100644
--- a/include/hardware/bt_rc.h
+++ b/include/hardware/bt_rc.h
@@ -19,17 +19,69 @@
__BEGIN_DECLS
+/* Change this macro to use multiple RC */
+#define BT_RC_NUM_APP 1
+
/* Macros */
-#define BTRC_MAX_ATTR_STR_LEN 255
+#define BTRC_MAX_ATTR_STR_LEN (1 << 16)
#define BTRC_UID_SIZE 8
#define BTRC_MAX_APP_SETTINGS 8
#define BTRC_MAX_FOLDER_DEPTH 4
#define BTRC_MAX_APP_ATTR_SIZE 16
-#define BTRC_MAX_ELEM_ATTR_SIZE 7
+#define BTRC_MAX_ELEM_ATTR_SIZE 8
+#define BTRC_FEATURE_BIT_MASK_SIZE 16
+
+/* Macros for valid scopes in get_folder_items */
+#define BTRC_SCOPE_PLAYER_LIST 0x00 /* Media Player List */
+#define BTRC_SCOPE_FILE_SYSTEM 0x01 /* Virtual File System */
+#define BTRC_SCOPE_SEARCH 0x02 /* Search */
+#define BTRC_SCOPE_NOW_PLAYING 0x03 /* Now Playing */
+
+/* Macros for supported character encoding */
+#define BTRC_CHARSET_ID_UTF8 0x006A
+
+/* Macros for item types */
+#define BTRC_ITEM_PLAYER 0x01 /* Media Player */
+#define BTRC_ITEM_FOLDER 0x02 /* Folder */
+#define BTRC_ITEM_MEDIA 0x03 /* Media File */
+
+/* Macros for media attribute IDs */
+#define BTRC_MEDIA_ATTR_ID_INVALID -1
+#define BTRC_MEDIA_ATTR_ID_TITLE 0x00000001
+#define BTRC_MEDIA_ATTR_ID_ARTIST 0x00000002
+#define BTRC_MEDIA_ATTR_ID_ALBUM 0x00000003
+#define BTRC_MEDIA_ATTR_ID_TRACK_NUM 0x00000004
+#define BTRC_MEDIA_ATTR_ID_NUM_TRACKS 0x00000005
+#define BTRC_MEDIA_ATTR_ID_GENRE 0x00000006
+#define BTRC_MEDIA_ATTR_ID_PLAYING_TIME 0x00000007 /* in miliseconds */
+
+/* Macros for folder types */
+#define BTRC_FOLDER_TYPE_MIXED 0x00
+#define BTRC_FOLDER_TYPE_TITLES 0x01
+#define BTRC_FOLDER_TYPE_ALBUMS 0x02
+#define BTRC_FOLDER_TYPE_ARTISTS 0x03
+#define BTRC_FOLDER_TYPE_GENRES 0x04
+#define BTRC_FOLDER_TYPE_PLAYLISTS 0x05
+#define BTRC_FOLDER_TYPE_YEARS 0x06
+
+/* Macros for media types */
+#define BTRC_MEDIA_TYPE_AUDIO 0x00 /* audio */
+#define BTRC_MEDIA_TYPE_VIDEO 0x01 /* video */
+
+/* Macros for num attributes */
+#define BTRC_NUM_ATTR_NONE 0xFF /* No attributes required */
+#define BTRC_NUM_ATTR_ALL 0X00 /* All attributes required */
+
+#define BTRC_HANDLE_NONE 0xFF
typedef uint8_t btrc_uid_t[BTRC_UID_SIZE];
typedef enum {
+ BTRC_CONNECTION_STATE_DISCONNECTED = 0,
+ BTRC_CONNECTION_STATE_CONNECTED
+} btrc_connection_state_t;
+
+typedef enum {
BTRC_FEAT_NONE = 0x00, /* AVRCP 1.0 */
BTRC_FEAT_METADATA = 0x01, /* AVRCP 1.3 */
BTRC_FEAT_ABSOLUTE_VOLUME = 0x02, /* Supports TG role and volume sync */
@@ -52,6 +104,11 @@
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_AVAL_PLAYER_CHANGE = 0x0a,
+ BTRC_EVT_ADDR_PLAYER_CHANGE = 0x0b,
+ BTRC_EVT_UIDS_CHANGED = 0x0c,
+ BTRC_EVT_VOL_CHANGED = 0x0d,
} btrc_event_id_t;
typedef enum {
@@ -94,10 +151,33 @@
BTRC_STS_BAD_PARAM = 0x01, /* Invalid parameter */
BTRC_STS_NOT_FOUND = 0x02, /* Specified parameter is wrong or not found */
BTRC_STS_INTERNAL_ERR = 0x03, /* Internal Error */
- BTRC_STS_NO_ERROR = 0x04 /* Operation Success */
+ BTRC_STS_NO_ERROR = 0x04, /* Operation Success */
+ BTRC_STS_UID_CHANGED = 0x05, /* UIDs changed */
+ BTRC_STS_RESERVED = 0x06, /* Reserved */
+ BTRC_STS_INV_DIRN = 0x07, /* Invalid direction */
+ BTRC_STS_INV_DIRECTORY = 0x08, /* Invalid directory */
+ BTRC_STS_INV_ITEM = 0x09, /* Invalid Item */
+ BTRC_STS_INV_SCOPE = 0x0a, /* Invalid scope */
+ BTRC_STS_INV_RANGE = 0x0b, /* Invalid range */
+ BTRC_STS_DIRECTORY = 0x0c, /* UID is a directory */
+ BTRC_STS_MEDIA_IN_USE = 0x0d, /* Media in use */
+ BTRC_STS_PLAY_LIST_FULL = 0x0e, /* Playing list full */
+ BTRC_STS_SRCH_NOT_SPRTD = 0x0f, /* Search not supported */
+ BTRC_STS_SRCH_IN_PROG = 0x10, /* Search in progress */
+ BTRC_STS_INV_PLAYER = 0x11, /* Invalid player */
+ BTRC_STS_PLAY_NOT_BROW = 0x12, /* Player not browsable */
+ BTRC_STS_PLAY_NOT_ADDR = 0x13, /* Player not addressed */
+ BTRC_STS_INV_RESULTS = 0x14, /* Invalid results */
+ BTRC_STS_NO_AVBL_PLAY = 0x15, /* No available players */
+ BTRC_STS_ADDR_PLAY_CHGD = 0x16, /* Addressed player changed */
} btrc_status_t;
typedef struct {
+ uint16_t player_id;
+ uint16_t uid_counter;
+} btrc_addr_player_changed_t;
+
+typedef struct {
uint8_t num_attr;
uint8_t attr_ids[BTRC_MAX_APP_SETTINGS];
uint8_t attr_values[BTRC_MAX_APP_SETTINGS];
@@ -133,12 +213,25 @@
uint8_t attr_count;
} btrc_getfolderitem_t;
+typedef struct {
+ uint16_t type;
+ uint16_t uid_counter;
+} btrc_uids_changed_t;
+
+typedef struct {
+ uint16_t type;
+} btrc_now_playing_changed_t;
+
typedef union
{
btrc_play_status_t play_status;
btrc_uid_t track; /* queue position in NowPlaying */
uint32_t song_pos;
+ uint16_t uid_counter;
btrc_player_settings_t player_setting;
+ btrc_addr_player_changed_t addr_player_changed;
+ btrc_uids_changed_t uids_changed;
+ btrc_now_playing_changed_t now_playing_changed;
} btrc_register_notification_t;
typedef struct {
@@ -151,55 +244,141 @@
uint8_t text[BTRC_MAX_ATTR_STR_LEN];
} btrc_element_attr_val_t;
+typedef struct {
+ uint16_t player_id;
+ uint8_t major_type;
+ uint32_t sub_type;
+ uint8_t play_status;
+ uint8_t features[BTRC_FEATURE_BIT_MASK_SIZE];
+ uint16_t charset_id;
+ uint8_t name[BTRC_MAX_ATTR_STR_LEN];
+} btrc_item_player_t;
+
+typedef struct {
+ uint8_t uid[BTRC_UID_SIZE];
+ uint8_t type;
+ uint8_t playable;
+ uint16_t charset_id;
+ uint8_t name[BTRC_MAX_ATTR_STR_LEN];
+} btrc_item_folder_t;
+
+typedef struct {
+ uint8_t uid[BTRC_UID_SIZE];
+ uint8_t type;
+ uint16_t charset_id;
+ uint8_t name[BTRC_MAX_ATTR_STR_LEN];
+ int num_attrs;
+ btrc_element_attr_val_t* p_attrs;
+} btrc_item_media_t;
+
+typedef struct {
+ uint8_t item_type;
+ union
+ {
+ btrc_item_player_t player;
+ btrc_item_folder_t folder;
+ btrc_item_media_t media;
+ };
+} btrc_folder_items_t;
+
+typedef struct {
+ uint16_t str_len;
+ uint8_t p_str[BTRC_MAX_ATTR_STR_LEN];
+} btrc_br_folder_name_t;
+
/** Callback for the controller's supported feautres */
typedef void (* btrc_remote_features_callback)(bt_bdaddr_t *bd_addr,
btrc_remote_features_t features);
/** 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);
+
+/** Callback for set addressed player response on TG **/
+typedef void (* btrc_set_addressed_player_callback) (uint16_t player_id, bt_bdaddr_t *bd_addr);
+
+/** Callback for set browsed player response on TG **/
+typedef void (* btrc_set_browsed_player_callback) (uint16_t player_id, bt_bdaddr_t *bd_addr);
+
+/** Callback for get folder items on TG
+** num_attr: specifies the number of attributes requested in p_attr_ids
+*/
+typedef void (* btrc_get_folder_items_callback) (uint8_t scope, uint32_t start_item,
+ uint32_t end_item, uint8_t num_attr, uint32_t *p_attr_ids, bt_bdaddr_t *bd_addr);
+
+/** Callback for changing browsed path on TG **/
+typedef void (* btrc_change_path_callback) (uint8_t direction,
+ uint8_t* folder_uid, bt_bdaddr_t *bd_addr);
+
+/** Callback to fetch the get item attributes of the media item
+** num_attr: specifies the number of attributes requested in p_attrs
+*/
+typedef void (* btrc_get_item_attr_callback) (uint8_t scope, uint8_t* uid, uint16_t uid_counter,
+ uint8_t num_attr, btrc_media_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
+
+/** Callback for play request for the media item indicated by an identifier */
+typedef void (* btrc_play_item_callback) (uint8_t scope,
+ uint16_t uid_counter, uint8_t* uid, bt_bdaddr_t *bd_addr);
+
+/** Callback to fetch total number of items from a folder **/
+typedef void (* btrc_get_total_num_of_items_callback) (uint8_t scope, bt_bdaddr_t *bd_addr);
+
+/** Callback for conducting recursive search on a current browsed path for a specified string */
+typedef void (* btrc_search_callback) (uint16_t charset_id,
+ uint16_t str_len, uint8_t* p_str, bt_bdaddr_t *bd_addr);
+
+/** Callback to add a specified media item indicated by an identifier to now playing queue. */
+typedef void (* btrc_add_to_now_playing_callback) (uint8_t scope,
+ uint8_t* uid, uint16_t uid_counter, bt_bdaddr_t *bd_addr);
/** BT-RC Target callback structure. */
typedef struct {
@@ -217,6 +396,15 @@
btrc_register_notification_callback register_notification_cb;
btrc_volume_change_callback volume_change_cb;
btrc_passthrough_cmd_callback passthrough_cmd_cb;
+ btrc_set_addressed_player_callback set_addressed_player_cb;
+ btrc_set_browsed_player_callback set_browsed_player_cb;
+ btrc_get_folder_items_callback get_folder_items_cb;
+ btrc_change_path_callback change_path_cb;
+ btrc_get_item_attr_callback get_item_attr_cb;
+ btrc_play_item_callback play_item_cb;
+ btrc_get_total_num_of_items_callback get_total_num_of_items_cb;
+ btrc_search_callback search_cb;
+ btrc_add_to_now_playing_callback add_to_now_playing_cb;
} btrc_callbacks_t;
/** Represents the standard BT-RC AVRCP Target interface. */
@@ -234,40 +422,45 @@
** 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)( bt_bdaddr_t *bd_addr, btrc_play_status_t play_status,
+ uint32_t song_len, uint32_t song_pos);
/** 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)( bt_bdaddr_t *bd_addr, int num_attr,
+ btrc_player_attr_t *p_attrs);
/** 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)( bt_bdaddr_t *bd_addr, int num_val, uint8_t *p_vals);
/** 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)( bt_bdaddr_t *bd_addr, btrc_player_settings_t *p_vals);
/** 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)( bt_bdaddr_t *bd_addr, int num_attr,
+ btrc_player_setting_text_t *p_attrs);
/** 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)( bt_bdaddr_t *bd_addr, int num_val,
+ btrc_player_setting_text_t *p_vals);
/** 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)( bt_bdaddr_t *bd_addr, uint8_t num_attr,
+ btrc_element_attr_val_t *p_attrs);
/** 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)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
/* Response to the register notification request (Play state change/track change/...).
** event_id: Refers to the event_id this notification change corresponds too
@@ -287,16 +480,52 @@
*/
bt_status_t (*set_volume)(uint8_t volume);
+ /* Set addressed player response from TG to CT */
+ bt_status_t (*set_addressed_player_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
+
+ /* Set browsed player response from TG to CT */
+ bt_status_t (*set_browsed_player_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
+ uint32_t num_items, uint16_t charset_id, uint8_t folder_depth,
+ btrc_br_folder_name_t *p_folders);
+
+ /* Get folder item list response from TG to CT */
+ bt_status_t (*get_folder_items_list_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
+ uint16_t uid_counter, uint8_t num_items, btrc_folder_items_t *p_items);
+
+ /* Change path response from TG to CT */
+ bt_status_t (*change_path_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
+ uint32_t num_items);
+
+ /** Returns the element's attributes num_attr: Specifies the number of attributes' text
+ * contained in the pointer p_attrs
+ */
+ bt_status_t (*get_item_attr_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
+ uint8_t num_attr, btrc_element_attr_val_t *p_attrs);
+
+ /* play media item response from TG to CT */
+ bt_status_t (*play_item_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
+
+ /* get total number of items response from TG to CT*/
+ bt_status_t (*get_total_num_of_items_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
+ uint32_t uid_counter, uint32_t num_items);
+
+ /* Search VFS response from TG to CT */
+ bt_status_t (*search_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status, uint32_t uid_counter,
+ uint32_t num_items);
+
+ /* add_to_now playing list response from TG to CT */
+ bt_status_t (*add_to_now_playing_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
+
/** Closes the interface. */
void (*cleanup)( void );
} btrc_interface_t;
-
-typedef void (* btrc_passthrough_rsp_callback) (int id, int key_state);
+typedef void (* btrc_passthrough_rsp_callback) (bt_bdaddr_t *bd_addr, int id, int key_state);
typedef void (* btrc_groupnavigation_rsp_callback) (int id, int key_state);
-typedef void (* btrc_connection_state_callback) (bool state, bt_bdaddr_t *bd_addr);
+typedef void (* btrc_connection_state_callback) (
+ bool rc_connect, bool bt_connect, bt_bdaddr_t *bd_addr);
typedef void (* btrc_ctrl_getrcfeatures_callback) (bt_bdaddr_t *bd_addr, int features);
@@ -325,6 +554,16 @@
typedef void (* btrc_ctrl_play_status_changed_callback)(bt_bdaddr_t *bd_addr,
btrc_play_status_t play_status);
+typedef void (* btrc_ctrl_get_folder_items_callback )(bt_bdaddr_t *bd_addr,
+ btrc_status_t status,
+ const btrc_folder_items_t *folder_items,
+ uint8_t count);
+
+typedef void (* btrc_ctrl_change_path_callback)(bt_bdaddr_t *bd_addr, uint8_t count);
+
+typedef void (* btrc_ctrl_set_browsed_player_callback )(
+ bt_bdaddr_t *bd_addr, uint8_t num_items, uint8_t depth);
+typedef void (* btrc_ctrl_set_addressed_player_callback)(bt_bdaddr_t *bd_addr, uint8_t status);
/** BT-RC Controller callback structure. */
typedef struct {
/** set to sizeof(BtRcCallbacks) */
@@ -341,6 +580,10 @@
btrc_ctrl_track_changed_callback track_changed_cb;
btrc_ctrl_play_position_changed_callback play_position_changed_cb;
btrc_ctrl_play_status_changed_callback play_status_changed_cb;
+ btrc_ctrl_get_folder_items_callback get_folder_items_cb;
+ btrc_ctrl_change_path_callback change_folder_path_cb;
+ btrc_ctrl_set_browsed_player_callback set_browsed_player_cb;
+ btrc_ctrl_set_addressed_player_callback set_addressed_player_cb;
} btrc_ctrl_callbacks_t;
/** Represents the standard BT-RC AVRCP Controller interface. */
@@ -365,6 +608,31 @@
bt_status_t (*set_player_app_setting_cmd) (bt_bdaddr_t *bd_addr, uint8_t num_attrib,
uint8_t* attrib_ids, uint8_t* attrib_vals);
+ /** send command to play a particular item */
+ bt_status_t (*play_item_cmd) (
+ bt_bdaddr_t *bd_addr, uint8_t scope, uint8_t *uid, uint16_t uid_counter);
+
+ /** get the playback state */
+ bt_status_t (*get_playback_state_cmd) (bt_bdaddr_t *bd_addr);
+
+ /** get the now playing list */
+ bt_status_t (*get_now_playing_list_cmd) (bt_bdaddr_t *bd_addr, uint8_t start, uint8_t items);
+
+ /** get the folder list */
+ bt_status_t (*get_folder_list_cmd) (bt_bdaddr_t *bd_addr, uint8_t start, uint8_t items);
+
+ /** get the folder list */
+ bt_status_t (*get_player_list_cmd) (bt_bdaddr_t *bd_addr, uint8_t start, uint8_t items);
+
+ /** get the folder list */
+ bt_status_t (*change_folder_path_cmd) (bt_bdaddr_t *bd_addr, uint8_t direction, uint8_t * uid);
+
+ /** set browsed player */
+ bt_status_t (*set_browsed_player_cmd) (bt_bdaddr_t *bd_addr, uint16_t player_id);
+
+ /** set addressed player */
+ bt_status_t (*set_addressed_player_cmd) (bt_bdaddr_t *bd_addr, uint16_t player_id);
+
/** send rsp to set_abs_vol received from target */
bt_status_t (*set_volume_rsp) (bt_bdaddr_t *bd_addr, uint8_t abs_vol, uint8_t label);
diff --git a/include/hardware/camera2.h b/include/hardware/camera2.h
index 2b7add0..547a1d7 100644
--- a/include/hardware/camera2.h
+++ b/include/hardware/camera2.h
@@ -146,7 +146,7 @@
typedef struct camera2_jpeg_blob {
uint16_t jpeg_blob_id;
uint32_t jpeg_size;
-};
+} camera2_jpeg_blob_t;
enum {
CAMERA2_JPEG_BLOB_ID = 0x00FF
diff --git a/include/hardware/context_hub.h b/include/hardware/context_hub.h
index 828f2dd..aaa4274 100644
--- a/include/hardware/context_hub.h
+++ b/include/hardware/context_hub.h
@@ -78,17 +78,17 @@
#define NANOAPP_VENDOR_ALL_APPS 0x0000000000FFFFFFULL
#define NANOAPP_VENDOR(name) \
- (((uint64_t)name[0] << 56) | \
- ((uint64_t)name[1] << 48) | \
- ((uint64_t)name[2] << 40) | \
- ((uint64_t)name[3] << 32) | \
- ((uint64_t)name[4] << 24))
+ (((uint64_t)(name)[0] << 56) | \
+ ((uint64_t)(name)[1] << 48) | \
+ ((uint64_t)(name)[2] << 40) | \
+ ((uint64_t)(name)[3] << 32) | \
+ ((uint64_t)(name)[4] << 24))
/*
* generates the NANOAPP ID from vendor id and app seq# id
*/
#define NANO_APP_ID(vendor, seq_id) \
- (((uint64_t)vendor & NANOAPP_VENDORS_ALL) | ((uint64_t)seq_id & NANOAPP_VENDOR_ALL_APPS))
+ (((uint64_t)(vendor) & NANOAPP_VENDORS_ALL) | ((uint64_t)(seq_id) & NANOAPP_VENDOR_ALL_APPS))
struct hub_app_name_t {
uint64_t id;
diff --git a/include/hardware/fb.h b/include/hardware/fb.h
index 9df9416..65720a3 100644
--- a/include/hardware/fb.h
+++ b/include/hardware/fb.h
@@ -160,7 +160,7 @@
static inline int framebuffer_open(const struct hw_module_t* module,
struct framebuffer_device_t** device) {
return module->methods->open(module,
- GRALLOC_HARDWARE_FB0, (struct hw_device_t**)device);
+ GRALLOC_HARDWARE_FB0, TO_HW_DEVICE_T_OPEN(device));
}
static inline int framebuffer_close(struct framebuffer_device_t* device) {
diff --git a/include/hardware/fingerprint.h b/include/hardware/fingerprint.h
index 618ca7e..b4465ba 100644
--- a/include/hardware/fingerprint.h
+++ b/include/hardware/fingerprint.h
@@ -17,6 +17,7 @@
#ifndef ANDROID_INCLUDE_HARDWARE_FINGERPRINT_H
#define ANDROID_INCLUDE_HARDWARE_FINGERPRINT_H
+#include <hardware/hardware.h>
#include <hardware/hw_auth_token.h>
#define FINGERPRINT_MODULE_API_VERSION_1_0 HARDWARE_MODULE_API_VERSION(1, 0)
diff --git a/include/hardware/gralloc.h b/include/hardware/gralloc.h
index 779915c..1b06ebf 100644
--- a/include/hardware/gralloc.h
+++ b/include/hardware/gralloc.h
@@ -68,69 +68,69 @@
enum {
/* buffer is never read in software */
- GRALLOC_USAGE_SW_READ_NEVER = 0x00000000,
+ GRALLOC_USAGE_SW_READ_NEVER = 0x00000000U,
/* buffer is rarely read in software */
- GRALLOC_USAGE_SW_READ_RARELY = 0x00000002,
+ GRALLOC_USAGE_SW_READ_RARELY = 0x00000002U,
/* buffer is often read in software */
- GRALLOC_USAGE_SW_READ_OFTEN = 0x00000003,
+ GRALLOC_USAGE_SW_READ_OFTEN = 0x00000003U,
/* mask for the software read values */
- GRALLOC_USAGE_SW_READ_MASK = 0x0000000F,
+ GRALLOC_USAGE_SW_READ_MASK = 0x0000000FU,
/* buffer is never written in software */
- GRALLOC_USAGE_SW_WRITE_NEVER = 0x00000000,
+ GRALLOC_USAGE_SW_WRITE_NEVER = 0x00000000U,
/* buffer is rarely written in software */
- GRALLOC_USAGE_SW_WRITE_RARELY = 0x00000020,
+ GRALLOC_USAGE_SW_WRITE_RARELY = 0x00000020U,
/* buffer is often written in software */
- GRALLOC_USAGE_SW_WRITE_OFTEN = 0x00000030,
+ GRALLOC_USAGE_SW_WRITE_OFTEN = 0x00000030U,
/* mask for the software write values */
- GRALLOC_USAGE_SW_WRITE_MASK = 0x000000F0,
+ GRALLOC_USAGE_SW_WRITE_MASK = 0x000000F0U,
/* buffer will be used as an OpenGL ES texture */
- GRALLOC_USAGE_HW_TEXTURE = 0x00000100,
+ GRALLOC_USAGE_HW_TEXTURE = 0x00000100U,
/* buffer will be used as an OpenGL ES render target */
- GRALLOC_USAGE_HW_RENDER = 0x00000200,
+ GRALLOC_USAGE_HW_RENDER = 0x00000200U,
/* buffer will be used by the 2D hardware blitter */
- GRALLOC_USAGE_HW_2D = 0x00000400,
+ GRALLOC_USAGE_HW_2D = 0x00000400U,
/* buffer will be used by the HWComposer HAL module */
- GRALLOC_USAGE_HW_COMPOSER = 0x00000800,
+ GRALLOC_USAGE_HW_COMPOSER = 0x00000800U,
/* buffer will be used with the framebuffer device */
- GRALLOC_USAGE_HW_FB = 0x00001000,
+ GRALLOC_USAGE_HW_FB = 0x00001000U,
/* buffer should be displayed full-screen on an external display when
* possible */
- GRALLOC_USAGE_EXTERNAL_DISP = 0x00002000,
+ GRALLOC_USAGE_EXTERNAL_DISP = 0x00002000U,
/* Must have a hardware-protected path to external display sink for
* this buffer. If a hardware-protected path is not available, then
* either don't composite only this buffer (preferred) to the
* external sink, or (less desirable) do not route the entire
* composition to the external sink. */
- GRALLOC_USAGE_PROTECTED = 0x00004000,
+ GRALLOC_USAGE_PROTECTED = 0x00004000U,
/* buffer may be used as a cursor */
- GRALLOC_USAGE_CURSOR = 0x00008000,
+ GRALLOC_USAGE_CURSOR = 0x00008000U,
/* buffer will be used with the HW video encoder */
- GRALLOC_USAGE_HW_VIDEO_ENCODER = 0x00010000,
+ GRALLOC_USAGE_HW_VIDEO_ENCODER = 0x00010000U,
/* buffer will be written by the HW camera pipeline */
- GRALLOC_USAGE_HW_CAMERA_WRITE = 0x00020000,
+ GRALLOC_USAGE_HW_CAMERA_WRITE = 0x00020000U,
/* buffer will be read by the HW camera pipeline */
- GRALLOC_USAGE_HW_CAMERA_READ = 0x00040000,
+ GRALLOC_USAGE_HW_CAMERA_READ = 0x00040000U,
/* buffer will be used as part of zero-shutter-lag queue */
- GRALLOC_USAGE_HW_CAMERA_ZSL = 0x00060000,
+ GRALLOC_USAGE_HW_CAMERA_ZSL = 0x00060000U,
/* mask for the camera access values */
- GRALLOC_USAGE_HW_CAMERA_MASK = 0x00060000,
+ GRALLOC_USAGE_HW_CAMERA_MASK = 0x00060000U,
/* mask for the software usage bit-mask */
- GRALLOC_USAGE_HW_MASK = 0x00071F00,
+ GRALLOC_USAGE_HW_MASK = 0x00071F00U,
/* buffer will be used as a RenderScript Allocation */
- GRALLOC_USAGE_RENDERSCRIPT = 0x00100000,
+ GRALLOC_USAGE_RENDERSCRIPT = 0x00100000U,
/* Set by the consumer to indicate to the producer that they may attach a
* buffer that they did not detach from the BufferQueue. Will be filtered
* out by GRALLOC_USAGE_ALLOC_MASK, so gralloc modules will not need to
* handle this flag. */
- GRALLOC_USAGE_FOREIGN_BUFFERS = 0x00200000,
+ GRALLOC_USAGE_FOREIGN_BUFFERS = 0x00200000U,
/* Mask of all flags which could be passed to a gralloc module for buffer
* allocation. Any flags not in this mask do not need to be handled by
@@ -138,11 +138,11 @@
GRALLOC_USAGE_ALLOC_MASK = ~(GRALLOC_USAGE_FOREIGN_BUFFERS),
/* implementation-specific private usage flags */
- GRALLOC_USAGE_PRIVATE_0 = 0x10000000,
- GRALLOC_USAGE_PRIVATE_1 = 0x20000000,
- GRALLOC_USAGE_PRIVATE_2 = 0x40000000,
- GRALLOC_USAGE_PRIVATE_3 = 0x80000000,
- GRALLOC_USAGE_PRIVATE_MASK = 0xF0000000,
+ GRALLOC_USAGE_PRIVATE_0 = 0x10000000U,
+ GRALLOC_USAGE_PRIVATE_1 = 0x20000000U,
+ GRALLOC_USAGE_PRIVATE_2 = 0x40000000U,
+ GRALLOC_USAGE_PRIVATE_3 = 0x80000000U,
+ GRALLOC_USAGE_PRIVATE_MASK = 0xF0000000U,
};
/*****************************************************************************/
@@ -372,7 +372,7 @@
static inline int gralloc_open(const struct hw_module_t* module,
struct alloc_device_t** device) {
return module->methods->open(module,
- GRALLOC_HARDWARE_GPU0, (struct hw_device_t**)device);
+ GRALLOC_HARDWARE_GPU0, TO_HW_DEVICE_T_OPEN(device));
}
static inline int gralloc_close(struct alloc_device_t* device) {
diff --git a/include/hardware/gralloc1.h b/include/hardware/gralloc1.h
index 58c0e33..a1a2d69 100644
--- a/include/hardware/gralloc1.h
+++ b/include/hardware/gralloc1.h
@@ -290,7 +290,7 @@
static inline int gralloc1_open(const struct hw_module_t* module,
gralloc1_device_t** device) {
return module->methods->open(module, GRALLOC_HARDWARE_MODULE_ID,
- (struct hw_device_t**) device);
+ TO_HW_DEVICE_T_OPEN(device));
}
static inline int gralloc1_close(gralloc1_device_t* device) {
diff --git a/include/hardware/hardware.h b/include/hardware/hardware.h
index 74f57aa..5ba37e9 100644
--- a/include/hardware/hardware.h
+++ b/include/hardware/hardware.h
@@ -20,8 +20,10 @@
#include <stdint.h>
#include <sys/cdefs.h>
+#ifndef _HW_DONT_INCLUDE_CORE_
#include <cutils/native_handle.h>
#include <system/graphics.h>
+#endif // _HW_DONT_INCLUDE_CORE_
__BEGIN_DECLS
@@ -201,6 +203,12 @@
} hw_device_t;
+#ifdef __cplusplus
+#define TO_HW_DEVICE_T_OPEN(x) reinterpret_cast<struct hw_device_t**>(x)
+#else
+#define TO_HW_DEVICE_T_OPEN(x) (struct hw_device_t**)(x)
+#endif
+
/**
* Name of the hal_module_info
*/
diff --git a/include/hardware/hdmi_cec.h b/include/hardware/hdmi_cec.h
index ab70f92..aa06384 100644
--- a/include/hardware/hdmi_cec.h
+++ b/include/hardware/hdmi_cec.h
@@ -417,7 +417,7 @@
static inline int hdmi_cec_open(const struct hw_module_t* module,
struct hdmi_cec_device** device) {
return module->methods->open(module,
- HDMI_CEC_HARDWARE_INTERFACE, (struct hw_device_t**)device);
+ HDMI_CEC_HARDWARE_INTERFACE, TO_HW_DEVICE_T_OPEN(device));
}
static inline int hdmi_cec_close(struct hdmi_cec_device* device) {
diff --git a/include/hardware/hwcomposer.h b/include/hardware/hwcomposer.h
index 61218bb..7eca7c1 100644
--- a/include/hardware/hwcomposer.h
+++ b/include/hardware/hwcomposer.h
@@ -783,7 +783,7 @@
static inline int hwc_open_1(const struct hw_module_t* module,
hwc_composer_device_1_t** device) {
return module->methods->open(module,
- HWC_HARDWARE_COMPOSER, (struct hw_device_t**)device);
+ HWC_HARDWARE_COMPOSER, TO_HW_DEVICE_T_OPEN(device));
}
static inline int hwc_close_1(hwc_composer_device_1_t* device) {
diff --git a/include/hardware/hwcomposer2.h b/include/hardware/hwcomposer2.h
index 6973603..35eedb0 100644
--- a/include/hardware/hwcomposer2.h
+++ b/include/hardware/hwcomposer2.h
@@ -17,6 +17,8 @@
#ifndef ANDROID_HARDWARE_HWCOMPOSER2_H
#define ANDROID_HARDWARE_HWCOMPOSER2_H
+#include <sys/cdefs.h>
+
#include <hardware/hardware.h>
#include "hwcomposer_defs.h"
@@ -360,7 +362,7 @@
static inline const char* getDisplayRequestName(
hwc2_display_request_t request) {
- switch (request) {
+ switch (__BIONIC_CAST(static_cast, int, request)) {
case 0: return "None";
case HWC2_DISPLAY_REQUEST_FLIP_CLIENT_TARGET: return "FlipClientTarget";
case HWC2_DISPLAY_REQUEST_WRITE_CLIENT_TARGET_TO_OUTPUT:
@@ -459,7 +461,7 @@
}
static inline const char* getLayerRequestName(hwc2_layer_request_t request) {
- switch (request) {
+ switch (__BIONIC_CAST(static_cast, int, request)) {
case 0: return "None";
case HWC2_LAYER_REQUEST_CLEAR_CLIENT_TARGET: return "ClearClientTarget";
default: return "Unknown";
@@ -477,7 +479,7 @@
}
static inline const char* getTransformName(hwc_transform_t transform) {
- switch (transform) {
+ switch (__BIONIC_CAST(static_cast, int, transform)) {
case 0: return "None";
case HWC_TRANSFORM_FLIP_H: return "FlipH";
case HWC_TRANSFORM_FLIP_V: return "FlipV";
@@ -738,7 +740,7 @@
static inline int hwc2_open(const struct hw_module_t* module,
hwc2_device_t** device) {
return module->methods->open(module, HWC_HARDWARE_COMPOSER,
- (struct hw_device_t**) device);
+ TO_HW_DEVICE_T_OPEN(device));
}
static inline int hwc2_close(hwc2_device_t* device) {
diff --git a/include/hardware/keymaster0.h b/include/hardware/keymaster0.h
index f020e5b..52ac64b 100644
--- a/include/hardware/keymaster0.h
+++ b/include/hardware/keymaster0.h
@@ -134,7 +134,7 @@
keymaster0_device_t** device)
{
int rc = module->methods->open(module, KEYSTORE_KEYMASTER,
- (struct hw_device_t**) device);
+ TO_HW_DEVICE_T_OPEN(device));
return rc;
}
diff --git a/include/hardware/keymaster1.h b/include/hardware/keymaster1.h
index afd202c..9969380 100644
--- a/include/hardware/keymaster1.h
+++ b/include/hardware/keymaster1.h
@@ -536,7 +536,7 @@
/* Convenience API for opening and closing keymaster devices */
static inline int keymaster1_open(const struct hw_module_t* module, keymaster1_device_t** device) {
- return module->methods->open(module, KEYSTORE_KEYMASTER, (struct hw_device_t**)device);
+ return module->methods->open(module, KEYSTORE_KEYMASTER, TO_HW_DEVICE_T_OPEN(device));
}
static inline int keymaster1_close(keymaster1_device_t* device) {
diff --git a/include/hardware/keymaster2.h b/include/hardware/keymaster2.h
index 565ad2e..f1993f8 100644
--- a/include/hardware/keymaster2.h
+++ b/include/hardware/keymaster2.h
@@ -420,7 +420,7 @@
/* Convenience API for opening and closing keymaster devices */
static inline int keymaster2_open(const struct hw_module_t* module, keymaster2_device_t** device) {
- return module->methods->open(module, KEYSTORE_KEYMASTER, (struct hw_device_t**)device);
+ return module->methods->open(module, KEYSTORE_KEYMASTER, TO_HW_DEVICE_T_OPEN(device));
}
static inline int keymaster2_close(keymaster2_device_t* device) {
diff --git a/include/hardware/local_time_hal.h b/include/hardware/local_time_hal.h
index 946e799..1bbbf11 100644
--- a/include/hardware/local_time_hal.h
+++ b/include/hardware/local_time_hal.h
@@ -109,7 +109,7 @@
struct local_time_hw_device** device)
{
return module->methods->open(module, LOCAL_TIME_HARDWARE_INTERFACE,
- (struct hw_device_t**)device);
+ TO_HW_DEVICE_T_OPEN(device));
}
static inline int local_time_hw_device_close(struct local_time_hw_device* device)
diff --git a/include/hardware/nfc-base.h b/include/hardware/nfc-base.h
new file mode 100644
index 0000000..6b63ad2
--- /dev/null
+++ b/include/hardware/nfc-base.h
@@ -0,0 +1,34 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+// Source: android.hardware.nfc@1.0
+// Root: android.hardware:hardware/interfaces
+
+#ifndef HIDL_GENERATED_ANDROID_HARDWARE_NFC_V1_0_EXPORTED_CONSTANTS_H_
+#define HIDL_GENERATED_ANDROID_HARDWARE_NFC_V1_0_EXPORTED_CONSTANTS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+ HAL_NFC_OPEN_CPLT_EVT = 0u, // 0
+ HAL_NFC_CLOSE_CPLT_EVT = 1u, // 1
+ HAL_NFC_POST_INIT_CPLT_EVT = 2u, // 2
+ HAL_NFC_PRE_DISCOVER_CPLT_EVT = 3u, // 3
+ HAL_NFC_REQUEST_CONTROL_EVT = 4u, // 4
+ HAL_NFC_RELEASE_CONTROL_EVT = 5u, // 5
+ HAL_NFC_ERROR_EVT = 6u, // 6
+};
+
+enum {
+ HAL_NFC_STATUS_OK = 0u, // 0
+ HAL_NFC_STATUS_FAILED = 1u, // 1
+ HAL_NFC_STATUS_ERR_TRANSPORT = 2u, // 2
+ HAL_NFC_STATUS_ERR_CMD_TIMEOUT = 3u, // 3
+ HAL_NFC_STATUS_REFUSED = 4u, // 4
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // HIDL_GENERATED_ANDROID_HARDWARE_NFC_V1_0_EXPORTED_CONSTANTS_H_
diff --git a/include/hardware/nfc.h b/include/hardware/nfc.h
index 58d33d9..fdd79a5 100644
--- a/include/hardware/nfc.h
+++ b/include/hardware/nfc.h
@@ -23,6 +23,7 @@
#include <sys/types.h>
#include <hardware/hardware.h>
+#include "nfc-base.h"
__BEGIN_DECLS
@@ -69,34 +70,9 @@
struct hw_module_t common;
} nfc_nci_module_t;
-/*
- * HAL events that can be passed back to the stack
- */
typedef uint8_t nfc_event_t;
-
-enum {
- HAL_NFC_OPEN_CPLT_EVT = 0x00,
- HAL_NFC_CLOSE_CPLT_EVT = 0x01,
- HAL_NFC_POST_INIT_CPLT_EVT = 0x02,
- HAL_NFC_PRE_DISCOVER_CPLT_EVT = 0x03,
- HAL_NFC_REQUEST_CONTROL_EVT = 0x04,
- HAL_NFC_RELEASE_CONTROL_EVT = 0x05,
- HAL_NFC_ERROR_EVT = 0x06
-};
-
-/*
- * Allowed status return values for each of the HAL methods
- */
typedef uint8_t nfc_status_t;
-enum {
- HAL_NFC_STATUS_OK = 0x00,
- HAL_NFC_STATUS_FAILED = 0x01,
- HAL_NFC_STATUS_ERR_TRANSPORT = 0x02,
- HAL_NFC_STATUS_ERR_CMD_TIMEOUT = 0x03,
- HAL_NFC_STATUS_REFUSED = 0x04
-};
-
/*
* The callback passed in from the NFC stack that the HAL
* can use to pass events back to the stack.
diff --git a/include/hardware/nvram.h b/include/hardware/nvram.h
index a1868b5..0654afe 100644
--- a/include/hardware/nvram.h
+++ b/include/hardware/nvram.h
@@ -21,6 +21,7 @@
#include <sys/cdefs.h>
#include <hardware/hardware.h>
+#include <hardware/nvram_defs.h>
__BEGIN_DECLS
@@ -30,30 +31,7 @@
/* The version of this module. */
#define NVRAM_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1)
-#define NVRAM_DEVICE_API_VERSION_0_1 HARDWARE_DEVICE_API_VERSION(0, 1)
-
-/* Values returned by nvram_device methods. */
-typedef uint32_t nvram_result_t;
-
-const nvram_result_t NV_RESULT_SUCCESS = 0;
-const nvram_result_t NV_RESULT_INTERNAL_ERROR = 1;
-const nvram_result_t NV_RESULT_ACCESS_DENIED = 2;
-const nvram_result_t NV_RESULT_INVALID_PARAMETER = 3;
-const nvram_result_t NV_RESULT_SPACE_DOES_NOT_EXIST = 4;
-const nvram_result_t NV_RESULT_SPACE_ALREADY_EXISTS = 5;
-const nvram_result_t NV_RESULT_OPERATION_DISABLED = 6;
-
-/* Values describing available access controls. */
-typedef uint32_t nvram_control_t;
-
-const nvram_control_t NV_CONTROL_PERSISTENT_WRITE_LOCK = 1;
-const nvram_control_t NV_CONTROL_BOOT_WRITE_LOCK = 2;
-const nvram_control_t NV_CONTROL_BOOT_READ_LOCK = 3;
-const nvram_control_t NV_CONTROL_WRITE_AUTHORIZATION = 4;
-const nvram_control_t NV_CONTROL_READ_AUTHORIZATION = 5;
-const nvram_control_t NV_CONTROL_WRITE_EXTEND = 6;
-
-const uint32_t NV_UNLIMITED_SPACES = 0xFFFFFFFF;
+#define NVRAM_DEVICE_API_VERSION_1_1 HARDWARE_DEVICE_API_VERSION(1, 1)
struct nvram_module {
/**
@@ -99,6 +77,17 @@
const struct nvram_device* device, uint64_t* available_size);
/**
+ * Outputs the maximum number of bytes that can be allocated for a single
+ * space. This will always be at least 32. If an implementation does not
+ * limit the maximum size it may provide the total size.
+ *
+ * device - The nvram_device instance.
+ * max_space_size - Receives the output. Cannot be NULL.
+ */
+ nvram_result_t (*get_max_space_size_in_bytes)(
+ const struct nvram_device* device, uint64_t* max_space_size);
+
+ /**
* Outputs the maximum total number of spaces that may be allocated.
* This will always be at least 8. Outputs NV_UNLIMITED_SPACES if any
* number of spaces are supported (limited only to available NVRAM
@@ -337,7 +326,7 @@
static inline int nvram_open(const struct hw_module_t* module,
nvram_device_t** device) {
return module->methods->open(module, NVRAM_HARDWARE_DEVICE_ID,
- (struct hw_device_t**)device);
+ TO_HW_DEVICE_T_OPEN(device));
}
static inline int nvram_close(nvram_device_t* device) {
diff --git a/include/hardware/nvram_defs.h b/include/hardware/nvram_defs.h
new file mode 100644
index 0000000..0256a3c
--- /dev/null
+++ b/include/hardware/nvram_defs.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+/*
+ * This file contains data type definitions and constants that are useful to
+ * code interacting with and implementing the NVRAM HAL, even though it doesn't
+ * use the actual NVRAM HAL module interface. Keeping this in a separate file
+ * simplifies inclusion in low-level code which can't easily include the heavier
+ * hardware.h due to lacking standard headers.
+ */
+
+#ifndef ANDROID_HARDWARE_NVRAM_DEFS_H
+#define ANDROID_HARDWARE_NVRAM_DEFS_H
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+/* Values returned by nvram_device methods. */
+typedef uint32_t nvram_result_t;
+
+const nvram_result_t NV_RESULT_SUCCESS = 0;
+const nvram_result_t NV_RESULT_INTERNAL_ERROR = 1;
+const nvram_result_t NV_RESULT_ACCESS_DENIED = 2;
+const nvram_result_t NV_RESULT_INVALID_PARAMETER = 3;
+const nvram_result_t NV_RESULT_SPACE_DOES_NOT_EXIST = 4;
+const nvram_result_t NV_RESULT_SPACE_ALREADY_EXISTS = 5;
+const nvram_result_t NV_RESULT_OPERATION_DISABLED = 6;
+
+/* Values describing available access controls. */
+typedef uint32_t nvram_control_t;
+
+const nvram_control_t NV_CONTROL_PERSISTENT_WRITE_LOCK = 1;
+const nvram_control_t NV_CONTROL_BOOT_WRITE_LOCK = 2;
+const nvram_control_t NV_CONTROL_BOOT_READ_LOCK = 3;
+const nvram_control_t NV_CONTROL_WRITE_AUTHORIZATION = 4;
+const nvram_control_t NV_CONTROL_READ_AUTHORIZATION = 5;
+const nvram_control_t NV_CONTROL_WRITE_EXTEND = 6;
+
+const uint32_t NV_UNLIMITED_SPACES = 0xFFFFFFFF;
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#endif // ANDROID_HARDWARE_NVRAM_DEFS_H
diff --git a/include/hardware/qemu_pipe.h b/include/hardware/qemu_pipe.h
deleted file mode 100644
index 53aec97..0000000
--- a/include/hardware/qemu_pipe.h
+++ /dev/null
@@ -1,94 +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 ANDROID_INCLUDE_HARDWARE_QEMU_PIPE_H
-#define ANDROID_INCLUDE_HARDWARE_QEMU_PIPE_H
-
-#include <sys/cdefs.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <pthread.h> /* for pthread_once() */
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-#ifndef D
-# define D(...) do{}while(0)
-#endif
-
-/* Try to open a new Qemu fast-pipe. This function returns a file descriptor
- * that can be used to communicate with a named service managed by the
- * emulator.
- *
- * This file descriptor can be used as a standard pipe/socket descriptor.
- *
- * 'pipeName' is the name of the emulator service you want to connect to.
- * E.g. 'opengles' or 'camera'.
- *
- * On success, return a valid file descriptor
- * Returns -1 on error, and errno gives the error code, e.g.:
- *
- * EINVAL -> unknown/unsupported pipeName
- * ENOSYS -> fast pipes not available in this system.
- *
- * ENOSYS should never happen, except if you're trying to run within a
- * misconfigured emulator.
- *
- * You should be able to open several pipes to the same pipe service,
- * except for a few special cases (e.g. GSM modem), where EBUSY will be
- * returned if more than one client tries to connect to it.
- */
-static __inline__ int
-qemu_pipe_open(const char* pipeName)
-{
- char buff[256];
- int buffLen;
- int fd, ret;
-
- if (pipeName == NULL || pipeName[0] == '\0') {
- errno = EINVAL;
- return -1;
- }
-
- snprintf(buff, sizeof buff, "pipe:%s", pipeName);
-
- fd = open("/dev/qemu_pipe", O_RDWR);
- if (fd < 0 && errno == ENOENT)
- fd = open("/dev/goldfish_pipe", O_RDWR);
- if (fd < 0) {
- D("%s: Could not open /dev/qemu_pipe: %s", __FUNCTION__, strerror(errno));
- //errno = ENOSYS;
- return -1;
- }
-
- buffLen = strlen(buff);
-
- ret = TEMP_FAILURE_RETRY(write(fd, buff, buffLen+1));
- if (ret != buffLen+1) {
- D("%s: Could not connect to %s pipe service: %s", __FUNCTION__, pipeName, strerror(errno));
- if (ret == 0) {
- errno = ECONNRESET;
- } else if (ret > 0) {
- errno = EINVAL;
- }
- return -1;
- }
-
- return fd;
-}
-
-#endif /* ANDROID_INCLUDE_HARDWARE_QEMUD_PIPE_H */
diff --git a/include/hardware/qemud.h b/include/hardware/qemud.h
deleted file mode 100644
index 5c39f9c..0000000
--- a/include/hardware/qemud.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (C) 2008 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_HARDWARE_QEMUD_H
-#define ANDROID_INCLUDE_HARDWARE_QEMUD_H
-
-#include <cutils/sockets.h>
-#include "qemu_pipe.h"
-
-/* the following is helper code that is used by the QEMU-specific
- * hardware HAL modules to communicate with the emulator program
- * through the 'qemud' multiplexing daemon, or through the qemud
- * pipe.
- *
- * see the documentation comments for details in
- * development/emulator/qemud/qemud.c
- *
- * all definitions here are built into the HAL module to avoid
- * having to write a tiny shared library for this.
- */
-
-/* we expect the D macro to be defined to a function macro
- * that sends its formatted string argument(s) to the log.
- * If not, ignore the traces.
- */
-#ifndef D
-# define D(...) ((void)0)
-#endif
-
-static __inline__ int
-qemud_fd_write(int fd, const void* buff, int len)
-{
- int len2;
- do {
- len2 = write(fd, buff, len);
- } while (len2 < 0 && errno == EINTR);
- return len2;
-}
-
-static __inline__ int
-qemud_fd_read(int fd, void* buff, int len)
-{
- int len2;
- do {
- len2 = read(fd, buff, len);
- } while (len2 < 0 && errno == EINTR);
- return len2;
-}
-
-static __inline__ int
-qemud_channel_open(const char* name)
-{
- int fd;
- int namelen = strlen(name);
- char answer[2];
- char pipe_name[256];
-
- /* First, try to connect to the pipe. */
- snprintf(pipe_name, sizeof(pipe_name), "qemud:%s", name);
- fd = qemu_pipe_open(pipe_name);
- if (fd < 0) {
- D("QEMUD pipe is not available for %s: %s", name, strerror(errno));
- /* If pipe is not available, connect to qemud control socket */
- fd = socket_local_client( "qemud",
- ANDROID_SOCKET_NAMESPACE_RESERVED,
- SOCK_STREAM );
- if (fd < 0) {
- D("no qemud control socket: %s", strerror(errno));
- return -1;
- }
-
- /* send service name to connect */
- if (qemud_fd_write(fd, name, namelen) != namelen) {
- D("can't send service name to qemud: %s",
- strerror(errno));
- close(fd);
- return -1;
- }
-
- /* read answer from daemon */
- if (qemud_fd_read(fd, answer, 2) != 2 ||
- answer[0] != 'O' || answer[1] != 'K') {
- D("cant' connect to %s service through qemud", name);
- close(fd);
- return -1;
- }
- }
- return fd;
-}
-
-static __inline__ int
-qemud_channel_send(int fd, const void* msg, int msglen)
-{
- char header[5];
-
- if (msglen < 0)
- msglen = strlen((const char*)msg);
-
- if (msglen == 0)
- return 0;
-
- snprintf(header, sizeof header, "%04x", msglen);
- if (qemud_fd_write(fd, header, 4) != 4) {
- D("can't write qemud frame header: %s", strerror(errno));
- return -1;
- }
-
- if (qemud_fd_write(fd, msg, msglen) != msglen) {
- D("can4t write qemud frame payload: %s", strerror(errno));
- return -1;
- }
- return 0;
-}
-
-static __inline__ int
-qemud_channel_recv(int fd, void* msg, int msgsize)
-{
- char header[5];
- int size, avail;
-
- if (qemud_fd_read(fd, header, 4) != 4) {
- D("can't read qemud frame header: %s", strerror(errno));
- return -1;
- }
- header[4] = 0;
- if (sscanf(header, "%04x", &size) != 1) {
- D("malformed qemud frame header: '%.*s'", 4, header);
- return -1;
- }
- if (size > msgsize)
- return -1;
-
- if (qemud_fd_read(fd, msg, size) != size) {
- D("can't read qemud frame payload: %s", strerror(errno));
- return -1;
- }
- return size;
-}
-
-#endif /* ANDROID_INCLUDE_HARDWARE_QEMUD_H */
diff --git a/include/hardware/radio.h b/include/hardware/radio.h
index 145deb5..413f413 100644
--- a/include/hardware/radio.h
+++ b/include/hardware/radio.h
@@ -285,7 +285,7 @@
struct radio_hw_device** device)
{
return module->methods->open(module, RADIO_HARDWARE_DEVICE,
- (struct hw_device_t**)device);
+ TO_HW_DEVICE_T_OPEN(device));
}
static inline int radio_hw_device_close(const struct radio_hw_device* device)
diff --git a/include/hardware/sensors.h b/include/hardware/sensors.h
index 1d73c31..322abe6 100644
--- a/include/hardware/sensors.h
+++ b/include/hardware/sensors.h
@@ -798,6 +798,7 @@
/**
* SENSOR_TYPE_DYNAMIC_SENSOR_META
* trigger-mode: special
+ * wake-up sensor: yes
*
* A sensor event of this type is received when a dynamic sensor is added to or removed from the
* system. At most one sensor of this type can be present in one sensor HAL implementation and
@@ -829,6 +830,8 @@
* sensor_t, but the UUID should be unique and persistent for each individual unit. An all zero UUID
* indicates it is not possible to differentiate individual sensor unit.
*
+ * It is recommended to implement this type as wake up sensor.
+ *
*/
#define SENSOR_TYPE_DYNAMIC_SENSOR_META (32)
#define SENSOR_STRING_TYPE_DYNAMIC_SENSOR_META "android.sensor.dynamic_sensor_meta"
@@ -1151,7 +1154,7 @@
/**
* Enumerate all available sensors. The list is returned in "list".
- * @return number of sensors in the list
+ * return number of sensors in the list
*/
int (*get_sensors_list)(struct sensors_module_t* module,
struct sensor_t const** list);
@@ -1162,7 +1165,7 @@
* 0 - Normal operation. Default state of the module.
* 1 - Loopback mode. Data is injected for the supported
* sensors by the sensor service in this mode.
- * @return 0 on success
+ * return 0 on success
* -EINVAL if requested mode is not supported
* -EPERM if operation is not allowed
*/
@@ -1308,11 +1311,16 @@
struct {
struct hw_device_t common;
- /* Activate/de-activate one sensor. Return 0 on success, negative
+ /* Activate/de-activate one sensor.
*
* sensor_handle is the handle of the sensor to change.
* enabled set to 1 to enable, or 0 to disable the sensor.
*
+ * After sensor de-activation, existing sensor events that have not
+ * been picked up by poll() should be abandoned immediately so that
+ * subsequent activation will not get stale sensor events (events
+ * that is generated prior to the latter activation).
+ *
* Return 0 on success, negative errno code otherwise.
*/
int (*activate)(struct sensors_poll_device_t *dev,
@@ -1367,7 +1375,7 @@
/*
* Inject a single sensor sample to be to this device.
* data points to the sensor event to be injected
- * @return 0 on success
+ * return 0 on success
* -EPERM if operation is not allowed
* -EINVAL if sensor event cannot be injected
*/
@@ -1383,7 +1391,7 @@
static inline int sensors_open(const struct hw_module_t* module,
struct sensors_poll_device_t** device) {
return module->methods->open(module,
- SENSORS_HARDWARE_POLL, (struct hw_device_t**)device);
+ SENSORS_HARDWARE_POLL, TO_HW_DEVICE_T_OPEN(device));
}
static inline int sensors_close(struct sensors_poll_device_t* device) {
@@ -1393,7 +1401,7 @@
static inline int sensors_open_1(const struct hw_module_t* module,
sensors_poll_device_1_t** device) {
return module->methods->open(module,
- SENSORS_HARDWARE_POLL, (struct hw_device_t**)device);
+ SENSORS_HARDWARE_POLL, TO_HW_DEVICE_T_OPEN(device));
}
static inline int sensors_close_1(sensors_poll_device_1_t* device) {
diff --git a/include/hardware/sound_trigger.h b/include/hardware/sound_trigger.h
index e1abbc9..d7828ac 100644
--- a/include/hardware/sound_trigger.h
+++ b/include/hardware/sound_trigger.h
@@ -124,7 +124,7 @@
struct sound_trigger_hw_device** device)
{
return module->methods->open(module, SOUND_TRIGGER_HARDWARE_INTERFACE,
- (struct hw_device_t**)device);
+ TO_HW_DEVICE_T_OPEN(device));
}
static inline int sound_trigger_hw_device_close(struct sound_trigger_hw_device* device)
diff --git a/include/hardware/vibrator.h b/include/hardware/vibrator.h
index 200adf0..361085f 100644
--- a/include/hardware/vibrator.h
+++ b/include/hardware/vibrator.h
@@ -65,7 +65,7 @@
static inline int vibrator_open(const struct hw_module_t* module, vibrator_device_t** device)
{
- return module->methods->open(module, VIBRATOR_DEVICE_ID_MAIN, (struct hw_device_t**)device);
+ return module->methods->open(module, VIBRATOR_DEVICE_ID_MAIN, TO_HW_DEVICE_T_OPEN(device));
}
__END_DECLS
diff --git a/modules/Android.mk b/modules/Android.mk
index 3bd0943..462081d 100644
--- a/modules/Android.mk
+++ b/modules/Android.mk
@@ -1,4 +1,14 @@
-hardware_modules := gralloc hwcomposer audio nfc nfc-nci local_time \
- power usbaudio audio_remote_submix camera usbcamera consumerir sensors vibrator \
- tv_input fingerprint input vehicle thermal vr
+hardware_modules := \
+ audio_remote_submix \
+ camera \
+ gralloc \
+ hwcomposer \
+ input \
+ radio \
+ sensors \
+ thermal \
+ usbaudio \
+ usbcamera \
+ vehicle \
+ vr
include $(call all-named-subdir-makefiles,$(hardware_modules))
diff --git a/modules/audio/Android.bp b/modules/audio/Android.bp
new file mode 100644
index 0000000..80cab19
--- /dev/null
+++ b/modules/audio/Android.bp
@@ -0,0 +1,57 @@
+// 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.
+
+// The default audio HAL module, which is a stub, that is loaded if no other
+// device specific modules are present. The exact load order can be seen in
+// libhardware/hardware.c
+//
+// The format of the name is audio.<type>.<hardware/etc>.so where the only
+// required type is 'primary'. Other possibilites are 'a2dp', 'usb', etc.
+cc_library_shared {
+ name: "audio.primary.default",
+ relative_install_path: "hw",
+ srcs: ["audio_hw.c"],
+ shared_libs: [
+ "liblog",
+ ],
+ cflags: ["-Wno-unused-parameter"],
+}
+
+// The stub audio HAL module, identical to the default audio hal, but with
+// different name to be loaded concurrently with other audio HALs if necessary.
+// This can also be used as skeleton for new implementations
+//
+// The format of the name is audio.<type>.<hardware/etc>.so where the only
+// required type is 'primary'. Other possibilites are 'a2dp', 'usb', etc.
+cc_library_shared {
+ name: "audio.stub.default",
+ relative_install_path: "hw",
+ srcs: ["audio_hw.c"],
+ shared_libs: [
+ "liblog",
+ ],
+ cflags: ["-Wno-unused-parameter"],
+}
+
+// The stub audio policy HAL module that can be used as a skeleton for
+// new implementations.
+cc_library_shared {
+ name: "audio_policy.stub",
+ relative_install_path: "hw",
+ srcs: ["audio_policy.c"],
+ shared_libs: [
+ "liblog",
+ ],
+ cflags: ["-Wno-unused-parameter"],
+}
diff --git a/modules/audio/Android.mk b/modules/audio/Android.mk
deleted file mode 100644
index ef4b8f5..0000000
--- a/modules/audio/Android.mk
+++ /dev/null
@@ -1,62 +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.
-
-LOCAL_PATH := $(call my-dir)
-
-# The default audio HAL module, which is a stub, that is loaded if no other
-# device specific modules are present. The exact load order can be seen in
-# libhardware/hardware.c
-#
-# The format of the name is audio.<type>.<hardware/etc>.so where the only
-# required type is 'primary'. Other possibilites are 'a2dp', 'usb', etc.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := audio.primary.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := audio_hw.c
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS := -Wno-unused-parameter
-
-include $(BUILD_SHARED_LIBRARY)
-
-# The stub audio HAL module, identical to the default audio hal, but with
-# different name to be loaded concurrently with other audio HALs if necessary.
-# This can also be used as skeleton for new implementations
-#
-# The format of the name is audio.<type>.<hardware/etc>.so where the only
-# required type is 'primary'. Other possibilites are 'a2dp', 'usb', etc.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := audio.stub.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := audio_hw.c
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS := -Wno-unused-parameter
-
-include $(BUILD_SHARED_LIBRARY)
-
-# The stub audio policy HAL module that can be used as a skeleton for
-# new implementations.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := audio_policy.stub
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := audio_policy.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_hw.c b/modules/audio/audio_hw.c
index 68b0d3a..3c288ca 100644
--- a/modules/audio/audio_hw.c
+++ b/modules/audio/audio_hw.c
@@ -21,13 +21,16 @@
#include <malloc.h>
#include <pthread.h>
#include <stdint.h>
-#include <sys/time.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
-#include <cutils/log.h>
+#include <log/log.h>
+#include <hardware/audio.h>
#include <hardware/hardware.h>
#include <system/audio.h>
-#include <hardware/audio.h>
struct stub_audio_device {
struct audio_hw_device device;
@@ -119,7 +122,7 @@
static ssize_t out_write(struct audio_stream_out *stream, const void* buffer,
size_t bytes)
{
- ALOGV("out_write: bytes: %d", bytes);
+ ALOGV("out_write: bytes: %zu", bytes);
/* XXX: fake timing for audio output */
struct stub_stream_out *out = (struct stub_stream_out *)stream;
@@ -242,7 +245,7 @@
static ssize_t in_read(struct audio_stream_in *stream, void* buffer,
size_t bytes)
{
- ALOGV("in_read: bytes %d", bytes);
+ ALOGV("in_read: bytes %zu", bytes);
/* XXX: fake timing for audio input */
struct stub_stream_in *in = (struct stub_stream_in *)stream;
diff --git a/modules/audio_remote_submix/audio_hw.cpp b/modules/audio_remote_submix/audio_hw.cpp
index d47cfba..6c538ce 100644
--- a/modules/audio_remote_submix/audio_hw.cpp
+++ b/modules/audio_remote_submix/audio_hw.cpp
@@ -26,9 +26,10 @@
#include <sys/limits.h>
#include <cutils/compiler.h>
-#include <cutils/log.h>
#include <cutils/properties.h>
#include <cutils/str_parms.h>
+#include <log/log.h>
+#include <utils/String8.h>
#include <hardware/audio.h>
#include <hardware/hardware.h>
@@ -39,8 +40,6 @@
#include <media/nbaio/MonoPipe.h>
#include <media/nbaio/MonoPipeReader.h>
-#include <utils/String8.h>
-
#define LOG_STREAMS_TO_FILES 0
#if LOG_STREAMS_TO_FILES
#include <fcntl.h>
diff --git a/modules/camera/Camera.cpp b/modules/camera/Camera.cpp
index de3ae78..dc7ffa5 100644
--- a/modules/camera/Camera.cpp
+++ b/modules/camera/Camera.cpp
@@ -13,25 +13,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "Camera"
+
+#include <errno.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
#include <cstdlib>
-#include <stdio.h>
+
+#include <log/log.h>
+#include <utils/Mutex.h>
+
+#define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
+#include <utils/Trace.h>
+
#include <hardware/camera3.h>
#include <sync/sync.h>
#include <system/camera_metadata.h>
#include <system/graphics.h>
-#include <utils/Mutex.h>
#include "CameraHAL.h"
#include "Metadata.h"
#include "Stream.h"
-//#define LOG_NDEBUG 0
-#define LOG_TAG "Camera"
-#include <cutils/log.h>
-
-#define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
-#include <utils/Trace.h>
-
#include "Camera.h"
#define CAMERA_SYNC_TIMEOUT 5000 // in msecs
diff --git a/modules/camera/Camera.h b/modules/camera/Camera.h
index 0ceaf25..072de35 100644
--- a/modules/camera/Camera.h
+++ b/modules/camera/Camera.h
@@ -34,7 +34,7 @@
public:
// id is used to distinguish cameras. 0 <= id < NUM_CAMERAS.
// module is a handle to the HAL module, used when the device is opened.
- Camera(int id);
+ explicit Camera(int id);
virtual ~Camera();
// Common Camera Device Operations (see <hardware/camera_common.h>)
diff --git a/modules/camera/CameraHAL.cpp b/modules/camera/CameraHAL.cpp
index 62ee6d4..2d1d763 100644
--- a/modules/camera/CameraHAL.cpp
+++ b/modules/camera/CameraHAL.cpp
@@ -13,20 +13,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "DefaultCameraHAL"
#include <cstdlib>
+
+#include <log/log.h>
+#define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
+#include <cutils/trace.h>
+
#include <hardware/camera_common.h>
#include <hardware/hardware.h>
#include "ExampleCamera.h"
#include "VendorTags.h"
-//#define LOG_NDEBUG 0
-#define LOG_TAG "DefaultCameraHAL"
-#include <cutils/log.h>
-
-#define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
-#include <cutils/trace.h>
-
#include "CameraHAL.h"
/*
@@ -165,29 +165,29 @@
}
static hw_module_methods_t gCameraModuleMethods = {
- open : open_dev
+ .open = open_dev
};
camera_module_t HAL_MODULE_INFO_SYM __attribute__ ((visibility("default"))) = {
- common : {
- tag : HARDWARE_MODULE_TAG,
- module_api_version : CAMERA_MODULE_API_VERSION_2_2,
- hal_api_version : HARDWARE_HAL_API_VERSION,
- id : CAMERA_HARDWARE_MODULE_ID,
- name : "Default Camera HAL",
- author : "The Android Open Source Project",
- methods : &gCameraModuleMethods,
- dso : NULL,
- reserved : {0},
+ .common = {
+ .tag = HARDWARE_MODULE_TAG,
+ .module_api_version = CAMERA_MODULE_API_VERSION_2_2,
+ .hal_api_version = HARDWARE_HAL_API_VERSION,
+ .id = CAMERA_HARDWARE_MODULE_ID,
+ .name = "Default Camera HAL",
+ .author = "The Android Open Source Project",
+ .methods = &gCameraModuleMethods,
+ .dso = NULL,
+ .reserved = {0},
},
- get_number_of_cameras : get_number_of_cameras,
- get_camera_info : get_camera_info,
- set_callbacks : set_callbacks,
- get_vendor_tag_ops : get_vendor_tag_ops,
- open_legacy : NULL,
- set_torch_mode : NULL,
- init : NULL,
- reserved : {0},
+ .get_number_of_cameras = get_number_of_cameras,
+ .get_camera_info = get_camera_info,
+ .set_callbacks = set_callbacks,
+ .get_vendor_tag_ops = get_vendor_tag_ops,
+ .open_legacy = NULL,
+ .set_torch_mode = NULL,
+ .init = NULL,
+ .reserved = {0},
};
} // extern "C"
diff --git a/modules/camera/CameraHAL.h b/modules/camera/CameraHAL.h
index 00c74e5..74a70a6 100644
--- a/modules/camera/CameraHAL.h
+++ b/modules/camera/CameraHAL.h
@@ -29,7 +29,7 @@
// camera device.
class CameraHAL {
public:
- CameraHAL(int num_cameras);
+ explicit CameraHAL(int num_cameras);
~CameraHAL();
// Camera Module Interface (see <hardware/camera_common.h>)
diff --git a/modules/camera/ExampleCamera.cpp b/modules/camera/ExampleCamera.cpp
index d873321..473cb60 100644
--- a/modules/camera/ExampleCamera.cpp
+++ b/modules/camera/ExampleCamera.cpp
@@ -13,20 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-#include <system/camera_metadata.h>
-#include "Camera.h"
-
//#define LOG_NDEBUG 0
#define LOG_TAG "ExampleCamera"
-#include <cutils/log.h>
+
+#include <stdint.h>
+
+#include <log/log.h>
#define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
#include <utils/Trace.h>
+#include <system/camera_metadata.h>
+#include "Camera.h"
#include "ExampleCamera.h"
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
namespace default_camera_hal {
@@ -264,7 +265,8 @@
return setTemplate(CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG, m.get());
}
-bool ExampleCamera::isValidCaptureSettings(const camera_metadata_t* settings)
+bool ExampleCamera::isValidCaptureSettings(
+ const camera_metadata_t* /*settings*/)
{
// TODO: reject settings that cannot be captured
return true;
diff --git a/modules/camera/ExampleCamera.h b/modules/camera/ExampleCamera.h
index 45c4a94..44eac76 100644
--- a/modules/camera/ExampleCamera.h
+++ b/modules/camera/ExampleCamera.h
@@ -27,7 +27,7 @@
// metadata and logic about that device.
class ExampleCamera : public Camera {
public:
- ExampleCamera(int id);
+ explicit ExampleCamera(int id);
~ExampleCamera();
private:
diff --git a/modules/camera/Metadata.cpp b/modules/camera/Metadata.cpp
index 18e5239..440da5f 100644
--- a/modules/camera/Metadata.cpp
+++ b/modules/camera/Metadata.cpp
@@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "Metadata"
#include <system/camera_metadata.h>
-//#define LOG_NDEBUG 0
-#define LOG_TAG "Metadata"
-#include <cutils/log.h>
+#include <log/log.h>
#define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
#include <utils/Trace.h>
diff --git a/modules/camera/Stream.cpp b/modules/camera/Stream.cpp
index e0099b6..a38b590 100644
--- a/modules/camera/Stream.cpp
+++ b/modules/camera/Stream.cpp
@@ -13,20 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-#include <stdio.h>
-#include <hardware/camera3.h>
-#include <hardware/gralloc.h>
-#include <system/graphics.h>
-#include <utils/Mutex.h>
-
//#define LOG_NDEBUG 0
#define LOG_TAG "Stream"
-#include <cutils/log.h>
+
+#include <stdio.h>
+
+#include <log/log.h>
+#include <utils/Mutex.h>
#define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
#include <utils/Trace.h>
+#include <hardware/camera3.h>
+#include <hardware/gralloc.h>
+#include <system/graphics.h>
+
#include "Stream.h"
namespace default_camera_hal {
diff --git a/modules/camera/VendorTags.cpp b/modules/camera/VendorTags.cpp
index 2c54648..9a34dc9 100644
--- a/modules/camera/VendorTags.cpp
+++ b/modules/camera/VendorTags.cpp
@@ -13,17 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-#include <system/camera_metadata.h>
-#include "Metadata.h"
-
//#define LOG_NDEBUG 0
#define LOG_TAG "VendorTags"
-#include <cutils/log.h>
+
+#include <stdint.h>
+
+#include <log/log.h>
#define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
#include <utils/Trace.h>
+#include <system/camera_metadata.h>
+#include "Metadata.h"
+
#include "VendorTags.h"
namespace default_camera_hal {
@@ -136,12 +138,13 @@
{
}
-int VendorTags::getTagCount(const vendor_tag_ops_t* ops)
+int VendorTags::getTagCount(const vendor_tag_ops_t* /*ops*/)
{
return mTagCount;
}
-void VendorTags::getAllTags(const vendor_tag_ops_t* ops, uint32_t* tag_array)
+void VendorTags::getAllTags(const vendor_tag_ops_t* /*ops*/,
+ uint32_t* tag_array)
{
if (tag_array == NULL) {
ALOGE("%s: NULL tag_array", __func__);
@@ -156,7 +159,8 @@
}
}
-const char* VendorTags::getSectionName(const vendor_tag_ops_t* ops, uint32_t tag)
+const char* VendorTags::getSectionName(const vendor_tag_ops_t* /*ops*/,
+ uint32_t tag)
{
const Section* section = getSection(tag);
@@ -166,7 +170,8 @@
return section->name;
}
-const char* VendorTags::getTagName(const vendor_tag_ops_t* ops, uint32_t tag)
+const char* VendorTags::getTagName(const vendor_tag_ops_t* /*ops*/,
+ uint32_t tag)
{
const Entry* entry = getEntry(tag);
@@ -176,7 +181,7 @@
return entry->name;
}
-int VendorTags::getTagType(const vendor_tag_ops_t* ops, uint32_t tag)
+int VendorTags::getTagType(const vendor_tag_ops_t* /*ops*/, uint32_t tag)
{
const Entry* entry = getEntry(tag);
diff --git a/modules/consumerir/Android.bp b/modules/consumerir/Android.bp
new file mode 100644
index 0000000..4ee5fb1
--- /dev/null
+++ b/modules/consumerir/Android.bp
@@ -0,0 +1,22 @@
+// 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.
+
+cc_library_shared {
+ name: "consumerir.default",
+ relative_install_path: "hw",
+ srcs: ["consumerir.c"],
+ shared_libs: [
+ "liblog",
+ ],
+}
diff --git a/modules/consumerir/Android.mk b/modules/consumerir/Android.mk
deleted file mode 100644
index b881572..0000000
--- a/modules/consumerir/Android.mk
+++ /dev/null
@@ -1,25 +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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := consumerir.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := consumerir.c
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/consumerir/consumerir.c b/modules/consumerir/consumerir.c
index f3eac0b..f2cc623 100644
--- a/modules/consumerir/consumerir.c
+++ b/modules/consumerir/consumerir.c
@@ -17,12 +17,16 @@
#include <errno.h>
#include <malloc.h>
+#include <stdlib.h>
#include <string.h>
-#include <cutils/log.h>
-#include <hardware/hardware.h>
-#include <hardware/consumerir.h>
+#include <unistd.h>
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+#include <log/log.h>
+
+#include <hardware/consumerir.h>
+#include <hardware/hardware.h>
+
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
static const consumerir_freq_range_t consumerir_freqs[] = {
{.min = 30000, .max = 30000},
diff --git a/modules/fingerprint/Android.bp b/modules/fingerprint/Android.bp
new file mode 100644
index 0000000..a66f9f9
--- /dev/null
+++ b/modules/fingerprint/Android.bp
@@ -0,0 +1,20 @@
+// 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.
+
+cc_library_shared {
+ name: "fingerprint.default",
+ relative_install_path: "hw",
+ srcs: ["fingerprint.c"],
+ shared_libs: ["liblog"],
+}
diff --git a/modules/fingerprint/Android.mk b/modules/fingerprint/Android.mk
deleted file mode 100644
index 58c0a83..0000000
--- a/modules/fingerprint/Android.mk
+++ /dev/null
@@ -1,25 +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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := fingerprint.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := fingerprint.c
-LOCAL_SHARED_LIBRARIES := liblog
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/fingerprint/fingerprint.c b/modules/fingerprint/fingerprint.c
index 08b112b..8f4bca6 100644
--- a/modules/fingerprint/fingerprint.c
+++ b/modules/fingerprint/fingerprint.c
@@ -17,10 +17,13 @@
#include <errno.h>
#include <malloc.h>
+#include <stdint.h>
#include <string.h>
-#include <cutils/log.h>
-#include <hardware/hardware.h>
+
+#include <log/log.h>
+
#include <hardware/fingerprint.h>
+#include <hardware/hardware.h>
static int fingerprint_close(hw_device_t *dev)
{
diff --git a/modules/gralloc/Android.mk b/modules/gralloc/Android.mk
index 092e851..6b6e60d 100644
--- a/modules/gralloc/Android.mk
+++ b/modules/gralloc/Android.mk
@@ -27,6 +27,8 @@
framebuffer.cpp \
mapper.cpp
+LOCAL_HEADER_LIBRARIES := libhardware_headers
+
LOCAL_MODULE := gralloc.default
LOCAL_CFLAGS:= -DLOG_TAG=\"gralloc\" -Wno-missing-field-initializers
ifeq ($(TARGET_USE_PAN_DISPLAY),true)
diff --git a/modules/gralloc/framebuffer.cpp b/modules/gralloc/framebuffer.cpp
index eadcdaa..7ef8098 100644
--- a/modules/gralloc/framebuffer.cpp
+++ b/modules/gralloc/framebuffer.cpp
@@ -14,24 +14,20 @@
* limitations under the License.
*/
+#include <dlfcn.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/ioctl.h>
#include <sys/mman.h>
-#include <dlfcn.h>
-
#include <cutils/ashmem.h>
-#include <cutils/log.h>
-
-#include <hardware/hardware.h>
-#include <hardware/gralloc.h>
-
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/ioctl.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <cutils/log.h>
#include <cutils/atomic.h>
+#include <log/log.h>
+
+#include <hardware/gralloc.h>
+#include <hardware/hardware.h>
#ifdef __ANDROID__
#include <linux/fb.h>
diff --git a/modules/gralloc/gr.h b/modules/gralloc/gr.h
index 732b6bc..ac7e967 100644
--- a/modules/gralloc/gr.h
+++ b/modules/gralloc/gr.h
@@ -48,7 +48,7 @@
class Autolock {
Locker& locker;
public:
- inline Autolock(Locker& locker) : locker(locker) { locker.lock(); }
+ inline explicit Autolock(Locker& locker) : locker(locker) { locker.lock(); }
inline ~Autolock() { locker.unlock(); }
};
inline Locker() { pthread_mutex_init(&mutex, 0); }
diff --git a/modules/gralloc/gralloc.cpp b/modules/gralloc/gralloc.cpp
index e9559e9..f8d3c78 100644
--- a/modules/gralloc/gralloc.cpp
+++ b/modules/gralloc/gralloc.cpp
@@ -14,25 +14,24 @@
* limitations under the License.
*/
-#include <limits.h>
-#include <unistd.h>
-#include <fcntl.h>
#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
-
+#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <sys/ioctl.h>
+#include <unistd.h>
#include <cutils/ashmem.h>
-#include <cutils/log.h>
#include <cutils/atomic.h>
+#include <log/log.h>
-#include <hardware/hardware.h>
#include <hardware/gralloc.h>
+#include <hardware/hardware.h>
#include "gralloc_priv.h"
#include "gr.h"
diff --git a/modules/gralloc/mapper.cpp b/modules/gralloc/mapper.cpp
index 20d9841..ee3e40e 100644
--- a/modules/gralloc/mapper.cpp
+++ b/modules/gralloc/mapper.cpp
@@ -14,18 +14,17 @@
* limitations under the License.
*/
-#include <limits.h>
#include <errno.h>
+#include <limits.h>
#include <pthread.h>
-#include <unistd.h>
#include <string.h>
-
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <unistd.h>
-#include <cutils/log.h>
#include <cutils/atomic.h>
+#include <log/log.h>
#include <hardware/hardware.h>
#include <hardware/gralloc.h>
diff --git a/modules/hwcomposer/hwcomposer.cpp b/modules/hwcomposer/hwcomposer.cpp
index 9d1aa34..297cafd 100644
--- a/modules/hwcomposer/hwcomposer.cpp
+++ b/modules/hwcomposer/hwcomposer.cpp
@@ -14,15 +14,14 @@
* limitations under the License.
*/
-#include <hardware/hardware.h>
-
#include <errno.h>
#include <fcntl.h>
#include <malloc.h>
-#include <cutils/log.h>
#include <cutils/atomic.h>
+#include <log/log.h>
+#include <hardware/hardware.h>
#include <hardware/hwcomposer.h>
#include <EGL/egl.h>
diff --git a/modules/input/evdev/InputHub.cpp b/modules/input/evdev/InputHub.cpp
index 389955d..e2c65fa 100644
--- a/modules/input/evdev/InputHub.cpp
+++ b/modules/input/evdev/InputHub.cpp
@@ -610,7 +610,7 @@
for (;;) {
ssize_t readSize = TEMP_FAILURE_RETRY(read(inputFd, ievs, sizeof(ievs)));
if (readSize == 0 || (readSize < 0 && errno == ENODEV)) {
- ALOGW("could not get event, removed? (fd: %d, size: %d errno: %d)",
+ ALOGW("could not get event, removed? (fd: %d, size: %zd errno: %d)",
inputFd, readSize, errno);
removedDeviceFds.push_back(inputFd);
@@ -621,7 +621,7 @@
}
break;
} else if (readSize % sizeof(input_event) != 0) {
- ALOGE("could not get event. wrong size=%d", readSize);
+ ALOGE("could not get event. wrong size=%zd", readSize);
break;
} else {
size_t count = static_cast<size_t>(readSize) / sizeof(struct input_event);
@@ -702,7 +702,7 @@
if (event->mask & IN_CREATE) {
auto deviceNode = openNode(path);
if (deviceNode == nullptr) {
- ALOGE("could not open device node %s. err=%d", path.c_str(), res);
+ ALOGE("could not open device node %s. err=%zd", path.c_str(), res);
} else {
mInputCallback->onDeviceAdded(deviceNode);
}
diff --git a/modules/local_time/Android.bp b/modules/local_time/Android.bp
new file mode 100644
index 0000000..df32325
--- /dev/null
+++ b/modules/local_time/Android.bp
@@ -0,0 +1,32 @@
+// 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.
+
+// The default local time HAL module. The default module simply uses the
+// system's clock_gettime(CLOCK_MONOTONIC) and does not support HW slewing.
+// Devices which use the default implementation should take care to ensure that
+// the oscillator backing the CLOCK_MONOTONIC implementation is phase locked to
+// the audio and video output hardware. This default implementation is loaded
+// if no other device specific modules are present. The exact load order can be
+// seen in libhardware/hardware.c
+//
+// The format of the name is local_time.<hardware>.so
+cc_library_shared {
+ name: "local_time.default",
+ relative_install_path: "hw",
+ srcs: ["local_time_hw.c"],
+ shared_libs: [
+ "liblog",
+ "libcutils",
+ ],
+}
diff --git a/modules/local_time/Android.mk b/modules/local_time/Android.mk
deleted file mode 100644
index 91885aa..0000000
--- a/modules/local_time/Android.mk
+++ /dev/null
@@ -1,34 +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.
-
-LOCAL_PATH := $(call my-dir)
-
-# The default local time HAL module. The default module simply uses the
-# system's clock_gettime(CLOCK_MONOTONIC) and does not support HW slewing.
-# Devices which use the default implementation should take care to ensure that
-# the oscillator backing the CLOCK_MONOTONIC implementation is phase locked to
-# the audio and video output hardware. This default implementation is loaded
-# if no other device specific modules are present. The exact load order can be
-# seen in libhardware/hardware.c
-#
-# The format of the name is local_time.<hardware>.so
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := local_time.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := local_time_hw.c
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/local_time/local_time_hw.c b/modules/local_time/local_time_hw.c
index ac597f4..4b21656 100644
--- a/modules/local_time/local_time_hw.c
+++ b/modules/local_time/local_time_hw.c
@@ -23,7 +23,7 @@
#include <string.h>
#include <sys/time.h>
-#include <cutils/log.h>
+#include <log/log.h>
#include <hardware/hardware.h>
#include <hardware/local_time_hal.h>
diff --git a/modules/nfc-nci/Android.bp b/modules/nfc-nci/Android.bp
new file mode 100644
index 0000000..fc73761
--- /dev/null
+++ b/modules/nfc-nci/Android.bp
@@ -0,0 +1,23 @@
+// 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.
+
+cc_library_shared {
+ name: "nfc_nci.default",
+ relative_install_path: "hw",
+ srcs: ["nfc_nci_example.c"],
+ shared_libs: [
+ "liblog",
+ "libcutils",
+ ],
+}
diff --git a/modules/nfc-nci/Android.mk b/modules/nfc-nci/Android.mk
deleted file mode 100644
index c1f679a..0000000
--- a/modules/nfc-nci/Android.mk
+++ /dev/null
@@ -1,25 +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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := nfc_nci.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := nfc_nci_example.c
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/nfc-nci/nfc_nci_example.c b/modules/nfc-nci/nfc_nci_example.c
index 758c2b7..cdfd7d7 100644
--- a/modules/nfc-nci/nfc_nci_example.c
+++ b/modules/nfc-nci/nfc_nci_example.c
@@ -17,11 +17,11 @@
#include <malloc.h>
#include <string.h>
-#include <cutils/log.h>
+#include <log/log.h>
+
#include <hardware/hardware.h>
#include <hardware/nfc.h>
-
/*
* NCI HAL method implementations. These must be overriden
*/
diff --git a/modules/nfc/Android.bp b/modules/nfc/Android.bp
new file mode 100644
index 0000000..53ab309
--- /dev/null
+++ b/modules/nfc/Android.bp
@@ -0,0 +1,22 @@
+// 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.
+
+cc_library_shared {
+ name: "nfc.default",
+ relative_install_path: "hw",
+ srcs: ["nfc_pn544_example.c"],
+ shared_libs: [
+ "liblog",
+ ],
+}
diff --git a/modules/nfc/Android.mk b/modules/nfc/Android.mk
deleted file mode 100644
index 29b239c..0000000
--- a/modules/nfc/Android.mk
+++ /dev/null
@@ -1,25 +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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := nfc.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := nfc_pn544_example.c
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/power/Android.bp b/modules/power/Android.bp
new file mode 100644
index 0000000..2b86c8b
--- /dev/null
+++ b/modules/power/Android.bp
@@ -0,0 +1,20 @@
+// 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.
+
+cc_library_shared {
+ name: "power.default",
+ relative_install_path: "hw",
+ srcs: ["power.c"],
+ shared_libs: ["liblog"],
+}
diff --git a/modules/power/Android.mk b/modules/power/Android.mk
deleted file mode 100644
index c868ded..0000000
--- a/modules/power/Android.mk
+++ /dev/null
@@ -1,25 +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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := power.default
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := power.c
-LOCAL_SHARED_LIBRARIES := liblog
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/power/power.c b/modules/power/power.c
index 7cacc09..15d7ba2 100644
--- a/modules/power/power.c
+++ b/modules/power/power.c
@@ -25,16 +25,21 @@
#include <hardware/hardware.h>
#include <hardware/power.h>
-static void power_init(struct power_module *module)
+// We only support clang and g++.
+#define UNUSED_ARGUMENT __attribute((unused))
+
+static void power_init(struct power_module *module UNUSED_ARGUMENT)
{
}
-static void power_set_interactive(struct power_module *module, int on)
+static void power_set_interactive(struct power_module *module UNUSED_ARGUMENT,
+ int on UNUSED_ARGUMENT)
{
}
-static void power_hint(struct power_module *module, power_hint_t hint,
- void *data) {
+static void power_hint(struct power_module *module UNUSED_ARGUMENT,
+ power_hint_t hint,
+ void *data UNUSED_ARGUMENT) {
switch (hint) {
default:
break;
diff --git a/modules/radio/radio_hal_tool.c b/modules/radio/radio_hal_tool.c
index 05d872e..baa2efe 100644
--- a/modules/radio/radio_hal_tool.c
+++ b/modules/radio/radio_hal_tool.c
@@ -16,16 +16,18 @@
#define LOG_TAG "radio_hal_tool"
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
-#include <cutils/log.h>
+#include <log/log.h>
+
#include <hardware/hardware.h>
#include <hardware/radio.h>
#include <system/radio.h>
#include <system/radio_metadata.h>
-
// Global state variables.
const struct radio_tuner *hal_tuner = NULL;
diff --git a/modules/radio/radio_hw.c b/modules/radio/radio_hw.c
index fbf8c94..f1448da 100644
--- a/modules/radio/radio_hw.c
+++ b/modules/radio/radio_hw.c
@@ -17,22 +17,26 @@
#define LOG_TAG "radio_hw_stub"
#define LOG_NDEBUG 0
-#include <string.h>
-#include <stdlib.h>
#include <errno.h>
+#include <fcntl.h>
#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <sys/prctl.h>
+#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
+#include <time.h>
#include <unistd.h>
-#include <cutils/log.h>
+
#include <cutils/list.h>
-#include <system/radio.h>
-#include <system/radio_metadata.h>
+#include <log/log.h>
+
#include <hardware/hardware.h>
#include <hardware/radio.h>
+#include <system/radio.h>
+#include <system/radio_metadata.h>
static const radio_hal_properties_t hw_properties = {
.class_id = RADIO_CLASS_AM_FM,
@@ -189,7 +193,7 @@
exit:
close(fd);
free(data);
- ALOGE_IF(ret != 0, "%s error %d", __func__, ret);
+ ALOGE_IF(ret != 0, "%s error %d", __func__, (int)ret);
return (int)ret;
}
diff --git a/modules/sensors/SensorEventQueue.cpp b/modules/sensors/SensorEventQueue.cpp
index f6144f8..0d4d64a 100644
--- a/modules/sensors/SensorEventQueue.cpp
+++ b/modules/sensors/SensorEventQueue.cpp
@@ -14,11 +14,13 @@
* limitations under the License.
*/
-#include <hardware/sensors.h>
-#include <algorithm>
#include <pthread.h>
-#include <cutils/log.h>
+#include <algorithm>
+
+#include <log/log.h>
+
+#include <hardware/sensors.h>
#include "SensorEventQueue.h"
SensorEventQueue::SensorEventQueue(int capacity) {
diff --git a/modules/sensors/SensorEventQueue.h b/modules/sensors/SensorEventQueue.h
index 11e1f41..9778e93 100644
--- a/modules/sensors/SensorEventQueue.h
+++ b/modules/sensors/SensorEventQueue.h
@@ -38,7 +38,7 @@
pthread_cond_t mSpaceAvailableCondition;
public:
- SensorEventQueue(int capacity);
+ explicit SensorEventQueue(int capacity);
~SensorEventQueue();
// Returns length of region, between zero and min(capacity, requestedLength). If there is any
diff --git a/modules/soundtrigger/sound_trigger_hw.c b/modules/soundtrigger/sound_trigger_hw.c
index 20d97f2..0089f98 100644
--- a/modules/soundtrigger/sound_trigger_hw.c
+++ b/modules/soundtrigger/sound_trigger_hw.c
@@ -51,21 +51,20 @@
#define ERROR_BAD_COMMAND "Bad command"
+#include <arpa/inet.h>
#include <errno.h>
+#include <pthread.h>
+#include <netinet/in.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
-#include <arpa/inet.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-
-#include <errno.h>
-#include <pthread.h>
#include <sys/prctl.h>
-#include <cutils/log.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <unistd.h>
+
+#include <log/log.h>
#include <hardware/hardware.h>
#include <system/sound_trigger.h>
diff --git a/modules/thermal/thermal.c b/modules/thermal/thermal.c
index 6ba5845..7f4de3b 100644
--- a/modules/thermal/thermal.c
+++ b/modules/thermal/thermal.c
@@ -138,8 +138,9 @@
fclose(file);
fclose(cpu_file);
return errno ? -errno : -EIO;
+ } else {
+ fclose(cpu_file);
}
- fclose(cpu_file);
if (list != NULL) {
list[size] = (cpu_usage_t) {
diff --git a/modules/tv_input/Android.bp b/modules/tv_input/Android.bp
new file mode 100644
index 0000000..beac132
--- /dev/null
+++ b/modules/tv_input/Android.bp
@@ -0,0 +1,23 @@
+// Copyright (C) 2014 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.
+
+cc_library_shared {
+ name: "tv_input.default",
+ relative_install_path: "hw",
+ shared_libs: [
+ "libcutils",
+ "liblog",
+ ],
+ srcs: ["tv_input.cpp"],
+}
diff --git a/modules/tv_input/Android.mk b/modules/tv_input/Android.mk
deleted file mode 100644
index e8aa7fc..0000000
--- a/modules/tv_input/Android.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (C) 2014 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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SHARED_LIBRARIES := libcutils liblog
-LOCAL_SRC_FILES := tv_input.cpp
-LOCAL_MODULE := tv_input.default
-LOCAL_MODULE_TAGS := optional
-include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/tv_input/tv_input.cpp b/modules/tv_input/tv_input.cpp
index 114e80e..f93cb20 100644
--- a/modules/tv_input/tv_input.cpp
+++ b/modules/tv_input/tv_input.cpp
@@ -18,8 +18,8 @@
#include <fcntl.h>
#include <malloc.h>
-#include <cutils/log.h>
#include <cutils/native_handle.h>
+#include <log/log.h>
#include <hardware/tv_input.h>
diff --git a/modules/usbcamera/Camera.cpp b/modules/usbcamera/Camera.cpp
index cf62f7f..500a982 100644
--- a/modules/usbcamera/Camera.cpp
+++ b/modules/usbcamera/Camera.cpp
@@ -16,21 +16,28 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "Camera"
-#include <cutils/log.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
#include <cstdlib>
-#include <stdio.h>
-#include <hardware/camera3.h>
-#include <system/camera_metadata.h>
-#include <system/graphics.h>
+
+#include <log/log.h>
#include <utils/Mutex.h>
-#include "CameraHAL.h"
-#include "Metadata.h"
-#include "Stream.h"
#define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
#include <utils/Trace.h>
+#include <hardware/camera3.h>
+#include <system/camera_metadata.h>
+#include <system/graphics.h>
+
+#include "CameraHAL.h"
+#include "Metadata.h"
+#include "Stream.h"
+
#include "Camera.h"
namespace usb_camera_hal {
diff --git a/modules/usbcamera/Camera.h b/modules/usbcamera/Camera.h
index 6419c7d..4051345 100644
--- a/modules/usbcamera/Camera.h
+++ b/modules/usbcamera/Camera.h
@@ -38,7 +38,7 @@
public:
// id is used to distinguish cameras. 0 <= id < NUM_CAMERAS.
// module is a handle to the HAL module, used when the device is opened.
- Camera(int id);
+ explicit Camera(int id);
virtual ~Camera();
// Common Camera Device Operations (see <hardware/camera_common.h>)
diff --git a/modules/usbcamera/CameraHAL.cpp b/modules/usbcamera/CameraHAL.cpp
index 652e937..eec1044 100644
--- a/modules/usbcamera/CameraHAL.cpp
+++ b/modules/usbcamera/CameraHAL.cpp
@@ -16,13 +16,17 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "UsbCameraHAL"
-#include <cutils/log.h>
#include <cstdlib>
+
+#include <log/log.h>
+#include <utils/Mutex.h>
+
#include <hardware/camera_common.h>
#include <hardware/hardware.h>
-#include "UsbCamera.h"
+
#include "CameraHAL.h"
+#include "UsbCamera.h"
/*
* This file serves as the entry point to the HAL. It contains the module
diff --git a/modules/usbcamera/HotplugThread.cpp b/modules/usbcamera/HotplugThread.cpp
index 6c65086..80f18c8 100644
--- a/modules/usbcamera/HotplugThread.cpp
+++ b/modules/usbcamera/HotplugThread.cpp
@@ -16,7 +16,8 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "HotplugThread"
-#include <cutils/log.h>
+
+#include <log/log.h>
#include "HotplugThread.h"
diff --git a/modules/usbcamera/HotplugThread.h b/modules/usbcamera/HotplugThread.h
index a13adb7..625dcb4 100644
--- a/modules/usbcamera/HotplugThread.h
+++ b/modules/usbcamera/HotplugThread.h
@@ -36,7 +36,7 @@
class HotplugThread : public android::Thread {
public:
- HotplugThread(CameraHAL *hal);
+ explicit HotplugThread(CameraHAL *hal);
~HotplugThread();
// Override below two methods for proper cleanup.
diff --git a/modules/usbcamera/Metadata.cpp b/modules/usbcamera/Metadata.cpp
index f243834..78318f3 100644
--- a/modules/usbcamera/Metadata.cpp
+++ b/modules/usbcamera/Metadata.cpp
@@ -16,13 +16,14 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "Metadata"
-#include <cutils/log.h>
-#include <system/camera_metadata.h>
+#include <log/log.h>
#define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
#include <utils/Trace.h>
+#include <system/camera_metadata.h>
+
#include "Metadata.h"
namespace usb_camera_hal {
diff --git a/modules/usbcamera/Stream.cpp b/modules/usbcamera/Stream.cpp
index f56866e..45e7fc2 100644
--- a/modules/usbcamera/Stream.cpp
+++ b/modules/usbcamera/Stream.cpp
@@ -16,17 +16,19 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "Stream"
-#include <cutils/log.h>
#include <stdio.h>
-#include <hardware/camera3.h>
-#include <hardware/gralloc.h>
-#include <system/graphics.h>
+
+#include <log/log.h>
#include <utils/Mutex.h>
#define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
#include <utils/Trace.h>
+#include <hardware/camera3.h>
+#include <hardware/gralloc.h>
+#include <system/graphics.h>
+
#include "Stream.h"
namespace usb_camera_hal {
diff --git a/modules/usbcamera/UsbCamera.cpp b/modules/usbcamera/UsbCamera.cpp
index 82a1145..ec949ae 100644
--- a/modules/usbcamera/UsbCamera.cpp
+++ b/modules/usbcamera/UsbCamera.cpp
@@ -16,17 +16,20 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "UsbCameraDevice"
-#include <cutils/log.h>
-#include <system/camera_metadata.h>
+#include <stdint.h>
+
+#include <log/log.h>
#define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
#include <utils/Trace.h>
+#include <system/camera_metadata.h>
+
#include "Camera.h"
#include "UsbCamera.h"
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
namespace usb_camera_hal {
diff --git a/modules/usbcamera/UsbCamera.h b/modules/usbcamera/UsbCamera.h
index fe52ade..57017fe 100644
--- a/modules/usbcamera/UsbCamera.h
+++ b/modules/usbcamera/UsbCamera.h
@@ -28,7 +28,7 @@
*/
class UsbCamera : public Camera {
public:
- UsbCamera(int id);
+ explicit UsbCamera(int id);
~UsbCamera();
private:
diff --git a/modules/vehicle/vehicle.c b/modules/vehicle/vehicle.c
index a26f27c..78545af 100644
--- a/modules/vehicle/vehicle.c
+++ b/modules/vehicle/vehicle.c
@@ -31,7 +31,7 @@
#include <sys/time.h>
#include <time.h>
-#include <cutils/log.h>
+#include <log/log.h>
#include <system/radio.h>
#include <hardware/hardware.h>
#include <hardware/vehicle.h>
diff --git a/modules/vibrator/Android.bp b/modules/vibrator/Android.bp
new file mode 100644
index 0000000..f9afd45
--- /dev/null
+++ b/modules/vibrator/Android.bp
@@ -0,0 +1,24 @@
+// 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.
+
+cc_library_shared {
+ name: "vibrator.default",
+
+ // HAL module implementation stored in
+ // hw/<VIBRATOR_HARDWARE_MODULE_ID>.default.so
+ relative_install_path: "hw",
+ include_dirs: ["hardware/libhardware"],
+ srcs: ["vibrator.c"],
+ shared_libs: ["liblog"],
+}
diff --git a/modules/vibrator/Android.mk b/modules/vibrator/Android.mk
deleted file mode 100644
index b6b480c..0000000
--- a/modules/vibrator/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := vibrator.default
-
-# HAL module implementation stored in
-# hw/<VIBRATOR_HARDWARE_MODULE_ID>.default.so
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_C_INCLUDES := hardware/libhardware
-LOCAL_SRC_FILES := vibrator.c
-LOCAL_SHARED_LIBRARIES := liblog
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_SHARED_LIBRARY)
-
diff --git a/modules/vibrator/vibrator.c b/modules/vibrator/vibrator.c
index 6b3ce57..950bc59 100644
--- a/modules/vibrator/vibrator.c
+++ b/modules/vibrator/vibrator.c
@@ -14,54 +14,58 @@
* limitations under the License.
*/
-#include <hardware/vibrator.h>
#include <hardware/hardware.h>
+#include <hardware/vibrator.h>
-#include <cutils/log.h>
-
-#include <malloc.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
#include <errno.h>
+#include <fcntl.h>
+#include <malloc.h>
#include <math.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <log/log.h>
+
+#define TIMEOUT_STR_LEN 20
static const char THE_DEVICE[] = "/sys/class/timed_output/vibrator/enable";
-static int vibra_exists() {
+static bool device_exists(const char *file) {
int fd;
- fd = TEMP_FAILURE_RETRY(open(THE_DEVICE, O_RDWR));
+ fd = TEMP_FAILURE_RETRY(open(file, O_RDWR));
if(fd < 0) {
- ALOGE("Vibrator file does not exist : %d", fd);
- return 0;
+ return false;
}
close(fd);
- return 1;
+ return true;
}
-static int sendit(unsigned int timeout_ms)
+static bool vibra_exists() {
+ return device_exists(THE_DEVICE);
+}
+
+static int write_value(const char *file, const char *value)
{
int to_write, written, ret, fd;
- char value[20]; /* large enough for millions of years */
-
- fd = TEMP_FAILURE_RETRY(open(THE_DEVICE, O_RDWR));
- if(fd < 0) {
+ fd = TEMP_FAILURE_RETRY(open(file, O_WRONLY));
+ if (fd < 0) {
return -errno;
}
- to_write = snprintf(value, sizeof(value), "%u\n", timeout_ms);
+ to_write = strlen(value) + 1;
written = TEMP_FAILURE_RETRY(write(fd, value, to_write));
-
if (written == -1) {
ret = -errno;
} else if (written != to_write) {
/* even though EAGAIN is an errno value that could be set
by write() in some cases, none of them apply here. So, this return
value can be clearly identified when debugging and suggests the
- caller that it may try to call vibraror_on() again */
+ caller that it may try to call vibrator_on() again */
ret = -EAGAIN;
} else {
ret = 0;
@@ -73,6 +77,14 @@
return ret;
}
+static int sendit(unsigned int timeout_ms)
+{
+ char value[TIMEOUT_STR_LEN]; /* large enough for millions of years */
+
+ snprintf(value, sizeof(value), "%u", timeout_ms);
+ return write_value(THE_DEVICE, value);
+}
+
static int vibra_on(vibrator_device_t* vibradev __unused, unsigned int timeout_ms)
{
/* constant on, up to maximum allowed time */
@@ -84,6 +96,47 @@
return sendit(0);
}
+static const char LED_DEVICE[] = "/sys/class/leds/vibrator";
+
+static int write_led_file(const char *file, const char *value)
+{
+ char file_str[50];
+
+ snprintf(file_str, sizeof(file_str), "%s/%s", LED_DEVICE, file);
+ return write_value(file_str, value);
+}
+
+static bool vibra_led_exists()
+{
+ int fd;
+ char file_str[50];
+
+ snprintf(file_str, sizeof(file_str), "%s/%s", LED_DEVICE, "activate");
+ return device_exists(file_str);
+}
+
+static int vibra_led_on(vibrator_device_t* vibradev __unused, unsigned int timeout_ms)
+{
+ int ret;
+ char value[TIMEOUT_STR_LEN]; /* large enough for millions of years */
+
+ ret = write_led_file("state", "1");
+ if (ret)
+ return ret;
+
+ snprintf(value, sizeof(value), "%u\n", timeout_ms);
+ ret = write_led_file("duration", value);
+ if (ret)
+ return ret;
+
+ return write_led_file("activate", "1");
+}
+
+static int vibra_led_off(vibrator_device_t* vibradev __unused)
+{
+ return write_led_file("activate", "0");
+}
+
static int vibra_close(hw_device_t *device)
{
free(device);
@@ -92,7 +145,15 @@
static int vibra_open(const hw_module_t* module, const char* id __unused,
hw_device_t** device __unused) {
- if (!vibra_exists()) {
+ bool use_led;
+
+ if (vibra_exists()) {
+ ALOGD("Vibrator using timed_output");
+ use_led = false;
+ } else if (vibra_led_exists()) {
+ ALOGD("Vibrator using LED trigger");
+ use_led = true;
+ } else {
ALOGE("Vibrator device does not exist. Cannot start vibrator");
return -ENODEV;
}
@@ -109,8 +170,13 @@
vibradev->common.version = HARDWARE_DEVICE_API_VERSION(1,0);
vibradev->common.close = vibra_close;
- vibradev->vibrator_on = vibra_on;
- vibradev->vibrator_off = vibra_off;
+ if (use_led) {
+ vibradev->vibrator_on = vibra_led_on;
+ vibradev->vibrator_off = vibra_led_off;
+ } else {
+ vibradev->vibrator_on = vibra_on;
+ vibradev->vibrator_off = vibra_off;
+ }
*device = (hw_device_t *) vibradev;
diff --git a/tests/camera2/CameraMetadataTests.cpp b/tests/camera2/CameraMetadataTests.cpp
index da5b748..16b2dd9 100644
--- a/tests/camera2/CameraMetadataTests.cpp
+++ b/tests/camera2/CameraMetadataTests.cpp
@@ -16,8 +16,13 @@
#define LOG_NDEBUG 0
#define LOG_TAG "CameraMetadataTestFunctional"
-#include "cutils/log.h"
+
+#include <stdint.h>
+
+#include <string>
+
#include "cutils/properties.h"
+#include "log/log.h"
#include "utils/Errors.h"
#include "gtest/gtest.h"
@@ -31,8 +36,6 @@
#include <gui/CpuConsumer.h>
#include <gui/Surface.h>
-#include <string>
-
#include "CameraStreamFixture.h"
#include "TestExtensions.h"
diff --git a/tests/camera2/CameraModuleFixture.h b/tests/camera2/CameraModuleFixture.h
index 661c693..25513af 100644
--- a/tests/camera2/CameraModuleFixture.h
+++ b/tests/camera2/CameraModuleFixture.h
@@ -35,7 +35,7 @@
template <bool InfoQuirk = false>
struct CameraModuleFixture {
- CameraModuleFixture(int CameraID = -1) {
+ explicit CameraModuleFixture(int CameraID = -1) {
TEST_EXTENSION_FORKING_CONSTRUCTOR;
mCameraID = CameraID;
diff --git a/tests/camera2/CameraMultiStreamTests.cpp b/tests/camera2/CameraMultiStreamTests.cpp
index eb64db1..f4aeab7 100644
--- a/tests/camera2/CameraMultiStreamTests.cpp
+++ b/tests/camera2/CameraMultiStreamTests.cpp
@@ -334,7 +334,7 @@
int height,
const sp<CameraDeviceBase>& device,
CameraStreamParams param = DEFAULT_STREAM_PARAMETERS,
- sp<Surface> surface = NULL,
+ const sp<Surface>& surface = NULL,
bool useCpuConsumer = true) {
param.mFormat = MapAutoFormat(param.mFormat);
return new CameraStream(width, height, device,
diff --git a/tests/camera2/CameraStreamFixture.h b/tests/camera2/CameraStreamFixture.h
index bf7fb42..92ff05b 100644
--- a/tests/camera2/CameraStreamFixture.h
+++ b/tests/camera2/CameraStreamFixture.h
@@ -71,7 +71,7 @@
: public CameraModuleFixture</*InfoQuirk*/true> {
public:
- CameraStreamFixture(CameraStreamParams p)
+ explicit CameraStreamFixture(CameraStreamParams p)
: CameraModuleFixture(TestSettings::DeviceId()) {
TEST_EXTENSION_FORKING_CONSTRUCTOR;
diff --git a/tests/camera2/camera2_utils.cpp b/tests/camera2/camera2_utils.cpp
index c63c32a..dab0ae9 100644
--- a/tests/camera2/camera2_utils.cpp
+++ b/tests/camera2/camera2_utils.cpp
@@ -176,7 +176,7 @@
}
status_t MetadataQueue::freeBuffers(List<camera_metadata_t*>::iterator start,
- List<camera_metadata_t*>::iterator end) {
+ const List<camera_metadata_t*>::iterator& end) {
while (start != end) {
free_camera_metadata(*start);
start = mStreamSlot.erase(start);
diff --git a/tests/camera2/camera2_utils.h b/tests/camera2/camera2_utils.h
index ab1fcfb..274ee76 100644
--- a/tests/camera2/camera2_utils.h
+++ b/tests/camera2/camera2_utils.h
@@ -65,7 +65,7 @@
private:
status_t freeBuffers(List<camera_metadata_t*>::iterator start,
- List<camera_metadata_t*>::iterator end);
+ const List<camera_metadata_t*>::iterator& end);
camera2_device_t *mDevice;
@@ -166,7 +166,7 @@
*/
class StreamAdapter: public camera2_stream_ops {
public:
- StreamAdapter(sp<IGraphicBufferProducer> consumer);
+ explicit StreamAdapter(sp<IGraphicBufferProducer> consumer);
~StreamAdapter();
diff --git a/tests/fingerprint/Android.bp b/tests/fingerprint/Android.bp
new file mode 100644
index 0000000..7de3dee
--- /dev/null
+++ b/tests/fingerprint/Android.bp
@@ -0,0 +1,14 @@
+cc_test {
+ name: "fingerprint_tests",
+ srcs: ["fingerprint_tests.cpp"],
+
+ shared_libs: [
+ "liblog",
+ "libhardware",
+ ],
+
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ ],
+}
diff --git a/tests/fingerprint/Android.mk b/tests/fingerprint/Android.mk
deleted file mode 100644
index 4f03c39..0000000
--- a/tests/fingerprint/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- fingerprint_tests.cpp \
-
-LOCAL_SHARED_LIBRARIES := \
- liblog \
- libhardware \
-
-#LOCAL_C_INCLUDES += \
-# system/media/camera/include \
-
-LOCAL_CFLAGS += -Wall -Wextra
-
-LOCAL_MODULE:= fingerprint_tests
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_NATIVE_TEST)
diff --git a/tests/hardware/Android.bp b/tests/hardware/Android.bp
new file mode 100644
index 0000000..668e28f
--- /dev/null
+++ b/tests/hardware/Android.bp
@@ -0,0 +1,15 @@
+cc_library_static {
+ name: "static-hal-check",
+ srcs: [
+ "struct-size.cpp",
+ "struct-offset.cpp",
+ "struct-last.cpp",
+ ],
+ shared_libs: ["libhardware"],
+ cflags: [
+ "-std=gnu++11",
+ "-O0",
+ ],
+
+ include_dirs: ["system/media/camera/include"],
+}
diff --git a/tests/hardware/Android.mk b/tests/hardware/Android.mk
deleted file mode 100644
index 02540c9..0000000
--- a/tests/hardware/Android.mk
+++ /dev/null
@@ -1,12 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := static-hal-check
-LOCAL_SRC_FILES := struct-size.cpp struct-offset.cpp struct-last.cpp
-LOCAL_SHARED_LIBRARIES := libhardware
-LOCAL_CFLAGS := -std=gnu++11 -O0
-
-LOCAL_C_INCLUDES += \
- system/media/camera/include
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/tests/hwc/cnativewindow.c b/tests/hwc/cnativewindow.c
index 5c16afb..5b1d78e 100644
--- a/tests/hwc/cnativewindow.c
+++ b/tests/hwc/cnativewindow.c
@@ -37,7 +37,7 @@
static int trace_level = 1;
#define _TRACE(n,fmt...) \
- do { if (trace_level >= n) fprintf(stderr, "CNW: " fmt); } while (0)
+ do { if (trace_level >= (n)) fprintf(stderr, "CNW: " fmt); } while (0)
#define ERROR(fmt...) _TRACE(0, fmt)
#define INFO(fmt...) _TRACE(1, fmt)
diff --git a/tests/input/evdev/Android.mk b/tests/input/evdev/Android.mk
index 3aeb2f8..b892a7f 100644
--- a/tests/input/evdev/Android.mk
+++ b/tests/input/evdev/Android.mk
@@ -2,7 +2,6 @@
include $(CLEAR_VARS)
LOCAL_C_INCLUDES += hardware/libhardware/modules/input/evdev
-LOCAL_C_INCLUDES += $(TOP)/external/gmock/include
LOCAL_SRC_FILES:= \
BitUtils_test.cpp \
diff --git a/tests/input/evdev/InputHub_test.cpp b/tests/input/evdev/InputHub_test.cpp
index 64671ff..3d62152 100644
--- a/tests/input/evdev/InputHub_test.cpp
+++ b/tests/input/evdev/InputHub_test.cpp
@@ -50,9 +50,9 @@
mInputCb(kNoopInputCb), mDeviceAddedCb(kNoopDeviceCb), mDeviceRemovedCb(kNoopDeviceCb) {}
virtual ~TestInputCallback() = default;
- void setInputCallback(InputCbFunc cb) { mInputCb = cb; }
- void setDeviceAddedCallback(DeviceCbFunc cb) { mDeviceAddedCb = cb; }
- void setDeviceRemovedCallback(DeviceCbFunc cb) { mDeviceRemovedCb = cb; }
+ void setInputCallback(const InputCbFunc& cb) { mInputCb = cb; }
+ void setDeviceAddedCallback(const DeviceCbFunc& cb) { mDeviceAddedCb = cb; }
+ void setDeviceRemovedCallback(const DeviceCbFunc& cb) { mDeviceRemovedCb = cb; }
virtual void onInputEvent(const std::shared_ptr<InputDeviceNode>& node, InputEvent& event,
nsecs_t event_time) override {
diff --git a/tests/input/evdev/TestHelpers.h b/tests/input/evdev/TestHelpers.h
index 461db04..d26adfb 100644
--- a/tests/input/evdev/TestHelpers.h
+++ b/tests/input/evdev/TestHelpers.h
@@ -42,7 +42,7 @@
*/
class TempFile {
public:
- TempFile(const char* path);
+ explicit TempFile(const char* path);
~TempFile();
// No copy or assign
diff --git a/tests/keymaster/keymaster_test.cpp b/tests/keymaster/keymaster_test.cpp
index 6266d40..3040a5c 100644
--- a/tests/keymaster/keymaster_test.cpp
+++ b/tests/keymaster/keymaster_test.cpp
@@ -41,7 +41,7 @@
class UniqueBlob : public UniquePtr<uint8_t[]> {
public:
- UniqueBlob(size_t length) :
+ explicit UniqueBlob(size_t length) :
mLength(length) {
}
diff --git a/tests/nusensors/Android.bp b/tests/nusensors/Android.bp
new file mode 100644
index 0000000..e923468
--- /dev/null
+++ b/tests/nusensors/Android.bp
@@ -0,0 +1,10 @@
+cc_binary {
+ name: "test-nusensors",
+
+ srcs: ["nusensors.cpp"],
+
+ shared_libs: [
+ "libcutils",
+ "libhardware",
+ ],
+}
diff --git a/tests/nusensors/Android.mk b/tests/nusensors/Android.mk
deleted file mode 100644
index ef49096..0000000
--- a/tests/nusensors/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- nusensors.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libcutils libhardware
-
-LOCAL_MODULE:= test-nusensors
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_EXECUTABLE)
diff --git a/tests/nusensors/nusensors.cpp b/tests/nusensors/nusensors.cpp
index 55b7785..a063959 100644
--- a/tests/nusensors/nusensors.cpp
+++ b/tests/nusensors/nusensors.cpp
@@ -17,14 +17,15 @@
#include <inttypes.h>
#include <string.h>
#include <stdint.h>
+#include <stdio.h>
#include <string.h>
#include <sys/cdefs.h>
#include <sys/types.h>
-#include <cutils/log.h>
+#include <log/log.h>
+#include <utils/Timers.h>
#include <hardware/sensors.h>
-#include <utils/Timers.h>
char const* getSensorName(int type) {
switch(type) {
diff --git a/tests/vehicle/vehicle-hal-tool.c b/tests/vehicle/vehicle-hal-tool.c
index c93790a..94624d3 100755
--- a/tests/vehicle/vehicle-hal-tool.c
+++ b/tests/vehicle/vehicle-hal-tool.c
@@ -17,13 +17,15 @@
#define LOG_TAG "vehicle-hal-tool"
#include <inttypes.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+
+#include <log/log.h>
+
#include <hardware/hardware.h>
#include <hardware/vehicle.h>
-#include <cutils/log.h>
-
void usage() {
printf("Usage: "
"./vehicle-hal-tool [-l] [-m -p -t [-v]]\n"
@@ -98,6 +100,7 @@
memcpy(ascii_out, data->value.str_value.data, data->value.str_value.len);
ascii_out[data->value.str_value.len] = '\0';
printf("Value Type: STRING %s\n", ascii_out);
+ free(ascii_out);
break;
case VEHICLE_VALUE_TYPE_BYTES:
printf("Value type: BYTES\n Size: %d", data->value.bytes_value.len);