Merge "Use staging-public-group in framework SDK" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
d4f0220d29
@@ -466,11 +466,19 @@ TEST_F(LinkTest, StagedAndroidApi) {
|
||||
const std::string android_r_java = android_java + "/android/R.java";
|
||||
std::string android_r_contents;
|
||||
ASSERT_TRUE(android::base::ReadFileToString(android_r_java, &android_r_contents));
|
||||
EXPECT_THAT(android_r_contents, HasSubstr(" public static final int finalized_res=0x01010001;"));
|
||||
EXPECT_THAT(android_r_contents, HasSubstr(" public static int staged_s_res=0x01010050;"));
|
||||
EXPECT_THAT(android_r_contents, HasSubstr(" public static int staged_s2_res=0x01ff0049;"));
|
||||
EXPECT_THAT(android_r_contents, HasSubstr(" public static int staged_t_res=0x01fe0063;"));
|
||||
EXPECT_THAT(android_r_contents, HasSubstr(" public static int staged_t_string=0x01fd0072;"));
|
||||
EXPECT_THAT(android_r_contents, HasSubstr("public static final int finalized_res=0x01010001;"));
|
||||
EXPECT_THAT(
|
||||
android_r_contents,
|
||||
HasSubstr("public static final int staged_s_res; static { staged_s_res=0x01010050; }"));
|
||||
EXPECT_THAT(
|
||||
android_r_contents,
|
||||
HasSubstr("public static final int staged_s2_res; static { staged_s2_res=0x01ff0049; }"));
|
||||
EXPECT_THAT(
|
||||
android_r_contents,
|
||||
HasSubstr("public static final int staged_t_res; static { staged_t_res=0x01fe0063; }"));
|
||||
EXPECT_THAT(
|
||||
android_r_contents,
|
||||
HasSubstr("public static final int staged_t_string; static { staged_t_string=0x01fd0072; }"));
|
||||
|
||||
// Build an app that uses the framework attribute in a declare-styleable
|
||||
const std::string client_res = GetTestPath("app-res");
|
||||
|
||||
@@ -393,8 +393,15 @@ bool BinaryResourceParser::ParseType(const ResourceTablePackage* package,
|
||||
.SetAllowMangled(true);
|
||||
|
||||
if (entry->flags & ResTable_entry::FLAG_PUBLIC) {
|
||||
res_builder.SetVisibility(Visibility{Visibility::Level::kPublic});
|
||||
Visibility visibility{Visibility::Level::kPublic};
|
||||
|
||||
auto spec_flags = entry_type_spec_flags_.find(res_id);
|
||||
if (spec_flags != entry_type_spec_flags_.end() &&
|
||||
spec_flags->second & ResTable_typeSpec::SPEC_STAGED_API) {
|
||||
visibility.staged_api = true;
|
||||
}
|
||||
|
||||
res_builder.SetVisibility(visibility);
|
||||
// Erase the ID from the map once processed, so that we don't mark the same symbol more than
|
||||
// once.
|
||||
entry_type_spec_flags_.erase(res_id);
|
||||
|
||||
@@ -78,10 +78,18 @@ class PrimitiveMember : public ClassMember {
|
||||
ClassMember::Print(final, printer, strip_api_annotations);
|
||||
|
||||
printer->Print("public static ");
|
||||
if (final && !staged_api_) {
|
||||
if (final) {
|
||||
printer->Print("final ");
|
||||
}
|
||||
printer->Print("int ").Print(name_).Print("=").Print(to_string(val_)).Print(";");
|
||||
printer->Print("int ").Print(name_);
|
||||
if (staged_api_) {
|
||||
// Prevent references to staged apis from being inline by setting their value out-of-line.
|
||||
printer->Print("; static { ").Print(name_);
|
||||
}
|
||||
printer->Print("=").Print(to_string(val_)).Print(";");
|
||||
if (staged_api_) {
|
||||
printer->Print(" }");
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user