Debian Codegraph @

debian/patches/Migrate-from-android-String-isEmpty-to-empty-aapt.patch

raw
1 From: Tomasz Wasilczyk <[email protected]>
2 Date: Thu, 24 Aug 2023 19:02:33 +0000
3 Subject: Migrate from android::String isEmpty to empty [aapt]
4
5 This empty method is different from the old one - it aligns with
6 std::string definition.
7
8 Change-Id: I1900f2285ee3c3b1eb57d2cef3990896a64dae01
9 Forwarded: https://android.googlesource.com/platform/frameworks/base/+/7e22cab784f64c658b8a41fa1fb22cf7bd44c65e
10 ---
11 libs/androidfw/AssetManager2.cpp | 4 ++--
12 tools/aapt/AaptAssets.cpp | 2 +-
13 tools/aapt/Command.cpp | 4 ++--
14 tools/aapt/Resource.cpp | 4 ++--
15 tools/aapt/ResourceTable.cpp | 8 ++++----
16 tools/aapt/SourcePos.cpp | 2 +-
17 tools/aapt2/DominatorTree_test.cpp | 3 +--
18 tools/split-select/SplitDescription.cpp | 2 +-
19 8 files changed, 14 insertions(+), 15 deletions(-)
20
21 diff --git a/libs/androidfw/AssetManager2.cpp b/libs/androidfw/AssetManager2.cpp
22 index 400829e15364..fc9dd145dc5d 100644
23 --- a/libs/androidfw/AssetManager2.cpp
24 +++ b/libs/androidfw/AssetManager2.cpp
25 @@ -890,13 +890,13 @@ std::string AssetManager2::GetLastResourceResolution() const {
26 }
27
28 log_stream << "\n\t" << prefix->second << ": " << apk_assets_[step.cookie]->GetDebugName();
29 - if (!step.config_name.isEmpty()) {
30 + if (!step.config_name.empty()) {
31 log_stream << " - " << step.config_name;
32 }
33 }
34
35 log_stream << "\nBest matching is from "
36 - << (last_resolution_.best_config_name.isEmpty() ? "default"
37 + << (last_resolution_.best_config_name.empty() ? "default"
38 : last_resolution_.best_config_name)
39 << " configuration of " << last_resolution_.best_package_name;
40 return log_stream.str();
41 diff --git a/tools/aapt/AaptAssets.cpp b/tools/aapt/AaptAssets.cpp
42 index b94d14fd4b75..0fc2617bb9f2 100644
43 --- a/tools/aapt/AaptAssets.cpp
44 +++ b/tools/aapt/AaptAssets.cpp
45 @@ -1540,7 +1540,7 @@ status_t AaptAssets::buildIncludedResources(Bundle* bundle)
46 }
47
48 const String8& featureOfBase = bundle->getFeatureOfPackage();
49 - if (!featureOfBase.isEmpty()) {
50 + if (!featureOfBase.empty()) {
51 if (bundle->getVerbose()) {
52 printf("Including base feature resources from package: %s\n",
53 featureOfBase.c_str());
54 diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
55 index 5a06b102592a..60f3f2715395 100644
56 --- a/tools/aapt/Command.cpp
57 +++ b/tools/aapt/Command.cpp
58 @@ -1133,7 +1133,7 @@ int doDump(Bundle* bundle)
59 if (code == ResXMLTree::END_TAG) {
60 depth--;
61 if (depth < 2) {
62 - if (withinSupportsInput && !supportedInput.isEmpty()) {
63 + if (withinSupportsInput && !supportedInput.empty()) {
64 printf("supports-input: '");
65 const size_t N = supportedInput.size();
66 for (size_t i=0; i<N; i++) {
67 @@ -1300,7 +1300,7 @@ int doDump(Bundle* bundle)
68 ResTable::normalizeForOutput(versionName.c_str()).c_str());
69
70 String8 splitName = AaptXml::getAttribute(tree, NULL, "split");
71 - if (!splitName.isEmpty()) {
72 + if (!splitName.empty()) {
73 printf(" split='%s'", ResTable::normalizeForOutput(
74 splitName.c_str()).c_str());
75 }
76 diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
77 index 9c944e0de075..4a360ed1c80e 100644
78 --- a/tools/aapt/Resource.cpp
79 +++ b/tools/aapt/Resource.cpp
80 @@ -1285,7 +1285,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
81 packageType = ResourceTable::SharedLibrary;
82 } else if (bundle->getExtending()) {
83 packageType = ResourceTable::System;
84 - } else if (!bundle->getFeatureOfPackage().isEmpty()) {
85 + } else if (!bundle->getFeatureOfPackage().empty()) {
86 packageType = ResourceTable::AppFeature;
87 }
88
89 @@ -3144,7 +3144,7 @@ writeProguardForXml(ProguardKeepSet* keep, const sp<AaptFile>& layoutFile,
90
91 tree.restart();
92
93 - if (!startTags.isEmpty()) {
94 + if (!startTags.empty()) {
95 bool haveStart = false;
96 while ((code=tree.next()) != ResXMLTree::END_DOCUMENT && code != ResXMLTree::BAD_DOCUMENT) {
97 if (code != ResXMLTree::START_TAG) {
98 diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
99 index b6a17eb3e684..bccf73e69c34 100644
100 --- a/tools/aapt/ResourceTable.cpp
101 +++ b/tools/aapt/ResourceTable.cpp
102 @@ -1813,7 +1813,7 @@ status_t ResourceTable::addIncludedResources(Bundle* bundle, const sp<AaptAssets
103 mTypeIdOffset = findLargestTypeIdForPackage(assets->getIncludedResources(), mAssetsPackage);
104
105 const String8& featureAfter = bundle->getFeatureAfterPackage();
106 - if (!featureAfter.isEmpty()) {
107 + if (!featureAfter.empty()) {
108 AssetManager featureAssetManager;
109 if (!featureAssetManager.addAssetPath(featureAfter, NULL)) {
110 fprintf(stderr, "ERROR: Feature package '%s' not found.\n",
111 @@ -1823,7 +1823,7 @@ status_t ResourceTable::addIncludedResources(Bundle* bundle, const sp<AaptAssets
112
113 const ResTable& featureTable = featureAssetManager.getResources(false);
114 mTypeIdOffset = std::max(mTypeIdOffset,
115 - findLargestTypeIdForPackage(featureTable, mAssetsPackage));
116 + findLargestTypeIdForPackage(featureTable, mAssetsPackage));
117 }
118
119 return NO_ERROR;
120 @@ -3252,7 +3252,7 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<const ResourceFilter>&
121
122 // If we're building splits, then each invocation of the flattening
123 // step will have 'missing' entries. Don't warn/error for this case.
124 - if (bundle->getSplitConfigurations().isEmpty()) {
125 + if (bundle->getSplitConfigurations().empty()) {
126 bool missing_entry = false;
127 const char* log_prefix = bundle->getErrorOnMissingConfigEntry() ?
128 "error" : "warning";
129 @@ -4858,7 +4858,7 @@ status_t ResourceTable::modifyForCompat(const Bundle* bundle,
130
131 Vector<sp<XMLNode> > nodesToVisit;
132 nodesToVisit.push(root);
133 - while (!nodesToVisit.isEmpty()) {
134 + while (!nodesToVisit.empty()) {
135 sp<XMLNode> node = nodesToVisit.top();
136 nodesToVisit.pop();
137
138 diff --git a/tools/aapt/SourcePos.cpp b/tools/aapt/SourcePos.cpp
139 index e13028684414..354a65c14772 100644
140 --- a/tools/aapt/SourcePos.cpp
141 +++ b/tools/aapt/SourcePos.cpp
142 @@ -78,7 +78,7 @@ ErrorPos::print(FILE* to) const
143 break;
144 }
145
146 - if (!this->file.isEmpty()) {
147 + if (!this->file.empty()) {
148 if (this->line >= 0) {
149 fprintf(to, "%s:%d: %s%s\n", this->file.c_str(), this->line, type, this->error.c_str());
150 } else {
151 diff --git a/tools/aapt2/DominatorTree_test.cpp b/tools/aapt2/DominatorTree_test.cpp
152 index 52949da1b64f..a0679a65b9fd 100644
153 --- a/tools/aapt2/DominatorTree_test.cpp
154 +++ b/tools/aapt2/DominatorTree_test.cpp
155 @@ -50,8 +50,7 @@ class PrettyPrinter : public DominatorTree::Visitor {
156 private:
157 void VisitConfig(const DominatorTree::Node* node, const int indent) {
158 auto config_string = node->value()->config.toString();
159 - buffer_ << std::string(indent, ' ')
160 - << (config_string.isEmpty() ? "<default>" : config_string)
161 + buffer_ << std::string(indent, ' ') << (config_string.empty() ? "<default>" : config_string)
162 << std::endl;
163 }
164
165 diff --git a/tools/split-select/SplitDescription.cpp b/tools/split-select/SplitDescription.cpp
166 index 4e2b48e1f450..71500080193f 100644
167 --- a/tools/split-select/SplitDescription.cpp
168 +++ b/tools/split-select/SplitDescription.cpp
169 @@ -70,7 +70,7 @@ bool SplitDescription::match(const SplitDescription& o) const {
170 String8 SplitDescription::toString() const {
171 String8 extension;
172 if (abi != abi::Variant_none) {
173 - if (extension.isEmpty()) {
174 + if (extension.empty()) {
175 extension.append(":");
176 } else {
177 extension.append("-");
178 --
179 2.39.5
180