From 61d7e391aeade6fa8da644ac6682ad85a4339302 Mon Sep 17 00:00:00 2001 From: houdisheng Date: Tue, 14 Jun 2022 15:25:23 +0800 Subject: [PATCH 01/10] =?UTF-8?q?isIdleState=E6=9D=83=E9=99=90=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- frameworks/src/bundle_state_query.cpp | 2 +- .../innerkits/include/bundle_active_client.h | 2 +- .../innerkits/include/bundle_active_proxy.h | 2 +- .../innerkits/src/bundle_active_client.cpp | 4 +-- .../innerkits/src/bundle_active_proxy.cpp | 6 ++-- .../napi/include/bundle_state_data.h | 2 +- .../device_usage_statistics_jsunit.test.js | 8 ++--- .../common/include/bundle_active_service.h | 2 +- .../common/include/ibundle_active_service.h | 4 +-- services/common/src/bundle_active_service.cpp | 36 +++++++++++++++---- services/common/src/bundle_active_stub.cpp | 6 ++-- .../unittest/device_usage_statistics_test.cpp | 6 ++-- 12 files changed, 53 insertions(+), 27 deletions(-) diff --git a/frameworks/src/bundle_state_query.cpp b/frameworks/src/bundle_state_query.cpp index b604db1..112b881 100644 --- a/frameworks/src/bundle_state_query.cpp +++ b/frameworks/src/bundle_state_query.cpp @@ -221,7 +221,7 @@ napi_value IsIdleState(napi_env env, napi_callback_info info) AsyncCallbackInfoIsIdleState *asyncCallbackInfo = (AsyncCallbackInfoIsIdleState *)data; if (asyncCallbackInfo != nullptr) { asyncCallbackInfo->state = BundleActiveClient::GetInstance().IsBundleIdle( - asyncCallbackInfo->bundleName); + asyncCallbackInfo->bundleName, asyncCallbackInfo->errorCode); } else { BUNDLE_ACTIVE_LOGE("IsIdleState, asyncCallbackInfo == nullptr"); } diff --git a/interfaces/innerkits/include/bundle_active_client.h b/interfaces/innerkits/include/bundle_active_client.h index c396903..6e186ba 100644 --- a/interfaces/innerkits/include/bundle_active_client.h +++ b/interfaces/innerkits/include/bundle_active_client.h @@ -42,7 +42,7 @@ public: * parameters: bundleName * return: if bundle is idle, return true. if bundle is not idle, return false. */ - bool IsBundleIdle(const std::string& bundleName); + bool IsBundleIdle(const std::string& bundleName, int32_t& errCode); /* * function: QueryPackageStats, query all bundle usage statistics in specific time span for calling user. * parameters: intervalType, beginTime, endTime, errCode diff --git a/interfaces/innerkits/include/bundle_active_proxy.h b/interfaces/innerkits/include/bundle_active_proxy.h index a0b90b3..5adce7c 100644 --- a/interfaces/innerkits/include/bundle_active_proxy.h +++ b/interfaces/innerkits/include/bundle_active_proxy.h @@ -38,7 +38,7 @@ public: * parameters: bundleName * return: if bundle is idle, return true. if bundle is not idle, return false. */ - bool IsBundleIdle(const std::string& bundleName) override; + bool IsBundleIdle(const std::string& bundleName, int32_t& errCode) override; /* * function: QueryPackageStats, query all bundle usage statistics in specific time span for calling user. * parameters: intervalType, beginTime, endTime, errCode diff --git a/interfaces/innerkits/src/bundle_active_client.cpp b/interfaces/innerkits/src/bundle_active_client.cpp index 58478d4..2b635de 100644 --- a/interfaces/innerkits/src/bundle_active_client.cpp +++ b/interfaces/innerkits/src/bundle_active_client.cpp @@ -63,12 +63,12 @@ int32_t BundleActiveClient::ReportEvent(BundleActiveEvent event, const int32_t u return bundleActiveProxy_->ReportEvent(event, userId); } -bool BundleActiveClient::IsBundleIdle(const std::string& bundleName) +bool BundleActiveClient::IsBundleIdle(const std::string& bundleName, int32_t& errCode) { if (!GetBundleActiveProxy()) { return -1; } - return bundleActiveProxy_->IsBundleIdle(bundleName); + return bundleActiveProxy_->IsBundleIdle(bundleName, errCode); } std::vector BundleActiveClient::QueryPackageStats(const int32_t intervalType, diff --git a/interfaces/innerkits/src/bundle_active_proxy.cpp b/interfaces/innerkits/src/bundle_active_proxy.cpp index 1392c7d..93bc327 100644 --- a/interfaces/innerkits/src/bundle_active_proxy.cpp +++ b/interfaces/innerkits/src/bundle_active_proxy.cpp @@ -33,7 +33,7 @@ int32_t BundleActiveProxy::ReportEvent(BundleActiveEvent& event, const int32_t u return result; } -bool BundleActiveProxy::IsBundleIdle(const std::string& bundleName) +bool BundleActiveProxy::IsBundleIdle(const std::string& bundleName, int32_t& errCode) { MessageParcel data; MessageParcel reply; @@ -43,8 +43,8 @@ bool BundleActiveProxy::IsBundleIdle(const std::string& bundleName) } data.WriteString(bundleName); Remote() -> SendRequest(IS_BUNDLE_IDLE, data, reply, option); - int32_t result = reply.ReadInt32(); - BUNDLE_ACTIVE_LOGI("result is %{public}d", result); + bool result = reply.ReadInt32(); + errCode = reply.ReadInt32(); return result; } diff --git a/interfaces/kits/bundlestats/napi/include/bundle_state_data.h b/interfaces/kits/bundlestats/napi/include/bundle_state_data.h index 6856cf0..8118aab 100644 --- a/interfaces/kits/bundlestats/napi/include/bundle_state_data.h +++ b/interfaces/kits/bundlestats/napi/include/bundle_state_data.h @@ -71,7 +71,7 @@ struct CallbackReceiveDataWorker { struct AsyncCallbackInfoIsIdleState : public AsyncWorkData { explicit AsyncCallbackInfoIsIdleState(napi_env env) : AsyncWorkData(env) {} std::string bundleName = ""; - bool state = true; + bool state = false; }; struct AsyncCallbackInfoPriorityGroup : public AsyncWorkData { diff --git a/interfaces/test/unittest/device_usage_statistics_jsunittest/device_usage_statistics_jsunit.test.js b/interfaces/test/unittest/device_usage_statistics_jsunittest/device_usage_statistics_jsunit.test.js index a5c96c4..284a809 100644 --- a/interfaces/test/unittest/device_usage_statistics_jsunittest/device_usage_statistics_jsunit.test.js +++ b/interfaces/test/unittest/device_usage_statistics_jsunittest/device_usage_statistics_jsunit.test.js @@ -467,7 +467,7 @@ describe("DeviceUsageStatisticsJsTest", function () { setTimeout(()=>{ done(); - }, 500); + }, 500); }) /* @@ -498,7 +498,7 @@ describe("DeviceUsageStatisticsJsTest", function () { done(); }, 500); }) - + /* * @tc.name: DeviceUsageStatisticsJsTest020 * @tc.desc: test registerGroupCallBack callback. @@ -527,7 +527,7 @@ describe("DeviceUsageStatisticsJsTest", function () { setTimeout(()=>{ done(); - }, 500); + }, 500); }) /* @@ -571,7 +571,7 @@ describe("DeviceUsageStatisticsJsTest", function () { setTimeout(()=>{ done(); - }, 500); + }, 500); }) /* diff --git a/services/common/include/bundle_active_service.h b/services/common/include/bundle_active_service.h index 954a28b..7e45ef2 100644 --- a/services/common/include/bundle_active_service.h +++ b/services/common/include/bundle_active_service.h @@ -56,7 +56,7 @@ public: * parameters: bundleName * return: if bundle is idle, return true. if bundle is not idle, return false. */ - bool IsBundleIdle(const std::string& bundleName) override; + bool IsBundleIdle(const std::string& bundleName, int32_t& errCode) override; /* * function: QueryPackageStats, query all bundle usage statistics in specific time span for calling user. * parameters: intervalType, beginTime, endTime, errCode diff --git a/services/common/include/ibundle_active_service.h b/services/common/include/ibundle_active_service.h index eff21f7..ee37510 100644 --- a/services/common/include/ibundle_active_service.h +++ b/services/common/include/ibundle_active_service.h @@ -61,7 +61,7 @@ public: * parameters: bundleName * return: if bundle is idle, return true. if bundle is not idle, return false. */ - virtual bool IsBundleIdle(const std::string& bundleName) = 0; + virtual bool IsBundleIdle(const std::string& bundleName, int32_t& errCode) = 0; /* * function: QueryPackageStats, query all bundle usage statistics in specific time span for calling user. * parameters: intervalType, beginTime, endTime, errCode @@ -120,7 +120,7 @@ public: */ virtual int32_t QueryEventStats(int64_t beginTime, int64_t endTime, std::vector& eventStats, int32_t userId) = 0; - + /* * function: QueryAppNotificationNumber, query all app notification number in specific time span for calling user. * parameters: beginTime, endTime, eventStats, userId, default userId is -1 for JS API, diff --git a/services/common/src/bundle_active_service.cpp b/services/common/src/bundle_active_service.cpp index 4375637..de701d7 100644 --- a/services/common/src/bundle_active_service.cpp +++ b/services/common/src/bundle_active_service.cpp @@ -244,20 +244,42 @@ int32_t BundleActiveService::ReportEvent(BundleActiveEvent& event, const int32_t } } -bool BundleActiveService::IsBundleIdle(const std::string& bundleName) +bool BundleActiveService::IsBundleIdle(const std::string& bundleName, int32_t& errCode) { // get uid - BUNDLE_ACTIVE_LOGI("Is bundle active called"); int32_t callingUid = OHOS::IPCSkeleton::GetCallingUid(); - BUNDLE_ACTIVE_LOGI("UID is %{public}d", callingUid); + AccessToken::AccessTokenID tokenId = OHOS::IPCSkeleton::GetCallingTokenID(); + if (!GetBundleMgrProxy()) { + BUNDLE_ACTIVE_LOGE("get bundle manager proxy failed!"); + return false; + } + std::string callingBundleName = ""; + sptrBundleMgr_->GetBundleNameForUid(callingUid, callingBundleName); + BUNDLE_ACTIVE_LOGI("UID is %{public}d, bundle name is %{public}s", callingUid, callingBundleName.c_str()); // get user id int32_t userId = -1; int32_t result = -1; - OHOS::ErrCode ret = BundleActiveAccountHelper::GetUserId(callingUid, userId); - if (ret == ERR_OK && userId != -1) { - result = bundleActiveCore_->IsBundleIdle(bundleName, userId); + BundleActiveAccountHelper::GetUserId(callingUid, userId); + if (userId != -1 && !callingBundleName.empty()) { + if (callingBundleName == bundleName) { + BUNDLE_ACTIVE_LOGI("%{public}s check its own idle state", bundleName.c_str()); + result = bundleActiveCore_->IsBundleIdle(bundleName, userId); + } else { + bool isSystemAppAndHasPermission = CheckBundleIsSystemAppAndHasPermission(callingUid, tokenId, errCode); + BUNDLE_ACTIVE_LOGI("check other bundle idle state"); + if (isSystemAppAndHasPermission) { + errCode = 0; + result = bundleActiveCore_->IsBundleIdle(bundleName, userId); + } else { + errCode = -1; + return false; + } + } + } else { + errCode = -1; + return false; } - if (result == 0) { + if (result == 0 || result == -1) { return false; } return true; diff --git a/services/common/src/bundle_active_stub.cpp b/services/common/src/bundle_active_stub.cpp index 25fe267..3dae350 100644 --- a/services/common/src/bundle_active_stub.cpp +++ b/services/common/src/bundle_active_stub.cpp @@ -40,8 +40,10 @@ int32_t BundleActiveStub::OnRemoteRequest(uint32_t code, MessageParcel& data, Me } case IS_BUNDLE_IDLE: { std::string bundleName = data.ReadString(); - int32_t result = IsBundleIdle(bundleName); - return reply.WriteInt32(result); + int32_t errCode = data.ReadInt32(); + int32_t result = IsBundleIdle(bundleName, errCode); + reply.WriteInt32(result); + return reply.WriteInt32(errCode); } case QUERY_USAGE_STATS: { std::vector result; diff --git a/test/unittest/device_usage_statistics_test.cpp b/test/unittest/device_usage_statistics_test.cpp index 01fbb0b..2748693 100644 --- a/test/unittest/device_usage_statistics_test.cpp +++ b/test/unittest/device_usage_statistics_test.cpp @@ -150,8 +150,10 @@ HWTEST_F(DeviceUsageStatisticsTest, DeviceUsageStatisticsTest_QueryPackagesStats */ HWTEST_F(DeviceUsageStatisticsTest, DeviceUsageStatisticsTest_IsBundleIdle_001, Function | MediumTest | Level0) { - bool result = BundleActiveClient::GetInstance().IsBundleIdle(DEFAULT_BUNDLENAME); - EXPECT_EQ(result, true); + int32_t errCode = 0; + bool result = BundleActiveClient::GetInstance().IsBundleIdle(DEFAULT_BUNDLENAME, errCode); + EXPECT_EQ(result, false); + EXPECT_EQ(errCode, -1); } /* -- Gitee From 9be9804d027fd808e4835327a949645a64a4b3c1 Mon Sep 17 00:00:00 2001 From: houdisheng Date: Wed, 15 Jun 2022 10:49:39 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E6=B7=BB=E5=8A=A0isbundleidle=E5=AF=B9na?= =?UTF-8?q?tive=E8=BF=9B=E7=A8=8B=E7=9A=84=E6=9D=83=E9=99=90=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- services/common/src/bundle_active_service.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/services/common/src/bundle_active_service.cpp b/services/common/src/bundle_active_service.cpp index de701d7..4a6612a 100644 --- a/services/common/src/bundle_active_service.cpp +++ b/services/common/src/bundle_active_service.cpp @@ -260,14 +260,16 @@ bool BundleActiveService::IsBundleIdle(const std::string& bundleName, int32_t& e int32_t userId = -1; int32_t result = -1; BundleActiveAccountHelper::GetUserId(callingUid, userId); - if (userId != -1 && !callingBundleName.empty()) { + if (userId != -1) { if (callingBundleName == bundleName) { BUNDLE_ACTIVE_LOGI("%{public}s check its own idle state", bundleName.c_str()); result = bundleActiveCore_->IsBundleIdle(bundleName, userId); } else { bool isSystemAppAndHasPermission = CheckBundleIsSystemAppAndHasPermission(callingUid, tokenId, errCode); BUNDLE_ACTIVE_LOGI("check other bundle idle state"); - if (isSystemAppAndHasPermission) { + if (isSystemAppAndHasPermission || + AccessToken::AccessTokenKit::GetTokenTypeFlag(tokenId) == + AccessToken::TypeATokenTypeEnum::TOKEN_NATIVE) { errCode = 0; result = bundleActiveCore_->IsBundleIdle(bundleName, userId); } else { -- Gitee From bf86d4cbc51bb7d5be8e8eb989aa37b89ef6851a Mon Sep 17 00:00:00 2001 From: houdisheng Date: Wed, 15 Jun 2022 11:06:19 +0800 Subject: [PATCH 03/10] =?UTF-8?q?isbundleidle=E6=8E=A5=E5=8F=A3=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0native=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- interfaces/innerkits/include/bundle_active_client.h | 2 +- interfaces/innerkits/include/bundle_active_proxy.h | 2 +- interfaces/innerkits/src/bundle_active_client.cpp | 4 ++-- interfaces/innerkits/src/bundle_active_proxy.cpp | 4 +++- services/common/include/bundle_active_service.h | 2 +- services/common/include/ibundle_active_service.h | 2 +- services/common/src/bundle_active_service.cpp | 7 ++++--- services/common/src/bundle_active_stub.cpp | 3 ++- 8 files changed, 15 insertions(+), 11 deletions(-) diff --git a/interfaces/innerkits/include/bundle_active_client.h b/interfaces/innerkits/include/bundle_active_client.h index 6e186ba..772000c 100644 --- a/interfaces/innerkits/include/bundle_active_client.h +++ b/interfaces/innerkits/include/bundle_active_client.h @@ -42,7 +42,7 @@ public: * parameters: bundleName * return: if bundle is idle, return true. if bundle is not idle, return false. */ - bool IsBundleIdle(const std::string& bundleName, int32_t& errCode); + bool IsBundleIdle(const std::string& bundleName, int32_t& errCode, int32_t userId = -1); /* * function: QueryPackageStats, query all bundle usage statistics in specific time span for calling user. * parameters: intervalType, beginTime, endTime, errCode diff --git a/interfaces/innerkits/include/bundle_active_proxy.h b/interfaces/innerkits/include/bundle_active_proxy.h index 5adce7c..9e0a205 100644 --- a/interfaces/innerkits/include/bundle_active_proxy.h +++ b/interfaces/innerkits/include/bundle_active_proxy.h @@ -38,7 +38,7 @@ public: * parameters: bundleName * return: if bundle is idle, return true. if bundle is not idle, return false. */ - bool IsBundleIdle(const std::string& bundleName, int32_t& errCode) override; + bool IsBundleIdle(const std::string& bundleName, int32_t& errCode, int32_t userId = -1) override; /* * function: QueryPackageStats, query all bundle usage statistics in specific time span for calling user. * parameters: intervalType, beginTime, endTime, errCode diff --git a/interfaces/innerkits/src/bundle_active_client.cpp b/interfaces/innerkits/src/bundle_active_client.cpp index 2b635de..4c0441d 100644 --- a/interfaces/innerkits/src/bundle_active_client.cpp +++ b/interfaces/innerkits/src/bundle_active_client.cpp @@ -63,12 +63,12 @@ int32_t BundleActiveClient::ReportEvent(BundleActiveEvent event, const int32_t u return bundleActiveProxy_->ReportEvent(event, userId); } -bool BundleActiveClient::IsBundleIdle(const std::string& bundleName, int32_t& errCode) +bool BundleActiveClient::IsBundleIdle(const std::string& bundleName, int32_t& errCode, int32_t userId) { if (!GetBundleActiveProxy()) { return -1; } - return bundleActiveProxy_->IsBundleIdle(bundleName, errCode); + return bundleActiveProxy_->IsBundleIdle(bundleName, errCode, userId); } std::vector BundleActiveClient::QueryPackageStats(const int32_t intervalType, diff --git a/interfaces/innerkits/src/bundle_active_proxy.cpp b/interfaces/innerkits/src/bundle_active_proxy.cpp index 93bc327..d4b64f7 100644 --- a/interfaces/innerkits/src/bundle_active_proxy.cpp +++ b/interfaces/innerkits/src/bundle_active_proxy.cpp @@ -33,7 +33,7 @@ int32_t BundleActiveProxy::ReportEvent(BundleActiveEvent& event, const int32_t u return result; } -bool BundleActiveProxy::IsBundleIdle(const std::string& bundleName, int32_t& errCode) +bool BundleActiveProxy::IsBundleIdle(const std::string& bundleName, int32_t& errCode, int32_t userId) { MessageParcel data; MessageParcel reply; @@ -42,6 +42,8 @@ bool BundleActiveProxy::IsBundleIdle(const std::string& bundleName, int32_t& err return false; } data.WriteString(bundleName); + data.WriteInt32(errCode); + data.WriteInt32(userId); Remote() -> SendRequest(IS_BUNDLE_IDLE, data, reply, option); bool result = reply.ReadInt32(); errCode = reply.ReadInt32(); diff --git a/services/common/include/bundle_active_service.h b/services/common/include/bundle_active_service.h index 7e45ef2..92ad34e 100644 --- a/services/common/include/bundle_active_service.h +++ b/services/common/include/bundle_active_service.h @@ -56,7 +56,7 @@ public: * parameters: bundleName * return: if bundle is idle, return true. if bundle is not idle, return false. */ - bool IsBundleIdle(const std::string& bundleName, int32_t& errCode) override; + bool IsBundleIdle(const std::string& bundleName, int32_t& errCode, int32_t userId = -1) override; /* * function: QueryPackageStats, query all bundle usage statistics in specific time span for calling user. * parameters: intervalType, beginTime, endTime, errCode diff --git a/services/common/include/ibundle_active_service.h b/services/common/include/ibundle_active_service.h index ee37510..4935160 100644 --- a/services/common/include/ibundle_active_service.h +++ b/services/common/include/ibundle_active_service.h @@ -61,7 +61,7 @@ public: * parameters: bundleName * return: if bundle is idle, return true. if bundle is not idle, return false. */ - virtual bool IsBundleIdle(const std::string& bundleName, int32_t& errCode) = 0; + virtual bool IsBundleIdle(const std::string& bundleName, int32_t& errCode, int32_t userId) = 0; /* * function: QueryPackageStats, query all bundle usage statistics in specific time span for calling user. * parameters: intervalType, beginTime, endTime, errCode diff --git a/services/common/src/bundle_active_service.cpp b/services/common/src/bundle_active_service.cpp index 4a6612a..0d13b45 100644 --- a/services/common/src/bundle_active_service.cpp +++ b/services/common/src/bundle_active_service.cpp @@ -244,7 +244,7 @@ int32_t BundleActiveService::ReportEvent(BundleActiveEvent& event, const int32_t } } -bool BundleActiveService::IsBundleIdle(const std::string& bundleName, int32_t& errCode) +bool BundleActiveService::IsBundleIdle(const std::string& bundleName, int32_t& errCode, int32_t userId) { // get uid int32_t callingUid = OHOS::IPCSkeleton::GetCallingUid(); @@ -257,9 +257,10 @@ bool BundleActiveService::IsBundleIdle(const std::string& bundleName, int32_t& e sptrBundleMgr_->GetBundleNameForUid(callingUid, callingBundleName); BUNDLE_ACTIVE_LOGI("UID is %{public}d, bundle name is %{public}s", callingUid, callingBundleName.c_str()); // get user id - int32_t userId = -1; int32_t result = -1; - BundleActiveAccountHelper::GetUserId(callingUid, userId); + if (userId == -1) { + BundleActiveAccountHelper::GetUserId(callingUid, userId); + } if (userId != -1) { if (callingBundleName == bundleName) { BUNDLE_ACTIVE_LOGI("%{public}s check its own idle state", bundleName.c_str()); diff --git a/services/common/src/bundle_active_stub.cpp b/services/common/src/bundle_active_stub.cpp index 3dae350..4745fe8 100644 --- a/services/common/src/bundle_active_stub.cpp +++ b/services/common/src/bundle_active_stub.cpp @@ -41,7 +41,8 @@ int32_t BundleActiveStub::OnRemoteRequest(uint32_t code, MessageParcel& data, Me case IS_BUNDLE_IDLE: { std::string bundleName = data.ReadString(); int32_t errCode = data.ReadInt32(); - int32_t result = IsBundleIdle(bundleName, errCode); + int32_t userId = data.ReadInt32(); + int32_t result = IsBundleIdle(bundleName, errCode, userId); reply.WriteInt32(result); return reply.WriteInt32(errCode); } -- Gitee From 3a1f13aa2867ea407ae6ab1cd2cf295d3ff97cde Mon Sep 17 00:00:00 2001 From: houdisheng Date: Wed, 15 Jun 2022 13:56:22 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E9=80=82=E9=85=8Dtdd=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- test/unittest/device_usage_statistics_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unittest/device_usage_statistics_test.cpp b/test/unittest/device_usage_statistics_test.cpp index 2748693..7c8142b 100644 --- a/test/unittest/device_usage_statistics_test.cpp +++ b/test/unittest/device_usage_statistics_test.cpp @@ -151,9 +151,9 @@ HWTEST_F(DeviceUsageStatisticsTest, DeviceUsageStatisticsTest_QueryPackagesStats HWTEST_F(DeviceUsageStatisticsTest, DeviceUsageStatisticsTest_IsBundleIdle_001, Function | MediumTest | Level0) { int32_t errCode = 0; - bool result = BundleActiveClient::GetInstance().IsBundleIdle(DEFAULT_BUNDLENAME, errCode); + bool result = BundleActiveClient::GetInstance().IsBundleIdle(DEFAULT_BUNDLENAME, errCode, DEFAULT_USERID); EXPECT_EQ(result, false); - EXPECT_EQ(errCode, -1); + EXPECT_EQ(errCode, 0); } /* -- Gitee From 28387759245b928c4fc20cca5e272fc28f2980b8 Mon Sep 17 00:00:00 2001 From: houdisheng Date: Wed, 15 Jun 2022 15:10:53 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9proxyipc=E9=80=9A?= =?UTF-8?q?=E8=AE=AF=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- interfaces/innerkits/src/bundle_active_proxy.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/interfaces/innerkits/src/bundle_active_proxy.cpp b/interfaces/innerkits/src/bundle_active_proxy.cpp index 3161b35..f984489 100644 --- a/interfaces/innerkits/src/bundle_active_proxy.cpp +++ b/interfaces/innerkits/src/bundle_active_proxy.cpp @@ -38,12 +38,12 @@ bool BundleActiveProxy::IsBundleIdle(const std::string& bundleName, int32_t& err MessageParcel data; MessageParcel reply; MessageOption option; - if (!data.WriteInterfaceToken(GetDescriptor())) { + if (!data.WriteInterfaceToken(GetDescriptor()) || + !data.WriteString(bundleName) || + !data.WriteInt32(errCode) || + !data.WriteInt32(userId)) { return false; } - data.WriteString(bundleName); - data.WriteInt32(errCode); - data.WriteInt32(userId); Remote() -> SendRequest(IS_BUNDLE_IDLE, data, reply, option); bool result = reply.ReadInt32(); errCode = reply.ReadInt32(); -- Gitee From 7a532ae1aeff837d901bdee5fbab220524cfcb4a Mon Sep 17 00:00:00 2001 From: houdisheng Date: Fri, 17 Jun 2022 09:28:55 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E7=89=88=E6=9D=83=E5=A4=B4=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- OAT.xml | 2 +- interfaces/innerkits/include/bundle_active_client.h | 2 +- .../innerkits/include/bundle_active_group_callback_info.h | 2 +- .../innerkits/include/bundle_active_group_callback_proxy.h | 2 +- interfaces/innerkits/include/bundle_active_proxy.h | 2 +- interfaces/innerkits/include/ibundle_active_group_callback.h | 2 +- interfaces/innerkits/src/bundle_active_client.cpp | 2 +- interfaces/innerkits/src/bundle_active_group_callback_info.cpp | 2 +- interfaces/innerkits/src/bundle_active_group_callback_proxy.cpp | 2 +- interfaces/innerkits/src/bundle_active_group_callback_stub.cpp | 2 +- interfaces/innerkits/src/bundle_active_proxy.cpp | 2 +- .../kits/bundlestats/napi/include/bundle_state_condition.h | 2 +- interfaces/kits/bundlestats/napi/include/bundle_state_data.h | 2 +- .../kits/bundlestats/napi/include/bundle_state_inner_errors.h | 2 +- .../test/unittest/device_usage_statistics_jsunittest/BUILD.gn | 2 +- .../device_usage_statistics_jsunit.test.js | 2 +- sa_profile/1907.xml | 2 +- services/common/include/bundle_active_account_helper.h | 2 +- services/common/include/bundle_active_app_state_observer.h | 2 +- services/common/include/bundle_active_binary_search.h | 2 +- services/common/include/bundle_active_common_event_subscriber.h | 2 +- services/common/include/bundle_active_constant.h | 2 +- .../common/include/bundle_active_continuous_task_observer.h | 2 +- services/common/include/bundle_active_core.h | 2 +- services/common/include/bundle_active_debug_mode.h | 2 +- services/common/include/bundle_active_log.h | 2 +- services/common/include/bundle_active_open_callback.h | 2 +- .../common/include/bundle_active_power_state_callback_proxy.h | 2 +- .../common/include/bundle_active_power_state_callback_service.h | 2 +- .../common/include/bundle_active_power_state_callback_stub.h | 2 +- services/common/include/bundle_active_service.h | 2 +- services/common/include/bundle_active_shutdown_callback_proxy.h | 2 +- .../common/include/bundle_active_shutdown_callback_service.h | 2 +- services/common/include/bundle_active_shutdown_callback_stub.h | 2 +- services/common/include/bundle_active_stub.h | 2 +- services/common/include/bundle_active_usage_database.h | 2 +- services/common/include/ibundle_active_service.h | 2 +- services/common/include/remote_death_recipient.h | 2 +- services/common/src/bundle_active_account_helper.cpp | 2 +- services/common/src/bundle_active_app_state_obsever.cpp | 2 +- services/common/src/bundle_active_binary_search.cpp | 2 +- services/common/src/bundle_active_continuous_task_observer.cpp | 2 +- services/common/src/bundle_active_core.cpp | 2 +- services/common/src/bundle_active_debug_mode.cpp | 2 +- services/common/src/bundle_active_log.cpp | 2 +- services/common/src/bundle_active_open_callback.cpp | 2 +- .../common/src/bundle_active_power_state_callback_proxy.cpp | 2 +- .../common/src/bundle_active_power_state_callback_service.cpp | 2 +- services/common/src/bundle_active_power_state_callback_stub.cpp | 2 +- services/common/src/bundle_active_service.cpp | 2 +- services/common/src/bundle_active_shutdown_callback_proxy.cpp | 2 +- services/common/src/bundle_active_shutdown_callback_service.cpp | 2 +- services/common/src/bundle_active_shutdown_callback_stub.cpp | 2 +- services/common/src/bundle_active_stub.cpp | 2 +- services/common/src/bundle_active_usage_database.cpp | 2 +- services/packagegroup/include/bundle_active_group_common.h | 2 +- services/packagegroup/include/bundle_active_group_controller.h | 2 +- services/packagegroup/include/bundle_active_group_handler.h | 2 +- services/packagegroup/include/bundle_active_package_history.h | 2 +- services/packagegroup/include/bundle_active_user_history.h | 2 +- services/packagegroup/src/bundle_active_group_controller.cpp | 2 +- services/packagegroup/src/bundle_active_group_handler.cpp | 2 +- services/packagegroup/src/bundle_active_user_history.cpp | 2 +- services/packageusage/include/bundle_active_calendar.h | 2 +- services/packageusage/include/bundle_active_event.h | 2 +- services/packageusage/include/bundle_active_event_list.h | 2 +- services/packageusage/include/bundle_active_event_stats.h | 2 +- services/packageusage/include/bundle_active_event_tracker.h | 2 +- services/packageusage/include/bundle_active_form_record.h | 2 +- services/packageusage/include/bundle_active_module_record.h | 2 +- services/packageusage/include/bundle_active_package_stats.h | 2 +- services/packageusage/include/bundle_active_period_stats.h | 2 +- services/packageusage/include/bundle_active_report_handler.h | 2 +- services/packageusage/include/bundle_active_stats_combiner.h | 2 +- .../packageusage/include/bundle_active_stats_update_listener.h | 2 +- services/packageusage/include/bundle_active_user_service.h | 2 +- services/packageusage/src/bundle_active_calendar.cpp | 2 +- services/packageusage/src/bundle_active_event.cpp | 2 +- services/packageusage/src/bundle_active_event_list.cpp | 2 +- services/packageusage/src/bundle_active_event_stats.cpp | 2 +- services/packageusage/src/bundle_active_event_tracker.cpp | 2 +- services/packageusage/src/bundle_active_form_record.cpp | 2 +- services/packageusage/src/bundle_active_module_record.cpp | 2 +- services/packageusage/src/bundle_active_package_stats.cpp | 2 +- services/packageusage/src/bundle_active_period_stats.cpp | 2 +- services/packageusage/src/bundle_active_report_handler.cpp | 2 +- services/packageusage/src/bundle_active_stats_combiner.cpp | 2 +- services/packageusage/src/bundle_active_user_service.cpp | 2 +- test/fuzztest/bundleactiveonremoterequest_fuzzer/BUILD.gn | 2 +- .../bundleactiveonremoterequest_fuzzer.cpp | 2 +- .../bundleactiveonremoterequest_fuzzer.h | 2 +- test/fuzztest/bundleactiveonremoterequest_fuzzer/corpus/init | 2 +- test/fuzztest/bundleactiveonremoterequest_fuzzer/project.xml | 2 +- utils/dump/include/bundle_active_shell_command.h | 2 +- utils/dump/include/shell_command.h | 2 +- utils/dump/src/bundle_active_shell_command.cpp | 2 +- utils/dump/src/main.cpp | 2 +- utils/dump/src/shell_command.cpp | 2 +- 98 files changed, 98 insertions(+), 98 deletions(-) diff --git a/OAT.xml b/OAT.xml index b0ba076..e566849 100644 --- a/OAT.xml +++ b/OAT.xml @@ -1,5 +1,5 @@ -