merge in master-release history after reset to e14b37eb07b394fef05da5ee09dc6d33e3a25711
diff --git a/adb/sysdeps.h b/adb/sysdeps.h
index 4033b72..ba4306f 100644
--- a/adb/sysdeps.h
+++ b/adb/sysdeps.h
@@ -169,6 +169,8 @@
/* normally provided by <cutils/sockets.h> */
extern int socket_loopback_client(int port, int type);
extern int socket_network_client(const char *host, int port, int type);
+extern int socket_network_client_timeout(const char *host, int port, int type,
+ int timeout);
extern int socket_loopback_server(int port, int type);
extern int socket_inaddr_any_server(int port, int type);
diff --git a/adb/sysdeps_win32.c b/adb/sysdeps_win32.c
index b0cb048..29f58ec 100644
--- a/adb/sysdeps_win32.c
+++ b/adb/sysdeps_win32.c
@@ -701,6 +701,13 @@
}
+int socket_network_client_timeout(const char *host, int port, int type, int timeout)
+{
+ // TODO: implement timeouts for Windows.
+ return socket_network_client(host, port, type);
+}
+
+
int socket_inaddr_any_server(int port, int type)
{
FH f = _fh_alloc( &_fh_socket_class );
diff --git a/healthd/BatteryMonitor.cpp b/healthd/BatteryMonitor.cpp
index ac649ce..4ee6249 100644
--- a/healthd/BatteryMonitor.cpp
+++ b/healthd/BatteryMonitor.cpp
@@ -27,6 +27,7 @@
#include <unistd.h>
#include <batteryservice/BatteryService.h>
#include <cutils/klog.h>
+#include <sys/types.h>
#include <utils/Errors.h>
#include <utils/String8.h>
#include <utils/Vector.h>
@@ -315,7 +316,11 @@
break;
case BATTERY_PROP_ENERGY_COUNTER:
- ret = NAME_NOT_FOUND;
+ if (mHealthdConfig->energyCounter) {
+ ret = mHealthdConfig->energyCounter(&val->valueInt64);
+ } else {
+ ret = NAME_NOT_FOUND;
+ }
break;
default:
diff --git a/healthd/healthd.cpp b/healthd/healthd.cpp
index 5fe2965..a1912f1 100644
--- a/healthd/healthd.cpp
+++ b/healthd/healthd.cpp
@@ -52,6 +52,7 @@
.batteryCurrentNowPath = String8(String8::kEmptyString),
.batteryCurrentAvgPath = String8(String8::kEmptyString),
.batteryChargeCounterPath = String8(String8::kEmptyString),
+ .energyCounter = NULL,
};
static int eventct;
diff --git a/healthd/healthd.h b/healthd/healthd.h
index 23a54bf..972e728 100644
--- a/healthd/healthd.h
+++ b/healthd/healthd.h
@@ -18,6 +18,7 @@
#define _HEALTHD_H_
#include <batteryservice/BatteryService.h>
+#include <sys/types.h>
#include <utils/Errors.h>
#include <utils/String8.h>
@@ -64,6 +65,8 @@
android::String8 batteryCurrentNowPath;
android::String8 batteryCurrentAvgPath;
android::String8 batteryChargeCounterPath;
+
+ int (*energyCounter)(int64_t *);
};
// Global helper functions
diff --git a/libcutils/Android.mk b/libcutils/Android.mk
index 945ebdd..e1d6f49 100644
--- a/libcutils/Android.mk
+++ b/libcutils/Android.mk
@@ -27,13 +27,6 @@
hashmap.c \
atomic.c.arm \
native_handle.c \
- socket_inaddr_any_server.c \
- socket_local_client.c \
- socket_local_server.c \
- socket_loopback_client.c \
- socket_loopback_server.c \
- socket_network_client.c \
- sockets.c \
config_utils.c \
cpu_info.c \
load_file.c \
@@ -67,7 +60,15 @@
ifneq ($(WINDOWS_HOST_ONLY),1)
commonSources += \
fs.c \
- multiuser.c
+ multiuser.c \
+ socket_inaddr_any_server.c \
+ socket_local_client.c \
+ socket_local_server.c \
+ socket_loopback_client.c \
+ socket_loopback_server.c \
+ socket_network_client.c \
+ sockets.c \
+
endif
diff --git a/libcutils/socket_network_client.c b/libcutils/socket_network_client.c
index 8a8474e..4826033 100644
--- a/libcutils/socket_network_client.c
+++ b/libcutils/socket_network_client.c
@@ -21,13 +21,11 @@
#include <string.h>
#include <unistd.h>
-#ifndef HAVE_WINSOCK
#include <sys/socket.h>
#include <sys/select.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
-#endif
#include <cutils/sockets.h>
@@ -68,13 +66,6 @@
s = socket(hp->h_addrtype, type, 0);
if (s < 0) return -1;
-#ifdef HAVE_WINSOCK
- if (connect(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
- close(s);
- return -1;
- }
- return s;
-#else
if ((flags = fcntl(s, F_GETFL, 0)) < 0) {
close(s);
return -1;
@@ -132,5 +123,4 @@
}
return s;
-#endif
}
diff --git a/liblog/tests/liblog_test.cpp b/liblog/tests/liblog_test.cpp
index ec35e45..393e2cd 100644
--- a/liblog/tests/liblog_test.cpp
+++ b/liblog/tests/liblog_test.cpp
@@ -544,7 +544,7 @@
EXPECT_LE(LOGGER_ENTRY_MAX_PAYLOAD - sizeof(big_payload_tag),
static_cast<size_t>(max_len));
- EXPECT_EQ(ret, max_len + sizeof(big_payload_tag));
+ EXPECT_EQ(ret, max_len + static_cast<ssize_t>(sizeof(big_payload_tag)));
}
TEST(liblog, dual_reader) {