!1500 【IPC/RPC】日志整改

Merge pull request !1500 from chenchong_666/master
This commit is contained in:
openharmony_ci 2024-11-07 12:35:52 +00:00 committed by Gitee
commit d1bb5140ed
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
12 changed files with 142 additions and 129 deletions

View File

@ -28,6 +28,7 @@
#include "system_ability_definition.h"
#include "test_capi_skeleton.h"
#include "test_service_command.h"
#include "test_service_client.h"
using namespace testing::ext;
using namespace OHOS;
@ -232,8 +233,11 @@ HWTEST_F(IpcCApiRemoteObjectUnitTest, SendRequestAsync_001, TestSize.Level1)
IPCTestHelper helper;
bool res = helper.StartTestApp(IPCTestHelper::IPC_TEST_SERVER);
ASSERT_TRUE(res);
int cmdId = TestCommand::TEST_CMD_NATIVE_IPC_REGISTER_REMOTE_STUB_OBJECT;
res = helper.StartTestApp(IPCTestHelper::IPC_TEST_CLIENT, cmdId);
std::unique_ptr<TestServiceClient> testClient = std::make_unique<TestServiceClient>();
res = testClient->ConnectService();
ASSERT_TRUE(res);
res = testClient->TestRegisterRemoteStub();
ASSERT_TRUE(res);
auto saMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
@ -242,8 +246,13 @@ HWTEST_F(IpcCApiRemoteObjectUnitTest, SendRequestAsync_001, TestSize.Level1)
sptr<IRemoteObject> object = saMgr->GetSystemAbility(IPC_TEST_SERVICE);
ASSERT_NE(object, nullptr);
auto testService = iface_cast<ITestService>(object);
ASSERT_NE(testService, nullptr);
auto remoteProxyTest = std::make_shared<NativeRemoteProxyTest>(testService);
ASSERT_NE(remoteProxyTest, nullptr);
EXPECT_EQ(remoteProxyTest->ASyncAdd(), 0);
res = testClient->TestUnRegisterRemoteStub();
ASSERT_TRUE(res);
}
HWTEST_F(IpcCApiRemoteObjectUnitTest, DeathRecipient_Create_001, TestSize.Level1)

View File

@ -28,7 +28,6 @@ int FooStub::OnRemoteRequest(uint32_t code,
switch (code) {
case GET_FOO_NAME: {
ZLOGD(LABEL, "%{public}s:called\n", __func__);
reply.WriteString(GetFooName());
break;
}
@ -99,7 +98,7 @@ FooProxy::FooProxy(const sptr<IRemoteObject> &impl)
std::string FooProxy::GetFooName()
{
ZLOGD(LABEL, "%{public}s:called\n", __func__);
ZLOGI(LABEL, "Start");
MessageParcel data, reply;
MessageOption option;
Remote()->SendRequest(GET_FOO_NAME, data, reply, option);
@ -108,7 +107,7 @@ std::string FooProxy::GetFooName()
void FooProxy::SendAsyncReply(int &replyValue)
{
ZLOGD(LABEL, "%{public}s:called\n", __func__);
ZLOGI(LABEL, "Start");
MessageParcel data, reply;
MessageOption option = { MessageOption::TF_ASYNC };
data.WriteInt32(replyValue);
@ -123,7 +122,7 @@ int FooProxy::TestNestingSend(int sendCode)
return -1;
}
int error = Remote()->SendRequest(SEND_WRONG_REPLY, dataParcel, replyParcel, option);
ZLOGE(LABEL, "send foo result = %{public}d", error);
ZLOGE(LABEL, "Send foo result = %{public}d", error);
return error;
}
} // namespace OHOS

View File

@ -112,7 +112,7 @@ pid_t IPCTestHelper::GetPidByName(std::string task_name)
}
if (sprintf_s(filepath, sizeof(filepath), "/proc/%s/status", ptr->d_name) <= 0) {
ZLOGE(LABEL, "format file failed");
ZLOGE(LABEL, "Format file failed");
closedir(dir);
return INVALID_PID;
}
@ -128,12 +128,12 @@ pid_t IPCTestHelper::GetPidByName(std::string task_name)
}
if (sscanf_s(buf, "%*s %s", curTaskName, sizeof(curTaskName)) <= 0) {
ZLOGE(LABEL, "could not find current task");
ZLOGE(LABEL, "Could not find current task");
}
if (!strcmp(task_name.c_str(), curTaskName)) {
if (sscanf_s(ptr->d_name, "%d", &pid) <= 0) {
ZLOGE(LABEL, "could not find target task");
ZLOGE(LABEL, "Could not find target task");
}
}
@ -148,7 +148,7 @@ pid_t IPCTestHelper::GetPidByName(std::string task_name)
bool IPCTestHelper::GetChildPids(std::vector<pid_t> &childPids)
{
pid_t current = getpid();
ZLOGD(LABEL, "current pid %d\n", current);
ZLOGI(LABEL, "Current pid %{public}d", current);
const std::string taskPath = "/proc/" + std::to_string(current) + "/task";
DIR *dir = opendir(taskPath.c_str());
if (dir == nullptr) {
@ -175,7 +175,7 @@ bool IPCTestHelper::GetChildPids(std::vector<pid_t> &childPids)
}
childPids.push_back(child);
ZLOGD(LABEL, "child pid %d", child);
ZLOGI(LABEL, "Child pid %{public}d", child);
}
closedir(dir);
@ -195,7 +195,7 @@ pid_t IPCTestHelper::StartExecutable(std::string name, std::string args)
std::string cmd1 = "chmod +x /system/bin/" + name;
int res = system(cmd1.c_str());
ZLOGD(LABEL, "%s, res = %d\n", cmd1.c_str(), res);
ZLOGI(LABEL, "%{public}s, res = %{public}d", cmd1.c_str(), res);
// kill the program if the program is already exist.
execPid = GetPidByName(name);
@ -208,7 +208,7 @@ pid_t IPCTestHelper::StartExecutable(std::string name, std::string args)
setenv("LD_LIBRARY_PATH", ld_library_path, 1);
}
ZLOGD(LABEL, "%s res = %d\n", cmd2.c_str(), res);
ZLOGI(LABEL, "%{public}s res = %{public}d", cmd2.c_str(), res);
do {
execPid = GetPidByName(name);
@ -219,14 +219,14 @@ pid_t IPCTestHelper::StartExecutable(std::string name, std::string args)
}
} while (checkCount++ < MAX_CHECK_COUNT);
ZLOGD(LABEL, "start %s done, pid:%d\n", name.c_str(), execPid);
ZLOGI(LABEL, "Start %{public}s done, pid = %{public}d", name.c_str(), execPid);
return execPid;
}
bool IPCTestHelper::StopExecutable(pid_t pid)
{
if (pid != INVALID_PID) {
ZLOGD(LABEL, "kill pid = %d\n", pid);
ZLOGI(LABEL, "Kill pid = %{public}d", pid);
kill(pid, SIG_KILL);
}
@ -237,7 +237,7 @@ bool IPCTestHelper::StopExecutable(std::string name)
{
pid_t pid = GetPidByName(name);
if (pid != INVALID_PID) {
ZLOGD(LABEL, "%s pid = %d, kill it\n", name.c_str(), pid);
ZLOGI(LABEL, "%{public}s pid = %{public}d, kill it", name.c_str(), pid);
kill(pid, SIG_KILL);
}
@ -250,7 +250,7 @@ bool IPCTestHelper::PrepareTestSuite()
if (pid == INVALID_PID) {
usleep(SLEEP_TIME);
pid = StartTestApp(IPC_TEST_SAMGR);
ZLOGD(LABEL, "StartSystemServer done");
ZLOGI(LABEL, "StartSystemServer done");
}
return (pid != INVALID_PID);
@ -259,7 +259,7 @@ bool IPCTestHelper::PrepareTestSuite()
bool IPCTestHelper::TearDownTestSuite()
{
for (auto it = testPids_.begin(); it != testPids_.end();) {
ZLOGD(LABEL, "kill %s", it->first.c_str());
ZLOGI(LABEL, "Kill %{public}s", it->first.c_str());
StopExecutable(it->second);
it = testPids_.erase(it);
}
@ -298,7 +298,7 @@ bool IPCTestHelper::StartTestApp(int appId, const int &cmdId)
AddTestAppPid(appName, pid);
}
ZLOGD(LABEL, "StartTestApp:%d cmdId=%d pid = %d", appId, cmdId, pid);
ZLOGI(LABEL, "StartTestApp:%{public}d cmdId = %{public}d pid = %{public}d", appId, cmdId, pid);
return (pid != INVALID_PID);
}
@ -322,7 +322,7 @@ bool IPCTestHelper::StopTestApp(int appId)
pid_t IPCTestHelper::GetTestAppPid(int appId)
{
ZLOGE(LABEL, "GetTestAppPid appId=%d", appId);
ZLOGE(LABEL, "GetTestAppPid appId = %{public}d", appId);
int pid = INVALID_PID;
std::string appName = GetTestAppName(appId);
if (appName.empty()) {
@ -336,21 +336,21 @@ pid_t IPCTestHelper::GetTestAppPid(int appId)
pid = GetPidByName(appName);
}
ZLOGE(LABEL, "GetTestAppPid return pid=%d", pid);
ZLOGE(LABEL, "GetTestAppPid return pid = %{public}d", pid);
return pid;
}
pid_t IPCTestHelper::GetPid()
{
pid_t pid = getpid();
ZLOGD(LABEL, "return pid=%{public}d", pid);
ZLOGI(LABEL, "Return pid = %{public}d", pid);
return pid;
}
uid_t IPCTestHelper::GetUid()
{
uid_t uid = getuid();
ZLOGD(LABEL, "return uid=%{public}d", uid);
ZLOGI(LABEL, "Return uid = %{public}d", uid);
return uid;
}

View File

@ -60,14 +60,14 @@ void ThreadFunc(std::shared_ptr<TestServiceClient> testClient)
void SignalHandler(int signum)
{
ZLOGD(LABEL, "caught signal %{public}d", signum);
ZLOGI(LABEL, "Caught signal %{public}d", signum);
if (gTestClient != nullptr) {
ZLOGE(LABEL, "UnRegister RemoteStub before application exit");
gTestClient->TestUnRegisterRemoteStub();
gTestClient = nullptr;
}
if (signum == SIGINT) {
ZLOGD(LABEL, "SIGINT");
ZLOGI(LABEL, "SIGINT");
IPCSkeleton::StopWorkThread();
}
}
@ -235,7 +235,7 @@ int main(int argc, char *argv[])
// The non IPC context obtains one's own sid
std::string selfSid = IPCSkeleton::GetCallingSid();
ZLOGI(LABEL, "get from service: sid: %{public}s", selfSid.c_str());
ZLOGI(LABEL, "Get from service: sid = %{public}s", selfSid.c_str());
system("kill -9 $(pidof /system/bin/ipc_server_test)");
return 0;

View File

@ -52,6 +52,6 @@ int main(int argc, char *argv[])
}
InitTokenId();
TestService::Instantiate(isEnableSerialInvokeFlag);
ZLOGD(LABEL, "call StartThreadPool");
ZLOGI(LABEL, "Call StartThreadPool");
IPCSkeleton::JoinWorkThread();
}

View File

@ -142,7 +142,7 @@ JNIEXPORT jint JNICALL Java_ohos_rpc_test_TestHelper_nativeGetTestAppPid(
pid = (jint)helper->GetTestAppPid(appId);
}
ZLOGD(LABEL, "nativeGetTestAppPid:%d", pid);
ZLOGI(LABEL, "nativeGetTestAppPid:%{public}d", pid);
return pid;
}
@ -201,7 +201,7 @@ JNIEXPORT jboolean JNICALL Java_ohos_rpc_test_TestHelper_nativeStartExecutable(
if (utfString != nullptr) {
std::string exectubeFile = std::string(utfString, length);
ZLOGD(LABEL, "StartExecutable:%s", exectubeFile.c_str());
ZLOGI(LABEL, "StartExecutable: %{public}s", exectubeFile.c_str());
helper->StartExecutable(exectubeFile);
env->ReleaseStringUTFChars(string, utfString);
return JNI_TRUE;
@ -225,7 +225,7 @@ JNIEXPORT jboolean JNICALL Java_ohos_rpc_test_TestHelper_nativeStopExecutable(
if (utfString != nullptr) {
std::string exectubeFile = std::string(utfString, length);
ZLOGD(LABEL, "StopExecutable:%s", exectubeFile.c_str());
ZLOGI(LABEL, "StopExecutable: %{public}s", exectubeFile.c_str());
helper->StopExecutable(exectubeFile);
env->ReleaseStringUTFChars(string, utfString);
return JNI_TRUE;
@ -246,7 +246,7 @@ JNIEXPORT jboolean JNICALL Java_ohos_rpc_test_TestHelper_nativeRunCommand(
if (utfString != nullptr) {
std::string shellCommand = std::string(utfString, length);
ZLOGD(LABEL, "StartExecutable:%s", shellCommand.c_str());
ZLOGI(LABEL, "StartExecutable: %{public}s", shellCommand.c_str());
system(shellCommand.c_str());
env->ReleaseStringUTFChars(string, utfString);
return JNI_TRUE;
@ -260,7 +260,7 @@ int JTestHelpertRegisterNativeMethods(JNIEnv *env)
jclass clazz;
clazz = env->FindClass("ohos/rpc/test/TestHelper");
if (clazz == nullptr) {
ZLOGD(LABEL, "Could not find class:TestHelper");
ZLOGE(LABEL, "Could not find class:TestHelper");
return -1;
}
@ -272,7 +272,7 @@ int JTestHelpertRegisterNativeMethods(JNIEnv *env)
return -1;
}
ZLOGD(LABEL, "TestHelper Register Native Methods success\n");
ZLOGI(LABEL, "TestHelper Register Native Methods success");
return 0;
}
@ -295,7 +295,7 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved)
return -1;
}
ZLOGD(LABEL, "JNI_OnLoad success\n");
ZLOGI(LABEL, "JNI_OnLoad success");
g_isTestHelperMethodRegistered = true;
return JNI_VERSION_1_4;
}

View File

@ -68,7 +68,7 @@ NativeRemoteProxyTest::NativeRemoteProxyTest(const sptr<ITestService> &testServi
: NativeRemoteBase(testService)
{
if (testService_ == nullptr) {
ZLOGE(LABEL, "test service is nullptr");
ZLOGE(LABEL, "Test service is nullptr");
return;
}
@ -143,10 +143,12 @@ int NativeRemoteProxyTest::SyncAdd()
int NativeRemoteProxyTest::ASyncAdd()
{
if (proxy_ == nullptr) {
ZLOGE(LABEL, "proxy_ is nullptr");
return -1;
}
OHIPCParcel *data = OH_IPCParcel_Create();
if (data == nullptr) {
ZLOGE(LABEL, "data is nullptr");
return -1;
}
@ -164,13 +166,13 @@ int NativeRemoteProxyTest::ASyncAdd()
int ret = OH_IPCRemoteProxy_SendRequest(proxy_, NATIVE_TEST_CMD_ASYNC_ADD, data, nullptr, &option);
OH_IPCParcel_Destroy(data);
if (ret != OH_IPC_SUCCESS) {
ZLOGE(LABEL, "ipc sendRequest return=%{public}d ", ret);
ZLOGE(LABEL, "ipc sendRequest return = %{public}d ", ret);
return -1;
}
static constexpr int TIMEOUT = 3;
WaitForAsyncReply(TIMEOUT);
if ((a + b) == asyncReply_) {
ZLOGD(LABEL, "ASyncAdd success! %{public}d + %{public}d = %{public}d", a, b, asyncReply_);
ZLOGI(LABEL, "ASyncAdd success! %{public}d + %{public}d = %{public}d", a, b, asyncReply_);
return 0;
}
ZLOGE(LABEL, "ASyncAdd failed! %{public}d + %{public}d = %{public}d", a, b, asyncReply_);
@ -180,7 +182,7 @@ int NativeRemoteProxyTest::ASyncAdd()
int NativeRemoteProxyTest::OnRemoteRequestStubCallBack(uint32_t code,
const OHIPCParcel *data, OHIPCParcel *reply, void *userData)
{
ZLOGD(LABEL, "start %{public}u", code);
ZLOGI(LABEL, "start %{public}u", code);
auto *proxyTest = reinterpret_cast<NativeRemoteProxyTest *>(userData);
if (code != NATIVE_TEST_CMD_ASYNC_ADD || proxyTest == nullptr) {
ZLOGE(LABEL, "check params or init failed!");
@ -522,7 +524,7 @@ int NativeRemoteProxyTest::AddParallel(bool isSync)
return ret;
}
}
ZLOGD(LABEL, "Parallel test success!");
ZLOGI(LABEL, "Parallel test success!");
return 0;
}
@ -556,7 +558,7 @@ NativeRemoteStubTest::~NativeRemoteStubTest()
int NativeRemoteStubTest::RegisterRemoteStub()
{
ZLOGD(LABEL, "TestRegisterRemoteStubTest");
ZLOGI(LABEL, "TestRegisterRemoteStubTest");
if (testService_ == nullptr) {
ZLOGE(LABEL, "Member variable testService_ Is a null pointer");
return OH_IPC_INNER_ERROR;
@ -567,7 +569,7 @@ int NativeRemoteStubTest::RegisterRemoteStub()
int NativeRemoteStubTest::UnRegisterRemoteStub()
{
ZLOGD(LABEL, "TestRegisterRemoteStubTest");
ZLOGI(LABEL, "TestRegisterRemoteStubTest");
if (testService_ == nullptr) {
ZLOGE(LABEL, "Member variable testService_ Is a null pointer");
return OH_IPC_INNER_ERROR;
@ -639,16 +641,16 @@ int NativeRemoteStubTest::ASyncAdd()
OH_IPCParcel_Destroy(dataParcel);
return OH_IPC_MEM_ALLOCATOR_ERROR;
}
ZLOGD(LABEL, "start create sendCallback thread!");
ZLOGI(LABEL, "start create sendCallback thread!");
std::thread th([proxyCallBack, dataParcel, replyParcel, a, b] {
std::this_thread::sleep_for(std::chrono::seconds(1));
OH_IPCParcel_WriteInt32(dataParcel, a + b);
OH_IPC_MessageOption option{ OH_IPC_REQUEST_MODE_ASYNC, 0 };
ZLOGD(LABEL, "thread start sendCallback!");
ZLOGI(LABEL, "thread start sendCallback!");
int ret = OH_IPCRemoteProxy_SendRequest(proxyCallBack, NATIVE_TEST_CMD_ASYNC_ADD,
dataParcel, replyParcel, &option);
if (ret != OH_IPC_SUCCESS) {
ZLOGE(LABEL, "ASyncAdd SendRequest failed! ret=%{public}d", ret);
ZLOGE(LABEL, "ASyncAdd SendRequest failed! ret = %{public}d", ret);
}
OH_IPCRemoteProxy_Destroy(proxyCallBack);
OH_IPCParcel_Destroy(dataParcel);

View File

@ -45,10 +45,10 @@ static int Reverse(int x)
int TestService::Instantiate(bool isEnableSerialInvokeFlag)
{
ZLOGD(LABEL, "%{public}s call in", __func__);
ZLOGI(LABEL, "Start");
auto saMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
if (saMgr == nullptr) {
ZLOGE(LABEL, "%{public}s:fail to get Registry", __func__);
ZLOGE(LABEL, "Fail to get Registry");
return -ENODEV;
}
@ -58,13 +58,13 @@ int TestService::Instantiate(bool isEnableSerialInvokeFlag)
#ifdef IPCSERVERTESTEXTRA
int result = saMgr->AddSystemAbility(IPC_EXTRA_TEST_SERVICE, newInstance);
ZLOGD(LABEL, "%{public}s: IPC_EXTRA_TEST_SERVICE result = %{public}d", __func__, result);
ZLOGI(LABEL, "IPC_EXTRA_TEST_SERVICE result = %{public}d", result);
#else
int result = saMgr->AddSystemAbility(IPC_TEST_SERVICE, newInstance);
ZLOGD(LABEL, "%{public}s: IPC_TEST_SERVICE result = %{public}d", __func__, result);
ZLOGI(LABEL, "IPC_TEST_SERVICE result = %{public}d", result);
#endif
ZLOGD(LABEL, "TestService: strong = %d", newInstance->GetSptrRefCount());
ZLOGI(LABEL, "TestService: strong = %{public}d", newInstance->GetSptrRefCount());
return result;
}
@ -113,7 +113,7 @@ int TestService::TestPingService(const std::u16string &serviceName)
{
std::u16string localServiceName = GetObjectDescriptor();
if (localServiceName.compare(serviceName) != 0) {
ZLOGE(LABEL, "local name is ""%s, passing is %s",
ZLOGE(LABEL, "Local name is %{public}s, passing is %{public}s",
Str16ToStr8(localServiceName).c_str(), Str16ToStr8(serviceName).c_str());
return -1;
}
@ -135,17 +135,17 @@ int TestService::TestGetFileDescriptor()
testFd_ = open("/data/test.txt",
O_RDWR | O_APPEND | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
if (testFd_ == INVALID_FD) {
ZLOGE(LABEL, "%s(%d):open failed.", __func__, __LINE__);
ZLOGE(LABEL, "Open failed.");
return !INVALID_FD;
}
ssize_t writeLen = write(testFd_, "Sever write!\n", strlen("Sever write!\n"));
if (writeLen < 0) {
ZLOGE(LABEL, "%s(%d): server write file failed.", __func__, __LINE__);
ZLOGE(LABEL, "Server write file failed.");
close(testFd_);
return INVALID_FD;
} else {
ZLOGD(LABEL, "%s(%d): server write file success.", __func__, __LINE__);
ZLOGI(LABEL, "Server write file success.");
}
return testFd_;
@ -291,6 +291,7 @@ int TestService::TestRegisterRemoteStub(const char *descriptor, const sptr<IRemo
int TestService::TestUnRegisterRemoteStub(const char *descriptor)
{
if (descriptor == nullptr || strlen(descriptor) < 1) {
ZLOGE(LABEL, "The descriptor pointer is empty or has a length less than 1");
return -1;
}
std::lock_guard<std::mutex> lockGuard(remoteObjectsMutex_);
@ -301,12 +302,14 @@ int TestService::TestUnRegisterRemoteStub(const char *descriptor)
sptr<IRemoteObject> TestService::TestQueryRemoteProxy(const char *descriptor)
{
if (descriptor == nullptr || strlen(descriptor) < 1) {
ZLOGE(LABEL, "The descriptor pointer is empty or has a length less than 1");
return nullptr;
}
auto data = remoteObjects_.find(descriptor);
if (data != remoteObjects_.end()) {
return data->second;
}
ZLOGI(LABEL, "The descriptor is not registered");
return nullptr;
}

View File

@ -58,7 +58,7 @@ bool TestServiceClient::StartSyncTransaction()
return false;
}
ZLOGD(LABEL, "StartSyncTransaction");
ZLOGI(LABEL, "StartSyncTransaction");
int result = 0;
int originalValue = 2019;
int reversalValue = 9102;
@ -81,7 +81,7 @@ bool TestServiceClient::StartPingService()
return false;
}
ZLOGD(LABEL, "StartPingService");
ZLOGI(LABEL, "StartPingService");
const std::u16string descriptor = ITestService::GetDescriptor();
int ret = testService_->TestPingService(descriptor);
if (ret != 0) {
@ -98,7 +98,7 @@ bool TestServiceClient::StartGetFooService()
return false;
}
ZLOGD(LABEL, "StartGetFooService");
ZLOGI(LABEL, "StartGetFooService");
sptr<IFoo> foo = testService_->TestGetFooService();
if (foo == nullptr) {
ZLOGE(LABEL, "TestGetFooService function call failed");
@ -114,7 +114,7 @@ bool TestServiceClient::StartDumpService()
return false;
}
ZLOGD(LABEL, "StartDumpService");
ZLOGI(LABEL, "StartDumpService");
int ret = testService_->TestDumpService();
if (ret != 0) {
ZLOGE(LABEL, "TestDumpService function call failed");
@ -130,7 +130,7 @@ bool TestServiceClient::StartTestFileDescriptor()
return false;
}
ZLOGD(LABEL, "StartTestFileDescriptor");
ZLOGI(LABEL, "StartTestFileDescriptor");
int fd = testService_->TestGetFileDescriptor();
if (fd == INVALID_FD) {
ZLOGE(LABEL, "TestGetFileDescriptor function call failed");
@ -151,7 +151,7 @@ bool TestServiceClient::StartLoopTest(int maxCount)
return false;
}
ZLOGD(LABEL, "StartLoopTest");
ZLOGI(LABEL, "StartLoopTest");
int count = 0;
std::string testString;
// start loop test, test times is 10240
@ -168,7 +168,7 @@ bool TestServiceClient::StartLoopTest(int maxCount)
bool TestServiceClient::TestEnableSerialInvokeFlag()
{
ZLOGD(LABEL, "TestEnableSerialInvokeFlag");
ZLOGI(LABEL, "TestEnableSerialInvokeFlag");
if (testService_ == nullptr) {
ZLOGE(LABEL, "The testService_ object is an empty object");
return false;
@ -191,7 +191,7 @@ bool TestServiceClient::TestNativeIPCSendRequests(int subCmd)
auto remoteProxy = std::make_shared<NativeRemoteProxyTest>(testService_);
if (remoteProxy == nullptr) {
ZLOGE(LABEL, "create remote proxy test failed!");
ZLOGE(LABEL, "Create remote proxy test failed!");
return false;
}
@ -208,7 +208,7 @@ bool TestServiceClient::TestNativeIPCSendRequests(int subCmd)
};
auto it = commandMap.find(subCmd);
if (it == commandMap.end()) {
ZLOGE(LABEL, "error sub cmd:%{public}d", subCmd);
ZLOGE(LABEL, "Error sub cmd:%{public}d", subCmd);
return false;
}
if (it->second() != 0) {
@ -230,7 +230,7 @@ bool TestServiceClient::TestRegisterRemoteStub()
if (remoteStub_ == nullptr) {
remoteStub_ = std::make_shared<NativeRemoteStubTest>(testService_);
if (remoteStub_ == nullptr) {
ZLOGE(LABEL, "create remote stub test failed!");
ZLOGE(LABEL, "Create remote stub test failed!");
return false;
}
}
@ -259,10 +259,10 @@ bool TestServiceClient::TestUnRegisterRemoteStub()
}
int ret = remoteStub_->UnRegisterRemoteStub();
if (ret != 0) {
ZLOGE(LABEL, "function call failed");
ZLOGE(LABEL, "UnRegisterRemoteStub function call failed");
return false;
}
ZLOGI(LABEL, "function call success");
ZLOGI(LABEL, "TestUnRegisterRemoteStub function call success");
return true;
}
@ -273,12 +273,12 @@ bool TestServiceClient::TestSendTooManyRequest()
return false;
}
ZLOGD(LABEL, "TestSendTooManyRequest");
ZLOGI(LABEL, "TestSendTooManyRequest");
int res = 0;
int data = 2024;
int ret = testService_->TestSendTooManyRequest(data, res);
if (ret != 0) {
ZLOGE(LABEL, "function call failed");
ZLOGE(LABEL, "TestSendTooManyRequest function call failed");
return false;
}
return true;
@ -295,7 +295,7 @@ bool TestServiceClient::TestMultiThreadSendRequest()
int value = 2024;
int ret = testService_->TestMultiThreadSendRequest(value, res);
if (ret != 0) {
ZLOGE(LABEL, "function call failed");
ZLOGE(LABEL, "TestMultiThreadSendRequest function call failed");
return false;
}
return true;

View File

@ -26,7 +26,7 @@ bool TestDeathRecipient::GotDeathRecipient()
void TestDeathRecipient::OnRemoteDied(const wptr<IRemoteObject> &remote)
{
gotDeathRecipient_ = true;
ZLOGI(LABEL, "recv death notice");
ZLOGI(LABEL, "Recv death notice");
}
TestDeathRecipient::TestDeathRecipient()

View File

@ -52,17 +52,17 @@ int TestServiceProxy::TestEnableSerialInvokeFlag()
MessageParcel dataParcel, replyParcel;
std::string value = "testData";
ZLOGI(LABEL, "send to server data = %{public}s", value.c_str());
ZLOGI(LABEL, "Send to server data = %{public}s", value.c_str());
dataParcel.WriteString(value);
auto remote = Remote();
if (remote == nullptr) {
ZLOGD(LABEL, "The obtained proxy is a null pointer");
ZLOGI(LABEL, "The obtained proxy is a null pointer");
return -1;
}
int ret = remote->SendRequest(TRANS_ENABLE_SERIAL_INVOKE_FLAG, dataParcel, replyParcel, option);
std::string reply = replyParcel.ReadString();
ZLOGI(LABEL, "get result from server data = %{public}s", reply.c_str());
ZLOGI(LABEL, "Get result from server data = %{public}s", reply.c_str());
return ret;
}
@ -72,14 +72,14 @@ int TestServiceProxy::TestSyncTransaction(int value, int &reply, int delayTime)
MessageParcel dataParcel, replyParcel;
int ret = -1;
ZLOGD(LABEL, "send to server data = %{public}d", value);
ZLOGI(LABEL, "Send to server data = %{public}d", value);
if (value > 0) {
dataParcel.WriteInt32(value);
dataParcel.WriteInt32(delayTime);
}
auto remote = Remote();
if (remote == nullptr) {
ZLOGD(LABEL, "The obtained proxy is a null pointer");
ZLOGI(LABEL, "The obtained proxy is a null pointer");
return ret;
}
@ -89,7 +89,7 @@ int TestServiceProxy::TestSyncTransaction(int value, int &reply, int delayTime)
}
reply = replyParcel.ReadInt32();
ZLOGD(LABEL, "get result from server data = %{public}d", reply);
ZLOGI(LABEL, "Get result from server data = %{public}d", reply);
return ret;
}
@ -101,7 +101,7 @@ int TestServiceProxy::TestSendTooManyRequest(int data, int &reply)
MessageParcel dataParcel;
MessageParcel replyParcel[SEDNREQUEST_TIMES];
ZLOGD(LABEL, "send to server data = %{public}d", data);
ZLOGI(LABEL, "Send to server data = %{public}d", data);
if (data > 0) {
dataParcel.WriteInt32(data);
dataParcel.WriteInt32(delayTime);
@ -110,7 +110,7 @@ int TestServiceProxy::TestSendTooManyRequest(int data, int &reply)
ret = Remote()->SendRequest(TRANS_ID_SYNC_TRANSACTION, dataParcel, replyParcel[i], option);
}
reply = replyParcel[0].ReadInt32();
ZLOGD(LABEL, "get result from server data = %{public}d", reply);
ZLOGI(LABEL, "Get result from server data = %{public}d", reply);
return ret;
}
@ -131,7 +131,7 @@ int TestServiceProxy::TestMultiThreadSendRequest(int data, int &reply)
}
int ret = proxyObject->SendRequest(TRANS_ID_SYNC_TRANSACTION, dataParcel, replyParcel, option);
if (ret != 0) {
ZLOGD(LABEL, "SendRequest is failed: %{public}d", ret);
ZLOGI(LABEL, "SendRequest is failed: %{public}d", ret);
return;
}
reply = replyParcel.ReadInt32();
@ -147,7 +147,7 @@ int TestServiceProxy::TestAsyncTransaction(int data, int timeout)
{
MessageOption option = { MessageOption::TF_ASYNC };
MessageParcel dataParcel, replyParcel;
ZLOGI(LABEL, "%{public}s:in, data = %{public}d", __func__, data);
ZLOGI(LABEL, "TestAsyncTransaction is called, data = %{public}d", data);
dataParcel.WriteInt32(data);
dataParcel.WriteInt32(timeout);
dataParcel.WriteBool(false);
@ -164,7 +164,7 @@ int TestServiceProxy::TestAsyncCallbackTrans(int data, int &reply, int timeout)
int ret;
MessageOption option = { MessageOption::TF_ASYNC };
MessageParcel dataParcel, replyParcel;
ZLOGI(LABEL, "%{public}s:in, data = %{public}d", __func__, data);
ZLOGI(LABEL, "TestAsyncCallbackTrans is called, data = %{public}d", data);
dataParcel.WriteInt32(data);
dataParcel.WriteInt32(timeout);
dataParcel.WriteBool(true);
@ -205,11 +205,11 @@ int TestServiceProxy::TestPingService(const std::u16string &serviceName)
int ret;
MessageOption option;
MessageParcel dataParcel, replyParcel;
ZLOGD(LABEL, "PingService");
ZLOGI(LABEL, "PingService");
dataParcel.WriteString16(serviceName);
ret = Remote()->SendRequest(TRANS_ID_PING_SERVICE, dataParcel, replyParcel, option);
int result = (ret == ERR_NONE) ? replyParcel.ReadInt32() : -1;
ZLOGD(LABEL, "PingService result = %{public}d", result);
ZLOGI(LABEL, "PingService result = %{public}d", result);
return result;
}
@ -249,13 +249,13 @@ int TestServiceProxy::TestStringTransaction(const std::string &data)
int TestServiceProxy::TestDumpService()
{
ZLOGD(LABEL, "call StartDumpService");
ZLOGI(LABEL, "call StartDumpService");
int fd = open("/data/dump.txt", O_RDWR | O_APPEND | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
if (fd == INVALID_FD) {
ZLOGE(LABEL, "Call to open system function failed.");
return -1;
}
ZLOGD(LABEL, "Start Dump Service");
ZLOGI(LABEL, "Start Dump Service");
std::vector<std::u16string> args;
args.push_back(u"DumpTest");
int ret = Remote()->Dump(fd, args);
@ -271,14 +271,14 @@ int TestServiceProxy::TestRawDataTransaction(int length, int &reply)
int ret;
MessageOption option;
MessageParcel dataParcel, replyParcel;
ZLOGE(LABEL, "send to server data length = %{public}d", length);
ZLOGE(LABEL, "Send to server data length = %{public}d", length);
if (length <= 1 || static_cast<unsigned>(length) > dataParcel.GetRawDataCapacity()) {
ZLOGE(LABEL, "length should > 1, length is %{public}d", length);
return -1;
}
unsigned char *buffer = new (std::nothrow) unsigned char[length];
if (buffer == nullptr) {
ZLOGE(LABEL, "new buffer failed of length = %{public}d", length);
ZLOGE(LABEL, "New buffer failed of length = %{public}d", length);
return -1;
}
buffer[0] = 'a';
@ -289,7 +289,7 @@ int TestServiceProxy::TestRawDataTransaction(int length, int &reply)
dataParcel.WriteInt32(length);
ret = Remote()->SendRequest(TRANS_ID_RAWDATA_TRANSACTION, dataParcel, replyParcel, option);
reply = replyParcel.ReadInt32();
ZLOGE(LABEL, "get result from server data = %{public}d", reply);
ZLOGE(LABEL, "Get result from server data = %{public}d", reply);
delete [] buffer;
return ret;
}
@ -299,7 +299,7 @@ int TestServiceProxy::TestRawDataReply(int length)
MessageOption option;
MessageParcel dataParcel, replyParcel;
if (length <= 1 || static_cast<unsigned>(length) > dataParcel.GetRawDataCapacity()) {
ZLOGE(LABEL, "length should > 1, length is %{public}d", length);
ZLOGE(LABEL, "Length should > 1, length is %{public}d", length);
return ERR_INVALID_STATE;
}
@ -329,12 +329,12 @@ int TestServiceProxy::TestRawDataReply(int length)
return ERR_INVALID_DATA;
}
if (buffer[0] != 'a' || buffer[length - 1] != 'z') {
ZLOGE(LABEL, "buffer error, length = %{public}d", length);
ZLOGE(LABEL, "Buffer error, length = %{public}d", length);
return ERR_INVALID_DATA;
}
if (replyParcel.ReadInt32() != length) {
ZLOGE(LABEL, "read raw data after failed, length = %{public}d", length);
ZLOGE(LABEL, "Read raw data after failed, length = %{public}d", length);
return ERR_INVALID_DATA;
}
@ -357,7 +357,7 @@ int TestServiceProxy::TestCallingUidPid()
IPCTestHelper helper;
int actualUid = static_cast<int>(helper.GetUid());
int actualPid = static_cast<int>(helper.GetPid());
ZLOGD(LABEL, "uid = %{public}d, pid = %{public}d, actualUid = %{public}d, actualPid = %{public}d",
ZLOGI(LABEL, "uid = %{public}d, pid = %{public}d, actualUid = %{public}d, actualPid = %{public}d",
uid, pid, actualUid, actualPid);
if (uid == actualUid && pid == actualPid) {
@ -403,7 +403,7 @@ sptr<IRemoteObject> TestServiceProxy::TestQueryRemoteProxy(const char *descripto
dataParcel.WriteString(descriptor);
int ret = Remote()->SendRequest(TRANS_ID_QUERY_REMOTE_PROXY_OBJECT, dataParcel, replyParcel, option);
if (ret != ERR_NONE) {
ZLOGE(LABEL, "ret = %{public}d", ret);
ZLOGE(LABEL, "SendRequest failed ret = %{public}d", ret);
return nullptr;
}
auto readRemoteObject = replyParcel.ReadRemoteObject();
@ -536,12 +536,12 @@ int TestServiceProxy::TestAccessTokenID64(uint64_t token_expected, uint64_t ftok
ftoken = replyParcel1.ReadUint64();
if (token != token_expected) {
ZLOGE(LABEL, "token != token_expected, token:%{public}" PRIu64, token);
ZLOGE(LABEL, "token != token_expected, token = %{public}" PRIu64, token);
ret = -1;
goto ERR;
}
if (ftoken != ftoken_expected) {
ZLOGE(LABEL, "ftoken != ftoken_expected, ftoken:%{public}" PRIu64, ftoken);
ZLOGE(LABEL, "ftoken != ftoken_expected, ftoken = %{public}" PRIu64, ftoken);
ret = -1;
goto ERR;
}
@ -560,9 +560,9 @@ int TestServiceProxy::TestAccessTokenID(int32_t ftoken_expected)
int32_t token = (int32_t)IPCSkeleton::GetCallingTokenID();
int32_t ftoken = (int32_t)IPCSkeleton::GetFirstTokenID();
int32_t tokenSelf = RpcGetSelfTokenID();
ZLOGE(LABEL, "TestServiceProxy tokenSelf: %{public}d", tokenSelf);
ZLOGE(LABEL, "TestServiceProxy ftoken: %{public}d", ftoken);
ZLOGE(LABEL, "TestServiceProxy ftoken_expected: %{public}d", ftoken_expected);
ZLOGI(LABEL, "TestServiceProxy tokenSelf: %{public}d", tokenSelf);
ZLOGI(LABEL, "TestServiceProxy ftoken: %{public}d", ftoken);
ZLOGI(LABEL, "TestServiceProxy ftoken_expected: %{public}d", ftoken_expected);
if (!CheckTokenSelf(token, tokenSelf, ftoken, 0)) {
ZLOGE(LABEL, "first");
return -1;
@ -607,7 +607,7 @@ int TestServiceProxy::TestMessageParcelAppend(MessageParcel &dst, MessageParcel
{
bool res = dst.Append(src);
if (!res) {
ZLOGE(LABEL, "message parcel append without ipc failed");
ZLOGE(LABEL, "Message parcel append without ipc failed");
return -1;
}
return 0;
@ -618,7 +618,7 @@ int TestServiceProxy::TestMessageParcelAppendWithIpc(MessageParcel &dst, Message
{
bool res = dst.Append(src);
if (!res) {
ZLOGE(LABEL, "message parcel append with ipc failed");
ZLOGE(LABEL, "Message parcel append with ipc failed");
return -1;
}
MessageOption option;
@ -641,7 +641,7 @@ int TestServiceProxy::TestFlushAsyncCalls(int count, int length)
for (int i = 0; i < count; i++) {
ret = Remote()->SendRequest(TRANS_ID_FLUSH_ASYNC_CALLS, dataParcel, replyParcel, option);
if (ret != ERR_NONE) {
ZLOGE(LABEL, "fail to send request when count = %{public}d, ret = %{public}d", count, ret);
ZLOGE(LABEL, "Fail to send request when count = %{public}d, ret = %{public}d", count, ret);
return ret;
}
}
@ -655,7 +655,7 @@ int TestServiceProxy::TestMultipleProcesses(int data, int &rep, int delayTime)
int ret;
MessageOption option;
MessageParcel dataParcel, replyParcel;
ZLOGD(LABEL, "send to server data = %{public}d", data);
ZLOGI(LABEL, "Send to server data = %{public}d", data);
if (data > 0) {
dataParcel.WriteInt32(data);
dataParcel.WriteInt32(delayTime);
@ -709,19 +709,19 @@ std::u16string TestServiceProxy::TestAshmem(sptr<Ashmem> ashmem, int32_t content
int TestServiceProxy::TestNestingSend(int sendCode, int &replyCode)
{
ZLOGW(LABEL, "%{public}s", __func__);
ZLOGW(LABEL, "Start");
MessageOption option;
MessageParcel dataParcel, replyParcel;
sptr<IFoo> foo = new FooStub();
sptr<IRemoteObject> sendFoo = foo->AsObject();
sendFoo->SetBehavior(Parcelable::BehaviorFlag::HOLD_OBJECT);
if (!dataParcel.WriteRemoteObject(sendFoo) || !dataParcel.WriteInt32(sendCode)) {
ZLOGE(LABEL, "%{public}s: fail to write data", __func__);
ZLOGE(LABEL, "Fail to write data.");
return -1;
}
int ret = Remote()->SendRequest(TRANS_ID_NESTING_SEND, dataParcel, replyParcel, option);
replyCode = replyParcel.ReadInt32();
ZLOGW(LABEL, "%{public}s: outer = %{public}d, inner = %{public}d", __func__, ret, replyCode);
ZLOGW(LABEL, "Outer = %{public}d, inner = %{public}d", ret, replyCode);
return ret;
}

View File

@ -105,7 +105,7 @@ int32_t TestServiceStub::ServerPingService(MessageParcel &data, MessageParcel &r
{
std::u16string serviceName = data.ReadString16();
int32_t result = TestPingService(serviceName);
ZLOGD(LABEL, "%{public}s:PingService: result=%{public}d", __func__, result);
ZLOGI(LABEL, "Result:%{public}d", result);
reply.WriteInt32(result);
return 0;
}
@ -141,7 +141,7 @@ int32_t TestServiceStub::ServerZtraceTransaction(MessageParcel &data, MessagePar
int32_t ret = 0;
int32_t len = data.ReadInt32();
if (len < 0) {
ZLOGE(LABEL, "%{public}s:get len failed, len = %{public}d", __func__, len);
ZLOGE(LABEL, "Get len failed, len = %{public}d", len);
return ret;
}
std::string recvString;
@ -159,18 +159,18 @@ int32_t TestServiceStub::ServerCallingUidAndPid(MessageParcel &data, MessageParc
reply.WriteInt32(IPCSkeleton::GetCallingUid());
reply.WriteInt32(IPCSkeleton::GetCallingPid());
ZLOGE(LABEL, "calling before reset uid = %{public}d, pid = %{public}d",
ZLOGI(LABEL, "Calling before reset uid = %{public}d, pid = %{public}d",
IPCSkeleton::GetCallingUid(), IPCSkeleton::GetCallingPid());
std::string token = IPCSkeleton::ResetCallingIdentity();
ZLOGE(LABEL, "calling before set uid = %{public}d, pid = %{public}d",
ZLOGI(LABEL, "Calling before set uid = %{public}d, pid = %{public}d",
IPCSkeleton::GetCallingUid(), IPCSkeleton::GetCallingPid());
if (!IPCSkeleton::SetCallingIdentity(token)) {
ZLOGE(LABEL, "Set Calling Identity fail");
return 0;
}
ZLOGE(LABEL, "calling after set uid = %{public}d, pid = %{public}d",
ZLOGI(LABEL, "Calling after set uid = %{public}d, pid = %{public}d",
IPCSkeleton::GetCallingUid(), IPCSkeleton::GetCallingPid());
return 0;
}
@ -188,8 +188,8 @@ int32_t TestServiceStub::ServerAccessTokenId(MessageParcel &data, MessageParcel
{
int32_t token = static_cast<int32_t>(IPCSkeleton::GetCallingTokenID());
int32_t ftoken = static_cast<int32_t>(IPCSkeleton::GetFirstTokenID());
ZLOGE(LABEL, "server GetCallingTokenID:%{public}d", token);
ZLOGE(LABEL, "server GetFirstTokenID:%{public}d", ftoken);
ZLOGI(LABEL, "Server GetCallingTokenID:%{public}d", token);
ZLOGI(LABEL, "Server GetFirstTokenID:%{public}d", ftoken);
reply.WriteInt32(token);
reply.WriteInt32(ftoken);
return 0;
@ -199,8 +199,8 @@ int32_t TestServiceStub::ServerAccessTokenId64(MessageParcel &data, MessageParce
{
uint64_t token = IPCSkeleton::GetCallingFullTokenID();
uint64_t ftoken = IPCSkeleton::GetFirstFullTokenID();
ZLOGE(LABEL, "server GetCallingFullTokenID:%{public}" PRIu64, token);
ZLOGE(LABEL, "server GetFirstFullTokenID:%{public}" PRIu64, ftoken);
ZLOGI(LABEL, "Server GetCallingFullTokenID:%{public}" PRIu64, token);
ZLOGI(LABEL, "Server GetFirstFullTokenID:%{public}" PRIu64, ftoken);
reply.WriteUint64(token);
reply.WriteUint64(ftoken);
return 0;
@ -296,44 +296,44 @@ int TestServiceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Message
int32_t TestServiceStub::TransferRawData(MessageParcel &data, MessageParcel &reply)
{
ZLOGD(LABEL, "enter transfer raw data");
ZLOGI(LABEL, "Enter transfer raw data");
int length = data.ReadInt32();
if (length <= 1) {
ZLOGE(LABEL, "%{public}s: length should > 1, length is %{public}d", __func__, length);
ZLOGE(LABEL, "Length should > 1, length is %{public}d", length);
if (!reply.WriteInt32(length)) {
ZLOGE(LABEL, "fail to write parcel");
ZLOGE(LABEL, "Fail to write parcel");
}
return ERR_INVALID_DATA;
}
if (!data.ContainFileDescriptors()) {
ZLOGE(LABEL, "sent raw data is less than 32k");
ZLOGE(LABEL, "Sent raw data is less than 32k");
}
const char *buffer = nullptr;
if ((buffer = reinterpret_cast<const char *>(data.ReadRawData((size_t)length))) == nullptr) {
ZLOGE(LABEL, "%{public}s:read raw data failed, length = %{public}d", __func__, length);
ZLOGE(LABEL, "Read raw data failed, length = %{public}d", length);
if (reply.WriteInt32(0)) {
ZLOGE(LABEL, "fail to write parcel");
ZLOGE(LABEL, "Fail to write parcel");
}
return ERR_INVALID_DATA;
}
if (buffer[0] != 'a' || buffer[length - 1] != 'z') {
ZLOGE(LABEL, "%{public}s:buffer error, length = %{public}d", __func__, length);
ZLOGE(LABEL, "Buffer error, length = %{public}d", length);
if (reply.WriteInt32(0)) {
ZLOGE(LABEL, "fail to write parcel");
ZLOGE(LABEL, "Fail to write parcel");
}
return ERR_INVALID_DATA;
}
if (data.ReadInt32() != length) {
ZLOGE(LABEL, "%{public}s:read raw data after failed, length = %{public}d", __func__, length);
ZLOGE(LABEL, "Read raw data after failed, length = %{public}d", length);
if (!reply.WriteInt32(0)) {
ZLOGE(LABEL, "fail to write parcel");
ZLOGE(LABEL, "Fail to write parcel");
}
return ERR_INVALID_DATA;
}
if (!reply.WriteInt32(length)) {
ZLOGE(LABEL, "fail to write parcel");
ZLOGE(LABEL, "Fail to write parcel");
return ERR_INVALID_DATA;
}
return ERR_NONE;
@ -341,19 +341,19 @@ int32_t TestServiceStub::TransferRawData(MessageParcel &data, MessageParcel &rep
int32_t TestServiceStub::ReplyRawData(MessageParcel &data, MessageParcel &reply)
{
ZLOGD(LABEL, "enter reply raw data");
ZLOGI(LABEL, "Enter reply raw data");
int length = data.ReadInt32();
if (length <= 1) {
ZLOGE(LABEL, "%{public}s: length should > 1, length is %{public}d", __func__, length);
ZLOGE(LABEL, "Length should > 1, length is %{public}d", length);
if (!reply.WriteInt32(length)) {
ZLOGE(LABEL, "fail to write parcel");
ZLOGE(LABEL, "Fail to write parcel");
}
return ERR_INVALID_DATA;
}
unsigned char *buffer = new (std::nothrow) unsigned char[length];
if (buffer == nullptr) {
ZLOGE(LABEL, "new buffer failed of length = %{public}d", length);
ZLOGE(LABEL, "New buffer failed of length = %{public}d", length);
return ERR_INVALID_STATE;
}
buffer[0] = 'a';
@ -361,7 +361,7 @@ int32_t TestServiceStub::ReplyRawData(MessageParcel &data, MessageParcel &reply)
if (!reply.WriteInt32(length) ||
!reply.WriteRawData(buffer, (size_t)length) ||
!reply.WriteInt32(length)) {
ZLOGE(LABEL, "fail to write parcel");
ZLOGE(LABEL, "Fail to write parcel");
delete [] buffer;
return ERR_INVALID_STATE;
}