Android is introducing a new binary XML format that is a drop-in
replacement for many existing .xml files written by system_server.
Since engineers may be surprised when encountering this new format,
add it to the "file" tool to aid identification in the field.
---
 toys/posix/file.c | 5 +++++
 1 file changed, 5 insertions(+)
From 5c4596f3d5d26aab1f60829172c42a9352fa5fe2 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <e...@google.com>
Date: Wed, 11 Nov 2020 09:56:03 -0800
Subject: [PATCH] file: identify Android Binary XML.

Android is introducing a new binary XML format that is a drop-in
replacement for many existing .xml files written by system_server.
Since engineers may be surprised when encountering this new format,
add it to the "file" tool to aid identification in the field.
---
 toys/posix/file.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/toys/posix/file.c b/toys/posix/file.c
index 5ec24919..4ff2cca7 100644
--- a/toys/posix/file.c
+++ b/toys/posix/file.c
@@ -394,6 +394,11 @@ static void do_regular_file(int fd, char *name)
     xprintf("Android DTB/DTBO v%d, %d entries\n", (int) peek_be(s+28, 4),
         (int) peek_be(s+16, 4));
 
+    // frameworks/base/core/java/com/android/internal/util/BinaryXmlSerializer.java
+  } else if (len>4 && !memcmp(s, "ABX", 3)) {
+    xprintf("Android Binary XML v%d\n", s[3]);
+
+    // Text files, including shell scripts.
   } else {
     char *what = 0;
     int i, bytes;
-- 
2.29.2.222.g5d2a92d10f8-goog

_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to