Add string resource type inspection

Allows "aapt dump --values resource" to print out whether a string in a
ResStringPool is in UTF-8 or UTF-16 encoding.

Change-Id: I6478884a70a3b46fee862dece6cb33454fc34843
diff --git a/include/utils/ResourceTypes.h b/include/utils/ResourceTypes.h
index a845908..6090f600 100644
--- a/include/utils/ResourceTypes.h
+++ b/include/utils/ResourceTypes.h
@@ -454,6 +454,10 @@
 
     size_t size() const;
 
+#ifndef HAVE_ANDROID_OS
+    bool isUTF8() const;
+#endif
+
 private:
     status_t                    mError;
     void*                       mOwnedData;
diff --git a/libs/utils/ResourceTypes.cpp b/libs/utils/ResourceTypes.cpp
index afca814..e8bd5cf 100644
--- a/libs/utils/ResourceTypes.cpp
+++ b/libs/utils/ResourceTypes.cpp
@@ -576,6 +576,13 @@
     return (mError == NO_ERROR) ? mHeader->stringCount : 0;
 }
 
+#ifndef HAVE_ANDROID_OS
+bool ResStringPool::isUTF8() const
+{
+    return (mHeader->flags&ResStringPool_header::UTF8_FLAG)!=0;
+}
+#endif
+
 // --------------------------------------------------------------------
 // --------------------------------------------------------------------
 // --------------------------------------------------------------------
@@ -4016,7 +4023,8 @@
         if (str == NULL) {
             printf("(string) null\n");
         } else {
-            printf("(string) \"%s\"\n",
+            printf("(string%d) \"%s\"\n",
+                    pkg->header->values.isUTF8()?8:16,
                     String8(str, len).string());
         } 
     } else if (value.dataType == Res_value::TYPE_FLOAT) {