Merge "Fix format string warnings in InputHub.cpp."
diff --git a/Android.bp b/Android.bp
index f093c56..739cb6d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,5 +1,11 @@
// Copyright 2006 The Android Open Source Project
+cc_library_headers {
+ name: "libhardware_headers",
+ export_include_dirs: ["include"],
+ vendor_available: true,
+}
+
cc_library_shared {
name: "libhardware",
@@ -9,7 +15,10 @@
"liblog",
"libdl",
],
+ header_libs: ["libsystem_headers"],
cflags: ["-DQEMU_HARDWARE"],
+ export_include_dirs: ["include"],
+ vendor_available: true,
}
subdirs = [
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_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/audio_effect.h b/include/hardware/audio_effect.h
index e49980d..8a88414 100644
--- a/include/hardware/audio_effect.h
+++ b/include/hardware/audio_effect.h
@@ -911,6 +911,9 @@
char data[]; // Start of Parameter + Value data
} effect_param_t;
+// Maximum effect_param_t size
+#define EFFECT_PARAM_SIZE_MAX 65536
+
// structure used by EFFECT_CMD_OFFLOAD command
typedef struct effect_offload_param_s {
bool isOffload; // true if the playback thread the effect is attached to is offloaded
diff --git a/include/hardware/ble_advertiser.h b/include/hardware/ble_advertiser.h
index 45282aa..8abca00 100644
--- a/include/hardware/ble_advertiser.h
+++ b/include/hardware/ble_advertiser.h
@@ -34,41 +34,72 @@
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 Callback = base::Callback<void(uint8_t /* status */)>;
+ 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(
- base::Callback<void(uint8_t /* advertiser_id */,
- uint8_t /* status */)>) = 0;
+ virtual void RegisterAdvertiser(IdStatusCallback) = 0;
/* Set the parameters as per spec, user manual specified values */
- virtual void SetParameters(
- uint8_t advertiser_id, uint16_t advertising_event_properties,
- uint32_t min_interval, uint32_t max_interval, int chnl_map, int tx_power,
- uint8_t primary_advertising_phy, uint8_t secondary_advertising_phy,
- uint8_t scan_request_notification_enable, Callback cb) = 0;
+ 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, Callback cb) = 0;
+ std::vector<uint8_t> data, StatusCallback cb) = 0;
/* Enable the advertising instance */
- virtual void Enable(uint8_t advertiser_id, bool enable, Callback cb,
- int timeout_s, Callback timeout_cb) = 0;
+ 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, Callback cb,
+ 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, Callback timeout_cb) = 0;
+ 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
index 273cbc5..c8f9ec2 100644
--- a/include/hardware/ble_scanner.h
+++ b/include/hardware/ble_scanner.h
@@ -23,13 +23,6 @@
#include "bt_gatt_client.h"
#include "bt_gatt_types.h"
-/** 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,
@@ -42,10 +35,6 @@
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);
-
/** 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,
@@ -54,29 +43,11 @@
int8_t rssi, uint16_t periodic_adv_int,
std::vector<uint8_t> adv_data);
-/** 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);
-
typedef struct {
scan_result_callback scan_result_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;
- scan_filter_cfg_callback scan_filter_cfg_cb;
- scan_filter_param_callback scan_filter_param_cb;
- scan_filter_status_callback scan_filter_status_cb;
} btgatt_scanner_callbacks_t;
class BleScannerInterface {
@@ -86,6 +57,19 @@
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;
@@ -98,42 +82,58 @@
/** 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) = 0;
+ std::unique_ptr<btgatt_filt_param_setup_t> filt_param,
+ FilterParamSetupCallback cb) = 0;
/** Configure a scan filter condition */
- virtual void ScanFilterAddRemove(int client_if, int action, int filt_type,
- int filt_index, int company_id,
- int company_id_mask, const bt_uuid_t *p_uuid,
+ 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) = 0;
+ std::vector<uint8_t> p_mask,
+ FilterConfigCallback cb) = 0;
/** Clear all scan filter conditions for specific filter index*/
- virtual void ScanFilterClear(int client_if, int filt_index) = 0;
+ virtual void ScanFilterClear(int filt_index, FilterConfigCallback cb) = 0;
/** Enable / disable scan filter feature*/
- virtual void ScanFilterEnable(int client_if, bool enable) = 0;
+ 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 client_if, int scan_interval,
- int scan_window) = 0;
+ 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) = 0;
+ int batch_scan_notify_threshold,
+ Callback cb) = 0;
/* Enable batchscan */
- virtual void BatchscanEnable(int client_if, int scan_mode, int scan_interval,
- int scan_window, int addr_type,
- int discard_rule) = 0;
+ 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(int client_if) = 0;
+ 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 9870913..5d69ab3 100644
--- a/include/hardware/bluetooth.h
+++ b/include/hardware/bluetooth.h
@@ -163,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 */
diff --git a/include/hardware/bt_gatt_client.h b/include/hardware/bt_gatt_client.h
index 76b52fd..ec8dd16 100644
--- a/include/hardware/bt_gatt_client.h
+++ b/include/hardware/bt_gatt_client.h
@@ -166,6 +166,15 @@
/** 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;
connect_callback open_cb;
@@ -184,6 +193,8 @@
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. */
@@ -196,8 +207,8 @@
bt_status_t (*unregister_client)(int client_if );
/** 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,
@@ -255,6 +266,14 @@
bt_status_t (*conn_parameter_update)(const bt_bdaddr_t *bd_addr, int min_interval,
int max_interval, int latency, int timeout);
+ 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);
+
/** 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 b105cba..36259a1 100644
--- a/include/hardware/bt_gatt_server.h
+++ b/include/hardware/bt_gatt_server.h
@@ -105,6 +105,14 @@
/** 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;
@@ -120,6 +128,8 @@
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,6 +166,14 @@
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_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/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/hw_auth_token.h b/include/hardware/hw_auth_token.h
index d84ea48..3305f2c 100644
--- a/include/hardware/hw_auth_token.h
+++ b/include/hardware/hw_auth_token.h
@@ -23,7 +23,7 @@
extern "C" {
#endif // __cplusplus
-static const uint8_t HW_AUTH_TOKEN_VERSION = 0;
+#define HW_AUTH_TOKEN_VERSION 0
typedef enum {
HW_AUTH_NONE = 0,
diff --git a/include/hardware/nfc-base.h b/include/hardware/nfc-base.h
index d53e759..6b63ad2 100644
--- a/include/hardware/nfc-base.h
+++ b/include/hardware/nfc-base.h
@@ -1,32 +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_
+#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 = 0,
- HAL_NFC_CLOSE_CPLT_EVT = 1,
- HAL_NFC_POST_INIT_CPLT_EVT = 2,
- HAL_NFC_PRE_DISCOVER_CPLT_EVT = 3,
- HAL_NFC_REQUEST_CONTROL_EVT = 4,
- HAL_NFC_RELEASE_CONTROL_EVT = 5,
- HAL_NFC_ERROR_EVT = 6,
+ 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 = 0,
- HAL_NFC_STATUS_FAILED = 1,
- HAL_NFC_STATUS_ERR_TRANSPORT = 2,
- HAL_NFC_STATUS_ERR_CMD_TIMEOUT = 3,
- HAL_NFC_STATUS_REFUSED = 4,
+ 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_
+#endif // HIDL_GENERATED_ANDROID_HARDWARE_NFC_V1_0_EXPORTED_CONSTANTS_H_
diff --git a/modules/audio/Android.bp b/modules/audio/Android.bp
index 02da2b3..80cab19 100644
--- a/modules/audio/Android.bp
+++ b/modules/audio/Android.bp
@@ -24,7 +24,6 @@
srcs: ["audio_hw.c"],
shared_libs: [
"liblog",
- "libcutils",
],
cflags: ["-Wno-unused-parameter"],
}
@@ -41,7 +40,6 @@
srcs: ["audio_hw.c"],
shared_libs: [
"liblog",
- "libcutils",
],
cflags: ["-Wno-unused-parameter"],
}
@@ -54,7 +52,6 @@
srcs: ["audio_policy.c"],
shared_libs: [
"liblog",
- "libcutils",
],
cflags: ["-Wno-unused-parameter"],
}
diff --git a/modules/audio/audio_hw.c b/modules/audio/audio_hw.c
index 35901e4..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;
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/CameraHAL.cpp b/modules/camera/CameraHAL.cpp
index e395ce5..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"
/*
diff --git a/modules/camera/ExampleCamera.cpp b/modules/camera/ExampleCamera.cpp
index d060d35..473cb60 100644
--- a/modules/camera/ExampleCamera.cpp
+++ b/modules/camera/ExampleCamera.cpp
@@ -13,17 +13,18 @@
* 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]))
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 48c1a46..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 {
diff --git a/modules/consumerir/Android.bp b/modules/consumerir/Android.bp
index bbce6b1..4ee5fb1 100644
--- a/modules/consumerir/Android.bp
+++ b/modules/consumerir/Android.bp
@@ -18,6 +18,5 @@
srcs: ["consumerir.c"],
shared_libs: [
"liblog",
- "libcutils",
],
}
diff --git a/modules/consumerir/consumerir.c b/modules/consumerir/consumerir.c
index b0ff940..f2cc623 100644
--- a/modules/consumerir/consumerir.c
+++ b/modules/consumerir/consumerir.c
@@ -17,10 +17,14 @@
#include <errno.h>
#include <malloc.h>
+#include <stdlib.h>
#include <string.h>
-#include <cutils/log.h>
-#include <hardware/hardware.h>
+#include <unistd.h>
+
+#include <log/log.h>
+
#include <hardware/consumerir.h>
+#include <hardware/hardware.h>
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
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/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/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/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/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/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 09f07b1..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,
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/multihal.cpp b/modules/sensors/multihal.cpp
index 7044551..f38d90d 100644
--- a/modules/sensors/multihal.cpp
+++ b/modules/sensors/multihal.cpp
@@ -199,6 +199,7 @@
int poll(sensors_event_t* data, int count);
int batch(int handle, int flags, int64_t period_ns, int64_t timeout);
int flush(int handle);
+ int inject_sensor_data(struct sensors_poll_device_1 *dev, const sensors_event_t *data);
int close();
std::vector<hw_device_t*> sub_hw_devices;
@@ -267,6 +268,11 @@
return version != -1 && HAL_VERSION_IS_COMPLIANT(version);
}
+static bool halIsAPILevelCompliant(sensors_poll_context_t *ctx, int handle, int level) {
+ int version = ctx->get_device_version_by_handle(handle);
+ return version != -1 && (version >= level);
+}
+
const char *apiNumToStr(int version) {
switch(version) {
case SENSORS_DEVICE_API_VERSION_1_0:
@@ -277,6 +283,8 @@
return "SENSORS_DEVICE_API_VERSION_1_2";
case SENSORS_DEVICE_API_VERSION_1_3:
return "SENSORS_DEVICE_API_VERSION_1_3";
+ case SENSORS_DEVICE_API_VERSION_1_4:
+ return "SENSORS_DEVICE_API_VERSION_1_4";
default:
return "UNKNOWN";
}
@@ -403,6 +411,25 @@
return retval;
}
+int sensors_poll_context_t::inject_sensor_data(struct sensors_poll_device_1 *dev,
+ const sensors_event_t *data) {
+ int retval = -EINVAL;
+ ALOGV("inject_sensor_data");
+ // Get handle for the sensor owning the event being injected
+ int local_handle = get_local_handle(data->sensor);
+ sensors_poll_device_1_t* v1 = this->get_v1_device_by_handle(data->sensor);
+ if (halIsAPILevelCompliant(this, data->sensor, SENSORS_DEVICE_API_VERSION_1_4) &&
+ local_handle >= 0 && v1) {
+ retval = v1->inject_sensor_data(dev, data);
+ } else {
+ ALOGE("IGNORED inject_sensor_data(type=%d, handle=%d) call to non-API-compliant sensor",
+ data->type, data->sensor);
+ }
+ ALOGV("retval %d", retval);
+ return retval;
+
+}
+
int sensors_poll_context_t::close() {
ALOGV("close");
for (std::vector<hw_device_t*>::iterator it = this->sub_hw_devices.begin();
@@ -453,6 +480,12 @@
return ctx->flush(handle);
}
+static int device__inject_sensor_data(struct sensors_poll_device_1 *dev,
+ const sensors_event_t *data) {
+ sensors_poll_context_t* ctx = (sensors_poll_context_t*) dev;
+ return ctx->inject_sensor_data(dev, data);
+}
+
static int open_sensors(const struct hw_module_t* module, const char* name,
struct hw_device_t** device);
@@ -637,7 +670,7 @@
sensors_poll_context_t *dev = new sensors_poll_context_t();
memset(dev, 0, sizeof(sensors_poll_device_1_t));
dev->proxy_device.common.tag = HARDWARE_DEVICE_TAG;
- dev->proxy_device.common.version = SENSORS_DEVICE_API_VERSION_1_3;
+ dev->proxy_device.common.version = SENSORS_DEVICE_API_VERSION_1_4;
dev->proxy_device.common.module = const_cast<hw_module_t*>(hw_module);
dev->proxy_device.common.close = device__close;
dev->proxy_device.activate = device__activate;
@@ -645,6 +678,7 @@
dev->proxy_device.poll = device__poll;
dev->proxy_device.batch = device__batch;
dev->proxy_device.flush = device__flush;
+ dev->proxy_device.inject_sensor_data = device__inject_sensor_data;
dev->nextReadIndex = 0;
@@ -656,7 +690,7 @@
int sub_open_result = sensors_module->common.methods->open(*it, name, &sub_hw_device);
if (!sub_open_result) {
if (!HAL_VERSION_IS_COMPLIANT(sub_hw_device->version)) {
- ALOGE("SENSORS_DEVICE_API_VERSION_1_3 is required for all sensor HALs");
+ ALOGE("SENSORS_DEVICE_API_VERSION_1_3 or newer is required for all sensor HALs");
ALOGE("This HAL reports non-compliant API level : %s",
apiNumToStr(sub_hw_device->version));
ALOGE("Sensors belonging to this HAL will get ignored !");
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/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/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/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 d0aaded..ec949ae 100644
--- a/modules/usbcamera/UsbCamera.cpp
+++ b/modules/usbcamera/UsbCamera.cpp
@@ -16,13 +16,16 @@
//#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"
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/vibrator.c b/modules/vibrator/vibrator.c
index c3c2951..950bc59 100644
--- a/modules/vibrator/vibrator.c
+++ b/modules/vibrator/vibrator.c
@@ -14,34 +14,38 @@
* limitations under the License.
*/
-#include <hardware/vibrator.h>
#include <hardware/hardware.h>
+#include <hardware/vibrator.h>
-#include <cutils/log.h>
-
+#include <errno.h>
+#include <fcntl.h>
#include <malloc.h>
-#include <stdio.h>
+#include <math.h>
#include <stdbool.h>
+#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <math.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) {
- return 0;
+ return false;
}
close(fd);
- return 1;
+ return true;
+}
+
+static bool vibra_exists() {
+ return device_exists(THE_DEVICE);
}
static int write_value(const char *file, const char *value)
@@ -102,9 +106,13 @@
return write_value(file_str, value);
}
-static int vibra_led_exists()
+static bool vibra_led_exists()
{
- return !write_led_file("trigger", "transient");
+ 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)
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/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 e85df62..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"