Merge "surfaceflinger: use Mutex timedLock instead of tryLock loop"
diff --git a/cmds/dumpstate/utils.c b/cmds/dumpstate/utils.c
index e3042eb..81cdd12 100644
--- a/cmds/dumpstate/utils.c
+++ b/cmds/dumpstate/utils.c
@@ -360,7 +360,7 @@
         }
 
         if (timeout_seconds && elapsed / NANOS_PER_SEC > timeout_seconds) {
-            printf("*** %s: Timed out after %ds (killing pid %d)\n", command, (int) elapsed, pid);
+            printf("*** %s: Timed out after %.3fs (killing pid %d)\n", command, (float) elapsed / NANOS_PER_SEC, pid);
             kill(pid, SIGTERM);
             return -1;
         }
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index 98c51cc..3b09aa7 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -640,7 +640,7 @@
   return count;
 }
 
-static int split(char *buf, char **argv)
+static int split(char *buf, const char **argv)
 {
   char *ctx;
   int count = 0;
@@ -732,6 +732,9 @@
     bool have_dex2oat_isa_variant = property_get(dex2oat_isa_variant_key,
                                                  dex2oat_isa_variant, NULL) > 0;
 
+    const char *dex2oat_norelocation = "-Xnorelocate";
+    bool have_dex2oat_relocation_skip_flag = false;
+
     char dex2oat_flags[PROPERTY_VALUE_MAX];
     int dex2oat_flags_count = property_get("dalvik.vm.dex2oat-flags",
                                  dex2oat_flags, NULL) <= 0 ? 0 : split_count(dex2oat_flags);
@@ -804,6 +807,7 @@
     if (skip_compilation) {
         strcpy(dex2oat_compiler_filter_arg, "--compiler-filter=verify-none");
         have_dex2oat_compiler_filter_flag = true;
+        have_dex2oat_relocation_skip_flag = true;
     } else if (vm_safe_mode) {
         strcpy(dex2oat_compiler_filter_arg, "--compiler-filter=interpret-only");
         have_dex2oat_compiler_filter_flag = true;
@@ -813,18 +817,19 @@
 
     ALOGV("Running %s in=%s out=%s\n", DEX2OAT_BIN, input_file_name, output_file_name);
 
-    char* argv[7  // program name, mandatory arguments and the final NULL
-               + (have_dex2oat_isa_variant ? 1 : 0)
-               + (have_dex2oat_isa_features ? 1 : 0)
-               + (have_profile_file ? 1 : 0)
-               + (have_top_k_profile_threshold ? 1 : 0)
-               + (have_dex2oat_Xms_flag ? 2 : 0)
-               + (have_dex2oat_Xmx_flag ? 2 : 0)
-               + (have_dex2oat_compiler_filter_flag ? 1 : 0)
-               + (have_dex2oat_swap_fd ? 1 : 0)
-               + dex2oat_flags_count];
+    const char* argv[7  // program name, mandatory arguments and the final NULL
+                     + (have_dex2oat_isa_variant ? 1 : 0)
+                     + (have_dex2oat_isa_features ? 1 : 0)
+                     + (have_profile_file ? 1 : 0)
+                     + (have_top_k_profile_threshold ? 1 : 0)
+                     + (have_dex2oat_Xms_flag ? 2 : 0)
+                     + (have_dex2oat_Xmx_flag ? 2 : 0)
+                     + (have_dex2oat_compiler_filter_flag ? 1 : 0)
+                     + (have_dex2oat_swap_fd ? 1 : 0)
+                     + (have_dex2oat_relocation_skip_flag ? 2 : 0)
+                     + dex2oat_flags_count];
     int i = 0;
-    argv[i++] = (char*)DEX2OAT_BIN;
+    argv[i++] = DEX2OAT_BIN;
     argv[i++] = zip_fd_arg;
     argv[i++] = zip_location_arg;
     argv[i++] = oat_fd_arg;
@@ -843,11 +848,11 @@
         argv[i++] = top_k_profile_threshold_arg;
     }
     if (have_dex2oat_Xms_flag) {
-        argv[i++] = (char*)RUNTIME_ARG;
+        argv[i++] = RUNTIME_ARG;
         argv[i++] = dex2oat_Xms_arg;
     }
     if (have_dex2oat_Xmx_flag) {
-        argv[i++] = (char*)RUNTIME_ARG;
+        argv[i++] = RUNTIME_ARG;
         argv[i++] = dex2oat_Xmx_arg;
     }
     if (have_dex2oat_compiler_filter_flag) {
@@ -859,10 +864,14 @@
     if (dex2oat_flags_count) {
         i += split(dex2oat_flags, argv + i);
     }
+    if (have_dex2oat_relocation_skip_flag) {
+        argv[i++] = RUNTIME_ARG;
+        argv[i++] = dex2oat_norelocation;
+    }
     // Do not add after dex2oat_flags, they should override others for debugging.
     argv[i] = NULL;
 
-    execv(DEX2OAT_BIN, (char* const *)argv);
+    execv(DEX2OAT_BIN, (char * const *)argv);
     ALOGE("execv(%s) failed: %s\n", DEX2OAT_BIN, strerror(errno));
 }
 
diff --git a/services/inputflinger/Android.mk b/services/inputflinger/Android.mk
index 85edbe5..1af59a3 100644
--- a/services/inputflinger/Android.mk
+++ b/services/inputflinger/Android.mk
@@ -31,16 +31,13 @@
     libinput \
     liblog \
     libutils \
-	libui \
-	libhardware_legacy
+    libui \
+    libhardware_legacy
 
 
 # TODO: Move inputflinger to its own process and mark it hidden
 #LOCAL_CFLAGS += -fvisibility=hidden
 
-LOCAL_C_INCLUDES := \
-    external/openssl/include \
-
 LOCAL_CFLAGS += -Wno-unused-parameter
 
 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
diff --git a/services/inputflinger/EventHub.cpp b/services/inputflinger/EventHub.cpp
index 7a77c30..93ce010 100644
--- a/services/inputflinger/EventHub.cpp
+++ b/services/inputflinger/EventHub.cpp
@@ -858,7 +858,6 @@
                                     int(iev.time.tv_sec), int(iev.time.tv_usec));
                         }
 
-#ifdef HAVE_POSIX_CLOCKS
                         // Use the time specified in the event instead of the current time
                         // so that downstream code can get more accurate estimates of
                         // event dispatch latency from the time the event is enqueued onto
@@ -909,9 +908,6 @@
                                         event->when, time, now);
                             }
                         }
-#else
-                        event->when = now;
-#endif
                         event->deviceId = deviceId;
                         event->type = iev.type;
                         event->code = iev.code;