Debian Codegraph @

debian/patches/Use-String8-16-c_str-tools.patch

raw symbols SCIP
1 From: Tomasz Wasilczyk <[email protected]>
2 Date: Thu, 10 Aug 2023 23:54:44 +0000
3 Subject: [PATCH 1/1] Use String8/16 c_str [tools]
4
5 Change-Id: I82d6899d8c15a10b15399c39177290012bb5f13b
6 Forwarded: https://android.googlesource.com/platform/frameworks/base/+/d2a698351d13901b95f836df09e9463344f6ab0e
7 ---
8 cmds/idmap2/libidmap2/XmlParser.cpp | 2 +-
9 core/jni/android_content_res_ObbScanner.cpp | 2 +-
10 core/jni/android_util_AssetManager.cpp | 4 +-
11 libs/androidfw/AssetManager.cpp | 134 ++---
12 libs/androidfw/BackupData.cpp | 6 +-
13 libs/androidfw/BackupHelpers.cpp | 76 +--
14 libs/androidfw/ConfigDescription.cpp | 2 +-
15 libs/androidfw/CursorWindow.cpp | 2 +-
16 libs/androidfw/ObbFile.cpp | 4 +-
17 libs/androidfw/ResourceTypes.cpp | 128 ++---
18 libs/androidfw/include/androidfw/Asset.h | 2 +-
19 .../include/androidfw/ConfigDescription.h | 2 +-
20 libs/androidfw/tests/BackupData_test.cpp | 34 +-
21 libs/androidfw/tests/CommonHelpers.cpp | 2 +-
22 .../tests/ConfigDescription_test.cpp | 26 +-
23 libs/androidfw/tests/ObbFile_test.cpp | 10 +-
24 libs/androidfw/tests/ResTable_test.cpp | 6 +-
25 libs/androidfw/tests/Split_test.cpp | 4 +-
26 libs/androidfw/tests/TestHelpers.cpp | 4 +-
27 tools/aapt/AaptAssets.cpp | 146 ++---
28 tools/aapt/AaptAssets.h | 2 +-
29 tools/aapt/AaptConfig.cpp | 60 +--
30 tools/aapt/AaptUtil.cpp | 4 +-
31 tools/aapt/ApkBuilder.cpp | 6 +-
32 tools/aapt/CacheUpdater.h | 12 +-
33 tools/aapt/Command.cpp | 260 ++++-----
34 tools/aapt/CrunchCache.cpp | 2 +-
35 tools/aapt/DirectoryWalker.h | 4 +-
36 tools/aapt/FileFinder.cpp | 4 +-
37 tools/aapt/Images.cpp | 42 +-
38 tools/aapt/Package.cpp | 68 +--
39 tools/aapt/Resource.cpp | 372 ++++++-------
40 tools/aapt/ResourceFilter.cpp | 6 +-
41 tools/aapt/ResourceIdCache.cpp | 2 +-
42 tools/aapt/ResourceTable.cpp | 502 +++++++++---------
43 tools/aapt/SourcePos.cpp | 6 +-
44 tools/aapt/StringPool.cpp | 28 +-
45 tools/aapt/Symbol.h | 6 +-
46 tools/aapt/XMLNode.cpp | 160 +++---
47 tools/aapt/pseudolocalize.cpp | 8 +-
48 tools/aapt2/Debug.cpp | 2 +-
49 tools/aapt2/cmd/Util.cpp | 2 +-
50 .../format/binary/BinaryResourceParser.cpp | 2 +-
51 tools/split-select/Grouper_test.cpp | 2 +-
52 tools/split-select/Main.cpp | 38 +-
53 tools/split-select/Rule_test.cpp | 2 +-
54 tools/split-select/SplitDescription.cpp | 4 +-
55 tools/split-select/TestRules.cpp | 5 +-
56 48 files changed, 1101 insertions(+), 1106 deletions(-)
57
58 diff --git a/cmds/idmap2/libidmap2/XmlParser.cpp b/cmds/idmap2/libidmap2/XmlParser.cpp
59 index 70822c890288..f71e6b95ba32 100644
60 --- a/cmds/idmap2/libidmap2/XmlParser.cpp
61 +++ b/cmds/idmap2/libidmap2/XmlParser.cpp
62 @@ -111,7 +111,7 @@ Result<std::string> GetStringValue(const ResXMLParser& parser, const Res_value&
63 switch (value.dataType) {
64 case Res_value::TYPE_STRING: {
65 if (auto str = parser.getStrings().string8ObjectAt(value.data); str.ok()) {
66 - return std::string(str->string());
67 + return std::string(str->c_str());
68 }
69 break;
70 }
71 diff --git a/core/jni/android_content_res_ObbScanner.cpp b/core/jni/android_content_res_ObbScanner.cpp
72 index de429a07d0f6..760037f63195 100644
73 --- a/core/jni/android_content_res_ObbScanner.cpp
74 +++ b/core/jni/android_content_res_ObbScanner.cpp
75 @@ -52,7 +52,7 @@ static void android_content_res_ObbScanner_getObbInfo(JNIEnv* env, jobject clazz
76
77 env->ReleaseStringUTFChars(file, filePath);
78
79 - const char* packageNameStr = obb->getPackageName().string();
80 + const char* packageNameStr = obb->getPackageName().c_str();
81
82 jstring packageName = env->NewStringUTF(packageNameStr);
83 if (packageName == NULL) {
84 diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
85 index 206ad17e3c4b..971848d24c38 100644
86 --- a/core/jni/android_util_AssetManager.cpp
87 +++ b/core/jni/android_util_AssetManager.cpp
88 @@ -272,7 +272,7 @@ static jobject NativeGetAssetAllocations(JNIEnv* env, jobject /*clazz*/) {
89 if (alloc.length() <= 0) {
90 return nullptr;
91 }
92 - return env->NewStringUTF(alloc.string());
93 + return env->NewStringUTF(alloc.c_str());
94 }
95
96 static jint NativeGetGlobalAssetManagerCount(JNIEnv* /*env*/, jobject /*clazz*/) {
97 @@ -427,7 +427,7 @@ static jobjectArray NativeList(JNIEnv* env, jclass /*clazz*/, jlong ptr, jstring
98 }
99
100 for (size_t i = 0; i < file_count; i++) {
101 - jstring java_string = env->NewStringUTF(asset_dir->getFileName(i).string());
102 + jstring java_string = env->NewStringUTF(asset_dir->getFileName(i).c_str());
103
104 // Check for errors creating the strings (if malformed or no memory).
105 if (env->ExceptionCheck()) {
106 diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp
107 index fb2b57193b83..795bb3c716d1 100644
108 --- a/libs/androidfw/AssetManager.cpp
109 +++ b/libs/androidfw/AssetManager.cpp
110 @@ -91,7 +91,7 @@ String8 idmapPathForPackagePath(const String8& pkgPath) {
111 path.appendPath(kResourceCache);
112
113 char buf[256]; // 256 chars should be enough for anyone...
114 - strncpy(buf, pkgPath.string(), 255);
115 + strncpy(buf, pkgPath.c_str(), 255);
116 buf[255] = '\0';
117 char* filename = buf;
118 while (*filename && *filename == '/') {
119 @@ -183,15 +183,15 @@ bool AssetManager::addAssetPath(
120 if (kAppZipName) {
121 realPath.appendPath(kAppZipName);
122 }
123 - ap.type = ::getFileType(realPath.string());
124 + ap.type = ::getFileType(realPath.c_str());
125 if (ap.type == kFileTypeRegular) {
126 ap.path = realPath;
127 } else {
128 ap.path = path;
129 - ap.type = ::getFileType(path.string());
130 + ap.type = ::getFileType(path.c_str());
131 if (ap.type != kFileTypeDirectory && ap.type != kFileTypeRegular) {
132 ALOGW("Asset path %s is neither a directory nor file (type=%d).",
133 - path.string(), (int)ap.type);
134 + path.c_str(), (int)ap.type);
135 return false;
136 }
137 }
138 @@ -207,7 +207,7 @@ bool AssetManager::addAssetPath(
139 }
140
141 ALOGV("In %p Asset %s path: %s", this,
142 - ap.type == kFileTypeDirectory ? "dir" : "zip", ap.path.string());
143 + ap.type == kFileTypeDirectory ? "dir" : "zip", ap.path.c_str());
144
145 ap.isSystemAsset = isSystemAsset;
146 ssize_t apPos = mAssetPaths.add(ap);
147 @@ -248,7 +248,7 @@ bool AssetManager::addOverlayPath(const String8& packagePath, int32_t* cookie)
148
149 Asset* idmap = NULL;
150 if ((idmap = openAssetFromFileLocked(idmapPath, Asset::ACCESS_BUFFER)) == NULL) {
151 - ALOGW("failed to open idmap file %s\n", idmapPath.string());
152 + ALOGW("failed to open idmap file %s\n", idmapPath.c_str());
153 return false;
154 }
155
156 @@ -256,7 +256,7 @@ bool AssetManager::addOverlayPath(const String8& packagePath, int32_t* cookie)
157 String8 overlayPath;
158 if (!ResTable::getIdmapInfo(idmap->getBuffer(false), idmap->getLength(),
159 NULL, NULL, NULL, &targetPath, &overlayPath)) {
160 - ALOGW("failed to read idmap file %s\n", idmapPath.string());
161 + ALOGW("failed to read idmap file %s\n", idmapPath.c_str());
162 delete idmap;
163 return false;
164 }
165 @@ -264,29 +264,29 @@ bool AssetManager::addOverlayPath(const String8& packagePath, int32_t* cookie)
166
167 if (overlayPath != packagePath) {
168 ALOGW("idmap file %s inconcistent: expected path %s does not match actual path %s\n",
169 - idmapPath.string(), packagePath.string(), overlayPath.string());
170 + idmapPath.c_str(), packagePath.c_str(), overlayPath.c_str());
171 return false;
172 }
173 - if (access(targetPath.string(), R_OK) != 0) {
174 - ALOGW("failed to access file %s: %s\n", targetPath.string(), strerror(errno));
175 + if (access(targetPath.c_str(), R_OK) != 0) {
176 + ALOGW("failed to access file %s: %s\n", targetPath.c_str(), strerror(errno));
177 return false;
178 }
179 - if (access(idmapPath.string(), R_OK) != 0) {
180 - ALOGW("failed to access file %s: %s\n", idmapPath.string(), strerror(errno));
181 + if (access(idmapPath.c_str(), R_OK) != 0) {
182 + ALOGW("failed to access file %s: %s\n", idmapPath.c_str(), strerror(errno));
183 return false;
184 }
185 - if (access(overlayPath.string(), R_OK) != 0) {
186 - ALOGW("failed to access file %s: %s\n", overlayPath.string(), strerror(errno));
187 + if (access(overlayPath.c_str(), R_OK) != 0) {
188 + ALOGW("failed to access file %s: %s\n", overlayPath.c_str(), strerror(errno));
189 return false;
190 }
191
192 asset_path oap;
193 oap.path = overlayPath;
194 - oap.type = ::getFileType(overlayPath.string());
195 + oap.type = ::getFileType(overlayPath.c_str());
196 oap.idmap = idmapPath;
197 #if 0
198 ALOGD("Overlay added: targetPath=%s overlayPath=%s idmapPath=%s\n",
199 - targetPath.string(), overlayPath.string(), idmapPath.string());
200 + targetPath.c_str(), overlayPath.c_str(), idmapPath.c_str());
201 #endif
202 mAssetPaths.add(oap);
203 *cookie = static_cast<int32_t>(mAssetPaths.size());
204 @@ -310,7 +310,7 @@ bool AssetManager::addAssetFd(
205 ap.type = kFileTypeRegular;
206 ap.assumeOwnership = assume_ownership;
207
208 - ALOGV("In %p Asset fd %d name: %s", this, fd, ap.path.string());
209 + ALOGV("In %p Asset fd %d name: %s", this, fd, ap.path.c_str());
210
211 ssize_t apPos = mAssetPaths.add(ap);
212
213 @@ -343,11 +343,11 @@ bool AssetManager::createIdmap(const char* targetApkPath, const char* overlayApk
214 assets[i] = openNonAssetInPathLocked("resources.arsc",
215 Asset::ACCESS_BUFFER, ap);
216 if (assets[i] == NULL) {
217 - ALOGW("failed to find resources.arsc in %s\n", ap.path.string());
218 + ALOGW("failed to find resources.arsc in %s\n", ap.path.c_str());
219 goto exit;
220 }
221 if (tables[i].add(assets[i]) != NO_ERROR) {
222 - ALOGW("failed to add %s to resource table", paths[i].string());
223 + ALOGW("failed to add %s to resource table", paths[i].c_str());
224 goto exit;
225 }
226 }
227 @@ -449,8 +449,8 @@ Asset* AssetManager::open(const char* fileName, AccessMode mode)
228 while (i > 0) {
229 i--;
230 ALOGV("Looking for asset '%s' in '%s'\n",
231 - assetName.string(), mAssetPaths.itemAt(i).path.string());
232 - Asset* pAsset = openNonAssetInPathLocked(assetName.string(), mode,
233 + assetName.c_str(), mAssetPaths.itemAt(i).path.c_str());
234 + Asset* pAsset = openNonAssetInPathLocked(assetName.c_str(), mode,
235 mAssetPaths.editItemAt(i));
236 if (pAsset != NULL) {
237 return pAsset != kExcludedAsset ? pAsset : NULL;
238 @@ -478,7 +478,7 @@ Asset* AssetManager::openNonAsset(const char* fileName, AccessMode mode, int32_t
239 size_t i = mAssetPaths.size();
240 while (i > 0) {
241 i--;
242 - ALOGV("Looking for non-asset '%s' in '%s'\n", fileName, mAssetPaths.itemAt(i).path.string());
243 + ALOGV("Looking for non-asset '%s' in '%s'\n", fileName, mAssetPaths.itemAt(i).path.c_str());
244 Asset* pAsset = openNonAssetInPathLocked(
245 fileName, mode, mAssetPaths.editItemAt(i));
246 if (pAsset != NULL) {
247 @@ -500,7 +500,7 @@ Asset* AssetManager::openNonAsset(const int32_t cookie, const char* fileName, Ac
248
249 if (which < mAssetPaths.size()) {
250 ALOGV("Looking for non-asset '%s' in '%s'\n", fileName,
251 - mAssetPaths.itemAt(which).path.string());
252 + mAssetPaths.itemAt(which).path.c_str());
253 Asset* pAsset = openNonAssetInPathLocked(
254 fileName, mode, mAssetPaths.editItemAt(which));
255 if (pAsset != NULL) {
256 @@ -546,10 +546,10 @@ bool AssetManager::appendPathToResTable(asset_path& ap, bool appAsLib) const {
257 ResTable* sharedRes = NULL;
258 bool shared = true;
259 bool onlyEmptyResources = true;
260 - ATRACE_NAME(ap.path.string());
261 + ATRACE_NAME(ap.path.c_str());
262 Asset* idmap = openIdmapLocked(ap);
263 size_t nextEntryIdx = mResources->getTableCount();
264 - ALOGV("Looking for resource asset in '%s'\n", ap.path.string());
265 + ALOGV("Looking for resource asset in '%s'\n", ap.path.c_str());
266 if (ap.type != kFileTypeDirectory && ap.rawFd < 0) {
267 if (nextEntryIdx == 0) {
268 // The first item is typically the framework resources,
269 @@ -565,7 +565,7 @@ bool AssetManager::appendPathToResTable(asset_path& ap, bool appAsLib) const {
270 ass = const_cast<AssetManager*>(this)->
271 mZipSet.getZipResourceTableAsset(ap.path);
272 if (ass == NULL) {
273 - ALOGV("loading resource table %s\n", ap.path.string());
274 + ALOGV("loading resource table %s\n", ap.path.c_str());
275 ass = const_cast<AssetManager*>(this)->
276 openNonAssetInPathLocked("resources.arsc",
277 Asset::ACCESS_BUFFER,
278 @@ -580,7 +580,7 @@ bool AssetManager::appendPathToResTable(asset_path& ap, bool appAsLib) const {
279 // If this is the first resource table in the asset
280 // manager, then we are going to cache it so that we
281 // can quickly copy it out for others.
282 - ALOGV("Creating shared resources for %s", ap.path.string());
283 + ALOGV("Creating shared resources for %s", ap.path.c_str());
284 sharedRes = new ResTable();
285 sharedRes->add(ass, idmap, nextEntryIdx + 1, false);
286 #ifdef __ANDROID__
287 @@ -589,14 +589,14 @@ bool AssetManager::appendPathToResTable(asset_path& ap, bool appAsLib) const {
288 String8 overlaysListPath(data);
289 overlaysListPath.appendPath(kResourceCache);
290 overlaysListPath.appendPath("overlays.list");
291 - addSystemOverlays(overlaysListPath.string(), ap.path, sharedRes, nextEntryIdx);
292 + addSystemOverlays(overlaysListPath.c_str(), ap.path, sharedRes, nextEntryIdx);
293 #endif
294 sharedRes = const_cast<AssetManager*>(this)->
295 mZipSet.setZipResourceTable(ap.path, sharedRes);
296 }
297 }
298 } else {
299 - ALOGV("loading resource table %s\n", ap.path.string());
300 + ALOGV("loading resource table %s\n", ap.path.c_str());
301 ass = const_cast<AssetManager*>(this)->
302 openNonAssetInPathLocked("resources.arsc",
303 Asset::ACCESS_BUFFER,
304 @@ -607,10 +607,10 @@ bool AssetManager::appendPathToResTable(asset_path& ap, bool appAsLib) const {
305 if ((ass != NULL || sharedRes != NULL) && ass != kExcludedAsset) {
306 ALOGV("Installing resource asset %p in to table %p\n", ass, mResources);
307 if (sharedRes != NULL) {
308 - ALOGV("Copying existing resources for %s", ap.path.string());
309 + ALOGV("Copying existing resources for %s", ap.path.c_str());
310 mResources->add(sharedRes, ap.isSystemAsset);
311 } else {
312 - ALOGV("Parsing resources for %s", ap.path.string());
313 + ALOGV("Parsing resources for %s", ap.path.c_str());
314 mResources->add(ass, idmap, nextEntryIdx + 1, !shared, appAsLib, ap.isSystemAsset);
315 }
316 onlyEmptyResources = false;
317 @@ -692,9 +692,9 @@ Asset* AssetManager::openIdmapLocked(const struct asset_path& ap) const
318 ass = const_cast<AssetManager*>(this)->
319 openAssetFromFileLocked(ap.idmap, Asset::ACCESS_BUFFER);
320 if (ass) {
321 - ALOGV("loading idmap %s\n", ap.idmap.string());
322 + ALOGV("loading idmap %s\n", ap.idmap.c_str());
323 } else {
324 - ALOGW("failed to load idmap %s\n", ap.idmap.string());
325 + ALOGW("failed to load idmap %s\n", ap.idmap.c_str());
326 }
327 }
328 return ass;
329 @@ -812,7 +812,7 @@ Asset* AssetManager::openNonAssetInPathLocked(const char* fileName, AccessMode m
330 ZipFileRO* pZip = getZipFileLocked(ap);
331 if (pZip != NULL) {
332 ALOGV("GOT zip, checking NA '%s'", (const char*) path);
333 - ZipEntryRO entry = pZip->findEntryByName(path.string());
334 + ZipEntryRO entry = pZip->findEntryByName(path.c_str());
335 if (entry != NULL) {
336 ALOGV("FOUND NA in Zip file for %s", (const char*) path);
337 pAsset = openAssetFromZipLocked(pZip, entry, mode, path);
338 @@ -823,7 +823,7 @@ Asset* AssetManager::openNonAssetInPathLocked(const char* fileName, AccessMode m
339 if (pAsset != NULL) {
340 /* create a "source" name, for debug/display */
341 pAsset->setAssetSource(
342 - createZipSourceNameLocked(ZipSet::getPathName(ap.path.string()), String8(""),
343 + createZipSourceNameLocked(ZipSet::getPathName(ap.path.c_str()), String8(""),
344 String8(fileName)));
345 }
346 }
347 @@ -870,7 +870,7 @@ ZipFileRO* AssetManager::getZipFileLocked(asset_path& ap)
348 }
349
350 if (ap.rawFd < 0) {
351 - ALOGV("getZipFileLocked: Creating new zip from path %s", ap.path.string());
352 + ALOGV("getZipFileLocked: Creating new zip from path %s", ap.path.c_str());
353 ap.zip = mZipSet.getSharedZip(ap.path);
354 } else {
355 ALOGV("getZipFileLocked: Creating new zip from fd %d", ap.rawFd);
356 @@ -897,12 +897,12 @@ Asset* AssetManager::openAssetFromFileLocked(const String8& pathName,
357 {
358 Asset* pAsset = NULL;
359
360 - if (strcasecmp(pathName.getPathExtension().string(), ".gz") == 0) {
361 + if (strcasecmp(pathName.getPathExtension().c_str(), ".gz") == 0) {
362 //printf("TRYING '%s'\n", (const char*) pathName);
363 - pAsset = Asset::createFromCompressedFile(pathName.string(), mode);
364 + pAsset = Asset::createFromCompressedFile(pathName.c_str(), mode);
365 } else {
366 //printf("TRYING '%s'\n", (const char*) pathName);
367 - pAsset = Asset::createFromFile(pathName.string(), mode);
368 + pAsset = Asset::createFromFile(pathName.c_str(), mode);
369 }
370
371 return pAsset;
372 @@ -940,12 +940,12 @@ Asset* AssetManager::openAssetFromZipLocked(const ZipFileRO* pZipFile,
373
374 if (method == ZipFileRO::kCompressStored) {
375 pAsset = Asset::createFromUncompressedMap(std::move(*dataMap), mode);
376 - ALOGV("Opened uncompressed entry %s in zip %s mode %d: %p", entryName.string(),
377 + ALOGV("Opened uncompressed entry %s in zip %s mode %d: %p", entryName.c_str(),
378 dataMap->file_name(), mode, pAsset.get());
379 } else {
380 pAsset = Asset::createFromCompressedMap(std::move(*dataMap),
381 static_cast<size_t>(uncompressedLen), mode);
382 - ALOGV("Opened compressed entry %s in zip %s mode %d: %p", entryName.string(),
383 + ALOGV("Opened compressed entry %s in zip %s mode %d: %p", entryName.c_str(),
384 dataMap->file_name(), mode, pAsset.get());
385 }
386 if (pAsset == NULL) {
387 @@ -993,10 +993,10 @@ AssetDir* AssetManager::openDir(const char* dirName)
388 i--;
389 const asset_path& ap = mAssetPaths.itemAt(i);
390 if (ap.type == kFileTypeRegular) {
391 - ALOGV("Adding directory %s from zip %s", dirName, ap.path.string());
392 + ALOGV("Adding directory %s from zip %s", dirName, ap.path.c_str());
393 scanAndMergeZipLocked(pMergedInfo, ap, kAssetsRoot, dirName);
394 } else {
395 - ALOGV("Adding directory %s from dir %s", dirName, ap.path.string());
396 + ALOGV("Adding directory %s from dir %s", dirName, ap.path.c_str());
397 scanAndMergeDirLocked(pMergedInfo, ap, kAssetsRoot, dirName);
398 }
399 }
400 @@ -1042,10 +1042,10 @@ AssetDir* AssetManager::openNonAssetDir(const int32_t cookie, const char* dirNam
401 if (which < mAssetPaths.size()) {
402 const asset_path& ap = mAssetPaths.itemAt(which);
403 if (ap.type == kFileTypeRegular) {
404 - ALOGV("Adding directory %s from zip %s", dirName, ap.path.string());
405 + ALOGV("Adding directory %s from zip %s", dirName, ap.path.c_str());
406 scanAndMergeZipLocked(pMergedInfo, ap, NULL, dirName);
407 } else {
408 - ALOGV("Adding directory %s from dir %s", dirName, ap.path.string());
409 + ALOGV("Adding directory %s from dir %s", dirName, ap.path.c_str());
410 scanAndMergeDirLocked(pMergedInfo, ap, NULL, dirName);
411 }
412 }
413 @@ -1075,7 +1075,7 @@ bool AssetManager::scanAndMergeDirLocked(SortedVector<AssetDir::FileInfo>* pMerg
414 {
415 assert(pMergedInfo != NULL);
416
417 - //printf("scanAndMergeDir: %s %s %s\n", ap.path.string(), rootDir, dirName);
418 + //printf("scanAndMergeDir: %s %s %s\n", ap.path.c_str(), rootDir, dirName);
419
420 String8 path = createPathNameLocked(ap, rootDir);
421 if (dirName[0] != '\0')
422 @@ -1100,7 +1100,7 @@ bool AssetManager::scanAndMergeDirLocked(SortedVector<AssetDir::FileInfo>* pMerg
423 const char* name;
424 int nameLen;
425
426 - name = pContents->itemAt(i).getFileName().string();
427 + name = pContents->itemAt(i).getFileName().c_str();
428 nameLen = strlen(name);
429 if (nameLen > exclExtLen &&
430 strcmp(name + (nameLen - exclExtLen), kExcludeExtension) == 0)
431 @@ -1111,8 +1111,8 @@ bool AssetManager::scanAndMergeDirLocked(SortedVector<AssetDir::FileInfo>* pMerg
432 matchIdx = AssetDir::FileInfo::findEntry(pMergedInfo, match);
433 if (matchIdx > 0) {
434 ALOGV("Excluding '%s' [%s]\n",
435 - pMergedInfo->itemAt(matchIdx).getFileName().string(),
436 - pMergedInfo->itemAt(matchIdx).getSourceName().string());
437 + pMergedInfo->itemAt(matchIdx).getFileName().c_str(),
438 + pMergedInfo->itemAt(matchIdx).getSourceName().c_str());
439 pMergedInfo->removeAt(matchIdx);
440 } else {
441 //printf("+++ no match on '%s'\n", (const char*) match);
442 @@ -1150,9 +1150,9 @@ SortedVector<AssetDir::FileInfo>* AssetManager::scanDirLocked(const String8& pat
443 struct dirent* entry;
444 FileType fileType;
445
446 - ALOGV("Scanning dir '%s'\n", path.string());
447 + ALOGV("Scanning dir '%s'\n", path.c_str());
448
449 - dir = opendir(path.string());
450 + dir = opendir(path.c_str());
451 if (dir == NULL)
452 return NULL;
453
454 @@ -1176,7 +1176,7 @@ SortedVector<AssetDir::FileInfo>* AssetManager::scanDirLocked(const String8& pat
455 fileType = kFileTypeUnknown;
456 #else
457 // stat the file
458 - fileType = ::getFileType(path.appendPathCopy(entry->d_name).string());
459 + fileType = ::getFileType(path.appendPathCopy(entry->d_name).c_str());
460 #endif
461
462 if (fileType != kFileTypeRegular && fileType != kFileTypeDirectory)
463 @@ -1184,7 +1184,7 @@ SortedVector<AssetDir::FileInfo>* AssetManager::scanDirLocked(const String8& pat
464
465 AssetDir::FileInfo info;
466 info.set(String8(entry->d_name), fileType);
467 - if (strcasecmp(info.getFileName().getPathExtension().string(), ".gz") == 0)
468 + if (strcasecmp(info.getFileName().getPathExtension().c_str(), ".gz") == 0)
469 info.setFileName(info.getFileName().getBasePath());
470 info.setSourceName(path.appendPathCopy(info.getFileName()));
471 pContents->add(info);
472 @@ -1212,11 +1212,11 @@ bool AssetManager::scanAndMergeZipLocked(SortedVector<AssetDir::FileInfo>* pMerg
473
474 pZip = mZipSet.getZip(ap.path);
475 if (pZip == NULL) {
476 - ALOGW("Failure opening zip %s\n", ap.path.string());
477 + ALOGW("Failure opening zip %s\n", ap.path.c_str());
478 return false;
479 }
480
481 - zipName = ZipSet::getPathName(ap.path.string());
482 + zipName = ZipSet::getPathName(ap.path.c_str());
483
484 /* convert "sounds" to "rootDir/sounds" */
485 if (rootDir != NULL) dirName = rootDir;
486 @@ -1240,7 +1240,7 @@ bool AssetManager::scanAndMergeZipLocked(SortedVector<AssetDir::FileInfo>* pMerg
487 */
488 int dirNameLen = dirName.length();
489 void *iterationCookie;
490 - if (!pZip->startIteration(&iterationCookie, dirName.string(), NULL)) {
491 + if (!pZip->startIteration(&iterationCookie, dirName.c_str(), NULL)) {
492 ALOGW("ZipFileRO::startIteration returned false");
493 return false;
494 }
495 @@ -1254,7 +1254,7 @@ bool AssetManager::scanAndMergeZipLocked(SortedVector<AssetDir::FileInfo>* pMerg
496 ALOGE("ARGH: name too long?\n");
497 continue;
498 }
499 - //printf("Comparing %s in %s?\n", nameBuf, dirName.string());
500 + //printf("Comparing %s in %s?\n", nameBuf, dirName.c_str());
501 if (dirNameLen == 0 || nameBuf[dirNameLen] == '/')
502 {
503 const char* cp;
504 @@ -1275,7 +1275,7 @@ bool AssetManager::scanAndMergeZipLocked(SortedVector<AssetDir::FileInfo>* pMerg
505 createZipSourceNameLocked(zipName, dirName, info.getFileName()));
506
507 contents.add(info);
508 - //printf("FOUND: file '%s'\n", info.getFileName().string());
509 + //printf("FOUND: file '%s'\n", info.getFileName().c_str());
510 } else {
511 /* this is a subdir; add it if we don't already have it*/
512 String8 subdirName(cp, nextSlash - cp);
513 @@ -1291,7 +1291,7 @@ bool AssetManager::scanAndMergeZipLocked(SortedVector<AssetDir::FileInfo>* pMerg
514 dirs.add(subdirName);
515 }
516
517 - //printf("FOUND: dir '%s'\n", subdirName.string());
518 + //printf("FOUND: dir '%s'\n", subdirName.c_str());
519 }
520 }
521 }
522 @@ -1427,10 +1427,10 @@ AssetManager::SharedZip::SharedZip(const String8& path, time_t modWhen)
523 if (kIsDebug) {
524 ALOGI("Creating SharedZip %p %s\n", this, (const char*)mPath);
525 }
526 - ALOGV("+++ opening zip '%s'\n", mPath.string());
527 - mZipFile = ZipFileRO::open(mPath.string());
528 + ALOGV("+++ opening zip '%s'\n", mPath.c_str());
529 + mZipFile = ZipFileRO::open(mPath.c_str());
530 if (mZipFile == NULL) {
531 - ALOGD("failed to open Zip archive '%s'\n", mPath.string());
532 + ALOGD("failed to open Zip archive '%s'\n", mPath.c_str());
533 }
534 }
535
536 @@ -1441,11 +1441,11 @@ AssetManager::SharedZip::SharedZip(int fd, const String8& path)
537 if (kIsDebug) {
538 ALOGI("Creating SharedZip %p fd=%d %s\n", this, fd, (const char*)mPath);
539 }
540 - ALOGV("+++ opening zip fd=%d '%s'\n", fd, mPath.string());
541 - mZipFile = ZipFileRO::openFd(fd, mPath.string());
542 + ALOGV("+++ opening zip fd=%d '%s'\n", fd, mPath.c_str());
543 + mZipFile = ZipFileRO::openFd(fd, mPath.c_str());
544 if (mZipFile == NULL) {
545 ::close(fd);
546 - ALOGD("failed to open Zip archive fd=%d '%s'\n", fd, mPath.string());
547 + ALOGD("failed to open Zip archive fd=%d '%s'\n", fd, mPath.c_str());
548 }
549 }
550
551 @@ -1520,7 +1520,7 @@ ResTable* AssetManager::SharedZip::setResourceTable(ResTable* res)
552
553 bool AssetManager::SharedZip::isUpToDate()
554 {
555 - time_t modWhen = getFileModDate(mPath.string());
556 + time_t modWhen = getFileModDate(mPath.c_str());
557 return mModWhen == modWhen;
558 }
559
560 @@ -1551,7 +1551,7 @@ AssetManager::SharedZip::~SharedZip()
561 }
562 if (mZipFile != NULL) {
563 delete mZipFile;
564 - ALOGV("Closed '%s'\n", mPath.string());
565 + ALOGV("Closed '%s'\n", mPath.c_str());
566 }
567 }
568
569 diff --git a/libs/androidfw/BackupData.cpp b/libs/androidfw/BackupData.cpp
570 index 76a430ee9f0e..fec0e772674d 100644
571 --- a/libs/androidfw/BackupData.cpp
572 +++ b/libs/androidfw/BackupData.cpp
573 @@ -106,8 +106,8 @@ BackupDataWriter::WriteEntityHeader(const String8& key, size_t dataSize)
574 k = key;
575 }
576 if (kIsDebug) {
577 - ALOGD("Writing header: prefix='%s' key='%s' dataSize=%zu", m_keyPrefix.string(),
578 - key.string(), dataSize);
579 + ALOGD("Writing header: prefix='%s' key='%s' dataSize=%zu", m_keyPrefix.c_str(),
580 + key.c_str(), dataSize);
581 }
582
583 entity_header_v1 header;
584 @@ -128,7 +128,7 @@ BackupDataWriter::WriteEntityHeader(const String8& key, size_t dataSize)
585 m_pos += amt;
586
587 if (kIsDebug) ALOGI("writing entity header key, %zd bytes", keyLen+1);
588 - amt = write(m_fd, k.string(), keyLen+1);
589 + amt = write(m_fd, k.c_str(), keyLen+1);
590 if (amt != keyLen+1) {
591 m_status = errno;
592 return m_status;
593 diff --git a/libs/androidfw/BackupHelpers.cpp b/libs/androidfw/BackupHelpers.cpp
594 index e80e9486c8b2..35826090d6e5 100644
595 --- a/libs/androidfw/BackupHelpers.cpp
596 +++ b/libs/androidfw/BackupHelpers.cpp
597 @@ -179,7 +179,7 @@ write_snapshot_file(int fd, const KeyedVector<String8,FileRec>& snapshot)
598 }
599
600 // filename is not NULL terminated, but it is padded
601 - amt = write(fd, name.string(), nameLen);
602 + amt = write(fd, name.c_str(), nameLen);
603 if (amt != nameLen) {
604 ALOGW("write_snapshot_file error writing filename %s", strerror(errno));
605 return 1;
606 @@ -203,7 +203,7 @@ write_snapshot_file(int fd, const KeyedVector<String8,FileRec>& snapshot)
607 static int
608 write_delete_file(BackupDataWriter* dataStream, const String8& key)
609 {
610 - LOGP("write_delete_file %s\n", key.string());
611 + LOGP("write_delete_file %s\n", key.c_str());
612 return dataStream->WriteEntityHeader(key, -1);
613 }
614
615 @@ -211,7 +211,7 @@ static int
616 write_update_file(BackupDataWriter* dataStream, int fd, int mode, const String8& key,
617 char const* realFilename)
618 {
619 - LOGP("write_update_file %s (%s) : mode 0%o\n", realFilename, key.string(), mode);
620 + LOGP("write_update_file %s (%s) : mode 0%o\n", realFilename, key.c_str(), mode);
621
622 const int bufsize = 4*1024;
623 int err;
624 @@ -365,7 +365,7 @@ back_up_files(int oldSnapshotFD, BackupDataWriter* dataStream, int newSnapshotFD
625 r.s.size = st.st_size;
626
627 if (newSnapshot.indexOfKey(key) >= 0) {
628 - LOGP("back_up_files key already in use '%s'", key.string());
629 + LOGP("back_up_files key already in use '%s'", key.c_str());
630 return -1;
631 }
632
633 @@ -390,30 +390,30 @@ back_up_files(int oldSnapshotFD, BackupDataWriter* dataStream, int newSnapshotFD
634 int cmp = p.compare(q);
635 if (cmp < 0) {
636 // file present in oldSnapshot, but not present in newSnapshot
637 - LOGP("file removed: %s", p.string());
638 + LOGP("file removed: %s", p.c_str());
639 write_delete_file(dataStream, p);
640 n++;
641 } else if (cmp > 0) {
642 // file added
643 - LOGP("file added: %s crc=0x%08x", g.file.string(), g.s.crc32);
644 - write_update_file(dataStream, q, g.file.string());
645 + LOGP("file added: %s crc=0x%08x", g.file.c_str(), g.s.crc32);
646 + write_update_file(dataStream, q, g.file.c_str());
647 m++;
648 } else {
649 // same file exists in both old and new; check whether to update
650 const FileState& f = oldSnapshot.valueAt(n);
651
652 - LOGP("%s", q.string());
653 + LOGP("%s", q.c_str());
654 LOGP(" old: modTime=%d,%d mode=%04o size=%-3d crc32=0x%08x",
655 f.modTime_sec, f.modTime_nsec, f.mode, f.size, f.crc32);
656 LOGP(" new: modTime=%d,%d mode=%04o size=%-3d crc32=0x%08x",
657 g.s.modTime_sec, g.s.modTime_nsec, g.s.mode, g.s.size, g.s.crc32);
658 if (f.modTime_sec != g.s.modTime_sec || f.modTime_nsec != g.s.modTime_nsec
659 || f.mode != g.s.mode || f.size != g.s.size || f.crc32 != g.s.crc32) {
660 - int fd = open(g.file.string(), O_RDONLY);
661 + int fd = open(g.file.c_str(), O_RDONLY);
662 if (fd < 0) {
663 - ALOGE("Unable to read file for backup: %s", g.file.string());
664 + ALOGE("Unable to read file for backup: %s", g.file.c_str());
665 } else {
666 - write_update_file(dataStream, fd, g.s.mode, p, g.file.string());
667 + write_update_file(dataStream, fd, g.s.mode, p, g.file.c_str());
668 close(fd);
669 }
670 }
671 @@ -432,7 +432,7 @@ back_up_files(int oldSnapshotFD, BackupDataWriter* dataStream, int newSnapshotFD
672 while (m<M) {
673 const String8& q = newSnapshot.keyAt(m);
674 FileRec& g = newSnapshot.editValueAt(m);
675 - write_update_file(dataStream, q, g.file.string());
676 + write_update_file(dataStream, q, g.file.c_str());
677 m++;
678 }
679
680 @@ -483,7 +483,7 @@ int write_tarfile(const String8& packageName, const String8& domain,
681 BackupDataWriter* writer)
682 {
683 // In the output stream everything is stored relative to the root
684 - const char* relstart = filepath.string() + rootpath.length();
685 + const char* relstart = filepath.c_str() + rootpath.length();
686 if (*relstart == '/') relstart++; // won't be true when path == rootpath
687 String8 relpath(relstart);
688
689 @@ -514,9 +514,9 @@ int write_tarfile(const String8& packageName, const String8& domain,
690
691 int err = 0;
692 struct stat64 s;
693 - if (lstat64(filepath.string(), &s) != 0) {
694 + if (lstat64(filepath.c_str(), &s) != 0) {
695 err = errno;
696 - ALOGE("Error %d (%s) from lstat64(%s)", err, strerror(err), filepath.string());
697 + ALOGE("Error %d (%s) from lstat64(%s)", err, strerror(err), filepath.c_str());
698 return err;
699 }
700
701 @@ -541,10 +541,10 @@ int write_tarfile(const String8& packageName, const String8& domain,
702
703 // !!! TODO: use mmap when possible to avoid churning the buffer cache
704 // !!! TODO: this will break with symlinks; need to use readlink(2)
705 - int fd = open(filepath.string(), O_RDONLY);
706 + int fd = open(filepath.c_str(), O_RDONLY);
707 if (fd < 0) {
708 err = errno;
709 - ALOGE("Error %d (%s) from open(%s)", err, strerror(err), filepath.string());
710 + ALOGE("Error %d (%s) from open(%s)", err, strerror(err), filepath.c_str());
711 return err;
712 }
713
714 @@ -592,7 +592,7 @@ int write_tarfile(const String8& packageName, const String8& domain,
715 } else if (S_ISREG(s.st_mode)) {
716 type = '0'; // tar magic: '0' == normal file
717 } else {
718 - ALOGW("Error: unknown file mode 0%o [%s]", s.st_mode, filepath.string());
719 + ALOGW("Error: unknown file mode 0%o [%s]", s.st_mode, filepath.c_str());
720 goto cleanup;
721 }
722 buf[156] = type;
723 @@ -620,16 +620,16 @@ int write_tarfile(const String8& packageName, const String8& domain,
724 // [ 345 : 155 ] filename path prefix
725 // We only use the prefix area if fullname won't fit in the path
726 if (fullname.length() > 100) {
727 - strncpy(buf, relpath.string(), 100);
728 - strncpy(buf + 345, prefix.string(), 155);
729 + strncpy(buf, relpath.c_str(), 100);
730 + strncpy(buf + 345, prefix.c_str(), 155);
731 } else {
732 - strncpy(buf, fullname.string(), 100);
733 + strncpy(buf, fullname.c_str(), 100);
734 }
735 }
736
737 // [ 329 : 8 ] and [ 337 : 8 ] devmajor/devminor, not used
738
739 - ALOGI(" Name: %s", fullname.string());
740 + ALOGI(" Name: %s", fullname.c_str());
741
742 // If we're using a pax extended header, build & write that here; lengths are
743 // already preflighted
744 @@ -647,7 +647,7 @@ int write_tarfile(const String8& packageName, const String8& domain,
745
746 // fullname was generated above with the ustar paths
747 paxLen += write_pax_header_entry(paxData + paxLen, PAXDATA_SIZE - paxLen,
748 - "path", fullname.string());
749 + "path", fullname.c_str());
750
751 // Now we know how big the pax data is
752
753 @@ -656,9 +656,9 @@ int write_tarfile(const String8& packageName, const String8& domain,
754
755 String8 leaf = fullname.getPathLeaf();
756 memset(paxHeader, 0, 100); // rewrite the name area
757 - snprintf(paxHeader, 100, "PaxHeader/%s", leaf.string());
758 + snprintf(paxHeader, 100, "PaxHeader/%s", leaf.c_str());
759 memset(paxHeader + 345, 0, 155); // rewrite the prefix area
760 - strncpy(paxHeader + 345, prefix.string(), 155);
761 + strncpy(paxHeader + 345, prefix.c_str(), 155);
762
763 paxHeader[156] = 'x'; // mark it as a pax extended header
764
765 @@ -691,12 +691,12 @@ int write_tarfile(const String8& packageName, const String8& domain,
766 ssize_t nRead = read(fd, buf, toRead);
767 if (nRead < 0) {
768 err = errno;
769 - ALOGE("Unable to read file [%s], err=%d (%s)", filepath.string(),
770 + ALOGE("Unable to read file [%s], err=%d (%s)", filepath.c_str(),
771 err, strerror(err));
772 break;
773 } else if (nRead == 0) {
774 ALOGE("EOF but expect %lld more bytes in [%s]", (long long) toWrite,
775 - filepath.string());
776 + filepath.c_str());
777 err = EIO;
778 break;
779 }
780 @@ -762,7 +762,7 @@ RestoreHelperBase::WriteFile(const String8& filename, BackupDataReader* in)
781 file_metadata_v1 metadata;
782 amt = in->ReadEntityData(&metadata, sizeof(metadata));
783 if (amt != sizeof(metadata)) {
784 - ALOGW("Could not read metadata for %s -- %ld / %s", filename.string(),
785 + ALOGW("Could not read metadata for %s -- %ld / %s", filename.c_str(),
786 (long)amt, strerror(errno));
787 return EIO;
788 }
789 @@ -779,9 +779,9 @@ RestoreHelperBase::WriteFile(const String8& filename, BackupDataReader* in)
790
791 // Write the file and compute the crc
792 crc = crc32(0L, Z_NULL, 0);
793 - fd = open(filename.string(), O_CREAT|O_RDWR|O_TRUNC, mode);
794 + fd = open(filename.c_str(), O_CREAT|O_RDWR|O_TRUNC, mode);
795 if (fd == -1) {
796 - ALOGW("Could not open file %s -- %s", filename.string(), strerror(errno));
797 + ALOGW("Could not open file %s -- %s", filename.c_str(), strerror(errno));
798 return errno;
799 }
800
801 @@ -789,7 +789,7 @@ RestoreHelperBase::WriteFile(const String8& filename, BackupDataReader* in)
802 err = write(fd, buf, amt);
803 if (err != amt) {
804 close(fd);
805 - ALOGW("Error '%s' writing '%s'", strerror(errno), filename.string());
806 + ALOGW("Error '%s' writing '%s'", strerror(errno), filename.c_str());
807 return errno;
808 }
809 crc = crc32(crc, (Bytef*)buf, amt);
810 @@ -798,9 +798,9 @@ RestoreHelperBase::WriteFile(const String8& filename, BackupDataReader* in)
811 close(fd);
812
813 // Record for the snapshot
814 - err = stat(filename.string(), &st);
815 + err = stat(filename.c_str(), &st);
816 if (err != 0) {
817 - ALOGW("Error stating file that we just created %s", filename.string());
818 + ALOGW("Error stating file that we just created %s", filename.c_str());
819 return errno;
820 }
821
822 @@ -1104,9 +1104,9 @@ backup_helper_test_four()
823 fprintf(stderr, "state %zu expected={%d/%d, %04o, 0x%08x, 0x%08x, %3zu} '%s'\n"
824 " actual={%d/%d, %04o, 0x%08x, 0x%08x, %3d} '%s'\n", i,
825 states[i].modTime_sec, states[i].modTime_nsec, states[i].mode, states[i].size,
826 - states[i].crc32, name.length(), filenames[i].string(),
827 + states[i].crc32, name.length(), filenames[i].c_str(),
828 state.modTime_sec, state.modTime_nsec, state.mode, state.size, state.crc32,
829 - state.nameLen, name.string());
830 + state.nameLen, name.c_str());
831 matched = false;
832 }
833 }
834 @@ -1152,9 +1152,9 @@ test_write_header_and_entity(BackupDataWriter& writer, const char* str)
835 return err;
836 }
837
838 - err = writer.WriteEntityData(text.string(), text.length()+1);
839 + err = writer.WriteEntityData(text.c_str(), text.length()+1);
840 if (err != 0) {
841 - fprintf(stderr, "write failed for data '%s'\n", text.string());
842 + fprintf(stderr, "write failed for data '%s'\n", text.c_str());
843 return errno;
844 }
845
846 @@ -1230,7 +1230,7 @@ test_read_header_and_entity(BackupDataReader& reader, const char* str)
847 goto finished;
848 }
849 if (string != str) {
850 - fprintf(stderr, "ReadEntityHeader expected key '%s' got '%s'\n", str, string.string());
851 + fprintf(stderr, "ReadEntityHeader expected key '%s' got '%s'\n", str, string.c_str());
852 err = EINVAL;
853 goto finished;
854 }
855 diff --git a/libs/androidfw/ConfigDescription.cpp b/libs/androidfw/ConfigDescription.cpp
856 index 19ead9583eb2..952101b1952c 100644
857 --- a/libs/androidfw/ConfigDescription.cpp
858 +++ b/libs/androidfw/ConfigDescription.cpp
859 @@ -878,7 +878,7 @@ std::string ConfigDescription::GetBcp47LanguageTag(bool canonicalize) const {
860
861 std::string ConfigDescription::to_string() const {
862 const String8 str = toString();
863 - return std::string(str.string(), str.size());
864 + return std::string(str.c_str(), str.size());
865 }
866
867 bool ConfigDescription::Dominates(const ConfigDescription& o) const {
868 diff --git a/libs/androidfw/CursorWindow.cpp b/libs/androidfw/CursorWindow.cpp
869 index 3527eeead1d5..5aa8e7006abb 100644
870 --- a/libs/androidfw/CursorWindow.cpp
871 +++ b/libs/androidfw/CursorWindow.cpp
872 @@ -84,7 +84,7 @@ status_t CursorWindow::maybeInflate() {
873 String8 ashmemName("CursorWindow: ");
874 ashmemName.append(mName);
875
876 - ashmemFd = ashmem_create_region(ashmemName.string(), mInflatedSize);
877 + ashmemFd = ashmem_create_region(ashmemName.c_str(), mInflatedSize);
878 if (ashmemFd < 0) {
879 PLOG(ERROR) << "Failed ashmem_create_region";
880 goto fail_silent;
881 diff --git a/libs/androidfw/ObbFile.cpp b/libs/androidfw/ObbFile.cpp
882 index 95332a35eb7d..c6a9632ee7b7 100644
883 --- a/libs/androidfw/ObbFile.cpp
884 +++ b/libs/androidfw/ObbFile.cpp
885 @@ -217,7 +217,7 @@ bool ObbFile::parseObbFile(int fd)
886 free(scanBuf);
887
888 #ifdef DEBUG
889 - ALOGI("Obb scan succeeded: packageName=%s, version=%d\n", mPackageName.string(), mVersion);
890 + ALOGI("Obb scan succeeded: packageName=%s, version=%d\n", mPackageName.c_str(), mVersion);
891 #endif
892
893 return true;
894 @@ -288,7 +288,7 @@ bool ObbFile::writeTo(int fd)
895 return false;
896 }
897
898 - if (write(fd, mPackageName.string(), packageNameLen) != (ssize_t)packageNameLen) {
899 + if (write(fd, mPackageName.c_str(), packageNameLen) != (ssize_t)packageNameLen) {
900 ALOGW("couldn't write package name: %s\n", strerror(errno));
901 return false;
902 }
903 diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
904 index 5e8a623d4205..0e7d8412e615 100644
905 --- a/libs/androidfw/ResourceTypes.cpp
906 +++ b/libs/androidfw/ResourceTypes.cpp
907 @@ -1029,7 +1029,7 @@ base::expected<size_t, NullOrIOError> ResStringPool::indexOfString(const char16_
908
909 if ((mHeader->flags&ResStringPool_header::UTF8_FLAG) != 0) {
910 if (kDebugStringPoolNoisy) {
911 - ALOGI("indexOfString UTF-8: %s", String8(str, strLen).string());
912 + ALOGI("indexOfString UTF-8: %s", String8(str, strLen).c_str());
913 }
914
915 // The string pool contains UTF 8 strings; we don't want to cause
916 @@ -1090,7 +1090,7 @@ base::expected<size_t, NullOrIOError> ResStringPool::indexOfString(const char16_
917 ALOGI("Looking at %s, i=%d\n", s->data(), i);
918 }
919 if (str8Len == s->size()
920 - && memcmp(s->data(), str8.string(), str8Len) == 0) {
921 + && memcmp(s->data(), str8.c_str(), str8Len) == 0) {
922 if (kDebugStringPoolNoisy) {
923 ALOGI("MATCH!");
924 }
925 @@ -1102,7 +1102,7 @@ base::expected<size_t, NullOrIOError> ResStringPool::indexOfString(const char16_
926
927 } else {
928 if (kDebugStringPoolNoisy) {
929 - ALOGI("indexOfString UTF-16: %s", String8(str, strLen).string());
930 + ALOGI("indexOfString UTF-16: %s", String8(str, strLen).c_str());
931 }
932
933 if (mHeader->flags&ResStringPool_header::SORTED_FLAG) {
934 @@ -1120,7 +1120,7 @@ base::expected<size_t, NullOrIOError> ResStringPool::indexOfString(const char16_
935 int c = s.has_value() ? strzcmp16(s->data(), s->size(), str, strLen) : -1;
936 if (kDebugStringPoolNoisy) {
937 ALOGI("Looking at %s, cmp=%d, l/mid/h=%d/%d/%d\n",
938 - String8(s->data(), s->size()).string(), c, (int)l, (int)mid, (int)h);
939 + String8(s->data(), s->size()).c_str(), c, (int)l, (int)mid, (int)h);
940 }
941 if (c == 0) {
942 if (kDebugStringPoolNoisy) {
943 @@ -1144,7 +1144,7 @@ base::expected<size_t, NullOrIOError> ResStringPool::indexOfString(const char16_
944 return base::unexpected(s.error());
945 }
946 if (kDebugStringPoolNoisy) {
947 - ALOGI("Looking at %s, i=%d\n", String8(s->data(), s->size()).string(), i);
948 + ALOGI("Looking at %s, i=%d\n", String8(s->data(), s->size()).c_str(), i);
949 }
950 if (s.has_value() && strLen == s->size() &&
951 strzcmp16(s->data(), s->size(), str, strLen) == 0) {
952 @@ -1512,8 +1512,8 @@ ssize_t ResXMLParser::indexOfAttribute(const char* ns, const char* attr) const
953 {
954 String16 nsStr(ns != NULL ? ns : "");
955 String16 attrStr(attr);
956 - return indexOfAttribute(ns ? nsStr.string() : NULL, ns ? nsStr.size() : 0,
957 - attrStr.string(), attrStr.size());
958 + return indexOfAttribute(ns ? nsStr.c_str() : NULL, ns ? nsStr.size() : 0,
959 + attrStr.c_str(), attrStr.size());
960 }
961
962 ssize_t ResXMLParser::indexOfAttribute(const char16_t* ns, size_t nsLen,
963 @@ -1531,8 +1531,8 @@ ssize_t ResXMLParser::indexOfAttribute(const char16_t* ns, size_t nsLen,
964 }
965 attr8 = String8(attr, attrLen);
966 if (kDebugStringPoolNoisy) {
967 - ALOGI("indexOfAttribute UTF8 %s (%zu) / %s (%zu)", ns8.string(), nsLen,
968 - attr8.string(), attrLen);
969 + ALOGI("indexOfAttribute UTF8 %s (%zu) / %s (%zu)", ns8.c_str(), nsLen,
970 + attr8.c_str(), attrLen);
971 }
972 for (size_t i=0; i<N; i++) {
973 size_t curNsLen = 0, curAttrLen = 0;
974 @@ -1542,7 +1542,7 @@ ssize_t ResXMLParser::indexOfAttribute(const char16_t* ns, size_t nsLen,
975 ALOGI(" curNs=%s (%zu), curAttr=%s (%zu)", curNs, curNsLen, curAttr, curAttrLen);
976 }
977 if (curAttr != NULL && curNsLen == nsLen && curAttrLen == attrLen
978 - && memcmp(attr8.string(), curAttr, attrLen) == 0) {
979 + && memcmp(attr8.c_str(), curAttr, attrLen) == 0) {
980 if (ns == NULL) {
981 if (curNs == NULL) {
982 if (kDebugStringPoolNoisy) {
983 @@ -1552,8 +1552,8 @@ ssize_t ResXMLParser::indexOfAttribute(const char16_t* ns, size_t nsLen,
984 }
985 } else if (curNs != NULL) {
986 //printf(" --> ns=%s, curNs=%s\n",
987 - // String8(ns).string(), String8(curNs).string());
988 - if (memcmp(ns8.string(), curNs, nsLen) == 0) {
989 + // String8(ns).c_str(), String8(curNs).c_str());
990 + if (memcmp(ns8.c_str(), curNs, nsLen) == 0) {
991 if (kDebugStringPoolNoisy) {
992 ALOGI(" FOUND!");
993 }
994 @@ -1565,8 +1565,8 @@ ssize_t ResXMLParser::indexOfAttribute(const char16_t* ns, size_t nsLen,
995 } else {
996 if (kDebugStringPoolNoisy) {
997 ALOGI("indexOfAttribute UTF16 %s (%zu) / %s (%zu)",
998 - String8(ns, nsLen).string(), nsLen,
999 - String8(attr, attrLen).string(), attrLen);
1000 + String8(ns, nsLen).c_str(), nsLen,
1001 + String8(attr, attrLen).c_str(), attrLen);
1002 }
1003 for (size_t i=0; i<N; i++) {
1004 size_t curNsLen = 0, curAttrLen = 0;
1005 @@ -1574,8 +1574,8 @@ ssize_t ResXMLParser::indexOfAttribute(const char16_t* ns, size_t nsLen,
1006 const char16_t* curAttr = getAttributeName(i, &curAttrLen);
1007 if (kDebugStringPoolNoisy) {
1008 ALOGI(" curNs=%s (%zu), curAttr=%s (%zu)",
1009 - String8(curNs, curNsLen).string(), curNsLen,
1010 - String8(curAttr, curAttrLen).string(), curAttrLen);
1011 + String8(curNs, curNsLen).c_str(), curNsLen,
1012 + String8(curAttr, curAttrLen).c_str(), curAttrLen);
1013 }
1014 if (curAttr != NULL && curNsLen == nsLen && curAttrLen == attrLen
1015 && (memcmp(attr, curAttr, attrLen*sizeof(char16_t)) == 0)) {
1016 @@ -1588,7 +1588,7 @@ ssize_t ResXMLParser::indexOfAttribute(const char16_t* ns, size_t nsLen,
1017 }
1018 } else if (curNs != NULL) {
1019 //printf(" --> ns=%s, curNs=%s\n",
1020 - // String8(ns).string(), String8(curNs).string());
1021 + // String8(ns).c_str(), String8(curNs).c_str());
1022 if (memcmp(ns, curNs, nsLen*sizeof(char16_t)) == 0) {
1023 if (kDebugStringPoolNoisy) {
1024 ALOGI(" FOUND!");
1025 @@ -4412,7 +4412,7 @@ bool ResTable::getResourceName(uint32_t resID, bool allowUtf8, resource_name* ou
1026 return false;
1027 }
1028
1029 - outName->package = grp->name.string();
1030 + outName->package = grp->name.c_str();
1031 outName->packageLen = grp->name.size();
1032 if (allowUtf8) {
1033 outName->type8 = UnpackOptionalString(entry.typeStr.string8(), &outName->typeLen);
1034 @@ -4518,7 +4518,7 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag
1035 outValue->dataType,
1036 outValue->dataType == Res_value::TYPE_STRING ?
1037 String8(UnpackOptionalString(
1038 - entry.package->header->values.stringAt(outValue->data), &len)).string() :
1039 + entry.package->header->values.stringAt(outValue->data), &len)).c_str() :
1040 "",
1041 outValue->data);
1042 }
1043 @@ -4888,7 +4888,7 @@ void ResTable::setParameters(const ResTable_config* params)
1044 AutoMutex _lock2(mFilteredConfigLock);
1045
1046 if (kDebugTableGetEntry) {
1047 - ALOGI("Setting parameters: %s\n", params->toString().string());
1048 + ALOGI("Setting parameters: %s\n", params->toString().c_str());
1049 }
1050 mParams = *params;
1051 for (size_t p = 0; p < mPackageGroups.size(); p++) {
1052 @@ -4999,7 +4999,7 @@ nope:
1053 if (name[1] == 'i' && name[2] == 'n'
1054 && name[3] == 'd' && name[4] == 'e' && name[5] == 'x'
1055 && name[6] == '_') {
1056 - int index = atoi(String8(name + 7, nameLen - 7).string());
1057 + int index = atoi(String8(name + 7, nameLen - 7).c_str());
1058 if (Res_CHECKID(index)) {
1059 ALOGW("Array resource index: %d is too large.",
1060 index);
1061 @@ -5065,9 +5065,9 @@ nope:
1062
1063 if (kDebugTableNoisy) {
1064 printf("Looking for identifier: type=%s, name=%s, package=%s\n",
1065 - String8(type, typeLen).string(),
1066 - String8(name, nameLen).string(),
1067 - String8(package, packageLen).string());
1068 + String8(type, typeLen).c_str(),
1069 + String8(name, nameLen).c_str(),
1070 + String8(package, packageLen).c_str());
1071 }
1072
1073 const String16 attr("attr");
1074 @@ -5078,9 +5078,9 @@ nope:
1075 const PackageGroup* group = mPackageGroups[ig];
1076
1077 if (strzcmp16(package, packageLen,
1078 - group->name.string(), group->name.size())) {
1079 + group->name.c_str(), group->name.size())) {
1080 if (kDebugTableNoisy) {
1081 - printf("Skipping package group: %s\n", String8(group->name).string());
1082 + printf("Skipping package group: %s\n", String8(group->name).c_str());
1083 }
1084 continue;
1085 }
1086 @@ -5105,8 +5105,8 @@ nope:
1087 }
1088 return identifier;
1089 }
1090 - } while (strzcmp16(attr.string(), attr.size(), targetType, targetTypeLen) == 0
1091 - && (targetType = attrPrivate.string())
1092 + } while (strzcmp16(attr.c_str(), attr.size(), targetType, targetTypeLen) == 0
1093 + && (targetType = attrPrivate.c_str())
1094 && (targetTypeLen = attrPrivate.size())
1095 );
1096 }
1097 @@ -5525,7 +5525,7 @@ bool ResTable::stringToValue(Res_value* outValue, String16* outString,
1098 }
1099 }
1100
1101 - //printf("Value for: %s\n", String8(s, len).string());
1102 + //printf("Value for: %s\n", String8(s, len).c_str());
1103
1104 uint32_t l10nReq = ResTable_map::L10N_NOT_REQUIRED;
1105 uint32_t attrMin = 0x80000000, attrMax = 0x7fffffff;
1106 @@ -5580,7 +5580,7 @@ bool ResTable::stringToValue(Res_value* outValue, String16* outString,
1107 // be to any other type; we just need to count on the client making
1108 // sure the referenced type is correct.
1109
1110 - //printf("Looking up ref: %s\n", String8(s, len).string());
1111 + //printf("Looking up ref: %s\n", String8(s, len).c_str());
1112
1113 // It's a reference!
1114 if (len == 5 && s[1]=='n' && s[2]=='u' && s[3]=='l' && s[4]=='l') {
1115 @@ -5620,8 +5620,8 @@ bool ResTable::stringToValue(Res_value* outValue, String16* outString,
1116 }
1117
1118 uint32_t specFlags = 0;
1119 - uint32_t rid = identifierForName(name.string(), name.size(), type.string(),
1120 - type.size(), package.string(), package.size(), &specFlags);
1121 + uint32_t rid = identifierForName(name.c_str(), name.size(), type.c_str(),
1122 + type.size(), package.c_str(), package.size(), &specFlags);
1123 if (rid != 0) {
1124 if (enforcePrivate) {
1125 if (accessor == NULL || accessor->getAssetsPackage() != package) {
1126 @@ -5640,8 +5640,8 @@ bool ResTable::stringToValue(Res_value* outValue, String16* outString,
1127 Res_GETTYPE(rid), Res_GETENTRY(rid));
1128 if (kDebugTableNoisy) {
1129 ALOGI("Incl %s:%s/%s: 0x%08x\n",
1130 - String8(package).string(), String8(type).string(),
1131 - String8(name).string(), rid);
1132 + String8(package).c_str(), String8(type).c_str(),
1133 + String8(name).c_str(), rid);
1134 }
1135 }
1136
1137 @@ -5659,8 +5659,8 @@ bool ResTable::stringToValue(Res_value* outValue, String16* outString,
1138 if (rid != 0) {
1139 if (kDebugTableNoisy) {
1140 ALOGI("Pckg %s:%s/%s: 0x%08x\n",
1141 - String8(package).string(), String8(type).string(),
1142 - String8(name).string(), rid);
1143 + String8(package).c_str(), String8(type).c_str(),
1144 + String8(name).c_str(), rid);
1145 }
1146 uint32_t packageId = Res_GETPACKAGE(rid) + 1;
1147 if (packageId == 0x00) {
1148 @@ -5749,7 +5749,7 @@ bool ResTable::stringToValue(Res_value* outValue, String16* outString,
1149 }
1150 } else {
1151 outValue->data = color;
1152 - //printf("Color input=%s, output=0x%x\n", String8(s, len).string(), color);
1153 + //printf("Color input=%s, output=0x%x\n", String8(s, len).c_str(), color);
1154 return true;
1155 }
1156 } else {
1157 @@ -5761,8 +5761,8 @@ bool ResTable::stringToValue(Res_value* outValue, String16* outString,
1158 #if 0
1159 fprintf(stderr, "%s: Color ID %s value %s is not valid\n",
1160 "Resource File", //(const char*)in->getPrintableSource(),
1161 - String8(*curTag).string(),
1162 - String8(s, len).string());
1163 + String8(*curTag).c_str(),
1164 + String8(s, len).c_str());
1165 #endif
1166 return false;
1167 }
1168 @@ -5776,7 +5776,7 @@ bool ResTable::stringToValue(Res_value* outValue, String16* outString,
1169 // be to any other type; we just need to count on the client making
1170 // sure the referenced type is correct.
1171
1172 - //printf("Looking up attr: %s\n", String8(s, len).string());
1173 + //printf("Looking up attr: %s\n", String8(s, len).c_str());
1174
1175 static const String16 attr16("attr");
1176 String16 package, type, name;
1177 @@ -5789,13 +5789,13 @@ bool ResTable::stringToValue(Res_value* outValue, String16* outString,
1178 }
1179
1180 //printf("Pkg: %s, Type: %s, Name: %s\n",
1181 - // String8(package).string(), String8(type).string(),
1182 - // String8(name).string());
1183 + // String8(package).c_str(), String8(type).c_str(),
1184 + // String8(name).c_str());
1185 uint32_t specFlags = 0;
1186 uint32_t rid =
1187 - identifierForName(name.string(), name.size(),
1188 - type.string(), type.size(),
1189 - package.string(), package.size(), &specFlags);
1190 + identifierForName(name.c_str(), name.size(),
1191 + type.c_str(), type.size(),
1192 + package.c_str(), package.size(), &specFlags);
1193 if (rid != 0) {
1194 if (enforcePrivate) {
1195 if ((specFlags&ResTable_typeSpec::SPEC_PUBLIC) == 0) {
1196 @@ -5953,8 +5953,8 @@ bool ResTable::stringToValue(Res_value* outValue, String16* outString,
1197 if (getResourceName(bag->map.name.ident, false, &rname)) {
1198 #if 0
1199 printf("Matching %s against %s (0x%08x)\n",
1200 - String8(s, len).string(),
1201 - String8(rname.name, rname.nameLen).string(),
1202 + String8(s, len).c_str(),
1203 + String8(rname.name, rname.nameLen).c_str(),
1204 bag->map.name.ident);
1205 #endif
1206 if (strzcmp16(s, len, rname.name, rname.nameLen) == 0) {
1207 @@ -5997,7 +5997,7 @@ bool ResTable::stringToValue(Res_value* outValue, String16* outString,
1208 while (pos < end && *pos != '|') {
1209 pos++;
1210 }
1211 - //printf("Looking for: %s\n", String8(start, pos-start).string());
1212 + //printf("Looking for: %s\n", String8(start, pos-start).c_str());
1213 const bag_entry* bagi = bag;
1214 ssize_t i;
1215 for (i=0; i<cnt; i++, bagi++) {
1216 @@ -6006,8 +6006,8 @@ bool ResTable::stringToValue(Res_value* outValue, String16* outString,
1217 if (getResourceName(bagi->map.name.ident, false, &rname)) {
1218 #if 0
1219 printf("Matching %s against %s (0x%08x)\n",
1220 - String8(start,pos-start).string(),
1221 - String8(rname.name, rname.nameLen).string(),
1222 + String8(start,pos-start).c_str(),
1223 + String8(rname.name, rname.nameLen).c_str(),
1224 bagi->map.name.ident);
1225 #endif
1226 if (strzcmp16(start, pos-start, rname.name, rname.nameLen) == 0) {
1227 @@ -6334,7 +6334,7 @@ void ResTable::getConfigurations(Vector<ResTable_config>* configs, bool ignoreMi
1228 }
1229
1230 static bool compareString8AndCString(const String8& str, const char* cStr) {
1231 - return strcmp(str.string(), cStr) < 0;
1232 + return strcmp(str.c_str(), cStr) < 0;
1233 }
1234
1235 void ResTable::getLocales(Vector<String8>* locales, bool includeSystemLocales,
1236 @@ -6348,7 +6348,7 @@ void ResTable::getLocales(Vector<String8>* locales, bool includeSystemLocales,
1237 const auto endIter = locales->end();
1238
1239 auto iter = std::lower_bound(beginIter, endIter, locale, compareString8AndCString);
1240 - if (iter == endIter || strcmp(iter->string(), locale) != 0) {
1241 + if (iter == endIter || strcmp(iter->c_str(), locale) != 0) {
1242 locales->insertAt(String8(locale), std::distance(beginIter, iter));
1243 }
1244 });
1245 @@ -6940,7 +6940,7 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg,
1246 ResTable_config thisConfig;
1247 thisConfig.copyFromDtoH(type->config);
1248 ALOGI("Adding config to type %d: %s\n", type->id,
1249 - thisConfig.toString().string());
1250 + thisConfig.toString().c_str());
1251 }
1252 }
1253 } else {
1254 @@ -7018,7 +7018,7 @@ status_t DynamicRefTable::load(const ResTable_lib_header* const header)
1255 char16_t tmpName[sizeof(entry->packageName) / sizeof(char16_t)];
1256 strcpy16_dtoh(tmpName, entry->packageName, sizeof(entry->packageName) / sizeof(char16_t));
1257 if (kDebugLibNoisy) {
1258 - ALOGV("Found lib entry %s with id %d\n", String8(tmpName).string(),
1259 + ALOGV("Found lib entry %s with id %d\n", String8(tmpName).c_str(),
1260 dtohl(entry->packageId));
1261 }
1262 if (packageId >= 256) {
1263 @@ -7300,7 +7300,7 @@ status_t ResTable::createIdmap(const ResTable& targetResTable,
1264 current_res.nameLen,
1265 current_res.type,
1266 current_res.typeLen,
1267 - targetPackageName.string(),
1268 + targetPackageName.c_str(),
1269 targetPackageName.size(),
1270 &typeSpecFlags);
1271
1272 @@ -7407,7 +7407,7 @@ bool ResTable::getIdmapInfo(const void* idmap, size_t sizeBytes,
1273 }
1274
1275
1276 -#define CHAR16_TO_CSTR(c16, len) (String8(String16(c16,len)).string())
1277 +#define CHAR16_TO_CSTR(c16, len) (String8(String16(c16,len)).c_str())
1278
1279 #define CHAR16_ARRAY_EQ(constant, var, len) \
1280 (((len) == (sizeof(constant)/sizeof((constant)[0]))) && (0 == memcmp((var), (constant), (len))))
1281 @@ -7502,13 +7502,13 @@ void ResTable::print_value(const Package* pkg, const Res_value& value) const
1282 const char* str8 = UnpackOptionalString(pkg->header->values.string8At(
1283 value.data), &len);
1284 if (str8 != NULL) {
1285 - printf("(string8) \"%s\"\n", normalizeForOutput(str8).string());
1286 + printf("(string8) \"%s\"\n", normalizeForOutput(str8).c_str());
1287 } else {
1288 const char16_t* str16 = UnpackOptionalString(pkg->header->values.stringAt(
1289 value.data), &len);
1290 if (str16 != NULL) {
1291 printf("(string16) \"%s\"\n",
1292 - normalizeForOutput(String8(str16, len).string()).string());
1293 + normalizeForOutput(String8(str16, len).c_str()).c_str());
1294 } else {
1295 printf("(string) null\n");
1296 }
1297 @@ -7549,7 +7549,7 @@ void ResTable::print(bool inclValues) const
1298 const PackageGroup* pg = mPackageGroups[pgIndex];
1299 printf("Package Group %d id=0x%02x packageCount=%d name=%s\n",
1300 (int)pgIndex, pg->id, (int)pg->packages.size(),
1301 - String8(pg->name).string());
1302 + String8(pg->name).c_str());
1303
1304 const KeyedVector<String16, uint8_t>& refEntries = pg->dynamicRefTable.entries();
1305 const size_t refEntryCount = refEntries.size();
1306 @@ -7558,7 +7558,7 @@ void ResTable::print(bool inclValues) const
1307 for (size_t refIndex = 0; refIndex < refEntryCount; refIndex++) {
1308 printf(" 0x%02x -> %s\n",
1309 refEntries.valueAt(refIndex),
1310 - String8(refEntries.keyAt(refIndex)).string());
1311 + String8(refEntries.keyAt(refIndex)).c_str());
1312 }
1313 printf("\n");
1314 }
1315 @@ -7584,7 +7584,7 @@ void ResTable::print(bool inclValues) const
1316 strcpy16_dtoh(tmpName, pkg->package->name,
1317 sizeof(pkg->package->name)/sizeof(pkg->package->name[0]));
1318 printf(" Package %d id=0x%02x name=%s\n", (int)pkgIndex,
1319 - pkg->package->id, String8(tmpName).string());
1320 + pkg->package->id, String8(tmpName).c_str());
1321 }
1322
1323 for (size_t typeIndex = 0; typeIndex < pg->types.size(); typeIndex++) {
1324 @@ -7626,7 +7626,7 @@ void ResTable::print(bool inclValues) const
1325 printf(" spec resource 0x%08x %s:%s/%s: flags=0x%08x\n",
1326 resID,
1327 CHAR16_TO_CSTR(resName.package, resName.packageLen),
1328 - type8.string(), name8.string(),
1329 + type8.c_str(), name8.c_str(),
1330 dtohl(typeConfigs->typeSpecFlags[entryIndex]));
1331 } else {
1332 printf(" INVALID TYPE CONFIG FOR RESOURCE 0x%08x\n", resID);
1333 @@ -7647,7 +7647,7 @@ void ResTable::print(bool inclValues) const
1334
1335 String8 configStr = thisConfig.toString();
1336 printf(" config %s", configStr.size() > 0
1337 - ? configStr.string() : "(default)");
1338 + ? configStr.c_str() : "(default)");
1339 if (type->flags != 0u) {
1340 printf(" flags=0x%02x", type->flags);
1341 if (type->flags & ResTable_type::FLAG_SPARSE) {
1342 @@ -7712,7 +7712,7 @@ void ResTable::print(bool inclValues) const
1343 }
1344 printf(" resource 0x%08x %s:%s/%s: ", resID,
1345 CHAR16_TO_CSTR(resName.package, resName.packageLen),
1346 - type8.string(), name8.string());
1347 + type8.c_str(), name8.c_str());
1348 } else {
1349 printf(" INVALID RESOURCE 0x%08x: ", resID);
1350 }
1351 diff --git a/libs/androidfw/include/androidfw/Asset.h b/libs/androidfw/include/androidfw/Asset.h
1352 index 19febcdee77e..f3776b5401f3 100644
1353 --- a/libs/androidfw/include/androidfw/Asset.h
1354 +++ b/libs/androidfw/include/androidfw/Asset.h
1355 @@ -135,7 +135,7 @@ public:
1356 * This is NOT intended to be used for anything except debug output.
1357 * DO NOT try to parse this or use it to open a file.
1358 */
1359 - const char* getAssetSource(void) const { return mAssetSource.string(); }
1360 + const char* getAssetSource(void) const { return mAssetSource.c_str(); }
1361
1362 /*
1363 * Create the asset from a file descriptor.
1364 diff --git a/libs/androidfw/include/androidfw/ConfigDescription.h b/libs/androidfw/include/androidfw/ConfigDescription.h
1365 index 61d10cd4e55b..1701f1b8bc0d 100644
1366 --- a/libs/androidfw/include/androidfw/ConfigDescription.h
1367 +++ b/libs/androidfw/include/androidfw/ConfigDescription.h
1368 @@ -207,7 +207,7 @@ inline bool ConfigDescription::operator>(const ConfigDescription& o) const {
1369
1370 inline ::std::ostream& operator<<(::std::ostream& out,
1371 const ConfigDescription& o) {
1372 - return out << o.toString().string();
1373 + return out << o.toString().c_str();
1374 }
1375
1376 } // namespace android
1377 diff --git a/libs/androidfw/tests/BackupData_test.cpp b/libs/androidfw/tests/BackupData_test.cpp
1378 index e25b616dcbd9..7d3a3411d81d 100644
1379 --- a/libs/androidfw/tests/BackupData_test.cpp
1380 +++ b/libs/androidfw/tests/BackupData_test.cpp
1381 @@ -56,10 +56,10 @@ protected:
1382 mFilename.append(m_external_storage);
1383 mFilename.append(TEST_FILENAME);
1384
1385 - ::unlink(mFilename.string());
1386 - int fd = ::open(mFilename.string(), O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
1387 + ::unlink(mFilename.c_str());
1388 + int fd = ::open(mFilename.c_str(), O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
1389 if (fd < 0) {
1390 - FAIL() << "Couldn't create " << mFilename.string() << " for writing";
1391 + FAIL() << "Couldn't create " << mFilename.c_str() << " for writing";
1392 }
1393 mKey1 = String8(KEY1);
1394 mKey2 = String8(KEY2);
1395 @@ -72,7 +72,7 @@ protected:
1396 };
1397
1398 TEST_F(BackupDataTest, WriteAndReadSingle) {
1399 - int fd = ::open(mFilename.string(), O_WRONLY);
1400 + int fd = ::open(mFilename.c_str(), O_WRONLY);
1401 BackupDataWriter* writer = new BackupDataWriter(fd);
1402
1403 EXPECT_EQ(NO_ERROR, writer->WriteEntityHeader(mKey1, sizeof(DATA1)))
1404 @@ -81,7 +81,7 @@ TEST_F(BackupDataTest, WriteAndReadSingle) {
1405 << "WriteEntityData returned an error";
1406
1407 ::close(fd);
1408 - fd = ::open(mFilename.string(), O_RDONLY);
1409 + fd = ::open(mFilename.c_str(), O_RDONLY);
1410 BackupDataReader* reader = new BackupDataReader(fd);
1411 EXPECT_EQ(NO_ERROR, reader->Status())
1412 << "Reader ctor failed";
1413 @@ -114,7 +114,7 @@ TEST_F(BackupDataTest, WriteAndReadSingle) {
1414 }
1415
1416 TEST_F(BackupDataTest, WriteAndReadMultiple) {
1417 - int fd = ::open(mFilename.string(), O_WRONLY);
1418 + int fd = ::open(mFilename.c_str(), O_WRONLY);
1419 BackupDataWriter* writer = new BackupDataWriter(fd);
1420 writer->WriteEntityHeader(mKey1, sizeof(DATA1));
1421 writer->WriteEntityData(DATA1, sizeof(DATA1));
1422 @@ -122,7 +122,7 @@ TEST_F(BackupDataTest, WriteAndReadMultiple) {
1423 writer->WriteEntityData(DATA2, sizeof(DATA2));
1424
1425 ::close(fd);
1426 - fd = ::open(mFilename.string(), O_RDONLY);
1427 + fd = ::open(mFilename.c_str(), O_RDONLY);
1428 BackupDataReader* reader = new BackupDataReader(fd);
1429
1430 bool done;
1431 @@ -162,7 +162,7 @@ TEST_F(BackupDataTest, WriteAndReadMultiple) {
1432 }
1433
1434 TEST_F(BackupDataTest, SkipEntity) {
1435 - int fd = ::open(mFilename.string(), O_WRONLY);
1436 + int fd = ::open(mFilename.c_str(), O_WRONLY);
1437 BackupDataWriter* writer = new BackupDataWriter(fd);
1438 writer->WriteEntityHeader(mKey1, sizeof(DATA1));
1439 writer->WriteEntityData(DATA1, sizeof(DATA1));
1440 @@ -172,7 +172,7 @@ TEST_F(BackupDataTest, SkipEntity) {
1441 writer->WriteEntityData(DATA3, sizeof(DATA3));
1442
1443 ::close(fd);
1444 - fd = ::open(mFilename.string(), O_RDONLY);
1445 + fd = ::open(mFilename.c_str(), O_RDONLY);
1446 BackupDataReader* reader = new BackupDataReader(fd);
1447
1448 bool done;
1449 @@ -217,14 +217,14 @@ TEST_F(BackupDataTest, SkipEntity) {
1450 }
1451
1452 TEST_F(BackupDataTest, DeleteEntity) {
1453 - int fd = ::open(mFilename.string(), O_WRONLY);
1454 + int fd = ::open(mFilename.c_str(), O_WRONLY);
1455 BackupDataWriter* writer = new BackupDataWriter(fd);
1456 writer->WriteEntityHeader(mKey1, sizeof(DATA1));
1457 writer->WriteEntityData(DATA1, sizeof(DATA1));
1458 writer->WriteEntityHeader(mKey2, -1);
1459
1460 ::close(fd);
1461 - fd = ::open(mFilename.string(), O_RDONLY);
1462 + fd = ::open(mFilename.c_str(), O_RDONLY);
1463 BackupDataReader* reader = new BackupDataReader(fd);
1464
1465 bool done;
1466 @@ -256,7 +256,7 @@ TEST_F(BackupDataTest, DeleteEntity) {
1467 }
1468
1469 TEST_F(BackupDataTest, EneityAfterDelete) {
1470 - int fd = ::open(mFilename.string(), O_WRONLY);
1471 + int fd = ::open(mFilename.c_str(), O_WRONLY);
1472 BackupDataWriter* writer = new BackupDataWriter(fd);
1473 writer->WriteEntityHeader(mKey1, sizeof(DATA1));
1474 writer->WriteEntityData(DATA1, sizeof(DATA1));
1475 @@ -265,7 +265,7 @@ TEST_F(BackupDataTest, EneityAfterDelete) {
1476 writer->WriteEntityData(DATA3, sizeof(DATA3));
1477
1478 ::close(fd);
1479 - fd = ::open(mFilename.string(), O_RDONLY);
1480 + fd = ::open(mFilename.c_str(), O_RDONLY);
1481 BackupDataReader* reader = new BackupDataReader(fd);
1482
1483 bool done;
1484 @@ -317,7 +317,7 @@ TEST_F(BackupDataTest, EneityAfterDelete) {
1485 }
1486
1487 TEST_F(BackupDataTest, OnlyDeleteEntities) {
1488 - int fd = ::open(mFilename.string(), O_WRONLY);
1489 + int fd = ::open(mFilename.c_str(), O_WRONLY);
1490 BackupDataWriter* writer = new BackupDataWriter(fd);
1491 writer->WriteEntityHeader(mKey1, -1);
1492 writer->WriteEntityHeader(mKey2, -1);
1493 @@ -325,7 +325,7 @@ TEST_F(BackupDataTest, OnlyDeleteEntities) {
1494 writer->WriteEntityHeader(mKey4, -1);
1495
1496 ::close(fd);
1497 - fd = ::open(mFilename.string(), O_RDONLY);
1498 + fd = ::open(mFilename.c_str(), O_RDONLY);
1499 BackupDataReader* reader = new BackupDataReader(fd);
1500
1501 bool done;
1502 @@ -385,13 +385,13 @@ TEST_F(BackupDataTest, OnlyDeleteEntities) {
1503 }
1504
1505 TEST_F(BackupDataTest, ReadDeletedEntityData) {
1506 - int fd = ::open(mFilename.string(), O_WRONLY);
1507 + int fd = ::open(mFilename.c_str(), O_WRONLY);
1508 BackupDataWriter* writer = new BackupDataWriter(fd);
1509 writer->WriteEntityHeader(mKey1, -1);
1510 writer->WriteEntityHeader(mKey2, -1);
1511
1512 ::close(fd);
1513 - fd = ::open(mFilename.string(), O_RDONLY);
1514 + fd = ::open(mFilename.c_str(), O_RDONLY);
1515 BackupDataReader* reader = new BackupDataReader(fd);
1516
1517 bool done;
1518 diff --git a/libs/androidfw/tests/CommonHelpers.cpp b/libs/androidfw/tests/CommonHelpers.cpp
1519 index 3396729536a4..10138de0843c 100644
1520 --- a/libs/androidfw/tests/CommonHelpers.cpp
1521 +++ b/libs/androidfw/tests/CommonHelpers.cpp
1522 @@ -60,7 +60,7 @@ const std::string& GetTestDataPath() {
1523 std::string GetStringFromPool(const ResStringPool* pool, uint32_t idx) {
1524 auto str = pool->string8ObjectAt(idx);
1525 CHECK(str.has_value()) << "failed to find string entry";
1526 - return std::string(str->string(), str->length());
1527 + return std::string(str->c_str(), str->length());
1528 }
1529
1530 } // namespace android
1531 diff --git a/libs/androidfw/tests/ConfigDescription_test.cpp b/libs/androidfw/tests/ConfigDescription_test.cpp
1532 index ce7f8054e2ca..727035714df3 100644
1533 --- a/libs/androidfw/tests/ConfigDescription_test.cpp
1534 +++ b/libs/androidfw/tests/ConfigDescription_test.cpp
1535 @@ -50,10 +50,10 @@ TEST(ConfigDescriptionTest, ParseFailWhenQualifiersHaveTrailingDash) {
1536 TEST(ConfigDescriptionTest, ParseBasicQualifiers) {
1537 ConfigDescription config;
1538 EXPECT_TRUE(TestParse("", &config));
1539 - EXPECT_EQ(std::string(""), config.toString().string());
1540 + EXPECT_EQ(std::string(""), config.toString().c_str());
1541
1542 EXPECT_TRUE(TestParse("fr-land", &config));
1543 - EXPECT_EQ(std::string("fr-land"), config.toString().string());
1544 + EXPECT_EQ(std::string("fr-land"), config.toString().c_str());
1545
1546 EXPECT_TRUE(
1547 TestParse("mcc310-pl-sw720dp-normal-long-port-night-"
1548 @@ -61,22 +61,22 @@ TEST(ConfigDescriptionTest, ParseBasicQualifiers) {
1549 &config));
1550 EXPECT_EQ(std::string("mcc310-pl-sw720dp-normal-long-port-night-"
1551 "xhdpi-keyssoft-qwerty-navexposed-nonav-v13"),
1552 - config.toString().string());
1553 + config.toString().c_str());
1554 }
1555
1556 TEST(ConfigDescriptionTest, ParseLocales) {
1557 ConfigDescription config;
1558 EXPECT_TRUE(TestParse("en-rUS", &config));
1559 - EXPECT_EQ(std::string("en-rUS"), config.toString().string());
1560 + EXPECT_EQ(std::string("en-rUS"), config.toString().c_str());
1561 }
1562
1563 TEST(ConfigDescriptionTest, ParseQualifierAddedInApi13) {
1564 ConfigDescription config;
1565 EXPECT_TRUE(TestParse("sw600dp", &config));
1566 - EXPECT_EQ(std::string("sw600dp-v13"), config.toString().string());
1567 + EXPECT_EQ(std::string("sw600dp-v13"), config.toString().c_str());
1568
1569 EXPECT_TRUE(TestParse("sw600dp-v8", &config));
1570 - EXPECT_EQ(std::string("sw600dp-v13"), config.toString().string());
1571 + EXPECT_EQ(std::string("sw600dp-v13"), config.toString().c_str());
1572 }
1573
1574 TEST(ConfigDescriptionTest, ParseCarAttribute) {
1575 @@ -91,13 +91,13 @@ TEST(ConfigDescriptionTest, TestParsingRoundQualifier) {
1576 EXPECT_EQ(android::ResTable_config::SCREENROUND_YES,
1577 config.screenLayout2 & android::ResTable_config::MASK_SCREENROUND);
1578 EXPECT_EQ(SDK_MARSHMALLOW, config.sdkVersion);
1579 - EXPECT_EQ(std::string("round-v23"), config.toString().string());
1580 + EXPECT_EQ(std::string("round-v23"), config.toString().c_str());
1581
1582 EXPECT_TRUE(TestParse("notround", &config));
1583 EXPECT_EQ(android::ResTable_config::SCREENROUND_NO,
1584 config.screenLayout2 & android::ResTable_config::MASK_SCREENROUND);
1585 EXPECT_EQ(SDK_MARSHMALLOW, config.sdkVersion);
1586 - EXPECT_EQ(std::string("notround-v23"), config.toString().string());
1587 + EXPECT_EQ(std::string("notround-v23"), config.toString().c_str());
1588 }
1589
1590 TEST(ConfigDescriptionTest, TestWideColorGamutQualifier) {
1591 @@ -106,13 +106,13 @@ TEST(ConfigDescriptionTest, TestWideColorGamutQualifier) {
1592 EXPECT_EQ(android::ResTable_config::WIDE_COLOR_GAMUT_YES,
1593 config.colorMode & android::ResTable_config::MASK_WIDE_COLOR_GAMUT);
1594 EXPECT_EQ(SDK_O, config.sdkVersion);
1595 - EXPECT_EQ(std::string("widecg-v26"), config.toString().string());
1596 + EXPECT_EQ(std::string("widecg-v26"), config.toString().c_str());
1597
1598 EXPECT_TRUE(TestParse("nowidecg", &config));
1599 EXPECT_EQ(android::ResTable_config::WIDE_COLOR_GAMUT_NO,
1600 config.colorMode & android::ResTable_config::MASK_WIDE_COLOR_GAMUT);
1601 EXPECT_EQ(SDK_O, config.sdkVersion);
1602 - EXPECT_EQ(std::string("nowidecg-v26"), config.toString().string());
1603 + EXPECT_EQ(std::string("nowidecg-v26"), config.toString().c_str());
1604 }
1605
1606 TEST(ConfigDescriptionTest, TestHdrQualifier) {
1607 @@ -121,13 +121,13 @@ TEST(ConfigDescriptionTest, TestHdrQualifier) {
1608 EXPECT_EQ(android::ResTable_config::HDR_YES,
1609 config.colorMode & android::ResTable_config::MASK_HDR);
1610 EXPECT_EQ(SDK_O, config.sdkVersion);
1611 - EXPECT_EQ(std::string("highdr-v26"), config.toString().string());
1612 + EXPECT_EQ(std::string("highdr-v26"), config.toString().c_str());
1613
1614 EXPECT_TRUE(TestParse("lowdr", &config));
1615 EXPECT_EQ(android::ResTable_config::HDR_NO,
1616 config.colorMode & android::ResTable_config::MASK_HDR);
1617 EXPECT_EQ(SDK_O, config.sdkVersion);
1618 - EXPECT_EQ(std::string("lowdr-v26"), config.toString().string());
1619 + EXPECT_EQ(std::string("lowdr-v26"), config.toString().c_str());
1620 }
1621
1622 TEST(ConfigDescriptionTest, ParseVrAttribute) {
1623 @@ -135,7 +135,7 @@ TEST(ConfigDescriptionTest, ParseVrAttribute) {
1624 EXPECT_TRUE(TestParse("vrheadset", &config));
1625 EXPECT_EQ(android::ResTable_config::UI_MODE_TYPE_VR_HEADSET, config.uiMode);
1626 EXPECT_EQ(SDK_O, config.sdkVersion);
1627 - EXPECT_EQ(std::string("vrheadset-v26"), config.toString().string());
1628 + EXPECT_EQ(std::string("vrheadset-v26"), config.toString().c_str());
1629 }
1630
1631 static inline ConfigDescription ParseConfigOrDie(const android::StringPiece& str) {
1632 diff --git a/libs/androidfw/tests/ObbFile_test.cpp b/libs/androidfw/tests/ObbFile_test.cpp
1633 index 115112128636..ba818c4d7645 100644
1634 --- a/libs/androidfw/tests/ObbFile_test.cpp
1635 +++ b/libs/androidfw/tests/ObbFile_test.cpp
1636 @@ -43,9 +43,9 @@ protected:
1637 mFileName.append(externalStorage);
1638 mFileName.append(TEST_FILENAME);
1639
1640 - int fd = ::open(mFileName.string(), O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
1641 + int fd = ::open(mFileName.c_str(), O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
1642 if (fd < 0) {
1643 - FAIL() << "Couldn't create " << mFileName.string() << " for tests";
1644 + FAIL() << "Couldn't create " << mFileName.c_str() << " for tests";
1645 }
1646 }
1647
1648 @@ -69,17 +69,17 @@ TEST_F(ObbFileTest, WriteThenRead) {
1649 EXPECT_TRUE(mObbFile->setSalt(salt, SALT_SIZE))
1650 << "Salt should be successfully set";
1651
1652 - EXPECT_TRUE(mObbFile->writeTo(mFileName.string()))
1653 + EXPECT_TRUE(mObbFile->writeTo(mFileName.c_str()))
1654 << "couldn't write to fake .obb file";
1655
1656 mObbFile = new ObbFile();
1657
1658 - EXPECT_TRUE(mObbFile->readFrom(mFileName.string()))
1659 + EXPECT_TRUE(mObbFile->readFrom(mFileName.c_str()))
1660 << "couldn't read from fake .obb file";
1661
1662 EXPECT_EQ(versionNum, mObbFile->getVersion())
1663 << "version didn't come out the same as it went in";
1664 - const char* currentPackageName = mObbFile->getPackageName().string();
1665 + const char* currentPackageName = mObbFile->getPackageName().c_str();
1666 EXPECT_STREQ(packageName, currentPackageName)
1667 << "package name didn't come out the same as it went in";
1668
1669 diff --git a/libs/androidfw/tests/ResTable_test.cpp b/libs/androidfw/tests/ResTable_test.cpp
1670 index 9aeb00c47e63..dc6dea9fe69c 100644
1671 --- a/libs/androidfw/tests/ResTable_test.cpp
1672 +++ b/libs/androidfw/tests/ResTable_test.cpp
1673 @@ -57,7 +57,7 @@ TEST(ResTableTest, ShouldLoadSparseEntriesSuccessfully) {
1674 String16 name(u"com.android.sparse:integer/foo_9");
1675 uint32_t flags;
1676 uint32_t resid =
1677 - table.identifierForName(name.string(), name.size(), nullptr, 0, nullptr, 0, &flags);
1678 + table.identifierForName(name.c_str(), name.size(), nullptr, 0, nullptr, 0, &flags);
1679 ASSERT_NE(0u, resid);
1680
1681 Res_value val;
1682 @@ -91,8 +91,8 @@ TEST(ResTableTest, ResourceNameIsResolved) {
1683 String16 defPackage("com.android.basic");
1684 String16 testName("@string/test1");
1685 uint32_t resID =
1686 - table.identifierForName(testName.string(), testName.size(), 0, 0,
1687 - defPackage.string(), defPackage.size());
1688 + table.identifierForName(testName.c_str(), testName.size(), 0, 0,
1689 + defPackage.c_str(), defPackage.size());
1690 ASSERT_NE(uint32_t(0x00000000), resID);
1691 ASSERT_EQ(basic::R::string::test1, resID);
1692 }
1693 diff --git a/libs/androidfw/tests/Split_test.cpp b/libs/androidfw/tests/Split_test.cpp
1694 index 2c242dbd3e28..3d88577c078f 100644
1695 --- a/libs/androidfw/tests/Split_test.cpp
1696 +++ b/libs/androidfw/tests/Split_test.cpp
1697 @@ -261,8 +261,8 @@ TEST_F(SplitTest, TestNewResourceIsAccessibleByName) {
1698 const String16 package("com.android.basic");
1699 ASSERT_EQ(
1700 R::string::test3,
1701 - table.identifierForName(name.string(), name.size(), type.string(),
1702 - type.size(), package.string(), package.size()));
1703 + table.identifierForName(name.c_str(), name.size(), type.c_str(),
1704 + type.size(), package.c_str(), package.size()));
1705 }
1706
1707 } // namespace
1708 diff --git a/libs/androidfw/tests/TestHelpers.cpp b/libs/androidfw/tests/TestHelpers.cpp
1709 index 10c0a4fc8316..c6f657c5d9a8 100644
1710 --- a/libs/androidfw/tests/TestHelpers.cpp
1711 +++ b/libs/androidfw/tests/TestHelpers.cpp
1712 @@ -79,9 +79,9 @@ AssertionResult IsStringEqual(const ResTable& table, uint32_t resource_id,
1713 }
1714
1715 if (String8(expected_str) != *actual_str) {
1716 - return AssertionFailure() << actual_str->string();
1717 + return AssertionFailure() << actual_str->c_str();
1718 }
1719 - return AssertionSuccess() << actual_str->string();
1720 + return AssertionSuccess() << actual_str->c_str();
1721 }
1722
1723 } // namespace android
1724 diff --git a/tools/aapt/AaptAssets.cpp b/tools/aapt/AaptAssets.cpp
1725 index 899d26818548..b94d14fd4b75 100644
1726 --- a/tools/aapt/AaptAssets.cpp
1727 +++ b/tools/aapt/AaptAssets.cpp
1728 @@ -219,7 +219,7 @@ bool AaptLocaleValue::initFromFilterString(const String8& str) {
1729 if (numTags >= 1) {
1730 const String8& lang = parts[0];
1731 if (isAlpha(lang) && (lang.length() == 2 || lang.length() == 3)) {
1732 - setLanguage(lang.string());
1733 + setLanguage(lang.c_str());
1734 valid = true;
1735 }
1736 }
1737 @@ -232,11 +232,11 @@ bool AaptLocaleValue::initFromFilterString(const String8& str) {
1738 const String8& part2 = parts[1];
1739 if ((part2.length() == 2 && isAlpha(part2)) ||
1740 (part2.length() == 3 && isNumber(part2))) {
1741 - setRegion(part2.string());
1742 + setRegion(part2.c_str());
1743 } else if (part2.length() == 4 && isAlpha(part2)) {
1744 - setScript(part2.string());
1745 + setScript(part2.c_str());
1746 } else if (part2.length() >= 4 && part2.length() <= 8) {
1747 - setVariant(part2.string());
1748 + setVariant(part2.c_str());
1749 } else {
1750 valid = false;
1751 }
1752 @@ -249,9 +249,9 @@ bool AaptLocaleValue::initFromFilterString(const String8& str) {
1753 const String8& part3 = parts[2];
1754 if (((part3.length() == 2 && isAlpha(part3)) ||
1755 (part3.length() == 3 && isNumber(part3))) && script[0]) {
1756 - setRegion(part3.string());
1757 + setRegion(part3.c_str());
1758 } else if (part3.length() >= 4 && part3.length() <= 8) {
1759 - setVariant(part3.string());
1760 + setVariant(part3.c_str());
1761 } else {
1762 valid = false;
1763 }
1764 @@ -262,7 +262,7 @@ bool AaptLocaleValue::initFromFilterString(const String8& str) {
1765
1766 const String8& part4 = parts[3];
1767 if (part4.length() >= 4 && part4.length() <= 8) {
1768 - setVariant(part4.string());
1769 + setVariant(part4.c_str());
1770 } else {
1771 valid = false;
1772 }
1773 @@ -310,7 +310,7 @@ int AaptLocaleValue::initFromDirName(const Vector<String8>& parts, const int sta
1774 break;
1775 default:
1776 fprintf(stderr, "ERROR: Invalid BCP 47 tag in directory name %s\n",
1777 - part.string());
1778 + part.c_str());
1779 return -1;
1780 }
1781 } else if (subtags.size() == 3) {
1782 @@ -324,7 +324,7 @@ int AaptLocaleValue::initFromDirName(const Vector<String8>& parts, const int sta
1783 } else if (subtags[1].size() == 2 || subtags[1].size() == 3) {
1784 setRegion(subtags[1]);
1785 } else {
1786 - fprintf(stderr, "ERROR: Invalid BCP 47 tag in directory name %s\n", part.string());
1787 + fprintf(stderr, "ERROR: Invalid BCP 47 tag in directory name %s\n", part.c_str());
1788 return -1;
1789 }
1790
1791 @@ -341,14 +341,14 @@ int AaptLocaleValue::initFromDirName(const Vector<String8>& parts, const int sta
1792 setRegion(subtags[2]);
1793 setVariant(subtags[3]);
1794 } else {
1795 - fprintf(stderr, "ERROR: Invalid BCP 47 tag in directory name: %s\n", part.string());
1796 + fprintf(stderr, "ERROR: Invalid BCP 47 tag in directory name: %s\n", part.c_str());
1797 return -1;
1798 }
1799
1800 return ++currentIndex;
1801 } else {
1802 if ((part.length() == 2 || part.length() == 3)
1803 - && isAlpha(part) && strcmp("car", part.string())) {
1804 + && isAlpha(part) && strcmp("car", part.c_str())) {
1805 setLanguage(part);
1806 if (++currentIndex == size) {
1807 return size;
1808 @@ -358,8 +358,8 @@ int AaptLocaleValue::initFromDirName(const Vector<String8>& parts, const int sta
1809 }
1810
1811 part = parts[currentIndex];
1812 - if (part.string()[0] == 'r' && part.length() == 3) {
1813 - setRegion(part.string() + 1);
1814 + if (part.c_str()[0] == 'r' && part.length() == 3) {
1815 + setRegion(part.c_str() + 1);
1816 if (++currentIndex == size) {
1817 return size;
1818 }
1819 @@ -524,8 +524,8 @@ status_t AaptGroup::addFile(const sp<AaptFile>& file, const bool overwriteDuplic
1820 ssize_t index = mFiles.indexOfKey(file->getGroupEntry());
1821 if (index >= 0 && overwriteDuplicate) {
1822 fprintf(stderr, "warning: overwriting '%s' with '%s'\n",
1823 - mFiles[index]->getSourceFile().string(),
1824 - file->getSourceFile().string());
1825 + mFiles[index]->getSourceFile().c_str(),
1826 + file->getSourceFile().c_str());
1827 removeFile(index);
1828 index = -1;
1829 }
1830 @@ -545,7 +545,7 @@ status_t AaptGroup::addFile(const sp<AaptFile>& file, const bool overwriteDuplic
1831 const sp<AaptFile>& originalFile = mFiles.valueAt(index);
1832 SourcePos(file->getSourceFile(), -1)
1833 .error("Duplicate file.\n%s: Original is here. %s",
1834 - originalFile->getPrintableSource().string(),
1835 + originalFile->getPrintableSource().c_str(),
1836 (withoutVersion.version != 0) ? "The version qualifier may be implied." : "");
1837 return UNKNOWN_ERROR;
1838 }
1839 @@ -557,21 +557,21 @@ void AaptGroup::removeFile(size_t index)
1840
1841 void AaptGroup::print(const String8& prefix) const
1842 {
1843 - printf("%s%s\n", prefix.string(), getPath().string());
1844 + printf("%s%s\n", prefix.c_str(), getPath().c_str());
1845 const size_t N=mFiles.size();
1846 size_t i;
1847 for (i=0; i<N; i++) {
1848 sp<AaptFile> file = mFiles.valueAt(i);
1849 const AaptGroupEntry& e = file->getGroupEntry();
1850 if (file->hasData()) {
1851 - printf("%s Gen: (%s) %d bytes\n", prefix.string(), e.toDirName(String8()).string(),
1852 + printf("%s Gen: (%s) %d bytes\n", prefix.c_str(), e.toDirName(String8()).c_str(),
1853 (int)file->getSize());
1854 } else {
1855 - printf("%s Src: (%s) %s\n", prefix.string(), e.toDirName(String8()).string(),
1856 - file->getPrintableSource().string());
1857 + printf("%s Src: (%s) %s\n", prefix.c_str(), e.toDirName(String8()).c_str(),
1858 + file->getPrintableSource().c_str());
1859 }
1860 - //printf("%s File Group Entry: %s\n", prefix.string(),
1861 - // file->getGroupEntry().toDirName(String8()).string());
1862 + //printf("%s File Group Entry: %s\n", prefix.c_str(),
1863 + // file->getGroupEntry().toDirName(String8()).c_str());
1864 }
1865 }
1866
1867 @@ -660,9 +660,9 @@ ssize_t AaptDir::slurpFullTree(Bundle* bundle, const String8& srcDir,
1868 {
1869 DIR* dir = NULL;
1870
1871 - dir = opendir(srcDir.string());
1872 + dir = opendir(srcDir.c_str());
1873 if (dir == NULL) {
1874 - fprintf(stderr, "ERROR: opendir(%s): %s\n", srcDir.string(), strerror(errno));
1875 + fprintf(stderr, "ERROR: opendir(%s): %s\n", srcDir.c_str(), strerror(errno));
1876 return UNKNOWN_ERROR;
1877 }
1878
1879 @@ -676,7 +676,7 @@ ssize_t AaptDir::slurpFullTree(Bundle* bundle, const String8& srcDir,
1880 if (entry == NULL)
1881 break;
1882
1883 - if (isHidden(srcDir.string(), entry->d_name))
1884 + if (isHidden(srcDir.c_str(), entry->d_name))
1885 continue;
1886
1887 String8 name(entry->d_name);
1888 @@ -701,8 +701,8 @@ ssize_t AaptDir::slurpFullTree(Bundle* bundle, const String8& srcDir,
1889 String8 pathName(srcDir);
1890 FileType type;
1891
1892 - pathName.appendPath(fileNames[i].string());
1893 - type = getFileType(pathName.string());
1894 + pathName.appendPath(fileNames[i].c_str());
1895 + type = getFileType(pathName.c_str());
1896 if (type == kFileTypeDirectory) {
1897 sp<AaptDir> subdir;
1898 bool notAdded = false;
1899 @@ -732,7 +732,7 @@ ssize_t AaptDir::slurpFullTree(Bundle* bundle, const String8& srcDir,
1900
1901 } else {
1902 if (bundle->getVerbose())
1903 - printf(" (ignoring non-file/dir '%s')\n", pathName.string());
1904 + printf(" (ignoring non-file/dir '%s')\n", pathName.c_str());
1905 }
1906 }
1907
1908 @@ -745,7 +745,7 @@ status_t AaptDir::validate() const
1909 const size_t ND = mDirs.size();
1910 size_t i;
1911 for (i = 0; i < NF; i++) {
1912 - if (!validateFileName(mFiles.valueAt(i)->getLeaf().string())) {
1913 + if (!validateFileName(mFiles.valueAt(i)->getLeaf().c_str())) {
1914 SourcePos(mFiles.valueAt(i)->getPrintableSource(), -1).error(
1915 "Invalid filename. Unable to add.");
1916 return UNKNOWN_ERROR;
1917 @@ -753,11 +753,11 @@ status_t AaptDir::validate() const
1918
1919 size_t j;
1920 for (j = i+1; j < NF; j++) {
1921 - if (strcasecmp(mFiles.valueAt(i)->getLeaf().string(),
1922 - mFiles.valueAt(j)->getLeaf().string()) == 0) {
1923 + if (strcasecmp(mFiles.valueAt(i)->getLeaf().c_str(),
1924 + mFiles.valueAt(j)->getLeaf().c_str()) == 0) {
1925 SourcePos(mFiles.valueAt(i)->getPrintableSource(), -1).error(
1926 "File is case-insensitive equivalent to: %s",
1927 - mFiles.valueAt(j)->getPrintableSource().string());
1928 + mFiles.valueAt(j)->getPrintableSource().c_str());
1929 return UNKNOWN_ERROR;
1930 }
1931
1932 @@ -766,18 +766,18 @@ status_t AaptDir::validate() const
1933 }
1934
1935 for (j = 0; j < ND; j++) {
1936 - if (strcasecmp(mFiles.valueAt(i)->getLeaf().string(),
1937 - mDirs.valueAt(j)->getLeaf().string()) == 0) {
1938 + if (strcasecmp(mFiles.valueAt(i)->getLeaf().c_str(),
1939 + mDirs.valueAt(j)->getLeaf().c_str()) == 0) {
1940 SourcePos(mFiles.valueAt(i)->getPrintableSource(), -1).error(
1941 "File conflicts with dir from: %s",
1942 - mDirs.valueAt(j)->getPrintableSource().string());
1943 + mDirs.valueAt(j)->getPrintableSource().c_str());
1944 return UNKNOWN_ERROR;
1945 }
1946 }
1947 }
1948
1949 for (i = 0; i < ND; i++) {
1950 - if (!validateFileName(mDirs.valueAt(i)->getLeaf().string())) {
1951 + if (!validateFileName(mDirs.valueAt(i)->getLeaf().c_str())) {
1952 SourcePos(mDirs.valueAt(i)->getPrintableSource(), -1).error(
1953 "Invalid directory name, unable to add.");
1954 return UNKNOWN_ERROR;
1955 @@ -785,11 +785,11 @@ status_t AaptDir::validate() const
1956
1957 size_t j;
1958 for (j = i+1; j < ND; j++) {
1959 - if (strcasecmp(mDirs.valueAt(i)->getLeaf().string(),
1960 - mDirs.valueAt(j)->getLeaf().string()) == 0) {
1961 + if (strcasecmp(mDirs.valueAt(i)->getLeaf().c_str(),
1962 + mDirs.valueAt(j)->getLeaf().c_str()) == 0) {
1963 SourcePos(mDirs.valueAt(i)->getPrintableSource(), -1).error(
1964 "Directory is case-insensitive equivalent to: %s",
1965 - mDirs.valueAt(j)->getPrintableSource().string());
1966 + mDirs.valueAt(j)->getPrintableSource().c_str());
1967 return UNKNOWN_ERROR;
1968 }
1969 }
1970 @@ -846,12 +846,12 @@ status_t AaptSymbols::applyJavaSymbols(const sp<AaptSymbols>& javaSymbols)
1971 const AaptSymbolEntry& entry = javaSymbols->mSymbols.valueAt(i);
1972 ssize_t pos = mSymbols.indexOfKey(name);
1973 if (pos < 0) {
1974 - entry.sourcePos.error("Symbol '%s' declared with <java-symbol> not defined\n", name.string());
1975 + entry.sourcePos.error("Symbol '%s' declared with <java-symbol> not defined\n", name.c_str());
1976 err = UNKNOWN_ERROR;
1977 continue;
1978 }
1979 //printf("**** setting symbol #%d/%d %s to isJavaSymbol=%d\n",
1980 - // i, N, name.string(), entry.isJavaSymbol ? 1 : 0);
1981 + // i, N, name.c_str(), entry.isJavaSymbol ? 1 : 0);
1982 mSymbols.editValueAt(pos).isJavaSymbol = entry.isJavaSymbol;
1983 }
1984
1985 @@ -862,11 +862,11 @@ status_t AaptSymbols::applyJavaSymbols(const sp<AaptSymbols>& javaSymbols)
1986 ssize_t pos = mNestedSymbols.indexOfKey(name);
1987 if (pos < 0) {
1988 SourcePos pos;
1989 - pos.error("Java symbol dir %s not defined\n", name.string());
1990 + pos.error("Java symbol dir %s not defined\n", name.c_str());
1991 err = UNKNOWN_ERROR;
1992 continue;
1993 }
1994 - //printf("**** applying java symbols in dir %s\n", name.string());
1995 + //printf("**** applying java symbols in dir %s\n", name.c_str());
1996 status_t myerr = mNestedSymbols.valueAt(pos)->applyJavaSymbols(symbols);
1997 if (myerr != NO_ERROR) {
1998 err = myerr;
1999 @@ -1131,9 +1131,9 @@ ssize_t AaptAssets::slurpResourceTree(Bundle* bundle, const String8& srcDir)
2000 {
2001 ssize_t err = 0;
2002
2003 - DIR* dir = opendir(srcDir.string());
2004 + DIR* dir = opendir(srcDir.c_str());
2005 if (dir == NULL) {
2006 - fprintf(stderr, "ERROR: opendir(%s): %s\n", srcDir.string(), strerror(errno));
2007 + fprintf(stderr, "ERROR: opendir(%s): %s\n", srcDir.c_str(), strerror(errno));
2008 return UNKNOWN_ERROR;
2009 }
2010
2011 @@ -1149,7 +1149,7 @@ ssize_t AaptAssets::slurpResourceTree(Bundle* bundle, const String8& srcDir)
2012 break;
2013 }
2014
2015 - if (isHidden(srcDir.string(), entry->d_name)) {
2016 + if (isHidden(srcDir.c_str(), entry->d_name)) {
2017 continue;
2018 }
2019
2020 @@ -1160,7 +1160,7 @@ ssize_t AaptAssets::slurpResourceTree(Bundle* bundle, const String8& srcDir)
2021 String8 resType;
2022 bool b = group.initFromDirName(entry->d_name, &resType);
2023 if (!b) {
2024 - fprintf(stderr, "invalid resource directory name: %s %s\n", srcDir.string(),
2025 + fprintf(stderr, "invalid resource directory name: %s %s\n", srcDir.c_str(),
2026 entry->d_name);
2027 err = -1;
2028 continue;
2029 @@ -1168,7 +1168,7 @@ ssize_t AaptAssets::slurpResourceTree(Bundle* bundle, const String8& srcDir)
2030
2031 if (bundle->getMaxResVersion() != NULL && group.getVersionString().length() != 0) {
2032 int maxResInt = atoi(bundle->getMaxResVersion());
2033 - const char *verString = group.getVersionString().string();
2034 + const char *verString = group.getVersionString().c_str();
2035 int dirVersionInt = atoi(verString + 1); // skip 'v' in version name
2036 if (dirVersionInt > maxResInt) {
2037 fprintf(stderr, "max res %d, skipping %s\n", maxResInt, entry->d_name);
2038 @@ -1176,7 +1176,7 @@ ssize_t AaptAssets::slurpResourceTree(Bundle* bundle, const String8& srcDir)
2039 }
2040 }
2041
2042 - FileType type = getFileType(subdirName.string());
2043 + FileType type = getFileType(subdirName.c_str());
2044
2045 if (type == kFileTypeDirectory) {
2046 sp<AaptDir> dir = makeDir(resType);
2047 @@ -1200,7 +1200,7 @@ ssize_t AaptAssets::slurpResourceTree(Bundle* bundle, const String8& srcDir)
2048 }
2049 } else {
2050 if (bundle->getVerbose()) {
2051 - fprintf(stderr, " (ignoring file '%s')\n", subdirName.string());
2052 + fprintf(stderr, " (ignoring file '%s')\n", subdirName.c_str());
2053 }
2054 }
2055 }
2056 @@ -1248,7 +1248,7 @@ AaptAssets::slurpResourceZip(Bundle* /* bundle */, const char* filename)
2057 String8 remain;
2058 if (entryName.walkPath(&remain) == kResourceDir) {
2059 // these are the resources, pull their type out of the directory name
2060 - kind.initFromDirName(remain.walkPath().string(), &resType);
2061 + kind.initFromDirName(remain.walkPath().c_str(), &resType);
2062 } else {
2063 // these are untyped and don't have an AaptGroupEntry
2064 }
2065 @@ -1263,7 +1263,7 @@ AaptAssets::slurpResourceZip(Bundle* /* bundle */, const char* filename)
2066 sp<AaptFile> file = new AaptFile(entryName, kind, resType);
2067 status_t err = dir->addLeafFile(entryName.getPathLeaf(), file);
2068 if (err != NO_ERROR) {
2069 - fprintf(stderr, "err=%s entryName=%s\n", strerror(err), entryName.string());
2070 + fprintf(stderr, "err=%s entryName=%s\n", strerror(err), entryName.c_str());
2071 count = err;
2072 goto bail;
2073 }
2074 @@ -1273,7 +1273,7 @@ AaptAssets::slurpResourceZip(Bundle* /* bundle */, const char* filename)
2075 if (entryName == "AndroidManifest.xml") {
2076 printf("AndroidManifest.xml\n");
2077 }
2078 - printf("\n\nfile: %s\n", entryName.string());
2079 + printf("\n\nfile: %s\n", entryName.c_str());
2080 #endif
2081
2082 size_t len = entry->getUncompressedLen();
2083 @@ -1317,9 +1317,9 @@ status_t AaptAssets::filter(Bundle* bundle)
2084 uint32_t preferredDensity = 0;
2085 if (bundle->getPreferredDensity().size() > 0) {
2086 ResTable_config preferredConfig;
2087 - if (!AaptConfig::parseDensity(bundle->getPreferredDensity().string(), &preferredConfig)) {
2088 + if (!AaptConfig::parseDensity(bundle->getPreferredDensity().c_str(), &preferredConfig)) {
2089 fprintf(stderr, "Error parsing preferred density: %s\n",
2090 - bundle->getPreferredDensity().string());
2091 + bundle->getPreferredDensity().c_str());
2092 return UNKNOWN_ERROR;
2093 }
2094 preferredDensity = preferredConfig.density;
2095 @@ -1332,11 +1332,11 @@ status_t AaptAssets::filter(Bundle* bundle)
2096 if (bundle->getVerbose()) {
2097 if (!reqFilter->isEmpty()) {
2098 printf("Applying required filter: %s\n",
2099 - bundle->getConfigurations().string());
2100 + bundle->getConfigurations().c_str());
2101 }
2102 if (preferredDensity > 0) {
2103 printf("Applying preferred density filter: %s\n",
2104 - bundle->getPreferredDensity().string());
2105 + bundle->getPreferredDensity().c_str());
2106 }
2107 }
2108
2109 @@ -1385,7 +1385,7 @@ status_t AaptAssets::filter(Bundle* bundle)
2110 if (!reqFilter->match(config)) {
2111 if (bundle->getVerbose()) {
2112 printf("Pruning unneeded resource: %s\n",
2113 - file->getPrintableSource().string());
2114 + file->getPrintableSource().c_str());
2115 }
2116 grp->removeFile(k);
2117 k--;
2118 @@ -1453,7 +1453,7 @@ status_t AaptAssets::filter(Bundle* bundle)
2119 if (bestDensity != config.density) {
2120 if (bundle->getVerbose()) {
2121 printf("Pruning unneeded resource: %s\n",
2122 - file->getPrintableSource().string());
2123 + file->getPrintableSource().c_str());
2124 }
2125 grp->removeFile(k);
2126 k--;
2127 @@ -1495,10 +1495,10 @@ status_t AaptAssets::applyJavaSymbols()
2128 ssize_t pos = mSymbols.indexOfKey(name);
2129 if (pos < 0) {
2130 SourcePos pos;
2131 - pos.error("Java symbol dir %s not defined\n", name.string());
2132 + pos.error("Java symbol dir %s not defined\n", name.c_str());
2133 return UNKNOWN_ERROR;
2134 }
2135 - //printf("**** applying java symbols in dir %s\n", name.string());
2136 + //printf("**** applying java symbols in dir %s\n", name.c_str());
2137 status_t err = mSymbols.valueAt(pos)->applyJavaSymbols(symbols);
2138 if (err != NO_ERROR) {
2139 return err;
2140 @@ -1510,7 +1510,7 @@ status_t AaptAssets::applyJavaSymbols()
2141
2142 bool AaptAssets::isJavaSymbol(const AaptSymbolEntry& sym, bool includePrivate) const {
2143 //printf("isJavaSymbol %s: public=%d, includePrivate=%d, isJavaSymbol=%d\n",
2144 - // sym.name.string(), sym.isPublic ? 1 : 0, includePrivate ? 1 : 0,
2145 + // sym.name.c_str(), sym.isPublic ? 1 : 0, includePrivate ? 1 : 0,
2146 // sym.isJavaSymbol ? 1 : 0);
2147 if (!mHavePrivateSymbols) return true;
2148 if (sym.isPublic) return true;
2149 @@ -1529,12 +1529,12 @@ status_t AaptAssets::buildIncludedResources(Bundle* bundle)
2150 const size_t packageIncludeCount = includes.size();
2151 for (size_t i = 0; i < packageIncludeCount; i++) {
2152 if (bundle->getVerbose()) {
2153 - printf("Including resources from package: %s\n", includes[i].string());
2154 + printf("Including resources from package: %s\n", includes[i].c_str());
2155 }
2156
2157 if (!mIncludedAssets.addAssetPath(includes[i], NULL)) {
2158 fprintf(stderr, "ERROR: Asset package include '%s' not found.\n",
2159 - includes[i].string());
2160 + includes[i].c_str());
2161 return UNKNOWN_ERROR;
2162 }
2163 }
2164 @@ -1543,12 +1543,12 @@ status_t AaptAssets::buildIncludedResources(Bundle* bundle)
2165 if (!featureOfBase.isEmpty()) {
2166 if (bundle->getVerbose()) {
2167 printf("Including base feature resources from package: %s\n",
2168 - featureOfBase.string());
2169 + featureOfBase.c_str());
2170 }
2171
2172 if (!mIncludedAssets.addAssetPath(featureOfBase, NULL)) {
2173 fprintf(stderr, "ERROR: base feature package '%s' not found.\n",
2174 - featureOfBase.string());
2175 + featureOfBase.c_str());
2176 return UNKNOWN_ERROR;
2177 }
2178 }
2179 @@ -1581,23 +1581,23 @@ void AaptAssets::print(const String8& prefix) const
2180 innerPrefix.append(" ");
2181 String8 innerInnerPrefix(innerPrefix);
2182 innerInnerPrefix.append(" ");
2183 - printf("%sConfigurations:\n", prefix.string());
2184 + printf("%sConfigurations:\n", prefix.c_str());
2185 const size_t N=mGroupEntries.size();
2186 for (size_t i=0; i<N; i++) {
2187 String8 cname = mGroupEntries.itemAt(i).toDirName(String8());
2188 - printf("%s %s\n", prefix.string(),
2189 - cname != "" ? cname.string() : "(default)");
2190 + printf("%s %s\n", prefix.c_str(),
2191 + cname != "" ? cname.c_str() : "(default)");
2192 }
2193
2194 - printf("\n%sFiles:\n", prefix.string());
2195 + printf("\n%sFiles:\n", prefix.c_str());
2196 AaptDir::print(innerPrefix);
2197
2198 - printf("\n%sResource Dirs:\n", prefix.string());
2199 + printf("\n%sResource Dirs:\n", prefix.c_str());
2200 const Vector<sp<AaptDir> >& resdirs = mResDirs;
2201 const size_t NR = resdirs.size();
2202 for (size_t i=0; i<NR; i++) {
2203 const sp<AaptDir>& d = resdirs.itemAt(i);
2204 - printf("%s Type %s\n", prefix.string(), d->getLeaf().string());
2205 + printf("%s Type %s\n", prefix.c_str(), d->getLeaf().c_str());
2206 d->print(innerInnerPrefix);
2207 }
2208 }
2209 @@ -1631,7 +1631,7 @@ valid_symbol_name(const String8& symbol)
2210 NULL
2211 };
2212 const char*const* k = KEYWORDS;
2213 - const char*const s = symbol.string();
2214 + const char*const s = symbol.c_str();
2215 while (*k) {
2216 if (0 == strcmp(s, *k)) {
2217 return false;
2218 diff --git a/tools/aapt/AaptAssets.h b/tools/aapt/AaptAssets.h
2219 index eadd48a6c261..498fc4e38c8c 100644
2220 --- a/tools/aapt/AaptAssets.h
2221 +++ b/tools/aapt/AaptAssets.h
2222 @@ -463,7 +463,7 @@ private:
2223 if (valid_symbol_name(symbol)) {
2224 return true;
2225 }
2226 - pos.error("invalid %s: '%s'\n", label, symbol.string());
2227 + pos.error("invalid %s: '%s'\n", label, symbol.c_str());
2228 return false;
2229 }
2230 AaptSymbolEntry& edit_symbol(const String8& symbol, const SourcePos* pos) {
2231 diff --git a/tools/aapt/AaptConfig.cpp b/tools/aapt/AaptConfig.cpp
2232 index 0aca45ea8d60..7578f79f792e 100644
2233 --- a/tools/aapt/AaptConfig.cpp
2234 +++ b/tools/aapt/AaptConfig.cpp
2235 @@ -39,7 +39,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2236 ssize_t index = 0;
2237 ssize_t localeIndex = 0;
2238 const ssize_t N = parts.size();
2239 - const char* part = parts[index].string();
2240 + const char* part = parts[index].c_str();
2241
2242 if (str.length() == 0) {
2243 goto success;
2244 @@ -50,7 +50,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2245 if (index == N) {
2246 goto success;
2247 }
2248 - part = parts[index].string();
2249 + part = parts[index].c_str();
2250 }
2251
2252 if (parseMnc(part, &config)) {
2253 @@ -58,7 +58,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2254 if (index == N) {
2255 goto success;
2256 }
2257 - part = parts[index].string();
2258 + part = parts[index].c_str();
2259 }
2260
2261 // Locale spans a few '-' separators, so we let it
2262 @@ -72,7 +72,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2263 if (index >= N) {
2264 goto success;
2265 }
2266 - part = parts[index].string();
2267 + part = parts[index].c_str();
2268 }
2269
2270 if (parseLayoutDirection(part, &config)) {
2271 @@ -80,7 +80,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2272 if (index == N) {
2273 goto success;
2274 }
2275 - part = parts[index].string();
2276 + part = parts[index].c_str();
2277 }
2278
2279 if (parseSmallestScreenWidthDp(part, &config)) {
2280 @@ -88,7 +88,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2281 if (index == N) {
2282 goto success;
2283 }
2284 - part = parts[index].string();
2285 + part = parts[index].c_str();
2286 }
2287
2288 if (parseScreenWidthDp(part, &config)) {
2289 @@ -96,7 +96,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2290 if (index == N) {
2291 goto success;
2292 }
2293 - part = parts[index].string();
2294 + part = parts[index].c_str();
2295 }
2296
2297 if (parseScreenHeightDp(part, &config)) {
2298 @@ -104,7 +104,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2299 if (index == N) {
2300 goto success;
2301 }
2302 - part = parts[index].string();
2303 + part = parts[index].c_str();
2304 }
2305
2306 if (parseScreenLayoutSize(part, &config)) {
2307 @@ -112,7 +112,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2308 if (index == N) {
2309 goto success;
2310 }
2311 - part = parts[index].string();
2312 + part = parts[index].c_str();
2313 }
2314
2315 if (parseScreenLayoutLong(part, &config)) {
2316 @@ -120,7 +120,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2317 if (index == N) {
2318 goto success;
2319 }
2320 - part = parts[index].string();
2321 + part = parts[index].c_str();
2322 }
2323
2324 if (parseScreenRound(part, &config)) {
2325 @@ -128,7 +128,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2326 if (index == N) {
2327 goto success;
2328 }
2329 - part = parts[index].string();
2330 + part = parts[index].c_str();
2331 }
2332
2333 if (parseWideColorGamut(part, &config)) {
2334 @@ -136,7 +136,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2335 if (index == N) {
2336 goto success;
2337 }
2338 - part = parts[index].string();
2339 + part = parts[index].c_str();
2340 }
2341
2342 if (parseHdr(part, &config)) {
2343 @@ -144,7 +144,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2344 if (index == N) {
2345 goto success;
2346 }
2347 - part = parts[index].string();
2348 + part = parts[index].c_str();
2349 }
2350
2351 if (parseOrientation(part, &config)) {
2352 @@ -152,7 +152,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2353 if (index == N) {
2354 goto success;
2355 }
2356 - part = parts[index].string();
2357 + part = parts[index].c_str();
2358 }
2359
2360 if (parseUiModeType(part, &config)) {
2361 @@ -160,7 +160,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2362 if (index == N) {
2363 goto success;
2364 }
2365 - part = parts[index].string();
2366 + part = parts[index].c_str();
2367 }
2368
2369 if (parseUiModeNight(part, &config)) {
2370 @@ -168,7 +168,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2371 if (index == N) {
2372 goto success;
2373 }
2374 - part = parts[index].string();
2375 + part = parts[index].c_str();
2376 }
2377
2378 if (parseDensity(part, &config)) {
2379 @@ -176,7 +176,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2380 if (index == N) {
2381 goto success;
2382 }
2383 - part = parts[index].string();
2384 + part = parts[index].c_str();
2385 }
2386
2387 if (parseTouchscreen(part, &config)) {
2388 @@ -184,7 +184,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2389 if (index == N) {
2390 goto success;
2391 }
2392 - part = parts[index].string();
2393 + part = parts[index].c_str();
2394 }
2395
2396 if (parseKeysHidden(part, &config)) {
2397 @@ -192,7 +192,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2398 if (index == N) {
2399 goto success;
2400 }
2401 - part = parts[index].string();
2402 + part = parts[index].c_str();
2403 }
2404
2405 if (parseKeyboard(part, &config)) {
2406 @@ -200,7 +200,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2407 if (index == N) {
2408 goto success;
2409 }
2410 - part = parts[index].string();
2411 + part = parts[index].c_str();
2412 }
2413
2414 if (parseNavHidden(part, &config)) {
2415 @@ -208,7 +208,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2416 if (index == N) {
2417 goto success;
2418 }
2419 - part = parts[index].string();
2420 + part = parts[index].c_str();
2421 }
2422
2423 if (parseNavigation(part, &config)) {
2424 @@ -216,7 +216,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2425 if (index == N) {
2426 goto success;
2427 }
2428 - part = parts[index].string();
2429 + part = parts[index].c_str();
2430 }
2431
2432 if (parseScreenSize(part, &config)) {
2433 @@ -224,7 +224,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2434 if (index == N) {
2435 goto success;
2436 }
2437 - part = parts[index].string();
2438 + part = parts[index].c_str();
2439 }
2440
2441 if (parseVersion(part, &config)) {
2442 @@ -232,7 +232,7 @@ bool parse(const String8& str, ConfigDescription* out) {
2443 if (index == N) {
2444 goto success;
2445 }
2446 - part = parts[index].string();
2447 + part = parts[index].c_str();
2448 }
2449
2450 // Unrecognized.
2451 @@ -773,8 +773,8 @@ bool parseScreenSize(const char* name, ResTable_config* out) {
2452 if (y == name || *y != 0) return false;
2453 String8 yName(x, y-x);
2454
2455 - uint16_t w = (uint16_t)atoi(xName.string());
2456 - uint16_t h = (uint16_t)atoi(yName.string());
2457 + uint16_t w = (uint16_t)atoi(xName.c_str());
2458 + uint16_t h = (uint16_t)atoi(yName.c_str());
2459 if (w < h) {
2460 return false;
2461 }
2462 @@ -805,7 +805,7 @@ bool parseSmallestScreenWidthDp(const char* name, ResTable_config* out) {
2463 String8 xName(name, x-name);
2464
2465 if (out) {
2466 - out->smallestScreenWidthDp = (uint16_t)atoi(xName.string());
2467 + out->smallestScreenWidthDp = (uint16_t)atoi(xName.c_str());
2468 }
2469
2470 return true;
2471 @@ -827,7 +827,7 @@ bool parseScreenWidthDp(const char* name, ResTable_config* out) {
2472 String8 xName(name, x-name);
2473
2474 if (out) {
2475 - out->screenWidthDp = (uint16_t)atoi(xName.string());
2476 + out->screenWidthDp = (uint16_t)atoi(xName.c_str());
2477 }
2478
2479 return true;
2480 @@ -849,7 +849,7 @@ bool parseScreenHeightDp(const char* name, ResTable_config* out) {
2481 String8 xName(name, x-name);
2482
2483 if (out) {
2484 - out->screenHeightDp = (uint16_t)atoi(xName.string());
2485 + out->screenHeightDp = (uint16_t)atoi(xName.c_str());
2486 }
2487
2488 return true;
2489 @@ -875,7 +875,7 @@ bool parseVersion(const char* name, ResTable_config* out) {
2490 String8 sdkName(name, s-name);
2491
2492 if (out) {
2493 - out->sdkVersion = (uint16_t)atoi(sdkName.string());
2494 + out->sdkVersion = (uint16_t)atoi(sdkName.c_str());
2495 out->minorVersion = 0;
2496 }
2497
2498 diff --git a/tools/aapt/AaptUtil.cpp b/tools/aapt/AaptUtil.cpp
2499 index 293e144b71fe..e82860de578a 100644
2500 --- a/tools/aapt/AaptUtil.cpp
2501 +++ b/tools/aapt/AaptUtil.cpp
2502 @@ -23,7 +23,7 @@ namespace AaptUtil {
2503
2504 Vector<String8> split(const String8& str, const char sep) {
2505 Vector<String8> parts;
2506 - const char* p = str.string();
2507 + const char* p = str.c_str();
2508 const char* q;
2509
2510 while (true) {
2511 @@ -41,7 +41,7 @@ Vector<String8> split(const String8& str, const char sep) {
2512
2513 Vector<String8> splitAndLowerCase(const String8& str, const char sep) {
2514 Vector<String8> parts;
2515 - const char* p = str.string();
2516 + const char* p = str.c_str();
2517 const char* q;
2518
2519 while (true) {
2520 diff --git a/tools/aapt/ApkBuilder.cpp b/tools/aapt/ApkBuilder.cpp
2521 index 01e02e270b63..335c43b96599 100644
2522 --- a/tools/aapt/ApkBuilder.cpp
2523 +++ b/tools/aapt/ApkBuilder.cpp
2524 @@ -36,7 +36,7 @@ status_t ApkBuilder::createSplitForConfigs(const std::set<ConfigDescription>& co
2525 if (splitConfigs.count(*iter) > 0) {
2526 // Can't have overlapping configurations.
2527 fprintf(stderr, "ERROR: Split configuration '%s' is already defined "
2528 - "in another split.\n", iter->toString().string());
2529 + "in another split.\n", iter->toString().c_str());
2530 return ALREADY_EXISTS;
2531 }
2532 }
2533 @@ -115,10 +115,10 @@ status_t ApkSplit::addEntry(const String8& path, const sp<AaptFile>& file) {
2534 }
2535
2536 void ApkSplit::print() const {
2537 - fprintf(stderr, "APK Split '%s'\n", mName.string());
2538 + fprintf(stderr, "APK Split '%s'\n", mName.c_str());
2539
2540 std::set<OutputEntry>::const_iterator iter = mFiles.begin();
2541 for (; iter != mFiles.end(); iter++) {
2542 - fprintf(stderr, " %s (%s)\n", iter->getPath().string(), iter->getFile()->getSourceFile().string());
2543 + fprintf(stderr, " %s (%s)\n", iter->getPath().c_str(), iter->getFile()->getSourceFile().c_str());
2544 }
2545 }
2546 diff --git a/tools/aapt/CacheUpdater.h b/tools/aapt/CacheUpdater.h
2547 index 6fa96d67e6a3..2dc143c6a66d 100644
2548 --- a/tools/aapt/CacheUpdater.h
2549 +++ b/tools/aapt/CacheUpdater.h
2550 @@ -66,7 +66,7 @@ public:
2551 // Check optomistically to see if all directories exist.
2552 // If something in the path doesn't exist, then walk the path backwards
2553 // and find the place to start creating directories forward.
2554 - if (stat(path.string(),&s) == -1) {
2555 + if (stat(path.c_str(),&s) == -1) {
2556 // Walk backwards to find place to start creating directories
2557 existsPath = path;
2558 do {
2559 @@ -74,7 +74,7 @@ public:
2560 // the string of paths to create.
2561 toCreate = existsPath.getPathLeaf().appendPath(toCreate);
2562 existsPath = existsPath.getPathDir();
2563 - } while (stat(existsPath.string(),&s) == -1);
2564 + } while (stat(existsPath.c_str(),&s) == -1);
2565
2566 // Walk forwards and build directories as we go
2567 do {
2568 @@ -82,9 +82,9 @@ public:
2569 existsPath.appendPath(toCreate.walkPath(&remains));
2570 toCreate = remains;
2571 #ifdef _WIN32
2572 - _mkdir(existsPath.string());
2573 + _mkdir(existsPath.c_str());
2574 #else
2575 - mkdir(existsPath.string(), S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP);
2576 + mkdir(existsPath.c_str(), S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP);
2577 #endif
2578 } while (remains.length() > 0);
2579 } //if
2580 @@ -93,8 +93,8 @@ public:
2581 // Delete a file
2582 virtual void deleteFile(String8 path)
2583 {
2584 - if (remove(path.string()) != 0)
2585 - fprintf(stderr,"ERROR DELETING %s\n",path.string());
2586 + if (remove(path.c_str()) != 0)
2587 + fprintf(stderr,"ERROR DELETING %s\n",path.c_str());
2588 };
2589
2590 // Process an image from source out to dest
2591 diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
2592 index 51cf38bce64e..5a06b102592a 100644
2593 --- a/tools/aapt/Command.cpp
2594 +++ b/tools/aapt/Command.cpp
2595 @@ -240,13 +240,13 @@ static void printResolvedResourceAttribute(const ResTable& resTable, const ResXM
2596 }
2597 if (value.dataType == Res_value::TYPE_STRING) {
2598 String8 result = AaptXml::getResolvedAttribute(resTable, tree, attrRes, outError);
2599 - printf("%s='%s'", attrLabel.string(),
2600 - ResTable::normalizeForOutput(result.string()).string());
2601 + printf("%s='%s'", attrLabel.c_str(),
2602 + ResTable::normalizeForOutput(result.c_str()).c_str());
2603 } else if (Res_value::TYPE_FIRST_INT <= value.dataType &&
2604 value.dataType <= Res_value::TYPE_LAST_INT) {
2605 - printf("%s='%d'", attrLabel.string(), value.data);
2606 + printf("%s='%d'", attrLabel.c_str(), value.data);
2607 } else {
2608 - printf("%s='0x%x'", attrLabel.string(), (int)value.data);
2609 + printf("%s='0x%x'", attrLabel.c_str(), (int)value.data);
2610 }
2611 }
2612
2613 @@ -355,21 +355,21 @@ static void printCompatibleScreens(ResXMLTree& tree, String8* outError) {
2614 static void printUsesPermission(const String8& name, bool optional=false, int maxSdkVersion=-1,
2615 const String8& requiredFeature = String8::empty(),
2616 const String8& requiredNotFeature = String8::empty()) {
2617 - printf("uses-permission: name='%s'", ResTable::normalizeForOutput(name.string()).string());
2618 + printf("uses-permission: name='%s'", ResTable::normalizeForOutput(name.c_str()).c_str());
2619 if (maxSdkVersion != -1) {
2620 printf(" maxSdkVersion='%d'", maxSdkVersion);
2621 }
2622 if (requiredFeature.length() > 0) {
2623 - printf(" requiredFeature='%s'", requiredFeature.string());
2624 + printf(" requiredFeature='%s'", requiredFeature.c_str());
2625 }
2626 if (requiredNotFeature.length() > 0) {
2627 - printf(" requiredNotFeature='%s'", requiredNotFeature.string());
2628 + printf(" requiredNotFeature='%s'", requiredNotFeature.c_str());
2629 }
2630 printf("\n");
2631
2632 if (optional) {
2633 printf("optional-permission: name='%s'",
2634 - ResTable::normalizeForOutput(name.string()).string());
2635 + ResTable::normalizeForOutput(name.c_str()).c_str());
2636 if (maxSdkVersion != -1) {
2637 printf(" maxSdkVersion='%d'", maxSdkVersion);
2638 }
2639 @@ -380,7 +380,7 @@ static void printUsesPermission(const String8& name, bool optional=false, int ma
2640 static void printUsesPermissionSdk23(const String8& name, int maxSdkVersion=-1) {
2641 printf("uses-permission-sdk-23: ");
2642
2643 - printf("name='%s'", ResTable::normalizeForOutput(name.string()).string());
2644 + printf("name='%s'", ResTable::normalizeForOutput(name.c_str()).c_str());
2645 if (maxSdkVersion != -1) {
2646 printf(" maxSdkVersion='%d'", maxSdkVersion);
2647 }
2648 @@ -390,11 +390,11 @@ static void printUsesPermissionSdk23(const String8& name, int maxSdkVersion=-1)
2649 static void printUsesImpliedPermission(const String8& name, const String8& reason,
2650 const int32_t maxSdkVersion = -1) {
2651 printf("uses-implied-permission: name='%s'",
2652 - ResTable::normalizeForOutput(name.string()).string());
2653 + ResTable::normalizeForOutput(name.c_str()).c_str());
2654 if (maxSdkVersion != -1) {
2655 printf(" maxSdkVersion='%d'", maxSdkVersion);
2656 }
2657 - printf(" reason='%s'\n", ResTable::normalizeForOutput(reason.string()).string());
2658 + printf(" reason='%s'\n", ResTable::normalizeForOutput(reason.c_str()).c_str());
2659 }
2660
2661 Vector<String8> getNfcAidCategories(AssetManager& assets, const String8& xmlPath, bool offHost,
2662 @@ -556,7 +556,7 @@ static void addImpliedFeature(KeyedVector<String8, ImpliedFeature>* impliedFeatu
2663
2664 static void printFeatureGroupImpl(const FeatureGroup& grp,
2665 const KeyedVector<String8, ImpliedFeature>* impliedFeatures) {
2666 - printf("feature-group: label='%s'\n", grp.label.string());
2667 + printf("feature-group: label='%s'\n", grp.label.c_str());
2668
2669 if (grp.openGLESVersion > 0) {
2670 printf(" uses-gl-es: '0x%x'\n", grp.openGLESVersion);
2671 @@ -570,7 +570,7 @@ static void printFeatureGroupImpl(const FeatureGroup& grp,
2672
2673 const String8& featureName = grp.features.keyAt(i);
2674 printf(" uses-feature%s: name='%s'", (required ? "" : "-not-required"),
2675 - ResTable::normalizeForOutput(featureName.string()).string());
2676 + ResTable::normalizeForOutput(featureName.c_str()).c_str());
2677
2678 if (version > 0) {
2679 printf(" version='%d'", version);
2680 @@ -589,15 +589,15 @@ static void printFeatureGroupImpl(const FeatureGroup& grp,
2681 }
2682
2683 String8 printableFeatureName(ResTable::normalizeForOutput(
2684 - impliedFeature.name.string()));
2685 + impliedFeature.name.c_str()));
2686 const char* sdk23Suffix = impliedFeature.impliedBySdk23 ? "-sdk-23" : "";
2687
2688 - printf(" uses-feature%s: name='%s'\n", sdk23Suffix, printableFeatureName.string());
2689 + printf(" uses-feature%s: name='%s'\n", sdk23Suffix, printableFeatureName.c_str());
2690 printf(" uses-implied-feature%s: name='%s' reason='", sdk23Suffix,
2691 - printableFeatureName.string());
2692 + printableFeatureName.c_str());
2693 const size_t numReasons = impliedFeature.reasons.size();
2694 for (size_t j = 0; j < numReasons; j++) {
2695 - printf("%s", impliedFeature.reasons[j].string());
2696 + printf("%s", impliedFeature.reasons[j].c_str());
2697 if (j + 2 < numReasons) {
2698 printf(", ");
2699 } else if (j + 1 < numReasons) {
2700 @@ -649,43 +649,43 @@ static void addImpliedFeaturesForPermission(const int targetSdk, const String8&
2701 bool impliedBySdk23Permission) {
2702 if (name == "android.permission.CAMERA") {
2703 addImpliedFeature(impliedFeatures, "android.hardware.camera",
2704 - String8::format("requested %s permission", name.string()),
2705 + String8::format("requested %s permission", name.c_str()),
2706 impliedBySdk23Permission);
2707 } else if (name == "android.permission.ACCESS_FINE_LOCATION") {
2708 if (targetSdk < SDK_LOLLIPOP) {
2709 addImpliedFeature(impliedFeatures, "android.hardware.location.gps",
2710 - String8::format("requested %s permission", name.string()),
2711 + String8::format("requested %s permission", name.c_str()),
2712 impliedBySdk23Permission);
2713 addImpliedFeature(impliedFeatures, "android.hardware.location.gps",
2714 String8::format("targetSdkVersion < %d", SDK_LOLLIPOP),
2715 impliedBySdk23Permission);
2716 }
2717 addImpliedFeature(impliedFeatures, "android.hardware.location",
2718 - String8::format("requested %s permission", name.string()),
2719 + String8::format("requested %s permission", name.c_str()),
2720 impliedBySdk23Permission);
2721 } else if (name == "android.permission.ACCESS_COARSE_LOCATION") {
2722 if (targetSdk < SDK_LOLLIPOP) {
2723 addImpliedFeature(impliedFeatures, "android.hardware.location.network",
2724 - String8::format("requested %s permission", name.string()),
2725 + String8::format("requested %s permission", name.c_str()),
2726 impliedBySdk23Permission);
2727 addImpliedFeature(impliedFeatures, "android.hardware.location.network",
2728 String8::format("targetSdkVersion < %d", SDK_LOLLIPOP),
2729 impliedBySdk23Permission);
2730 }
2731 addImpliedFeature(impliedFeatures, "android.hardware.location",
2732 - String8::format("requested %s permission", name.string()),
2733 + String8::format("requested %s permission", name.c_str()),
2734 impliedBySdk23Permission);
2735 } else if (name == "android.permission.ACCESS_MOCK_LOCATION" ||
2736 name == "android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" ||
2737 name == "android.permission.INSTALL_LOCATION_PROVIDER") {
2738 addImpliedFeature(impliedFeatures, "android.hardware.location",
2739 - String8::format("requested %s permission", name.string()),
2740 + String8::format("requested %s permission", name.c_str()),
2741 impliedBySdk23Permission);
2742 } else if (name == "android.permission.BLUETOOTH" ||
2743 name == "android.permission.BLUETOOTH_ADMIN") {
2744 if (targetSdk > SDK_DONUT) {
2745 addImpliedFeature(impliedFeatures, "android.hardware.bluetooth",
2746 - String8::format("requested %s permission", name.string()),
2747 + String8::format("requested %s permission", name.c_str()),
2748 impliedBySdk23Permission);
2749 addImpliedFeature(impliedFeatures, "android.hardware.bluetooth",
2750 String8::format("targetSdkVersion > %d", SDK_DONUT),
2751 @@ -693,13 +693,13 @@ static void addImpliedFeaturesForPermission(const int targetSdk, const String8&
2752 }
2753 } else if (name == "android.permission.RECORD_AUDIO") {
2754 addImpliedFeature(impliedFeatures, "android.hardware.microphone",
2755 - String8::format("requested %s permission", name.string()),
2756 + String8::format("requested %s permission", name.c_str()),
2757 impliedBySdk23Permission);
2758 } else if (name == "android.permission.ACCESS_WIFI_STATE" ||
2759 name == "android.permission.CHANGE_WIFI_STATE" ||
2760 name == "android.permission.CHANGE_WIFI_MULTICAST_STATE") {
2761 addImpliedFeature(impliedFeatures, "android.hardware.wifi",
2762 - String8::format("requested %s permission", name.string()),
2763 + String8::format("requested %s permission", name.c_str()),
2764 impliedBySdk23Permission);
2765 } else if (name == "android.permission.CALL_PHONE" ||
2766 name == "android.permission.CALL_PRIVILEGED" ||
2767 @@ -746,7 +746,7 @@ int doDump(Bundle* bundle)
2768 for (size_t i = 0; i < bundle->getPackageIncludes().size(); i++) {
2769 const String8& assetPath = bundle->getPackageIncludes()[i];
2770 if (!assets.addAssetPath(assetPath, NULL)) {
2771 - fprintf(stderr, "ERROR: included asset path %s could not be loaded\n", assetPath.string());
2772 + fprintf(stderr, "ERROR: included asset path %s could not be loaded\n", assetPath.c_str());
2773 return 1;
2774 }
2775 }
2776 @@ -890,7 +890,7 @@ int doDump(Bundle* bundle)
2777 goto bail;
2778 }
2779 String8 tag(ctag16);
2780 - //printf("Depth %d tag %s\n", depth, tag.string());
2781 + //printf("Depth %d tag %s\n", depth, tag.c_str());
2782 if (depth == 1) {
2783 if (tag != "manifest") {
2784 SourcePos(manifestFile, tree.getLineNumber()).error(
2785 @@ -898,14 +898,14 @@ int doDump(Bundle* bundle)
2786 goto bail;
2787 }
2788 String8 pkg = AaptXml::getAttribute(tree, NULL, "package", NULL);
2789 - printf("package: %s\n", ResTable::normalizeForOutput(pkg.string()).string());
2790 + printf("package: %s\n", ResTable::normalizeForOutput(pkg.c_str()).c_str());
2791 } else if (depth == 2) {
2792 if (tag == "permission") {
2793 String8 error;
2794 String8 name = AaptXml::getAttribute(tree, NAME_ATTR, &error);
2795 if (error != "") {
2796 SourcePos(manifestFile, tree.getLineNumber()).error(
2797 - "ERROR getting 'android:name': %s", error.string());
2798 + "ERROR getting 'android:name': %s", error.c_str());
2799 goto bail;
2800 }
2801
2802 @@ -915,13 +915,13 @@ int doDump(Bundle* bundle)
2803 goto bail;
2804 }
2805 printf("permission: %s\n",
2806 - ResTable::normalizeForOutput(name.string()).string());
2807 + ResTable::normalizeForOutput(name.c_str()).c_str());
2808 } else if (tag == "uses-permission") {
2809 String8 error;
2810 String8 name = AaptXml::getAttribute(tree, NAME_ATTR, &error);
2811 if (error != "") {
2812 SourcePos(manifestFile, tree.getLineNumber()).error(
2813 - "ERROR getting 'android:name' attribute: %s", error.string());
2814 + "ERROR getting 'android:name' attribute: %s", error.c_str());
2815 goto bail;
2816 }
2817
2818 @@ -938,7 +938,7 @@ int doDump(Bundle* bundle)
2819 String8 name = AaptXml::getAttribute(tree, NAME_ATTR, &error);
2820 if (error != "") {
2821 SourcePos(manifestFile, tree.getLineNumber()).error(
2822 - "ERROR getting 'android:name' attribute: %s", error.string());
2823 + "ERROR getting 'android:name' attribute: %s", error.c_str());
2824 goto bail;
2825 }
2826
2827 @@ -1138,7 +1138,7 @@ int doDump(Bundle* bundle)
2828 const size_t N = supportedInput.size();
2829 for (size_t i=0; i<N; i++) {
2830 printf("%s", ResTable::normalizeForOutput(
2831 - supportedInput[i].string()).string());
2832 + supportedInput[i].c_str()).c_str());
2833 if (i != N - 1) {
2834 printf("' '");
2835 } else {
2836 @@ -1157,27 +1157,27 @@ int doDump(Bundle* bundle)
2837 printf("launchable-activity:");
2838 if (aName.length() > 0) {
2839 printf(" name='%s' ",
2840 - ResTable::normalizeForOutput(aName.string()).string());
2841 + ResTable::normalizeForOutput(aName.c_str()).c_str());
2842 }
2843 printf(" label='%s' icon='%s'\n",
2844 - ResTable::normalizeForOutput(activityLabel.string())
2845 - .string(),
2846 - ResTable::normalizeForOutput(activityIcon.string())
2847 - .string());
2848 + ResTable::normalizeForOutput(activityLabel.c_str())
2849 + .c_str(),
2850 + ResTable::normalizeForOutput(activityIcon.c_str())
2851 + .c_str());
2852 }
2853 if (isLeanbackLauncherActivity) {
2854 printf("leanback-launchable-activity:");
2855 if (aName.length() > 0) {
2856 printf(" name='%s' ",
2857 - ResTable::normalizeForOutput(aName.string()).string());
2858 + ResTable::normalizeForOutput(aName.c_str()).c_str());
2859 }
2860 printf(" label='%s' icon='%s' banner='%s'\n",
2861 - ResTable::normalizeForOutput(activityLabel.string())
2862 - .string(),
2863 - ResTable::normalizeForOutput(activityIcon.string())
2864 - .string(),
2865 - ResTable::normalizeForOutput(activityBanner.string())
2866 - .string());
2867 + ResTable::normalizeForOutput(activityLabel.c_str())
2868 + .c_str(),
2869 + ResTable::normalizeForOutput(activityIcon.c_str())
2870 + .c_str(),
2871 + ResTable::normalizeForOutput(activityBanner.c_str())
2872 + .c_str());
2873 }
2874 }
2875 if (!hasIntentFilter) {
2876 @@ -1265,7 +1265,7 @@ int doDump(Bundle* bundle)
2877 goto bail;
2878 }
2879 String8 tag(ctag16);
2880 - //printf("Depth %d, %s\n", depth, tag.string());
2881 + //printf("Depth %d, %s\n", depth, tag.c_str());
2882 if (depth == 1) {
2883 if (tag != "manifest") {
2884 SourcePos(manifestFile, tree.getLineNumber()).error(
2885 @@ -1274,13 +1274,13 @@ int doDump(Bundle* bundle)
2886 }
2887 pkg = AaptXml::getAttribute(tree, NULL, "package", NULL);
2888 printf("package: name='%s' ",
2889 - ResTable::normalizeForOutput(pkg.string()).string());
2890 + ResTable::normalizeForOutput(pkg.c_str()).c_str());
2891 int32_t versionCode = AaptXml::getIntegerAttribute(tree, VERSION_CODE_ATTR,
2892 &error);
2893 if (error != "") {
2894 SourcePos(manifestFile, tree.getLineNumber()).error(
2895 "ERROR getting 'android:versionCode' attribute: %s",
2896 - error.string());
2897 + error.c_str());
2898 goto bail;
2899 }
2900 if (versionCode > 0) {
2901 @@ -1293,16 +1293,16 @@ int doDump(Bundle* bundle)
2902 if (error != "") {
2903 SourcePos(manifestFile, tree.getLineNumber()).error(
2904 "ERROR getting 'android:versionName' attribute: %s",
2905 - error.string());
2906 + error.c_str());
2907 goto bail;
2908 }
2909 printf("versionName='%s'",
2910 - ResTable::normalizeForOutput(versionName.string()).string());
2911 + ResTable::normalizeForOutput(versionName.c_str()).c_str());
2912
2913 String8 splitName = AaptXml::getAttribute(tree, NULL, "split");
2914 if (!splitName.isEmpty()) {
2915 printf(" split='%s'", ResTable::normalizeForOutput(
2916 - splitName.string()).string());
2917 + splitName.c_str()).c_str());
2918 }
2919
2920 // For 'platformBuildVersionName', using both string and int type as a fallback
2921 @@ -1313,7 +1313,7 @@ int doDump(Bundle* bundle)
2922 AaptXml::getIntegerAttribute(tree, NULL, "platformBuildVersionName", 0,
2923 NULL);
2924 if (platformBuildVersionName != "") {
2925 - printf(" platformBuildVersionName='%s'", platformBuildVersionName.string());
2926 + printf(" platformBuildVersionName='%s'", platformBuildVersionName.c_str());
2927 } else if (platformBuildVersionNameInt > 0) {
2928 printf(" platformBuildVersionName='%d'", platformBuildVersionNameInt);
2929 }
2930 @@ -1326,7 +1326,7 @@ int doDump(Bundle* bundle)
2931 AaptXml::getIntegerAttribute(tree, NULL, "platformBuildVersionCode", 0,
2932 NULL);
2933 if (platformBuildVersionCode != "") {
2934 - printf(" platformBuildVersionCode='%s'", platformBuildVersionCode.string());
2935 + printf(" platformBuildVersionCode='%s'", platformBuildVersionCode.c_str());
2936 } else if (platformBuildVersionCodeInt > 0) {
2937 printf(" platformBuildVersionCode='%d'", platformBuildVersionCodeInt);
2938 }
2939 @@ -1336,7 +1336,7 @@ int doDump(Bundle* bundle)
2940 if (error != "") {
2941 SourcePos(manifestFile, tree.getLineNumber()).error(
2942 "ERROR getting 'android:compileSdkVersion' attribute: %s",
2943 - error.string());
2944 + error.c_str());
2945 goto bail;
2946 }
2947 if (compileSdkVersion > 0) {
2948 @@ -1347,7 +1347,7 @@ int doDump(Bundle* bundle)
2949 COMPILE_SDK_VERSION_CODENAME_ATTR, &error);
2950 if (compileSdkVersionCodename != "") {
2951 printf(" compileSdkVersionCodename='%s'", ResTable::normalizeForOutput(
2952 - compileSdkVersionCodename.string()).string());
2953 + compileSdkVersionCodename.c_str()).c_str());
2954 }
2955
2956 printf("\n");
2957 @@ -1357,7 +1357,7 @@ int doDump(Bundle* bundle)
2958 if (error != "") {
2959 SourcePos(manifestFile, tree.getLineNumber()).error(
2960 "ERROR getting 'android:installLocation' attribute: %s",
2961 - error.string());
2962 + error.c_str());
2963 goto bail;
2964 }
2965
2966 @@ -1387,7 +1387,7 @@ int doDump(Bundle* bundle)
2967 String8 label;
2968 const size_t NL = locales.size();
2969 for (size_t i=0; i<NL; i++) {
2970 - const char* localeStr = locales[i].string();
2971 + const char* localeStr = locales[i].c_str();
2972 assets.setConfiguration(config, localeStr != NULL ? localeStr : "");
2973 String8 llabel = AaptXml::getResolvedAttribute(res, tree, LABEL_ATTR,
2974 &error);
2975 @@ -1395,13 +1395,13 @@ int doDump(Bundle* bundle)
2976 if (localeStr == NULL || strlen(localeStr) == 0) {
2977 label = llabel;
2978 printf("application-label:'%s'\n",
2979 - ResTable::normalizeForOutput(llabel.string()).string());
2980 + ResTable::normalizeForOutput(llabel.c_str()).c_str());
2981 } else {
2982 if (label == "") {
2983 label = llabel;
2984 }
2985 printf("application-label-%s:'%s'\n", localeStr,
2986 - ResTable::normalizeForOutput(llabel.string()).string());
2987 + ResTable::normalizeForOutput(llabel.c_str()).c_str());
2988 }
2989 }
2990 }
2991 @@ -1415,7 +1415,7 @@ int doDump(Bundle* bundle)
2992 &error);
2993 if (icon != "") {
2994 printf("application-icon-%d:'%s'\n", densities[i],
2995 - ResTable::normalizeForOutput(icon.string()).string());
2996 + ResTable::normalizeForOutput(icon.c_str()).c_str());
2997 }
2998 }
2999 assets.setConfiguration(config);
3000 @@ -1423,7 +1423,7 @@ int doDump(Bundle* bundle)
3001 String8 icon = AaptXml::getResolvedAttribute(res, tree, ICON_ATTR, &error);
3002 if (error != "") {
3003 SourcePos(manifestFile, tree.getLineNumber()).error(
3004 - "ERROR getting 'android:icon' attribute: %s", error.string());
3005 + "ERROR getting 'android:icon' attribute: %s", error.c_str());
3006 goto bail;
3007 }
3008 int32_t testOnly = AaptXml::getIntegerAttribute(tree, TEST_ONLY_ATTR, 0,
3009 @@ -1431,7 +1431,7 @@ int doDump(Bundle* bundle)
3010 if (error != "") {
3011 SourcePos(manifestFile, tree.getLineNumber()).error(
3012 "ERROR getting 'android:testOnly' attribute: %s",
3013 - error.string());
3014 + error.c_str());
3015 goto bail;
3016 }
3017
3018 @@ -1439,15 +1439,15 @@ int doDump(Bundle* bundle)
3019 &error);
3020 if (error != "") {
3021 SourcePos(manifestFile, tree.getLineNumber()).error(
3022 - "ERROR getting 'android:banner' attribute: %s", error.string());
3023 + "ERROR getting 'android:banner' attribute: %s", error.c_str());
3024 goto bail;
3025 }
3026 printf("application: label='%s' ",
3027 - ResTable::normalizeForOutput(label.string()).string());
3028 - printf("icon='%s'", ResTable::normalizeForOutput(icon.string()).string());
3029 + ResTable::normalizeForOutput(label.c_str()).c_str());
3030 + printf("icon='%s'", ResTable::normalizeForOutput(icon.c_str()).c_str());
3031 if (banner != "") {
3032 printf(" banner='%s'",
3033 - ResTable::normalizeForOutput(banner.string()).string());
3034 + ResTable::normalizeForOutput(banner.c_str()).c_str());
3035 }
3036 printf("\n");
3037 if (testOnly != 0) {
3038 @@ -1458,7 +1458,7 @@ int doDump(Bundle* bundle)
3039 ISGAME_ATTR, 0, &error);
3040 if (error != "") {
3041 SourcePos(manifestFile, tree.getLineNumber()).error(
3042 - "ERROR getting 'android:isGame' attribute: %s", error.string());
3043 + "ERROR getting 'android:isGame' attribute: %s", error.c_str());
3044 goto bail;
3045 }
3046 if (isGame != 0) {
3047 @@ -1470,7 +1470,7 @@ int doDump(Bundle* bundle)
3048 if (error != "") {
3049 SourcePos(manifestFile, tree.getLineNumber()).error(
3050 "ERROR getting 'android:debuggable' attribute: %s",
3051 - error.string());
3052 + error.c_str());
3053 goto bail;
3054 }
3055 if (debuggable != 0) {
3056 @@ -1500,12 +1500,12 @@ int doDump(Bundle* bundle)
3057 if (error != "") {
3058 SourcePos(manifestFile, tree.getLineNumber()).error(
3059 "ERROR getting 'android:minSdkVersion' attribute: %s",
3060 - error.string());
3061 + error.c_str());
3062 goto bail;
3063 }
3064 if (name == "Donut") targetSdk = SDK_DONUT;
3065 printf("sdkVersion:'%s'\n",
3066 - ResTable::normalizeForOutput(name.string()).string());
3067 + ResTable::normalizeForOutput(name.c_str()).c_str());
3068 } else if (code != -1) {
3069 targetSdk = code;
3070 printf("sdkVersion:'%d'\n", code);
3071 @@ -1522,7 +1522,7 @@ int doDump(Bundle* bundle)
3072 if (error != "") {
3073 SourcePos(manifestFile, tree.getLineNumber()).error(
3074 "ERROR getting 'android:targetSdkVersion' attribute: %s",
3075 - error.string());
3076 + error.c_str());
3077 goto bail;
3078 }
3079 if (name == "Donut" && targetSdk < SDK_DONUT) {
3080 @@ -1532,7 +1532,7 @@ int doDump(Bundle* bundle)
3081 targetSdk = SDK_CUR_DEVELOPMENT;
3082 }
3083 printf("targetSdkVersion:'%s'\n",
3084 - ResTable::normalizeForOutput(name.string()).string());
3085 + ResTable::normalizeForOutput(name.c_str()).c_str());
3086 } else if (code != -1) {
3087 if (targetSdk < code) {
3088 targetSdk = code;
3089 @@ -1592,7 +1592,7 @@ int doDump(Bundle* bundle)
3090 group.label = AaptXml::getResolvedAttribute(res, tree, LABEL_ATTR, &error);
3091 if (error != "") {
3092 SourcePos(manifestFile, tree.getLineNumber()).error(
3093 - "ERROR getting 'android:label' attribute: %s", error.string());
3094 + "ERROR getting 'android:label' attribute: %s", error.c_str());
3095 goto bail;
3096 }
3097 featureGroups.add(group);
3098 @@ -1608,7 +1608,7 @@ int doDump(Bundle* bundle)
3099 if (error != "") {
3100 SourcePos(manifestFile, tree.getLineNumber()).error(
3101 "failed to read attribute 'android:required': %s",
3102 - error.string());
3103 + error.c_str());
3104 goto bail;
3105 }
3106
3107 @@ -1617,7 +1617,7 @@ int doDump(Bundle* bundle)
3108 if (error != "") {
3109 SourcePos(manifestFile, tree.getLineNumber()).error(
3110 "failed to read attribute 'android:version': %s",
3111 - error.string());
3112 + error.c_str());
3113 goto bail;
3114 }
3115
3116 @@ -1638,7 +1638,7 @@ int doDump(Bundle* bundle)
3117 String8 name = AaptXml::getAttribute(tree, NAME_ATTR, &error);
3118 if (error != "") {
3119 SourcePos(manifestFile, tree.getLineNumber()).error(
3120 - "ERROR getting 'android:name' attribute: %s", error.string());
3121 + "ERROR getting 'android:name' attribute: %s", error.c_str());
3122 goto bail;
3123 }
3124
3125 @@ -1682,7 +1682,7 @@ int doDump(Bundle* bundle)
3126 String8 name = AaptXml::getAttribute(tree, NAME_ATTR, &error);
3127 if (error != "") {
3128 SourcePos(manifestFile, tree.getLineNumber()).error(
3129 - "ERROR getting 'android:name' attribute: %s", error.string());
3130 + "ERROR getting 'android:name' attribute: %s", error.c_str());
3131 goto bail;
3132 }
3133
3134 @@ -1701,37 +1701,37 @@ int doDump(Bundle* bundle)
3135 String8 name = AaptXml::getAttribute(tree, NAME_ATTR, &error);
3136 if (name != "" && error == "") {
3137 printf("uses-package:'%s'\n",
3138 - ResTable::normalizeForOutput(name.string()).string());
3139 + ResTable::normalizeForOutput(name.c_str()).c_str());
3140 } else {
3141 SourcePos(manifestFile, tree.getLineNumber()).error(
3142 - "ERROR getting 'android:name' attribute: %s", error.string());
3143 + "ERROR getting 'android:name' attribute: %s", error.c_str());
3144 goto bail;
3145 }
3146 } else if (tag == "original-package") {
3147 String8 name = AaptXml::getAttribute(tree, NAME_ATTR, &error);
3148 if (name != "" && error == "") {
3149 printf("original-package:'%s'\n",
3150 - ResTable::normalizeForOutput(name.string()).string());
3151 + ResTable::normalizeForOutput(name.c_str()).c_str());
3152 } else {
3153 SourcePos(manifestFile, tree.getLineNumber()).error(
3154 - "ERROR getting 'android:name' attribute: %s", error.string());
3155 + "ERROR getting 'android:name' attribute: %s", error.c_str());
3156 goto bail;
3157 }
3158 } else if (tag == "supports-gl-texture") {
3159 String8 name = AaptXml::getAttribute(tree, NAME_ATTR, &error);
3160 if (name != "" && error == "") {
3161 printf("supports-gl-texture:'%s'\n",
3162 - ResTable::normalizeForOutput(name.string()).string());
3163 + ResTable::normalizeForOutput(name.c_str()).c_str());
3164 } else {
3165 SourcePos(manifestFile, tree.getLineNumber()).error(
3166 - "ERROR getting 'android:name' attribute: %s", error.string());
3167 + "ERROR getting 'android:name' attribute: %s", error.c_str());
3168 goto bail;
3169 }
3170 } else if (tag == "compatible-screens") {
3171 printCompatibleScreens(tree, &error);
3172 if (error != "") {
3173 SourcePos(manifestFile, tree.getLineNumber()).error(
3174 - "ERROR getting compatible screens: %s", error.string());
3175 + "ERROR getting compatible screens: %s", error.c_str());
3176 goto bail;
3177 }
3178 depth--;
3179 @@ -1742,8 +1742,8 @@ int doDump(Bundle* bundle)
3180 &error);
3181 if (publicKey != "" && error == "") {
3182 printf("package-verifier: name='%s' publicKey='%s'\n",
3183 - ResTable::normalizeForOutput(name.string()).string(),
3184 - ResTable::normalizeForOutput(publicKey.string()).string());
3185 + ResTable::normalizeForOutput(name.c_str()).c_str(),
3186 + ResTable::normalizeForOutput(publicKey.c_str()).c_str());
3187 }
3188 }
3189 }
3190 @@ -1769,7 +1769,7 @@ int doDump(Bundle* bundle)
3191 if (error != "") {
3192 SourcePos(manifestFile, tree.getLineNumber()).error(
3193 "ERROR getting 'android:name' attribute: %s",
3194 - error.string());
3195 + error.c_str());
3196 goto bail;
3197 }
3198
3199 @@ -1778,7 +1778,7 @@ int doDump(Bundle* bundle)
3200 if (error != "") {
3201 SourcePos(manifestFile, tree.getLineNumber()).error(
3202 "ERROR getting 'android:label' attribute: %s",
3203 - error.string());
3204 + error.c_str());
3205 goto bail;
3206 }
3207
3208 @@ -1787,7 +1787,7 @@ int doDump(Bundle* bundle)
3209 if (error != "") {
3210 SourcePos(manifestFile, tree.getLineNumber()).error(
3211 "ERROR getting 'android:icon' attribute: %s",
3212 - error.string());
3213 + error.c_str());
3214 goto bail;
3215 }
3216
3217 @@ -1796,7 +1796,7 @@ int doDump(Bundle* bundle)
3218 if (error != "") {
3219 SourcePos(manifestFile, tree.getLineNumber()).error(
3220 "ERROR getting 'android:banner' attribute: %s",
3221 - error.string());
3222 + error.c_str());
3223 goto bail;
3224 }
3225
3226 @@ -1824,14 +1824,14 @@ int doDump(Bundle* bundle)
3227 if (error != "") {
3228 SourcePos(manifestFile, tree.getLineNumber()).error(
3229 "ERROR getting 'android:name' attribute for uses-library"
3230 - " %s", error.string());
3231 + " %s", error.c_str());
3232 goto bail;
3233 }
3234 int req = AaptXml::getIntegerAttribute(tree,
3235 REQUIRED_ATTR, 1);
3236 printf("uses-library%s:'%s'\n",
3237 req ? "" : "-not-required", ResTable::normalizeForOutput(
3238 - libraryName.string()).string());
3239 + libraryName.c_str()).c_str());
3240 } else if (tag == "receiver") {
3241 withinReceiver = true;
3242 receiverName = AaptXml::getAttribute(tree, NAME_ATTR, &error);
3243 @@ -1839,7 +1839,7 @@ int doDump(Bundle* bundle)
3244 if (error != "") {
3245 SourcePos(manifestFile, tree.getLineNumber()).error(
3246 "ERROR getting 'android:name' attribute for receiver:"
3247 - " %s", error.string());
3248 + " %s", error.c_str());
3249 goto bail;
3250 }
3251
3252 @@ -1853,7 +1853,7 @@ int doDump(Bundle* bundle)
3253 SourcePos(manifestFile, tree.getLineNumber()).error(
3254 "ERROR getting 'android:permission' attribute for"
3255 " receiver '%s': %s",
3256 - receiverName.string(), error.string());
3257 + receiverName.c_str(), error.c_str());
3258 }
3259 } else if (tag == "service") {
3260 withinService = true;
3261 @@ -1862,7 +1862,7 @@ int doDump(Bundle* bundle)
3262 if (error != "") {
3263 SourcePos(manifestFile, tree.getLineNumber()).error(
3264 "ERROR getting 'android:name' attribute for "
3265 - "service:%s", error.string());
3266 + "service:%s", error.c_str());
3267 goto bail;
3268 }
3269
3270 @@ -1887,7 +1887,7 @@ int doDump(Bundle* bundle)
3271 } else {
3272 SourcePos(manifestFile, tree.getLineNumber()).error(
3273 "ERROR getting 'android:permission' attribute for "
3274 - "service '%s': %s", serviceName.string(), error.string());
3275 + "service '%s': %s", serviceName.c_str(), error.c_str());
3276 }
3277 } else if (tag == "provider") {
3278 withinProvider = true;
3279 @@ -1897,7 +1897,7 @@ int doDump(Bundle* bundle)
3280 if (error != "") {
3281 SourcePos(manifestFile, tree.getLineNumber()).error(
3282 "ERROR getting 'android:exported' attribute for provider:"
3283 - " %s", error.string());
3284 + " %s", error.c_str());
3285 goto bail;
3286 }
3287
3288 @@ -1906,7 +1906,7 @@ int doDump(Bundle* bundle)
3289 if (error != "") {
3290 SourcePos(manifestFile, tree.getLineNumber()).error(
3291 "ERROR getting 'android:grantUriPermissions' attribute for "
3292 - "provider: %s", error.string());
3293 + "provider: %s", error.c_str());
3294 goto bail;
3295 }
3296
3297 @@ -1915,7 +1915,7 @@ int doDump(Bundle* bundle)
3298 if (error != "") {
3299 SourcePos(manifestFile, tree.getLineNumber()).error(
3300 "ERROR getting 'android:permission' attribute for "
3301 - "provider: %s", error.string());
3302 + "provider: %s", error.c_str());
3303 goto bail;
3304 }
3305
3306 @@ -1928,11 +1928,11 @@ int doDump(Bundle* bundle)
3307 if (error != "") {
3308 SourcePos(manifestFile, tree.getLineNumber()).error(
3309 "ERROR getting 'android:name' attribute for "
3310 - "meta-data: %s", error.string());
3311 + "meta-data: %s", error.c_str());
3312 goto bail;
3313 }
3314 printf("meta-data: name='%s' ",
3315 - ResTable::normalizeForOutput(metaDataName.string()).string());
3316 + ResTable::normalizeForOutput(metaDataName.c_str()).c_str());
3317 printResolvedResourceAttribute(res, tree, VALUE_ATTR, String8("value"),
3318 &error);
3319 if (error != "") {
3320 @@ -1944,7 +1944,7 @@ int doDump(Bundle* bundle)
3321 SourcePos(manifestFile, tree.getLineNumber()).error(
3322 "ERROR getting 'android:value' or "
3323 "'android:resource' attribute for "
3324 - "meta-data: %s", error.string());
3325 + "meta-data: %s", error.c_str());
3326 goto bail;
3327 }
3328 }
3329 @@ -1956,7 +1956,7 @@ int doDump(Bundle* bundle)
3330 } else {
3331 SourcePos(manifestFile, tree.getLineNumber()).error(
3332 "ERROR getting 'android:name' attribute: %s",
3333 - error.string());
3334 + error.c_str());
3335 goto bail;
3336 }
3337 }
3338 @@ -1969,13 +1969,13 @@ int doDump(Bundle* bundle)
3339 Feature feature(true);
3340
3341 int32_t featureVers = AaptXml::getIntegerAttribute(
3342 - tree, androidSchema.string(), "version", 0, &error);
3343 + tree, androidSchema.c_str(), "version", 0, &error);
3344 if (error == "") {
3345 feature.version = featureVers;
3346 } else {
3347 SourcePos(manifestFile, tree.getLineNumber()).error(
3348 "failed to read attribute 'android:version': %s",
3349 - error.string());
3350 + error.c_str());
3351 goto bail;
3352 }
3353
3354 @@ -2016,8 +2016,8 @@ int doDump(Bundle* bundle)
3355 if (error != "") {
3356 SourcePos(manifestFile, tree.getLineNumber()).error(
3357 "ERROR getting 'android:name' attribute for "
3358 - "meta-data tag in service '%s': %s", serviceName.string(),
3359 - error.string());
3360 + "meta-data tag in service '%s': %s", serviceName.c_str(),
3361 + error.c_str());
3362 goto bail;
3363 }
3364
3365 @@ -2034,7 +2034,7 @@ int doDump(Bundle* bundle)
3366 SourcePos(manifestFile, tree.getLineNumber()).error(
3367 "ERROR getting 'android:resource' attribute for "
3368 "meta-data tag in service '%s': %s",
3369 - serviceName.string(), error.string());
3370 + serviceName.c_str(), error.c_str());
3371 goto bail;
3372 }
3373
3374 @@ -2043,7 +2043,7 @@ int doDump(Bundle* bundle)
3375 if (error != "") {
3376 SourcePos(manifestFile, tree.getLineNumber()).error(
3377 "ERROR getting AID category for service '%s'",
3378 - serviceName.string());
3379 + serviceName.c_str());
3380 goto bail;
3381 }
3382
3383 @@ -2064,7 +2064,7 @@ int doDump(Bundle* bundle)
3384 action = AaptXml::getAttribute(tree, NAME_ATTR, &error);
3385 if (error != "") {
3386 SourcePos(manifestFile, tree.getLineNumber()).error(
3387 - "ERROR getting 'android:name' attribute: %s", error.string());
3388 + "ERROR getting 'android:name' attribute: %s", error.c_str());
3389 goto bail;
3390 }
3391
3392 @@ -2120,7 +2120,7 @@ int doDump(Bundle* bundle)
3393 String8 category = AaptXml::getAttribute(tree, NAME_ATTR, &error);
3394 if (error != "") {
3395 SourcePos(manifestFile, tree.getLineNumber()).error(
3396 - "ERROR getting 'name' attribute: %s", error.string());
3397 + "ERROR getting 'name' attribute: %s", error.c_str());
3398 goto bail;
3399 }
3400 if (withinActivity) {
3401 @@ -2352,7 +2352,7 @@ int doDump(Bundle* bundle)
3402 printf("locales:");
3403 const size_t NL = locales.size();
3404 for (size_t i=0; i<NL; i++) {
3405 - const char* localeStr = locales[i].string();
3406 + const char* localeStr = locales[i].c_str();
3407 if (localeStr == NULL || strlen(localeStr) == 0) {
3408 localeStr = "--_--";
3409 }
3410 @@ -2373,7 +2373,7 @@ int doDump(Bundle* bundle)
3411 SortedVector<String8> architectures;
3412 for (size_t i=0; i<dir->getFileCount(); i++) {
3413 architectures.add(ResTable::normalizeForOutput(
3414 - dir->getFileName(i).string()));
3415 + dir->getFileName(i).c_str()));
3416 }
3417
3418 bool outputAltNativeCode = false;
3419 @@ -2401,7 +2401,7 @@ int doDump(Bundle* bundle)
3420 }
3421
3422 if (index >= 0) {
3423 - printf("native-code: '%s'\n", architectures[index].string());
3424 + printf("native-code: '%s'\n", architectures[index].c_str());
3425 architectures.removeAt(index);
3426 outputAltNativeCode = true;
3427 }
3428 @@ -2414,7 +2414,7 @@ int doDump(Bundle* bundle)
3429 }
3430 printf("native-code:");
3431 for (size_t i = 0; i < archCount; i++) {
3432 - printf(" '%s'", architectures[i].string());
3433 + printf(" '%s'", architectures[i].c_str());
3434 }
3435 printf("\n");
3436 }
3437 @@ -2428,7 +2428,7 @@ int doDump(Bundle* bundle)
3438 res.getConfigurations(&configs);
3439 const size_t N = configs.size();
3440 for (size_t i=0; i<N; i++) {
3441 - printf("%s\n", configs[i].toString().string());
3442 + printf("%s\n", configs[i].toString().c_str());
3443 }
3444 } else {
3445 fprintf(stderr, "ERROR: unknown dump option '%s'\n", option);
3446 @@ -2486,15 +2486,15 @@ int doAdd(Bundle* bundle)
3447 for (int i = 1; i < bundle->getFileSpecCount(); i++) {
3448 const char* fileName = bundle->getFileSpecEntry(i);
3449
3450 - if (strcasecmp(String8(fileName).getPathExtension().string(), ".gz") == 0) {
3451 + if (strcasecmp(String8(fileName).getPathExtension().c_str(), ".gz") == 0) {
3452 printf(" '%s'... (from gzip)\n", fileName);
3453 - result = zip->addGzip(fileName, String8(fileName).getBasePath().string(), NULL);
3454 + result = zip->addGzip(fileName, String8(fileName).getBasePath().c_str(), NULL);
3455 } else {
3456 if (bundle->getJunkPath()) {
3457 String8 storageName = String8(fileName).getPathLeaf();
3458 printf(" '%s' as '%s'...\n", fileName,
3459 - ResTable::normalizeForOutput(storageName.string()).string());
3460 - result = zip->add(fileName, storageName.string(),
3461 + ResTable::normalizeForOutput(storageName.c_str()).c_str());
3462 + result = zip->add(fileName, storageName.c_str(),
3463 bundle->getCompressionMethod(), NULL);
3464 } else {
3465 printf(" '%s'...\n", fileName);
3466 @@ -2581,7 +2581,7 @@ static status_t addResourcesToBuilder(const sp<AaptDir>& dir, const sp<ApkBuilde
3467 for (size_t i = 0; i < numDirs; i++) {
3468 bool ignore = ignoreConfig;
3469 const sp<AaptDir>& subDir = dir->getDirs().valueAt(i);
3470 - const char* dirStr = subDir->getLeaf().string();
3471 + const char* dirStr = subDir->getLeaf().c_str();
3472 if (!ignore && strstr(dirStr, "mipmap") == dirStr) {
3473 ignore = true;
3474 }
3475 @@ -2604,7 +2604,7 @@ static status_t addResourcesToBuilder(const sp<AaptDir>& dir, const sp<ApkBuilde
3476 }
3477 if (err != NO_ERROR) {
3478 fprintf(stderr, "Failed to add %s (%s) to builder.\n",
3479 - gp->getPath().string(), gp->getFiles()[j]->getPrintableSource().string());
3480 + gp->getPath().c_str(), gp->getFiles()[j]->getPrintableSource().c_str());
3481 return err;
3482 }
3483 }
3484 @@ -2620,13 +2620,13 @@ static String8 buildApkName(const String8& original, const sp<ApkSplit>& split)
3485 String8 ext(original.getPathExtension());
3486 if (ext == String8(".apk")) {
3487 return String8::format("%s_%s%s",
3488 - original.getBasePath().string(),
3489 - split->getDirectorySafeName().string(),
3490 - ext.string());
3491 + original.getBasePath().c_str(),
3492 + split->getDirectorySafeName().c_str(),
3493 + ext.c_str());
3494 }
3495
3496 - return String8::format("%s_%s", original.string(),
3497 - split->getDirectorySafeName().string());
3498 + return String8::format("%s_%s", original.c_str(),
3499 + split->getDirectorySafeName().c_str());
3500 }
3501
3502 /*
3503 @@ -2712,7 +2712,7 @@ int doPackage(Bundle* bundle)
3504 for (size_t i = 0; i < numSplits; i++) {
3505 std::set<ConfigDescription> configs;
3506 if (!AaptConfig::parseCommaSeparatedList(splitStrs[i], &configs)) {
3507 - fprintf(stderr, "ERROR: failed to parse split configuration '%s'\n", splitStrs[i].string());
3508 + fprintf(stderr, "ERROR: failed to parse split configuration '%s'\n", splitStrs[i].c_str());
3509 goto bail;
3510 }
3511
3512 @@ -2835,7 +2835,7 @@ int doPackage(Bundle* bundle)
3513 String8 outputPath = buildApkName(String8(outputAPKFile), split);
3514 err = writeAPK(bundle, outputPath, split);
3515 if (err != NO_ERROR) {
3516 - fprintf(stderr, "ERROR: packaging of '%s' failed\n", outputPath.string());
3517 + fprintf(stderr, "ERROR: packaging of '%s' failed\n", outputPath.c_str());
3518 goto bail;
3519 }
3520 }
3521 diff --git a/tools/aapt/CrunchCache.cpp b/tools/aapt/CrunchCache.cpp
3522 index 7b8a576b88d3..1f2febec2230 100644
3523 --- a/tools/aapt/CrunchCache.cpp
3524 +++ b/tools/aapt/CrunchCache.cpp
3525 @@ -44,7 +44,7 @@ size_t CrunchCache::crunch(CacheUpdater* cu, bool forceOverwrite)
3526 // This efficiently strips the source directory prefix from our path.
3527 // Also, String8 doesn't have a substring method so this is what we've
3528 // got to work with.
3529 - const char* rPathPtr = mSourceFiles.keyAt(0).string()+mSourcePath.length();
3530 + const char* rPathPtr = mSourceFiles.keyAt(0).c_str()+mSourcePath.length();
3531 // Strip leading slash if present
3532 int offset = 0;
3533 if (rPathPtr[0] == OS_PATH_SEPARATOR)
3534 diff --git a/tools/aapt/DirectoryWalker.h b/tools/aapt/DirectoryWalker.h
3535 index 88031d04b2df..cea3a6eb0ecf 100644
3536 --- a/tools/aapt/DirectoryWalker.h
3537 +++ b/tools/aapt/DirectoryWalker.h
3538 @@ -57,7 +57,7 @@ public:
3539 virtual bool openDir(String8 path) {
3540 mBasePath = path;
3541 dir = NULL;
3542 - dir = opendir(mBasePath.string() );
3543 + dir = opendir(mBasePath.c_str() );
3544
3545 if (dir == NULL)
3546 return false;
3547 @@ -78,7 +78,7 @@ public:
3548 mEntry = *entryPtr;
3549 // Get stats
3550 String8 fullPath = mBasePath.appendPathCopy(mEntry.d_name);
3551 - stat(fullPath.string(),&mStats);
3552 + stat(fullPath.c_str(),&mStats);
3553 return &mEntry;
3554 };
3555 // Get the stats for the current entry
3556 diff --git a/tools/aapt/FileFinder.cpp b/tools/aapt/FileFinder.cpp
3557 index c9d0744a4463..a5c19806c804 100644
3558 --- a/tools/aapt/FileFinder.cpp
3559 +++ b/tools/aapt/FileFinder.cpp
3560 @@ -59,14 +59,14 @@ bool SystemFileFinder::findFiles(String8 basePath, Vector<String8>& extensions,
3561
3562 String8 fullPath = basePath.appendPathCopy(entryName);
3563 // If this entry is a directory we'll recurse into it
3564 - if (isDirectory(fullPath.string()) ) {
3565 + if (isDirectory(fullPath.c_str()) ) {
3566 DirectoryWalker* copy = dw->clone();
3567 findFiles(fullPath, extensions, fileStore,copy);
3568 delete copy;
3569 }
3570
3571 // If this entry is a file, we'll pass it over to checkAndAddFile
3572 - if (isFile(fullPath.string()) ) {
3573 + if (isFile(fullPath.c_str()) ) {
3574 checkAndAddFile(fullPath,dw->entryStats(),extensions,fileStore);
3575 }
3576 }
3577 diff --git a/tools/aapt/Images.cpp b/tools/aapt/Images.cpp
3578 index 627a231de5c8..c6c7e960ba2a 100644
3579 --- a/tools/aapt/Images.cpp
3580 +++ b/tools/aapt/Images.cpp
3581 @@ -1328,13 +1328,13 @@ static bool read_png_protected(png_structp read_ptr, String8& printableName, png
3582
3583 png_init_io(read_ptr, fp);
3584
3585 - read_png(printableName.string(), read_ptr, read_info, imageInfo);
3586 + read_png(printableName.c_str(), read_ptr, read_info, imageInfo);
3587
3588 const size_t nameLen = file->getPath().length();
3589 if (nameLen > 6) {
3590 - const char* name = file->getPath().string();
3591 + const char* name = file->getPath().c_str();
3592 if (name[nameLen-5] == '9' && name[nameLen-6] == '.') {
3593 - if (do_9patch(printableName.string(), imageInfo) != NO_ERROR) {
3594 + if (do_9patch(printableName.c_str(), imageInfo) != NO_ERROR) {
3595 return false;
3596 }
3597 }
3598 @@ -1349,7 +1349,7 @@ static bool write_png_protected(png_structp write_ptr, String8& printableName, p
3599 return false;
3600 }
3601
3602 - write_png(printableName.string(), write_ptr, write_info, *imageInfo, bundle);
3603 + write_png(printableName.c_str(), write_ptr, write_info, *imageInfo, bundle);
3604
3605 return true;
3606 }
3607 @@ -1360,7 +1360,7 @@ status_t preProcessImage(const Bundle* bundle, const sp<AaptAssets>& /* assets *
3608 String8 ext(file->getPath().getPathExtension());
3609
3610 // We currently only process PNG images.
3611 - if (strcmp(ext.string(), ".png") != 0) {
3612 + if (strcmp(ext.c_str(), ".png") != 0) {
3613 return NO_ERROR;
3614 }
3615
3616 @@ -1371,7 +1371,7 @@ status_t preProcessImage(const Bundle* bundle, const sp<AaptAssets>& /* assets *
3617 String8 printableName(file->getPrintableSource());
3618
3619 if (bundle->getVerbose()) {
3620 - printf("Processing image: %s\n", printableName.string());
3621 + printf("Processing image: %s\n", printableName.c_str());
3622 }
3623
3624 png_structp read_ptr = NULL;
3625 @@ -1385,9 +1385,9 @@ status_t preProcessImage(const Bundle* bundle, const sp<AaptAssets>& /* assets *
3626
3627 status_t error = UNKNOWN_ERROR;
3628
3629 - fp = fopen(file->getSourceFile().string(), "rb");
3630 + fp = fopen(file->getSourceFile().c_str(), "rb");
3631 if (fp == NULL) {
3632 - fprintf(stderr, "%s: ERROR: Unable to open PNG file\n", printableName.string());
3633 + fprintf(stderr, "%s: ERROR: Unable to open PNG file\n", printableName.c_str());
3634 goto bail;
3635 }
3636
3637 @@ -1434,7 +1434,7 @@ status_t preProcessImage(const Bundle* bundle, const sp<AaptAssets>& /* assets *
3638 size_t newSize = file->getSize();
3639 float factor = ((float)newSize)/oldSize;
3640 int percent = (int)(factor*100);
3641 - printf(" (processed image %s: %d%% size of source)\n", printableName.string(), percent);
3642 + printf(" (processed image %s: %d%% size of source)\n", printableName.c_str(), percent);
3643 }
3644
3645 bail:
3646 @@ -1450,7 +1450,7 @@ bail:
3647
3648 if (error != NO_ERROR) {
3649 fprintf(stderr, "ERROR: Failure processing PNG image %s\n",
3650 - file->getPrintableSource().string());
3651 + file->getPrintableSource().c_str());
3652 }
3653 return error;
3654 }
3655 @@ -1470,13 +1470,13 @@ status_t preProcessImageToCache(const Bundle* bundle, const String8& source, con
3656 status_t error = UNKNOWN_ERROR;
3657
3658 if (bundle->getVerbose()) {
3659 - printf("Processing image to cache: %s => %s\n", source.string(), dest.string());
3660 + printf("Processing image to cache: %s => %s\n", source.c_str(), dest.c_str());
3661 }
3662
3663 // Get a file handler to read from
3664 - fp = fopen(source.string(),"rb");
3665 + fp = fopen(source.c_str(),"rb");
3666 if (fp == NULL) {
3667 - fprintf(stderr, "%s ERROR: Unable to open PNG file\n", source.string());
3668 + fprintf(stderr, "%s ERROR: Unable to open PNG file\n", source.c_str());
3669 return error;
3670 }
3671
3672 @@ -1507,7 +1507,7 @@ status_t preProcessImageToCache(const Bundle* bundle, const String8& source, con
3673 png_init_io(read_ptr,fp);
3674
3675 // Actually read data from the file
3676 - read_png(source.string(), read_ptr, read_info, &imageInfo);
3677 + read_png(source.c_str(), read_ptr, read_info, &imageInfo);
3678
3679 // We're done reading so we can clean up
3680 // Find old file size before releasing handle
3681 @@ -1519,7 +1519,7 @@ status_t preProcessImageToCache(const Bundle* bundle, const String8& source, con
3682 // Check to see if we're dealing with a 9-patch
3683 // If we are, process appropriately
3684 if (source.getBasePath().getPathExtension() == ".9") {
3685 - if (do_9patch(source.string(), &imageInfo) != NO_ERROR) {
3686 + if (do_9patch(source.c_str(), &imageInfo) != NO_ERROR) {
3687 return error;
3688 }
3689 }
3690 @@ -1541,9 +1541,9 @@ status_t preProcessImageToCache(const Bundle* bundle, const String8& source, con
3691 }
3692
3693 // Open up our destination file for writing
3694 - fp = fopen(dest.string(), "wb");
3695 + fp = fopen(dest.c_str(), "wb");
3696 if (!fp) {
3697 - fprintf(stderr, "%s ERROR: Unable to open PNG file\n", dest.string());
3698 + fprintf(stderr, "%s ERROR: Unable to open PNG file\n", dest.c_str());
3699 png_destroy_write_struct(&write_ptr, &write_info);
3700 return error;
3701 }
3702 @@ -1559,11 +1559,11 @@ status_t preProcessImageToCache(const Bundle* bundle, const String8& source, con
3703 }
3704
3705 // Actually write out to the new png
3706 - write_png(dest.string(), write_ptr, write_info, imageInfo, bundle);
3707 + write_png(dest.c_str(), write_ptr, write_info, imageInfo, bundle);
3708
3709 if (bundle->getVerbose()) {
3710 // Find the size of our new file
3711 - FILE* reader = fopen(dest.string(), "rb");
3712 + FILE* reader = fopen(dest.c_str(), "rb");
3713 fseek(reader, 0, SEEK_END);
3714 size_t newSize = (size_t)ftell(reader);
3715 fclose(reader);
3716 @@ -1571,7 +1571,7 @@ status_t preProcessImageToCache(const Bundle* bundle, const String8& source, con
3717 float factor = ((float)newSize)/oldSize;
3718 int percent = (int)(factor*100);
3719 printf(" (processed image to cache entry %s: %d%% size of source)\n",
3720 - dest.string(), percent);
3721 + dest.c_str(), percent);
3722 }
3723
3724 //Clean up
3725 @@ -1588,7 +1588,7 @@ status_t postProcessImage(const Bundle* bundle, const sp<AaptAssets>& assets,
3726
3727 // At this point, now that we have all the resource data, all we need to
3728 // do is compile XML files.
3729 - if (strcmp(ext.string(), ".xml") == 0) {
3730 + if (strcmp(ext.c_str(), ".xml") == 0) {
3731 String16 resourceName(parseResourceName(file->getSourceFile().getPathLeaf()));
3732 return compileXmlFile(bundle, assets, resourceName, file, table);
3733 }
3734 diff --git a/tools/aapt/Package.cpp b/tools/aapt/Package.cpp
3735 index f06643dcf784..965655b59a94 100644
3736 --- a/tools/aapt/Package.cpp
3737 +++ b/tools/aapt/Package.cpp
3738 @@ -69,39 +69,39 @@ status_t writeAPK(Bundle* bundle, const String8& outputFile, const sp<OutputSet>
3739 * If "update" is set, update the contents of the existing archive.
3740 * Else, if "force" is set, remove the existing archive.
3741 */
3742 - FileType fileType = getFileType(outputFile.string());
3743 + FileType fileType = getFileType(outputFile.c_str());
3744 if (fileType == kFileTypeNonexistent) {
3745 // okay, create it below
3746 } else if (fileType == kFileTypeRegular) {
3747 if (bundle->getUpdate()) {
3748 // okay, open it below
3749 } else if (bundle->getForce()) {
3750 - if (unlink(outputFile.string()) != 0) {
3751 - fprintf(stderr, "ERROR: unable to remove '%s': %s\n", outputFile.string(),
3752 + if (unlink(outputFile.c_str()) != 0) {
3753 + fprintf(stderr, "ERROR: unable to remove '%s': %s\n", outputFile.c_str(),
3754 strerror(errno));
3755 goto bail;
3756 }
3757 } else {
3758 fprintf(stderr, "ERROR: '%s' exists (use '-f' to force overwrite)\n",
3759 - outputFile.string());
3760 + outputFile.c_str());
3761 goto bail;
3762 }
3763 } else {
3764 - fprintf(stderr, "ERROR: '%s' exists and is not a regular file\n", outputFile.string());
3765 + fprintf(stderr, "ERROR: '%s' exists and is not a regular file\n", outputFile.c_str());
3766 goto bail;
3767 }
3768
3769 if (bundle->getVerbose()) {
3770 printf("%s '%s'\n", (fileType == kFileTypeNonexistent) ? "Creating" : "Opening",
3771 - outputFile.string());
3772 + outputFile.c_str());
3773 }
3774
3775 status_t status;
3776 zip = new ZipFile;
3777 - status = zip->open(outputFile.string(), ZipFile::kOpenReadWrite | ZipFile::kOpenCreate);
3778 + status = zip->open(outputFile.c_str(), ZipFile::kOpenReadWrite | ZipFile::kOpenCreate);
3779 if (status != NO_ERROR) {
3780 fprintf(stderr, "ERROR: unable to open '%s' as Zip file for writing\n",
3781 - outputFile.string());
3782 + outputFile.c_str());
3783 goto bail;
3784 }
3785
3786 @@ -112,7 +112,7 @@ status_t writeAPK(Bundle* bundle, const String8& outputFile, const sp<OutputSet>
3787 count = processAssets(bundle, zip, outputSet);
3788 if (count < 0) {
3789 fprintf(stderr, "ERROR: unable to process assets while packaging '%s'\n",
3790 - outputFile.string());
3791 + outputFile.c_str());
3792 result = count;
3793 goto bail;
3794 }
3795 @@ -124,7 +124,7 @@ status_t writeAPK(Bundle* bundle, const String8& outputFile, const sp<OutputSet>
3796 count = processJarFiles(bundle, zip);
3797 if (count < 0) {
3798 fprintf(stderr, "ERROR: unable to process jar files while packaging '%s'\n",
3799 - outputFile.string());
3800 + outputFile.c_str());
3801 result = count;
3802 goto bail;
3803 }
3804 @@ -169,12 +169,12 @@ status_t writeAPK(Bundle* bundle, const String8& outputFile, const sp<OutputSet>
3805 /* anything here? */
3806 if (zip->getNumEntries() == 0) {
3807 if (bundle->getVerbose()) {
3808 - printf("Archive is empty -- removing %s\n", outputFile.getPathLeaf().string());
3809 + printf("Archive is empty -- removing %s\n", outputFile.getPathLeaf().c_str());
3810 }
3811 delete zip; // close the file so we can remove it in Win32
3812 zip = NULL;
3813 - if (unlink(outputFile.string()) != 0) {
3814 - fprintf(stderr, "warning: could not unlink '%s'\n", outputFile.string());
3815 + if (unlink(outputFile.c_str()) != 0) {
3816 + fprintf(stderr, "warning: could not unlink '%s'\n", outputFile.c_str());
3817 }
3818 }
3819
3820 @@ -187,9 +187,9 @@ status_t writeAPK(Bundle* bundle, const String8& outputFile, const sp<OutputSet>
3821 String8 dependencyFile = outputFile;
3822 dependencyFile.append(".d");
3823
3824 - FILE* fp = fopen(dependencyFile.string(), "a");
3825 + FILE* fp = fopen(dependencyFile.c_str(), "a");
3826 // Add this file to the dependency file
3827 - fprintf(fp, "%s \\\n", outputFile.string());
3828 + fprintf(fp, "%s \\\n", outputFile.c_str());
3829 fclose(fp);
3830 }
3831
3832 @@ -199,10 +199,10 @@ bail:
3833 delete zip; // must close before remove in Win32
3834 if (result != NO_ERROR) {
3835 if (bundle->getVerbose()) {
3836 - printf("Removing %s due to earlier failures\n", outputFile.string());
3837 + printf("Removing %s due to earlier failures\n", outputFile.c_str());
3838 }
3839 - if (unlink(outputFile.string()) != 0) {
3840 - fprintf(stderr, "warning: could not unlink '%s'\n", outputFile.string());
3841 + if (unlink(outputFile.c_str()) != 0) {
3842 + fprintf(stderr, "warning: could not unlink '%s'\n", outputFile.c_str());
3843 }
3844 }
3845
3846 @@ -267,31 +267,31 @@ bool processFile(Bundle* bundle, ZipFile* zip,
3847 int fileNameLen = storageName.length();
3848 int excludeExtensionLen = strlen(kExcludeExtension);
3849 if (fileNameLen > excludeExtensionLen
3850 - && (0 == strcmp(storageName.string() + (fileNameLen - excludeExtensionLen),
3851 + && (0 == strcmp(storageName.c_str() + (fileNameLen - excludeExtensionLen),
3852 kExcludeExtension))) {
3853 - fprintf(stderr, "warning: '%s' not added to Zip\n", storageName.string());
3854 + fprintf(stderr, "warning: '%s' not added to Zip\n", storageName.c_str());
3855 return true;
3856 }
3857
3858 - if (strcasecmp(storageName.getPathExtension().string(), ".gz") == 0) {
3859 + if (strcasecmp(storageName.getPathExtension().c_str(), ".gz") == 0) {
3860 fromGzip = true;
3861 storageName = storageName.getBasePath();
3862 }
3863
3864 if (bundle->getUpdate()) {
3865 - entry = zip->getEntryByName(storageName.string());
3866 + entry = zip->getEntryByName(storageName.c_str());
3867 if (entry != NULL) {
3868 /* file already exists in archive; there can be only one */
3869 if (entry->getMarked()) {
3870 fprintf(stderr,
3871 "ERROR: '%s' exists twice (check for with & w/o '.gz'?)\n",
3872 - file->getPrintableSource().string());
3873 + file->getPrintableSource().c_str());
3874 return false;
3875 }
3876 if (!hasData) {
3877 const String8& srcName = file->getSourceFile();
3878 time_t fileModWhen;
3879 - fileModWhen = getFileModDate(srcName.string());
3880 + fileModWhen = getFileModDate(srcName.c_str());
3881 if (fileModWhen == (time_t) -1) { // file existence tested earlier,
3882 return false; // not expecting an error here
3883 }
3884 @@ -299,14 +299,14 @@ bool processFile(Bundle* bundle, ZipFile* zip,
3885 if (fileModWhen > entry->getModWhen()) {
3886 // mark as deleted so add() will succeed
3887 if (bundle->getVerbose()) {
3888 - printf(" (removing old '%s')\n", storageName.string());
3889 + printf(" (removing old '%s')\n", storageName.c_str());
3890 }
3891
3892 zip->remove(entry);
3893 } else {
3894 // version in archive is newer
3895 if (bundle->getVerbose()) {
3896 - printf(" (not updating '%s')\n", storageName.string());
3897 + printf(" (not updating '%s')\n", storageName.c_str());
3898 }
3899 entry->setMarked(true);
3900 return true;
3901 @@ -321,22 +321,22 @@ bool processFile(Bundle* bundle, ZipFile* zip,
3902 //android_setMinPriority(NULL, ANDROID_LOG_VERBOSE);
3903
3904 if (fromGzip) {
3905 - result = zip->addGzip(file->getSourceFile().string(), storageName.string(), &entry);
3906 + result = zip->addGzip(file->getSourceFile().c_str(), storageName.c_str(), &entry);
3907 } else if (!hasData) {
3908 /* don't compress certain files, e.g. PNGs */
3909 int compressionMethod = bundle->getCompressionMethod();
3910 if (!okayToCompress(bundle, storageName)) {
3911 compressionMethod = ZipEntry::kCompressStored;
3912 }
3913 - result = zip->add(file->getSourceFile().string(), storageName.string(), compressionMethod,
3914 + result = zip->add(file->getSourceFile().c_str(), storageName.c_str(), compressionMethod,
3915 &entry);
3916 } else {
3917 - result = zip->add(file->getData(), file->getSize(), storageName.string(),
3918 + result = zip->add(file->getData(), file->getSize(), storageName.c_str(),
3919 file->getCompressionMethod(), &entry);
3920 }
3921 if (result == NO_ERROR) {
3922 if (bundle->getVerbose()) {
3923 - printf(" '%s'%s", storageName.string(), fromGzip ? " (from .gz)" : "");
3924 + printf(" '%s'%s", storageName.c_str(), fromGzip ? " (from .gz)" : "");
3925 if (entry->getCompressionMethod() == ZipEntry::kCompressStored) {
3926 printf(" (not compressed)\n");
3927 } else {
3928 @@ -348,10 +348,10 @@ bool processFile(Bundle* bundle, ZipFile* zip,
3929 } else {
3930 if (result == ALREADY_EXISTS) {
3931 fprintf(stderr, " Unable to add '%s': file already in archive (try '-u'?)\n",
3932 - file->getPrintableSource().string());
3933 + file->getPrintableSource().c_str());
3934 } else {
3935 fprintf(stderr, " Unable to add '%s': Zip add failed (%d)\n",
3936 - file->getPrintableSource().string(), result);
3937 + file->getPrintableSource().c_str(), result);
3938 }
3939 return false;
3940 }
3941 @@ -372,7 +372,7 @@ bool okayToCompress(Bundle* bundle, const String8& pathName)
3942 return true;
3943
3944 for (i = 0; i < NELEM(kNoCompressExt); i++) {
3945 - if (strcasecmp(ext.string(), kNoCompressExt[i]) == 0)
3946 + if (strcasecmp(ext.c_str(), kNoCompressExt[i]) == 0)
3947 return false;
3948 }
3949
3950 @@ -383,7 +383,7 @@ bool okayToCompress(Bundle* bundle, const String8& pathName)
3951 if (pos < 0) {
3952 continue;
3953 }
3954 - const char* path = pathName.string();
3955 + const char* path = pathName.c_str();
3956 if (strcasecmp(path + pos, str) == 0) {
3957 return false;
3958 }
3959 diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
3960 index dd3ebdbdea09..4ca3a68d02a6 100644
3961 --- a/tools/aapt/Resource.cpp
3962 +++ b/tools/aapt/Resource.cpp
3963 @@ -57,8 +57,8 @@ public:
3964
3965 String8 parseResourceName(const String8& leaf)
3966 {
3967 - const char* firstDot = strchr(leaf.string(), '.');
3968 - const char* str = leaf.string();
3969 + const char* firstDot = strchr(leaf.c_str(), '.');
3970 + const char* str = leaf.c_str();
3971
3972 if (firstDot) {
3973 return String8(str, firstDot-str);
3974 @@ -132,7 +132,7 @@ public:
3975 mParams = file->getGroupEntry().toParams();
3976 if (kIsDebug) {
3977 printf("Dir %s: mcc=%d mnc=%d lang=%c%c cnt=%c%c orient=%d ui=%d density=%d touch=%d key=%d inp=%d nav=%d\n",
3978 - group->getPath().string(), mParams.mcc, mParams.mnc,
3979 + group->getPath().c_str(), mParams.mcc, mParams.mnc,
3980 mParams.language[0] ? mParams.language[0] : '-',
3981 mParams.language[1] ? mParams.language[1] : '-',
3982 mParams.country[0] ? mParams.country[0] : '-',
3983 @@ -147,12 +147,12 @@ public:
3984 mBaseName = parseResourceName(leaf);
3985 if (mBaseName == "") {
3986 fprintf(stderr, "Error: malformed resource filename %s\n",
3987 - file->getPrintableSource().string());
3988 + file->getPrintableSource().c_str());
3989 return UNKNOWN_ERROR;
3990 }
3991
3992 if (kIsDebug) {
3993 - printf("file name=%s\n", mBaseName.string());
3994 + printf("file name=%s\n", mBaseName.c_str());
3995 }
3996
3997 return NO_ERROR;
3998 @@ -222,7 +222,7 @@ static status_t parsePackage(Bundle* bundle, const sp<AaptAssets>& assets,
3999 {
4000 if (grp->getFiles().size() != 1) {
4001 fprintf(stderr, "warning: Multiple AndroidManifest.xml files found, using %s\n",
4002 - grp->getFiles().valueAt(0)->getPrintableSource().string());
4003 + grp->getFiles().valueAt(0)->getPrintableSource().c_str());
4004 }
4005
4006 sp<AaptFile> file = grp->getFiles().valueAt(0);
4007 @@ -243,20 +243,20 @@ static status_t parsePackage(Bundle* bundle, const sp<AaptAssets>& assets,
4008 size_t len;
4009 if (code != ResXMLTree::START_TAG) {
4010 fprintf(stderr, "%s:%d: No start tag found\n",
4011 - file->getPrintableSource().string(), block.getLineNumber());
4012 + file->getPrintableSource().c_str(), block.getLineNumber());
4013 return UNKNOWN_ERROR;
4014 }
4015 - if (strcmp16(block.getElementName(&len), String16("manifest").string()) != 0) {
4016 + if (strcmp16(block.getElementName(&len), String16("manifest").c_str()) != 0) {
4017 fprintf(stderr, "%s:%d: Invalid start tag %s, expected <manifest>\n",
4018 - file->getPrintableSource().string(), block.getLineNumber(),
4019 - String8(block.getElementName(&len)).string());
4020 + file->getPrintableSource().c_str(), block.getLineNumber(),
4021 + String8(block.getElementName(&len)).c_str());
4022 return UNKNOWN_ERROR;
4023 }
4024
4025 ssize_t nameIndex = block.indexOfAttribute(NULL, "package");
4026 if (nameIndex < 0) {
4027 fprintf(stderr, "%s:%d: <manifest> does not have package attribute.\n",
4028 - file->getPrintableSource().string(), block.getLineNumber());
4029 + file->getPrintableSource().c_str(), block.getLineNumber());
4030 return UNKNOWN_ERROR;
4031 }
4032
4033 @@ -264,19 +264,19 @@ static status_t parsePackage(Bundle* bundle, const sp<AaptAssets>& assets,
4034
4035 ssize_t revisionCodeIndex = block.indexOfAttribute(RESOURCES_ANDROID_NAMESPACE, "revisionCode");
4036 if (revisionCodeIndex >= 0) {
4037 - bundle->setRevisionCode(String8(block.getAttributeStringValue(revisionCodeIndex, &len)).string());
4038 + bundle->setRevisionCode(String8(block.getAttributeStringValue(revisionCodeIndex, &len)).c_str());
4039 }
4040
4041 String16 uses_sdk16("uses-sdk");
4042 while ((code=block.next()) != ResXMLTree::END_DOCUMENT
4043 && code != ResXMLTree::BAD_DOCUMENT) {
4044 if (code == ResXMLTree::START_TAG) {
4045 - if (strcmp16(block.getElementName(&len), uses_sdk16.string()) == 0) {
4046 + if (strcmp16(block.getElementName(&len), uses_sdk16.c_str()) == 0) {
4047 ssize_t minSdkIndex = block.indexOfAttribute(RESOURCES_ANDROID_NAMESPACE,
4048 "minSdkVersion");
4049 if (minSdkIndex >= 0) {
4050 const char16_t* minSdk16 = block.getAttributeStringValue(minSdkIndex, &len);
4051 - const char* minSdk8 = strdup(String8(minSdk16).string());
4052 + const char* minSdk8 = strdup(String8(minSdk16).c_str());
4053 bundle->setManifestMinSdkVersion(minSdk8);
4054 }
4055 }
4056 @@ -305,17 +305,17 @@ static status_t makeFileResources(Bundle* bundle, const sp<AaptAssets>& assets,
4057 while ((res=it.next()) == NO_ERROR) {
4058 if (bundle->getVerbose()) {
4059 printf(" (new resource id %s from %s)\n",
4060 - it.getBaseName().string(), it.getFile()->getPrintableSource().string());
4061 + it.getBaseName().c_str(), it.getFile()->getPrintableSource().c_str());
4062 }
4063 String16 baseName(it.getBaseName());
4064 - const char16_t* str = baseName.string();
4065 + const char16_t* str = baseName.c_str();
4066 const char16_t* const end = str + baseName.size();
4067 while (str < end) {
4068 if (!((*str >= 'a' && *str <= 'z')
4069 || (*str >= '0' && *str <= '9')
4070 || *str == '_' || *str == '.')) {
4071 fprintf(stderr, "%s: Invalid file name: must contain only [a-z0-9_.]\n",
4072 - it.getPath().string());
4073 + it.getPath().c_str());
4074 hasErrors = true;
4075 }
4076 str++;
4077 @@ -413,7 +413,7 @@ static void collect_files(const sp<AaptDir>& dir,
4078 sp<ResourceTypeSet> set = new ResourceTypeSet();
4079 if (kIsDebug) {
4080 printf("Creating new resource type set for leaf %s with group %s (%p)\n",
4081 - leafName.string(), group->getPath().string(), group.get());
4082 + leafName.c_str(), group->getPath().c_str(), group.get());
4083 }
4084 set->add(leafName, group);
4085 resources->add(resType, set);
4086 @@ -423,21 +423,21 @@ static void collect_files(const sp<AaptDir>& dir,
4087 if (index < 0) {
4088 if (kIsDebug) {
4089 printf("Adding to resource type set for leaf %s group %s (%p)\n",
4090 - leafName.string(), group->getPath().string(), group.get());
4091 + leafName.c_str(), group->getPath().c_str(), group.get());
4092 }
4093 set->add(leafName, group);
4094 } else {
4095 sp<AaptGroup> existingGroup = set->valueAt(index);
4096 if (kIsDebug) {
4097 printf("Extending to resource type set for leaf %s group %s (%p)\n",
4098 - leafName.string(), group->getPath().string(), group.get());
4099 + leafName.c_str(), group->getPath().c_str(), group.get());
4100 }
4101 for (size_t j=0; j<files.size(); j++) {
4102 if (kIsDebug) {
4103 printf("Adding file %s in group %s resType %s\n",
4104 - files.valueAt(j)->getSourceFile().string(),
4105 - files.keyAt(j).toDirName(String8()).string(),
4106 - resType.string());
4107 + files.valueAt(j)->getSourceFile().c_str(),
4108 + files.keyAt(j).toDirName(String8()).c_str(),
4109 + resType.c_str());
4110 }
4111 existingGroup->addFile(files.valueAt(j));
4112 }
4113 @@ -455,14 +455,14 @@ static void collect_files(const sp<AaptAssets>& ass,
4114 for (int i=0; i<N; i++) {
4115 const sp<AaptDir>& d = dirs.itemAt(i);
4116 if (kIsDebug) {
4117 - printf("Collecting dir #%d %p: %s, leaf %s\n", i, d.get(), d->getPath().string(),
4118 - d->getLeaf().string());
4119 + printf("Collecting dir #%d %p: %s, leaf %s\n", i, d.get(), d->getPath().c_str(),
4120 + d->getLeaf().c_str());
4121 }
4122 collect_files(d, resources);
4123
4124 // don't try to include the res dir
4125 if (kIsDebug) {
4126 - printf("Removing dir leaf %s\n", d->getLeaf().string());
4127 + printf("Removing dir leaf %s\n", d->getLeaf().c_str());
4128 }
4129 ass->removeDir(d->getLeaf());
4130 }
4131 @@ -490,8 +490,8 @@ static int validateAttr(const String8& path, const ResTable& table,
4132 int strIdx;
4133 if ((strIdx=table.resolveReference(&value, 0x10000000, NULL, &specFlags)) < 0) {
4134 fprintf(stderr, "%s:%d: Tag <%s> attribute %s references unknown resid 0x%08x.\n",
4135 - path.string(), parser.getLineNumber(),
4136 - String8(parser.getElementName(&len)).string(), attr,
4137 + path.c_str(), parser.getLineNumber(),
4138 + String8(parser.getElementName(&len)).c_str(), attr,
4139 value.data);
4140 return ATTR_NOT_FOUND;
4141 }
4142 @@ -502,12 +502,12 @@ static int validateAttr(const String8& path, const ResTable& table,
4143 str = pool->stringAt(value.data, &len);
4144 }
4145 printf("***** RES ATTR: %s specFlags=0x%x strIdx=%d: %s\n", attr,
4146 - specFlags, strIdx, str != NULL ? String8(str).string() : "???");
4147 + specFlags, strIdx, str != NULL ? String8(str).c_str() : "???");
4148 #endif
4149 if ((specFlags&~ResTable_typeSpec::SPEC_PUBLIC) != 0 && false) {
4150 fprintf(stderr, "%s:%d: Tag <%s> attribute %s varies by configurations 0x%x.\n",
4151 - path.string(), parser.getLineNumber(),
4152 - String8(parser.getElementName(&len)).string(), attr,
4153 + path.c_str(), parser.getLineNumber(),
4154 + String8(parser.getElementName(&len)).c_str(), attr,
4155 specFlags);
4156 return ATTR_NOT_FOUND;
4157 }
4158 @@ -515,20 +515,20 @@ static int validateAttr(const String8& path, const ResTable& table,
4159 if (value.dataType == Res_value::TYPE_STRING) {
4160 if (pool == NULL) {
4161 fprintf(stderr, "%s:%d: Tag <%s> attribute %s has no string block.\n",
4162 - path.string(), parser.getLineNumber(),
4163 - String8(parser.getElementName(&len)).string(), attr);
4164 + path.c_str(), parser.getLineNumber(),
4165 + String8(parser.getElementName(&len)).c_str(), attr);
4166 return ATTR_NOT_FOUND;
4167 }
4168 if ((str = UnpackOptionalString(pool->stringAt(value.data), &len)) == NULL) {
4169 fprintf(stderr, "%s:%d: Tag <%s> attribute %s has corrupt string value.\n",
4170 - path.string(), parser.getLineNumber(),
4171 - String8(parser.getElementName(&len)).string(), attr);
4172 + path.c_str(), parser.getLineNumber(),
4173 + String8(parser.getElementName(&len)).c_str(), attr);
4174 return ATTR_NOT_FOUND;
4175 }
4176 } else {
4177 fprintf(stderr, "%s:%d: Tag <%s> attribute %s has invalid type %d.\n",
4178 - path.string(), parser.getLineNumber(),
4179 - String8(parser.getElementName(&len)).string(), attr,
4180 + path.c_str(), parser.getLineNumber(),
4181 + String8(parser.getElementName(&len)).c_str(), attr,
4182 value.dataType);
4183 return ATTR_NOT_FOUND;
4184 }
4185 @@ -546,30 +546,30 @@ static int validateAttr(const String8& path, const ResTable& table,
4186 }
4187 if (!okay) {
4188 fprintf(stderr, "%s:%d: Tag <%s> attribute %s has invalid character '%c'.\n",
4189 - path.string(), parser.getLineNumber(),
4190 - String8(parser.getElementName(&len)).string(), attr, (char)str[i]);
4191 + path.c_str(), parser.getLineNumber(),
4192 + String8(parser.getElementName(&len)).c_str(), attr, (char)str[i]);
4193 return (int)i;
4194 }
4195 }
4196 }
4197 if (*str == ' ') {
4198 fprintf(stderr, "%s:%d: Tag <%s> attribute %s can not start with a space.\n",
4199 - path.string(), parser.getLineNumber(),
4200 - String8(parser.getElementName(&len)).string(), attr);
4201 + path.c_str(), parser.getLineNumber(),
4202 + String8(parser.getElementName(&len)).c_str(), attr);
4203 return ATTR_LEADING_SPACES;
4204 }
4205 if (len != 0 && str[len-1] == ' ') {
4206 fprintf(stderr, "%s:%d: Tag <%s> attribute %s can not end with a space.\n",
4207 - path.string(), parser.getLineNumber(),
4208 - String8(parser.getElementName(&len)).string(), attr);
4209 + path.c_str(), parser.getLineNumber(),
4210 + String8(parser.getElementName(&len)).c_str(), attr);
4211 return ATTR_TRAILING_SPACES;
4212 }
4213 return ATTR_OKAY;
4214 }
4215 if (required) {
4216 fprintf(stderr, "%s:%d: Tag <%s> missing required attribute %s.\n",
4217 - path.string(), parser.getLineNumber(),
4218 - String8(parser.getElementName(&len)).string(), attr);
4219 + path.c_str(), parser.getLineNumber(),
4220 + String8(parser.getElementName(&len)).c_str(), attr);
4221 return ATTR_NOT_FOUND;
4222 }
4223 return ATTR_OKAY;
4224 @@ -584,7 +584,7 @@ static void checkForIds(const String8& path, ResXMLParser& parser)
4225 ssize_t index = parser.indexOfAttribute(NULL, "id");
4226 if (index >= 0) {
4227 fprintf(stderr, "%s:%d: warning: found plain 'id' attribute; did you mean the new 'android:id' name?\n",
4228 - path.string(), parser.getLineNumber());
4229 + path.c_str(), parser.getLineNumber());
4230 }
4231 }
4232 }
4233 @@ -618,7 +618,7 @@ static bool applyFileOverlay(Bundle *bundle,
4234 size_t overlayCount = overlaySet->size();
4235 for (size_t overlayIndex=0; overlayIndex<overlayCount; overlayIndex++) {
4236 if (bundle->getVerbose()) {
4237 - printf("trying overlaySet Key=%s\n",overlaySet->keyAt(overlayIndex).string());
4238 + printf("trying overlaySet Key=%s\n",overlaySet->keyAt(overlayIndex).c_str());
4239 }
4240 ssize_t baseIndex = -1;
4241 if (baseSet->get() != NULL) {
4242 @@ -638,11 +638,11 @@ static bool applyFileOverlay(Bundle *bundle,
4243 baseGroup->getFiles();
4244 for (size_t i=0; i < baseFiles.size(); i++) {
4245 printf("baseFile " ZD " has flavor %s\n", (ZD_TYPE) i,
4246 - baseFiles.keyAt(i).toString().string());
4247 + baseFiles.keyAt(i).toString().c_str());
4248 }
4249 for (size_t i=0; i < overlayFiles.size(); i++) {
4250 printf("overlayFile " ZD " has flavor %s\n", (ZD_TYPE) i,
4251 - overlayFiles.keyAt(i).toString().string());
4252 + overlayFiles.keyAt(i).toString().c_str());
4253 }
4254 }
4255
4256 @@ -657,16 +657,16 @@ static bool applyFileOverlay(Bundle *bundle,
4257 if (bundle->getVerbose()) {
4258 printf("found a match (" ZD ") for overlay file %s, for flavor %s\n",
4259 (ZD_TYPE) baseFileIndex,
4260 - overlayGroup->getLeaf().string(),
4261 - overlayFiles.keyAt(overlayGroupIndex).toString().string());
4262 + overlayGroup->getLeaf().c_str(),
4263 + overlayFiles.keyAt(overlayGroupIndex).toString().c_str());
4264 }
4265 baseGroup->removeFile(baseFileIndex);
4266 } else {
4267 // didn't find a match fall through and add it..
4268 if (true || bundle->getVerbose()) {
4269 printf("nothing matches overlay file %s, for flavor %s\n",
4270 - overlayGroup->getLeaf().string(),
4271 - overlayFiles.keyAt(overlayGroupIndex).toString().string());
4272 + overlayGroup->getLeaf().c_str(),
4273 + overlayFiles.keyAt(overlayGroupIndex).toString().c_str());
4274 }
4275 }
4276 baseGroup->addFile(overlayFiles.valueAt(overlayGroupIndex));
4277 @@ -728,7 +728,7 @@ bool addTagAttribute(const sp<XMLNode>& node, const char* ns8,
4278 if (errorOnFailedInsert) {
4279 fprintf(stderr, "Error: AndroidManifest.xml already defines %s (in %s);"
4280 " cannot insert new value %s.\n",
4281 - String8(attr).string(), String8(ns).string(), value);
4282 + String8(attr).c_str(), String8(ns).c_str(), value);
4283 return false;
4284 }
4285
4286 @@ -763,7 +763,7 @@ static void fullyQualifyClassName(const String8& package, const sp<XMLNode>& nod
4287 // .asdf .a.b --> package.asdf package.a.b
4288 // asdf.adsf --> asdf.asdf
4289 String8 className;
4290 - const char* p = name.string();
4291 + const char* p = name.c_str();
4292 const char* q = strchr(p, '.');
4293 if (p == q) {
4294 className += package;
4295 @@ -776,7 +776,7 @@ static void fullyQualifyClassName(const String8& package, const sp<XMLNode>& nod
4296 className += name;
4297 }
4298 if (kIsDebug) {
4299 - printf("Qualifying class '%s' to '%s'", name.string(), className.string());
4300 + printf("Qualifying class '%s' to '%s'", name.c_str(), className.c_str());
4301 }
4302 attr->string.setTo(String16(className));
4303 }
4304 @@ -810,7 +810,7 @@ static void massageRoundIconSupport(const String16& iconRef, const String16& rou
4305 const char* err;
4306
4307 String16 iconPackage, iconType, iconName;
4308 - if (!ResTable::expandResourceRef(iconRef.string(), iconRef.size(), &iconPackage, &iconType,
4309 + if (!ResTable::expandResourceRef(iconRef.c_str(), iconRef.size(), &iconPackage, &iconType,
4310 &iconName, NULL, &table->getAssetsPackage(), &err,
4311 &publicOnly)) {
4312 // Errors will be raised in later XML compilation.
4313 @@ -824,7 +824,7 @@ static void massageRoundIconSupport(const String16& iconRef, const String16& rou
4314 }
4315
4316 String16 roundIconPackage, roundIconType, roundIconName;
4317 - if (!ResTable::expandResourceRef(roundIconRef.string(), roundIconRef.size(), &roundIconPackage,
4318 + if (!ResTable::expandResourceRef(roundIconRef.c_str(), roundIconRef.size(), &roundIconPackage,
4319 &roundIconType, &roundIconName, NULL, &table->getAssetsPackage(),
4320 &err, &publicOnly)) {
4321 // Errors will be raised in later XML compilation.
4322 @@ -839,9 +839,9 @@ static void massageRoundIconSupport(const String16& iconRef, const String16& rou
4323 return;
4324 }
4325
4326 - String16 aliasValue = String16(String8::format("@%s:%s/%s", String8(iconPackage).string(),
4327 - String8(iconType).string(),
4328 - String8(iconName).string()));
4329 + String16 aliasValue = String16(String8::format("@%s:%s/%s", String8(iconPackage).c_str(),
4330 + String8(iconType).c_str(),
4331 + String8(iconName).c_str()));
4332
4333 // Add an equivalent v26 entry to the roundIcon for each v26 variant of the regular icon.
4334 const DefaultKeyedVector<ConfigDescription, sp<ResourceTable::Entry>>& configList =
4335 @@ -872,7 +872,7 @@ status_t massageManifest(Bundle* bundle, ResourceTable* table, sp<XMLNode> root)
4336 const XMLNode::attribute_entry* attr = root->getAttribute(
4337 String16(RESOURCES_ANDROID_NAMESPACE), String16("versionCode"));
4338 if (attr != NULL) {
4339 - bundle->setVersionCode(strdup(String8(attr->string).string()));
4340 + bundle->setVersionCode(strdup(String8(attr->string).c_str()));
4341 }
4342 }
4343
4344 @@ -883,7 +883,7 @@ status_t massageManifest(Bundle* bundle, ResourceTable* table, sp<XMLNode> root)
4345 const XMLNode::attribute_entry* attr = root->getAttribute(
4346 String16(RESOURCES_ANDROID_NAMESPACE), String16("versionName"));
4347 if (attr != NULL) {
4348 - bundle->setVersionName(strdup(String8(attr->string).string()));
4349 + bundle->setVersionName(strdup(String8(attr->string).c_str()));
4350 }
4351 }
4352
4353 @@ -914,7 +914,7 @@ status_t massageManifest(Bundle* bundle, ResourceTable* table, sp<XMLNode> root)
4354 const XMLNode::attribute_entry* attr = vers->getAttribute(
4355 String16(RESOURCES_ANDROID_NAMESPACE), String16("minSdkVersion"));
4356 if (attr != NULL) {
4357 - bundle->setMinSdkVersion(strdup(String8(attr->string).string()));
4358 + bundle->setMinSdkVersion(strdup(String8(attr->string).c_str()));
4359 }
4360 }
4361
4362 @@ -970,7 +970,7 @@ status_t massageManifest(Bundle* bundle, ResourceTable* table, sp<XMLNode> root)
4363 String8 origPackage(attr->string);
4364 attr->string.setTo(String16(manifestPackageNameOverride));
4365 if (kIsDebug) {
4366 - printf("Overriding package '%s' to be '%s'\n", origPackage.string(),
4367 + printf("Overriding package '%s' to be '%s'\n", origPackage.c_str(),
4368 manifestPackageNameOverride);
4369 }
4370
4371 @@ -1071,7 +1071,7 @@ enum {
4372 static ssize_t extractPlatformBuildVersion(const ResTable& table, ResXMLTree& tree, Bundle* bundle) {
4373 // First check if we should be recording the compileSdkVersion* attributes.
4374 static const String16 compileSdkVersionName("android:attr/compileSdkVersion");
4375 - const bool useCompileSdkVersion = table.identifierForName(compileSdkVersionName.string(),
4376 + const bool useCompileSdkVersion = table.identifierForName(compileSdkVersionName.c_str(),
4377 compileSdkVersionName.size()) != 0u;
4378
4379 size_t len;
4380 @@ -1223,7 +1223,7 @@ status_t generateAndroidManifestForSplit(Bundle* bundle, const sp<AaptAssets>& a
4381 // Add the 'revisionCode' attribute, which is set to the original revisionCode.
4382 if (bundle->getRevisionCode().size() > 0) {
4383 if (!addTagAttribute(manifest, RESOURCES_ANDROID_NAMESPACE, "revisionCode",
4384 - bundle->getRevisionCode().string(), true, true)) {
4385 + bundle->getRevisionCode().c_str(), true, true)) {
4386 return UNKNOWN_ERROR;
4387 }
4388 }
4389 @@ -1270,7 +1270,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
4390 }
4391
4392 if (kIsDebug) {
4393 - printf("Creating resources for package %s\n", assets->getPackage().string());
4394 + printf("Creating resources for package %s\n", assets->getPackage().c_str());
4395 }
4396
4397 // Set the private symbols package if it was declared.
4398 @@ -1804,7 +1804,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
4399 flattenedTable, split->isBase());
4400 if (err != NO_ERROR) {
4401 fprintf(stderr, "Failed to generate resource table for split '%s'\n",
4402 - split->getPrintableName().string());
4403 + split->getPrintableName().c_str());
4404 return err;
4405 }
4406 split->addEntry(String8("resources.arsc"), flattenedTable);
4407 @@ -1821,7 +1821,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
4408 err = resTable.add(flattenedTable->getData(), flattenedTable->getSize());
4409 if (err != NO_ERROR) {
4410 fprintf(stderr, "Generated resource table for split '%s' is corrupt.\n",
4411 - split->getPrintableName().string());
4412 + split->getPrintableName().c_str());
4413 return err;
4414 }
4415
4416 @@ -1849,7 +1849,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
4417 if (block < 0) {
4418 hasError = true;
4419 SourcePos().error("%s has no definition for density split '%s'",
4420 - symbol.toString().string(), config.toString().string());
4421 + symbol.toString().c_str(), config.toString().c_str());
4422
4423 if (bundle->getVerbose()) {
4424 const Vector<SymbolDefinition>& defs = densityVaryingResources[k];
4425 @@ -1857,7 +1857,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
4426 for (size_t d = 0; d < defCount; d++) {
4427 const SymbolDefinition& def = defs[d];
4428 def.source.error("%s has definition for %s",
4429 - symbol.toString().string(), def.config.toString().string());
4430 + symbol.toString().c_str(), def.config.toString().c_str());
4431 }
4432
4433 if (defCount < defs.size()) {
4434 @@ -1880,7 +1880,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
4435 generatedManifest, &table);
4436 if (err != NO_ERROR) {
4437 fprintf(stderr, "Failed to generate AndroidManifest.xml for split '%s'\n",
4438 - split->getPrintableName().string());
4439 + split->getPrintableName().c_str());
4440 return err;
4441 }
4442 split->addEntry(String8("AndroidManifest.xml"), generatedManifest);
4443 @@ -1960,7 +1960,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
4444 if (block.getElementNamespace(&len) != NULL) {
4445 continue;
4446 }
4447 - if (strcmp16(block.getElementName(&len), manifest16.string()) == 0) {
4448 + if (strcmp16(block.getElementName(&len), manifest16.c_str()) == 0) {
4449 if (validateAttr(manifestPath, finalResTable, block, NULL, "package",
4450 packageIdentChars, true) != ATTR_OKAY) {
4451 hasErrors = true;
4452 @@ -1969,10 +1969,10 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
4453 "sharedUserId", packageIdentChars, false) != ATTR_OKAY) {
4454 hasErrors = true;
4455 }
4456 - } else if (strcmp16(block.getElementName(&len), permission16.string()) == 0
4457 - || strcmp16(block.getElementName(&len), permission_group16.string()) == 0) {
4458 + } else if (strcmp16(block.getElementName(&len), permission16.c_str()) == 0
4459 + || strcmp16(block.getElementName(&len), permission_group16.c_str()) == 0) {
4460 const bool isGroup = strcmp16(block.getElementName(&len),
4461 - permission_group16.string()) == 0;
4462 + permission_group16.c_str()) == 0;
4463 if (validateAttr(manifestPath, finalResTable, block, RESOURCES_ANDROID_NAMESPACE,
4464 "name", isGroup ? packageIdentCharsWithTheStupid
4465 : packageIdentChars, true) != ATTR_OKAY) {
4466 @@ -2002,8 +2002,8 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
4467 const char16_t* id = block.getAttributeStringValue(index, &len);
4468 if (id == NULL) {
4469 fprintf(stderr, "%s:%d: missing name attribute in element <%s>.\n",
4470 - manifestPath.string(), block.getLineNumber(),
4471 - String8(block.getElementName(&len)).string());
4472 + manifestPath.c_str(), block.getLineNumber(),
4473 + String8(block.getElementName(&len)).c_str());
4474 hasErrors = true;
4475 break;
4476 }
4477 @@ -2038,23 +2038,23 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
4478 if (begins_with_digit || (e != p && *(e-1) != '.')) {
4479 fprintf(stderr,
4480 "%s:%d: Permission name <%s> is not a valid Java symbol\n",
4481 - manifestPath.string(), block.getLineNumber(), idStr.string());
4482 + manifestPath.c_str(), block.getLineNumber(), idStr.c_str());
4483 hasErrors = true;
4484 }
4485 syms->addStringSymbol(String8(e), idStr, srcPos);
4486 const char16_t* cmt = block.getComment(&len);
4487 if (cmt != NULL && *cmt != 0) {
4488 - //printf("Comment of %s: %s\n", String8(e).string(),
4489 - // String8(cmt).string());
4490 + //printf("Comment of %s: %s\n", String8(e).c_str(),
4491 + // String8(cmt).c_str());
4492 syms->appendComment(String8(e), String16(cmt), srcPos);
4493 }
4494 syms->makeSymbolPublic(String8(e), srcPos);
4495 - } else if (strcmp16(block.getElementName(&len), uses_permission16.string()) == 0) {
4496 + } else if (strcmp16(block.getElementName(&len), uses_permission16.c_str()) == 0) {
4497 if (validateAttr(manifestPath, finalResTable, block, RESOURCES_ANDROID_NAMESPACE,
4498 "name", packageIdentChars, true) != ATTR_OKAY) {
4499 hasErrors = true;
4500 }
4501 - } else if (strcmp16(block.getElementName(&len), instrumentation16.string()) == 0) {
4502 + } else if (strcmp16(block.getElementName(&len), instrumentation16.c_str()) == 0) {
4503 if (validateAttr(manifestPath, finalResTable, block, RESOURCES_ANDROID_NAMESPACE,
4504 "name", classIdentChars, true) != ATTR_OKAY) {
4505 hasErrors = true;
4506 @@ -2064,7 +2064,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
4507 packageIdentChars, true) != ATTR_OKAY) {
4508 hasErrors = true;
4509 }
4510 - } else if (strcmp16(block.getElementName(&len), application16.string()) == 0) {
4511 + } else if (strcmp16(block.getElementName(&len), application16.c_str()) == 0) {
4512 if (validateAttr(manifestPath, finalResTable, block, RESOURCES_ANDROID_NAMESPACE,
4513 "name", classIdentChars, false) != ATTR_OKAY) {
4514 hasErrors = true;
4515 @@ -2084,7 +2084,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
4516 processIdentChars, false) != ATTR_OKAY) {
4517 hasErrors = true;
4518 }
4519 - } else if (strcmp16(block.getElementName(&len), provider16.string()) == 0) {
4520 + } else if (strcmp16(block.getElementName(&len), provider16.c_str()) == 0) {
4521 if (validateAttr(manifestPath, finalResTable, block, RESOURCES_ANDROID_NAMESPACE,
4522 "name", classIdentChars, true) != ATTR_OKAY) {
4523 hasErrors = true;
4524 @@ -2104,9 +2104,9 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
4525 processIdentChars, false) != ATTR_OKAY) {
4526 hasErrors = true;
4527 }
4528 - } else if (strcmp16(block.getElementName(&len), service16.string()) == 0
4529 - || strcmp16(block.getElementName(&len), receiver16.string()) == 0
4530 - || strcmp16(block.getElementName(&len), activity16.string()) == 0) {
4531 + } else if (strcmp16(block.getElementName(&len), service16.c_str()) == 0
4532 + || strcmp16(block.getElementName(&len), receiver16.c_str()) == 0
4533 + || strcmp16(block.getElementName(&len), activity16.c_str()) == 0) {
4534 if (validateAttr(manifestPath, finalResTable, block, RESOURCES_ANDROID_NAMESPACE,
4535 "name", classIdentChars, true) != ATTR_OKAY) {
4536 hasErrors = true;
4537 @@ -2126,14 +2126,14 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
4538 processIdentChars, false) != ATTR_OKAY) {
4539 hasErrors = true;
4540 }
4541 - } else if (strcmp16(block.getElementName(&len), action16.string()) == 0
4542 - || strcmp16(block.getElementName(&len), category16.string()) == 0) {
4543 + } else if (strcmp16(block.getElementName(&len), action16.c_str()) == 0
4544 + || strcmp16(block.getElementName(&len), category16.c_str()) == 0) {
4545 if (validateAttr(manifestPath, finalResTable, block,
4546 RESOURCES_ANDROID_NAMESPACE, "name",
4547 packageIdentChars, true) != ATTR_OKAY) {
4548 hasErrors = true;
4549 }
4550 - } else if (strcmp16(block.getElementName(&len), data16.string()) == 0) {
4551 + } else if (strcmp16(block.getElementName(&len), data16.c_str()) == 0) {
4552 if (validateAttr(manifestPath, finalResTable, block,
4553 RESOURCES_ANDROID_NAMESPACE, "mimeType",
4554 typeIdentChars, true) != ATTR_OKAY) {
4555 @@ -2144,13 +2144,13 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
4556 schemeIdentChars, true) != ATTR_OKAY) {
4557 hasErrors = true;
4558 }
4559 - } else if (strcmp16(block.getElementName(&len), feature_group16.string()) == 0) {
4560 + } else if (strcmp16(block.getElementName(&len), feature_group16.c_str()) == 0) {
4561 int depth = 1;
4562 while ((code=block.next()) != ResXMLTree::END_DOCUMENT
4563 && code > ResXMLTree::BAD_DOCUMENT) {
4564 if (code == ResXMLTree::START_TAG) {
4565 depth++;
4566 - if (strcmp16(block.getElementName(&len), uses_feature16.string()) == 0) {
4567 + if (strcmp16(block.getElementName(&len), uses_feature16.c_str()) == 0) {
4568 ssize_t idx = block.indexOfAttribute(
4569 RESOURCES_ANDROID_NAMESPACE, "required");
4570 if (idx < 0) {
4571 @@ -2162,7 +2162,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
4572 fprintf(stderr, "%s:%d: Tag <uses-feature> can not have "
4573 "android:required=\"false\" when inside a "
4574 "<feature-group> tag.\n",
4575 - manifestPath.string(), block.getLineNumber());
4576 + manifestPath.c_str(), block.getLineNumber());
4577 hasErrors = true;
4578 }
4579 }
4580 @@ -2222,7 +2222,7 @@ static String8 flattenSymbol(const String8& symbol) {
4581 static String8 getSymbolPackage(const String8& symbol, const sp<AaptAssets>& assets, bool pub) {
4582 ssize_t colon = symbol.find(":", 0);
4583 if (colon >= 0) {
4584 - return String8(symbol.string(), colon);
4585 + return String8(symbol.c_str(), colon);
4586 }
4587 return pub ? assets->getPackage() : assets->getSymbolsPrivatePackage();
4588 }
4589 @@ -2230,7 +2230,7 @@ static String8 getSymbolPackage(const String8& symbol, const sp<AaptAssets>& ass
4590 static String8 getSymbolName(const String8& symbol) {
4591 ssize_t colon = symbol.find(":", 0);
4592 if (colon >= 0) {
4593 - return String8(symbol.string() + colon + 1);
4594 + return String8(symbol.c_str() + colon + 1);
4595 }
4596 return symbol;
4597 }
4598 @@ -2245,7 +2245,7 @@ static String16 getAttributeComment(const sp<AaptAssets>& assets,
4599 asym = asym->getNestedSymbols().valueFor(String8("attr"));
4600 if (asym != NULL) {
4601 //printf("Got attrs symbols! comment %s=%s\n",
4602 - // name.string(), String8(asym->getComment(name)).string());
4603 + // name.c_str(), String8(asym->getComment(name)).c_str());
4604 if (outTypeComment != NULL) {
4605 *outTypeComment = asym->getTypeComment(name);
4606 }
4607 @@ -2276,8 +2276,8 @@ static status_t writeResourceLoadedCallbackForLayoutClasses(
4608 "%sfor(int i = 0; i < styleable.%s.length; ++i) {\n"
4609 "%sstyleable.%s[i] = (styleable.%s[i] & 0x00ffffff) | (packageId << 24);\n"
4610 "%s}\n",
4611 - indentStr, nclassName.string(),
4612 - getIndentSpace(indent+1), nclassName.string(), nclassName.string(),
4613 + indentStr, nclassName.c_str(),
4614 + getIndentSpace(indent+1), nclassName.c_str(), nclassName.c_str(),
4615 indentStr);
4616 }
4617
4618 @@ -2303,8 +2303,8 @@ static status_t writeResourceLoadedCallback(
4619 String8 flat_name(flattenSymbol(sym.name));
4620 fprintf(fp,
4621 "%s%s.%s = (%s.%s & 0x00ffffff) | (packageId << 24);\n",
4622 - getIndentSpace(indent), className.string(), flat_name.string(),
4623 - className.string(), flat_name.string());
4624 + getIndentSpace(indent), className.c_str(), flat_name.c_str(),
4625 + className.c_str(), flat_name.c_str());
4626 }
4627
4628 N = symbols->getNestedSymbols().size();
4629 @@ -2365,12 +2365,12 @@ static status_t writeLayoutClasses(
4630 String16 name16(sym.name);
4631 uint32_t typeSpecFlags;
4632 code = assets->getIncludedResources().identifierForName(
4633 - name16.string(), name16.size(),
4634 - attr16.string(), attr16.size(),
4635 - package16.string(), package16.size(), &typeSpecFlags);
4636 + name16.c_str(), name16.size(),
4637 + attr16.c_str(), attr16.size(),
4638 + package16.c_str(), package16.size(), &typeSpecFlags);
4639 if (code == 0) {
4640 fprintf(stderr, "ERROR: In <declare-styleable> %s, unable to find attribute %s\n",
4641 - nclassName.string(), sym.name.string());
4642 + nclassName.c_str(), sym.name.c_str());
4643 hasErrors = true;
4644 }
4645 isPublic = (typeSpecFlags&ResTable_typeSpec::SPEC_PUBLIC) != 0;
4646 @@ -2388,9 +2388,9 @@ static status_t writeLayoutClasses(
4647 if (comment.size() > 0) {
4648 String8 cmt(comment);
4649 ann.preprocessComment(cmt);
4650 - fprintf(fp, "%s\n", cmt.string());
4651 + fprintf(fp, "%s\n", cmt.c_str());
4652 } else {
4653 - fprintf(fp, "Attributes that can be used with a %s.\n", nclassName.string());
4654 + fprintf(fp, "Attributes that can be used with a %s.\n", nclassName.c_str());
4655 }
4656 bool hasTable = false;
4657 for (a=0; a<NA; a++) {
4658 @@ -2423,7 +2423,7 @@ static status_t writeLayoutClasses(
4659 continue;
4660 }
4661 if (comment.size() > 0) {
4662 - const char16_t* p = comment.string();
4663 + const char16_t* p = comment.c_str();
4664 while (*p != 0 && *p != '.') {
4665 if (*p == '{') {
4666 while (*p != 0 && *p != '}') {
4667 @@ -2436,14 +2436,14 @@ static status_t writeLayoutClasses(
4668 if (*p == '.') {
4669 p++;
4670 }
4671 - comment = String16(comment.string(), p-comment.string());
4672 + comment = String16(comment.c_str(), p-comment.c_str());
4673 }
4674 fprintf(fp, "%s <tr><td><code>{@link #%s_%s %s:%s}</code></td><td>%s</td></tr>\n",
4675 - indentStr, nclassName.string(),
4676 - flattenSymbol(name8).string(),
4677 - getSymbolPackage(name8, assets, true).string(),
4678 - getSymbolName(name8).string(),
4679 - String8(comment).string());
4680 + indentStr, nclassName.c_str(),
4681 + flattenSymbol(name8).c_str(),
4682 + getSymbolPackage(name8, assets, true).c_str(),
4683 + getSymbolName(name8).c_str(),
4684 + String8(comment).c_str());
4685 }
4686 }
4687 if (hasTable) {
4688 @@ -2457,8 +2457,8 @@ static status_t writeLayoutClasses(
4689 continue;
4690 }
4691 fprintf(fp, "%s @see #%s_%s\n",
4692 - indentStr, nclassName.string(),
4693 - flattenSymbol(sym.name).string());
4694 + indentStr, nclassName.c_str(),
4695 + flattenSymbol(sym.name).c_str());
4696 }
4697 }
4698 fprintf(fp, "%s */\n", getIndentSpace(indent));
4699 @@ -2468,7 +2468,7 @@ static status_t writeLayoutClasses(
4700 fprintf(fp,
4701 "%spublic static final int[] %s = {\n"
4702 "%s",
4703 - indentStr, nclassName.string(),
4704 + indentStr, nclassName.c_str(),
4705 getIndentSpace(indent+1));
4706
4707 for (a=0; a<NA; a++) {
4708 @@ -2503,11 +2503,11 @@ static status_t writeLayoutClasses(
4709 uint32_t typeSpecFlags = 0;
4710 String16 name16(sym.name);
4711 assets->getIncludedResources().identifierForName(
4712 - name16.string(), name16.size(),
4713 - attr16.string(), attr16.size(),
4714 - package16.string(), package16.size(), &typeSpecFlags);
4715 - //printf("%s:%s/%s: 0x%08x\n", String8(package16).string(),
4716 - // String8(attr16).string(), String8(name16).string(), typeSpecFlags);
4717 + name16.c_str(), name16.size(),
4718 + attr16.c_str(), attr16.size(),
4719 + package16.c_str(), package16.size(), &typeSpecFlags);
4720 + //printf("%s:%s/%s: 0x%08x\n", String8(package16).c_str(),
4721 + // String8(attr16).c_str(), String8(name16).c_str(), typeSpecFlags);
4722 const bool pub = (typeSpecFlags&ResTable_typeSpec::SPEC_PUBLIC) != 0;
4723
4724 AnnotationProcessor ann;
4725 @@ -2516,20 +2516,20 @@ static status_t writeLayoutClasses(
4726 String8 cmt(comment);
4727 ann.preprocessComment(cmt);
4728 fprintf(fp, "%s <p>\n%s @attr description\n", indentStr, indentStr);
4729 - fprintf(fp, "%s %s\n", indentStr, cmt.string());
4730 + fprintf(fp, "%s %s\n", indentStr, cmt.c_str());
4731 } else {
4732 fprintf(fp,
4733 "%s <p>This symbol is the offset where the {@link %s.R.attr#%s}\n"
4734 "%s attribute's value can be found in the {@link #%s} array.\n",
4735 indentStr,
4736 - getSymbolPackage(name8, assets, pub).string(),
4737 - getSymbolName(name8).string(),
4738 - indentStr, nclassName.string());
4739 + getSymbolPackage(name8, assets, pub).c_str(),
4740 + getSymbolName(name8).c_str(),
4741 + indentStr, nclassName.c_str());
4742 }
4743 if (typeComment.size() > 0) {
4744 String8 cmt(typeComment);
4745 ann.preprocessComment(cmt);
4746 - fprintf(fp, "\n\n%s %s\n", indentStr, cmt.string());
4747 + fprintf(fp, "\n\n%s %s\n", indentStr, cmt.c_str());
4748 }
4749 if (comment.size() > 0) {
4750 if (pub) {
4751 @@ -2537,16 +2537,16 @@ static status_t writeLayoutClasses(
4752 "%s <p>This corresponds to the global attribute\n"
4753 "%s resource symbol {@link %s.R.attr#%s}.\n",
4754 indentStr, indentStr,
4755 - getSymbolPackage(name8, assets, true).string(),
4756 - getSymbolName(name8).string());
4757 + getSymbolPackage(name8, assets, true).c_str(),
4758 + getSymbolName(name8).c_str());
4759 } else {
4760 fprintf(fp,
4761 "%s <p>This is a private symbol.\n", indentStr);
4762 }
4763 }
4764 fprintf(fp, "%s @attr name %s:%s\n", indentStr,
4765 - getSymbolPackage(name8, assets, pub).string(),
4766 - getSymbolName(name8).string());
4767 + getSymbolPackage(name8, assets, pub).c_str(),
4768 + getSymbolName(name8).c_str());
4769 fprintf(fp, "%s*/\n", indentStr);
4770 ann.printAnnotations(fp, indentStr);
4771
4772 @@ -2556,8 +2556,8 @@ static status_t writeLayoutClasses(
4773
4774 fprintf(fp,
4775 id_format,
4776 - indentStr, nclassName.string(),
4777 - flattenSymbol(name8).string(), (int)pos);
4778 + indentStr, nclassName.c_str(),
4779 + flattenSymbol(name8).c_str(), (int)pos);
4780 }
4781 }
4782 }
4783 @@ -2598,12 +2598,12 @@ static status_t writeTextLayoutClasses(
4784 String16 name16(sym.name);
4785 uint32_t typeSpecFlags;
4786 code = assets->getIncludedResources().identifierForName(
4787 - name16.string(), name16.size(),
4788 - attr16.string(), attr16.size(),
4789 - package16.string(), package16.size(), &typeSpecFlags);
4790 + name16.c_str(), name16.size(),
4791 + attr16.c_str(), attr16.size(),
4792 + package16.c_str(), package16.size(), &typeSpecFlags);
4793 if (code == 0) {
4794 fprintf(stderr, "ERROR: In <declare-styleable> %s, unable to find attribute %s\n",
4795 - nclassName.string(), sym.name.string());
4796 + nclassName.c_str(), sym.name.c_str());
4797 hasErrors = true;
4798 }
4799 isPublic = (typeSpecFlags&ResTable_typeSpec::SPEC_PUBLIC) != 0;
4800 @@ -2615,7 +2615,7 @@ static status_t writeTextLayoutClasses(
4801
4802 NA = idents.size();
4803
4804 - fprintf(fp, "int[] styleable %s {", nclassName.string());
4805 + fprintf(fp, "int[] styleable %s {", nclassName.c_str());
4806
4807 for (a=0; a<NA; a++) {
4808 if (a != 0) {
4809 @@ -2645,17 +2645,17 @@ static status_t writeTextLayoutClasses(
4810 uint32_t typeSpecFlags = 0;
4811 String16 name16(sym.name);
4812 assets->getIncludedResources().identifierForName(
4813 - name16.string(), name16.size(),
4814 - attr16.string(), attr16.size(),
4815 - package16.string(), package16.size(), &typeSpecFlags);
4816 - //printf("%s:%s/%s: 0x%08x\n", String8(package16).string(),
4817 - // String8(attr16).string(), String8(name16).string(), typeSpecFlags);
4818 + name16.c_str(), name16.size(),
4819 + attr16.c_str(), attr16.size(),
4820 + package16.c_str(), package16.size(), &typeSpecFlags);
4821 + //printf("%s:%s/%s: 0x%08x\n", String8(package16).c_str(),
4822 + // String8(attr16).c_str(), String8(name16).c_str(), typeSpecFlags);
4823 //const bool pub = (typeSpecFlags&ResTable_typeSpec::SPEC_PUBLIC) != 0;
4824
4825 fprintf(fp,
4826 "int styleable %s_%s %d\n",
4827 - nclassName.string(),
4828 - flattenSymbol(name8).string(), (int)pos);
4829 + nclassName.c_str(),
4830 + flattenSymbol(name8).c_str(), (int)pos);
4831 }
4832 }
4833 }
4834 @@ -2670,7 +2670,7 @@ static status_t writeSymbolClass(
4835 {
4836 fprintf(fp, "%spublic %sfinal class %s {\n",
4837 getIndentSpace(indent),
4838 - indent != 0 ? "static " : "", className.string());
4839 + indent != 0 ? "static " : "", className.c_str());
4840 indent++;
4841
4842 size_t i;
4843 @@ -2699,7 +2699,7 @@ static status_t writeSymbolClass(
4844 ann.preprocessComment(cmt);
4845 fprintf(fp,
4846 "%s/** %s\n",
4847 - getIndentSpace(indent), cmt.string());
4848 + getIndentSpace(indent), cmt.c_str());
4849 }
4850 String16 typeComment(sym.typeComment);
4851 if (typeComment.size() > 0) {
4852 @@ -2708,10 +2708,10 @@ static status_t writeSymbolClass(
4853 if (!haveComment) {
4854 haveComment = true;
4855 fprintf(fp,
4856 - "%s/** %s\n", getIndentSpace(indent), cmt.string());
4857 + "%s/** %s\n", getIndentSpace(indent), cmt.c_str());
4858 } else {
4859 fprintf(fp,
4860 - "%s %s\n", getIndentSpace(indent), cmt.string());
4861 + "%s %s\n", getIndentSpace(indent), cmt.c_str());
4862 }
4863 }
4864 if (haveComment) {
4865 @@ -2720,7 +2720,7 @@ static status_t writeSymbolClass(
4866 ann.printAnnotations(fp, getIndentSpace(indent));
4867 fprintf(fp, id_format,
4868 getIndentSpace(indent),
4869 - flattenSymbol(name8).string(), (int)sym.int32Val);
4870 + flattenSymbol(name8).c_str(), (int)sym.int32Val);
4871 }
4872
4873 for (i=0; i<N; i++) {
4874 @@ -2740,13 +2740,13 @@ static status_t writeSymbolClass(
4875 fprintf(fp,
4876 "%s/** %s\n"
4877 "%s */\n",
4878 - getIndentSpace(indent), cmt.string(),
4879 + getIndentSpace(indent), cmt.c_str(),
4880 getIndentSpace(indent));
4881 }
4882 ann.printAnnotations(fp, getIndentSpace(indent));
4883 fprintf(fp, "%spublic static final String %s=\"%s\";\n",
4884 getIndentSpace(indent),
4885 - flattenSymbol(name8).string(), sym.stringVal.string());
4886 + flattenSymbol(name8).c_str(), sym.stringVal.c_str());
4887 }
4888
4889 sp<AaptSymbols> styleableSymbols;
4890 @@ -2805,8 +2805,8 @@ static status_t writeTextSymbolClass(
4891
4892 String8 name8(sym.name);
4893 fprintf(fp, "int %s %s 0x%08x\n",
4894 - className.string(),
4895 - flattenSymbol(name8).string(), (int)sym.int32Val);
4896 + className.c_str(),
4897 + flattenSymbol(name8).c_str(), (int)sym.int32Val);
4898 }
4899
4900 N = symbols->getNestedSymbols().size();
4901 @@ -2844,7 +2844,7 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets,
4902
4903 if (bundle->getMakePackageDirs()) {
4904 const String8& pkg(package);
4905 - const char* last = pkg.string();
4906 + const char* last = pkg.c_str();
4907 const char* s = last-1;
4908 do {
4909 s++;
4910 @@ -2852,9 +2852,9 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets,
4911 String8 part(last, s-last);
4912 dest.appendPath(part);
4913 #ifdef _WIN32
4914 - _mkdir(dest.string());
4915 + _mkdir(dest.c_str());
4916 #else
4917 - mkdir(dest.string(), S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP);
4918 + mkdir(dest.c_str(), S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP);
4919 #endif
4920 last = s+1;
4921 }
4922 @@ -2862,14 +2862,14 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets,
4923 }
4924 dest.appendPath(className);
4925 dest.append(".java");
4926 - FILE* fp = fopen(dest.string(), "w+");
4927 + FILE* fp = fopen(dest.c_str(), "w+");
4928 if (fp == NULL) {
4929 fprintf(stderr, "ERROR: Unable to open class file %s: %s\n",
4930 - dest.string(), strerror(errno));
4931 + dest.c_str(), strerror(errno));
4932 return UNKNOWN_ERROR;
4933 }
4934 if (bundle->getVerbose()) {
4935 - printf(" Writing symbols for class %s.\n", className.string());
4936 + printf(" Writing symbols for class %s.\n", className.c_str());
4937 }
4938
4939 fprintf(fp,
4940 @@ -2880,7 +2880,7 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets,
4941 " * should not be modified by hand.\n"
4942 " */\n"
4943 "\n"
4944 - "package %s;\n\n", package.string());
4945 + "package %s;\n\n", package.c_str());
4946
4947 status_t err = writeSymbolClass(fp, assets, includePrivate, symbols,
4948 className, 0, bundle->getNonConstantId(), emitCallback);
4949 @@ -2894,14 +2894,14 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets,
4950 textDest.appendPath(className);
4951 textDest.append(".txt");
4952
4953 - FILE* fp = fopen(textDest.string(), "w+");
4954 + FILE* fp = fopen(textDest.c_str(), "w+");
4955 if (fp == NULL) {
4956 fprintf(stderr, "ERROR: Unable to open text symbol file %s: %s\n",
4957 - textDest.string(), strerror(errno));
4958 + textDest.c_str(), strerror(errno));
4959 return UNKNOWN_ERROR;
4960 }
4961 if (bundle->getVerbose()) {
4962 - printf(" Writing text symbols for class %s.\n", className.string());
4963 + printf(" Writing text symbols for class %s.\n", className.c_str());
4964 }
4965
4966 status_t err = writeTextSymbolClass(fp, assets, includePrivate, symbols,
4967 @@ -2919,8 +2919,8 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets,
4968 String8 dependencyFile(bundle->getRClassDir());
4969 dependencyFile.appendPath("R.java.d");
4970
4971 - FILE *fp = fopen(dependencyFile.string(), "a");
4972 - fprintf(fp,"%s \\\n", dest.string());
4973 + FILE *fp = fopen(dependencyFile.c_str(), "a");
4974 + fprintf(fp,"%s \\\n", dest.c_str());
4975 fclose(fp);
4976 }
4977 }
4978 @@ -2956,7 +2956,7 @@ addProguardKeepRule(ProguardKeepSet* keep, const String8& inClassName,
4979 // asdf --> package.asdf
4980 // .asdf .a.b --> package.asdf package.a.b
4981 // asdf.adsf --> asdf.asdf
4982 - const char* p = className.string();
4983 + const char* p = className.c_str();
4984 const char* q = strchr(p, '.');
4985 if (p == q) {
4986 className = pkg;
4987 @@ -3023,7 +3023,7 @@ writeProguardForAndroidManifest(ProguardKeepSet* keep, const sp<AaptAssets>& ass
4988
4989 if (assGroup->getFiles().size() != 1) {
4990 fprintf(stderr, "warning: Multiple AndroidManifest.xml files found, using %s\n",
4991 - assGroup->getFiles().valueAt(0)->getPrintableSource().string());
4992 + assGroup->getFiles().valueAt(0)->getPrintableSource().c_str());
4993 }
4994
4995 assFile = assGroup->getFiles().valueAt(0);
4996 @@ -3048,7 +3048,7 @@ writeProguardForAndroidManifest(ProguardKeepSet* keep, const sp<AaptAssets>& ass
4997 }
4998 depth++;
4999 String8 tag(tree.getElementName(&len));
5000 - // printf("Depth %d tag %s\n", depth, tag.string());
5001 + // printf("Depth %d tag %s\n", depth, tag.c_str());
5002 bool keepTag = false;
5003 if (depth == 1) {
5004 if (tag != "manifest") {
5005 @@ -3065,7 +3065,7 @@ writeProguardForAndroidManifest(ProguardKeepSet* keep, const sp<AaptAssets>& ass
5006 "http://schemas.android.com/apk/res/android",
5007 "backupAgent", &error);
5008 if (agent.length() > 0) {
5009 - addProguardKeepRule(keep, agent, pkg.string(),
5010 + addProguardKeepRule(keep, agent, pkg.c_str(),
5011 assFile->getPrintableSource(), tree.getLineNumber());
5012 }
5013
5014 @@ -3073,7 +3073,7 @@ writeProguardForAndroidManifest(ProguardKeepSet* keep, const sp<AaptAssets>& ass
5015 defaultProcess = AaptXml::getAttribute(tree,
5016 "http://schemas.android.com/apk/res/android", "process", &error);
5017 if (error != "") {
5018 - fprintf(stderr, "ERROR: %s\n", error.string());
5019 + fprintf(stderr, "ERROR: %s\n", error.c_str());
5020 return -1;
5021 }
5022 }
5023 @@ -3089,7 +3089,7 @@ writeProguardForAndroidManifest(ProguardKeepSet* keep, const sp<AaptAssets>& ass
5024 String8 componentProcess = AaptXml::getAttribute(tree,
5025 "http://schemas.android.com/apk/res/android", "process", &error);
5026 if (error != "") {
5027 - fprintf(stderr, "ERROR: %s\n", error.string());
5028 + fprintf(stderr, "ERROR: %s\n", error.c_str());
5029 return -1;
5030 }
5031
5032 @@ -3103,14 +3103,14 @@ writeProguardForAndroidManifest(ProguardKeepSet* keep, const sp<AaptAssets>& ass
5033 String8 name = AaptXml::getAttribute(tree,
5034 "http://schemas.android.com/apk/res/android", "name", &error);
5035 if (error != "") {
5036 - fprintf(stderr, "ERROR: %s\n", error.string());
5037 + fprintf(stderr, "ERROR: %s\n", error.c_str());
5038 return -1;
5039 }
5040
5041 keepTag = name.length() > 0;
5042
5043 if (keepTag) {
5044 - addProguardKeepRule(keep, name, pkg.string(),
5045 + addProguardKeepRule(keep, name, pkg.c_str(),
5046 assFile->getPrintableSource(), tree.getLineNumber());
5047 }
5048 }
5049 @@ -3170,7 +3170,7 @@ writeProguardForXml(ProguardKeepSet* keep, const sp<AaptFile>& layoutFile,
5050 String8 tag(tree.getElementName(&len));
5051
5052 // If there is no '.', we'll assume that it's one of the built in names.
5053 - if (strchr(tag.string(), '.')) {
5054 + if (strchr(tag.c_str(), '.')) {
5055 addProguardKeepRule(keep, tag, NULL,
5056 layoutFile->getPrintableSource(), tree.getLineNumber());
5057 } else if (tagAttrPairs != NULL) {
5058 @@ -3183,8 +3183,8 @@ writeProguardForXml(ProguardKeepSet* keep, const sp<AaptFile>& layoutFile,
5059 ssize_t attrIndex = tree.indexOfAttribute(nsAttr.ns, nsAttr.attr);
5060 if (attrIndex < 0) {
5061 // fprintf(stderr, "%s:%d: <%s> does not have attribute %s:%s.\n",
5062 - // layoutFile->getPrintableSource().string(), tree.getLineNumber(),
5063 - // tag.string(), nsAttr.ns, nsAttr.attr);
5064 + // layoutFile->getPrintableSource().c_str(), tree.getLineNumber(),
5065 + // tag.c_str(), nsAttr.ns, nsAttr.attr);
5066 } else {
5067 size_t len;
5068 addProguardKeepRule(keep,
5069 @@ -3242,7 +3242,7 @@ writeProguardForLayouts(ProguardKeepSet* keep, const sp<AaptAssets>& assets)
5070
5071 // tag:attribute pairs that should be checked in transition files.
5072 KeyedVector<String8, Vector<NamespaceAttributePair> > kTransitionTagAttrPairs;
5073 - addTagAttrPair(&kTransitionTagAttrPairs, kTransition.string(), NULL, kClass);
5074 + addTagAttrPair(&kTransitionTagAttrPairs, kTransition.c_str(), NULL, kClass);
5075 addTagAttrPair(&kTransitionTagAttrPairs, "pathMotion", NULL, kClass);
5076
5077 const Vector<sp<AaptDir> >& dirs = assets->resDirs();
5078 @@ -3252,16 +3252,16 @@ writeProguardForLayouts(ProguardKeepSet* keep, const sp<AaptAssets>& assets)
5079 const String8& dirName = d->getLeaf();
5080 Vector<String8> startTags;
5081 const KeyedVector<String8, Vector<NamespaceAttributePair> >* tagAttrPairs = NULL;
5082 - if ((dirName == String8("layout")) || (strncmp(dirName.string(), "layout-", 7) == 0)) {
5083 + if ((dirName == String8("layout")) || (strncmp(dirName.c_str(), "layout-", 7) == 0)) {
5084 tagAttrPairs = &kLayoutTagAttrPairs;
5085 - } else if ((dirName == String8("xml")) || (strncmp(dirName.string(), "xml-", 4) == 0)) {
5086 + } else if ((dirName == String8("xml")) || (strncmp(dirName.c_str(), "xml-", 4) == 0)) {
5087 startTags.add(String8("PreferenceScreen"));
5088 startTags.add(String8("preference-headers"));
5089 tagAttrPairs = &kXmlTagAttrPairs;
5090 - } else if ((dirName == String8("menu")) || (strncmp(dirName.string(), "menu-", 5) == 0)) {
5091 + } else if ((dirName == String8("menu")) || (strncmp(dirName.c_str(), "menu-", 5) == 0)) {
5092 startTags.add(String8("menu"));
5093 tagAttrPairs = NULL;
5094 - } else if (dirName == kTransition || (strncmp(dirName.string(), kTransitionPrefix.string(),
5095 + } else if (dirName == kTransition || (strncmp(dirName.c_str(), kTransitionPrefix.c_str(),
5096 kTransitionPrefix.size()) == 0)) {
5097 tagAttrPairs = &kTransitionTagAttrPairs;
5098 } else {
5099 @@ -3307,9 +3307,9 @@ writeProguardSpec(const char* filename, const ProguardKeepSet& keep, status_t er
5100 const SortedVector<String8>& locations = rules.valueAt(i);
5101 const size_t M = locations.size();
5102 for (size_t j=0; j<M; j++) {
5103 - fprintf(fp, "# %s\n", locations.itemAt(j).string());
5104 + fprintf(fp, "# %s\n", locations.itemAt(j).c_str());
5105 }
5106 - fprintf(fp, "%s\n\n", rules.keyAt(i).string());
5107 + fprintf(fp, "%s\n\n", rules.keyAt(i).c_str());
5108 }
5109 fclose(fp);
5110
5111 @@ -3366,7 +3366,7 @@ status_t writePathsToFile(const sp<FilePathStore>& files, FILE* fp)
5112 status_t deps = -1;
5113 for (size_t file_i = 0; file_i < files->size(); ++file_i) {
5114 // Add the full file path to the dependency file
5115 - fprintf(fp, "%s \\\n", files->itemAt(file_i).string());
5116 + fprintf(fp, "%s \\\n", files->itemAt(file_i).c_str());
5117 deps++;
5118 }
5119 return deps;
5120 diff --git a/tools/aapt/ResourceFilter.cpp b/tools/aapt/ResourceFilter.cpp
5121 index ed06f605eaeb..cc8dce7e9f3e 100644
5122 --- a/tools/aapt/ResourceFilter.cpp
5123 +++ b/tools/aapt/ResourceFilter.cpp
5124 @@ -32,7 +32,7 @@ WeakResourceFilter::parse(const String8& str)
5125 // only specify locale in the standard 'en_US' format.
5126 val.writeTo(&entry.first);
5127 } else if (!AaptConfig::parse(part, &entry.first)) {
5128 - fprintf(stderr, "Invalid configuration: %s\n", part.string());
5129 + fprintf(stderr, "Invalid configuration: %s\n", part.c_str());
5130 return UNKNOWN_ERROR;
5131 }
5132
5133 @@ -43,7 +43,7 @@ WeakResourceFilter::parse(const String8& str)
5134
5135 // Ignore any densities. Those are best handled in --preferred-density
5136 if ((entry.second & ResTable_config::CONFIG_DENSITY) != 0) {
5137 - fprintf(stderr, "warning: ignoring flag -c %s. Use --preferred-density instead.\n", entry.first.toString().string());
5138 + fprintf(stderr, "warning: ignoring flag -c %s. Use --preferred-density instead.\n", entry.first.toString().c_str());
5139 entry.first.density = 0;
5140 entry.second &= ~ResTable_config::CONFIG_DENSITY;
5141 }
5142 @@ -148,7 +148,7 @@ StrongResourceFilter::parse(const String8& str) {
5143 mConfigs.clear();
5144 for (size_t i = 0; i < configStrs.size(); i++) {
5145 if (!AaptConfig::parse(configStrs[i], &config)) {
5146 - fprintf(stderr, "Invalid configuration: %s\n", configStrs[i].string());
5147 + fprintf(stderr, "Invalid configuration: %s\n", configStrs[i].c_str());
5148 return UNKNOWN_ERROR;
5149 }
5150 mConfigs.insert(config);
5151 diff --git a/tools/aapt/ResourceIdCache.cpp b/tools/aapt/ResourceIdCache.cpp
5152 index 8835fb0130a3..1c7788d70053 100644
5153 --- a/tools/aapt/ResourceIdCache.cpp
5154 +++ b/tools/aapt/ResourceIdCache.cpp
5155 @@ -37,7 +37,7 @@ static inline uint32_t hashround(uint32_t hash, int c) {
5156
5157 static uint32_t hash(const android::String16& hashableString) {
5158 uint32_t hash = 5381;
5159 - const char16_t* str = hashableString.string();
5160 + const char16_t* str = hashableString.c_str();
5161 while (int c = *str++) hash = hashround(hash, c);
5162 return hash;
5163 }
5164 diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
5165 index 47750fc11a6e..3abb89acd23b 100644
5166 --- a/tools/aapt/ResourceTable.cpp
5167 +++ b/tools/aapt/ResourceTable.cpp
5168 @@ -361,10 +361,10 @@ static status_t compileAttribute(const sp<AaptFile>& in,
5169 ssize_t typeIdx = block.indexOfAttribute(NULL, "format");
5170 if (typeIdx >= 0) {
5171 String16 typeStr = String16(block.getAttributeStringValue(typeIdx, &len));
5172 - attr.type = parse_flags(typeStr.string(), typeStr.size(), gFormatFlags);
5173 + attr.type = parse_flags(typeStr.c_str(), typeStr.size(), gFormatFlags);
5174 if (attr.type == 0) {
5175 attr.sourcePos.error("Tag <attr> 'format' attribute value \"%s\" not valid\n",
5176 - String8(typeStr).string());
5177 + String8(typeStr).c_str());
5178 attr.hasErrors = true;
5179 }
5180 attr.createIfNeeded(outTable);
5181 @@ -374,14 +374,14 @@ static status_t compileAttribute(const sp<AaptFile>& in,
5182 attr.createIfNeeded(outTable);
5183 }
5184
5185 - //printf("Attribute %s: type=0x%08x\n", String8(attr.ident).string(), attr.type);
5186 + //printf("Attribute %s: type=0x%08x\n", String8(attr.ident).c_str(), attr.type);
5187
5188 ssize_t minIdx = block.indexOfAttribute(NULL, "min");
5189 if (minIdx >= 0) {
5190 String16 val = String16(block.getAttributeStringValue(minIdx, &len));
5191 - if (!ResTable::stringToInt(val.string(), val.size(), NULL)) {
5192 + if (!ResTable::stringToInt(val.c_str(), val.size(), NULL)) {
5193 attr.sourcePos.error("Tag <attr> 'min' attribute must be a number, not \"%s\"\n",
5194 - String8(val).string());
5195 + String8(val).c_str());
5196 attr.hasErrors = true;
5197 }
5198 attr.createIfNeeded(outTable);
5199 @@ -397,9 +397,9 @@ static status_t compileAttribute(const sp<AaptFile>& in,
5200 ssize_t maxIdx = block.indexOfAttribute(NULL, "max");
5201 if (maxIdx >= 0) {
5202 String16 val = String16(block.getAttributeStringValue(maxIdx, &len));
5203 - if (!ResTable::stringToInt(val.string(), val.size(), NULL)) {
5204 + if (!ResTable::stringToInt(val.c_str(), val.size(), NULL)) {
5205 attr.sourcePos.error("Tag <attr> 'max' attribute must be a number, not \"%s\"\n",
5206 - String8(val).string());
5207 + String8(val).c_str());
5208 attr.hasErrors = true;
5209 }
5210 attr.createIfNeeded(outTable);
5211 @@ -422,7 +422,7 @@ static status_t compileAttribute(const sp<AaptFile>& in,
5212 uint32_t l10n_required = parse_flags(str, len, l10nRequiredFlags, &error);
5213 if (error) {
5214 attr.sourcePos.error("Tag <attr> 'localization' attribute value \"%s\" not valid\n",
5215 - String8(str).string());
5216 + String8(str).c_str());
5217 attr.hasErrors = true;
5218 }
5219 attr.createIfNeeded(outTable);
5220 @@ -442,14 +442,14 @@ static status_t compileAttribute(const sp<AaptFile>& in,
5221 while ((code=block.next()) != ResXMLTree::END_DOCUMENT && code != ResXMLTree::BAD_DOCUMENT) {
5222 if (code == ResXMLTree::START_TAG) {
5223 uint32_t localType = 0;
5224 - if (strcmp16(block.getElementName(&len), enum16.string()) == 0) {
5225 + if (strcmp16(block.getElementName(&len), enum16.c_str()) == 0) {
5226 localType = ResTable_map::TYPE_ENUM;
5227 - } else if (strcmp16(block.getElementName(&len), flag16.string()) == 0) {
5228 + } else if (strcmp16(block.getElementName(&len), flag16.c_str()) == 0) {
5229 localType = ResTable_map::TYPE_FLAGS;
5230 } else {
5231 SourcePos(in->getPrintableSource(), block.getLineNumber())
5232 .error("Tag <%s> can not appear inside <attr>, only <enum> or <flag>\n",
5233 - String8(block.getElementName(&len)).string());
5234 + String8(block.getElementName(&len)).c_str());
5235 return UNKNOWN_ERROR;
5236 }
5237
5238 @@ -505,11 +505,11 @@ static status_t compileAttribute(const sp<AaptFile>& in,
5239 .error("A 'value' attribute is required for <enum> or <flag>\n");
5240 attr.hasErrors = true;
5241 }
5242 - if (!attr.hasErrors && !ResTable::stringToInt(value.string(), value.size(), NULL)) {
5243 + if (!attr.hasErrors && !ResTable::stringToInt(value.c_str(), value.size(), NULL)) {
5244 SourcePos(in->getPrintableSource(), block.getLineNumber())
5245 .error("Tag <enum> or <flag> 'value' attribute must be a number,"
5246 " not \"%s\"\n",
5247 - String8(value).string());
5248 + String8(value).c_str());
5249 attr.hasErrors = true;
5250 }
5251
5252 @@ -546,21 +546,21 @@ static status_t compileAttribute(const sp<AaptFile>& in,
5253 }
5254 }
5255 } else if (code == ResXMLTree::END_TAG) {
5256 - if (strcmp16(block.getElementName(&len), attr16.string()) == 0) {
5257 + if (strcmp16(block.getElementName(&len), attr16.c_str()) == 0) {
5258 break;
5259 }
5260 if ((attr.type&ResTable_map::TYPE_ENUM) != 0) {
5261 - if (strcmp16(block.getElementName(&len), enum16.string()) != 0) {
5262 + if (strcmp16(block.getElementName(&len), enum16.c_str()) != 0) {
5263 SourcePos(in->getPrintableSource(), block.getLineNumber())
5264 .error("Found tag </%s> where </enum> is expected\n",
5265 - String8(block.getElementName(&len)).string());
5266 + String8(block.getElementName(&len)).c_str());
5267 return UNKNOWN_ERROR;
5268 }
5269 } else {
5270 - if (strcmp16(block.getElementName(&len), flag16.string()) != 0) {
5271 + if (strcmp16(block.getElementName(&len), flag16.c_str()) != 0) {
5272 SourcePos(in->getPrintableSource(), block.getLineNumber())
5273 .error("Found tag </%s> where </flag> is expected\n",
5274 - String8(block.getElementName(&len)).string());
5275 + String8(block.getElementName(&len)).c_str());
5276 return UNKNOWN_ERROR;
5277 }
5278 }
5279 @@ -606,7 +606,7 @@ status_t parseAndAddBag(Bundle* bundle,
5280
5281 String16 str;
5282 Vector<StringPool::entry_style_span> spans;
5283 - err = parseStyledString(bundle, in->getPrintableSource().string(),
5284 + err = parseStyledString(bundle, in->getPrintableSource().c_str(),
5285 block, item16, &str, &spans, isFormatted,
5286 pseudolocalize);
5287 if (err != NO_ERROR) {
5288 @@ -619,10 +619,10 @@ status_t parseAndAddBag(Bundle* bundle,
5289 config.language[0], config.language[1],
5290 config.country[0], config.country[1],
5291 config.orientation, config.density,
5292 - String8(parentIdent).string(),
5293 - String8(ident).string(),
5294 - String8(itemIdent).string(),
5295 - String8(str).string());
5296 + String8(parentIdent).c_str(),
5297 + String8(ident).c_str(),
5298 + String8(itemIdent).c_str(),
5299 + String8(str).c_str());
5300 }
5301
5302 err = outTable->addBag(SourcePos(in->getPrintableSource(), block->getLineNumber()),
5303 @@ -636,8 +636,8 @@ status_t parseAndAddBag(Bundle* bundle,
5304 * haystack, false otherwise.
5305 */
5306 bool isInProductList(const String16& needle, const String16& haystack) {
5307 - const char16_t *needle2 = needle.string();
5308 - const char16_t *haystack2 = haystack.string();
5309 + const char16_t *needle2 = needle.c_str();
5310 + const char16_t *haystack2 = haystack.c_str();
5311 size_t needlesize = needle.size();
5312
5313 while (*haystack2 != '\0') {
5314 @@ -703,7 +703,7 @@ status_t parseAndAddEntry(Bundle* bundle,
5315
5316 String16 str;
5317 Vector<StringPool::entry_style_span> spans;
5318 - err = parseStyledString(bundle, in->getPrintableSource().string(), block,
5319 + err = parseStyledString(bundle, in->getPrintableSource().c_str(), block,
5320 curTag, &str, curIsStyled ? &spans : NULL,
5321 isFormatted, pseudolocalize);
5322
5323 @@ -730,7 +730,7 @@ status_t parseAndAddEntry(Bundle* bundle,
5324 */
5325
5326 if (bundleProduct[0] == '\0') {
5327 - if (strcmp16(String16("default").string(), product.string()) != 0) {
5328 + if (strcmp16(String16("default").c_str(), product.c_str()) != 0) {
5329 /*
5330 * This string has a product other than 'default'. Do not add it,
5331 * but record it so that if we do not see the same string with
5332 @@ -750,7 +750,7 @@ status_t parseAndAddEntry(Bundle* bundle,
5333
5334 if (isInProductList(product, String16(bundleProduct))) {
5335 ;
5336 - } else if (strcmp16(String16("default").string(), product.string()) == 0 &&
5337 + } else if (strcmp16(String16("default").c_str(), product.c_str()) == 0 &&
5338 !outTable->hasBagOrEntry(myPackage, curType, ident, config)) {
5339 ;
5340 } else {
5341 @@ -764,7 +764,7 @@ status_t parseAndAddEntry(Bundle* bundle,
5342 config.language[0], config.language[1],
5343 config.country[0], config.country[1],
5344 config.orientation, config.density,
5345 - String8(ident).string(), String8(str).string());
5346 + String8(ident).c_str(), String8(str).c_str());
5347 }
5348
5349 err = outTable->addEntry(SourcePos(in->getPrintableSource(), block->getLineNumber()),
5350 @@ -847,7 +847,7 @@ status_t compileResourceFile(Bundle* bundle,
5351 bool hasErrors = false;
5352
5353 bool fileIsTranslatable = true;
5354 - if (strstr(in->getPrintableSource().string(), "donottranslate") != NULL) {
5355 + if (strstr(in->getPrintableSource().c_str(), "donottranslate") != NULL) {
5356 fileIsTranslatable = false;
5357 }
5358
5359 @@ -869,9 +869,9 @@ status_t compileResourceFile(Bundle* bundle,
5360 "No start tag found\n");
5361 return UNKNOWN_ERROR;
5362 }
5363 - if (strcmp16(block.getElementName(&len), resources16.string()) != 0) {
5364 + if (strcmp16(block.getElementName(&len), resources16.c_str()) != 0) {
5365 SourcePos(in->getPrintableSource(), block.getLineNumber()).error(
5366 - "Invalid start tag %s\n", String8(block.getElementName(&len)).string());
5367 + "Invalid start tag %s\n", String8(block.getElementName(&len)).c_str());
5368 return UNKNOWN_ERROR;
5369 }
5370
5371 @@ -900,7 +900,7 @@ status_t compileResourceFile(Bundle* bundle,
5372 SourcePos(in->getPrintableSource(), 0).warning(
5373 "Resource file %s is skipped as pseudolocalization"
5374 " was done automatically.",
5375 - in->getPrintableSource().string());
5376 + in->getPrintableSource().c_str());
5377 return NO_ERROR;
5378 }
5379
5380 @@ -917,29 +917,29 @@ status_t compileResourceFile(Bundle* bundle,
5381 bool curIsFormatted = fileIsTranslatable;
5382 bool localHasErrors = false;
5383
5384 - if (strcmp16(block.getElementName(&len), skip16.string()) == 0) {
5385 + if (strcmp16(block.getElementName(&len), skip16.c_str()) == 0) {
5386 while ((code=block.next()) != ResXMLTree::END_DOCUMENT
5387 && code != ResXMLTree::BAD_DOCUMENT) {
5388 if (code == ResXMLTree::END_TAG) {
5389 - if (strcmp16(block.getElementName(&len), skip16.string()) == 0) {
5390 + if (strcmp16(block.getElementName(&len), skip16.c_str()) == 0) {
5391 break;
5392 }
5393 }
5394 }
5395 continue;
5396
5397 - } else if (strcmp16(block.getElementName(&len), eat_comment16.string()) == 0) {
5398 + } else if (strcmp16(block.getElementName(&len), eat_comment16.c_str()) == 0) {
5399 while ((code=block.next()) != ResXMLTree::END_DOCUMENT
5400 && code != ResXMLTree::BAD_DOCUMENT) {
5401 if (code == ResXMLTree::END_TAG) {
5402 - if (strcmp16(block.getElementName(&len), eat_comment16.string()) == 0) {
5403 + if (strcmp16(block.getElementName(&len), eat_comment16.c_str()) == 0) {
5404 break;
5405 }
5406 }
5407 }
5408 continue;
5409
5410 - } else if (strcmp16(block.getElementName(&len), public16.string()) == 0) {
5411 + } else if (strcmp16(block.getElementName(&len), public16.c_str()) == 0) {
5412 SourcePos srcPos(in->getPrintableSource(), block.getLineNumber());
5413
5414 String16 type;
5415 @@ -965,7 +965,7 @@ status_t compileResourceFile(Bundle* bundle,
5416 Res_value identValue;
5417 if (!ResTable::stringToInt(identStr, len, &identValue)) {
5418 srcPos.error("Given 'id' attribute is not an integer: %s\n",
5419 - String8(block.getAttributeStringValue(identIdx, &len)).string());
5420 + String8(block.getAttributeStringValue(identIdx, &len)).c_str());
5421 hasErrors = localHasErrors = true;
5422 } else {
5423 ident = identValue.data;
5424 @@ -1004,14 +1004,14 @@ status_t compileResourceFile(Bundle* bundle,
5425
5426 while ((code=block.next()) != ResXMLTree::END_DOCUMENT && code != ResXMLTree::BAD_DOCUMENT) {
5427 if (code == ResXMLTree::END_TAG) {
5428 - if (strcmp16(block.getElementName(&len), public16.string()) == 0) {
5429 + if (strcmp16(block.getElementName(&len), public16.c_str()) == 0) {
5430 break;
5431 }
5432 }
5433 }
5434 continue;
5435
5436 - } else if (strcmp16(block.getElementName(&len), public_padding16.string()) == 0) {
5437 + } else if (strcmp16(block.getElementName(&len), public_padding16.c_str()) == 0) {
5438 SourcePos srcPos(in->getPrintableSource(), block.getLineNumber());
5439
5440 String16 type;
5441 @@ -1037,7 +1037,7 @@ status_t compileResourceFile(Bundle* bundle,
5442 Res_value startValue;
5443 if (!ResTable::stringToInt(startStr, len, &startValue)) {
5444 srcPos.error("Given 'start' attribute is not an integer: %s\n",
5445 - String8(block.getAttributeStringValue(startIdx, &len)).string());
5446 + String8(block.getAttributeStringValue(startIdx, &len)).c_str());
5447 hasErrors = localHasErrors = true;
5448 } else {
5449 start = startValue.data;
5450 @@ -1057,7 +1057,7 @@ status_t compileResourceFile(Bundle* bundle,
5451 Res_value endValue;
5452 if (!ResTable::stringToInt(endStr, len, &endValue)) {
5453 srcPos.error("Given 'end' attribute is not an integer: %s\n",
5454 - String8(block.getAttributeStringValue(endIdx, &len)).string());
5455 + String8(block.getAttributeStringValue(endIdx, &len)).c_str());
5456 hasErrors = localHasErrors = true;
5457 } else {
5458 end = endValue.data;
5459 @@ -1114,14 +1114,14 @@ status_t compileResourceFile(Bundle* bundle,
5460
5461 while ((code=block.next()) != ResXMLTree::END_DOCUMENT && code != ResXMLTree::BAD_DOCUMENT) {
5462 if (code == ResXMLTree::END_TAG) {
5463 - if (strcmp16(block.getElementName(&len), public_padding16.string()) == 0) {
5464 + if (strcmp16(block.getElementName(&len), public_padding16.c_str()) == 0) {
5465 break;
5466 }
5467 }
5468 }
5469 continue;
5470
5471 - } else if (strcmp16(block.getElementName(&len), private_symbols16.string()) == 0) {
5472 + } else if (strcmp16(block.getElementName(&len), private_symbols16.c_str()) == 0) {
5473 String16 pkg;
5474 ssize_t pkgIdx = block.indexOfAttribute(NULL, "package");
5475 if (pkgIdx < 0) {
5476 @@ -1144,14 +1144,14 @@ status_t compileResourceFile(Bundle* bundle,
5477
5478 while ((code=block.next()) != ResXMLTree::END_DOCUMENT && code != ResXMLTree::BAD_DOCUMENT) {
5479 if (code == ResXMLTree::END_TAG) {
5480 - if (strcmp16(block.getElementName(&len), private_symbols16.string()) == 0) {
5481 + if (strcmp16(block.getElementName(&len), private_symbols16.c_str()) == 0) {
5482 break;
5483 }
5484 }
5485 }
5486 continue;
5487
5488 - } else if (strcmp16(block.getElementName(&len), java_symbol16.string()) == 0) {
5489 + } else if (strcmp16(block.getElementName(&len), java_symbol16.c_str()) == 0) {
5490 SourcePos srcPos(in->getPrintableSource(), block.getLineNumber());
5491
5492 String16 type;
5493 @@ -1186,7 +1186,7 @@ status_t compileResourceFile(Bundle* bundle,
5494
5495 while ((code=block.next()) != ResXMLTree::END_DOCUMENT && code != ResXMLTree::BAD_DOCUMENT) {
5496 if (code == ResXMLTree::END_TAG) {
5497 - if (strcmp16(block.getElementName(&len), java_symbol16.string()) == 0) {
5498 + if (strcmp16(block.getElementName(&len), java_symbol16.c_str()) == 0) {
5499 break;
5500 }
5501 }
5502 @@ -1194,7 +1194,7 @@ status_t compileResourceFile(Bundle* bundle,
5503 continue;
5504
5505
5506 - } else if (strcmp16(block.getElementName(&len), add_resource16.string()) == 0) {
5507 + } else if (strcmp16(block.getElementName(&len), add_resource16.c_str()) == 0) {
5508 SourcePos srcPos(in->getPrintableSource(), block.getLineNumber());
5509
5510 String16 typeName;
5511 @@ -1217,14 +1217,14 @@ status_t compileResourceFile(Bundle* bundle,
5512
5513 while ((code=block.next()) != ResXMLTree::END_DOCUMENT && code != ResXMLTree::BAD_DOCUMENT) {
5514 if (code == ResXMLTree::END_TAG) {
5515 - if (strcmp16(block.getElementName(&len), add_resource16.string()) == 0) {
5516 + if (strcmp16(block.getElementName(&len), add_resource16.c_str()) == 0) {
5517 break;
5518 }
5519 }
5520 }
5521 continue;
5522
5523 - } else if (strcmp16(block.getElementName(&len), declare_styleable16.string()) == 0) {
5524 + } else if (strcmp16(block.getElementName(&len), declare_styleable16.c_str()) == 0) {
5525 SourcePos srcPos(in->getPrintableSource(), block.getLineNumber());
5526
5527 String16 ident;
5528 @@ -1258,30 +1258,30 @@ status_t compileResourceFile(Bundle* bundle,
5529
5530 while ((code=block.next()) != ResXMLTree::END_DOCUMENT && code != ResXMLTree::BAD_DOCUMENT) {
5531 if (code == ResXMLTree::START_TAG) {
5532 - if (strcmp16(block.getElementName(&len), skip16.string()) == 0) {
5533 + if (strcmp16(block.getElementName(&len), skip16.c_str()) == 0) {
5534 while ((code=block.next()) != ResXMLTree::END_DOCUMENT
5535 && code != ResXMLTree::BAD_DOCUMENT) {
5536 if (code == ResXMLTree::END_TAG) {
5537 - if (strcmp16(block.getElementName(&len), skip16.string()) == 0) {
5538 + if (strcmp16(block.getElementName(&len), skip16.c_str()) == 0) {
5539 break;
5540 }
5541 }
5542 }
5543 continue;
5544 - } else if (strcmp16(block.getElementName(&len), eat_comment16.string()) == 0) {
5545 + } else if (strcmp16(block.getElementName(&len), eat_comment16.c_str()) == 0) {
5546 while ((code=block.next()) != ResXMLTree::END_DOCUMENT
5547 && code != ResXMLTree::BAD_DOCUMENT) {
5548 if (code == ResXMLTree::END_TAG) {
5549 - if (strcmp16(block.getElementName(&len), eat_comment16.string()) == 0) {
5550 + if (strcmp16(block.getElementName(&len), eat_comment16.c_str()) == 0) {
5551 break;
5552 }
5553 }
5554 }
5555 continue;
5556 - } else if (strcmp16(block.getElementName(&len), attr16.string()) != 0) {
5557 + } else if (strcmp16(block.getElementName(&len), attr16.c_str()) != 0) {
5558 SourcePos(in->getPrintableSource(), block.getLineNumber()).error(
5559 "Tag <%s> can not appear inside <declare-styleable>, only <attr>\n",
5560 - String8(block.getElementName(&len)).string());
5561 + String8(block.getElementName(&len)).c_str());
5562 return UNKNOWN_ERROR;
5563 }
5564
5565 @@ -1297,30 +1297,30 @@ status_t compileResourceFile(Bundle* bundle,
5566 SourcePos srcPos(String8(in->getPrintableSource()), block.getLineNumber());
5567 symbols->addSymbol(String8(itemIdent), 0, srcPos);
5568 symbols->appendComment(String8(itemIdent), comment, srcPos);
5569 - //printf("Attribute %s comment: %s\n", String8(itemIdent).string(),
5570 - // String8(comment).string());
5571 + //printf("Attribute %s comment: %s\n", String8(itemIdent).c_str(),
5572 + // String8(comment).c_str());
5573 }
5574 } else if (code == ResXMLTree::END_TAG) {
5575 - if (strcmp16(block.getElementName(&len), declare_styleable16.string()) == 0) {
5576 + if (strcmp16(block.getElementName(&len), declare_styleable16.c_str()) == 0) {
5577 break;
5578 }
5579
5580 SourcePos(in->getPrintableSource(), block.getLineNumber()).error(
5581 "Found tag </%s> where </attr> is expected\n",
5582 - String8(block.getElementName(&len)).string());
5583 + String8(block.getElementName(&len)).c_str());
5584 return UNKNOWN_ERROR;
5585 }
5586 }
5587 continue;
5588
5589 - } else if (strcmp16(block.getElementName(&len), attr16.string()) == 0) {
5590 + } else if (strcmp16(block.getElementName(&len), attr16.c_str()) == 0) {
5591 err = compileAttribute(in, block, myPackage, outTable, NULL);
5592 if (err != NO_ERROR) {
5593 hasErrors = true;
5594 }
5595 continue;
5596
5597 - } else if (strcmp16(block.getElementName(&len), item16.string()) == 0) {
5598 + } else if (strcmp16(block.getElementName(&len), item16.c_str()) == 0) {
5599 curTag = &item16;
5600 ssize_t attri = block.indexOfAttribute(NULL, "type");
5601 if (attri >= 0) {
5602 @@ -1333,12 +1333,12 @@ status_t compileResourceFile(Bundle* bundle,
5603 if (formatIdx >= 0) {
5604 String16 formatStr = String16(block.getAttributeStringValue(
5605 formatIdx, &len));
5606 - curFormat = parse_flags(formatStr.string(), formatStr.size(),
5607 + curFormat = parse_flags(formatStr.c_str(), formatStr.size(),
5608 gFormatFlags);
5609 if (curFormat == 0) {
5610 SourcePos(in->getPrintableSource(), block.getLineNumber()).error(
5611 "Tag <item> 'format' attribute value \"%s\" not valid\n",
5612 - String8(formatStr).string());
5613 + String8(formatStr).c_str());
5614 hasErrors = localHasErrors = true;
5615 }
5616 }
5617 @@ -1348,7 +1348,7 @@ status_t compileResourceFile(Bundle* bundle,
5618 hasErrors = localHasErrors = true;
5619 }
5620 curIsStyled = true;
5621 - } else if (strcmp16(block.getElementName(&len), string16.string()) == 0) {
5622 + } else if (strcmp16(block.getElementName(&len), string16.c_str()) == 0) {
5623 // Note the existence and locale of every string we process
5624 char rawLocale[RESTABLE_MAX_LOCALE_LEN];
5625 curParams.getBcp47Locale(rawLocale);
5626 @@ -1361,11 +1361,11 @@ status_t compileResourceFile(Bundle* bundle,
5627 for (size_t i = 0; i < n; i++) {
5628 size_t length;
5629 const char16_t* attr = block.getAttributeName(i, &length);
5630 - if (strcmp16(attr, name16.string()) == 0) {
5631 + if (strcmp16(attr, name16.c_str()) == 0) {
5632 name.setTo(block.getAttributeStringValue(i, &length));
5633 - } else if (strcmp16(attr, translatable16.string()) == 0) {
5634 + } else if (strcmp16(attr, translatable16.c_str()) == 0) {
5635 translatable.setTo(block.getAttributeStringValue(i, &length));
5636 - } else if (strcmp16(attr, formatted16.string()) == 0) {
5637 + } else if (strcmp16(attr, formatted16.c_str()) == 0) {
5638 formatted.setTo(block.getAttributeStringValue(i, &length));
5639 }
5640 }
5641 @@ -1380,8 +1380,8 @@ status_t compileResourceFile(Bundle* bundle,
5642 if (locale.size() > 0) {
5643 SourcePos(in->getPrintableSource(), block.getLineNumber()).warning(
5644 "string '%s' marked untranslatable but exists in locale '%s'\n",
5645 - String8(name).string(),
5646 - locale.string());
5647 + String8(name).c_str(),
5648 + locale.c_str());
5649 // hasErrors = localHasErrors = true;
5650 } else {
5651 // Intentionally empty block:
5652 @@ -1407,31 +1407,31 @@ status_t compileResourceFile(Bundle* bundle,
5653 curFormat = ResTable_map::TYPE_REFERENCE|ResTable_map::TYPE_STRING;
5654 curIsStyled = true;
5655 curIsPseudolocalizable = fileIsTranslatable && (translatable != false16);
5656 - } else if (strcmp16(block.getElementName(&len), drawable16.string()) == 0) {
5657 + } else if (strcmp16(block.getElementName(&len), drawable16.c_str()) == 0) {
5658 curTag = &drawable16;
5659 curType = drawable16;
5660 curFormat = ResTable_map::TYPE_REFERENCE|ResTable_map::TYPE_COLOR;
5661 - } else if (strcmp16(block.getElementName(&len), color16.string()) == 0) {
5662 + } else if (strcmp16(block.getElementName(&len), color16.c_str()) == 0) {
5663 curTag = &color16;
5664 curType = color16;
5665 curFormat = ResTable_map::TYPE_REFERENCE|ResTable_map::TYPE_COLOR;
5666 - } else if (strcmp16(block.getElementName(&len), bool16.string()) == 0) {
5667 + } else if (strcmp16(block.getElementName(&len), bool16.c_str()) == 0) {
5668 curTag = &bool16;
5669 curType = bool16;
5670 curFormat = ResTable_map::TYPE_REFERENCE|ResTable_map::TYPE_BOOLEAN;
5671 - } else if (strcmp16(block.getElementName(&len), integer16.string()) == 0) {
5672 + } else if (strcmp16(block.getElementName(&len), integer16.c_str()) == 0) {
5673 curTag = &integer16;
5674 curType = integer16;
5675 curFormat = ResTable_map::TYPE_REFERENCE|ResTable_map::TYPE_INTEGER;
5676 - } else if (strcmp16(block.getElementName(&len), dimen16.string()) == 0) {
5677 + } else if (strcmp16(block.getElementName(&len), dimen16.c_str()) == 0) {
5678 curTag = &dimen16;
5679 curType = dimen16;
5680 curFormat = ResTable_map::TYPE_REFERENCE|ResTable_map::TYPE_DIMENSION;
5681 - } else if (strcmp16(block.getElementName(&len), fraction16.string()) == 0) {
5682 + } else if (strcmp16(block.getElementName(&len), fraction16.c_str()) == 0) {
5683 curTag = &fraction16;
5684 curType = fraction16;
5685 curFormat = ResTable_map::TYPE_REFERENCE|ResTable_map::TYPE_FRACTION;
5686 - } else if (strcmp16(block.getElementName(&len), bag16.string()) == 0) {
5687 + } else if (strcmp16(block.getElementName(&len), bag16.c_str()) == 0) {
5688 curTag = &bag16;
5689 curIsBag = true;
5690 ssize_t attri = block.indexOfAttribute(NULL, "type");
5691 @@ -1442,16 +1442,16 @@ status_t compileResourceFile(Bundle* bundle,
5692 "A 'type' attribute is required for <bag>\n");
5693 hasErrors = localHasErrors = true;
5694 }
5695 - } else if (strcmp16(block.getElementName(&len), style16.string()) == 0) {
5696 + } else if (strcmp16(block.getElementName(&len), style16.c_str()) == 0) {
5697 curTag = &style16;
5698 curType = style16;
5699 curIsBag = true;
5700 - } else if (strcmp16(block.getElementName(&len), plurals16.string()) == 0) {
5701 + } else if (strcmp16(block.getElementName(&len), plurals16.c_str()) == 0) {
5702 curTag = &plurals16;
5703 curType = plurals16;
5704 curIsBag = true;
5705 curIsPseudolocalizable = fileIsTranslatable;
5706 - } else if (strcmp16(block.getElementName(&len), array16.string()) == 0) {
5707 + } else if (strcmp16(block.getElementName(&len), array16.c_str()) == 0) {
5708 curTag = &array16;
5709 curType = array16;
5710 curIsBag = true;
5711 @@ -1460,16 +1460,16 @@ status_t compileResourceFile(Bundle* bundle,
5712 if (formatIdx >= 0) {
5713 String16 formatStr = String16(block.getAttributeStringValue(
5714 formatIdx, &len));
5715 - curFormat = parse_flags(formatStr.string(), formatStr.size(),
5716 + curFormat = parse_flags(formatStr.c_str(), formatStr.size(),
5717 gFormatFlags);
5718 if (curFormat == 0) {
5719 SourcePos(in->getPrintableSource(), block.getLineNumber()).error(
5720 "Tag <array> 'format' attribute value \"%s\" not valid\n",
5721 - String8(formatStr).string());
5722 + String8(formatStr).c_str());
5723 hasErrors = localHasErrors = true;
5724 }
5725 }
5726 - } else if (strcmp16(block.getElementName(&len), string_array16.string()) == 0) {
5727 + } else if (strcmp16(block.getElementName(&len), string_array16.c_str()) == 0) {
5728 // Check whether these strings need valid formats.
5729 // (simplified form of what string16 does above)
5730 bool isTranslatable = false;
5731 @@ -1480,14 +1480,14 @@ status_t compileResourceFile(Bundle* bundle,
5732 for (size_t i = 0; i < n; i++) {
5733 size_t length;
5734 const char16_t* attr = block.getAttributeName(i, &length);
5735 - if (strcmp16(attr, formatted16.string()) == 0) {
5736 + if (strcmp16(attr, formatted16.c_str()) == 0) {
5737 const char16_t* value = block.getAttributeStringValue(i, &length);
5738 - if (strcmp16(value, false16.string()) == 0) {
5739 + if (strcmp16(value, false16.c_str()) == 0) {
5740 curIsFormatted = false;
5741 }
5742 - } else if (strcmp16(attr, translatable16.string()) == 0) {
5743 + } else if (strcmp16(attr, translatable16.c_str()) == 0) {
5744 const char16_t* value = block.getAttributeStringValue(i, &length);
5745 - if (strcmp16(value, false16.string()) == 0) {
5746 + if (strcmp16(value, false16.c_str()) == 0) {
5747 isTranslatable = false;
5748 }
5749 }
5750 @@ -1499,7 +1499,7 @@ status_t compileResourceFile(Bundle* bundle,
5751 curIsBag = true;
5752 curIsBagReplaceOnOverwrite = true;
5753 curIsPseudolocalizable = isTranslatable && fileIsTranslatable;
5754 - } else if (strcmp16(block.getElementName(&len), integer_array16.string()) == 0) {
5755 + } else if (strcmp16(block.getElementName(&len), integer_array16.c_str()) == 0) {
5756 curTag = &integer_array16;
5757 curType = array16;
5758 curFormat = ResTable_map::TYPE_REFERENCE|ResTable_map::TYPE_INTEGER;
5759 @@ -1508,7 +1508,7 @@ status_t compileResourceFile(Bundle* bundle,
5760 } else {
5761 SourcePos(in->getPrintableSource(), block.getLineNumber()).error(
5762 "Found tag %s where item is expected\n",
5763 - String8(block.getElementName(&len)).string());
5764 + String8(block.getElementName(&len)).c_str());
5765 return UNKNOWN_ERROR;
5766 }
5767
5768 @@ -1519,7 +1519,7 @@ status_t compileResourceFile(Bundle* bundle,
5769 } else {
5770 SourcePos(in->getPrintableSource(), block.getLineNumber()).error(
5771 "A 'name' attribute is required for <%s>\n",
5772 - String8(*curTag).string());
5773 + String8(*curTag).c_str());
5774 hasErrors = localHasErrors = true;
5775 }
5776
5777 @@ -1560,11 +1560,11 @@ status_t compileResourceFile(Bundle* bundle,
5778 && code != ResXMLTree::BAD_DOCUMENT) {
5779
5780 if (code == ResXMLTree::START_TAG) {
5781 - if (strcmp16(block.getElementName(&len), item16.string()) != 0) {
5782 + if (strcmp16(block.getElementName(&len), item16.c_str()) != 0) {
5783 SourcePos(in->getPrintableSource(), block.getLineNumber()).error(
5784 "Tag <%s> can not appear inside <%s>, only <item>\n",
5785 - String8(block.getElementName(&len)).string(),
5786 - String8(*curTag).string());
5787 + String8(block.getElementName(&len)).c_str(),
5788 + String8(*curTag).c_str());
5789 return UNKNOWN_ERROR;
5790 }
5791
5792 @@ -1647,11 +1647,11 @@ status_t compileResourceFile(Bundle* bundle,
5793 hasErrors = localHasErrors = true;
5794 }
5795 } else if (code == ResXMLTree::END_TAG) {
5796 - if (strcmp16(block.getElementName(&len), curTag->string()) != 0) {
5797 + if (strcmp16(block.getElementName(&len), curTag->c_str()) != 0) {
5798 SourcePos(in->getPrintableSource(), block.getLineNumber()).error(
5799 "Found tag </%s> where </%s> is expected\n",
5800 - String8(block.getElementName(&len)).string(),
5801 - String8(*curTag).string());
5802 + String8(block.getElementName(&len)).c_str(),
5803 + String8(*curTag).c_str());
5804 return UNKNOWN_ERROR;
5805 }
5806 break;
5807 @@ -1700,9 +1700,9 @@ status_t compileResourceFile(Bundle* bundle,
5808
5809 #if 0
5810 if (comment.size() > 0) {
5811 - printf("Comment for @%s:%s/%s: %s\n", String8(myPackage).string(),
5812 - String8(curType).string(), String8(ident).string(),
5813 - String8(comment).string());
5814 + printf("Comment for @%s:%s/%s: %s\n", String8(myPackage).c_str(),
5815 + String8(curType).c_str(), String8(ident).c_str(),
5816 + String8(comment).c_str());
5817 }
5818 #endif
5819 if (!localHasErrors) {
5820 @@ -1710,9 +1710,9 @@ status_t compileResourceFile(Bundle* bundle,
5821 }
5822 }
5823 else if (code == ResXMLTree::END_TAG) {
5824 - if (strcmp16(block.getElementName(&len), resources16.string()) != 0) {
5825 + if (strcmp16(block.getElementName(&len), resources16.c_str()) != 0) {
5826 SourcePos(in->getPrintableSource(), block.getLineNumber()).error(
5827 - "Unexpected end tag %s\n", String8(block.getElementName(&len)).string());
5828 + "Unexpected end tag %s\n", String8(block.getElementName(&len)).c_str());
5829 return UNKNOWN_ERROR;
5830 }
5831 }
5832 @@ -1724,7 +1724,7 @@ status_t compileResourceFile(Bundle* bundle,
5833 }
5834 SourcePos(in->getPrintableSource(), block.getLineNumber()).error(
5835 "Found text \"%s\" where item tag is expected\n",
5836 - String8(block.getText(&len)).string());
5837 + String8(block.getText(&len)).c_str());
5838 return UNKNOWN_ERROR;
5839 }
5840 }
5841 @@ -1740,13 +1740,13 @@ status_t compileResourceFile(Bundle* bundle,
5842 const char* bundleProduct =
5843 (bundle->getProduct() == NULL) ? "" : bundle->getProduct();
5844 fprintf(stderr, "In resource file %s: %s\n",
5845 - in->getPrintableSource().string(),
5846 - curParams.toString().string());
5847 + in->getPrintableSource().c_str(),
5848 + curParams.toString().c_str());
5849
5850 fprintf(stderr, "\t%s '%s' does not match product %s.\n"
5851 "\tYou may have forgotten to include a 'default' product variant"
5852 " of the resource.\n",
5853 - String8(p.type).string(), String8(p.ident).string(),
5854 + String8(p.type).c_str(), String8(p.ident).c_str(),
5855 bundleProduct[0] == 0 ? "default" : bundleProduct);
5856 return UNKNOWN_ERROR;
5857 }
5858 @@ -1816,7 +1816,7 @@ status_t ResourceTable::addIncludedResources(Bundle* bundle, const sp<AaptAssets
5859 AssetManager featureAssetManager;
5860 if (!featureAssetManager.addAssetPath(featureAfter, NULL)) {
5861 fprintf(stderr, "ERROR: Feature package '%s' not found.\n",
5862 - featureAfter.string());
5863 + featureAfter.c_str());
5864 return UNKNOWN_ERROR;
5865 }
5866
5867 @@ -1835,13 +1835,13 @@ status_t ResourceTable::addPublic(const SourcePos& sourcePos,
5868 const uint32_t ident)
5869 {
5870 uint32_t rid = mAssets->getIncludedResources()
5871 - .identifierForName(name.string(), name.size(),
5872 - type.string(), type.size(),
5873 - package.string(), package.size());
5874 + .identifierForName(name.c_str(), name.size(),
5875 + type.c_str(), type.size(),
5876 + package.c_str(), package.size());
5877 if (rid != 0) {
5878 sourcePos.error("Error declaring public resource %s/%s for included package %s\n",
5879 - String8(type).string(), String8(name).string(),
5880 - String8(package).string());
5881 + String8(type).c_str(), String8(name).c_str(),
5882 + String8(package).c_str());
5883 return UNKNOWN_ERROR;
5884 }
5885
5886 @@ -1864,12 +1864,12 @@ status_t ResourceTable::addEntry(const SourcePos& sourcePos,
5887 const bool overwrite)
5888 {
5889 uint32_t rid = mAssets->getIncludedResources()
5890 - .identifierForName(name.string(), name.size(),
5891 - type.string(), type.size(),
5892 - package.string(), package.size());
5893 + .identifierForName(name.c_str(), name.size(),
5894 + type.c_str(), type.size(),
5895 + package.c_str(), package.size());
5896 if (rid != 0) {
5897 sourcePos.error("Resource entry %s/%s is already defined in package %s.",
5898 - String8(type).string(), String8(name).string(), String8(package).string());
5899 + String8(type).c_str(), String8(name).c_str(), String8(package).c_str());
5900 return UNKNOWN_ERROR;
5901 }
5902
5903 @@ -1899,12 +1899,12 @@ status_t ResourceTable::startBag(const SourcePos& sourcePos,
5904 // Check for adding entries in other packages... for now we do
5905 // nothing. We need to do the right thing here to support skinning.
5906 uint32_t rid = mAssets->getIncludedResources()
5907 - .identifierForName(name.string(), name.size(),
5908 - type.string(), type.size(),
5909 - package.string(), package.size());
5910 + .identifierForName(name.c_str(), name.size(),
5911 + type.c_str(), type.size(),
5912 + package.c_str(), package.size());
5913 if (rid != 0) {
5914 sourcePos.error("Resource entry %s/%s is already defined in package %s.",
5915 - String8(type).string(), String8(name).string(), String8(package).string());
5916 + String8(type).c_str(), String8(name).c_str(), String8(package).c_str());
5917 return UNKNOWN_ERROR;
5918 }
5919
5920 @@ -1921,7 +1921,7 @@ status_t ResourceTable::startBag(const SourcePos& sourcePos,
5921 }
5922 if (!canAdd) {
5923 sourcePos.error("Resource does not already exist in overlay at '%s'; use <add-resource> to add.\n",
5924 - String8(name).string());
5925 + String8(name).c_str());
5926 return UNKNOWN_ERROR;
5927 }
5928 }
5929 @@ -1959,9 +1959,9 @@ status_t ResourceTable::addBag(const SourcePos& sourcePos,
5930 // Check for adding entries in other packages... for now we do
5931 // nothing. We need to do the right thing here to support skinning.
5932 uint32_t rid = mAssets->getIncludedResources()
5933 - .identifierForName(name.string(), name.size(),
5934 - type.string(), type.size(),
5935 - package.string(), package.size());
5936 + .identifierForName(name.c_str(), name.size(),
5937 + type.c_str(), type.size(),
5938 + package.c_str(), package.size());
5939 if (rid != 0) {
5940 return NO_ERROR;
5941 }
5942 @@ -1969,7 +1969,7 @@ status_t ResourceTable::addBag(const SourcePos& sourcePos,
5943 #if 0
5944 if (name == String16("left")) {
5945 printf("Adding bag left: file=%s, line=%d, type=%s\n",
5946 - sourcePos.file.striing(), sourcePos.line, String8(type).string());
5947 + sourcePos.file.striing(), sourcePos.line, String8(type).c_str());
5948 }
5949 #endif
5950 sp<Entry> e = getEntry(package, type, name, sourcePos, replace, params);
5951 @@ -1996,9 +1996,9 @@ bool ResourceTable::hasBagOrEntry(const String16& package,
5952 {
5953 // First look for this in the included resources...
5954 uint32_t rid = mAssets->getIncludedResources()
5955 - .identifierForName(name.string(), name.size(),
5956 - type.string(), type.size(),
5957 - package.string(), package.size());
5958 + .identifierForName(name.c_str(), name.size(),
5959 + type.c_str(), type.size(),
5960 + package.c_str(), package.size());
5961 if (rid != 0) {
5962 return true;
5963 }
5964 @@ -2022,9 +2022,9 @@ bool ResourceTable::hasBagOrEntry(const String16& package,
5965 {
5966 // First look for this in the included resources...
5967 uint32_t rid = mAssets->getIncludedResources()
5968 - .identifierForName(name.string(), name.size(),
5969 - type.string(), type.size(),
5970 - package.string(), package.size());
5971 + .identifierForName(name.c_str(), name.size(),
5972 + type.c_str(), type.size(),
5973 + package.c_str(), package.size());
5974 if (rid != 0) {
5975 return true;
5976 }
5977 @@ -2051,7 +2051,7 @@ bool ResourceTable::hasBagOrEntry(const String16& ref,
5978 const String16* defPackage)
5979 {
5980 String16 package, type, name;
5981 - if (!ResTable::expandResourceRef(ref.string(), ref.size(), &package, &type, &name,
5982 + if (!ResTable::expandResourceRef(ref.c_str(), ref.size(), &package, &type, &name,
5983 defType, defPackage ? defPackage:&mAssetsPackage, NULL)) {
5984 return false;
5985 }
5986 @@ -2115,17 +2115,17 @@ bool ResourceTable::makeAttribute(const String16& package,
5987
5988 // First look for this in the included resources...
5989 uint32_t rid = mAssets->getIncludedResources()
5990 - .identifierForName(name.string(), name.size(),
5991 - attr16.string(), attr16.size(),
5992 - package.string(), package.size());
5993 + .identifierForName(name.c_str(), name.size(),
5994 + attr16.c_str(), attr16.size(),
5995 + package.c_str(), package.size());
5996 if (rid != 0) {
5997 - source.error("Attribute \"%s\" has already been defined", String8(name).string());
5998 + source.error("Attribute \"%s\" has already been defined", String8(name).c_str());
5999 return false;
6000 }
6001
6002 sp<ResourceTable::Entry> entry = getEntry(package, attr16, name, source, false);
6003 if (entry == NULL) {
6004 - source.error("Failed to create entry attr/%s", String8(name).string());
6005 + source.error("Failed to create entry attr/%s", String8(name).c_str());
6006 return false;
6007 }
6008
6009 @@ -2146,7 +2146,7 @@ bool ResourceTable::makeAttribute(const String16& package,
6010 formatItem.value != formatValue16) {
6011 source.error("Attribute \"%s\" already defined with incompatible format.\n"
6012 "%s:%d: Original attribute defined here.",
6013 - String8(name).string(), formatItem.sourcePos.file.string(),
6014 + String8(name).c_str(), formatItem.sourcePos.file.c_str(),
6015 formatItem.sourcePos.line);
6016 return false;
6017 }
6018 @@ -2207,9 +2207,9 @@ uint32_t ResourceTable::getResId(const String16& package,
6019 // First look for this in the included resources...
6020 uint32_t specFlags = 0;
6021 uint32_t rid = mAssets->getIncludedResources()
6022 - .identifierForName(name.string(), name.size(),
6023 - type.string(), type.size(),
6024 - package.string(), package.size(),
6025 + .identifierForName(name.c_str(), name.size(),
6026 + type.c_str(), type.size(),
6027 + package.c_str(), package.size(),
6028 &specFlags);
6029 if (rid != 0) {
6030 if (onlyPublic && (specFlags & ResTable_typeSpec::SPEC_PUBLIC) == 0) {
6031 @@ -2253,27 +2253,27 @@ uint32_t ResourceTable::getResId(const String16& ref,
6032 String16 package, type, name;
6033 bool refOnlyPublic = true;
6034 if (!ResTable::expandResourceRef(
6035 - ref.string(), ref.size(), &package, &type, &name,
6036 + ref.c_str(), ref.size(), &package, &type, &name,
6037 defType, defPackage ? defPackage:&mAssetsPackage,
6038 outErrorMsg, &refOnlyPublic)) {
6039 if (kIsDebug) {
6040 - printf("Expanding resource: ref=%s\n", String8(ref).string());
6041 + printf("Expanding resource: ref=%s\n", String8(ref).c_str());
6042 printf("Expanding resource: defType=%s\n",
6043 - defType ? String8(*defType).string() : "NULL");
6044 + defType ? String8(*defType).c_str() : "NULL");
6045 printf("Expanding resource: defPackage=%s\n",
6046 - defPackage ? String8(*defPackage).string() : "NULL");
6047 - printf("Expanding resource: ref=%s\n", String8(ref).string());
6048 + defPackage ? String8(*defPackage).c_str() : "NULL");
6049 + printf("Expanding resource: ref=%s\n", String8(ref).c_str());
6050 printf("Expanded resource: p=%s, t=%s, n=%s, res=0\n",
6051 - String8(package).string(), String8(type).string(),
6052 - String8(name).string());
6053 + String8(package).c_str(), String8(type).c_str(),
6054 + String8(name).c_str());
6055 }
6056 return 0;
6057 }
6058 uint32_t res = getResId(package, type, name, onlyPublic && refOnlyPublic);
6059 if (kIsDebug) {
6060 printf("Expanded resource: p=%s, t=%s, n=%s, res=%d\n",
6061 - String8(package).string(), String8(type).string(),
6062 - String8(name).string(), res);
6063 + String8(package).c_str(), String8(type).c_str(),
6064 + String8(name).c_str(), res);
6065 }
6066 if (res == 0) {
6067 if (outErrorMsg)
6068 @@ -2284,7 +2284,7 @@ uint32_t ResourceTable::getResId(const String16& ref,
6069
6070 bool ResourceTable::isValidResourceName(const String16& s)
6071 {
6072 - const char16_t* p = s.string();
6073 + const char16_t* p = s.c_str();
6074 bool first = true;
6075 while (*p) {
6076 if ((*p >= 'a' && *p <= 'z')
6077 @@ -2315,7 +2315,7 @@ bool ResourceTable::stringToValue(Res_value* outValue, StringPool* pool,
6078 if (style == NULL || style->size() == 0) {
6079 // Text is not styled so it can be any type... let's figure it out.
6080 res = mAssets->getIncludedResources()
6081 - .stringToValue(outValue, &finalStr, str.string(), str.size(), preserveSpaces,
6082 + .stringToValue(outValue, &finalStr, str.c_str(), str.size(), preserveSpaces,
6083 coerceType, attrID, NULL, &mAssetsPackage, this,
6084 accessorCookie, attrType);
6085 } else {
6086 @@ -2344,7 +2344,7 @@ bool ResourceTable::stringToValue(Res_value* outValue, StringPool* pool,
6087 if (kIsDebug) {
6088 printf("Adding to pool string style #%zu config %s: %s\n",
6089 style != NULL ? style->size() : 0U,
6090 - configStr.string(), String8(finalStr).string());
6091 + configStr.c_str(), String8(finalStr).c_str());
6092 }
6093 if (style != NULL && style->size() > 0) {
6094 outValue->data = pool->add(finalStr, *style, configTypeName, config);
6095 @@ -2368,8 +2368,8 @@ bool ResourceTable::stringToValue(Res_value* outValue, StringPool* pool,
6096 uint32_t ResourceTable::getCustomResource(
6097 const String16& package, const String16& type, const String16& name) const
6098 {
6099 - //printf("getCustomResource: %s %s %s\n", String8(package).string(),
6100 - // String8(type).string(), String8(name).string());
6101 + //printf("getCustomResource: %s %s %s\n", String8(package).c_str(),
6102 + // String8(type).c_str(), String8(name).c_str());
6103 sp<Package> p = mPackages.valueFor(package);
6104 if (p == NULL) return 0;
6105 sp<Type> t = p->getTypes().valueFor(type);
6106 @@ -2400,7 +2400,7 @@ uint32_t ResourceTable::getCustomResourceWithCreation(
6107
6108 if (mAssetsPackage != package) {
6109 mCurrentXmlPos.error("creating resource for external package %s: %s/%s.",
6110 - String8(package).string(), String8(type).string(), String8(name).string());
6111 + String8(package).c_str(), String8(type).c_str(), String8(name).c_str());
6112 if (package == String16("android")) {
6113 mCurrentXmlPos.printf("did you mean to use @+id instead of @+android:id?");
6114 }
6115 @@ -2427,7 +2427,7 @@ bool ResourceTable::getAttributeType(uint32_t attrID, uint32_t* outType)
6116 Res_value value;
6117 if (getItemValue(attrID, ResTable_map::ATTR_TYPE, &value)) {
6118 //printf("getAttributeType #%08x (%s): #%08x\n", attrID,
6119 - // String8(getEntry(attrID)->getName()).string(), value.data);
6120 + // String8(getEntry(attrID)->getName()).c_str(), value.data);
6121 *outType = value.data;
6122 return true;
6123 }
6124 @@ -2481,7 +2481,7 @@ void ResourceTable::reportError(void* accessorCookie, const char* fmt, ...)
6125 vsnprintf(buf, sizeof(buf), fmt, ap);
6126 va_end(ap);
6127 ac->sourcePos.error("Error: %s (at '%s' with value '%s').\n",
6128 - buf, ac->attr.string(), ac->value.string());
6129 + buf, ac->attr.c_str(), ac->value.c_str());
6130 }
6131 }
6132
6133 @@ -2493,7 +2493,7 @@ bool ResourceTable::getAttributeKeys(
6134 const size_t N = e->getBag().size();
6135 for (size_t i=0; i<N; i++) {
6136 const String16& key = e->getBag().keyAt(i);
6137 - if (key.size() > 0 && key.string()[0] != '^') {
6138 + if (key.size() > 0 && key.c_str()[0] != '^') {
6139 outKeys->add(key);
6140 }
6141 }
6142 @@ -2506,14 +2506,14 @@ bool ResourceTable::getAttributeEnum(
6143 uint32_t attrID, const char16_t* name, size_t nameLen,
6144 Res_value* outValue)
6145 {
6146 - //printf("getAttributeEnum #%08x %s\n", attrID, String8(name, nameLen).string());
6147 + //printf("getAttributeEnum #%08x %s\n", attrID, String8(name, nameLen).c_str());
6148 String16 nameStr(name, nameLen);
6149 sp<const Entry> e = getEntry(attrID);
6150 if (e != NULL) {
6151 const size_t N = e->getBag().size();
6152 for (size_t i=0; i<N; i++) {
6153 - //printf("Comparing %s to %s\n", String8(name, nameLen).string(),
6154 - // String8(e->getBag().keyAt(i)).string());
6155 + //printf("Comparing %s to %s\n", String8(name, nameLen).c_str(),
6156 + // String8(e->getBag().keyAt(i)).c_str());
6157 if (e->getBag().keyAt(i) == nameStr) {
6158 return getItemValue(attrID, e->getBag().valueAt(i).bagKeyId, outValue);
6159 }
6160 @@ -2529,7 +2529,7 @@ bool ResourceTable::getAttributeFlags(
6161 outValue->dataType = Res_value::TYPE_INT_HEX;
6162 outValue->data = 0;
6163
6164 - //printf("getAttributeFlags #%08x %s\n", attrID, String8(name, nameLen).string());
6165 + //printf("getAttributeFlags #%08x %s\n", attrID, String8(name, nameLen).c_str());
6166 String16 nameStr(name, nameLen);
6167 sp<const Entry> e = getEntry(attrID);
6168 if (e != NULL) {
6169 @@ -2546,8 +2546,8 @@ bool ResourceTable::getAttributeFlags(
6170 String16 nameStr(start, pos-start);
6171 size_t i;
6172 for (i=0; i<N; i++) {
6173 - //printf("Comparing \"%s\" to \"%s\"\n", String8(nameStr).string(),
6174 - // String8(e->getBag().keyAt(i)).string());
6175 + //printf("Comparing \"%s\" to \"%s\"\n", String8(nameStr).c_str(),
6176 + // String8(e->getBag().keyAt(i)).c_str());
6177 if (e->getBag().keyAt(i) == nameStr) {
6178 Res_value val;
6179 bool got = getItemValue(attrID, e->getBag().valueAt(i).bagKeyId, &val);
6180 @@ -2753,7 +2753,7 @@ status_t ResourceTable::addSymbols(const sp<AaptSymbols>& outSymbols,
6181 if (mHasDefaultLocalization.find(c->getName())
6182 == mHasDefaultLocalization.end()) {
6183 // printf("Skip symbol [%08x] %s\n", rid,
6184 - // String8(c->getName()).string());
6185 + // String8(c->getName()).c_str());
6186 continue;
6187 }
6188 }
6189 @@ -2763,7 +2763,7 @@ status_t ResourceTable::addSymbols(const sp<AaptSymbols>& outSymbols,
6190 String16 comment(c->getComment());
6191 typeSymbols->appendComment(String8(c->getName()), comment, c->getPos());
6192 //printf("Type symbol [%08x] %s comment: %s\n", rid,
6193 - // String8(c->getName()).string(), String8(comment).string());
6194 + // String8(c->getName()).c_str(), String8(comment).c_str());
6195 comment = c->getTypeComment();
6196 typeSymbols->appendTypeComment(String8(c->getName()), comment);
6197 }
6198 @@ -2809,10 +2809,10 @@ ResourceTable::validateLocalizations(void)
6199 // Look for strings with no default localization
6200 if (configSrcMap.count(defaultLocale) == 0) {
6201 SourcePos().warning("string '%s' has no default translation.",
6202 - String8(nameIter.first).string());
6203 + String8(nameIter.first).c_str());
6204 if (mBundle->getVerbose()) {
6205 for (const auto& locale : configSrcMap) {
6206 - locale.second.printf("locale %s found", locale.first.string());
6207 + locale.second.printf("locale %s found", locale.first.c_str());
6208 }
6209 }
6210 // !!! TODO: throw an error here in some circumstances
6211 @@ -2820,7 +2820,7 @@ ResourceTable::validateLocalizations(void)
6212
6213 // Check that all requested localizations are present for this string
6214 if (mBundle->getConfigurations().size() > 0 && mBundle->getRequireLocalization()) {
6215 - const char* allConfigs = mBundle->getConfigurations().string();
6216 + const char* allConfigs = mBundle->getConfigurations().c_str();
6217 const char* start = allConfigs;
6218 const char* comma;
6219
6220 @@ -2847,7 +2847,7 @@ ResourceTable::validateLocalizations(void)
6221 // requiring a specific regional localization [e.g. de_DE] but there is an
6222 // available string in the generic language localization [e.g. de];
6223 // consider that string to have fulfilled the localization requirement.
6224 - String8 region(config.string(), 2);
6225 + String8 region(config.c_str(), 2);
6226 if (configSrcMap.find(region) == configSrcMap.end() &&
6227 configSrcMap.count(defaultLocale) == 0) {
6228 missingConfigs.insert(config);
6229 @@ -2859,12 +2859,12 @@ ResourceTable::validateLocalizations(void)
6230 if (!missingConfigs.empty()) {
6231 String8 configStr;
6232 for (const auto& iter : missingConfigs) {
6233 - configStr.appendFormat(" %s", iter.string());
6234 + configStr.appendFormat(" %s", iter.c_str());
6235 }
6236 SourcePos().warning("string '%s' is missing %u required localizations:%s",
6237 - String8(nameIter.first).string(),
6238 + String8(nameIter.first).c_str(),
6239 (unsigned int)missingConfigs.size(),
6240 - configStr.string());
6241 + configStr.c_str());
6242 }
6243 }
6244 }
6245 @@ -3021,7 +3021,7 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<const ResourceFilter>&
6246 header->header.type = htods(RES_TABLE_PACKAGE_TYPE);
6247 header->header.headerSize = htods(sizeof(*header));
6248 header->id = htodl(static_cast<uint32_t>(p->getAssignedId()));
6249 - strcpy16_htod(header->name, p->getName().string());
6250 + strcpy16_htod(header->name, p->getName().c_str());
6251
6252 // Write the string blocks.
6253 const size_t typeStringsStart = data->getSize();
6254 @@ -3061,7 +3061,7 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<const ResourceFilter>&
6255 sp<Type> t = p->getTypes().valueFor(typeName);
6256 LOG_ALWAYS_FATAL_IF(t == NULL && typeName != String16("<empty>"),
6257 "Type name %s not found",
6258 - String8(typeName).string());
6259 + String8(typeName).c_str());
6260 if (t == NULL) {
6261 continue;
6262 }
6263 @@ -3260,7 +3260,7 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<const ResourceFilter>&
6264 sp<ConfigList> c = t->getOrderedConfigs().itemAt(i);
6265 if (c != NULL) {
6266 fprintf(stderr, "%s: no entries written for %s/%s (0x%08zx)\n", log_prefix,
6267 - String8(typeName).string(), String8(c->getName()).string(),
6268 + String8(typeName).c_str(), String8(c->getName()).c_str(),
6269 Res_MAKEID(p->getAssignedId() - 1, ti, i));
6270 }
6271 missing_entry = true;
6272 @@ -3359,7 +3359,7 @@ status_t ResourceTable::flattenLibraryTable(const sp<AaptFile>& dest, const Vect
6273 sp<Package> libPackage = libs[i];
6274 if (kIsDebug) {
6275 fprintf(stderr, " Entry %s -> 0x%02x\n",
6276 - String8(libPackage->getName()).string(),
6277 + String8(libPackage->getName()).c_str(),
6278 (uint8_t)libPackage->getAssignedId());
6279 }
6280
6281 @@ -3367,7 +3367,7 @@ status_t ResourceTable::flattenLibraryTable(const sp<AaptFile>& dest, const Vect
6282 entryStart, sizeof(ResTable_lib_entry));
6283 memset(entry, 0, sizeof(*entry));
6284 entry->packageId = htodl(libPackage->getAssignedId());
6285 - strcpy16_htod(entry->packageName, libPackage->getName().string());
6286 + strcpy16_htod(entry->packageName, libPackage->getName().c_str());
6287 }
6288 }
6289 return NO_ERROR;
6290 @@ -3435,13 +3435,13 @@ void ResourceTable::writePublicDefinitions(const String16& package, FILE* fp, bo
6291 const SourcePos& pos = c->getEntries().valueAt(k)->getPos();
6292 if (pos.file != "") {
6293 fprintf(fp," <!-- Declared at %s:%d -->\n",
6294 - pos.file.string(), pos.line);
6295 + pos.file.c_str(), pos.line);
6296 }
6297 }
6298 }
6299 fprintf(fp, " <public type=\"%s\" name=\"%s\" id=\"0x%08x\" />\n",
6300 - String8(t->getName()).string(),
6301 - String8(c->getName()).string(),
6302 + String8(t->getName()).c_str(),
6303 + String8(c->getName()).c_str(),
6304 getResId(pkg, t, c->getEntryIndex()));
6305 }
6306 }
6307 @@ -3501,8 +3501,8 @@ status_t ResourceTable::Entry::makeItABag(const SourcePos& sourcePos)
6308 }
6309 sourcePos.error("Resource entry %s is already defined as a single item.\n"
6310 "%s:%d: Originally defined here.\n",
6311 - String8(mName).string(),
6312 - mItem.sourcePos.file.string(), mItem.sourcePos.line);
6313 + String8(mName).c_str(),
6314 + mItem.sourcePos.file.c_str(), mItem.sourcePos.line);
6315 return UNKNOWN_ERROR;
6316 }
6317
6318 @@ -3517,21 +3517,21 @@ status_t ResourceTable::Entry::setItem(const SourcePos& sourcePos,
6319 if (mType == TYPE_BAG) {
6320 if (mBag.size() == 0) {
6321 sourcePos.error("Resource entry %s is already defined as a bag.",
6322 - String8(mName).string());
6323 + String8(mName).c_str());
6324 } else {
6325 const Item& item(mBag.valueAt(0));
6326 sourcePos.error("Resource entry %s is already defined as a bag.\n"
6327 "%s:%d: Originally defined here.\n",
6328 - String8(mName).string(),
6329 - item.sourcePos.file.string(), item.sourcePos.line);
6330 + String8(mName).c_str(),
6331 + item.sourcePos.file.c_str(), item.sourcePos.line);
6332 }
6333 return UNKNOWN_ERROR;
6334 }
6335 if ( (mType != TYPE_UNKNOWN) && (overwrite == false) ) {
6336 sourcePos.error("Resource entry %s is already defined.\n"
6337 "%s:%d: Originally defined here.\n",
6338 - String8(mName).string(),
6339 - mItem.sourcePos.file.string(), mItem.sourcePos.line);
6340 + String8(mName).c_str(),
6341 + mItem.sourcePos.file.c_str(), mItem.sourcePos.line);
6342 return UNKNOWN_ERROR;
6343 }
6344
6345 @@ -3562,12 +3562,12 @@ status_t ResourceTable::Entry::addToBag(const SourcePos& sourcePos,
6346 const Item& item(mBag.valueAt(origKey));
6347 sourcePos.error("Resource entry %s already has bag item %s.\n"
6348 "%s:%d: Originally defined here.\n",
6349 - String8(mName).string(), String8(key).string(),
6350 - item.sourcePos.file.string(), item.sourcePos.line);
6351 + String8(mName).c_str(), String8(key).c_str(),
6352 + item.sourcePos.file.c_str(), item.sourcePos.line);
6353 return UNKNOWN_ERROR;
6354 }
6355 //printf("Replacing %s with %s\n",
6356 - // String8(mBag.valueFor(key).value).string(), String8(value).string());
6357 + // String8(mBag.valueFor(key).value).c_str(), String8(value).c_str());
6358 mBag.replaceValueFor(key, item);
6359 }
6360
6361 @@ -3611,8 +3611,8 @@ status_t ResourceTable::Entry::generateAttributes(ResourceTable* table,
6362 String16 value("false");
6363 if (kIsDebug) {
6364 fprintf(stderr, "Generating %s:id/%s\n",
6365 - String8(package).string(),
6366 - String8(key).string());
6367 + String8(package).c_str(),
6368 + String8(key).c_str());
6369 }
6370 status_t err = table->addEntry(SourcePos(String8("<generated>"), 0), package,
6371 id16, key, value);
6372 @@ -3624,10 +3624,10 @@ status_t ResourceTable::Entry::generateAttributes(ResourceTable* table,
6373
6374 #if 1
6375 // fprintf(stderr, "ERROR: Bag attribute '%s' has not been defined.\n",
6376 -// String8(key).string());
6377 +// String8(key).c_str());
6378 // const Item& item(mBag.valueAt(i));
6379 // fprintf(stderr, "Referenced from file %s line %d\n",
6380 -// item.sourcePos.file.string(), item.sourcePos.line);
6381 +// item.sourcePos.file.c_str(), item.sourcePos.line);
6382 // return UNKNOWN_ERROR;
6383 #else
6384 char numberStr[16];
6385 @@ -3660,7 +3660,7 @@ status_t ResourceTable::Entry::assignResourceIds(ResourceTable* table,
6386 mParentId = table->getResId(mParent, &style16, NULL, &errorMsg);
6387 if (mParentId == 0) {
6388 mPos.error("Error retrieving parent for item: %s '%s'.\n",
6389 - errorMsg, String8(mParent).string());
6390 + errorMsg, String8(mParent).c_str());
6391 hasErrors = true;
6392 }
6393 }
6394 @@ -3670,11 +3670,11 @@ status_t ResourceTable::Entry::assignResourceIds(ResourceTable* table,
6395 Item& it = mBag.editValueAt(i);
6396 it.bagKeyId = table->getResId(key,
6397 it.isId ? &id16 : &attr16, NULL, &errorMsg);
6398 - //printf("Bag key of %s: #%08x\n", String8(key).string(), it.bagKeyId);
6399 + //printf("Bag key of %s: #%08x\n", String8(key).c_str(), it.bagKeyId);
6400 if (it.bagKeyId == 0) {
6401 it.sourcePos.error("Error: %s: %s '%s'.\n", errorMsg,
6402 - String8(it.isId ? id16 : attr16).string(),
6403 - String8(key).string());
6404 + String8(it.isId ? id16 : attr16).c_str(),
6405 + String8(key).c_str());
6406 hasErrors = true;
6407 }
6408 }
6409 @@ -3709,7 +3709,7 @@ status_t ResourceTable::Entry::prepareFlatten(StringPool* strings, ResourceTable
6410 }
6411 } else {
6412 mPos.error("Error: entry %s is not a single item or a bag.\n",
6413 - String8(mName).string());
6414 + String8(mName).c_str());
6415 return UNKNOWN_ERROR;
6416 }
6417 return NO_ERROR;
6418 @@ -3732,7 +3732,7 @@ status_t ResourceTable::Entry::remapStringValue(StringPool* strings)
6419 }
6420 } else {
6421 mPos.error("Error: entry %s is not a single item or a bag.\n",
6422 - String8(mName).string());
6423 + String8(mName).c_str());
6424 return UNKNOWN_ERROR;
6425 }
6426 return NO_ERROR;
6427 @@ -3768,7 +3768,7 @@ ssize_t ResourceTable::Entry::flatten(Bundle* /* bundle */, const sp<AaptFile>&
6428 par.data = htodl(it.parsedValue.data);
6429 #if 0
6430 printf("Writing item (%s): type=%d, data=0x%x, res0=0x%x\n",
6431 - String8(mName).string(), it.parsedValue.dataType,
6432 + String8(mName).c_str(), it.parsedValue.dataType,
6433 it.parsedValue.data, par.res0);
6434 #endif
6435 err = data->writeData(&par, it.parsedValue.size);
6436 @@ -3852,7 +3852,7 @@ status_t ResourceTable::Type::addPublic(const SourcePos& sourcePos,
6437 int32_t entryIdx = Res_GETENTRY(ident);
6438 if (entryIdx < 0) {
6439 sourcePos.error("Public resource %s/%s has an invalid 0 identifier (0x%08x).\n",
6440 - String8(mName).string(), String8(name).string(), ident);
6441 + String8(mName).c_str(), String8(name).c_str(), ident);
6442 return UNKNOWN_ERROR;
6443 }
6444 #endif
6445 @@ -3863,7 +3863,7 @@ status_t ResourceTable::Type::addPublic(const SourcePos& sourcePos,
6446 if (mPublicIndex > 0 && mPublicIndex != typeIdx) {
6447 sourcePos.error("Public resource %s/%s has conflicting type codes for its"
6448 " public identifiers (0x%x vs 0x%x).\n",
6449 - String8(mName).string(), String8(name).string(),
6450 + String8(mName).c_str(), String8(name).c_str(),
6451 mPublicIndex, typeIdx);
6452 return UNKNOWN_ERROR;
6453 }
6454 @@ -3882,8 +3882,8 @@ status_t ResourceTable::Type::addPublic(const SourcePos& sourcePos,
6455 sourcePos.error("Public resource %s/%s has conflicting public identifiers"
6456 " (0x%08x vs 0x%08x).\n"
6457 "%s:%d: Originally defined here.\n",
6458 - String8(mName).string(), String8(name).string(), p.ident, ident,
6459 - p.sourcePos.file.string(), p.sourcePos.line);
6460 + String8(mName).c_str(), String8(name).c_str(), p.ident, ident,
6461 + p.sourcePos.file.c_str(), p.sourcePos.line);
6462 return UNKNOWN_ERROR;
6463 }
6464 }
6465 @@ -3909,7 +3909,7 @@ sp<ResourceTable::Entry> ResourceTable::Type::getEntry(const String16& entry,
6466 if (overlay && !autoAddOverlay && mCanAddEntries.indexOf(entry) < 0) {
6467 sourcePos.error("Resource at %s appears in overlay but not"
6468 " in the base package; use <add-resource> to add.\n",
6469 - String8(entry).string());
6470 + String8(entry).c_str());
6471 return NULL;
6472 }
6473 c = new ConfigList(entry, sourcePos);
6474 @@ -3931,7 +3931,7 @@ sp<ResourceTable::Entry> ResourceTable::Type::getEntry(const String16& entry,
6475 printf("New entry at %s:%d: imsi:%d/%d lang:%c%c cnt:%c%c "
6476 "orien:%d touch:%d density:%d key:%d inp:%d nav:%d sz:%dx%d "
6477 "sw%ddp w%ddp h%ddp layout:%d\n",
6478 - sourcePos.file.string(), sourcePos.line,
6479 + sourcePos.file.c_str(), sourcePos.line,
6480 config->mcc, config->mnc,
6481 config->language[0] ? config->language[0] : '-',
6482 config->language[1] ? config->language[1] : '-',
6483 @@ -3951,7 +3951,7 @@ sp<ResourceTable::Entry> ResourceTable::Type::getEntry(const String16& entry,
6484 config->screenLayout);
6485 } else {
6486 printf("New entry at %s:%d: NULL config\n",
6487 - sourcePos.file.string(), sourcePos.line);
6488 + sourcePos.file.c_str(), sourcePos.line);
6489 }
6490 }
6491 e = new Entry(entry, sourcePos);
6492 @@ -4032,11 +4032,11 @@ status_t ResourceTable::Type::applyPublicEntryOrder()
6493 const Public& p = mPublic.valueAt(j);
6494 int32_t idx = Res_GETENTRY(p.ident);
6495 //printf("Looking for entry \"%s\"/\"%s\" (0x%08x) in %d...\n",
6496 - // String8(mName).string(), String8(name).string(), p.ident, N);
6497 + // String8(mName).c_str(), String8(name).c_str(), p.ident, N);
6498 bool found = false;
6499 for (i=0; i<N; i++) {
6500 sp<ConfigList> e = origOrder.itemAt(i);
6501 - //printf("#%d: \"%s\"\n", i, String8(e->getName()).string());
6502 + //printf("#%d: \"%s\"\n", i, String8(e->getName()).c_str());
6503 if (e->getName() == name) {
6504 if (idx >= (int32_t)mOrderedConfigs.size()) {
6505 mOrderedConfigs.resize(idx + 1);
6506 @@ -4056,10 +4056,10 @@ status_t ResourceTable::Type::applyPublicEntryOrder()
6507 p.sourcePos.error("Multiple entry names declared for public entry"
6508 " identifier 0x%x in type %s (%s vs %s).\n"
6509 "%s:%d: Originally defined here.",
6510 - idx+1, String8(mName).string(),
6511 - String8(oe->getName()).string(),
6512 - String8(name).string(),
6513 - oe->getPublicSourcePos().file.string(),
6514 + idx+1, String8(mName).c_str(),
6515 + String8(oe->getName()).c_str(),
6516 + String8(name).c_str(),
6517 + oe->getPublicSourcePos().file.c_str(),
6518 oe->getPublicSourcePos().line);
6519 hasError = true;
6520 }
6521 @@ -4068,7 +4068,7 @@ status_t ResourceTable::Type::applyPublicEntryOrder()
6522
6523 if (!found) {
6524 p.sourcePos.error("Public symbol %s/%s declared here is not defined.",
6525 - String8(mName).string(), String8(name).string());
6526 + String8(mName).c_str(), String8(name).c_str());
6527 hasError = true;
6528 }
6529 }
6530 @@ -4189,9 +4189,9 @@ status_t ResourceTable::Package::applyPublicTypeOrder()
6531 t->getFirstPublicSourcePos().error("Multiple type names declared for public type"
6532 " identifier 0x%x (%s vs %s).\n"
6533 "%s:%d: Originally defined here.",
6534 - idx, String8(ot->getName()).string(),
6535 - String8(t->getName()).string(),
6536 - ot->getFirstPublicSourcePos().file.string(),
6537 + idx, String8(ot->getName()).c_str(),
6538 + String8(t->getName()).c_str(),
6539 + ot->getFirstPublicSourcePos().file.c_str(),
6540 ot->getFirstPublicSourcePos().line);
6541 return UNKNOWN_ERROR;
6542 }
6543 @@ -4399,8 +4399,8 @@ const ResourceTable::Item* ResourceTable::getItem(uint32_t resID, uint32_t attrI
6544 const Item& it = e->getBag().valueAt(i);
6545 if (it.bagKeyId == 0) {
6546 fprintf(stderr, "warning: ID not yet assigned to '%s' in bag '%s'\n",
6547 - String8(e->getName()).string(),
6548 - String8(e->getBag().keyAt(i)).string());
6549 + String8(e->getName()).c_str(),
6550 + String8(e->getBag().keyAt(i)).c_str());
6551 }
6552 if (it.bagKeyId == attrID) {
6553 return &it;
6554 @@ -4427,8 +4427,8 @@ bool ResourceTable::getItemValue(
6555 }
6556 }
6557 fprintf(stderr, "warning: Circular reference detected in key '%s' of bag '%s'\n",
6558 - String8(e->getName()).string(),
6559 - String8(e->getBag().keyAt(i)).string());
6560 + String8(e->getName()).c_str(),
6561 + String8(e->getBag().keyAt(i)).c_str());
6562 return false;
6563 }
6564 item->evaluating = true;
6565 @@ -4436,7 +4436,7 @@ bool ResourceTable::getItemValue(
6566 if (kIsDebug) {
6567 if (res) {
6568 printf("getItemValue of #%08x[#%08x] (%s): type=#%08x, data=#%08x\n",
6569 - resID, attrID, String8(getEntry(resID)->getName()).string(),
6570 + resID, attrID, String8(getEntry(resID)->getName()).c_str(),
6571 outValue->dataType, outValue->data);
6572 } else {
6573 printf("getItemValue of #%08x[#%08x]: failed\n",
6574 @@ -4713,10 +4713,10 @@ status_t ResourceTable::modifyForCompat(const Bundle* bundle) {
6575 entriesToAdd[i].value->getPos()
6576 .printf("using v%d attributes; synthesizing resource %s:%s/%s for configuration %s.",
6577 entriesToAdd[i].key.sdkVersion,
6578 - String8(p->getName()).string(),
6579 - String8(t->getName()).string(),
6580 - String8(entriesToAdd[i].value->getName()).string(),
6581 - entriesToAdd[i].key.toString().string());
6582 + String8(p->getName()).c_str(),
6583 + String8(t->getName()).c_str(),
6584 + String8(entriesToAdd[i].value->getName()).c_str(),
6585 + entriesToAdd[i].key.toString().c_str());
6586 }
6587
6588 sp<Entry> newEntry = t->getEntry(c->getName(),
6589 @@ -4801,8 +4801,8 @@ bool ResourceTable::versionForCompat(const Bundle* bundle, const String16& resou
6590 sp<AaptFile> newFile = new AaptFile(target->getSourceFile(),
6591 AaptGroupEntry(newConfig), target->getResourceType());
6592 String8 resPath = String8::format("res/%s/%s.xml",
6593 - newFile->getGroupEntry().toDirName(target->getResourceType()).string(),
6594 - String8(resourceName).string());
6595 + newFile->getGroupEntry().toDirName(target->getResourceType()).c_str(),
6596 + String8(resourceName).c_str());
6597 resPath.convertToResPath();
6598
6599 // Add a resource table entry.
6600 @@ -4893,10 +4893,10 @@ status_t ResourceTable::modifyForCompat(const Bundle* bundle,
6601 if (bundle->getVerbose()) {
6602 SourcePos(node->getFilename(), node->getStartLineNumber()).printf(
6603 "removing attribute %s%s%s from <%s>",
6604 - String8(attr.ns).string(),
6605 + String8(attr.ns).c_str(),
6606 (attr.ns.size() == 0 ? "" : ":"),
6607 - String8(attr.name).string(),
6608 - String8(node->getElementName()).string());
6609 + String8(attr.name).c_str(),
6610 + String8(node->getElementName()).c_str());
6611 }
6612 node->removeAttribute(i);
6613 i--;
6614 @@ -4925,8 +4925,8 @@ status_t ResourceTable::modifyForCompat(const Bundle* bundle,
6615 sp<AaptFile> newFile = new AaptFile(target->getSourceFile(),
6616 AaptGroupEntry(newConfig), target->getResourceType());
6617 String8 resPath = String8::format("res/%s/%s.xml",
6618 - newFile->getGroupEntry().toDirName(target->getResourceType()).string(),
6619 - String8(resourceName).string());
6620 + newFile->getGroupEntry().toDirName(target->getResourceType()).c_str(),
6621 + String8(resourceName).c_str());
6622 resPath.convertToResPath();
6623
6624 // Add a resource table entry.
6625 @@ -4934,10 +4934,10 @@ status_t ResourceTable::modifyForCompat(const Bundle* bundle,
6626 SourcePos(target->getSourceFile(), -1).printf(
6627 "using v%d attributes; synthesizing resource %s:%s/%s for configuration %s.",
6628 newConfig.sdkVersion,
6629 - mAssets->getPackage().string(),
6630 - newFile->getResourceType().string(),
6631 - String8(resourceName).string(),
6632 - newConfig.toString().string());
6633 + mAssets->getPackage().c_str(),
6634 + newFile->getResourceType().c_str(),
6635 + String8(resourceName).c_str(),
6636 + newConfig.toString().c_str());
6637 }
6638
6639 addEntry(SourcePos(),
6640 @@ -5114,8 +5114,8 @@ status_t ResourceTable::processBundleFormatImpl(const Bundle* bundle,
6641 sp<XMLNode> nestedRoot = findOnlyChildElement(child);
6642 if (nestedRoot == NULL) {
6643 source.error("<%s:%s> must have exactly one child element",
6644 - String8(child->getElementNamespace()).string(),
6645 - String8(child->getElementName()).string());
6646 + String8(child->getElementNamespace()).c_str(),
6647 + String8(child->getElementName()).c_str());
6648 return UNKNOWN_ERROR;
6649 }
6650
6651 @@ -5130,7 +5130,7 @@ status_t ResourceTable::processBundleFormatImpl(const Bundle* bundle,
6652 // Parse the attribute name.
6653 const char* errorMsg = NULL;
6654 String16 attrPackage, attrType, attrName;
6655 - bool result = ResTable::expandResourceRef(attr->string.string(),
6656 + bool result = ResTable::expandResourceRef(attr->string.c_str(),
6657 attr->string.size(),
6658 &attrPackage, &attrType, &attrName,
6659 &kAttr16, &kAssetPackage16,
6660 @@ -5156,11 +5156,11 @@ status_t ResourceTable::processBundleFormatImpl(const Bundle* bundle,
6661 // This child element will be extracted into its own resource file.
6662 // Generate a name and path for it from its parent.
6663 nestedResourceName = String8::format("%s_%d",
6664 - String8(resourceName).string(), suffix++);
6665 + String8(resourceName).c_str(), suffix++);
6666 nestedResourcePath = String8::format("res/%s/%s.xml",
6667 target->getGroupEntry().toDirName(target->getResourceType())
6668 - .string(),
6669 - nestedResourceName.string());
6670 + .c_str(),
6671 + nestedResourceName.c_str());
6672
6673 // Lookup or create the entry for this name.
6674 sp<Entry> entry = getEntry(kAssetPackage16,
6675 @@ -5187,20 +5187,20 @@ status_t ResourceTable::processBundleFormatImpl(const Bundle* bundle,
6676
6677 if (bundle->getVerbose()) {
6678 source.printf("generating nested resource %s:%s/%s",
6679 - mAssets->getPackage().string(), target->getResourceType().string(),
6680 - nestedResourceName.string());
6681 + mAssets->getPackage().c_str(), target->getResourceType().c_str(),
6682 + nestedResourceName.c_str());
6683 }
6684
6685 // Build the attribute reference and assign it to the parent.
6686 String16 nestedResourceRef = String16(String8::format("@%s:%s/%s",
6687 - mAssets->getPackage().string(), target->getResourceType().string(),
6688 - nestedResourceName.string()));
6689 + mAssets->getPackage().c_str(), target->getResourceType().c_str(),
6690 + nestedResourceName.c_str()));
6691
6692 String16 attrNs = buildNamespace(attrPackage);
6693 if (parent->getAttribute(attrNs, attrName) != NULL) {
6694 SourcePos(parent->getFilename(), parent->getStartLineNumber())
6695 .error("parent of nested resource already defines attribute '%s:%s'",
6696 - String8(attrPackage).string(), String8(attrName).string());
6697 + String8(attrPackage).c_str(), String8(attrName).c_str());
6698 return UNKNOWN_ERROR;
6699 }
6700
6701 diff --git a/tools/aapt/SourcePos.cpp b/tools/aapt/SourcePos.cpp
6702 index 38643201c22d..e13028684414 100644
6703 --- a/tools/aapt/SourcePos.cpp
6704 +++ b/tools/aapt/SourcePos.cpp
6705 @@ -80,12 +80,12 @@ ErrorPos::print(FILE* to) const
6706
6707 if (!this->file.isEmpty()) {
6708 if (this->line >= 0) {
6709 - fprintf(to, "%s:%d: %s%s\n", this->file.string(), this->line, type, this->error.string());
6710 + fprintf(to, "%s:%d: %s%s\n", this->file.c_str(), this->line, type, this->error.c_str());
6711 } else {
6712 - fprintf(to, "%s: %s%s\n", this->file.string(), type, this->error.string());
6713 + fprintf(to, "%s: %s%s\n", this->file.c_str(), type, this->error.c_str());
6714 }
6715 } else {
6716 - fprintf(to, "%s%s\n", type, this->error.string());
6717 + fprintf(to, "%s%s\n", type, this->error.c_str());
6718 }
6719 }
6720
6721 diff --git a/tools/aapt/StringPool.cpp b/tools/aapt/StringPool.cpp
6722 index 6cacd32eb91d..8d0268393433 100644
6723 --- a/tools/aapt/StringPool.cpp
6724 +++ b/tools/aapt/StringPool.cpp
6725 @@ -67,7 +67,7 @@ void printStringPool(const ResStringPool* pool)
6726 const size_t NS = pool->size();
6727 for (size_t s=0; s<NS; s++) {
6728 auto str = pool->string8ObjectAt(s);
6729 - printf("String #" ZD ": %s\n", (ZD_TYPE) s, (str.has_value() ? str->string() : ""));
6730 + printf("String #" ZD ": %s\n", (ZD_TYPE) s, (str.has_value() ? str->c_str() : ""));
6731 }
6732 }
6733
6734 @@ -139,7 +139,7 @@ ssize_t StringPool::add(const String16& value,
6735 if (eidx < 0) {
6736 eidx = mEntries.add(entry(value));
6737 if (eidx < 0) {
6738 - fprintf(stderr, "Failure adding string %s\n", String8(value).string());
6739 + fprintf(stderr, "Failure adding string %s\n", String8(value).c_str());
6740 return eidx;
6741 }
6742 }
6743 @@ -148,7 +148,7 @@ ssize_t StringPool::add(const String16& value,
6744 entry& ent = mEntries.editItemAt(eidx);
6745 if (kIsDebug) {
6746 printf("*** adding config type name %s, was %s\n",
6747 - configTypeName->string(), ent.configTypeName.string());
6748 + configTypeName->c_str(), ent.configTypeName.c_str());
6749 }
6750 if (ent.configTypeName.size() <= 0) {
6751 ent.configTypeName = *configTypeName;
6752 @@ -166,7 +166,7 @@ ssize_t StringPool::add(const String16& value,
6753 if (cmp >= 0) {
6754 if (cmp > 0) {
6755 if (kIsDebug) {
6756 - printf("*** inserting config: %s\n", config->toString().string());
6757 + printf("*** inserting config: %s\n", config->toString().c_str());
6758 }
6759 ent.configs.insertAt(*config, addPos);
6760 }
6761 @@ -175,7 +175,7 @@ ssize_t StringPool::add(const String16& value,
6762 }
6763 if (addPos >= ent.configs.size()) {
6764 if (kIsDebug) {
6765 - printf("*** adding config: %s\n", config->toString().string());
6766 + printf("*** adding config: %s\n", config->toString().c_str());
6767 }
6768 ent.configs.add(*config);
6769 }
6770 @@ -195,7 +195,7 @@ ssize_t StringPool::add(const String16& value,
6771
6772 if (kIsDebug) {
6773 printf("Adding string %s to pool: pos=%zd eidx=%zd vidx=%zd\n",
6774 - String8(value).string(), pos, eidx, vidx);
6775 + String8(value).c_str(), pos, eidx, vidx);
6776 }
6777
6778 return pos;
6779 @@ -286,13 +286,13 @@ void StringPool::sortByConfig()
6780
6781 for (size_t i=0; i<N; i++) {
6782 printf("#%d was %d: %s\n", i, newPosToOriginalPos[i],
6783 - mEntries[mEntryArray[newPosToOriginalPos[i]]].makeConfigsString().string());
6784 + mEntries[mEntryArray[newPosToOriginalPos[i]]].makeConfigsString().c_str());
6785 entries.add(mEntries[mEntryArray[i]]);
6786 }
6787
6788 for (size_t i=0; i<entries.size(); i++) {
6789 printf("Sorted config #%d: %s\n", i,
6790 - entries[i].makeConfigsString().string());
6791 + entries[i].makeConfigsString().c_str());
6792 }
6793 #endif
6794
6795 @@ -363,8 +363,8 @@ void StringPool::sortByConfig()
6796 printf("FINAL SORTED STRING CONFIGS:\n");
6797 for (size_t i=0; i<mEntries.size(); i++) {
6798 const entry& ent = mEntries[i];
6799 - printf("#" ZD " %s: %s\n", (ZD_TYPE)i, ent.makeConfigsString().string(),
6800 - String8(ent.value).string());
6801 + printf("#" ZD " %s: %s\n", (ZD_TYPE)i, ent.makeConfigsString().c_str(),
6802 + String8(ent.value).c_str());
6803 }
6804 #endif
6805 }
6806 @@ -415,7 +415,7 @@ status_t StringPool::writeStringBlock(const sp<AaptFile>& pool)
6807 ssize_t idx = add(span.name, true);
6808 if (idx < 0) {
6809 fprintf(stderr, "Error adding span for style tag '%s'\n",
6810 - String8(span.name).string());
6811 + String8(span.name).c_str());
6812 return idx;
6813 }
6814 span.span.name.index = (uint32_t)idx;
6815 @@ -571,7 +571,7 @@ status_t StringPool::writeStringBlock(const sp<AaptFile>& pool)
6816 if (kIsDebug) {
6817 printf("Writing entry #%zu: \"%s\" ent=%zu off=%zu\n",
6818 i,
6819 - String8(ent.value).string(),
6820 + String8(ent.value).c_str(),
6821 mEntryArray[i],
6822 ent.offset);
6823 }
6824 @@ -591,8 +591,8 @@ ssize_t StringPool::offsetForString(const String16& val) const
6825 const Vector<size_t>* indices = offsetsForString(val);
6826 ssize_t res = indices != NULL && indices->size() > 0 ? indices->itemAt(0) : -1;
6827 if (kIsDebug) {
6828 - printf("Offset for string %s: %zd (%s)\n", String8(val).string(), res,
6829 - res >= 0 ? String8(mEntries[mEntryArray[res]].value).string() : String8());
6830 + printf("Offset for string %s: %zd (%s)\n", String8(val).c_str(), res,
6831 + res >= 0 ? String8(mEntries[mEntryArray[res]].value).c_str() : String8());
6832 }
6833 return res;
6834 }
6835 diff --git a/tools/aapt/Symbol.h b/tools/aapt/Symbol.h
6836 index e1575410e38b..de1d60cbae42 100644
6837 --- a/tools/aapt/Symbol.h
6838 +++ b/tools/aapt/Symbol.h
6839 @@ -68,9 +68,9 @@ Symbol::Symbol(const android::String16& p, const android::String16& t, const and
6840
6841 android::String8 Symbol::toString() const {
6842 return android::String8::format("%s:%s/%s (0x%08x)",
6843 - android::String8(package).string(),
6844 - android::String8(type).string(),
6845 - android::String8(name).string(),
6846 + android::String8(package).c_str(),
6847 + android::String8(type).c_str(),
6848 + android::String8(name).c_str(),
6849 (int) id);
6850 }
6851
6852 diff --git a/tools/aapt/XMLNode.cpp b/tools/aapt/XMLNode.cpp
6853 index 69392d66e21f..e270a7333295 100644
6854 --- a/tools/aapt/XMLNode.cpp
6855 +++ b/tools/aapt/XMLNode.cpp
6856 @@ -66,14 +66,14 @@ static const String16 RESOURCES_TOOLS_NAMESPACE("http://schemas.android.com/tool
6857
6858 String16 getNamespaceResourcePackage(const String16& appPackage, const String16& namespaceUri, bool* outIsPublic)
6859 {
6860 - //printf("%s starts with %s?\n", String8(namespaceUri).string(),
6861 - // String8(RESOURCES_PREFIX).string());
6862 + //printf("%s starts with %s?\n", String8(namespaceUri).c_str(),
6863 + // String8(RESOURCES_PREFIX).c_str());
6864 size_t prefixSize;
6865 bool isPublic = true;
6866 if(namespaceUri.startsWith(RESOURCES_PREFIX_AUTO_PACKAGE)) {
6867 if (kIsDebug) {
6868 - printf("Using default application package: %s -> %s\n", String8(namespaceUri).string(),
6869 - String8(appPackage).string());
6870 + printf("Using default application package: %s -> %s\n", String8(namespaceUri).c_str(),
6871 + String8(appPackage).c_str());
6872 }
6873 isPublic = true;
6874 return appPackage;
6875 @@ -88,7 +88,7 @@ String16 getNamespaceResourcePackage(const String16& appPackage, const String16&
6876 }
6877
6878 //printf("YES!\n");
6879 - //printf("namespace: %s\n", String8(String16(namespaceUri, namespaceUri.size()-prefixSize, prefixSize)).string());
6880 + //printf("namespace: %s\n", String8(String16(namespaceUri, namespaceUri.size()-prefixSize, prefixSize)).c_str());
6881 if (outIsPublic) *outIsPublic = isPublic;
6882 return String16(namespaceUri, namespaceUri.size()-prefixSize, prefixSize);
6883 }
6884 @@ -97,7 +97,7 @@ status_t hasSubstitutionErrors(const char* fileName,
6885 ResXMLTree* inXml,
6886 const String16& str16)
6887 {
6888 - const char16_t* str = str16.string();
6889 + const char16_t* str = str16.c_str();
6890 const char16_t* p = str;
6891 const char16_t* end = str + str16.size();
6892
6893 @@ -223,7 +223,7 @@ status_t parseStyledString(Bundle* /* bundle */,
6894 String16 text(inXml->getText(&len));
6895 if (firstTime && text.size() > 0) {
6896 firstTime = false;
6897 - if (text.string()[0] == '@') {
6898 + if (text.c_str()[0] == '@') {
6899 // If this is a resource reference, don't do the pseudoloc.
6900 pseudolocalize = NO_PSEUDOLOCALIZATION;
6901 pseudo.setMethod(pseudolocalize);
6902 @@ -263,7 +263,7 @@ status_t parseStyledString(Bundle* /* bundle */,
6903 {
6904 SourcePos(String8(fileName), inXml->getLineNumber()).error(
6905 "Found unsupported XLIFF tag <%s>\n",
6906 - element8.string());
6907 + element8.c_str());
6908 return UNKNOWN_ERROR;
6909 }
6910 moveon:
6911 @@ -272,14 +272,14 @@ moveon:
6912
6913 if (outSpans == NULL) {
6914 SourcePos(String8(fileName), inXml->getLineNumber()).error(
6915 - "Found style tag <%s> where styles are not allowed\n", element8.string());
6916 + "Found style tag <%s> where styles are not allowed\n", element8.c_str());
6917 return UNKNOWN_ERROR;
6918 }
6919
6920 - if (!ResTable::collectString(outString, curString.string(),
6921 + if (!ResTable::collectString(outString, curString.c_str(),
6922 curString.size(), false, &errorMsg, true)) {
6923 SourcePos(String8(fileName), inXml->getLineNumber()).error("%s (in %s)\n",
6924 - errorMsg, String8(curString).string());
6925 + errorMsg, String8(curString).c_str());
6926 return UNKNOWN_ERROR;
6927 }
6928 rawString.append(curString);
6929 @@ -295,7 +295,7 @@ moveon:
6930 str = inXml->getAttributeStringValue(ai, &len);
6931 span.name.append(str, len);
6932 }
6933 - //printf("Span: %s\n", String8(span.name).string());
6934 + //printf("Span: %s\n", String8(span.name).c_str());
6935 span.span.firstChar = span.span.lastChar = outString->size();
6936 spanStack.push(span);
6937
6938 @@ -311,21 +311,21 @@ moveon:
6939 xliffDepth--;
6940 continue;
6941 }
6942 - if (!ResTable::collectString(outString, curString.string(),
6943 + if (!ResTable::collectString(outString, curString.c_str(),
6944 curString.size(), false, &errorMsg, true)) {
6945 SourcePos(String8(fileName), inXml->getLineNumber()).error("%s (in %s)\n",
6946 - errorMsg, String8(curString).string());
6947 + errorMsg, String8(curString).c_str());
6948 return UNKNOWN_ERROR;
6949 }
6950 rawString.append(curString);
6951 curString = String16();
6952
6953 if (spanStack.size() == 0) {
6954 - if (strcmp16(inXml->getElementName(&len), endTag.string()) != 0) {
6955 + if (strcmp16(inXml->getElementName(&len), endTag.c_str()) != 0) {
6956 SourcePos(String8(fileName), inXml->getLineNumber()).error(
6957 "Found tag %s where <%s> close is expected\n",
6958 - String8(inXml->getElementName(&len)).string(),
6959 - String8(endTag).string());
6960 + String8(inXml->getElementName(&len)).c_str(),
6961 + String8(endTag).c_str());
6962 return UNKNOWN_ERROR;
6963 }
6964 break;
6965 @@ -334,15 +334,15 @@ moveon:
6966 String16 spanTag;
6967 ssize_t semi = span.name.findFirst(';');
6968 if (semi >= 0) {
6969 - spanTag.setTo(span.name.string(), semi);
6970 + spanTag.setTo(span.name.c_str(), semi);
6971 } else {
6972 spanTag.setTo(span.name);
6973 }
6974 - if (strcmp16(inXml->getElementName(&len), spanTag.string()) != 0) {
6975 + if (strcmp16(inXml->getElementName(&len), spanTag.c_str()) != 0) {
6976 SourcePos(String8(fileName), inXml->getLineNumber()).error(
6977 "Found close tag %s where close tag %s is expected\n",
6978 - String8(inXml->getElementName(&len)).string(),
6979 - String8(spanTag).string());
6980 + String8(inXml->getElementName(&len)).c_str(),
6981 + String8(spanTag).c_str());
6982 return UNKNOWN_ERROR;
6983 }
6984 bool empty = true;
6985 @@ -363,7 +363,7 @@ moveon:
6986 if (0 && empty) {
6987 fprintf(stderr, "%s:%d: warning: empty '%s' span found in text '%s'\n",
6988 fileName, inXml->getLineNumber(),
6989 - String8(spanTag).string(), String8(*outString).string());
6990 + String8(spanTag).c_str(), String8(*outString).c_str());
6991
6992 }
6993 } else if (code == ResXMLTree::START_NAMESPACE) {
6994 @@ -380,11 +380,11 @@ moveon:
6995
6996 if (outSpans != NULL && outSpans->size() > 0) {
6997 if (curString.size() > 0) {
6998 - if (!ResTable::collectString(outString, curString.string(),
6999 + if (!ResTable::collectString(outString, curString.c_str(),
7000 curString.size(), false, &errorMsg, true)) {
7001 SourcePos(String8(fileName), inXml->getLineNumber()).error(
7002 "%s (in %s)\n",
7003 - errorMsg, String8(curString).string());
7004 + errorMsg, String8(curString).c_str());
7005 return UNKNOWN_ERROR;
7006 }
7007 }
7008 @@ -450,10 +450,10 @@ void printXMLBlock(ResXMLTree* block)
7009 String8 elemNs = build_namespace(namespaces, ns16);
7010 const char16_t* com16 = block->getComment(&len);
7011 if (com16) {
7012 - printf("%s <!-- %s -->\n", prefix.string(), String8(com16).string());
7013 + printf("%s <!-- %s -->\n", prefix.c_str(), String8(com16).c_str());
7014 }
7015 - printf("%sE: %s%s (line=%d)\n", prefix.string(), elemNs.string(),
7016 - String8(block->getElementName(&len)).string(),
7017 + printf("%sE: %s%s (line=%d)\n", prefix.c_str(), elemNs.c_str(),
7018 + String8(block->getElementName(&len)).c_str(),
7019 block->getLineNumber());
7020 int N = block->getAttributeCount();
7021 depth++;
7022 @@ -463,11 +463,11 @@ void printXMLBlock(ResXMLTree* block)
7023 ns16 = block->getAttributeNamespace(i, &len);
7024 String8 ns = build_namespace(namespaces, ns16);
7025 String8 name(block->getAttributeName(i, &len));
7026 - printf("%sA: ", prefix.string());
7027 + printf("%sA: ", prefix.c_str());
7028 if (res) {
7029 - printf("%s%s(0x%08x)", ns.string(), name.string(), res);
7030 + printf("%s%s(0x%08x)", ns.c_str(), name.c_str(), res);
7031 } else {
7032 - printf("%s%s", ns.string(), name.string());
7033 + printf("%s%s", ns.c_str(), name.c_str());
7034 }
7035 Res_value value;
7036 block->getAttributeValue(i, &value);
7037 @@ -480,14 +480,14 @@ void printXMLBlock(ResXMLTree* block)
7038 } else if (value.dataType == Res_value::TYPE_STRING) {
7039 printf("=\"%s\"",
7040 ResTable::normalizeForOutput(String8(block->getAttributeStringValue(i,
7041 - &len)).string()).string());
7042 + &len)).c_str()).c_str());
7043 } else {
7044 printf("=(type 0x%x)0x%x", (int)value.dataType, (int)value.data);
7045 }
7046 const char16_t* val = block->getAttributeStringValue(i, &len);
7047 if (val != NULL) {
7048 - printf(" (Raw: \"%s\")", ResTable::normalizeForOutput(String8(val).string()).
7049 - string());
7050 + printf(" (Raw: \"%s\")", ResTable::normalizeForOutput(String8(val).c_str()).
7051 + c_str());
7052 }
7053 printf("\n");
7054 }
7055 @@ -509,8 +509,8 @@ void printXMLBlock(ResXMLTree* block)
7056 }
7057 ns.uri = String8(block->getNamespaceUri(&len));
7058 namespaces.push(ns);
7059 - printf("%sN: %s=%s\n", prefix.string(), ns.prefix.string(),
7060 - ns.uri.string());
7061 + printf("%sN: %s=%s\n", prefix.c_str(), ns.prefix.c_str(),
7062 + ns.uri.c_str());
7063 depth++;
7064 } else if (code == ResXMLTree::END_NAMESPACE) {
7065 if (--depth < 0) {
7066 @@ -529,19 +529,19 @@ void printXMLBlock(ResXMLTree* block)
7067 if (ns.prefix != pr) {
7068 prefix = make_prefix(depth);
7069 printf("%s*** BAD END NS PREFIX: found=%s, expected=%s\n",
7070 - prefix.string(), pr.string(), ns.prefix.string());
7071 + prefix.c_str(), pr.c_str(), ns.prefix.c_str());
7072 }
7073 String8 uri = String8(block->getNamespaceUri(&len));
7074 if (ns.uri != uri) {
7075 prefix = make_prefix(depth);
7076 printf("%s *** BAD END NS URI: found=%s, expected=%s\n",
7077 - prefix.string(), uri.string(), ns.uri.string());
7078 + prefix.c_str(), uri.c_str(), ns.uri.c_str());
7079 }
7080 namespaces.pop();
7081 } else if (code == ResXMLTree::TEXT) {
7082 size_t len;
7083 - printf("%sC: \"%s\"\n", prefix.string(),
7084 - ResTable::normalizeForOutput(String8(block->getText(&len)).string()).string());
7085 + printf("%sC: \"%s\"\n", prefix.c_str(),
7086 + ResTable::normalizeForOutput(String8(block->getText(&len)).c_str()).c_str());
7087 }
7088 }
7089
7090 @@ -583,7 +583,7 @@ status_t parseXMLResource(const sp<AaptFile>& file, ResXMLTree* outTree,
7091 sp<XMLNode> XMLNode::parse(const sp<AaptFile>& file)
7092 {
7093 char buf[16384];
7094 - int fd = open(file->getSourceFile().string(), O_RDONLY | O_BINARY);
7095 + int fd = open(file->getSourceFile().c_str(), O_RDONLY | O_BINARY);
7096 if (fd < 0) {
7097 SourcePos(file->getSourceFile(), -1).error("Unable to open file for read: %s",
7098 strerror(errno));
7099 @@ -875,9 +875,9 @@ void XMLNode::setAttributeResID(size_t attrIdx, uint32_t resId)
7100 }
7101 if (kIsDebug) {
7102 printf("Elem %s %s=\"%s\": set res id = 0x%08x\n",
7103 - String8(getElementName()).string(),
7104 - String8(mAttributes.itemAt(attrIdx).name).string(),
7105 - String8(mAttributes.itemAt(attrIdx).string).string(),
7106 + String8(getElementName()).c_str(),
7107 + String8(mAttributes.itemAt(attrIdx).name).c_str(),
7108 + String8(mAttributes.itemAt(attrIdx).string).c_str(),
7109 resId);
7110 }
7111 mAttributes.editItemAt(attrIdx).nameResId = resId;
7112 @@ -915,7 +915,7 @@ void XMLNode::setEndLineNumber(int32_t line)
7113
7114 void XMLNode::removeWhitespace(bool stripAll, const char** cDataTags)
7115 {
7116 - //printf("Removing whitespace in %s\n", String8(mElementName).string());
7117 + //printf("Removing whitespace in %s\n", String8(mElementName).c_str());
7118 size_t N = mChildren.size();
7119 if (cDataTags) {
7120 String8 tag(mElementName);
7121 @@ -931,13 +931,13 @@ void XMLNode::removeWhitespace(bool stripAll, const char** cDataTags)
7122 sp<XMLNode> node = mChildren.itemAt(i);
7123 if (node->getType() == TYPE_CDATA) {
7124 // This is a CDATA node...
7125 - const char16_t* p = node->mChars.string();
7126 + const char16_t* p = node->mChars.c_str();
7127 while (*p != 0 && *p < 128 && isspace(*p)) {
7128 p++;
7129 }
7130 //printf("Space ends at %d in \"%s\"\n",
7131 - // (int)(p-node->mChars.string()),
7132 - // String8(node->mChars).string());
7133 + // (int)(p-node->mChars.c_str()),
7134 + // String8(node->mChars).c_str());
7135 if (*p == 0) {
7136 if (stripAll) {
7137 // Remove this node!
7138 @@ -949,18 +949,18 @@ void XMLNode::removeWhitespace(bool stripAll, const char** cDataTags)
7139 }
7140 } else {
7141 // Compact leading/trailing whitespace.
7142 - const char16_t* e = node->mChars.string()+node->mChars.size()-1;
7143 + const char16_t* e = node->mChars.c_str()+node->mChars.size()-1;
7144 while (e > p && *e < 128 && isspace(*e)) {
7145 e--;
7146 }
7147 - if (p > node->mChars.string()) {
7148 + if (p > node->mChars.c_str()) {
7149 p--;
7150 }
7151 - if (e < (node->mChars.string()+node->mChars.size()-1)) {
7152 + if (e < (node->mChars.c_str()+node->mChars.size()-1)) {
7153 e++;
7154 }
7155 - if (p > node->mChars.string() ||
7156 - e < (node->mChars.string()+node->mChars.size()-1)) {
7157 + if (p > node->mChars.c_str() ||
7158 + e < (node->mChars.c_str()+node->mChars.size()-1)) {
7159 String16 tmp(p, e-p+1);
7160 node->mChars = tmp;
7161 }
7162 @@ -986,14 +986,14 @@ status_t XMLNode::parseValues(const sp<AaptAssets>& assets,
7163 table->setCurrentXmlPos(SourcePos(mFilename, getStartLineNumber()));
7164 if (!assets->getIncludedResources()
7165 .stringToValue(&e.value, &e.string,
7166 - e.string.string(), e.string.size(), true, true,
7167 + e.string.c_str(), e.string.size(), true, true,
7168 e.nameResId, NULL, &defPackage, table, &ac)) {
7169 hasErrors = true;
7170 }
7171 if (kIsDebug) {
7172 printf("Attr %s: type=0x%x, str=%s\n",
7173 - String8(e.name).string(), e.value.dataType,
7174 - String8(e.string).string());
7175 + String8(e.name).c_str(), e.value.dataType,
7176 + String8(e.string).c_str());
7177 }
7178 }
7179 }
7180 @@ -1023,30 +1023,30 @@ status_t XMLNode::assignResourceIds(const sp<AaptAssets>& assets,
7181 String16 pkg(getNamespaceResourcePackage(String16(assets->getPackage()), e.ns, &nsIsPublic));
7182 if (kIsDebug) {
7183 printf("Elem %s %s=\"%s\": namespace(%s) %s ===> %s\n",
7184 - String8(getElementName()).string(),
7185 - String8(e.name).string(),
7186 - String8(e.string).string(),
7187 - String8(e.ns).string(),
7188 + String8(getElementName()).c_str(),
7189 + String8(e.name).c_str(),
7190 + String8(e.string).c_str(),
7191 + String8(e.ns).c_str(),
7192 (nsIsPublic) ? "public" : "private",
7193 - String8(pkg).string());
7194 + String8(pkg).c_str());
7195 }
7196 if (pkg.size() <= 0) continue;
7197 uint32_t res = table != NULL
7198 ? table->getResId(e.name, &attr, &pkg, &errorMsg, nsIsPublic)
7199 : assets->getIncludedResources().
7200 - identifierForName(e.name.string(), e.name.size(),
7201 - attr.string(), attr.size(),
7202 - pkg.string(), pkg.size());
7203 + identifierForName(e.name.c_str(), e.name.size(),
7204 + attr.c_str(), attr.size(),
7205 + pkg.c_str(), pkg.size());
7206 if (res != 0) {
7207 if (kIsDebug) {
7208 printf("XML attribute name %s: resid=0x%08x\n",
7209 - String8(e.name).string(), res);
7210 + String8(e.name).c_str(), res);
7211 }
7212 setAttributeResID(i, res);
7213 } else {
7214 SourcePos(mFilename, getStartLineNumber()).error(
7215 "No resource identifier found for attribute '%s' in package '%s'\n",
7216 - String8(e.name).string(), String8(pkg).string());
7217 + String8(e.name).c_str(), String8(pkg).c_str());
7218 hasErrors = true;
7219 }
7220 }
7221 @@ -1137,7 +1137,7 @@ status_t XMLNode::flatten(const sp<AaptFile>& dest,
7222 if (kPrintStringMetrics) {
7223 fprintf(stderr, "**** total xml size: %zu / %zu%% strings (in %s)\n",
7224 dest->getSize(), (stringPool->getSize()*100)/dest->getSize(),
7225 - dest->getPath().string());
7226 + dest->getPath().c_str());
7227 }
7228
7229 return NO_ERROR;
7230 @@ -1155,8 +1155,8 @@ void XMLNode::print(int indent)
7231 if (elemNs.size() > 0) {
7232 elemNs.append(":");
7233 }
7234 - printf("%s E: %s%s", prefix.string(),
7235 - elemNs.string(), String8(getElementName()).string());
7236 + printf("%s E: %s%s", prefix.c_str(),
7237 + elemNs.c_str(), String8(getElementName()).c_str());
7238 int N = mAttributes.size();
7239 for (i=0; i<N; i++) {
7240 ssize_t idx = mAttributeOrder.valueAt(i);
7241 @@ -1171,21 +1171,21 @@ void XMLNode::print(int indent)
7242 attrNs.append(":");
7243 }
7244 if (attr.nameResId) {
7245 - printf("%s%s(0x%08x)", attrNs.string(),
7246 - String8(attr.name).string(), attr.nameResId);
7247 + printf("%s%s(0x%08x)", attrNs.c_str(),
7248 + String8(attr.name).c_str(), attr.nameResId);
7249 } else {
7250 - printf("%s%s", attrNs.string(), String8(attr.name).string());
7251 + printf("%s%s", attrNs.c_str(), String8(attr.name).c_str());
7252 }
7253 - printf("=%s", String8(attr.string).string());
7254 + printf("=%s", String8(attr.string).c_str());
7255 }
7256 printf("\n");
7257 } else if (getType() == TYPE_NAMESPACE) {
7258 - printf("%s N: %s=%s\n", prefix.string(),
7259 + printf("%s N: %s=%s\n", prefix.c_str(),
7260 getNamespacePrefix().size() > 0
7261 - ? String8(getNamespacePrefix()).string() : "<DEF>",
7262 - String8(getNamespaceUri()).string());
7263 + ? String8(getNamespacePrefix()).c_str() : "<DEF>",
7264 + String8(getNamespaceUri()).c_str());
7265 } else {
7266 - printf("%s C: \"%s\"\n", prefix.string(), String8(getCData()).string());
7267 + printf("%s C: \"%s\"\n", prefix.c_str(), String8(getCData()).c_str());
7268 }
7269 int N = mChildren.size();
7270 for (i=0; i<N; i++) {
7271 @@ -1258,7 +1258,7 @@ void XMLCALL
7272 XMLNode::characterData(void *userData, const XML_Char *s, int len)
7273 {
7274 if (kIsDebugParse) {
7275 - printf("CDATA: \"%s\"\n", String8(s, len).string());
7276 + printf("CDATA: \"%s\"\n", String8(s, len).c_str());
7277 }
7278 ParseState* st = (ParseState*)userData;
7279 sp<XMLNode> node = NULL;
7280 @@ -1423,7 +1423,7 @@ status_t XMLNode::collect_attr_strings(StringPool* outPool,
7281 idx = outPool->add(attr.name);
7282 if (kIsDebug) {
7283 printf("Adding attr %s (resid 0x%08x) to pool: idx=%zd\n",
7284 - String8(attr.name).string(), id, idx);
7285 + String8(attr.name).c_str(), id, idx);
7286 }
7287 if (id != 0) {
7288 while ((ssize_t)outResIds->size() <= idx) {
7289 @@ -1434,7 +1434,7 @@ status_t XMLNode::collect_attr_strings(StringPool* outPool,
7290 }
7291 attr.namePoolIdx = idx;
7292 if (kIsDebug) {
7293 - printf("String %s offset=0x%08zd\n", String8(attr.name).string(), idx);
7294 + printf("String %s offset=0x%08zd\n", String8(attr.name).c_str(), idx);
7295 }
7296 }
7297 }
7298 @@ -1488,7 +1488,7 @@ status_t XMLNode::flatten_node(const StringPool& strings, const sp<AaptFile>& de
7299 node.comment.index = htodl(
7300 mComment.size() > 0 ? strings.offsetForString(mComment) : -1);
7301 //if (mComment.size() > 0) {
7302 - // printf("Flattening comment: %s\n", String8(mComment).string());
7303 + // printf("Flattening comment: %s\n", String8(mComment).c_str());
7304 //}
7305 } else {
7306 node.comment.index = htodl((uint32_t)-1);
7307 diff --git a/tools/aapt/pseudolocalize.cpp b/tools/aapt/pseudolocalize.cpp
7308 index 4e8dcb1bc6ee..fc2ed98949dd 100644
7309 --- a/tools/aapt/pseudolocalize.cpp
7310 +++ b/tools/aapt/pseudolocalize.cpp
7311 @@ -42,7 +42,7 @@ String16 Pseudolocalizer::text(const String16& text) {
7312 size_t depth = mLastDepth;
7313 size_t lastpos, pos;
7314 const size_t length= text.size();
7315 - const char16_t* str = text.string();
7316 + const char16_t* str = text.c_str();
7317 bool escaped = false;
7318 for (lastpos = pos = 0; pos < length; pos++) {
7319 char16_t c = str[pos];
7320 @@ -181,7 +181,7 @@ static bool is_possible_normal_placeholder_end(const char16_t c) {
7321
7322 static String16 pseudo_generate_expansion(const unsigned int length) {
7323 String16 result = k_expansion_string;
7324 - const char16_t* s = result.string();
7325 + const char16_t* s = result.c_str();
7326 if (result.size() < length) {
7327 result += String16(" ");
7328 result += pseudo_generate_expansion(length - result.size());
7329 @@ -237,7 +237,7 @@ String16 PseudoMethodAccent::end() {
7330 */
7331 String16 PseudoMethodAccent::text(const String16& source)
7332 {
7333 - const char16_t* s = source.string();
7334 + const char16_t* s = source.c_str();
7335 String16 result;
7336 const size_t I = source.size();
7337 bool lastspace = true;
7338 @@ -357,7 +357,7 @@ String16 PseudoMethodAccent::placeholder(const String16& source) {
7339
7340 String16 PseudoMethodBidi::text(const String16& source)
7341 {
7342 - const char16_t* s = source.string();
7343 + const char16_t* s = source.c_str();
7344 String16 result;
7345 bool lastspace = true;
7346 bool space = true;
7347 diff --git a/tools/aapt2/Debug.cpp b/tools/aapt2/Debug.cpp
7348 index f47d66ea5e87..3fa39009971c 100644
7349 --- a/tools/aapt2/Debug.cpp
7350 +++ b/tools/aapt2/Debug.cpp
7351 @@ -445,7 +445,7 @@ void Debug::DumpResStringPool(const android::ResStringPool* pool, text::Printer*
7352 const size_t NS = pool->size();
7353 for (size_t s=0; s<NS; s++) {
7354 auto str = pool->string8ObjectAt(s);
7355 - printer->Print(StringPrintf("String #%zd : %s\n", s, str.has_value() ? str->string() : ""));
7356 + printer->Print(StringPrintf("String #%zd : %s\n", s, str.has_value() ? str->c_str() : ""));
7357 }
7358 }
7359
7360 diff --git a/tools/aapt2/cmd/Util.cpp b/tools/aapt2/cmd/Util.cpp
7361 index 3244fb83fa4b..73a8d683c2bd 100644
7362 --- a/tools/aapt2/cmd/Util.cpp
7363 +++ b/tools/aapt2/cmd/Util.cpp
7364 @@ -213,7 +213,7 @@ std::unique_ptr<xml::XmlResource> GenerateSplitManifest(const AppInfo& app_info,
7365 }
7366 std::vector<std::string> sanitized_config_names;
7367 for (const auto &config : constraints.configs) {
7368 - sanitized_config_names.push_back(MakePackageSafeName(config.toString().string()));
7369 + sanitized_config_names.push_back(MakePackageSafeName(config.toString().c_str()));
7370 }
7371 split_name << "config." << util::Joiner(sanitized_config_names, "_");
7372
7373 diff --git a/tools/aapt2/format/binary/BinaryResourceParser.cpp b/tools/aapt2/format/binary/BinaryResourceParser.cpp
7374 index c65c55024bab..5ed84879d561 100644
7375 --- a/tools/aapt2/format/binary/BinaryResourceParser.cpp
7376 +++ b/tools/aapt2/format/binary/BinaryResourceParser.cpp
7377 @@ -450,7 +450,7 @@ bool BinaryResourceParser::ParseLibrary(const ResChunk_header* chunk) {
7378 const size_t count = entries.size();
7379 for (size_t i = 0; i < count; i++) {
7380 table_->included_packages_[entries.valueAt(i)] =
7381 - util::Utf16ToUtf8(StringPiece16(entries.keyAt(i).string()));
7382 + util::Utf16ToUtf8(StringPiece16(entries.keyAt(i).c_str()));
7383 }
7384 return true;
7385 }
7386 diff --git a/tools/split-select/Grouper_test.cpp b/tools/split-select/Grouper_test.cpp
7387 index 7294a86fa862..a8b78cd3cf7c 100644
7388 --- a/tools/split-select/Grouper_test.cpp
7389 +++ b/tools/split-select/Grouper_test.cpp
7390 @@ -179,7 +179,7 @@ void GrouperTest::expectHasGroupWithSplits(const Vector<const char*>& expectedSt
7391 errorMessage.append("\n");
7392 }
7393 }
7394 - ADD_FAILURE() << errorMessage.string();
7395 + ADD_FAILURE() << errorMessage.c_str();
7396 }
7397
7398 void GrouperTest::addSplit(Vector<SplitDescription>& splits, const char* str) {
7399 diff --git a/tools/split-select/Main.cpp b/tools/split-select/Main.cpp
7400 index e6966db0aa00..1e751171b370 100644
7401 --- a/tools/split-select/Main.cpp
7402 +++ b/tools/split-select/Main.cpp
7403 @@ -99,8 +99,7 @@ void generate(const KeyedVector<String8, Vector<SplitDescription> >& splits, con
7404 }
7405 masterRule = Rule::simplify(masterRule);
7406 fprintf(stdout, " {\n \"path\": \"%s\",\n \"rules\": %s\n }",
7407 - splits.keyAt(i).string(),
7408 - masterRule->toJson(2).string());
7409 + splits.keyAt(i).c_str(), masterRule->toJson(2).c_str());
7410 }
7411 fprintf(stdout, "\n]\n");
7412 }
7413 @@ -158,25 +157,23 @@ static bool getAppInfo(const String8& path, AppInfo& outInfo) {
7414 const char16_t* name = xml.getElementName(&len);
7415 String16 name16(name, len);
7416 if (name16 == kManifestTag) {
7417 - ssize_t idx = xml.indexOfAttribute(
7418 - kAndroidNamespace.string(), kAndroidNamespace.size(),
7419 - kVersionCodeAttr.string(), kVersionCodeAttr.size());
7420 + ssize_t idx = xml.indexOfAttribute(kAndroidNamespace.c_str(), kAndroidNamespace.size(),
7421 + kVersionCodeAttr.c_str(), kVersionCodeAttr.size());
7422 if (idx >= 0) {
7423 outInfo.versionCode = xml.getAttributeData(idx);
7424 }
7425
7426 } else if (name16 == kApplicationTag) {
7427 - ssize_t idx = xml.indexOfAttribute(
7428 - kAndroidNamespace.string(), kAndroidNamespace.size(),
7429 - kMultiArchAttr.string(), kMultiArchAttr.size());
7430 + ssize_t idx = xml.indexOfAttribute(kAndroidNamespace.c_str(), kAndroidNamespace.size(),
7431 + kMultiArchAttr.c_str(), kMultiArchAttr.size());
7432 if (idx >= 0) {
7433 outInfo.multiArch = xml.getAttributeData(idx) != 0;
7434 }
7435
7436 } else if (name16 == kUsesSdkTag) {
7437 - ssize_t idx = xml.indexOfAttribute(
7438 - kAndroidNamespace.string(), kAndroidNamespace.size(),
7439 - kMinSdkVersionAttr.string(), kMinSdkVersionAttr.size());
7440 + ssize_t idx =
7441 + xml.indexOfAttribute(kAndroidNamespace.c_str(), kAndroidNamespace.size(),
7442 + kMinSdkVersionAttr.c_str(), kMinSdkVersionAttr.size());
7443 if (idx >= 0) {
7444 uint16_t type = xml.getAttributeDataType(idx);
7445 if (type >= Res_value::TYPE_FIRST_INT && type <= Res_value::TYPE_LAST_INT) {
7446 @@ -187,10 +184,10 @@ static bool getAppInfo(const String8& path, AppInfo& outInfo) {
7447 fprintf(stderr, "warning: failed to retrieve android:minSdkVersion.\n");
7448 } else {
7449 char *endPtr;
7450 - int minSdk = strtol(minSdk8->string(), &endPtr, 10);
7451 - if (endPtr != minSdk8->string() + minSdk8->size()) {
7452 + int minSdk = strtol(minSdk8->c_str(), &endPtr, 10);
7453 + if (endPtr != minSdk8->c_str() + minSdk8->size()) {
7454 fprintf(stderr, "warning: failed to parse android:minSdkVersion '%s'\n",
7455 - minSdk8->string());
7456 + minSdk8->c_str());
7457 } else {
7458 outInfo.minSdkVersion = minSdk;
7459 }
7460 @@ -232,7 +229,7 @@ static Vector<SplitDescription> extractSplitDescriptionsFromApk(const String8& p
7461 splits.add();
7462 Vector<String8> parts = AaptUtil::splitAndLowerCase(dir->getFileName(i), '-');
7463 if (parseAbi(parts, 0, &splits.editTop()) < 0) {
7464 - fprintf(stderr, "Malformed library %s\n", dir->getFileName(i).string());
7465 + fprintf(stderr, "Malformed library %s\n", dir->getFileName(i).c_str());
7466 splits.pop();
7467 }
7468 }
7469 @@ -291,7 +288,7 @@ static int main(int argc, char** argv) {
7470 help();
7471 return 0;
7472 } else {
7473 - fprintf(stderr, "error: unknown argument '%s'.\n", arg.string());
7474 + fprintf(stderr, "error: unknown argument '%s'.\n", arg.c_str());
7475 usage();
7476 return 1;
7477 }
7478 @@ -313,15 +310,14 @@ static int main(int argc, char** argv) {
7479 // Find out some details about the base APK.
7480 AppInfo baseAppInfo;
7481 if (!getAppInfo(baseApkPath, baseAppInfo)) {
7482 - fprintf(stderr, "error: unable to read base APK: '%s'.\n", baseApkPath.string());
7483 + fprintf(stderr, "error: unable to read base APK: '%s'.\n", baseApkPath.c_str());
7484 return 1;
7485 }
7486
7487 SplitDescription targetSplit;
7488 if (!generateFlag) {
7489 if (!SplitDescription::parse(targetConfigStr, &targetSplit)) {
7490 - fprintf(stderr, "error: invalid --target config: '%s'.\n",
7491 - targetConfigStr.string());
7492 + fprintf(stderr, "error: invalid --target config: '%s'.\n", targetConfigStr.c_str());
7493 usage();
7494 return 1;
7495 }
7496 @@ -341,7 +337,7 @@ static int main(int argc, char** argv) {
7497 Vector<SplitDescription> splits = extractSplitDescriptionsFromApk(splitApkPaths[i]);
7498 if (splits.isEmpty()) {
7499 fprintf(stderr, "error: invalid --split path: '%s'. No splits found.\n",
7500 - splitApkPaths[i].string());
7501 + splitApkPaths[i].c_str());
7502 usage();
7503 return 1;
7504 }
7505 @@ -364,7 +360,7 @@ static int main(int argc, char** argv) {
7506 const size_t matchingSplitApkPathCount = matchingSplitPaths.size();
7507 for (size_t i = 0; i < matchingSplitApkPathCount; i++) {
7508 if (matchingSplitPaths[i] != baseApkPath) {
7509 - fprintf(stdout, "%s\n", matchingSplitPaths[i].string());
7510 + fprintf(stdout, "%s\n", matchingSplitPaths[i].c_str());
7511 }
7512 }
7513 } else {
7514 diff --git a/tools/split-select/Rule_test.cpp b/tools/split-select/Rule_test.cpp
7515 index c6cff0d0220e..c78533fd1907 100644
7516 --- a/tools/split-select/Rule_test.cpp
7517 +++ b/tools/split-select/Rule_test.cpp
7518 @@ -68,7 +68,7 @@ TEST(RuleTest, generatesValidJson) {
7519 expected.erase(std::remove_if(expected.begin(), expected.end(), ::isspace), expected.end());
7520
7521 // Result
7522 - std::string result(rule.toJson().string());
7523 + std::string result(rule.toJson().c_str());
7524 result.erase(std::remove_if(result.begin(), result.end(), ::isspace), result.end());
7525
7526 ASSERT_EQ(expected, result);
7527 diff --git a/tools/split-select/SplitDescription.cpp b/tools/split-select/SplitDescription.cpp
7528 index 99bc23d819fb..4e2b48e1f450 100644
7529 --- a/tools/split-select/SplitDescription.cpp
7530 +++ b/tools/split-select/SplitDescription.cpp
7531 @@ -134,8 +134,8 @@ bool SplitDescription::parse(const String8& str, SplitDescription* outSplit) {
7532 String8 configStr;
7533 String8 extensionStr;
7534 if (index >= 0) {
7535 - configStr.setTo(str.string(), index);
7536 - extensionStr.setTo(str.string() + index + 1);
7537 + configStr.setTo(str.c_str(), index);
7538 + extensionStr.setTo(str.c_str() + index + 1);
7539 } else {
7540 configStr.setTo(str);
7541 }
7542 diff --git a/tools/split-select/TestRules.cpp b/tools/split-select/TestRules.cpp
7543 index 86ccd6a25c18..ca3c56fe861c 100644
7544 --- a/tools/split-select/TestRules.cpp
7545 +++ b/tools/split-select/TestRules.cpp
7546 @@ -78,9 +78,8 @@ const Rule AlwaysTrue() {
7547 const String8 actualStr(actual != NULL ? actual->toJson() : String8());
7548
7549 if (expectedStr != actualStr) {
7550 - return ::testing::AssertionFailure()
7551 - << "Expected: " << expectedStr.string() << "\n"
7552 - << " Actual: " << actualStr.string();
7553 + return ::testing::AssertionFailure() << "Expected: " << expectedStr.c_str() << "\n"
7554 + << " Actual: " << actualStr.c_str();
7555 }
7556 return ::testing::AssertionSuccess();
7557 }
7558 --
7559 2.39.5
7560