Be more C++. volume UUID should always be std::string.
Test: boots
Bug: 67041047
Change-Id: I36d3944ae8de192703b9ee359900841b833fe3a1
diff --git a/VoldNativeService.cpp b/VoldNativeService.cpp
index 049f5ba..6fb1731 100644
--- a/VoldNativeService.cpp
+++ b/VoldNativeService.cpp
@@ -32,6 +32,7 @@
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
+#include <ext4_utils/ext4_crypt.h>
#include <fs_mgr.h>
#include <private/android_filesystem_config.h>
#include <utils/Trace.h>
@@ -666,7 +667,7 @@
ENFORCE_UID(AID_SYSTEM);
ACQUIRE_CRYPT_LOCK;
- return translateBool(e4crypt_add_user_key_auth(userId, userSerial, token.c_str(), secret.c_str()));
+ return translateBool(e4crypt_add_user_key_auth(userId, userSerial, token, secret));
}
binder::Status VoldNativeService::fixateNewestUserKeyAuth(int32_t userId) {
@@ -681,7 +682,7 @@
ENFORCE_UID(AID_SYSTEM);
ACQUIRE_CRYPT_LOCK;
- return translateBool(e4crypt_unlock_user_key(userId, userSerial, token.c_str(), secret.c_str()));
+ return translateBool(e4crypt_unlock_user_key(userId, userSerial, token, secret));
}
binder::Status VoldNativeService::lockUserKey(int32_t userId) {
@@ -696,7 +697,8 @@
ENFORCE_UID(AID_SYSTEM);
ACQUIRE_CRYPT_LOCK;
- const char* uuid_ = uuid ? uuid->c_str() : nullptr;
+ std::string empty_string = "";
+ auto uuid_ = uuid ? *uuid : empty_string;
return translateBool(e4crypt_prepare_user_storage(uuid_, userId, userSerial, flags));
}
@@ -705,7 +707,8 @@
ENFORCE_UID(AID_SYSTEM);
ACQUIRE_CRYPT_LOCK;
- const char* uuid_ = uuid ? uuid->c_str() : nullptr;
+ std::string empty_string = "";
+ auto uuid_ = uuid ? *uuid : empty_string;
return translateBool(e4crypt_destroy_user_storage(uuid_, userId, flags));
}
@@ -713,7 +716,7 @@
ENFORCE_UID(AID_SYSTEM);
ACQUIRE_CRYPT_LOCK;
- return translateBool(e4crypt_secdiscard(path.c_str()));
+ return translateBool(e4crypt_secdiscard(path));
}
} // namespace vold