AAPT2: Use manifest parsing to determine format of APK.

This makes it possible to load APKs that don't have a resource table.

Bug: 69355482
Test: Manual
Change-Id: I8471dbe068e836b4beea9e6934d18dd16b70ef02
diff --git a/tools/aapt2/LoadedApk.h b/tools/aapt2/LoadedApk.h
index ef97de3..6d2257f 100644
--- a/tools/aapt2/LoadedApk.h
+++ b/tools/aapt2/LoadedApk.h
@@ -33,6 +33,12 @@
 constexpr static const char kProtoResourceTablePath[] = "resources.pb";
 constexpr static const char kAndroidManifestPath[] = "AndroidManifest.xml";
 
+enum ApkFormat {
+  kUnknown,
+  kBinary,
+  kProto,
+};
+
 // Info about an APK loaded in memory.
 class LoadedApk {
  public:
@@ -104,6 +110,8 @@
   std::unique_ptr<io::IFileCollection> apk_;
   std::unique_ptr<ResourceTable> table_;
   std::unique_ptr<xml::XmlResource> manifest_;
+
+  static ApkFormat DetermineApkFormat(io::IFileCollection* apk);
 };
 
 }  // namespace aapt