diff options
author | Adam Lesinski <adamlesinski@google.com> | 2017-12-12 16:48:07 -0800 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2017-12-18 14:16:02 -0800 |
commit | 71be70507de9cb619b644e55eda1cc181e3f7e90 (patch) | |
tree | 1ad3c588be3dd06b39b1ba5c3229f80ca08d62bd /tools/aapt2/cmd/Diff.cpp | |
parent | 6bb6fad16d93a5859d47dcf962337c2719e585dd (diff) |
AAPT2: Propagate SPEC_OVERLAYABLE flag to final APK
Resources can be marked as overlayable, which means they can
be overlaid by runtime resource overlays.
This change propagates this state to the final resource table that
is installed on device.
Future work:
- Have the idmap tool respect the overlayable state and ignore
entries that overlay anything else.
Bug: 64980941
Test: make aapt2_tests
Change-Id: Id45b1e141a281be2ee32a4ac3096fcf1114d523b
Diffstat (limited to 'tools/aapt2/cmd/Diff.cpp')
-rw-r--r-- | tools/aapt2/cmd/Diff.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/tools/aapt2/cmd/Diff.cpp b/tools/aapt2/cmd/Diff.cpp index fc1f1d6342ae..12113ed8a48a 100644 --- a/tools/aapt2/cmd/Diff.cpp +++ b/tools/aapt2/cmd/Diff.cpp @@ -75,14 +75,14 @@ static void EmitDiffLine(const Source& source, const StringPiece& message) { std::cerr << source << ": " << message << "\n"; } -static bool IsSymbolVisibilityDifferent(const Symbol& symbol_a, const Symbol& symbol_b) { - return symbol_a.state != symbol_b.state; +static bool IsSymbolVisibilityDifferent(const Visibility& vis_a, const Visibility& vis_b) { + return vis_a.level != vis_b.level; } template <typename Id> -static bool IsIdDiff(const Symbol& symbol_a, const Maybe<Id>& id_a, const Symbol& symbol_b, - const Maybe<Id>& id_b) { - if (symbol_a.state == SymbolState::kPublic || symbol_b.state == SymbolState::kPublic) { +static bool IsIdDiff(const Visibility::Level& level_a, const Maybe<Id>& id_a, + const Visibility::Level& level_b, const Maybe<Id>& id_b) { + if (level_a == Visibility::Level::kPublic || level_b == Visibility::Level::kPublic) { return id_a != id_b; } return false; @@ -157,17 +157,17 @@ static bool EmitResourceTypeDiff(IAaptContext* context, LoadedApk* apk_a, EmitDiffLine(apk_b->GetSource(), str_stream.str()); diff = true; } else { - if (IsSymbolVisibilityDifferent(entry_a->symbol_status, entry_b->symbol_status)) { + if (IsSymbolVisibilityDifferent(entry_a->visibility, entry_b->visibility)) { std::stringstream str_stream; str_stream << pkg_a->name << ":" << type_a->type << "/" << entry_a->name << " has different visibility ("; - if (entry_b->symbol_status.state == SymbolState::kPublic) { + if (entry_b->visibility.level == Visibility::Level::kPublic) { str_stream << "PUBLIC"; } else { str_stream << "PRIVATE"; } str_stream << " vs "; - if (entry_a->symbol_status.state == SymbolState::kPublic) { + if (entry_a->visibility.level == Visibility::Level::kPublic) { str_stream << "PUBLIC"; } else { str_stream << "PRIVATE"; @@ -175,7 +175,7 @@ static bool EmitResourceTypeDiff(IAaptContext* context, LoadedApk* apk_a, str_stream << ")"; EmitDiffLine(apk_b->GetSource(), str_stream.str()); diff = true; - } else if (IsIdDiff(entry_a->symbol_status, entry_a->id, entry_b->symbol_status, + } else if (IsIdDiff(entry_a->visibility.level, entry_a->id, entry_b->visibility.level, entry_b->id)) { std::stringstream str_stream; str_stream << pkg_a->name << ":" << type_a->type << "/" << entry_a->name @@ -225,16 +225,16 @@ static bool EmitResourcePackageDiff(IAaptContext* context, LoadedApk* apk_a, EmitDiffLine(apk_a->GetSource(), str_stream.str()); diff = true; } else { - if (IsSymbolVisibilityDifferent(type_a->symbol_status, type_b->symbol_status)) { + if (type_a->visibility_level != type_b->visibility_level) { std::stringstream str_stream; str_stream << pkg_a->name << ":" << type_a->type << " has different visibility ("; - if (type_b->symbol_status.state == SymbolState::kPublic) { + if (type_b->visibility_level == Visibility::Level::kPublic) { str_stream << "PUBLIC"; } else { str_stream << "PRIVATE"; } str_stream << " vs "; - if (type_a->symbol_status.state == SymbolState::kPublic) { + if (type_a->visibility_level == Visibility::Level::kPublic) { str_stream << "PUBLIC"; } else { str_stream << "PRIVATE"; @@ -242,7 +242,8 @@ static bool EmitResourcePackageDiff(IAaptContext* context, LoadedApk* apk_a, str_stream << ")"; EmitDiffLine(apk_b->GetSource(), str_stream.str()); diff = true; - } else if (IsIdDiff(type_a->symbol_status, type_a->id, type_b->symbol_status, type_b->id)) { + } else if (IsIdDiff(type_a->visibility_level, type_a->id, type_b->visibility_level, + type_b->id)) { std::stringstream str_stream; str_stream << pkg_a->name << ":" << type_a->type << " has different public ID ("; if (type_b->id) { |