Update the signature of init function to include whether the device is am: 3e7b35ee18 am: 43e0dd5936 am: 234cb4857b am: 1d90247bb1 am: e5ef2a3f04 am: 984f2f2d43
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/libhardware/+/12308134
Change-Id: Ie03df2d91b3d7a1c9028f72bed36d92762f123f2
diff --git a/Android.bp b/Android.bp
index ce4214e..0b340a1 100644
--- a/Android.bp
+++ b/Android.bp
@@ -18,6 +18,8 @@
export_include_dirs: ["include"],
recovery_available: true,
vendor_available: true,
+ // TODO(b/153609531): remove when no longer needed.
+ native_bridge_supported: true,
target: {
recovery: {
exclude_header_libs: [
@@ -26,6 +28,7 @@
],
},
},
+ min_sdk_version: "29",
}
@@ -59,4 +62,5 @@
exclude_shared_libs: ["libvndksupport"],
},
},
+ min_sdk_version: "29",
}
diff --git a/include/hardware/audio.h b/include/hardware/audio.h
index feebd23..b87d3bb 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
@@ -202,8 +203,15 @@
STREAM_CBK_EVENT_ERROR, /* stream hit some error, let AF take action */
} stream_callback_event_t;
+typedef enum {
+ STREAM_EVENT_CBK_TYPE_CODEC_FORMAT_CHANGED, /* codec format of the stream changed */
+} stream_event_callback_type_t;
+
typedef int (*stream_callback_t)(stream_callback_event_t event, void *param, void *cookie);
+typedef int (*stream_event_callback_t)(stream_event_callback_type_t event,
+ void *param, void *cookie);
+
/* type of drain requested to audio_stream_out->drain(). Mutually exclusive */
typedef enum {
AUDIO_DRAIN_ALL, /* drain() returns when all data has been played */
@@ -421,6 +429,13 @@
*/
void (*update_source_metadata)(struct audio_stream_out *stream,
const struct source_metadata* source_metadata);
+
+ /**
+ * Set the callback function for notifying events for an output stream.
+ */
+ int (*set_event_callback)(struct audio_stream_out *stream,
+ stream_event_callback_t callback,
+ void *cookie);
};
typedef struct audio_stream_out audio_stream_out_t;
@@ -825,6 +840,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/hwcomposer2.h b/include/hardware/hwcomposer2.h
index c70aef6..76122a5 100644
--- a/include/hardware/hwcomposer2.h
+++ b/include/hardware/hwcomposer2.h
@@ -50,6 +50,11 @@
* the device may return -1 instead */
HWC2_ATTRIBUTE_DPI_X = 4,
HWC2_ATTRIBUTE_DPI_Y = 5,
+
+ /* The configuration group this config is associated to.
+ * Switching between configurations within the same group may be done seamlessly
+ * in some conditions via setActiveConfigWithConstraints. */
+ HWC2_ATTRIBUTE_CONFIG_GROUP = 7,
} hwc2_attribute_t;
/* Blend modes, settable per layer */
@@ -73,6 +78,9 @@
HWC2_CALLBACK_HOTPLUG = 1,
HWC2_CALLBACK_REFRESH = 2,
HWC2_CALLBACK_VSYNC = 3,
+ HWC2_CALLBACK_VSYNC_2_4 = 4,
+ HWC2_CALLBACK_VSYNC_PERIOD_TIMING_CHANGED = 5,
+ HWC2_CALLBACK_SEAMLESS_POSSIBLE = 6,
} hwc2_callback_descriptor_t;
/* Optional capabilities which may be supported by some devices. The particular
@@ -203,6 +211,12 @@
HWC2_DISPLAY_TYPE_VIRTUAL = 2,
} hwc2_display_type_t;
+/* Physical display types returned by getDisplayConnectionType */
+typedef enum {
+ HWC2_DISPLAY_CONNECTION_TYPE_INTERNAL = 0,
+ HWC2_DISPLAY_CONNECTION_TYPE_EXTERNAL = 1,
+} hwc2_display_connection_type_t;
+
/* Return codes from all functions */
typedef enum {
HWC2_ERROR_NONE = 0,
@@ -214,6 +228,8 @@
HWC2_ERROR_NO_RESOURCES,
HWC2_ERROR_NOT_VALIDATED,
HWC2_ERROR_UNSUPPORTED,
+ HWC2_ERROR_SEAMLESS_NOT_ALLOWED,
+ HWC2_ERROR_SEAMLESS_NOT_POSSIBLE,
} hwc2_error_t;
/* Function descriptors for use with getFunction */
@@ -282,6 +298,17 @@
HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA_BLOBS,
HWC2_FUNCTION_GET_DISPLAY_BRIGHTNESS_SUPPORT,
HWC2_FUNCTION_SET_DISPLAY_BRIGHTNESS,
+
+ // composer 2.4
+ HWC2_FUNCTION_GET_DISPLAY_CONNECTION_TYPE,
+ HWC2_FUNCTION_GET_DISPLAY_VSYNC_PERIOD,
+ HWC2_FUNCTION_SET_ACTIVE_CONFIG_WITH_CONSTRAINTS,
+ HWC2_FUNCTION_SET_AUTO_LOW_LATENCY_MODE,
+ HWC2_FUNCTION_GET_SUPPORTED_CONTENT_TYPES,
+ HWC2_FUNCTION_SET_CONTENT_TYPE,
+ HWC2_FUNCTION_GET_CLIENT_TARGET_PROPERTY,
+ HWC2_FUNCTION_SET_LAYER_GENERIC_METADATA,
+ HWC2_FUNCTION_GET_LAYER_GENERIC_METADATA_KEY,
} hwc2_function_descriptor_t;
/* Layer requests returned from getDisplayRequests */
@@ -320,6 +347,14 @@
HWC2_POWER_MODE_ON = 2,
} hwc2_power_mode_t;
+typedef enum {
+ HWC2_CONTENT_TYPE_NONE = 0,
+ HWC2_CONTENT_TYPE_GRAPHICS = 1,
+ HWC2_CONTENT_TYPE_PHOTO = 2,
+ HWC2_CONTENT_TYPE_CINEMA = 3,
+ HWC2_CONTENT_TYPE_GAME = 4,
+} hwc2_content_type_t;
+
/* Vsync values passed to setVsyncEnabled */
typedef enum {
HWC2_VSYNC_INVALID = 0,
@@ -412,6 +447,15 @@
* Specified that the display supports brightness operations.
*/
HWC2_DISPLAY_CAPABILITY_BRIGHTNESS = 3,
+
+ /**
+ * Specifies that the display supports a low latency mode. If the connection
+ * to the display is via HDMI, this specifies whether Auto Low Latency Mode
+ * is supported. If, instead, there is an internal connection to the display,
+ * then this specifies that the display has some other custom low latency
+ * mode.
+ */
+ HWC2_DISPLAY_CAPABILITY_AUTO_LOW_LATENCY_MODE = 5,
} hwc2_display_capability_t;
/*
@@ -428,6 +472,7 @@
case HWC2_ATTRIBUTE_VSYNC_PERIOD: return "VsyncPeriod";
case HWC2_ATTRIBUTE_DPI_X: return "DpiX";
case HWC2_ATTRIBUTE_DPI_Y: return "DpiY";
+ case HWC2_ATTRIBUTE_CONFIG_GROUP: return "ConfigGroup";
default: return "Unknown";
}
}
@@ -449,6 +494,9 @@
case HWC2_CALLBACK_HOTPLUG: return "Hotplug";
case HWC2_CALLBACK_REFRESH: return "Refresh";
case HWC2_CALLBACK_VSYNC: return "Vsync";
+ case HWC2_CALLBACK_VSYNC_2_4: return "Vsync2.4";
+ case HWC2_CALLBACK_VSYNC_PERIOD_TIMING_CHANGED: return "VsyncPeriodTimingChanged";
+ case HWC2_CALLBACK_SEAMLESS_POSSIBLE: return "SeamlessPossible";
default: return "Unknown";
}
}
@@ -509,6 +557,14 @@
}
}
+static inline const char* getDisplayConnectionTypeName(hwc2_display_connection_type_t type) {
+ switch (type) {
+ case HWC2_DISPLAY_CONNECTION_TYPE_INTERNAL: return "Internal";
+ case HWC2_DISPLAY_CONNECTION_TYPE_EXTERNAL: return "External";
+ default: return "Unknown";
+ }
+}
+
static inline const char* getErrorName(hwc2_error_t error) {
switch (error) {
case HWC2_ERROR_NONE: return "None";
@@ -520,6 +576,8 @@
case HWC2_ERROR_NO_RESOURCES: return "NoResources";
case HWC2_ERROR_NOT_VALIDATED: return "NotValidated";
case HWC2_ERROR_UNSUPPORTED: return "Unsupported";
+ case HWC2_ERROR_SEAMLESS_NOT_ALLOWED: return "SeamlessNotAllowed";
+ case HWC2_ERROR_SEAMLESS_NOT_POSSIBLE: return "SeamlessNotPossible";
default: return "Unknown";
}
}
@@ -602,6 +660,18 @@
case HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA_BLOBS: return "SetLayerPerFrameMetadataBlobs";
case HWC2_FUNCTION_GET_DISPLAY_BRIGHTNESS_SUPPORT: return "GetDisplayBrightnessSupport";
case HWC2_FUNCTION_SET_DISPLAY_BRIGHTNESS: return "SetDisplayBrightness";
+
+ // composer 2.4
+ case HWC2_FUNCTION_GET_DISPLAY_CONNECTION_TYPE: return "GetDisplayConnectionType";
+ case HWC2_FUNCTION_GET_DISPLAY_VSYNC_PERIOD: return "GetDisplayVsyncPeriod";
+ case HWC2_FUNCTION_SET_ACTIVE_CONFIG_WITH_CONSTRAINTS: return "SetActiveConfigWithConstraints";
+ case HWC2_FUNCTION_SET_AUTO_LOW_LATENCY_MODE: return "SetAutoLowLatencyMode";
+ case HWC2_FUNCTION_GET_SUPPORTED_CONTENT_TYPES: return "GetSupportedContentTypes";
+ case HWC2_FUNCTION_SET_CONTENT_TYPE: return "SetContentType";
+ case HWC2_FUNCTION_GET_CLIENT_TARGET_PROPERTY: return "GetClientTargetProperty";
+ case HWC2_FUNCTION_SET_LAYER_GENERIC_METADATA: return "SetLayerGenericMetadata";
+ case HWC2_FUNCTION_GET_LAYER_GENERIC_METADATA_KEY: return "GetLayerGenericMetadataKey";
+
default: return "Unknown";
}
}
@@ -624,6 +694,17 @@
}
}
+static inline const char* getContentTypeName(hwc2_content_type_t contentType) {
+ switch(contentType) {
+ case HWC2_CONTENT_TYPE_NONE: return "None";
+ case HWC2_CONTENT_TYPE_GRAPHICS: return "Graphics";
+ case HWC2_CONTENT_TYPE_PHOTO: return "Photo";
+ case HWC2_CONTENT_TYPE_CINEMA: return "Cinema";
+ case HWC2_CONTENT_TYPE_GAME: return "Game";
+ default: return "Unknown";
+ }
+}
+
static inline const char* getTransformName(hwc_transform_t transform) {
switch (__BIONIC_CAST(static_cast, int, transform)) {
case 0: return "None";
@@ -676,6 +757,8 @@
return "Doze";
case HWC2_DISPLAY_CAPABILITY_BRIGHTNESS:
return "Brightness";
+ case HWC2_DISPLAY_CAPABILITY_AUTO_LOW_LATENCY_MODE:
+ return "AutoLowLatencyMode";
default:
return "Unknown";
}
@@ -708,6 +791,7 @@
VsyncPeriod = HWC2_ATTRIBUTE_VSYNC_PERIOD,
DpiX = HWC2_ATTRIBUTE_DPI_X,
DpiY = HWC2_ATTRIBUTE_DPI_Y,
+ ConfigGroup = HWC2_ATTRIBUTE_CONFIG_GROUP,
};
TO_STRING(hwc2_attribute_t, Attribute, getAttributeName)
@@ -724,6 +808,9 @@
Hotplug = HWC2_CALLBACK_HOTPLUG,
Refresh = HWC2_CALLBACK_REFRESH,
Vsync = HWC2_CALLBACK_VSYNC,
+ Vsync_2_4 = HWC2_CALLBACK_VSYNC_2_4,
+ VsyncPeriodTimingChanged = HWC2_CALLBACK_VSYNC_PERIOD_TIMING_CHANGED,
+ SeamlessPossible = HWC2_CALLBACK_SEAMLESS_POSSIBLE,
};
TO_STRING(hwc2_callback_descriptor_t, Callback, getCallbackDescriptorName)
@@ -767,6 +854,12 @@
};
TO_STRING(hwc2_display_type_t, DisplayType, getDisplayTypeName)
+enum class DisplayConnectionType : uint32_t {
+ Internal = HWC2_DISPLAY_CONNECTION_TYPE_INTERNAL,
+ External = HWC2_DISPLAY_CONNECTION_TYPE_EXTERNAL,
+};
+TO_STRING(hwc2_display_connection_type_t, DisplayConnectionType, getDisplayConnectionTypeName)
+
enum class Error : int32_t {
None = HWC2_ERROR_NONE,
BadConfig = HWC2_ERROR_BAD_CONFIG,
@@ -777,6 +870,8 @@
NoResources = HWC2_ERROR_NO_RESOURCES,
NotValidated = HWC2_ERROR_NOT_VALIDATED,
Unsupported = HWC2_ERROR_UNSUPPORTED,
+ SeamlessNotAllowed = HWC2_ERROR_SEAMLESS_NOT_ALLOWED,
+ SeamlessNotPossible = HWC2_ERROR_SEAMLESS_NOT_POSSIBLE,
};
TO_STRING(hwc2_error_t, Error, getErrorName)
@@ -845,6 +940,17 @@
SetLayerPerFrameMetadataBlobs = HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA_BLOBS,
GetDisplayBrightnessSupport = HWC2_FUNCTION_GET_DISPLAY_BRIGHTNESS_SUPPORT,
SetDisplayBrightness = HWC2_FUNCTION_SET_DISPLAY_BRIGHTNESS,
+
+ // composer 2.4
+ GetDisplayConnectionType = HWC2_FUNCTION_GET_DISPLAY_CONNECTION_TYPE,
+ GetDisplayVsyncPeriod = HWC2_FUNCTION_GET_DISPLAY_VSYNC_PERIOD,
+ SetActiveConfigWithConstraints = HWC2_FUNCTION_SET_ACTIVE_CONFIG_WITH_CONSTRAINTS,
+ SetAutoLowLatencyMode = HWC2_FUNCTION_SET_AUTO_LOW_LATENCY_MODE,
+ GetSupportedContentTypes = HWC2_FUNCTION_GET_SUPPORTED_CONTENT_TYPES,
+ SetContentType = HWC2_FUNCTION_SET_CONTENT_TYPE,
+ GetClientTargetProperty = HWC2_FUNCTION_GET_CLIENT_TARGET_PROPERTY,
+ SetLayerGenericMetadata = HWC2_FUNCTION_SET_LAYER_GENERIC_METADATA,
+ GetLayerGenericMetadataKey = HWC2_FUNCTION_GET_LAYER_GENERIC_METADATA_KEY,
};
TO_STRING(hwc2_function_descriptor_t, FunctionDescriptor,
getFunctionDescriptorName)
@@ -862,6 +968,15 @@
};
TO_STRING(hwc2_power_mode_t, PowerMode, getPowerModeName)
+enum class ContentType : int32_t {
+ None = HWC2_CONTENT_TYPE_NONE,
+ Graphics = HWC2_CONTENT_TYPE_GRAPHICS,
+ Photo = HWC2_CONTENT_TYPE_PHOTO,
+ Cinema = HWC2_CONTENT_TYPE_CINEMA,
+ Game = HWC2_CONTENT_TYPE_GAME,
+};
+TO_STRING(hwc2_content_type_t, ContentType, getContentTypeName)
+
enum class Transform : int32_t {
None = 0,
FlipH = HWC_TRANSFORM_FLIP_H,
@@ -886,6 +1001,7 @@
SkipClientColorTransform = HWC2_DISPLAY_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM,
Doze = HWC2_DISPLAY_CAPABILITY_DOZE,
Brightness = HWC2_DISPLAY_CAPABILITY_BRIGHTNESS,
+ AutoLowLatencyMode = HWC2_DISPLAY_CAPABILITY_AUTO_LOW_LATENCY_MODE,
};
TO_STRING(hwc2_display_capability_t, DisplayCapability, getDisplayCapabilityName)
@@ -904,6 +1020,7 @@
typedef uint32_t hwc2_config_t;
typedef uint64_t hwc2_display_t;
typedef uint64_t hwc2_layer_t;
+typedef uint32_t hwc2_vsync_period_t;
/*
* Device Struct
@@ -1030,6 +1147,63 @@
typedef void (*HWC2_PFN_VSYNC)(hwc2_callback_data_t callbackData,
hwc2_display_t display, int64_t timestamp);
+/* vsync_2_4(..., display, timestamp, vsyncPeriodNanos)
+ * Descriptor: HWC2_CALLBACK_VSYNC_2_4
+ * Required for HWC2 devices for composer 2.4
+ *
+ * Notifies the client that a vsync event has occurred. This callback must
+ * only be triggered when vsync is enabled for this display (through
+ * setVsyncEnabled).
+ *
+ * This callback should be triggered from a thread of at least
+ * HAL_PRIORITY_URGENT_DISPLAY with as little latency as possible, typically
+ * less than 0.5 ms. This thread is guaranteed not to call back into the device.
+ *
+ * Parameters:
+ * display - the display which has received a vsync event
+ * timestamp - the CLOCK_MONOTONIC time at which the vsync event occurred, in
+ * nanoseconds
+ * vsyncPeriodNanos - the display vsync period in nanoseconds i.e. the next onVsync2_4 is
+ * expected to be called vsyncPeriod nanoseconds after this call.
+ */
+typedef void (*HWC2_PFN_VSYNC_2_4)(hwc2_callback_data_t callbackData,
+ hwc2_display_t display, int64_t timestamp, hwc2_vsync_period_t vsyncPeriodNanos);
+
+/* vsyncPeriodTimingChanged(..., display, updated_timeline)
+ * Descriptor: HWC2_CALLBACK_VSYNC_PERIOD_TIMING_CHANGED
+ * Optional for HWC2 devices for composer 2.4
+ *
+ * Notifies the client that the previously reported timing for vsync period change has been
+ * updated. This may occur if the composer missed the deadline for changing the vsync period
+ * or the client submitted a refresh frame too late.
+ *
+ * This callback should be triggered from a thread of at least
+ * HAL_PRIORITY_URGENT_DISPLAY with as little latency as possible, typically
+ * less than 0.5 ms. This thread is guaranteed not to call back into the device.
+ *
+ * Parameters:
+ * display - the display which has received a vsync event
+ * updated_timeline - new timeline for the vsync period change
+ */
+typedef void (*HWC2_PFN_VSYNC_PERIOD_TIMING_CHANGED)(hwc2_callback_data_t callbackData,
+ hwc2_display_t display, hwc_vsync_period_change_timeline_t* updated_timeline);
+
+/* SeamlessPossible(..., display)
+ * Descriptor: HWC2_CALLBACK_SEAMLESS_POSSIBLE
+ * Optional for HWC2 devices for composer 2.4
+ *
+ * Notifies the client that the conditions which previously led to returning SEAMLESS_NOT_POSSIBLE
+ * from setActiveConfigWithConstraints have changed and now seamless may be possible. Client should
+ * retry calling setActiveConfigWithConstraints.
+ *
+ *
+ * Parameters:
+ * display - a display setActiveConfigWithConstraints previously failed with
+ * SEAMLESS_NOT_POSSIBLE.
+ */
+typedef void (*HWC2_PFN_SEAMLESS_POSSIBLE)(hwc2_callback_data_t callbackData,
+ hwc2_display_t display);
+
/*
* Device Functions
*
@@ -2727,6 +2901,275 @@
typedef int32_t /*hwc_error_t*/ (*HWC2_PFN_SET_DISPLAY_BRIGHTNESS)(hwc2_device_t* device,
hwc2_display_t display, float brightness);
+/* Composer 2.4 additions */
+
+/* getDisplayConnectionType(..., outType)
+ * Descriptor: HWC2_FUNCTION_GET_DISPLAY_CONNECTION_TYPE
+ * Optional for all HWC2 devices
+ *
+ * Returns whether the given physical display is internal or external.
+ *
+ * Parameters:
+ * outType - the connection type of the display; pointer will be non-NULL
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY when the display is invalid or virtual.
+ */
+typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DISPLAY_CONNECTION_TYPE)(
+ hwc2_device_t* device, hwc2_display_t display,
+ uint32_t* /*hwc2_display_connection_type_t*/ outType);
+
+/* getDisplayVsyncPeriod(..., outVsyncPeriods)
+ * Descriptor: HWC2_FUNCTION_GET_DISPLAY_VSYNC_PERIOD
+ * Required for HWC2 devices for composer 2.4
+ *
+ * Retrieves which vsync period the display is currently using.
+ *
+ * If no display configuration is currently active, this function must
+ * return BAD_CONFIG. If a vsync period is about to change due to a
+ * setActiveConfigWithConstraints call, this function must return the current vsync period
+ * until the change has taken place.
+ *
+ * Parameters:
+ * outVsyncPeriod - the current vsync period of the display.
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in
+ * HWC2_ERROR_BAD_CONFIG - no configuration is currently active
+ */
+typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DISPLAY_VSYNC_PERIOD)(
+ hwc2_device_t* device, hwc2_display_t display, hwc2_vsync_period_t* outVsyncPeriod);
+
+/* setActiveConfigWithConstraints(...,
+ * config,
+ * vsyncPeriodChangeConstraints,
+ * outTimeline)
+ * Descriptor: HWC2_FUNCTION_SET_ACTIVE_CONFIG_WITH_CONSTRAINTS
+ * Required for HWC2 devices for composer 2.4
+ *
+ * Sets the active configuration and the refresh rate for this display.
+ * If the new config shares the same config group as the current config,
+ * only the vsync period shall change.
+ * Upon returning, the given display configuration, except vsync period, must be active and
+ * remain so until either this function is called again or the display is disconnected.
+ * When the display starts to refresh at the new vsync period, onVsync_2_4 callback must be
+ * called with the new vsync period.
+ *
+ * Parameters:
+ * config - the new display configuration.
+ * vsyncPeriodChangeConstraints - constraints required for changing vsync period:
+ * desiredTimeNanos - the time in CLOCK_MONOTONIC after
+ * which the vsync period may change
+ * (i.e., the vsync period must not change
+ * before this time).
+ * seamlessRequired - if true, requires that the vsync period
+ * change must happen seamlessly without
+ * a noticeable visual artifact.
+ * When the conditions change and it may be
+ * possible to change the vsync period
+ * seamlessly, HWC2_CALLBACK_SEAMLESS_POSSIBLE
+ * callback must be called to indicate that
+ * caller should retry.
+ * outTimeline - the timeline for the vsync period change.
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in.
+ * HWC2_ERROR_BAD_CONFIG - an invalid configuration handle passed in.
+ * HWC2_ERROR_SEAMLESS_NOT_ALLOWED - when seamlessRequired was true but config provided doesn't
+ * share the same config group as the current config.
+ * HWC2_ERROR_SEAMLESS_NOT_POSSIBLE - when seamlessRequired was true but the display cannot
+ * achieve the vsync period change without a noticeable
+ * visual artifact.
+ */
+typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_ACTIVE_CONFIG_WITH_CONSTRAINTS)(
+ hwc2_device_t* device, hwc2_display_t display, hwc2_config_t config,
+ hwc_vsync_period_change_constraints_t* vsyncPeriodChangeConstraints,
+ hwc_vsync_period_change_timeline_t* outTimeline);
+
+/* setAutoLowLatencyMode(displayToken, on)
+ * Descriptor: HWC2_FUNCTION_SET_AUTO_LOW_LATENCY_MODE
+ * Optional for HWC2 devices
+ *
+ * setAutoLowLatencyMode requests that the display goes into low latency mode. If the display
+ * is connected via HDMI 2.1, then Auto Low Latency Mode should be triggered. If the display is
+ * internally connected, then a custom low latency mode should be triggered (if available).
+ *
+ * Parameters:
+ * on - indicates whether to turn low latency mode on (=true) or off (=false)
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY - when the display is invalid, or
+ * HWC2_ERROR_UNSUPPORTED - when the display does not support any low latency mode
+ */
+typedef int32_t /*hwc_error_t*/ (*HWC2_PFN_SET_AUTO_LOW_LATENCY_MODE)(hwc2_device_t* device,
+ hwc2_display_t display, bool on);
+
+/* getSupportedContentTypes(..., outSupportedContentTypes)
+ * Descriptor: HWC2_FUNCTION_GET_SUPPORTED_CONTENT_TYPES
+ * Optional for HWC2 devices
+ *
+ * getSupportedContentTypes returns a list of supported content types
+ * (as described in the definition of ContentType above).
+ * This list must not change after initialization.
+ *
+ * Parameters:
+ * outNumSupportedContentTypes - if outSupportedContentTypes was nullptr, returns the number
+ * of supported content types; if outSupportedContentTypes was not nullptr, returns the
+ * number of capabilities stored in outSupportedContentTypes, which must not exceed the
+ * value stored in outNumSupportedContentTypes prior to the call; pointer will be non-NULL
+ * outSupportedContentTypes - a list of supported content types.
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in
+ */
+typedef int32_t /*hwc_error_t*/ (*HWC2_PFN_GET_SUPPORTED_CONTENT_TYPES)(hwc2_device_t* device,
+ hwc2_display_t display, uint32_t* outNumSupportedContentTypes, uint32_t* outSupportedContentTypes);
+
+/* setContentType(displayToken, contentType)
+ * Descriptor: HWC2_FUNCTION_SET_CONTENT_TYPE
+ * Optional for HWC2 devices
+ *
+ * setContentType instructs the display that the content being shown is of the given contentType
+ * (one of GRAPHICS, PHOTO, CINEMA, GAME).
+ *
+ * According to the HDMI 1.4 specification, supporting all content types is optional. Whether
+ * the display supports a given content type is reported by getSupportedContentTypes.
+ *
+ * Parameters:
+ * contentType - the type of content that is currently being shown on the display
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY - when the display is invalid, or
+ * HWC2_ERROR_UNSUPPORTED - when the given content type is a valid content type, but is not
+ * supported on this display, or
+ * HWC2_ERROR_BAD_PARAMETER - when the given content type is invalid
+ */
+typedef int32_t /*hwc_error_t*/ (*HWC2_PFN_SET_CONTENT_TYPE)(hwc2_device_t* device,
+ hwc2_display_t display, int32_t /* hwc2_content_type_t */ contentType);
+
+/* getClientTargetProperty(..., outClientTargetProperty)
+ * Descriptor: HWC2_FUNCTION_GET_CLIENT_TARGET_PROPERTY
+ * Optional for HWC2 devices
+ *
+ * Retrieves the client target properties for which the hardware composer
+ * requests after the last call to validateDisplay. The client must set the
+ * properties of the client target to match the returned values.
+ * When this API is implemented, if client composition is needed, the hardware
+ * composer must return meaningful client target property with dataspace not
+ * setting to UNKNOWN.
+ * When the returned dataspace is set to UNKNOWN, it means hardware composer
+ * requests nothing, the client must ignore the returned client target property
+ * structrue.
+ *
+ * Parameters:
+ * outClientTargetProperty - the client target properties that hardware
+ * composer requests. If dataspace field is set to UNKNOWN, it means
+ * the hardware composer requests nothing, the client must ignore the
+ * returned client target property structure.
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in
+ * HWC2_ERROR_NOT_VALIDATED - validateDisplay has not been called for this
+ * display
+ */
+typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_CLIENT_TARGET_PROPERTY)(
+ hwc2_device_t* device, hwc2_display_t display,
+ hwc_client_target_property_t* outClientTargetProperty);
+
+/* setLayerGenericMetadata(..., keyLength, key, mandatory, valueLength, value)
+ * Descriptor: HWC2_FUNCTION_SET_LAYER_GENERIC_METADATA
+ * Optional for HWC2 devices for composer 2.4+
+ *
+ * setLayerGenericMetadata sets a piece of generic metadata for the given layer.
+ * If this function is called twice with the same key but different values, the
+ * newer value must override the older one. Calling this function with
+ * valueLength == 0 must reset that key's metadata as if it had not been set.
+ *
+ * A given piece of metadata may either be mandatory or a hint (non-mandatory)
+ * as indicated by the `mandatory` parameter. Mandatory metadata may affect the
+ * composition result, which is to say that it may cause a visible change in the
+ * final image. By contrast, hints may only affect the composition strategy,
+ * such as which layers are composited by the client, but must not cause a
+ * visible change in the final image.
+ *
+ * This implies that if the device does not understand a given key:
+ * - If the key is marked as mandatory, it must mark this layer for client
+ * composition in order to ensure the correct composition result
+ * - If the key is a hint, the metadata provided may be ignored
+ *
+ * Parameters:
+ * keyLength - the length of the key parameter
+ * key - the metadata key
+ * mandatory - indicates whether this particular key represents mandatory
+ * metadata or a hint, as described above
+ * valueLength - the length of the value parameter
+ * value - the metadata value
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in
+ * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in
+ * HWC2_ERROR_BAD_PARAMETER - an unsupported key was passed in, or the value
+ * does not conform to the expected format for the key
+ */
+typedef int32_t /*hwc_error_t*/ (*HWC2_PFN_SET_LAYER_GENERIC_METADATA)(hwc2_device_t* device,
+ hwc2_display_t display, hwc2_layer_t layer, uint32_t keyLength, const char* key,
+ bool mandatory, uint32_t valueLength, const uint8_t* value);
+
+/* getLayerGenericMetadataKey(..., keyIndex, outKeyLength, outKey, outMandatory)
+ * Descriptor: HWC2_FUNCTION_GET_LAYER_GENERIC_METADATA_KEY
+ * Optional for HWC2 devices for composer 2.4+
+ *
+ * getLayerGenericMetadataKey allows the client to query which metadata keys are
+ * supported by the composer implementation. Only keys in this list will be
+ * passed into setLayerGenericMetadata. Additionally, the key names in this list
+ * must meet the following requirements:
+ * - Must be specified in reverse domain name notation
+ * - Must not start with 'com.android' or 'android'
+ * - Must be unique within the returned list of keys
+ * - Must correspond to a matching HIDL struct type, which defines the structure
+ * of its values. For example, the key 'com.example.V1-3.Foo' should
+ * correspond to a value of type com.example@1.3::Foo, which is defined in a
+ * vendor HAL extension
+ *
+ * Client code which calls this function will look similar to this:
+ *
+ * struct Key {
+ * std::string name;
+ * bool mandatory;
+ * }
+ *
+ * std::vector<Key> keys;
+ * uint32_t index = 0;
+ * uint32_t keyLength = 0;
+ * while (true) {
+ * getLayerGenericMetadataKey(device, index, &keyLength, nullptr, nullptr);
+ * if (keyLength == 0) break;
+ *
+ * Key key;
+ * key.name.resize(keyLength);
+ * getLayerGenericMetadataKey(device, index, &keyLength, key.name.data(), &key.mandatory);
+ * keys.push_back(key);
+ *
+ * ++index;
+ * }
+ *
+ * Parameters:
+ * keyIndex - the index of the key to retrieve. For values beyond the end of
+ * the list of supported keys, outKeyLength should return 0, and the
+ * client may assume that if the length is 0 for keyIndex N, then it is
+ * also 0 for all keyIndex values > N.
+ * outKeyLength - if outKey was nullptr, returns the length of the key to
+ * allow the client to allocate an appropriately-sized buffer; if outKey
+ * was not nullptr, returns the length of the returned key, which must not
+ * exceed the value stored in outKeyLength prior to the call; pointer will
+ * be non-null
+ * outKey - the key at the given index, or nullptr to query the key's length
+ * outMandatory - whether the given metadata is mandatory or not (see
+ * setLayerGenericMetadata for more information), may be nullptr
+ */
+typedef void (*HWC2_PFN_GET_LAYER_GENERIC_METADATA_KEY)(hwc2_device_t* device, uint32_t keyIndex,
+ uint32_t* outKeyLength, char* outKey, bool* outMandatory);
+
__END_DECLS
#endif
diff --git a/include/hardware/hwcomposer_defs.h b/include/hardware/hwcomposer_defs.h
index fd373e3..3823765 100644
--- a/include/hardware/hwcomposer_defs.h
+++ b/include/hardware/hwcomposer_defs.h
@@ -104,6 +104,39 @@
HWC_TRANSFORM_FLIP_V_ROT_90 = HAL_TRANSFORM_FLIP_V | HAL_TRANSFORM_ROT_90,
} hwc_transform_t;
+/* Constraints for changing vsync period */
+typedef struct hwc_vsync_period_change_constraints {
+ /* Time in CLOCK_MONOTONIC after which the vsync period may change
+ * (i.e., the vsync period must not change before this time). */
+ int64_t desiredTimeNanos;
+ /*
+ * If true, requires that the vsync period change must happen seamlessly without
+ * a noticeable visual artifact. */
+ uint8_t seamlessRequired;
+} hwc_vsync_period_change_constraints_t;
+
+/* Timing for a vsync period change. */
+typedef struct hwc_vsync_period_change_timeline {
+ /* The time in CLOCK_MONOTONIC when the new display will start to refresh at
+ * the new vsync period. */
+ int64_t newVsyncAppliedTimeNanos;
+
+ /* Set to true if the client is required to sent a frame to be displayed before
+ * the change can take place. */
+ uint8_t refreshRequired;
+
+ /* The time in CLOCK_MONOTONIC when the client is expected to send the new frame.
+ * Should be ignored if refreshRequired is false. */
+ int64_t refreshTimeNanos;
+} hwc_vsync_period_change_timeline_t;
+
+typedef struct hwc_client_target_property {
+ // The pixel format of client target requested by hardware composer.
+ int32_t pixelFormat;
+ // The dataspace of the client target requested by hardware composer.
+ int32_t dataspace;
+} hwc_client_target_property_t;
+
/*******************************************************************************
* Beyond this point are things only used by HWC1, which should be ignored when
* implementing a HWC2 device
@@ -250,6 +283,11 @@
/* Indicates which of the vendor-defined color transforms is provided by
* this configuration. */
HWC_DISPLAY_COLOR_TRANSFORM = 6,
+
+ /* The configuration group this config is associated to. The groups are defined
+ * to mark certain configs as similar and changing configs within a certain group
+ * may be done seamlessly in some conditions. setActiveConfigWithConstraints. */
+ HWC_DISPLAY_CONFIG_GROUP = 7,
};
/* Allowed events for hwc_methods::eventControl() */
diff --git a/include/hardware/keymaster_defs.h b/include/hardware/keymaster_defs.h
index eca484c..2fbfe46 100644
--- a/include/hardware/keymaster_defs.h
+++ b/include/hardware/keymaster_defs.h
@@ -75,6 +75,9 @@
/* 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 */
+ KM_TAG_EARLY_BOOT_ONLY = KM_BOOL | 305, /* Key can only be used during early boot. */
/*
* Tags that should be semantically enforced by hardware if possible and will otherwise be
@@ -159,6 +162,10 @@
attestation */
KM_TAG_ATTESTATION_ID_MODEL = KM_BYTES | 717, /* Used to provide the device's model name to be
included in attestation */
+ KM_TAG_DEVICE_UNIQUE_ATTESTATION = KM_BOOL | 720, /* Indicates StrongBox device-unique attestation
+ is requested. */
+ KM_TAG_IDENTITY_CREDENTIAL_KEY = KM_BOOL | 721, /* This is an identity credential key */
+
/* Tags used only to provide data to or receive data from operations */
KM_TAG_ASSOCIATED_DATA = KM_BYTES | 1000, /* Used to provide associated data for AEAD modes. */
@@ -371,6 +378,7 @@
typedef enum {
KM_SECURITY_LEVEL_SOFTWARE = 0,
KM_SECURITY_LEVEL_TRUSTED_ENVIRONMENT = 1,
+ KM_SECURITY_LEVEL_STRONGBOX = 2,
} keymaster_security_level_t;
/**
@@ -456,8 +464,12 @@
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,
+ KM_ERROR_EARLY_BOOT_ENDED = -73,
+ KM_ERROR_ATTESTATION_KEYS_NOT_PROVISIONED = -74,
+ KM_ERROR_ATTESTATION_IDS_NOT_PROVISIONED = -75,
KM_ERROR_UNIMPLEMENTED = -100,
KM_ERROR_VERSION_MISMATCH = -101,
diff --git a/include/hardware/sensors-base.h b/include/hardware/sensors-base.h
index a87cf52..ef7eead 100644
--- a/include/hardware/sensors-base.h
+++ b/include/hardware/sensors-base.h
@@ -51,6 +51,7 @@
SENSOR_TYPE_ADDITIONAL_INFO = 33,
SENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT = 34,
SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED = 35,
+ SENSOR_TYPE_HINGE_ANGLE = 36,
SENSOR_TYPE_DEVICE_PRIVATE_BASE = 65536 /* 0x10000 */,
};
@@ -80,7 +81,7 @@
} sensor_flag_shift_t;
enum {
- SENSOR_STATUS_NO_CONTACT = -1 /* (-1) */,
+ SENSOR_STATUS_NO_CONTACT = -1 /* -1 */,
SENSOR_STATUS_UNRELIABLE = 0,
SENSOR_STATUS_ACCURACY_LOW = 1,
SENSOR_STATUS_ACCURACY_MEDIUM = 2,
@@ -95,35 +96,35 @@
AINFO_BEGIN = 0u,
AINFO_END = 1u,
AINFO_UNTRACKED_DELAY = 65536u /* 0x10000 */,
- AINFO_INTERNAL_TEMPERATURE = 65537u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_UNTRACKED_DELAY implicitly + 1) */,
- AINFO_VEC3_CALIBRATION = 65538u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_INTERNAL_TEMPERATURE implicitly + 1) */,
- AINFO_SENSOR_PLACEMENT = 65539u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_VEC3_CALIBRATION implicitly + 1) */,
- AINFO_SAMPLING = 65540u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_SENSOR_PLACEMENT implicitly + 1) */,
+ AINFO_INTERNAL_TEMPERATURE = 65537u /* ::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_UNTRACKED_DELAY implicitly + 1 */,
+ AINFO_VEC3_CALIBRATION = 65538u /* ::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_INTERNAL_TEMPERATURE implicitly + 1 */,
+ AINFO_SENSOR_PLACEMENT = 65539u /* ::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_VEC3_CALIBRATION implicitly + 1 */,
+ AINFO_SAMPLING = 65540u /* ::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_SENSOR_PLACEMENT implicitly + 1 */,
AINFO_CHANNEL_NOISE = 131072u /* 0x20000 */,
- AINFO_CHANNEL_SAMPLER = 131073u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_CHANNEL_NOISE implicitly + 1) */,
- AINFO_CHANNEL_FILTER = 131074u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_CHANNEL_SAMPLER implicitly + 1) */,
- AINFO_CHANNEL_LINEAR_TRANSFORM = 131075u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_CHANNEL_FILTER implicitly + 1) */,
- AINFO_CHANNEL_NONLINEAR_MAP = 131076u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_CHANNEL_LINEAR_TRANSFORM implicitly + 1) */,
- AINFO_CHANNEL_RESAMPLER = 131077u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_CHANNEL_NONLINEAR_MAP implicitly + 1) */,
+ AINFO_CHANNEL_SAMPLER = 131073u /* ::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_CHANNEL_NOISE implicitly + 1 */,
+ AINFO_CHANNEL_FILTER = 131074u /* ::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_CHANNEL_SAMPLER implicitly + 1 */,
+ AINFO_CHANNEL_LINEAR_TRANSFORM = 131075u /* ::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_CHANNEL_FILTER implicitly + 1 */,
+ AINFO_CHANNEL_NONLINEAR_MAP = 131076u /* ::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_CHANNEL_LINEAR_TRANSFORM implicitly + 1 */,
+ AINFO_CHANNEL_RESAMPLER = 131077u /* ::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_CHANNEL_NONLINEAR_MAP implicitly + 1 */,
AINFO_LOCAL_GEOMAGNETIC_FIELD = 196608u /* 0x30000 */,
- AINFO_LOCAL_GRAVITY = 196609u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_LOCAL_GEOMAGNETIC_FIELD implicitly + 1) */,
- AINFO_DOCK_STATE = 196610u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_LOCAL_GRAVITY implicitly + 1) */,
- AINFO_HIGH_PERFORMANCE_MODE = 196611u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_DOCK_STATE implicitly + 1) */,
- AINFO_MAGNETIC_FIELD_CALIBRATION = 196612u /* (::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_HIGH_PERFORMANCE_MODE implicitly + 1) */,
+ AINFO_LOCAL_GRAVITY = 196609u /* ::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_LOCAL_GEOMAGNETIC_FIELD implicitly + 1 */,
+ AINFO_DOCK_STATE = 196610u /* ::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_LOCAL_GRAVITY implicitly + 1 */,
+ AINFO_HIGH_PERFORMANCE_MODE = 196611u /* ::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_DOCK_STATE implicitly + 1 */,
+ AINFO_MAGNETIC_FIELD_CALIBRATION = 196612u /* ::android::hardware::sensors::V1_0::AdditionalInfoType.AINFO_HIGH_PERFORMANCE_MODE implicitly + 1 */,
AINFO_CUSTOM_START = 268435456u /* 0x10000000 */,
AINFO_DEBUGGING_START = 1073741824u /* 0x40000000 */,
} additional_info_type_t;
typedef enum {
SENSOR_DIRECT_RATE_STOP = 0,
- SENSOR_DIRECT_RATE_NORMAL = 1 /* (::android::hardware::sensors::V1_0::RateLevel.STOP implicitly + 1) */,
- SENSOR_DIRECT_RATE_FAST = 2 /* (::android::hardware::sensors::V1_0::RateLevel.NORMAL implicitly + 1) */,
- SENSOR_DIRECT_RATE_VERY_FAST = 3 /* (::android::hardware::sensors::V1_0::RateLevel.FAST implicitly + 1) */,
+ SENSOR_DIRECT_RATE_NORMAL = 1 /* ::android::hardware::sensors::V1_0::RateLevel.STOP implicitly + 1 */,
+ SENSOR_DIRECT_RATE_FAST = 2 /* ::android::hardware::sensors::V1_0::RateLevel.NORMAL implicitly + 1 */,
+ SENSOR_DIRECT_RATE_VERY_FAST = 3 /* ::android::hardware::sensors::V1_0::RateLevel.FAST implicitly + 1 */,
} direct_rate_level_t;
typedef enum {
SENSOR_DIRECT_MEM_TYPE_ASHMEM = 1,
- SENSOR_DIRECT_MEM_TYPE_GRALLOC = 2 /* (::android::hardware::sensors::V1_0::SharedMemType.ASHMEM implicitly + 1) */,
+ SENSOR_DIRECT_MEM_TYPE_GRALLOC = 2 /* ::android::hardware::sensors::V1_0::SharedMemType.ASHMEM implicitly + 1 */,
} direct_mem_type_t;
typedef enum {
diff --git a/include/hardware/sensors.h b/include/hardware/sensors.h
index d058d3b..a03a409 100644
--- a/include/hardware/sensors.h
+++ b/include/hardware/sensors.h
@@ -185,6 +185,7 @@
#define SENSOR_STRING_TYPE_ADDITIONAL_INFO "android.sensor.additional_info"
#define SENSOR_STRING_TYPE_LOW_LATENCY_OFFBODY_DETECT "android.sensor.low_latency_offbody_detect"
#define SENSOR_STRING_TYPE_ACCELEROMETER_UNCALIBRATED "android.sensor.accelerometer_uncalibrated"
+#define SENSOR_STRING_TYPE_HINGE_ANGLE "android.sensor.hinge_angle"
/**
* Values returned by the accelerometer in various locations in the universe.
diff --git a/include/hardware/sound_trigger.h b/include/hardware/sound_trigger.h
index 99346ef..7119637 100644
--- a/include/hardware/sound_trigger.h
+++ b/include/hardware/sound_trigger.h
@@ -41,7 +41,8 @@
#define SOUND_TRIGGER_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0)
#define SOUND_TRIGGER_DEVICE_API_VERSION_1_1 HARDWARE_DEVICE_API_VERSION(1, 1)
#define SOUND_TRIGGER_DEVICE_API_VERSION_1_2 HARDWARE_DEVICE_API_VERSION(1, 2)
-#define SOUND_TRIGGER_DEVICE_API_VERSION_CURRENT SOUND_TRIGGER_DEVICE_API_VERSION_1_2
+#define SOUND_TRIGGER_DEVICE_API_VERSION_1_3 HARDWARE_DEVICE_API_VERSION(1, 3)
+#define SOUND_TRIGGER_DEVICE_API_VERSION_CURRENT SOUND_TRIGGER_DEVICE_API_VERSION_1_3
/**
* List of known sound trigger HAL modules. This is the base name of the sound_trigger HAL
@@ -123,6 +124,60 @@
*/
int (*get_model_state)(const struct sound_trigger_hw_device *dev,
sound_model_handle_t sound_model_handle);
+
+ /* Set a model specific ModelParameter with the given value. This parameter
+ * will keep its value for the duration the model is loaded regardless of starting and stopping
+ * recognition. Once the model is unloaded, the value will be lost.
+ * Returns 0 or an error code.
+ * Only supported for device api versions SOUND_TRIGGER_DEVICE_API_VERSION_1_3 or above.
+ */
+ int (*set_parameter)(const struct sound_trigger_hw_device *dev,
+ sound_model_handle_t sound_model_handle,
+ sound_trigger_model_parameter_t model_param, int32_t value);
+
+ /* Get a model specific ModelParameter. This parameter will keep its value
+ * for the duration the model is loaded regardless of starting and stopping recognition.
+ * Once the model is unloaded, the value will be lost. If the value is not set, a default
+ * value is returned. See sound_trigger_model_parameter_t for parameter default values.
+ * Returns 0 or an error code. On return 0, value pointer will be set.
+ * Only supported for device api versions SOUND_TRIGGER_DEVICE_API_VERSION_1_3 or above.
+ */
+ int (*get_parameter)(const struct sound_trigger_hw_device *dev,
+ sound_model_handle_t sound_model_handle,
+ sound_trigger_model_parameter_t model_param, int32_t* value);
+
+ /* Get supported parameter attributes with respect to the provided model
+ * handle. Along with determining the valid range, this API is also used
+ * to determine if a given parameter ID is supported at all by the
+ * modelHandle for use with getParameter and setParameter APIs.
+ * Only supported for device api versions SOUND_TRIGGER_DEVICE_API_VERSION_1_3 or above.
+ */
+ int (*query_parameter)(const struct sound_trigger_hw_device *dev,
+ sound_model_handle_t sound_model_handle,
+ sound_trigger_model_parameter_t model_param,
+ sound_trigger_model_parameter_range_t* param_range);
+
+ /*
+ * Retrieve verbose extended implementation properties.
+ * The header pointer is intented to be cast to the proper extended
+ * properties struct based on the header version.
+ * The returned pointer is valid throughout the lifetime of the driver.
+ * Only supported for device api versions SOUND_TRIGGER_DEVICE_API_VERSION_1_3 or above.
+ */
+ const struct sound_trigger_properties_header* (*get_properties_extended)
+ (const struct sound_trigger_hw_device *dev);
+
+ /* Start recognition on a given model. Only one recognition active at a time per model.
+ * Once recognition succeeds of fails, the callback is called.
+ * Recognition API includes extended config fields. The header is intended to be base to
+ * the proper config struct based on the header version.
+ * Only supported for device api versions SOUND_TRIGGER_DEVICE_API_VERSION_1_3 or above.
+ */
+ int (*start_recognition_extended)(const struct sound_trigger_hw_device *dev,
+ sound_model_handle_t sound_model_handle,
+ const struct sound_trigger_recognition_config_header *header,
+ recognition_callback_t callback,
+ void *cookie);
};
typedef struct sound_trigger_hw_device sound_trigger_hw_device_t;
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..103f57d 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) {
@@ -819,12 +821,22 @@
return 0;
}
- // If the write to the sink would block when no input stream is present, flush enough frames
+ // If the write to the sink would block, flush enough frames
// from the pipe to make space to write the most recent data.
+ // We DO NOT block if:
+ // - no peer input stream is present
+ // - the peer input is in standby AFTER having been active.
+ // We DO block if:
+ // - the input was never activated to avoid discarding first frames
+ // in the pipe in case capture start was delayed
{
const size_t availableToWrite = sink->availableToWrite();
+ // NOTE: rsxSink has been checked above and sink and source life cycles are synchronized
sp<MonoPipeReader> source = rsxadev->routes[out->route_handle].rsxSource;
- if (rsxadev->routes[out->route_handle].input == NULL && availableToWrite < frames) {
+ const struct submix_stream_in *in = rsxadev->routes[out->route_handle].input;
+ const bool dont_block = (in == NULL)
+ || (in->input_standby && (in->read_counter_frames != 0));
+ if (dont_block && availableToWrite < frames) {
static uint8_t flush_buffer[64];
const size_t flushBufferSizeFrames = sizeof(flush_buffer) / frame_size;
size_t frames_to_flush_from_source = frames - availableToWrite;
@@ -894,8 +906,14 @@
int ret = -EWOULDBLOCK;
pthread_mutex_lock(&rsxadev->lock);
- const ssize_t frames_in_pipe =
- rsxadev->routes[out->route_handle].rsxSource->availableToRead();
+ sp<MonoPipeReader> source = rsxadev->routes[out->route_handle].rsxSource;
+ if (source == NULL) {
+ ALOGW("%s called on released output", __FUNCTION__);
+ pthread_mutex_unlock(&rsxadev->lock);
+ return -ENODEV;
+ }
+
+ const ssize_t frames_in_pipe = source->availableToRead();
if (CC_UNLIKELY(frames_in_pipe < 0)) {
*frames = out->frames_written;
ret = 0;
@@ -928,8 +946,14 @@
struct submix_audio_device * const rsxadev = out->dev;
pthread_mutex_lock(&rsxadev->lock);
- const ssize_t frames_in_pipe =
- rsxadev->routes[out->route_handle].rsxSource->availableToRead();
+ sp<MonoPipeReader> source = rsxadev->routes[out->route_handle].rsxSource;
+ if (source == NULL) {
+ ALOGW("%s called on released output", __FUNCTION__);
+ pthread_mutex_unlock(&rsxadev->lock);
+ return -ENODEV;
+ }
+
+ const ssize_t frames_in_pipe = source->availableToRead();
if (CC_UNLIKELY(frames_in_pipe < 0)) {
*dsp_frames = (uint32_t)out->frames_written_since_standby;
} else {
@@ -960,7 +984,7 @@
{
(void)stream;
(void)timestamp;
- return -EINVAL;
+ return -ENOSYS;
}
/** audio_stream_in implementation **/
@@ -1552,6 +1576,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 +1650,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 +1743,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/modules/usbaudio/audio_hal.c b/modules/usbaudio/audio_hal.c
index f0ea015..a19a0ae 100644
--- a/modules/usbaudio/audio_hal.c
+++ b/modules/usbaudio/audio_hal.c
@@ -1142,6 +1142,7 @@
// adev_close_input_stream() in this case.
*stream_in = NULL;
free(in);
+ return ret;
}
device_lock(in->adev);
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";