Merge "BufferQueue: Add NATIVE_WINDOW_BUFFER_AGE query"
diff --git a/cmds/installd/commands.cpp b/cmds/installd/commands.cpp
index de6fd96..6aa2bb4 100644
--- a/cmds/installd/commands.cpp
+++ b/cmds/installd/commands.cpp
@@ -684,6 +684,15 @@
ALOGE("execv(%s) failed: %s\n", PATCHOAT_BIN, strerror(errno));
}
+static bool check_boolean_property(const char* property_name, bool default_value = false) {
+ char tmp_property_value[PROPERTY_VALUE_MAX];
+ bool have_property = property_get(property_name, tmp_property_value, nullptr) > 0;
+ if (!have_property) {
+ return default_value;
+ }
+ return strcmp(tmp_property_value, "true") == 0;
+}
+
static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
const char* output_file_name, int swap_fd, const char *pkgname, const char *instruction_set,
bool vm_safe_mode, bool debuggable)
@@ -744,9 +753,8 @@
(strcmp(vold_decrypt, "trigger_restart_min_framework") == 0 ||
(strcmp(vold_decrypt, "1") == 0)));
- char use_jit_property[PROPERTY_VALUE_MAX];
- bool have_jit_property = property_get("debug.usejit", use_jit_property, NULL) > 0;
- bool use_jit = have_jit_property && strcmp(use_jit_property, "true") == 0;
+ bool use_jit = check_boolean_property("debug.usejit");
+ bool gen_cfi = check_boolean_property("debug.gencfi");
static const char* DEX2OAT_BIN = "/system/bin/dex2oat";
@@ -839,6 +847,7 @@
+ (have_dex2oat_threads_flag ? 1 : 0)
+ (have_dex2oat_swap_fd ? 1 : 0)
+ (have_dex2oat_relocation_skip_flag ? 2 : 0)
+ + (gen_cfi ? 1 : 0)
+ (debuggable ? 1 : 0)
+ dex2oat_flags_count];
int i = 0;
@@ -877,6 +886,9 @@
if (have_dex2oat_swap_fd) {
argv[i++] = dex2oat_swap_fd;
}
+ if (gen_cfi) {
+ argv[i++] = "--include-cfi";
+ }
if (debuggable) {
argv[i++] = "--debuggable";
}
diff --git a/include/gui/Surface.h b/include/gui/Surface.h
index a9f78cf..fd6d48c 100644
--- a/include/gui/Surface.h
+++ b/include/gui/Surface.h
@@ -179,7 +179,7 @@
virtual int unlockAndPost();
virtual int connect(int api, const sp<IProducerListener>& listener);
- virtual int detachNextBuffer(ANativeWindowBuffer** outBuffer,
+ virtual int detachNextBuffer(sp<GraphicBuffer>* outBuffer,
sp<Fence>* outFence);
virtual int attachBuffer(ANativeWindowBuffer*);
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 2c566f9..0921186 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -1626,7 +1626,7 @@
binder_size_t* objects = NULL;
if (objectsSize) {
- objects = (binder_size_t*)malloc(objectsSize*sizeof(binder_size_t));
+ objects = (binder_size_t*)calloc(objectsSize, sizeof(binder_size_t));
if (!objects) {
free(data);
diff --git a/libs/gui/IGraphicBufferConsumer.cpp b/libs/gui/IGraphicBufferConsumer.cpp
index 3f23c2f..6658ab1 100644
--- a/libs/gui/IGraphicBufferConsumer.cpp
+++ b/libs/gui/IGraphicBufferConsumer.cpp
@@ -414,6 +414,15 @@
reply->writeInt32(result);
return NO_ERROR;
}
+ case GET_SIDEBAND_STREAM: {
+ CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
+ sp<NativeHandle> stream = getSidebandStream();
+ reply->writeInt32(static_cast<int32_t>(stream != NULL));
+ if (stream != NULL) {
+ reply->writeNativeHandle(stream->handle());
+ }
+ return NO_ERROR;
+ }
case DUMP: {
CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
String8 result = data.readString8();
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index b8acad2..5d81f10 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -651,7 +651,7 @@
return err;
}
-int Surface::detachNextBuffer(ANativeWindowBuffer** outBuffer,
+int Surface::detachNextBuffer(sp<GraphicBuffer>* outBuffer,
sp<Fence>* outFence) {
ATRACE_CALL();
ALOGV("Surface::detachNextBuffer");
@@ -670,7 +670,7 @@
return result;
}
- *outBuffer = buffer.get();
+ *outBuffer = buffer;
if (fence != NULL && fence->isValid()) {
*outFence = fence;
} else {
diff --git a/services/inputflinger/InputReader.cpp b/services/inputflinger/InputReader.cpp
index 8634e42..318c85f 100644
--- a/services/inputflinger/InputReader.cpp
+++ b/services/inputflinger/InputReader.cpp
@@ -4315,7 +4315,7 @@
bottom = float(mRawPointerAxes.x.maxValue - rawLeft) * mXScale + mXTranslate;
top = float(mRawPointerAxes.x.maxValue - rawRight) * mXScale + mXTranslate;
orientation -= M_PI_2;
- if (orientation < mOrientedRanges.orientation.min) {
+ if (mOrientedRanges.haveOrientation && orientation < mOrientedRanges.orientation.min) {
orientation += (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min);
}
break;
@@ -4327,7 +4327,7 @@
bottom = float(mRawPointerAxes.y.maxValue - rawTop) * mYScale + mYTranslate;
top = float(mRawPointerAxes.y.maxValue - rawBottom) * mYScale + mYTranslate;
orientation -= M_PI;
- if (orientation < mOrientedRanges.orientation.min) {
+ if (mOrientedRanges.haveOrientation && orientation < mOrientedRanges.orientation.min) {
orientation += (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min);
}
break;
@@ -4339,7 +4339,7 @@
bottom = float(rawRight - mRawPointerAxes.x.minValue) * mXScale + mXTranslate;
top = float(rawLeft - mRawPointerAxes.x.minValue) * mXScale + mXTranslate;
orientation += M_PI_2;
- if (orientation > mOrientedRanges.orientation.max) {
+ if (mOrientedRanges.haveOrientation && orientation > mOrientedRanges.orientation.max) {
orientation -= (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min);
}
break;