Merge "contexthub: redefine hub_app_name" into nyc-dev
diff --git a/include/hardware/gps.h b/include/hardware/gps.h
index a54948c..4fc06bc 100644
--- a/include/hardware/gps.h
+++ b/include/hardware/gps.h
@@ -1469,7 +1469,7 @@
/**
* Leap second data.
* The sign of the value is defined by the following equation:
- * utc_time_ns = time_ns + (full_bias_ns + bias_ns) - leap_second *
+ * utc_time_ns = time_ns - (full_bias_ns + bias_ns) - leap_second *
* 1,000,000,000
*
* If the data is available 'flags' must contain GNSS_CLOCK_HAS_LEAP_SECOND.
@@ -1483,8 +1483,9 @@
* For local hardware clock, this value is expected to be monotonically
* increasing while the hardware clock remains power on. (For the case of a
* HW clock that is not continuously on, see the
- * hw_clock_discontinuity_count field). The real GPS time can be derived by
- * adding the 'full_bias_ns + bias_ns' (when it is available) to this value.
+ * hw_clock_discontinuity_count field). The receiver's estimate of GPS time
+ * can be derived by substracting the sum of full_bias_ns and bias_ns (when
+ * available) from this value.
*
* This GPS time is expected to be the best estimate of current GPS time
* that GNSS receiver can achieve.
@@ -1513,20 +1514,22 @@
* and the true GPS time since 0000Z, January 6, 1980, in nanoseconds.
*
* The sign of the value is defined by the following equation:
- * local estimate of GPS time = time_ns + (full_bias_ns + bias_ns)
+ * local estimate of GPS time = time_ns - (full_bias_ns + bias_ns)
*
* This value is mandatory if the receiver has estimated GPS time. If the
* computed time is for a non-GPS constellation, the time offset of that
- * constellation to GPS has to be applied to fill this value. The value
- * contains the 'bias uncertainty' in it, and the caller is responsible of
- * using the uncertainty. If the data is available 'flags' must contain
- * GNSS_CLOCK_HAS_FULL_BIAS.
+ * constellation to GPS has to be applied to fill this value. The error
+ * estimate for the sum of this and the bias_ns is the bias_uncertainty_ns,
+ * and the caller is responsible for using this uncertainty (it can be very
+ * large before the GPS time has been solved for.) If the data is available
+ * 'flags' must contain GNSS_CLOCK_HAS_FULL_BIAS.
*/
int64_t full_bias_ns;
/**
* Sub-nanosecond bias.
- * The value contains the 'bias uncertainty' in it.
+ * The error estimate for the sum of this and the full_bias_ns is the
+ * bias_uncertainty_ns
*
* If the data is available 'flags' must contain GNSS_CLOCK_HAS_BIAS. If GPS
* has computed a position fix. This value is mandatory if the receiver has
@@ -1549,7 +1552,8 @@
* The clock's drift in nanoseconds (per second).
*
* A positive value means that the frequency is higher than the nominal
- * frequency.
+ * frequency, and that the (full_bias_ns + bias_ns) is growing more positive
+ * over time.
*
* The value contains the 'drift uncertainty' in it.
* If the data is available 'flags' must contain GNSS_CLOCK_HAS_DRIFT.
diff --git a/include/hardware/hwcomposer2.h b/include/hardware/hwcomposer2.h
index 9650ae1..095557a 100644
--- a/include/hardware/hwcomposer2.h
+++ b/include/hardware/hwcomposer2.h
@@ -206,6 +206,7 @@
HWC2_FUNCTION_GET_DISPLAY_REQUESTS,
HWC2_FUNCTION_GET_DISPLAY_TYPE,
HWC2_FUNCTION_GET_DOZE_SUPPORT,
+ HWC2_FUNCTION_GET_HDR_CAPABILITIES,
HWC2_FUNCTION_GET_MAX_VIRTUAL_DISPLAY_COUNT,
HWC2_FUNCTION_GET_RELEASE_FENCES,
HWC2_FUNCTION_PRESENT_DISPLAY,
@@ -234,7 +235,7 @@
HWC2_FUNCTION_VALIDATE_DISPLAY,
} hwc2_function_descriptor_t;
-/* Layer requests returned from getDisplayRequests. */
+/* Layer requests returned from getDisplayRequests */
typedef enum {
/* The client should clear its target with transparent pixels where this
* layer would be. The client may ignore this request if the layer must be
@@ -412,6 +413,7 @@
case HWC2_FUNCTION_GET_DISPLAY_REQUESTS: return "GetDisplayRequests";
case HWC2_FUNCTION_GET_DISPLAY_TYPE: return "GetDisplayType";
case HWC2_FUNCTION_GET_DOZE_SUPPORT: return "GetDozeSupport";
+ case HWC2_FUNCTION_GET_HDR_CAPABILITIES: return "GetHdrCapabilities";
case HWC2_FUNCTION_GET_MAX_VIRTUAL_DISPLAY_COUNT:
return "GetMaxVirtualDisplayCount";
case HWC2_FUNCTION_GET_RELEASE_FENCES: return "GetReleaseFences";
@@ -603,6 +605,7 @@
GetDisplayRequests = HWC2_FUNCTION_GET_DISPLAY_REQUESTS,
GetDisplayType = HWC2_FUNCTION_GET_DISPLAY_TYPE,
GetDozeSupport = HWC2_FUNCTION_GET_DOZE_SUPPORT,
+ GetHdrCapabilities = HWC2_FUNCTION_GET_HDR_CAPABILITIES,
GetMaxVirtualDisplayCount = HWC2_FUNCTION_GET_MAX_VIRTUAL_DISPLAY_COUNT,
GetReleaseFences = HWC2_FUNCTION_GET_RELEASE_FENCES,
PresentDisplay = HWC2_FUNCTION_PRESENT_DISPLAY,
@@ -1244,6 +1247,42 @@
typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DOZE_SUPPORT)(
hwc2_device_t* device, hwc2_display_t display, int32_t* outSupport);
+/* getHdrCapabilities(..., outNumTypes, outTypes, outMaxLuminance,
+ * outMaxAverageLuminance, outMinLuminance)
+ * Descriptor: HWC2_FUNCTION_GET_HDR_CAPABILITIES
+ * Must be provided by all HWC2 devices
+ *
+ * Returns the high dynamic range (HDR) capabilities of the given display, which
+ * are invariant with regard to the active configuration.
+ *
+ * Displays which are not HDR-capable must return no types in outTypes and set
+ * outNumTypes to 0.
+ *
+ * If outTypes is NULL, the required number of HDR types must be returned in
+ * outNumTypes.
+ *
+ * Parameters:
+ * outNumTypes - if outTypes was NULL, the number of types which would have
+ * been returned; if it was not NULL, the number of types stored in
+ * outTypes, which must not exceed the value stored in outNumTypes prior
+ * to the call; pointer will be non-NULL
+ * outTypes - an array of HDR types, may have 0 elements if the display is not
+ * HDR-capable
+ * outMaxLuminance - the desired content maximum luminance for this display in
+ * cd/m^2; pointer will be non-NULL
+ * outMaxAverageLuminance - the desired content maximum frame-average
+ * luminance for this display in cd/m^2; pointer will be non-NULL
+ * outMinLuminance - the desired content minimum luminance for this display in
+ * cd/m^2; pointer will be non-NULL
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ * HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in
+ */
+typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_HDR_CAPABILITIES)(
+ hwc2_device_t* device, hwc2_display_t display, uint32_t* outNumTypes,
+ int32_t* /*android_hdr_t*/ outTypes, float* outMaxLuminance,
+ float* outMaxAverageLuminance, float* outMinLuminance);
+
/* getReleaseFences(..., outNumElements, outLayers, outFences)
* Descriptor: HWC2_FUNCTION_GET_RELEASE_FENCES
* Must be provided by all HWC2 devices
diff --git a/modules/soundtrigger/sound_trigger_hw.c b/modules/soundtrigger/sound_trigger_hw.c
index 0492fd5..20d97f2 100644
--- a/modules/soundtrigger/sound_trigger_hw.c
+++ b/modules/soundtrigger/sound_trigger_hw.c
@@ -45,6 +45,7 @@
#define COMMAND_RECOGNITION_ABORT "abort" // Argument: model index.
#define COMMAND_RECOGNITION_FAILURE "fail" // Argument: model index.
#define COMMAND_UPDATE "update" // Argument: model index.
+#define COMMAND_CLEAR "clear" // Removes all models from the list.
#define COMMAND_CLOSE "close" // Close just closes the network port, keeps thread running.
#define COMMAND_END "end" // Closes connection and stops the thread.
@@ -99,6 +100,8 @@
recognition_callback_t recognition_callback;
void *recognition_cookie;
+ bool model_started;
+
// Next recognition_context in the linked list
struct recognition_context *next;
};
@@ -239,6 +242,7 @@
}
bool parse_socket_data(int conn_socket, struct stub_sound_trigger_device* stdev);
+static void unload_all_sound_models(struct stub_sound_trigger_device *stdev);
static char *sound_trigger_keyphrase_event_alloc(sound_model_handle_t handle,
struct sound_trigger_recognition_config *config,
@@ -472,6 +476,7 @@
ALOGI("%s", __func__);
struct recognition_context *last_model_context = stdev->root_model_context;
unsigned int model_index = 0;
+ write_string(conn_socket, "-----------------------\n");
if (!last_model_context) {
ALOGI("ZERO Models exist.");
write_string(conn_socket, "Zero models exist.\n");
@@ -495,8 +500,15 @@
write_vastr(conn_socket, "Unknown sound model type: %d\n", model_type);
ALOGI("Unknown sound model type: %d", model_type);
}
- write_string(conn_socket, "----\n\n");
- ALOGI("----");
+ if (last_model_context->model_started) {
+ write_string(conn_socket, "Model started.\n");
+ ALOGI("Model started.\n");
+ } else {
+ write_string(conn_socket, "Model stopped.\n");
+ ALOGI("Model stopped.\n");
+ }
+ write_string(conn_socket, "-----------------------\n\n");
+ ALOGI("----\n\n");
last_model_context = last_model_context->next;
model_index++;
}
@@ -524,6 +536,7 @@
// Note: Since we acquire a lock inside this loop, do not use break or other
// exit methods without releasing this lock.
+ write_string(conn_socket, "\n>>> ");
while(!input_done) {
if (fgets(buffer, PARSE_BUF_LEN, input_fp) != NULL) {
pthread_mutex_lock(&stdev->lock);
@@ -540,6 +553,8 @@
send_event(conn_socket, stdev, EVENT_RECOGNITION, RECOGNITION_STATUS_FAILURE);
} else if (strcmp(command, COMMAND_UPDATE) == 0) {
send_event(conn_socket, stdev, EVENT_SOUND_MODEL, SOUND_MODEL_STATUS_UPDATED);
+ } else if (strncmp(command, COMMAND_CLEAR, 5) == 0) {
+ unload_all_sound_models(stdev);
} else if (strncmp(command, COMMAND_CLOSE, 5) == 0) {
ALOGI("Closing this connection.");
write_string(conn_socket, "Closing this connection.");
@@ -550,13 +565,14 @@
continue_listening = false;
input_done = true;
} else {
- write_vastr(conn_socket, "Bad command %s.\n", command);
+ write_vastr(conn_socket, "\nBad command %s.\n\n", command);
}
pthread_mutex_unlock(&stdev->lock);
} else {
ALOGI("parse_socket_data done (got null)");
input_done = true; // break.
}
+ write_string(conn_socket, "\n>>> ");
}
return continue_listening;
}
@@ -651,18 +667,35 @@
model_context->recognition_callback = NULL;
model_context->recognition_cookie = NULL;
model_context->next = NULL;
+ model_context->model_started = false;
ALOGI("Sound model loaded: Handle %d ", *handle);
pthread_mutex_unlock(&stdev->lock);
return status;
}
+static void unload_all_sound_models(struct stub_sound_trigger_device *stdev) {
+ ALOGI("%s", __func__);
+ struct recognition_context *model_context = stdev->root_model_context;
+ stdev->root_model_context = NULL;
+ pthread_mutex_lock(&stdev->lock);
+ while (model_context) {
+ ALOGI("Deleting model with handle: %d", model_context->model_handle);
+ struct recognition_context *temp = model_context;
+ model_context = model_context->next;
+ free(temp->config);
+ free(temp);
+ }
+ pthread_mutex_unlock(&stdev->lock);
+}
+
static int stdev_unload_sound_model(const struct sound_trigger_hw_device *dev,
sound_model_handle_t handle) {
// If recognizing, stop_recognition must be called for a sound model before unload_sound_model
ALOGI("%s", __func__);
struct stub_sound_trigger_device *stdev = (struct stub_sound_trigger_device *)dev;
int status = 0;
+ ALOGI("unload_sound_model:%d", handle);
pthread_mutex_lock(&stdev->lock);
struct recognition_context *model_context = NULL;
@@ -683,7 +716,7 @@
pthread_mutex_unlock(&stdev->lock);
return -ENOSYS;
}
- if(previous_model_context) {
+ if (previous_model_context) {
previous_model_context->next = model_context->next;
} else {
stdev->root_model_context = model_context->next;
@@ -725,6 +758,7 @@
}
model_context->recognition_callback = callback;
model_context->recognition_cookie = cookie;
+ model_context->model_started = true;
pthread_mutex_unlock(&stdev->lock);
ALOGI("%s done for handle %d", __func__, handle);
@@ -748,6 +782,7 @@
model_context->config = NULL;
model_context->recognition_callback = NULL;
model_context->recognition_cookie = NULL;
+ model_context->model_started = false;
pthread_mutex_unlock(&stdev->lock);
ALOGI("%s done for handle %d", __func__, handle);
@@ -766,6 +801,7 @@
model_context->config = NULL;
model_context->recognition_callback = NULL;
model_context->recognition_cookie = NULL;
+ model_context->model_started = false;
ALOGI("%s stopped handle %d", __func__, model_context->model_handle);
model_context = model_context->next;