Created resuable DumpApkCommand and added "badger"
This change refactors the dump commands to inherit from a base
DumpApkCommand and adds a command that prints out an ASCII
image of a badger if the user wrote "badger" instead of
"badging". The command is hidden from the help menu.
Bug: 73535002
Test: manual
Change-Id: I9bdd8a7bbf6a4282c4933e5c478f6d1d8e32d99e
diff --git a/tools/aapt2/dump/DumpManifest.h b/tools/aapt2/dump/DumpManifest.h
index a70be53..daf22ed 100644
--- a/tools/aapt2/dump/DumpManifest.h
+++ b/tools/aapt2/dump/DumpManifest.h
@@ -17,45 +17,23 @@
#ifndef AAPT2_DUMP_MANIFEST_H
#define AAPT2_DUMP_MANIFEST_H
-#include <Diagnostics.h>
-#include <ValueVisitor.h>
-#include <io/ZipArchive.h>
-
-
-#include "cmd/Command.h"
-#include "process/IResourceTableConsumer.h"
+#include "Diagnostics.h"
+#include "LoadedApk.h"
#include "text/Printer.h"
-#include "xml/XmlDom.h"
namespace aapt {
-class DumpBadgingCommand : public Command {
- public:
- explicit DumpBadgingCommand(IDiagnostics* diag) : Command("badging"), diag_(diag) {
- SetDescription("Print information extracted from the manifest of the APK.");
- AddOptionalSwitch("--include-meta-data", "Include meta-data information.",
- &include_metadata_);
- }
-
- int Action(const std::vector<std::string>& args) override;
-
- private:
- IDiagnostics* diag_;
- bool include_metadata_ = false;
+struct DumpManifestOptions {
+ /** Include meta information from <meta-data> elements in the output. */
+ bool include_meta_data = false;
+ /** Only output permission information. */
+ bool only_permissions = false;
};
-class DumpPermissionsCommand : public Command {
- public:
- explicit DumpPermissionsCommand(IDiagnostics* diag) : Command("permissions"), diag_(diag) {
- SetDescription("Print the permissions extracted from the manifest of the APK.");
- }
+/** Print information extracted from the manifest of the APK. */
+int DumpManifest(LoadedApk* apk, DumpManifestOptions& options, text::Printer* printer,
+ IDiagnostics* diag);
- int Action(const std::vector<std::string>& args) override;
+} // namespace aapt
- private:
- IDiagnostics* diag_;
-};
-
-}// namespace aapt
-
-#endif //AAPT2_DUMP_MANIFEST_H
\ No newline at end of file
+#endif // AAPT2_DUMP_MANIFEST_H
\ No newline at end of file