Don't use String8 path functions
Ideally, we should migrate to std::filesystem, but libc++fs is not
available for vendor binaries until b/175635923 lands.
Bug: 295394788
Test: m checkbuild
Change-Id: If285034d7b343531082d0176ab26bf51390714d0
diff --git a/cas/aidl/default/Android.bp b/cas/aidl/default/Android.bp
index 6ce5681..576016e 100644
--- a/cas/aidl/default/Android.bp
+++ b/cas/aidl/default/Android.bp
@@ -21,6 +21,7 @@
shared_libs: [
"android.hardware.cas-V1-ndk",
+ "libbase",
"libbinder_ndk",
"liblog",
"libutils",
@@ -48,6 +49,7 @@
],
shared_libs: [
"android.hardware.cas-V1-ndk",
+ "libbase",
"libbinder_ndk",
"liblog",
"libutils",
diff --git a/cas/aidl/default/FactoryLoader.h b/cas/aidl/default/FactoryLoader.h
index 6a562f6..443ea1f 100644
--- a/cas/aidl/default/FactoryLoader.h
+++ b/cas/aidl/default/FactoryLoader.h
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <android-base/strings.h>
#include <dirent.h>
#include <dlfcn.h>
#include <media/cas/CasAPI.h>
@@ -96,7 +97,7 @@
struct dirent* pEntry;
while ((pEntry = readdir(pDir))) {
String8 pluginPath = dirPath + "/" + pEntry->d_name;
- if (pluginPath.getPathExtension() == ".so") {
+ if (base::EndsWith(pluginPath.c_str(), ".so")) {
if (loadFactoryForSchemeFromPath(pluginPath, CA_system_id, library, factory)) {
mCASystemIdToLibraryPathMap.add(CA_system_id, pluginPath);
closedir(pDir);
@@ -135,7 +136,7 @@
struct dirent* pEntry;
while ((pEntry = readdir(pDir))) {
String8 pluginPath = dirPath + "/" + pEntry->d_name;
- if (pluginPath.getPathExtension() == ".so") {
+ if (base::EndsWith(pluginPath.c_str(), ".so")) {
queryPluginsFromPath(pluginPath, results);
}
}