diff options
author | 2025-02-12 19:47:09 -0800 | |
---|---|---|
committer | 2025-02-12 19:47:09 -0800 | |
commit | e5c50e78975e777f37aab6e6279d337a0fd111ee (patch) | |
tree | d6c56e2ab9a15d96945c1da0a2ec10ab880159e9 /libs/androidfw | |
parent | efeea6290cca46e42330549e1e22b875243c1dcd (diff) |
[res] Small cleanup in aapt2 output + optimization
Don't print the header line when there are no flag-disabled
items follow.
+ move the heavy string allocation to the tightest scope it is
used in
Test: manual
Flag: EXEMPT bugfix
Change-Id: I74902f5fb14b64f2ce3624e72d7774042441213b
Diffstat (limited to 'libs/androidfw')
-rw-r--r-- | libs/androidfw/AssetManager2.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libs/androidfw/AssetManager2.cpp b/libs/androidfw/AssetManager2.cpp index 0fa31c7a832e..f5e10d94452f 100644 --- a/libs/androidfw/AssetManager2.cpp +++ b/libs/androidfw/AssetManager2.cpp @@ -1467,8 +1467,6 @@ base::expected<uint32_t, NullOrIOError> AssetManager2::GetResourceId( } const StringPiece16 kAttr16 = u"attr"; - const static std::u16string kAttrPrivate16 = u"^attr-private"; - for (const PackageGroup& package_group : package_groups_) { for (const ConfiguredPackage& package_impl : package_group.packages_) { const LoadedPackage* package = package_impl.loaded_package_; @@ -1480,12 +1478,13 @@ base::expected<uint32_t, NullOrIOError> AssetManager2::GetResourceId( base::expected<uint32_t, NullOrIOError> resid = package->FindEntryByName(type16, entry16); if (UNLIKELY(IsIOError(resid))) { return base::unexpected(resid.error()); - } + } if (!resid.has_value() && kAttr16 == type16) { // Private attributes in libraries (such as the framework) are sometimes encoded // under the type '^attr-private' in order to leave the ID space of public 'attr' // free for future additions. Check '^attr-private' for the same name. + const static std::u16string kAttrPrivate16 = u"^attr-private"; resid = package->FindEntryByName(kAttrPrivate16, entry16); } |