Factor out an undocumented magic string.

PiperOrigin-RevId: 286307918
diff --git a/src/tools/android/java/com/google/devtools/build/android/AndroidCompiledDataDeserializer.java b/src/tools/android/java/com/google/devtools/build/android/AndroidCompiledDataDeserializer.java
index d1211f9..707cf14 100644
--- a/src/tools/android/java/com/google/devtools/build/android/AndroidCompiledDataDeserializer.java
+++ b/src/tools/android/java/com/google/devtools/build/android/AndroidCompiledDataDeserializer.java
@@ -599,7 +599,7 @@
       for (ZipEntry entry = zipStream.getNextEntry();
           entry != null;
           entry = zipStream.getNextEntry()) {
-        if (entry.getName().endsWith(".attributes")) {
+        if (entry.getName().endsWith(CompiledResources.ATTRIBUTES_FILE_EXTENSION)) {
           readAttributesFile(
               // Don't care about origin of ".attributes" values, since they don't feed into field
               // initializers.
@@ -650,7 +650,7 @@
           FullyQualifiedName.Factory fqnFactory =
               FullyQualifiedName.Factory.fromDirectoryName(dirNameAndQualifiers);
 
-          if (fileZipPath.endsWith(".attributes")) {
+          if (fileZipPath.endsWith(CompiledResources.ATTRIBUTES_FILE_EXTENSION)) {
             readAttributesFile(
                 dependencyInfo,
                 resourceFileStream,
diff --git a/src/tools/android/java/com/google/devtools/build/android/aapt2/CompiledResources.java b/src/tools/android/java/com/google/devtools/build/android/aapt2/CompiledResources.java
index 06daa81..853cccb 100644
--- a/src/tools/android/java/com/google/devtools/build/android/aapt2/CompiledResources.java
+++ b/src/tools/android/java/com/google/devtools/build/android/aapt2/CompiledResources.java
@@ -32,6 +32,14 @@
  */
 public class CompiledResources implements ManifestContainer {
 
+  /**
+   * File extension for persisting {@code <resources tool:* />} attributes. These files are bundled
+   * with *.flat files in the {@link resources} ZIP file and ignored by aapt2. The format is
+   * internal to ResourceProcessorBusyBox and can be changed at any time.
+   */
+  // TODO(b/143382754): aapt2 should be serializing these directly.
+  public static final String ATTRIBUTES_FILE_EXTENSION = ".attributes";
+
   private final Path resources;
   @Nullable private final Path manifest;
   private final List<Path> assetsDirs;
diff --git a/src/tools/android/java/com/google/devtools/build/android/aapt2/ResourceCompiler.java b/src/tools/android/java/com/google/devtools/build/android/aapt2/ResourceCompiler.java
index ca2467c..daf4faa 100644
--- a/src/tools/android/java/com/google/devtools/build/android/aapt2/ResourceCompiler.java
+++ b/src/tools/android/java/com/google/devtools/build/android/aapt2/ResourceCompiler.java
@@ -285,9 +285,8 @@
 
       AndroidDataSerializer serializer = AndroidDataSerializer.create();
       final Path resourcesAttributesPath =
-          CompilingVisitor.destinationPath(file,
-              compiledResourcesOut).resolve(
-                  type + "_" + filename + ".attributes");
+          CompilingVisitor.destinationPath(file, compiledResourcesOut)
+              .resolve(type + "_" + filename + CompiledResources.ATTRIBUTES_FILE_EXTENSION);
 
       Preconditions.checkArgument(!Files.exists(resourcesAttributesPath),
           "%s was already created for another resource.", resourcesAttributesPath);