summaryrefslogtreecommitdiff
path: root/tools/aapt/Images.cpp
diff options
context:
space:
mode:
author Tomasz Wasilczyk <twasilczyk@google.com> 2023-09-06 19:46:54 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-09-06 19:46:54 +0000
commitaa95ff271a31f903727c5ebc2e4990846c2073d2 (patch)
tree247609dc143ce6d8fc0c588fb8b8ef15bbd1d172 /tools/aapt/Images.cpp
parentb61b138892b337b9abf7082dde5c7c17eb82ab49 (diff)
parent4fb86ec92a08a65e2ab52f8e361edb15b380cfc4 (diff)
Merge "Move String8 path functions to androidfw and aapt" into main am: 713e3930c4 am: 0cfc1c6ddd am: 9a80e1b70c am: 13ab173d41 am: 4fb86ec92a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2723454 Change-Id: I91016723c47501051b8768c0ee29f8821cab0331 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'tools/aapt/Images.cpp')
-rw-r--r--tools/aapt/Images.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/aapt/Images.cpp b/tools/aapt/Images.cpp
index c6c7e960ba2a..cd4de90f12f6 100644
--- a/tools/aapt/Images.cpp
+++ b/tools/aapt/Images.cpp
@@ -8,6 +8,7 @@
#include "Images.h"
+#include <androidfw/PathUtils.h>
#include <androidfw/ResourceTypes.h>
#include <utils/ByteOrder.h>
@@ -1357,7 +1358,7 @@ static bool write_png_protected(png_structp write_ptr, String8& printableName, p
status_t preProcessImage(const Bundle* bundle, const sp<AaptAssets>& /* assets */,
const sp<AaptFile>& file, String8* /* outNewLeafName */)
{
- String8 ext(file->getPath().getPathExtension());
+ String8 ext(getPathExtension(file->getPath()));
// We currently only process PNG images.
if (strcmp(ext.c_str(), ".png") != 0) {
@@ -1518,7 +1519,7 @@ status_t preProcessImageToCache(const Bundle* bundle, const String8& source, con
// Check to see if we're dealing with a 9-patch
// If we are, process appropriately
- if (source.getBasePath().getPathExtension() == ".9") {
+ if (getPathExtension(getBasePath(source)) == ".9") {
if (do_9patch(source.c_str(), &imageInfo) != NO_ERROR) {
return error;
}
@@ -1584,12 +1585,12 @@ status_t preProcessImageToCache(const Bundle* bundle, const String8& source, con
status_t postProcessImage(const Bundle* bundle, const sp<AaptAssets>& assets,
ResourceTable* table, const sp<AaptFile>& file)
{
- String8 ext(file->getPath().getPathExtension());
+ String8 ext(getPathExtension(file->getPath()));
// At this point, now that we have all the resource data, all we need to
// do is compile XML files.
if (strcmp(ext.c_str(), ".xml") == 0) {
- String16 resourceName(parseResourceName(file->getSourceFile().getPathLeaf()));
+ String16 resourceName(parseResourceName(getPathLeaf(file->getSourceFile())));
return compileXmlFile(bundle, assets, resourceName, file, table);
}