DO NOT MERGE - Merge QQ1A.200205.002 into master
Bug: 147428392
Change-Id: I92ed91736a7fdb8f03a720d945f859cc49b430ac
diff --git a/include/hardware/audio.h b/include/hardware/audio.h
index feebd23..b047fa0 100644
--- a/include/hardware/audio.h
+++ b/include/hardware/audio.h
@@ -56,7 +56,8 @@
#define AUDIO_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0)
#define AUDIO_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0)
#define AUDIO_DEVICE_API_VERSION_3_0 HARDWARE_DEVICE_API_VERSION(3, 0)
-#define AUDIO_DEVICE_API_VERSION_CURRENT AUDIO_DEVICE_API_VERSION_3_0
+#define AUDIO_DEVICE_API_VERSION_3_1 HARDWARE_DEVICE_API_VERSION(3, 1)
+#define AUDIO_DEVICE_API_VERSION_CURRENT AUDIO_DEVICE_API_VERSION_3_1
/* Minimal audio HAL version supported by the audio framework */
#define AUDIO_DEVICE_API_VERSION_MIN AUDIO_DEVICE_API_VERSION_2_0
@@ -825,6 +826,31 @@
int (*set_audio_port_config)(struct audio_hw_device *dev,
const struct audio_port_config *config);
+ /**
+ * Applies an audio effect to an audio device.
+ *
+ * @param dev the audio HAL device context.
+ * @param device identifies the sink or source device the effect must be applied to.
+ * "device" is the audio_port_handle_t indicated for the device when
+ * the audio patch connecting that device was created.
+ * @param effect effect interface handle corresponding to the effect being added.
+ * @return retval operation completion status.
+ */
+ int (*add_device_effect)(struct audio_hw_device *dev,
+ audio_port_handle_t device, effect_handle_t effect);
+
+ /**
+ * Stops applying an audio effect to an audio device.
+ *
+ * @param dev the audio HAL device context.
+ * @param device identifies the sink or source device this effect was applied to.
+ * "device" is the audio_port_handle_t indicated for the device when
+ * the audio patch is created.
+ * @param effect effect interface handle corresponding to the effect being removed.
+ * @return retval operation completion status.
+ */
+ int (*remove_device_effect)(struct audio_hw_device *dev,
+ audio_port_handle_t device, effect_handle_t effect);
};
typedef struct audio_hw_device audio_hw_device_t;
diff --git a/include/hardware/audio_effect.h b/include/hardware/audio_effect.h
index 3366e17..a2809ba 100644
--- a/include/hardware/audio_effect.h
+++ b/include/hardware/audio_effect.h
@@ -207,6 +207,8 @@
// Note that EffectsFactory.c only checks the major version component, so changes to the minor
// number can only be used for fully backwards compatible changes
#define EFFECT_LIBRARY_API_VERSION EFFECT_MAKE_API_VERSION(3,0)
+#define EFFECT_LIBRARY_API_VERSION_3_0 EFFECT_MAKE_API_VERSION(3,0)
+#define EFFECT_LIBRARY_API_VERSION_3_1 EFFECT_MAKE_API_VERSION(3,1)
#define AUDIO_EFFECT_LIBRARY_TAG ((('A') << 24) | (('E') << 16) | (('L') << 8) | ('T'))
@@ -297,6 +299,48 @@
////////////////////////////////////////////////////////////////////////////////
int32_t (*get_descriptor)(const effect_uuid_t *uuid,
effect_descriptor_t *pDescriptor);
+
+ ////////////////////////////////////////////////////////////////////////////////
+ //
+ // Function: create_effect_3_1
+ //
+ // Description: Creates an effect engine of the specified implementation uuid and
+ // returns an effect control interface on this engine. The function will allocate the
+ // resources for an instance of the requested effect engine and return
+ // a handle on the effect control interface.
+ //
+ // Input:
+ // uuid: pointer to the effect uuid.
+ // sessionId: audio session to which this effect instance will be attached.
+ // All effects created with the same session ID are connected in series and process
+ // the same signal stream. Knowing that two effects are part of the same effect
+ // chain can help the library implement some kind of optimizations.
+ // ioId: identifies the output or input stream this effect is directed to in
+ // audio HAL.
+ // For future use especially with tunneled HW accelerated effects
+ // deviceId: identifies the sink or source device this effect is directed to in
+ // audio HAL. Must be specified if sessionId is AUDIO_SESSION_DEVICE and is
+ // ignored otherwise.
+ // deviceId is the audio_port_handle_t used for the device when the audio
+ // patch is created at the audio HAL.
+ //
+ // Input/Output:
+ // pHandle: address where to return the effect interface handle.
+ //
+ // Output:
+ // returned value: 0 successful operation.
+ // -ENODEV library failed to initialize
+ // -EINVAL invalid pEffectUuid or pHandle
+ // -ENOENT no effect with this uuid found
+ // *pHandle: updated with the effect interface handle.
+ //
+ ////////////////////////////////////////////////////////////////////////////////
+ int32_t (*create_effect_3_1)(const effect_uuid_t *uuid,
+ int32_t sessionId,
+ int32_t ioId,
+ int32_t deviceId,
+ effect_handle_t *pHandle);
+
} audio_effect_library_t;
// Name of the hal_module_info
diff --git a/include/hardware/keymaster_defs.h b/include/hardware/keymaster_defs.h
index eca484c..d92ce00 100644
--- a/include/hardware/keymaster_defs.h
+++ b/include/hardware/keymaster_defs.h
@@ -75,6 +75,8 @@
/* Other hardware-enforced. */
KM_TAG_BLOB_USAGE_REQUIREMENTS = KM_ENUM | 301, /* keymaster_key_blob_usage_requirements_t */
KM_TAG_BOOTLOADER_ONLY = KM_BOOL | 302, /* Usable only by bootloader */
+ KM_TAG_ROLLBACK_RESISTANCE = KM_BOOL | 303, /* Hardware enforced deletion with deleteKey
+ * or deleteAllKeys is supported */
/*
* Tags that should be semantically enforced by hardware if possible and will otherwise be
@@ -456,6 +458,7 @@
KM_ERROR_KEYMASTER_NOT_CONFIGURED = -64,
KM_ERROR_ATTESTATION_APPLICATION_ID_MISSING = -65,
KM_ERROR_CANNOT_ATTEST_IDS = -66,
+ KM_ERROR_ROLLBACK_RESISTANCE_UNAVAILABLE = -67,
KM_ERROR_NO_USER_CONFIRMATION = -71,
KM_ERROR_DEVICE_LOCKED = -72,
diff --git a/modules/audio_remote_submix/Android.bp b/modules/audio_remote_submix/Android.bp
index c7d018c..9523438 100644
--- a/modules/audio_remote_submix/Android.bp
+++ b/modules/audio_remote_submix/Android.bp
@@ -17,16 +17,13 @@
relative_install_path: "hw",
vendor: true,
srcs: ["audio_hw.cpp"],
- include_dirs: [
- "system/media/audio_utils/include",
- ],
shared_libs: [
"liblog",
"libcutils",
- "libutils",
+ "libmedia_helper",
"libnbaio_mono",
+ "libutils",
],
- static_libs: ["libmedia_helper"],
cflags: ["-Wno-unused-parameter"],
diff --git a/modules/audio_remote_submix/audio_hw.cpp b/modules/audio_remote_submix/audio_hw.cpp
index 833c12b..dda0d0e 100644
--- a/modules/audio_remote_submix/audio_hw.cpp
+++ b/modules/audio_remote_submix/audio_hw.cpp
@@ -472,7 +472,7 @@
rsxadev->routes[route_idx].rsxSource.clear();
}
memset(rsxadev->routes[route_idx].address, 0, AUDIO_DEVICE_MAX_ADDRESS_LEN);
-#ifdef ENABLE_RESAMPLING
+#if ENABLE_RESAMPLING
memset(rsxadev->routes[route_idx].resampler_buffer, 0,
sizeof(int16_t) * DEFAULT_PIPE_SIZE_IN_FRAMES);
#endif
@@ -499,7 +499,9 @@
}
ALOGV("submix_audio_device_destroy_pipe_l(): input ref_count %d", in->ref_count);
#else
- rsxadev->input = NULL;
+ route_idx = in->route_handle;
+ ALOG_ASSERT(rsxadev->routes[route_idx].input == in);
+ rsxadev->routes[route_idx].input = NULL;
shut_down = true;
#endif // ENABLE_LEGACY_INPUT_OPEN
if (shut_down) {
@@ -960,7 +962,7 @@
{
(void)stream;
(void)timestamp;
- return -EINVAL;
+ return -ENOSYS;
}
/** audio_stream_in implementation **/
@@ -1552,6 +1554,9 @@
}
const size_t frame_size_in_bytes = audio_channel_count_from_in_mask(config->channel_mask) *
audio_bytes_per_sample(config->format);
+ if (max_buffer_period_size_frames == 0) {
+ max_buffer_period_size_frames = DEFAULT_PIPE_SIZE_IN_FRAMES;
+ }
const size_t buffer_size = max_buffer_period_size_frames * frame_size_in_bytes;
SUBMIX_ALOGV("adev_get_input_buffer_size() returns %zu bytes, %zu frames",
buffer_size, max_buffer_period_size_frames);
@@ -1623,7 +1628,9 @@
if (!in) {
in = (struct submix_stream_in *)calloc(1, sizeof(struct submix_stream_in));
if (!in) return -ENOMEM;
+#if ENABLE_LEGACY_INPUT_OPEN
in->ref_count = 1;
+#endif
// Initialize the function pointer tables (v-tables).
in->stream.common.get_sample_rate = in_get_sample_rate;
@@ -1714,10 +1721,16 @@
int n = snprintf(msg, sizeof(msg), "\nReroute submix audio module:\n");
write(fd, &msg, n);
for (int i=0 ; i < MAX_ROUTES ; i++) {
+#if ENABLE_RESAMPLING
n = snprintf(msg, sizeof(msg), " route[%d] rate in=%d out=%d, addr=[%s]\n", i,
rsxadev->routes[i].config.input_sample_rate,
rsxadev->routes[i].config.output_sample_rate,
rsxadev->routes[i].address);
+#else
+ n = snprintf(msg, sizeof(msg), " route[%d], rate=%d addr=[%s]\n", i,
+ rsxadev->routes[i].config.common.sample_rate,
+ rsxadev->routes[i].address);
+#endif
write(fd, &msg, n);
}
return 0;
diff --git a/modules/camera/3_4/arc/exif_utils.cpp b/modules/camera/3_4/arc/exif_utils.cpp
index 5e8c756..e951e83 100644
--- a/modules/camera/3_4/arc/exif_utils.cpp
+++ b/modules/camera/3_4/arc/exif_utils.cpp
@@ -475,15 +475,15 @@
bool ExifUtils::GenerateYuvThumbnail(std::vector<uint8_t>* scaled_buffer) {
size_t y_plane_size = yu12_width_ * yu12_height_;
- const uint8* y_plane = yu12_buffer_;
- const uint8* u_plane = y_plane + y_plane_size;
- const uint8* v_plane = u_plane + y_plane_size / 4;
+ const uint8_t* y_plane = yu12_buffer_;
+ const uint8_t* u_plane = y_plane + y_plane_size;
+ const uint8_t* v_plane = u_plane + y_plane_size / 4;
size_t scaled_y_plane_size = thumbnail_width_ * thumbnail_height_;
scaled_buffer->resize(scaled_y_plane_size * 3 / 2);
- uint8* scaled_y_plane = scaled_buffer->data();
- uint8* scaled_u_plane = scaled_y_plane + scaled_y_plane_size;
- uint8* scaled_v_plane = scaled_u_plane + scaled_y_plane_size / 4;
+ uint8_t* scaled_y_plane = scaled_buffer->data();
+ uint8_t* scaled_u_plane = scaled_y_plane + scaled_y_plane_size;
+ uint8_t* scaled_v_plane = scaled_u_plane + scaled_y_plane_size / 4;
int result = libyuv::I420Scale(
y_plane, yu12_width_, u_plane, yu12_width_ / 2, v_plane, yu12_width_ / 2,
diff --git a/modules/gralloc/framebuffer.cpp b/modules/gralloc/framebuffer.cpp
index c171711..b2ec3e4 100644
--- a/modules/gralloc/framebuffer.cpp
+++ b/modules/gralloc/framebuffer.cpp
@@ -117,7 +117,7 @@
/*****************************************************************************/
-int mapFrameBufferLocked(struct private_module_t* module)
+int mapFrameBufferLocked(struct private_module_t* module, int format)
{
// already initialized...
if (module->framebuffer) {
@@ -161,6 +161,20 @@
*/
info.yres_virtual = info.yres * NUM_BUFFERS;
+ switch (format) {
+ case HAL_PIXEL_FORMAT_RGBA_8888:
+ info.bits_per_pixel = 32;
+ info.red.offset = 0;
+ info.red.length = 8;
+ info.green.offset = 8;
+ info.green.length = 8;
+ info.blue.offset = 16;
+ info.blue.length = 8;
+ break;
+ default:
+ ALOGW("unknown format: %d", format);
+ break;
+ }
uint32_t flags = PAGE_FLIP;
#if USE_PAN_DISPLAY
@@ -280,7 +294,8 @@
static int mapFrameBuffer(struct private_module_t* module)
{
pthread_mutex_lock(&module->lock);
- int err = mapFrameBufferLocked(module);
+ // Request RGBA8888 because the platform assumes support for RGBA8888.
+ int err = mapFrameBufferLocked(module, HAL_PIXEL_FORMAT_RGBA_8888);
pthread_mutex_unlock(&module->lock);
return err;
}
diff --git a/modules/gralloc/gr.h b/modules/gralloc/gr.h
index ac7e967..14fe6a0 100644
--- a/modules/gralloc/gr.h
+++ b/modules/gralloc/gr.h
@@ -36,7 +36,7 @@
return (x + (PAGE_SIZE-1)) & ~(PAGE_SIZE-1);
}
-int mapFrameBufferLocked(struct private_module_t* module);
+int mapFrameBufferLocked(struct private_module_t* module, int format);
int terminateBuffer(gralloc_module_t const* module, private_handle_t* hnd);
int mapBuffer(gralloc_module_t const* module, private_handle_t* hnd);
diff --git a/modules/gralloc/gralloc.cpp b/modules/gralloc/gralloc.cpp
index 07bbfba..87bda97 100644
--- a/modules/gralloc/gralloc.cpp
+++ b/modules/gralloc/gralloc.cpp
@@ -101,7 +101,7 @@
/*****************************************************************************/
static int gralloc_alloc_framebuffer_locked(alloc_device_t* dev,
- size_t size, int usage, buffer_handle_t* pHandle)
+ size_t size, int format, int usage, buffer_handle_t* pHandle)
{
private_module_t* m = reinterpret_cast<private_module_t*>(
dev->common.module);
@@ -110,7 +110,7 @@
if (m->framebuffer == NULL) {
// initialize the framebuffer, the framebuffer is mapped once
// and forever.
- int err = mapFrameBufferLocked(m);
+ int err = mapFrameBufferLocked(m, format);
if (err < 0) {
return err;
}
@@ -154,12 +154,12 @@
}
static int gralloc_alloc_framebuffer(alloc_device_t* dev,
- size_t size, int usage, buffer_handle_t* pHandle)
+ size_t size, int format, int usage, buffer_handle_t* pHandle)
{
private_module_t* m = reinterpret_cast<private_module_t*>(
dev->common.module);
pthread_mutex_lock(&m->lock);
- int err = gralloc_alloc_framebuffer_locked(dev, size, usage, pHandle);
+ int err = gralloc_alloc_framebuffer_locked(dev, size, format, usage, pHandle);
pthread_mutex_unlock(&m->lock);
return err;
}
@@ -236,7 +236,7 @@
int err;
if (usage & GRALLOC_USAGE_HW_FB) {
- err = gralloc_alloc_framebuffer(dev, size, usage, pHandle);
+ err = gralloc_alloc_framebuffer(dev, size, format, usage, pHandle);
} else {
err = gralloc_alloc_buffer(dev, size, usage, pHandle);
}
diff --git a/modules/input/evdev/InputDevice.cpp b/modules/input/evdev/InputDevice.cpp
index 3b72f1f..a1bce64 100644
--- a/modules/input/evdev/InputDevice.cpp
+++ b/modules/input/evdev/InputDevice.cpp
@@ -37,8 +37,6 @@
#include "MouseInputMapper.h"
#include "SwitchInputMapper.h"
-#define MSC_ANDROID_TIME_SEC 0x6
-#define MSC_ANDROID_TIME_USEC 0x7
namespace android {
@@ -240,25 +238,6 @@
event.value);
#endif
- if (event.type == EV_MSC) {
- if (event.code == MSC_ANDROID_TIME_SEC) {
- mOverrideSec = event.value;
- } else if (event.code == MSC_ANDROID_TIME_USEC) {
- mOverrideUsec = event.value;
- }
- return;
- }
-
- if (mOverrideSec || mOverrideUsec) {
- event.when = s2ns(mOverrideSec) + us2ns(mOverrideUsec);
- ALOGV("applied override time %d.%06d", mOverrideSec, mOverrideUsec);
-
- if (event.type == EV_SYN && event.code == SYN_REPORT) {
- mOverrideSec = 0;
- mOverrideUsec = 0;
- }
- }
-
// Bug 7291243: Add a guard in case the kernel generates timestamps
// that appear to be far into the future because they were generated
// using the wrong clock source.
diff --git a/modules/input/evdev/InputDevice.h b/modules/input/evdev/InputDevice.h
index 6892778..a1e9e98 100644
--- a/modules/input/evdev/InputDevice.h
+++ b/modules/input/evdev/InputDevice.h
@@ -72,9 +72,6 @@
InputDeviceHandle* mDeviceHandle = nullptr;
std::vector<std::unique_ptr<InputMapper>> mMappers;
uint32_t mClasses = 0;
-
- int32_t mOverrideSec = 0;
- int32_t mOverrideUsec = 0;
};
/* Input device classes. */
diff --git a/modules/input/evdev/SwitchInputMapper.cpp b/modules/input/evdev/SwitchInputMapper.cpp
index bb79d01..1b2e749 100644
--- a/modules/input/evdev/SwitchInputMapper.cpp
+++ b/modules/input/evdev/SwitchInputMapper.cpp
@@ -47,13 +47,26 @@
{SW_FRONT_PROXIMITY, INPUT_USAGE_SWITCH_UNKNOWN},
{SW_ROTATE_LOCK, INPUT_USAGE_SWITCH_UNKNOWN},
{SW_LINEIN_INSERT, INPUT_USAGE_SWITCH_UNKNOWN},
- {0x0e /* unused */, INPUT_USAGE_SWITCH_UNKNOWN},
+ {SW_MUTE_DEVICE, INPUT_USAGE_SWITCH_UNKNOWN},
+ {SW_PEN_INSERTED, INPUT_USAGE_SWITCH_UNKNOWN},
+ {SW_HPHL_OVERCURRENT, INPUT_USAGE_SWITCH_UNKNOWN},
+ {SW_HPHR_OVERCURRENT, INPUT_USAGE_SWITCH_UNKNOWN},
+ {SW_UNSUPPORT_INSERT, INPUT_USAGE_SWITCH_UNKNOWN},
+ {0x13 /* unused */, INPUT_USAGE_SWITCH_UNKNOWN},
+ {0x14 /* unused */, INPUT_USAGE_SWITCH_UNKNOWN},
+ {0x15 /* unused */, INPUT_USAGE_SWITCH_UNKNOWN},
+ {0x16 /* unused */, INPUT_USAGE_SWITCH_UNKNOWN},
+ {0x17 /* unused */, INPUT_USAGE_SWITCH_UNKNOWN},
+ {0x18 /* unused */, INPUT_USAGE_SWITCH_UNKNOWN},
+ {0x19 /* unused */, INPUT_USAGE_SWITCH_UNKNOWN},
{SW_MAX, INPUT_USAGE_SWITCH_UNKNOWN},
};
SwitchInputMapper::SwitchInputMapper()
: InputMapper() {
- static_assert(SW_CNT <= 32, "More than 32 switches defined in linux/input.h");
+ // If this gets larger than 64, then the mSwitchValues and mUpdatedSwitchMask
+ // variables need to be changed to support more than 64 bits.
+ static_assert(SW_CNT <= 64, "More than 64 switches defined in linux/input.h");
}
bool SwitchInputMapper::configureInputReport(InputDeviceNode* devNode,
diff --git a/modules/input/evdev/SwitchInputMapper.h b/modules/input/evdev/SwitchInputMapper.h
index e25c3a5..dbd5a03 100644
--- a/modules/input/evdev/SwitchInputMapper.h
+++ b/modules/input/evdev/SwitchInputMapper.h
@@ -39,8 +39,8 @@
void processSwitch(int32_t switchCode, int32_t switchValue);
void sync(nsecs_t when);
- BitSet32 mSwitchValues;
- BitSet32 mUpdatedSwitchMask;
+ BitSet64 mSwitchValues;
+ BitSet64 mUpdatedSwitchMask;
};
} // namespace android
diff --git a/modules/sensors/OWNERS b/modules/sensors/OWNERS
index 81099e8..90c2330 100644
--- a/modules/sensors/OWNERS
+++ b/modules/sensors/OWNERS
@@ -1,3 +1,3 @@
arthuri@google.com
bduddie@google.com
-bstack@google.com
+stange@google.com
diff --git a/modules/sensors/dynamic_sensor/Android.bp b/modules/sensors/dynamic_sensor/Android.bp
index 489cdf4..214d97c 100644
--- a/modules/sensors/dynamic_sensor/Android.bp
+++ b/modules/sensors/dynamic_sensor/Android.bp
@@ -22,8 +22,6 @@
"-Wall",
"-Werror",
"-Wextra",
- // Allow implicit fallthroughs in HidRawSensor.cpp until they are fixed.
- "-Wno-error=implicit-fallthrough",
],
export_include_dirs: ["."],
diff --git a/modules/sensors/dynamic_sensor/DynamicSensorManager.cpp b/modules/sensors/dynamic_sensor/DynamicSensorManager.cpp
index b634052..37b4313 100644
--- a/modules/sensors/dynamic_sensor/DynamicSensorManager.cpp
+++ b/modules/sensors/dynamic_sensor/DynamicSensorManager.cpp
@@ -111,8 +111,8 @@
if (handle == mHandleRange.first) {
// submit a flush complete here
static const sensors_event_t event = {
- .type = SENSOR_TYPE_META_DATA,
.sensor = mHandleRange.first,
+ .type = SENSOR_TYPE_META_DATA,
.timestamp = TIMESTAMP_AUTO_FILL, // timestamp will be filled at dispatcher
};
submitEvent(nullptr, event);
diff --git a/modules/sensors/dynamic_sensor/HidRawSensor.cpp b/modules/sensors/dynamic_sensor/HidRawSensor.cpp
index 4668412..f3c8a27 100644
--- a/modules/sensors/dynamic_sensor/HidRawSensor.cpp
+++ b/modules/sensors/dynamic_sensor/HidRawSensor.cpp
@@ -177,13 +177,13 @@
}
ReportTranslateRecord record = {
- .minValue = digest.minRaw,
+ .type = TYPE_FLOAT,
.maxValue = digest.maxRaw,
+ .minValue = digest.minRaw,
.byteOffset = digest.bitOffset / 8,
.byteSize = digest.bitSize / 8,
.a = digest.a,
.b = digest.b,
- .type = TYPE_FLOAT
};
// keep track of range and resolution
range = std::max(std::max(std::abs((digest.maxRaw + digest.b) * digest.a),
@@ -250,12 +250,12 @@
}
ReportTranslateRecord record = {
- .minValue = quat.minRaw,
+ .type = TYPE_FLOAT,
.maxValue = quat.maxRaw,
+ .minValue = quat.minRaw,
.byteOffset = quat.bitOffset / 8,
.byteSize = quat.bitSize / 8,
.b = quat.b,
- .type = TYPE_FLOAT,
};
// Android X Y Z maps to HID X -Z Y
@@ -351,10 +351,10 @@
mFeatureInfo.reportModeFlag = SENSOR_FLAG_CONTINUOUS_MODE;
ReportTranslateRecord record = {
- .minValue = reportX.minRaw,
+ .type = TYPE_FLOAT,
.maxValue = reportX.maxRaw,
+ .minValue = reportX.minRaw,
.byteSize = reportX.bitSize / 8,
- .type = TYPE_FLOAT
};
// Reorder and swap axis
diff --git a/modules/sensors/dynamic_sensor/HidUtils/HidParser.cpp b/modules/sensors/dynamic_sensor/HidUtils/HidParser.cpp
index 5efaf65..264f13c 100644
--- a/modules/sensors/dynamic_sensor/HidUtils/HidParser.cpp
+++ b/modules/sensors/dynamic_sensor/HidUtils/HidParser.cpp
@@ -231,9 +231,9 @@
// template
ReportPacket packet = {
+ .bitSize = 0,
.type = type,
.id = id,
- .bitSize = 0
};
for (const auto &r : reports) {
@@ -252,10 +252,10 @@
.maxRaw = logical.second,
.a = scale,
.b = offset,
+ .unit = r.getUnit(),
.bitOffset = packet.bitSize,
.bitSize = r.getSize(),
.count = r.getCount(),
- .unit = r.getUnit(),
};
packet.reports.push_back(digest);
packet.bitSize += digest.bitSize * digest.count;
diff --git a/tests/input/evdev/InputDevice_test.cpp b/tests/input/evdev/InputDevice_test.cpp
index bd57491..8f8a94b 100644
--- a/tests/input/evdev/InputDevice_test.cpp
+++ b/tests/input/evdev/InputDevice_test.cpp
@@ -31,8 +31,6 @@
// # of milliseconds to allow for timing measurements
#define TIMING_TOLERANCE_MS 25
-#define MSC_ANDROID_TIME_SEC 0x6
-#define MSC_ANDROID_TIME_USEC 0x7
using ::testing::_;
using ::testing::NiceMock;
@@ -66,35 +64,6 @@
NiceMock<MockInputDeviceDefinition> mDeviceDef;
};
-TEST_F(EvdevDeviceTest, testOverrideTime) {
- auto node = std::make_shared<MockInputDeviceNode>();
- auto device = std::make_unique<EvdevDevice>(&mHost, node);
- ASSERT_TRUE(device != nullptr);
-
- // Send two timestamp override events before an input event.
- nsecs_t when = 2ULL;
- InputEvent msc1 = { when, EV_MSC, MSC_ANDROID_TIME_SEC, 1 };
- InputEvent msc2 = { when, EV_MSC, MSC_ANDROID_TIME_USEC, 900000 };
-
- // Send a key down and syn. Should get the overridden timestamp.
- InputEvent keyDown = { when, EV_KEY, KEY_HOME, 1 };
- InputEvent syn = { when, EV_SYN, SYN_REPORT, 0 };
-
- // Send a key up, which should be at the reported timestamp.
- InputEvent keyUp = { when, EV_KEY, KEY_HOME, 0 };
-
- device->processInput(msc1, when);
- device->processInput(msc2, when);
- device->processInput(keyDown, when);
- device->processInput(syn, when);
- device->processInput(keyUp, when);
-
- nsecs_t expectedWhen = s2ns(1) + us2ns(900000);
- EXPECT_EQ(expectedWhen, keyDown.when);
- EXPECT_EQ(expectedWhen, syn.when);
- EXPECT_EQ(when, keyUp.when);
-}
-
TEST_F(EvdevDeviceTest, testWrongClockCorrection) {
auto node = std::make_shared<MockInputDeviceNode>();
auto device = std::make_unique<EvdevDevice>(&mHost, node);
diff --git a/tests/keymaster/keymaster_test.cpp b/tests/keymaster/keymaster_test.cpp
index e6b41c7..562c8ed 100644
--- a/tests/keymaster/keymaster_test.cpp
+++ b/tests/keymaster/keymaster_test.cpp
@@ -29,6 +29,7 @@
#include <openssl/bn.h>
#include <openssl/evp.h>
+#include <openssl/pkcs8.h>
#include <openssl/x509.h>
#define LOG_TAG "keymaster_test"
@@ -158,41 +159,6 @@
size_t mDataSize;
};
-struct BIGNUM_Delete {
- void operator()(BIGNUM* p) const {
- BN_free(p);
- }
-};
-typedef std::unique_ptr<BIGNUM, BIGNUM_Delete> Unique_BIGNUM;
-
-struct EVP_PKEY_Delete {
- void operator()(EVP_PKEY* p) const {
- EVP_PKEY_free(p);
- }
-};
-typedef std::unique_ptr<EVP_PKEY, EVP_PKEY_Delete> Unique_EVP_PKEY;
-
-struct PKCS8_PRIV_KEY_INFO_Delete {
- void operator()(PKCS8_PRIV_KEY_INFO* p) const {
- PKCS8_PRIV_KEY_INFO_free(p);
- }
-};
-typedef std::unique_ptr<PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO_Delete> Unique_PKCS8_PRIV_KEY_INFO;
-
-struct RSA_Delete {
- void operator()(RSA* p) const {
- RSA_free(p);
- }
-};
-typedef std::unique_ptr<RSA, RSA_Delete> Unique_RSA;
-
-struct EC_KEY_Delete {
- void operator()(EC_KEY* p) const {
- EC_KEY_free(p);
- }
-};
-typedef std::unique_ptr<EC_KEY, EC_KEY_Delete> Unique_EC_KEY;
-
/*
* DER-encoded PKCS#8 format RSA key. Generated using:
@@ -417,13 +383,13 @@
<< "X509 data should be allocated";
const unsigned char *tmp = static_cast<const unsigned char*>(x509_blob.get());
- Unique_EVP_PKEY actual(d2i_PUBKEY((EVP_PKEY**) NULL, &tmp,
+ bssl::UniquePtr<EVP_PKEY> actual(d2i_PUBKEY(NULL, &tmp,
static_cast<long>(x509_blob.length())));
ASSERT_EQ(EVP_PKEY_RSA, EVP_PKEY_type(actual.get()->type))
<< "Generated key type should be of type RSA";
- Unique_RSA rsa(EVP_PKEY_get1_RSA(actual.get()));
+ bssl::UniquePtr<RSA> rsa(EVP_PKEY_get1_RSA(actual.get()));
ASSERT_FALSE(rsa.get() == NULL)
<< "Should be able to extract RSA key from EVP_PKEY";
@@ -464,13 +430,13 @@
<< "X509 data should be allocated";
const unsigned char *tmp = static_cast<const unsigned char*>(x509_blob.get());
- Unique_EVP_PKEY actual(d2i_PUBKEY((EVP_PKEY**) NULL, &tmp,
+ bssl::UniquePtr<EVP_PKEY> actual(d2i_PUBKEY(NULL, &tmp,
static_cast<long>(x509_blob.length())));
ASSERT_EQ(EVP_PKEY_EC, EVP_PKEY_type(actual.get()->type))
<< "Generated key type should be of type EC";
- Unique_EC_KEY ecKey(EVP_PKEY_get1_EC_KEY(actual.get()));
+ bssl::UniquePtr<EC_KEY> ecKey(EVP_PKEY_get1_EC_KEY(actual.get()));
ASSERT_FALSE(ecKey.get() == NULL)
<< "Should be able to extract EC key from EVP_PKEY";
@@ -531,18 +497,18 @@
UniqueBlob x509_blob(x509_data, x509_data_length);
const unsigned char *tmp = static_cast<const unsigned char*>(x509_blob.get());
- Unique_EVP_PKEY actual(d2i_PUBKEY((EVP_PKEY**) NULL, &tmp,
+ bssl::UniquePtr<EVP_PKEY> actual(d2i_PUBKEY(NULL, &tmp,
static_cast<long>(x509_blob.length())));
ASSERT_EQ(EVP_PKEY_type(actual.get()->type), EVP_PKEY_RSA)
<< "Generated key type should be of type RSA";
const unsigned char *expectedTmp = static_cast<const unsigned char*>(TEST_RSA_KEY_1);
- Unique_PKCS8_PRIV_KEY_INFO expectedPkcs8(
- d2i_PKCS8_PRIV_KEY_INFO((PKCS8_PRIV_KEY_INFO**) NULL, &expectedTmp,
+ bssl::UniquePtr<PKCS8_PRIV_KEY_INFO> expectedPkcs8(
+ d2i_PKCS8_PRIV_KEY_INFO(NULL, &expectedTmp,
sizeof(TEST_RSA_KEY_1)));
- Unique_EVP_PKEY expected(EVP_PKCS82PKEY(expectedPkcs8.get()));
+ bssl::UniquePtr<EVP_PKEY> expected(EVP_PKCS82PKEY(expectedPkcs8.get()));
ASSERT_EQ(1, EVP_PKEY_cmp(expected.get(), actual.get()))
<< "Expected and actual keys should match";
@@ -567,18 +533,18 @@
UniqueBlob x509_blob(x509_data, x509_data_length);
const unsigned char *tmp = static_cast<const unsigned char*>(x509_blob.get());
- Unique_EVP_PKEY actual(d2i_PUBKEY((EVP_PKEY**) NULL, &tmp,
+ bssl::UniquePtr<EVP_PKEY> actual(d2i_PUBKEY(NULL, &tmp,
static_cast<long>(x509_blob.length())));
ASSERT_EQ(EVP_PKEY_type(actual.get()->type), EVP_PKEY_EC)
<< "Generated key type should be of type EC";
const unsigned char *expectedTmp = static_cast<const unsigned char*>(TEST_EC_KEY_1);
- Unique_PKCS8_PRIV_KEY_INFO expectedPkcs8(
- d2i_PKCS8_PRIV_KEY_INFO((PKCS8_PRIV_KEY_INFO**) NULL, &expectedTmp,
+ bssl::UniquePtr<PKCS8_PRIV_KEY_INFO> expectedPkcs8(
+ d2i_PKCS8_PRIV_KEY_INFO(NULL, &expectedTmp,
sizeof(TEST_EC_KEY_1)));
- Unique_EVP_PKEY expected(EVP_PKCS82PKEY(expectedPkcs8.get()));
+ bssl::UniquePtr<EVP_PKEY> expected(EVP_PKCS82PKEY(expectedPkcs8.get()));
ASSERT_EQ(1, EVP_PKEY_cmp(expected.get(), actual.get()))
<< "Expected and actual keys should match";
@@ -925,10 +891,10 @@
UniqueBlob x509_blob(x509_data, x509_data_length);
const unsigned char *tmp = static_cast<const unsigned char*>(x509_blob.get());
- Unique_EVP_PKEY expected(d2i_PUBKEY((EVP_PKEY**) NULL, &tmp,
+ bssl::UniquePtr<EVP_PKEY> expected(d2i_PUBKEY(NULL, &tmp,
static_cast<long>(x509_blob.length())));
- Unique_EC_KEY ecKey(EVP_PKEY_get1_EC_KEY(expected.get()));
+ bssl::UniquePtr<EC_KEY> ecKey(EVP_PKEY_get1_EC_KEY(expected.get()));
ASSERT_EQ(1, ECDSA_verify(0, testData.get(), testData.length(), sig_blob.get(), sig_blob.length(), ecKey.get()))
<< "Signature should verify";