Merge "Revert "Remove automatic adding of adb into default.prop""
diff --git a/core/Makefile b/core/Makefile
index f9e2906..88b0e27 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1146,7 +1146,8 @@
 	@echo Installed file list: $@
 	@mkdir -p $(dir $@)
 	@rm -f $@
-	$(hide) build/tools/fileslist.py $(TARGET_OUT) > $@
+	$(hide) build/tools/fileslist.py $(TARGET_OUT) > $(@:.txt=.json)
+	$(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
 
 .PHONY: installed-file-list
 installed-file-list: $(INSTALLED_FILES_FILE)
@@ -1592,7 +1593,8 @@
 	@echo Installed file list: $@
 	@mkdir -p $(dir $@)
 	@rm -f $@
-	$(hide) build/tools/fileslist.py $(TARGET_OUT_SYSTEM_OTHER) > $@
+	$(hide) build/tools/fileslist.py $(TARGET_OUT_SYSTEM_OTHER) > $(@:.txt=.json)
+	$(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
 
 systemotherimage_intermediates := \
     $(call intermediates-dir-for,PACKAGING,system_other)
@@ -1638,7 +1640,8 @@
 	@echo Installed file list: $@
 	@mkdir -p $(dir $@)
 	@rm -f $@
-	$(hide) build/tools/fileslist.py $(TARGET_OUT_VENDOR) > $@
+	$(hide) build/tools/fileslist.py $(TARGET_OUT_VENDOR) > $(@:.txt=.json)
+	$(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
 
 vendorimage_intermediates := \
     $(call intermediates-dir-for,PACKAGING,vendor)
@@ -2099,6 +2102,15 @@
 $(call dist-for-goals, target-files-package, $(BUILT_TARGET_FILES_PACKAGE))
 endif
 
+# -----------------------------------------------------------------
+# NDK Sysroot Package
+NDK_SYSROOT_TARGET := $(PRODUCT_OUT)/ndk_sysroot.tar.bz2
+$(NDK_SYSROOT_TARGET): ndk
+	@echo Package NDK sysroot...
+	$(hide) tar cjf $@ -C $(SOONG_OUT_DIR) ndk
+
+$(call dist-for-goals,sdk,$(NDK_SYSROOT_TARGET))
+
 ifeq ($(build_ota_package),true)
 # -----------------------------------------------------------------
 # OTA update package
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 91963f5..e496784 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -145,7 +145,7 @@
 LOCAL_DEX_PREOPT:= # '',true,false,nostripping
 LOCAL_DEX_PREOPT_IMAGE_LOCATION:=
 LOCAL_DEX_PREOPT_FLAGS:=
-LOCAL_PROTOC_OPTIMIZE_TYPE:= # lite(default),micro,nano,full,nanopb-c,nanopb-c-enable_malloc
+LOCAL_PROTOC_OPTIMIZE_TYPE:= # lite(default),micro,nano,stream,full,nanopb-c,nanopb-c-enable_malloc
 LOCAL_PROTOC_FLAGS:=
 LOCAL_PROTO_JAVA_OUTPUT_PARAMS:=
 LOCAL_VTSC_FLAGS:=
diff --git a/core/definitions.mk b/core/definitions.mk
index ed8f26d..52e28ce 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1150,6 +1150,7 @@
 ###########################################################
 ## Commands for running protoc to compile .proto into .java
 ###########################################################
+# PATH contains HOST_OUT_EXECUTABLES to allow protoc-gen-* plugins
 
 define transform-proto-to-java
 @mkdir -p $(dir $@)
@@ -1157,6 +1158,7 @@
 @rm -rf $(PRIVATE_PROTO_JAVA_OUTPUT_DIR)
 @mkdir -p $(PRIVATE_PROTO_JAVA_OUTPUT_DIR)
 $(hide) for f in $(PRIVATE_PROTO_SRC_FILES); do \
+        PATH=$$PATH:$(HOST_OUT_EXECUTABLES) \
         $(PROTOC) \
         $(addprefix --proto_path=, $(PRIVATE_PROTO_INCLUDES)) \
         $(PRIVATE_PROTO_JAVA_OUTPUT_OPTION)="$(PRIVATE_PROTO_JAVA_OUTPUT_PARAMS):$(PRIVATE_PROTO_JAVA_OUTPUT_DIR)" \
@@ -1169,10 +1171,14 @@
 ######################################################################
 ## Commands for running protoc to compile .proto into .pb.cc (or.pb.c) and .pb.h
 ######################################################################
+# PATH contains HOST_OUT_EXECUTABLES to allow protoc-gen-* plugins
+
 define transform-proto-to-cc
 @echo "Protoc: $@ <= $<"
 @mkdir -p $(dir $@)
-$(hide) $(PROTOC) \
+$(hide) \
+	PATH=$$PATH:$(HOST_OUT_EXECUTABLES) \
+	$(PROTOC) \
 	$(addprefix --proto_path=, $(PRIVATE_PROTO_INCLUDES)) \
 	$(PRIVATE_PROTOC_FLAGS) \
 	$<
diff --git a/core/java.mk b/core/java.mk
index 4370d8c..198c075 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -67,7 +67,11 @@
   ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
     LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-nano
   else
-    LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-lite
+    ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),stream)
+      # No library for stream protobufs
+    else
+      LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-lite
+    endif
   endif
 endif
 endif
diff --git a/core/java_common.mk b/core/java_common.mk
index 1119a37..aea6eb3 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -54,7 +54,12 @@
   ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
 $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javanano_out
   else
+    ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),stream)
+$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javastream_out
+$(proto_java_sources_file_stamp): $(HOST_OUT_EXECUTABLES)/protoc-gen-javastream
+    else
 $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --java_out
+    endif
   endif
 endif
 $(proto_java_sources_file_stamp): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS)
diff --git a/tools/fat16copy.py b/tools/fat16copy.py
index 1dd15b7..af8bd83 100755
--- a/tools/fat16copy.py
+++ b/tools/fat16copy.py
@@ -222,7 +222,8 @@
       data.seek(0, os.SEEK_END)
       size = data.tell()
 
-    chunk = self.backing.fs.allocate(size or 1)
+    # Empty files shouldn't have any clusters assigned.
+    chunk = self.backing.fs.allocate(size) if size > 0 else 0
     (shortname, ext) = self.make_short_name(name)
     self.add_dentry(0, shortname, ext, name, chunk, size)
 
@@ -240,10 +241,19 @@
     """
     chunk = self.backing.fs.allocate(1)
     (shortname, ext) = self.make_short_name(name)
-    new_dentry = dentry(self.backing.fs, ATTRIBUTE_SUBDIRECTORY,
-        shortname, ext, name, chunk, 0)
-    new_dentry.commit(self.backing)
-    return new_dentry.open_directory()
+    new_dentry = self.add_dentry(ATTRIBUTE_SUBDIRECTORY, shortname,
+            ext, name, chunk, 0)
+    result = new_dentry.open_directory()
+
+    parent_cluster = 0
+
+    if hasattr(self.backing, 'start_cluster'):
+      parent_cluster = self.backing.start_cluster
+
+    result.add_dentry(ATTRIBUTE_SUBDIRECTORY, '.', '', '', chunk, 0)
+    result.add_dentry(ATTRIBUTE_SUBDIRECTORY, '..', '', '', parent_cluster, 0)
+
+    return result
 
 def lfn_checksum(name_data):
   """
@@ -380,28 +390,23 @@
     record_count = len(longname_record_data) + 1
 
     found_count = 0
-
-    while True:
+    while found_count < record_count:
       record = f.read(32)
 
       if record is None or len(record) != 32:
-        break
+        # We reached the EOF, so we need to extend the file with a new cluster.
+        f.write("\0" * self.fs.bytes_per_cluster)
+        f.seek(-self.fs.bytes_per_cluster, os.SEEK_CUR)
+        record = f.read(32)
 
       marker = struct.unpack("B", record[0])[0]
 
       if marker == DEL_MARKER or marker == 0:
         found_count += 1
-
-        if found_count == record_count:
-          break
       else:
         found_count = 0
 
-    if found_count != record_count:
-      f.write("\0" * self.fs.bytes_per_cluster)
-      f.seek(-self.fs.bytes_per_cluster, os.SEEK_CUR)
-    else:
-      f.seek(-(record_count * 32), os.SEEK_CUR)
+    f.seek(-(record_count * 32), os.SEEK_CUR)
     f.write(entry)
 
 class root_dentry_file(fake_file):
@@ -624,6 +629,8 @@
     Allocate a new cluster chain big enough to hold at least the given amount
     of bytes.
     """
+    assert amount > 0, "Must allocate a non-zero amount."
+
     f = self.f
     f.seek(FAT_TABLE_START + 4)
 
@@ -686,38 +693,17 @@
     Given a cluster which is the *last* cluster in a chain, extend it to hold
     at least `amount` more bytes.
     """
-    return_cluster = None
+    if amount == 0:
+      return
     f = self.f
-
-    position = FAT_TABLE_START + cluster * 2
-    f.seek(position)
-
+    entry_offset = FAT_TABLE_START + cluster * 2
+    f.seek(entry_offset)
     assert read_le_short(f) == 0xFFFF, "Extending from middle of chain"
-    rewind_short(f)
 
-    while position + 2 < FAT_TABLE_START + self.fat_size and amount > 0:
-      skip_short(f)
-      got = read_le_short(f)
-      rewind_short(f)
-      rewind_short(f)
-
-      if got != 0:
-        break
-
-      cluster += 1
-      return_cluster = return_cluster or cluster
-      position += 2
-      self.write_cluster_entry(cluster)
-
-    if amount < 0:
-      self.write_cluster_entry(0xFFFF)
-      return return_cluster
-
-    new_chunk = self.allocate(amount)
-    f.seek(FAT_TABLE_START + cluster * 2)
-    self.write_cluster_entry(new_chunk)
-
-    return return_cluster or new_chunk
+    return_cluster = self.allocate(amount)
+    f.seek(entry_offset)
+    self.write_cluster_entry(return_cluster)
+    return return_cluster
 
   def write_file(self, head_cluster, start_byte, data):
     """
@@ -728,35 +714,31 @@
     data: The data to write.
     """
     f = self.f
+    last_offset = start_byte + len(data)
+    current_offset = 0
+    current_cluster = head_cluster
 
-    while True:
-      if start_byte < self.bytes_per_cluster:
-        to_write = data[:self.bytes_per_cluster - start_byte]
-        data = data[self.bytes_per_cluster - start_byte:]
+    while current_offset < last_offset:
+      # Write everything that falls in the cluster starting at current_offset.
+      data_begin = max(0, current_offset - start_byte)
+      data_end = min(len(data),
+                     current_offset + self.bytes_per_cluster - start_byte)
+      if data_end > data_begin:
+        cluster_file_offset = (self.data_start() + self.root_entries * 32 +
+                               (current_cluster - 2) * self.bytes_per_cluster)
+        f.seek(cluster_file_offset + max(0, start_byte - current_offset))
+        f.write(data[data_begin:data_end])
 
-        cluster_bytes_from_root = (head_cluster - 2) * \
-            self.bytes_per_cluster
-        bytes_from_root = cluster_bytes_from_root + start_byte
-        bytes_from_data_start = bytes_from_root + self.root_entries * 32
+      # Advance to the next cluster in the chain or get a new cluster if needed.
+      current_offset += self.bytes_per_cluster
+      if last_offset > current_offset:
+        f.seek(FAT_TABLE_START + current_cluster * 2)
+        next_cluster = read_le_short(f)
+        if next_cluster > MAX_CLUSTER_ID:
+          next_cluster = self.extend_cluster(current_cluster, len(data))
+        current_cluster = next_cluster
+        assert current_cluster > 0, "Cannot write free cluster"
 
-        f.seek(self.data_start() + bytes_from_data_start)
-        f.write(to_write)
-
-        if len(data) == 0:
-          return
-
-      start_byte -= self.bytes_per_cluster
-
-      if start_byte < 0:
-        start_byte = 0
-
-      f.seek(FAT_TABLE_START + head_cluster * 2)
-      next_cluster = read_le_short(f)
-      if next_cluster > MAX_CLUSTER_ID:
-        head_cluster = self.extend_cluster(head_cluster, len(data))
-      else:
-        head_cluster = next_cluster
-      assert head_cluster > 0, "Cannot write free cluster"
 
 def add_item(directory, item):
   """
@@ -770,7 +752,7 @@
     if len(base) == 0:
       base = os.path.basename(item[:-1])
     sub = directory.new_subdirectory(base)
-    for next_item in os.listdir(item):
+    for next_item in sorted(os.listdir(item)):
       add_item(sub, os.path.join(item, next_item))
   else:
     with open(item, 'rb') as f:
diff --git a/tools/fileslist.py b/tools/fileslist.py
index a11efaa..b9e7350 100755
--- a/tools/fileslist.py
+++ b/tools/fileslist.py
@@ -15,12 +15,24 @@
 # limitations under the License.
 #
 
-import operator, os, sys
+import json, hashlib, operator, os, sys
 
 def get_file_size(path):
   st = os.lstat(path)
   return st.st_size;
 
+def get_file_digest(path):
+  if os.path.isfile(path) == False:
+    return "----------------------------------------------------------------"
+  digest = hashlib.sha256()
+  with open(path, 'rb') as f:
+    while True:
+      buf = f.read(1024*1024)
+      if not buf:
+        break
+      digest.update(buf)
+  return digest.hexdigest();
+
 def main(argv):
   output = []
   roots = argv[1:]
@@ -30,16 +42,17 @@
       relative = dir[base:]
       for f in files:
         try:
-          row = (
-              get_file_size(os.path.sep.join((dir, f))),
-              os.path.sep.join((relative, f)),
-            )
+          path = os.path.sep.join((dir, f))
+          row = {
+              "Size": get_file_size(path),
+              "Name": os.path.sep.join((relative, f)),
+              "SHA256": get_file_digest(path),
+            }
           output.append(row)
         except os.error:
           pass
-  output.sort(key=operator.itemgetter(0), reverse=True)
-  for row in output:
-    print "%12d  %s" % row
+  output.sort(key=operator.itemgetter("Size", "Name"), reverse=True)
+  print json.dumps(output, indent=2, separators=(',',': '))
 
 if __name__ == '__main__':
   main(sys.argv)
diff --git a/tools/fileslist_util.py b/tools/fileslist_util.py
new file mode 100755
index 0000000..ff40d51
--- /dev/null
+++ b/tools/fileslist_util.py
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the 'License');
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an 'AS IS' BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import getopt, json, sys
+
+def PrintFileNames(path):
+  with open(path) as jf:
+    data = json.load(jf)
+  for line in data:
+    print(line["Name"])
+
+def PrintCanonicalList(path):
+  with open(path) as jf:
+    data = json.load(jf)
+  for line in data:
+    print "{0:12d}  {1}".format(line["Size"], line["Name"])
+
+def PrintUsage(name):
+  print("""
+Usage: %s -[nc] json_files_list
+ -n produces list of files only
+ -c produces classic installed-files.txt
+""" % (name))
+
+def main(argv):
+  try:
+    opts, args = getopt.getopt(argv[1:], "nc", "")
+  except getopt.GetoptError, err:
+    print(err)
+    PrintUsage(argv[0])
+    sys.exit(2)
+
+  if len(opts) == 0:
+    print("No conversion option specified")
+    PrintUsage(argv[0])
+    sys.exit(2)
+
+  if len(args) == 0:
+    print("No input file specified")
+    PrintUsage(argv[0])
+    sys.exit(2)
+
+  for o, a in opts:
+    if o == ("-n"):
+      PrintFileNames(args[0])
+      sys.exit()
+    elif o == ("-c"):
+      PrintCanonicalList(args[0])
+      sys.exit()
+    else:
+      assert False, "Unsupported option"
+
+if __name__ == '__main__':
+  main(sys.argv)
diff --git a/tools/warn.py b/tools/warn.py
index 3c75825..9dbe12e 100755
--- a/tools/warn.py
+++ b/tools/warn.py
@@ -1696,14 +1696,43 @@
     simple_project_pattern('frameworks/av/cmds'),
     simple_project_pattern('frameworks/av/drm'),
     simple_project_pattern('frameworks/av/include'),
-    simple_project_pattern('frameworks/av/media'),
+    simple_project_pattern('frameworks/av/media/common_time'),
+    simple_project_pattern('frameworks/av/media/img_utils'),
+    simple_project_pattern('frameworks/av/media/libcpustats'),
+    simple_project_pattern('frameworks/av/media/libeffects'),
+    simple_project_pattern('frameworks/av/media/libmediaplayerservice'),
+    simple_project_pattern('frameworks/av/media/libmedia'),
+    simple_project_pattern('frameworks/av/media/libstagefright'),
+    simple_project_pattern('frameworks/av/media/mtp'),
+    simple_project_pattern('frameworks/av/media/ndk'),
+    simple_project_pattern('frameworks/av/media/utils'),
+    project_name_and_pattern('frameworks/av/media/Other', 'frameworks/av/media'),
     simple_project_pattern('frameworks/av/radio'),
     simple_project_pattern('frameworks/av/services'),
+    simple_project_pattern('frameworks/av/soundtrigger'),
     project_name_and_pattern('frameworks/av/Other', 'frameworks/av'),
-    simple_project_pattern('frameworks/base'),
+    simple_project_pattern('frameworks/base/cmds'),
+    simple_project_pattern('frameworks/base/core'),
+    simple_project_pattern('frameworks/base/drm'),
+    simple_project_pattern('frameworks/base/media'),
+    simple_project_pattern('frameworks/base/libs'),
+    simple_project_pattern('frameworks/base/native'),
+    simple_project_pattern('frameworks/base/packages'),
+    simple_project_pattern('frameworks/base/rs'),
+    simple_project_pattern('frameworks/base/services'),
+    simple_project_pattern('frameworks/base/tests'),
+    simple_project_pattern('frameworks/base/tools'),
+    project_name_and_pattern('frameworks/base/Other', 'frameworks/base'),
     simple_project_pattern('frameworks/compile'),
     simple_project_pattern('frameworks/minikin'),
-    simple_project_pattern('frameworks/native'),
+    simple_project_pattern('frameworks/ml'),
+    simple_project_pattern('frameworks/native/cmds'),
+    simple_project_pattern('frameworks/native/include'),
+    simple_project_pattern('frameworks/native/libs'),
+    simple_project_pattern('frameworks/native/opengl'),
+    simple_project_pattern('frameworks/native/services'),
+    simple_project_pattern('frameworks/native/vulkan'),
+    project_name_and_pattern('frameworks/native/Other', 'frameworks/native'),
     simple_project_pattern('frameworks/opt'),
     simple_project_pattern('frameworks/rs'),
     simple_project_pattern('frameworks/webview'),
@@ -1730,16 +1759,58 @@
     simple_project_pattern('prebuilts'),
     simple_project_pattern('system/bt'),
     simple_project_pattern('system/connectivity'),
-    simple_project_pattern('system/core'),
-    simple_project_pattern('system/extras'),
+    simple_project_pattern('system/core/adb'),
+    simple_project_pattern('system/core/base'),
+    simple_project_pattern('system/core/debuggerd'),
+    simple_project_pattern('system/core/fastboot'),
+    simple_project_pattern('system/core/fingerprintd'),
+    simple_project_pattern('system/core/fs_mgr'),
+    simple_project_pattern('system/core/gatekeeperd'),
+    simple_project_pattern('system/core/healthd'),
+    simple_project_pattern('system/core/include'),
+    simple_project_pattern('system/core/init'),
+    simple_project_pattern('system/core/libbacktrace'),
+    simple_project_pattern('system/core/liblog'),
+    simple_project_pattern('system/core/libpixelflinger'),
+    simple_project_pattern('system/core/libprocessgroup'),
+    simple_project_pattern('system/core/libsysutils'),
+    simple_project_pattern('system/core/logcat'),
+    simple_project_pattern('system/core/logd'),
+    simple_project_pattern('system/core/run-as'),
+    simple_project_pattern('system/core/sdcard'),
+    simple_project_pattern('system/core/toolbox'),
+    project_name_and_pattern('system/core/Other', 'system/core'),
+    simple_project_pattern('system/extras/ANRdaemon'),
+    simple_project_pattern('system/extras/cpustats'),
+    simple_project_pattern('system/extras/crypto-perf'),
+    simple_project_pattern('system/extras/ext4_utils'),
+    simple_project_pattern('system/extras/f2fs_utils'),
+    simple_project_pattern('system/extras/iotop'),
+    simple_project_pattern('system/extras/libfec'),
+    simple_project_pattern('system/extras/memory_replay'),
+    simple_project_pattern('system/extras/micro_bench'),
+    simple_project_pattern('system/extras/mmap-perf'),
+    simple_project_pattern('system/extras/multinetwork'),
+    simple_project_pattern('system/extras/perfprofd'),
+    simple_project_pattern('system/extras/procrank'),
+    simple_project_pattern('system/extras/runconuid'),
+    simple_project_pattern('system/extras/showmap'),
+    simple_project_pattern('system/extras/simpleperf'),
+    simple_project_pattern('system/extras/su'),
+    simple_project_pattern('system/extras/tests'),
+    simple_project_pattern('system/extras/verity'),
+    project_name_and_pattern('system/extras/Other', 'system/extras'),
     simple_project_pattern('system/gatekeeper'),
     simple_project_pattern('system/keymaster'),
+    simple_project_pattern('system/libhidl'),
     simple_project_pattern('system/libhwbinder'),
     simple_project_pattern('system/media'),
     simple_project_pattern('system/netd'),
+    simple_project_pattern('system/nvram'),
     simple_project_pattern('system/security'),
     simple_project_pattern('system/sepolicy'),
     simple_project_pattern('system/tools'),
+    simple_project_pattern('system/update_engine'),
     simple_project_pattern('system/vold'),
     project_name_and_pattern('system/Other', 'system'),
     simple_project_pattern('toolchain'),
diff --git a/tools/zipalign/ZipAlign.cpp b/tools/zipalign/ZipAlign.cpp
index aef91a5..d56ac29 100644
--- a/tools/zipalign/ZipAlign.cpp
+++ b/tools/zipalign/ZipAlign.cpp
@@ -19,8 +19,9 @@
  */
 #include "ZipFile.h"
 
-#include <stdlib.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 using namespace android;
 
diff --git a/tools/zipalign/ZipEntry.cpp b/tools/zipalign/ZipEntry.cpp
index a9c2d33..63d75d1 100644
--- a/tools/zipalign/ZipEntry.cpp
+++ b/tools/zipalign/ZipEntry.cpp
@@ -23,10 +23,11 @@
 #include "ZipEntry.h"
 #include <utils/Log.h>
 
-#include <stdio.h>
-#include <string.h>
 #include <assert.h>
 #include <inttypes.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
 
 using namespace android;