Merge "Handle error from fopen_path in finish_recovery"
diff --git a/Android.mk b/Android.mk
index 384eefe..b1d84cd 100644
--- a/Android.mk
+++ b/Android.mk
@@ -22,7 +22,7 @@
LOCAL_CFLAGS := -O2 -g -DADB_HOST=0 -Wall -Wno-unused-parameter -Werror
LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
LOCAL_MODULE := libfusesideload
-LOCAL_STATIC_LIBRARIES := libcutils libc libcrypto_static
+LOCAL_STATIC_LIBRARIES := libcutils libc libcrypto
include $(BUILD_STATIC_LIBRARY)
# libmounts (static library)
@@ -85,8 +85,8 @@
libminui \
libpng \
libfs_mgr \
- libcrypto_utils_static \
- libcrypto_static \
+ libcrypto_utils \
+ libcrypto \
libbase \
libcutils \
libutils \
@@ -144,7 +144,7 @@
asn1_decoder.cpp \
verifier.cpp \
ui.cpp
-LOCAL_STATIC_LIBRARIES := libcrypto_utils_static libcrypto_static
+LOCAL_STATIC_LIBRARIES := libcrypto_utils libcrypto
include $(BUILD_STATIC_LIBRARY)
include $(LOCAL_PATH)/minui/Android.mk \
diff --git a/applypatch/Android.mk b/applypatch/Android.mk
index 48efe34..604787e 100644
--- a/applypatch/Android.mk
+++ b/applypatch/Android.mk
@@ -33,7 +33,7 @@
LOCAL_STATIC_LIBRARIES += \
libotafault \
libbase \
- libcrypto_static \
+ libcrypto \
libbz \
libz
include $(BUILD_STATIC_LIBRARY)
@@ -48,7 +48,7 @@
$(LOCAL_PATH)/include \
bootable/recovery
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
-LOCAL_STATIC_LIBRARIES += libcrypto_static libbz libz
+LOCAL_STATIC_LIBRARIES += libcrypto libbz libz
include $(BUILD_STATIC_LIBRARY)
# libimgpatch (host static library)
@@ -62,7 +62,7 @@
$(LOCAL_PATH)/include \
bootable/recovery
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
-LOCAL_STATIC_LIBRARIES += libcrypto_static libbz libz
+LOCAL_STATIC_LIBRARIES += libcrypto libbz libz
include $(BUILD_HOST_STATIC_LIBRARY)
# applypatch (executable)
@@ -78,7 +78,7 @@
libedify \
libotafault \
libminzip \
- libcrypto_static \
+ libcrypto \
libbz
LOCAL_SHARED_LIBRARIES += libz libcutils libc
include $(BUILD_EXECUTABLE)
diff --git a/minui/Android.mk b/minui/Android.mk
index 3057f45..380ec2b 100644
--- a/minui/Android.mk
+++ b/minui/Android.mk
@@ -11,6 +11,7 @@
LOCAL_WHOLE_STATIC_LIBRARIES += libadf
LOCAL_WHOLE_STATIC_LIBRARIES += libdrm
+LOCAL_WHOLE_STATIC_LIBRARIES += libsync_recovery
LOCAL_STATIC_LIBRARIES += libpng
LOCAL_MODULE := libminui
diff --git a/minui/graphics_adf.cpp b/minui/graphics_adf.cpp
index a72e40b..3c35410 100644
--- a/minui/graphics_adf.cpp
+++ b/minui/graphics_adf.cpp
@@ -26,11 +26,13 @@
#include <sys/mman.h>
#include <adf/adf.h>
+#include <sync/sync.h>
#include "graphics.h"
struct adf_surface_pdata {
GRSurface base;
+ int fence_fd;
int fd;
__u32 offset;
__u32 pitch;
@@ -55,6 +57,7 @@
static int adf_surface_init(adf_pdata *pdata, drm_mode_modeinfo *mode, adf_surface_pdata *surf) {
memset(surf, 0, sizeof(*surf));
+ surf->fence_fd = -1;
surf->fd = adf_interface_simple_buffer_alloc(pdata->intf_fd, mode->hdisplay,
mode->vdisplay, pdata->format, &surf->offset, &surf->pitch);
if (surf->fd < 0)
@@ -194,6 +197,23 @@
return ret;
}
+static void adf_sync(adf_surface_pdata *surf)
+{
+ unsigned int warningTimeout = 3000;
+
+ if (surf == NULL)
+ return;
+
+ if (surf->fence_fd >= 0){
+ int err = sync_wait(surf->fence_fd, warningTimeout);
+ if (err < 0)
+ perror("adf sync fence wait error\n");
+
+ close(surf->fence_fd);
+ surf->fence_fd = -1;
+ }
+}
+
static GRSurface* adf_flip(minui_backend *backend)
{
adf_pdata *pdata = (adf_pdata *)backend;
@@ -203,9 +223,10 @@
surf->base.width, surf->base.height, pdata->format, surf->fd,
surf->offset, surf->pitch, -1);
if (fence_fd >= 0)
- close(fence_fd);
+ surf->fence_fd = fence_fd;
pdata->current_surface = (pdata->current_surface + 1) % pdata->n_surfaces;
+ adf_sync(&pdata->surfaces[pdata->current_surface]);
return &pdata->surfaces[pdata->current_surface].base;
}
@@ -219,6 +240,7 @@
static void adf_surface_destroy(adf_surface_pdata *surf)
{
munmap(surf->base.data, surf->pitch * surf->base.height);
+ close(surf->fence_fd);
close(surf->fd);
}
diff --git a/tests/Android.mk b/tests/Android.mk
index 7b004b2..a683395 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -39,8 +39,8 @@
LOCAL_STATIC_LIBRARIES := \
libbase \
libverifier \
- libcrypto_utils_static \
- libcrypto_static \
+ libcrypto_utils \
+ libcrypto \
libminui \
libminzip \
libcutils \
diff --git a/updater/Android.mk b/updater/Android.mk
index 75af4bd..b4d427c 100644
--- a/updater/Android.mk
+++ b/updater/Android.mk
@@ -34,8 +34,8 @@
libfec_rs \
libext4_utils_static \
libsquashfs_utils \
- libcrypto_utils_static \
- libcrypto_static \
+ libcrypto_utils \
+ libcrypto \
libapplypatch \
libbase \
libotafault \