Check the size of the strings in the StringPool before flattening.

Test: Tested for normal functionality when string does not exceed
maximum length and tests for detection of string that is too lonhg for
UTF8i
Bug: b/74176037

Change-Id: Ic71d3671a069e7012e8ca107e79e071499eebbf6
diff --git a/tools/aapt2/LoadedApk.cpp b/tools/aapt2/LoadedApk.cpp
index 4a4260d..1dd46ba 100644
--- a/tools/aapt2/LoadedApk.cpp
+++ b/tools/aapt2/LoadedApk.cpp
@@ -225,7 +225,7 @@
       }
     } else if (format_ == ApkFormat::kProto && path == kProtoResourceTablePath) {
       pb::ResourceTable pb_table;
-      SerializeTableToPb(*split_table, &pb_table);
+      SerializeTableToPb(*split_table, &pb_table, context->GetDiagnostics());
       if (!io::CopyProtoToArchive(context,
                                   &pb_table,
                                   path,