Add ResourceConstNumber for tracking resource references
This will add a special resource value to the IR for tracking resource
value references no matter if they are in an R class or not.
This means that we can more freely optimize callsites and remove the
fields from the R class.
Note that this is exclusively used in the optimization pipeline, we
map out again before writing.
Also note, that the ResourceAccessAnalysis tracing of the resources is
currently a no-op since it does not give rise to any code tracing (and
the actual tracing for the output resource table is done in the second
round use the ResourceConstNumbers)
Bug: 287398085
Change-Id: Ic9d648bb4bd086548b4500fb6a148e7519ba1f28
diff --git a/src/resourceshrinker/java/com/android/build/shrinker/r8integration/R8ResourceShrinkerState.java b/src/resourceshrinker/java/com/android/build/shrinker/r8integration/R8ResourceShrinkerState.java
index 088547e..5e0a8ae 100644
--- a/src/resourceshrinker/java/com/android/build/shrinker/r8integration/R8ResourceShrinkerState.java
+++ b/src/resourceshrinker/java/com/android/build/shrinker/r8integration/R8ResourceShrinkerState.java
@@ -51,8 +51,8 @@
super(debugReporter, supportMultipackages);
}
- public Map<Integer, String> getStringResourcesWithSingleValue() {
- return stringResourcesWithSingleValue;
+ public String getSingleStringValueOrNull(int id) {
+ return stringResourcesWithSingleValue.get(id);
}
// Similar to instantiation in ProtoResourceTableGatherer, but using an inputstream.