diff --git a/frameworks/libs/distributeddb/common/src/param_check_utils.cpp b/frameworks/libs/distributeddb/common/src/param_check_utils.cpp index 868448d185228d5de42e86b2115f32c93d0e3308..5b80769bb8d74597e8b3c0ebe33e498eb6bfdd57 100644 --- a/frameworks/libs/distributeddb/common/src/param_check_utils.cpp +++ b/frameworks/libs/distributeddb/common/src/param_check_utils.cpp @@ -169,7 +169,7 @@ int ParamCheckUtils::CheckAndTransferAutoLaunchParam(const AutoLaunchParam ¶ LOGE("[AutoLaunch] CheckConflictNotifierType is invalid."); return -E_INVALID_ARGS; } - if (!ParamCheckUtils::CheckStoreParameter(param.storeId, param.appId, param.userId)) { + if (!ParamCheckUtils::CheckStoreParameter(param.storeId, param.appId, param.userId, false, param.subUser)) { LOGE("[AutoLaunch] CheckStoreParameter is invalid."); return -E_INVALID_ARGS; } diff --git a/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_auto_launch_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_auto_launch_test.cpp index 846a733a339381ca2801a363a3b9fe92b09b8c6b..bb248643ee2697831daaf5a0b3fa061f99a22585 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_auto_launch_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_auto_launch_test.cpp @@ -472,7 +472,7 @@ HWTEST_F(DistributedDBInterfacesAutoLaunchTest, EnableKvStoreAutoLaunch005, Test } /** - * @tc.name: EnableKvStoreAutoLaunch005 + * @tc.name: EnableKvStoreAutoLaunch006 * @tc.desc: test the over limits for the enable list. * @tc.type: FUNC * @tc.require: @@ -529,6 +529,25 @@ HWTEST_F(DistributedDBInterfacesAutoLaunchTest, EnableKvStoreAutoLaunch006, Test EXPECT_EQ(KvStoreDelegateManager::DisableKvStoreAutoLaunch(USER_ID1, APP_ID1, "store_1"), NOT_FOUND); } +/** + * @tc.name: EnableKvStoreAutoLaunch007 + * @tc.desc: test invalid enable auto launch. + * @tc.type: FUNC + * @tc.author: zqq + */ +HWTEST_F(DistributedDBInterfacesAutoLaunchTest, EnableKvStoreAutoLaunch007, TestSize.Level0) +{ + CipherPassword passwd; + AutoLaunchOption launchOption = {true, false, CipherType::DEFAULT, passwd, "", false, g_testDir}; + AutoLaunchParam param; + param.storeId = "store_id"; + param.userId = USER_ID1; + param.appId = APP_ID1; + param.option = launchOption; + param.subUser.resize(129, 'u'); // 129 is invalid length + EXPECT_EQ(KvStoreDelegateManager::EnableKvStoreAutoLaunch(param), INVALID_ARGS); +} + namespace { void SetAutoLaunchLifeCycleTime(const std::string &storeId, uint32_t time) { @@ -545,7 +564,7 @@ void SetAutoLaunchLifeCycleTime(const std::string &storeId, uint32_t time) } } /** - * @tc.name: EnableKvStoreAutoLaunch007 + * @tc.name: DisableKvStoreAutoLaunch001 * @tc.desc: test the over limits for the enable list. * @tc.type: FUNC * @tc.require: