Skip to content

Commit a1c6a0d

Browse files
committed
Protobuf appears to work, next step: conversion to System.Xml
1 parent f9b88e6 commit a1c6a0d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

tools/apput/src/Android/AndroidManifest.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using System.IO;
44
using System.Xml;
55

6+
using ProtoManifest = Aapt.Pb;
7+
68
namespace ApplicationUtility;
79

810
// TODO: implement support for AndroidManifest.xml in AAB packages. It's protobuf data, not binary/text XML
@@ -65,13 +67,21 @@ public static IAspectState ProbeAspect (Stream stream, string? description)
6567

6668
Log.Debug ($"Checking if '{description}' is an plain XML document.");
6769
try {
70+
stream.Seek (0, SeekOrigin.Begin);
6871
return new AndroidManifestAspectState (ParsePlainXML (stream));
6972
} catch (Exception ex) {
70-
Log.Debug ($"Failed to parse '{description}' as XML document. Exception thrown:", ex);
73+
Log.Debug ($"Failed to parse '{description}' as an XML document. Exception thrown:", ex);
74+
}
75+
76+
Log.Debug ($"Checking if '{description}' is a protobuf XML document.");
77+
try {
78+
stream.Seek (0, SeekOrigin.Begin);
79+
ProtoManifest.XmlNode root_node = ProtoManifest.XmlNode.Parser.ParseFrom (stream);
80+
// TODO: convert the PB nodes to System.Xml nodes
81+
} catch (Exception ex) {
82+
Log.Debug ($"Failed to parse '{description}' as a protobuf XML document. Exception thrown:", ex);
7183
}
7284

73-
// TODO: AndroidManifest.xml in AAB files is actually a protobuf data dump. Attempt to
74-
// deserialize it here.
7585
return new BasicAspectState (success: false);
7686
}
7787

0 commit comments

Comments
 (0)