merge in jb-release history after reset to jb-dev
diff --git a/include/system/window.h b/include/system/window.h
index 8daa44b..89720d5 100644
--- a/include/system/window.h
+++ b/include/system/window.h
@@ -160,7 +160,7 @@
* Default width and height of ANativeWindow buffers, these are the
* dimensions of the window buffers irrespective of the
* NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS call and match the native window
- * size unless overriden by NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS.
+ * size unless overridden by NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS.
*/
NATIVE_WINDOW_DEFAULT_WIDTH = 6,
NATIVE_WINDOW_DEFAULT_HEIGHT = 7,
@@ -213,26 +213,42 @@
*
*/
NATIVE_WINDOW_TRANSFORM_HINT = 8,
+
+ /*
+ * Boolean that indicates whether the consumer is running more than
+ * one buffer behind the producer.
+ */
+ NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND = 9
};
-/* valid operations for the (*perform)() hook */
+/* Valid operations for the (*perform)() hook.
+ *
+ * Values marked as 'deprecated' are supported, but have been superceded by
+ * other functionality.
+ *
+ * Values marked as 'private' should be considered private to the framework.
+ * HAL implementation code with access to an ANativeWindow should not use these,
+ * as it may not interact properly with the framework's use of the
+ * ANativeWindow.
+ */
enum {
NATIVE_WINDOW_SET_USAGE = 0,
NATIVE_WINDOW_CONNECT = 1, /* deprecated */
NATIVE_WINDOW_DISCONNECT = 2, /* deprecated */
- NATIVE_WINDOW_SET_CROP = 3,
+ NATIVE_WINDOW_SET_CROP = 3, /* private */
NATIVE_WINDOW_SET_BUFFER_COUNT = 4,
NATIVE_WINDOW_SET_BUFFERS_GEOMETRY = 5, /* deprecated */
NATIVE_WINDOW_SET_BUFFERS_TRANSFORM = 6,
NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP = 7,
NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS = 8,
NATIVE_WINDOW_SET_BUFFERS_FORMAT = 9,
- NATIVE_WINDOW_SET_SCALING_MODE = 10,
+ NATIVE_WINDOW_SET_SCALING_MODE = 10, /* private */
NATIVE_WINDOW_LOCK = 11, /* private */
NATIVE_WINDOW_UNLOCK_AND_POST = 12, /* private */
NATIVE_WINDOW_API_CONNECT = 13, /* private */
NATIVE_WINDOW_API_DISCONNECT = 14, /* private */
NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS = 15, /* private */
+ NATIVE_WINDOW_SET_ACTIVE_RECT = 16, /* private */
};
/* parameter for NATIVE_WINDOW_[API_][DIS]CONNECT */
@@ -504,6 +520,26 @@
}
/*
+ * native_window_set_active_rect(..., active_rect)
+ * Sets the region of future queued buffers that are 'active'. Pixels outside
+ * this 'active' region are considered to be completely transparent regardless
+ * of the pixel values in the buffer. The active_rect argument specifies the
+ * active rectangle in buffer pixel coordinates.
+ *
+ * The specified active rectangle applies to all buffers queued after it is
+ * called.
+ *
+ * An error is returned if for instance the crop region is invalid,
+ * out of the buffer's bound or if the window is invalid.
+ */
+static inline int native_window_set_active_rect(
+ struct ANativeWindow* window,
+ android_native_rect_t const * active_rect)
+{
+ return window->perform(window, NATIVE_WINDOW_SET_ACTIVE_RECT, active_rect);
+}
+
+/*
* native_window_set_buffer_count(..., count)
* Sets the number of buffers associated with this native window.
*/
@@ -634,7 +670,6 @@
mode);
}
-
/*
* native_window_api_connect(..., int api)
* connects an API to this window. only one API can be connected at a time.
diff --git a/include/sysutils/SocketClient.h b/include/sysutils/SocketClient.h
index 4d7c4fa..85b58ef 100644
--- a/include/sysutils/SocketClient.h
+++ b/include/sysutils/SocketClient.h
@@ -64,6 +64,9 @@
void incRef();
bool decRef(); // returns true at 0 (but note: SocketClient already deleted)
+ // return a new string in quotes with '\\' and '\"' escaped for "my arg" transmissions
+ static char *quoteArg(const char *arg);
+
private:
// Send null-terminated C strings
int sendMsg(const char *msg);
diff --git a/libsysutils/src/SocketClient.cpp b/libsysutils/src/SocketClient.cpp
index 1533120..4a1227f 100644
--- a/libsysutils/src/SocketClient.cpp
+++ b/libsysutils/src/SocketClient.cpp
@@ -107,6 +107,29 @@
return sendData(buf, sizeof(buf));
}
+char *SocketClient::quoteArg(const char *arg) {
+ int len = strlen(arg);
+ char *result = (char *)malloc(len * 2 + 3);
+ char *current = result;
+ const char *end = arg + len;
+
+ *(current++) = '"';
+ while (arg < end) {
+ switch (*arg) {
+ case '\\':
+ case '"':
+ *(current++) = '\\'; // fallthrough
+ default:
+ *(current++) = *(arg++);
+ }
+ }
+ *(current++) = '"';
+ *(current++) = '\0';
+ result = (char *)realloc(result, current-result);
+ return result;
+}
+
+
int SocketClient::sendMsg(const char *msg) {
if (mSocket < 0) {
errno = EHOSTUNREACH;