am 73690b24: am 5fb1a34a: Merge "Added transfer progress reporting for push and pull commands."
* commit '73690b24c64bdd96db5316eead079d03b7dcd8ea':
Added transfer progress reporting for push and pull commands.
diff --git a/charger/Android.mk b/charger/Android.mk
index 40c7d78..b9d3473 100644
--- a/charger/Android.mk
+++ b/charger/Android.mk
@@ -24,7 +24,7 @@
LOCAL_C_INCLUDES := bootable/recovery
-LOCAL_STATIC_LIBRARIES := libminui libpng
+LOCAL_STATIC_LIBRARIES := libminui libpixelflinger_static libpng
ifeq ($(strip $(BOARD_CHARGER_ENABLE_SUSPEND)),true)
LOCAL_STATIC_LIBRARIES += libsuspend
endif
diff --git a/charger/charger.c b/charger/charger.c
index 402d0e8..8f9169d 100644
--- a/charger/charger.c
+++ b/charger/charger.c
@@ -91,6 +91,7 @@
};
struct frame {
+ const char *name;
int disp_time;
int min_capacity;
bool level_only;
@@ -141,27 +142,33 @@
static struct frame batt_anim_frames[] = {
{
+ .name = "charger/battery_0",
.disp_time = 750,
.min_capacity = 0,
},
{
+ .name = "charger/battery_1",
.disp_time = 750,
.min_capacity = 20,
},
{
+ .name = "charger/battery_2",
.disp_time = 750,
.min_capacity = 40,
},
{
+ .name = "charger/battery_3",
.disp_time = 750,
.min_capacity = 60,
},
{
+ .name = "charger/battery_4",
.disp_time = 750,
.min_capacity = 80,
.level_only = true,
},
{
+ .name = "charger/battery_5",
.disp_time = 750,
.min_capacity = BATTERY_FULL_THRESH,
},
@@ -191,8 +198,8 @@
static void clear_screen(void)
{
gr_color(0, 0, 0, 255);
- gr_clear();
-}
+ gr_fill(0, 0, gr_fb_width(), gr_fb_height());
+};
#define MAX_KLOG_WRITE_BUF_SZ 256
@@ -652,8 +659,8 @@
if (batt_anim->num_frames != 0) {
draw_surface_centered(charger, frame->surface);
- LOGV("drawing frame #%d min_cap=%d time=%d\n",
- batt_anim->cur_frame, frame->min_capacity,
+ LOGV("drawing frame #%d name=%s min_cap=%d time=%d\n",
+ batt_anim->cur_frame, frame->name, frame->min_capacity,
frame->disp_time);
}
}
@@ -975,27 +982,20 @@
ret = res_create_surface("charger/battery_fail", &charger->surf_unknown);
if (ret < 0) {
- LOGE("Cannot load battery_fail image\n");
+ LOGE("Cannot load image\n");
charger->surf_unknown = NULL;
}
- charger->batt_anim = &battery_animation;
+ for (i = 0; i < charger->batt_anim->num_frames; i++) {
+ struct frame *frame = &charger->batt_anim->frames[i];
- gr_surface* scale_frames;
- int scale_count;
- ret = res_create_multi_surface("charger/battery_scale", &scale_count, &scale_frames);
- if (ret < 0) {
- LOGE("Cannot load battery_scale image\n");
- charger->batt_anim->num_frames = 0;
- charger->batt_anim->num_cycles = 1;
- } else if (scale_count != charger->batt_anim->num_frames) {
- LOGE("battery_scale image has unexpected frame count (%d, expected %d)\n",
- scale_count, charger->batt_anim->num_frames);
- charger->batt_anim->num_frames = 0;
- charger->batt_anim->num_cycles = 1;
- } else {
- for (i = 0; i < charger->batt_anim->num_frames; i++) {
- charger->batt_anim->frames[i].surface = scale_frames[i];
+ ret = res_create_surface(frame->name, &frame->surface);
+ if (ret < 0) {
+ LOGE("Cannot load image %s\n", frame->name);
+ /* TODO: free the already allocated surfaces... */
+ charger->batt_anim->num_frames = 0;
+ charger->batt_anim->num_cycles = 1;
+ break;
}
}
diff --git a/charger/images/battery_0.png b/charger/images/battery_0.png
new file mode 100644
index 0000000..2347074
--- /dev/null
+++ b/charger/images/battery_0.png
Binary files differ
diff --git a/charger/images/battery_1.png b/charger/images/battery_1.png
new file mode 100644
index 0000000..cd34620
--- /dev/null
+++ b/charger/images/battery_1.png
Binary files differ
diff --git a/charger/images/battery_2.png b/charger/images/battery_2.png
new file mode 100644
index 0000000..3e4095e
--- /dev/null
+++ b/charger/images/battery_2.png
Binary files differ
diff --git a/charger/images/battery_3.png b/charger/images/battery_3.png
new file mode 100644
index 0000000..08c1551
--- /dev/null
+++ b/charger/images/battery_3.png
Binary files differ
diff --git a/charger/images/battery_4.png b/charger/images/battery_4.png
new file mode 100644
index 0000000..3a678da
--- /dev/null
+++ b/charger/images/battery_4.png
Binary files differ
diff --git a/charger/images/battery_5.png b/charger/images/battery_5.png
new file mode 100644
index 0000000..d8dc40e
--- /dev/null
+++ b/charger/images/battery_5.png
Binary files differ
diff --git a/charger/images/battery_charge.png b/charger/images/battery_charge.png
new file mode 100644
index 0000000..b501933
--- /dev/null
+++ b/charger/images/battery_charge.png
Binary files differ
diff --git a/charger/images/battery_fail.png b/charger/images/battery_fail.png
index aded88a..36fc254 100644
--- a/charger/images/battery_fail.png
+++ b/charger/images/battery_fail.png
Binary files differ
diff --git a/charger/images/battery_scale.png b/charger/images/battery_scale.png
deleted file mode 100644
index 2ae8f0f..0000000
--- a/charger/images/battery_scale.png
+++ /dev/null
Binary files differ
diff --git a/include/system/graphics.h b/include/system/graphics.h
index be86ae4..b33900b 100644
--- a/include/system/graphics.h
+++ b/include/system/graphics.h
@@ -297,6 +297,136 @@
HAL_TRANSFORM_RESERVED = 0x08,
};
+/**
+ * Colorspace Definitions
+ * ======================
+ *
+ * Colorspace is the definition of how pixel values should be interpreted.
+ * It includes primaries (including white point) and the transfer
+ * characteristic function, which describes both gamma curve and numeric
+ * range (within the bit depth).
+ */
+
+enum {
+ /*
+ * Arbitrary colorspace with manually defined characteristics.
+ * Colorspace definition must be communicated separately.
+ *
+ * This is used when specifying primaries, transfer characteristics,
+ * etc. separately.
+ *
+ * A typical use case is in video encoding parameters (e.g. for H.264),
+ * where a colorspace can have separately defined primaries, transfer
+ * characteristics, etc.
+ */
+ HAL_COLORSPACE_ARBITRARY = 0x1,
+
+ /*
+ * YCbCr Colorspaces
+ * -----------------
+ *
+ * Primaries are given using (x,y) coordinates in the CIE 1931 definition
+ * of x and y specified by ISO 11664-1.
+ *
+ * Transfer characteristics are the opto-electronic transfer characteristic
+ * at the source as a function of linear optical intensity (luminance).
+ */
+
+ /*
+ * JPEG File Interchange Format (JFIF)
+ *
+ * Same model as BT.601-625, but all values (Y, Cb, Cr) range from 0 to 255
+ *
+ * Transfer characteristic curve:
+ * E = 1.099 * L ^ 0.45 - 0.099, 1.00 >= L >= 0.018
+ * E = 4.500 L, 0.018 > L >= 0
+ * L - luminance of image 0 <= L <= 1 for conventional colorimetry
+ * E - corresponding electrical signal
+ *
+ * Primaries: x y
+ * green 0.290 0.600
+ * blue 0.150 0.060
+ * red 0.640 0.330
+ * white (D65) 0.3127 0.3290
+ */
+ HAL_COLORSPACE_JFIF = 0x101,
+
+ /*
+ * ITU-R Recommendation 601 (BT.601) - 625-line
+ *
+ * Standard-definition television, 625 Lines (PAL)
+ *
+ * For 8-bit-depth formats:
+ * Luma (Y) samples should range from 16 to 235, inclusive
+ * Chroma (Cb, Cr) samples should range from 16 to 240, inclusive
+ *
+ * For 10-bit-depth formats:
+ * Luma (Y) samples should range from 64 to 940, inclusive
+ * Chroma (Cb, Cr) samples should range from 64 to 960, inclusive
+ *
+ * Transfer characteristic curve:
+ * E = 1.099 * L ^ 0.45 - 0.099, 1.00 >= L >= 0.018
+ * E = 4.500 L, 0.018 > L >= 0
+ * L - luminance of image 0 <= L <= 1 for conventional colorimetry
+ * E - corresponding electrical signal
+ *
+ * Primaries: x y
+ * green 0.290 0.600
+ * blue 0.150 0.060
+ * red 0.640 0.330
+ * white (D65) 0.3127 0.3290
+ */
+ HAL_COLORSPACE_BT601_625 = 0x102,
+
+ /*
+ * ITU-R Recommendation 601 (BT.601) - 525-line
+ *
+ * Standard-definition television, 525 Lines (NTSC)
+ *
+ * For 8-bit-depth formats:
+ * Luma (Y) samples should range from 16 to 235, inclusive
+ * Chroma (Cb, Cr) samples should range from 16 to 240, inclusive
+ *
+ * For 10-bit-depth formats:
+ * Luma (Y) samples should range from 64 to 940, inclusive
+ * Chroma (Cb, Cr) samples should range from 64 to 960, inclusive
+ *
+ * Transfer characteristic curve:
+ * E = 1.099 * L ^ 0.45 - 0.099, 1.00 >= L >= 0.018
+ * E = 4.500 L, 0.018 > L >= 0
+ * L - luminance of image 0 <= L <= 1 for conventional colorimetry
+ * E - corresponding electrical signal
+ *
+ * Primaries: x y
+ * green 0.310 0.595
+ * blue 0.155 0.070
+ * red 0.630 0.340
+ * white (D65) 0.3127 0.3290
+ */
+ HAL_COLORSPACE_BT601_525 = 0x103,
+
+ /*
+ * ITU-R Recommendation 709 (BT.709)
+ *
+ * High-definition television
+ *
+ * For 8-bit-depth formats:
+ * Luma (Y) samples should range from 16 to 235, inclusive
+ * Chroma (Cb, Cr) samples should range from 16 to 240, inclusive
+ *
+ * For 10-bit-depth formats:
+ * Luma (Y) samples should range from 64 to 940, inclusive
+ * Chroma (Cb, Cr) samples should range from 64 to 960, inclusive
+ *
+ * Primaries: x y
+ * green 0.300 0.600
+ * blue 0.150 0.060
+ * red 0.640 0.330
+ * white (D65) 0.3127 0.3290
+ */
+ HAL_COLORSPACE_BT709 = 0x104,
+};
+
#ifdef __cplusplus
}
#endif
diff --git a/init/property_service.c b/init/property_service.c
index ac63377e..ff22677 100644
--- a/init/property_service.c
+++ b/init/property_service.c
@@ -24,6 +24,7 @@
#include <dirent.h>
#include <limits.h>
#include <errno.h>
+#include <sys/poll.h>
#include <cutils/misc.h>
#include <cutils/sockets.h>
@@ -368,6 +369,9 @@
socklen_t addr_size = sizeof(addr);
socklen_t cr_size = sizeof(cr);
char * source_ctx = NULL;
+ struct pollfd ufds[1];
+ const int timeout_ms = 2 * 1000; /* Default 2 sec timeout for caller to send property. */
+ int nr;
if ((s = accept(property_set_fd, (struct sockaddr *) &addr, &addr_size)) < 0) {
return;
@@ -380,7 +384,21 @@
return;
}
- r = TEMP_FAILURE_RETRY(recv(s, &msg, sizeof(msg), 0));
+ ufds[0].fd = s;
+ ufds[0].events = POLLIN;
+ ufds[0].revents = 0;
+ nr = TEMP_FAILURE_RETRY(poll(ufds, 1, timeout_ms));
+ if (nr == 0) {
+ ERROR("sys_prop: timeout waiting for uid=%d to send property message.\n", cr.uid);
+ close(s);
+ return;
+ } else if (nr < 0) {
+ ERROR("sys_prop: error waiting for uid=%d to send property message. err=%d %s\n", cr.uid, errno, strerror(errno));
+ close(s);
+ return;
+ }
+
+ r = TEMP_FAILURE_RETRY(recv(s, &msg, sizeof(msg), MSG_DONTWAIT));
if(r != sizeof(prop_msg)) {
ERROR("sys_prop: mis-match msg size received: %d expected: %zu errno: %d\n",
r, sizeof(prop_msg), errno);
@@ -522,7 +540,7 @@
|| (sb.st_uid != 0)
|| (sb.st_gid != 0)
|| (sb.st_nlink != 1)) {
- ERROR("skipping insecure property file %s (uid=%u gid=%u nlink=%d mode=%o)\n",
+ ERROR("skipping insecure property file %s (uid=%lu gid=%lu nlink=%d mode=%o)\n",
entry->d_name, sb.st_uid, sb.st_gid, sb.st_nlink, sb.st_mode);
close(fd);
continue;