From 2e9bec1154b8342ae6914498edd2e0fb15e36957 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Mon, 22 Mar 2021 09:31:00 -0700 Subject: Add staging-public-group to aapt2 staging-public-group is a tag for putting resources that have been added during platform development, but have not yet been finalized, into a separate resource id namespace. R.java fields of staged resources are non-final, so when the SDK is finalized, applications using the android R.java will automatically use the new finalized resource id without having to recompile. Staged resources can exist either in the same type id as the type's non-staged counterpart or in a separate type id. Multiple staging-public-group tags each with a different type id can exist simultaneously, which allows for multiple versions of the platform to be developed at once. Bug: 183411093 Test: aapt2_tests Change-Id: Ibb6c84c3626751e33c6097f35a03e306bb85616a --- tools/aapt2/java/JavaClassGenerator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tools/aapt2/java/JavaClassGenerator.cpp') diff --git a/tools/aapt2/java/JavaClassGenerator.cpp b/tools/aapt2/java/JavaClassGenerator.cpp index 039448e1b3e9..e1e2e0135cf7 100644 --- a/tools/aapt2/java/JavaClassGenerator.cpp +++ b/tools/aapt2/java/JavaClassGenerator.cpp @@ -460,7 +460,8 @@ void JavaClassGenerator::ProcessResource(const ResourceNameRef& name, const Reso const std::string field_name = TransformToFieldName(name.entry); if (out_class_def != nullptr) { - auto resource_member = util::make_unique(field_name, real_id); + auto resource_member = + util::make_unique(field_name, real_id, entry.visibility.staged_api); // Build the comments and annotations for this entry. AnnotationProcessor* processor = resource_member->GetCommentBuilder(); -- cgit v1.2.3