diff --git a/frameworks/js/napi/kiosk_manager/js_kiosk_manager.cpp b/frameworks/js/napi/kiosk_manager/js_kiosk_manager.cpp index 90244fe250..3cc9764d45 100644 --- a/frameworks/js/napi/kiosk_manager/js_kiosk_manager.cpp +++ b/frameworks/js/napi/kiosk_manager/js_kiosk_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -68,11 +68,11 @@ napi_value JsKioskManager::CreateJsKioskStatus(napi_env env, napi_value objValue = nullptr; napi_create_object(env, &objValue); if (objValue == nullptr) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "null ObjValue"); + TAG_LOGE(AAFwkTag::APPKIT, "null ObjValue"); return nullptr; } if (kioskStatus == nullptr) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "null kioskStatus"); + TAG_LOGE(AAFwkTag::APPKIT, "null kioskStatus"); return nullptr; } napi_set_named_property(env, objValue, "isKioskMode", @@ -100,8 +100,8 @@ napi_value JsKioskManager::OnUpdateKioskApplicationList(napi_env env, NapiCallba std::vector appList; if (!OHOS::AppExecFwk::UnwrapArrayStringFromJS(env, info.argv[ARGC_ZERO], appList)) { - TAG_LOGE(AAFwkTag::QUICKFIX, "app list is invalid"); - ThrowInvalidParamError(env, "Parameter error: app list is invalid, must be a Array."); + TAG_LOGE(AAFwkTag::APPKIT, "app list is invalid"); + ThrowInvalidParamError(env, "Failed to parse application list. Application list must be an Array."); return CreateJsUndefined(env); } NapiAsyncTask::ExecuteCallback execute = [innerErrCode, appList]() { @@ -146,13 +146,13 @@ napi_value JsKioskManager::OnEnterKioskMode(napi_env env, NapiCallbackInfo &info auto context = OHOS::AbilityRuntime::GetStageModeContext(env, info.argv[INDEX_ZERO]); if (context == nullptr) { TAG_LOGE(AAFwkTag::APPKIT, "null context"); - ThrowInvalidParamError(env, "Parse param context failed, must not be nullptr."); + ThrowInvalidParamError(env, "Failed to get context. Context must not be nullptr."); return CreateJsUndefined(env); } auto uiAbilityContext = AbilityRuntime::Context::ConvertTo(context); if (uiAbilityContext == nullptr) { TAG_LOGE(AAFwkTag::APPKIT, "null UIAbilityContext"); - ThrowInvalidParamError(env, "Parse param context failed, must be UIAbilityContext."); + ThrowInvalidParamError(env, "Failed to get uiAbilityContext, uiAbilityContext must not be nullptr."); return CreateJsUndefined(env); } auto token = uiAbilityContext->GetToken(); @@ -202,13 +202,13 @@ napi_value JsKioskManager::OnExitKioskMode(napi_env env, NapiCallbackInfo &info) auto context = OHOS::AbilityRuntime::GetStageModeContext(env, info.argv[INDEX_ZERO]); if (context == nullptr) { TAG_LOGE(AAFwkTag::APPKIT, "null context"); - ThrowInvalidParamError(env, "Parse param context failed, must not be nullptr."); + ThrowInvalidParamError(env, "Failed to get context. Context must not be nullptr."); return CreateJsUndefined(env); } auto uiAbilityContext = AbilityRuntime::Context::ConvertTo(context); if (uiAbilityContext == nullptr) { TAG_LOGE(AAFwkTag::APPKIT, "null UIAbilityContext"); - ThrowInvalidParamError(env, "Parse param context failed, must be UIAbilityContext."); + ThrowInvalidParamError(env, "Failed to get uIAbilityContext. Context must be uIAbilityContext."); return CreateJsUndefined(env); } auto token = uiAbilityContext->GetToken(); @@ -277,15 +277,13 @@ napi_value JsKioskManager::OnGetKioskStatus(napi_env env, NapiCallbackInfo &info napi_value JsKioskManagerInit(napi_env env, napi_value exportObj) { - TAG_LOGD(AAFwkTag::APPKIT, "called"); - std::unique_ptr jsKioskManager = std::make_unique(); napi_wrap(env, exportObj, jsKioskManager.release(), JsKioskManager::Finalizer, nullptr, nullptr); const char *moduleName = "JsKioskManager"; - BindNativeFunction(env, exportObj, "updateKioskApplicationList", moduleName, + BindNativeFunction(env, exportObj, "updateKioskAppList", moduleName, JsKioskManager::UpdateKioskApplicationList); BindNativeFunction(env, exportObj, "enterKioskMode", moduleName, JsKioskManager::EnterKioskMode); BindNativeFunction(env, exportObj, "exitKioskMode", moduleName, JsKioskManager::ExitKioskMode); diff --git a/frameworks/js/napi/kiosk_manager/kiosk_manager_module.cpp b/frameworks/js/napi/kiosk_manager/kiosk_manager_module.cpp index ae0b7afeae..4e3b75b6a6 100644 --- a/frameworks/js/napi/kiosk_manager/kiosk_manager_module.cpp +++ b/frameworks/js/napi/kiosk_manager/kiosk_manager_module.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,35 +16,15 @@ #include "native_engine/native_engine.h" #include "js_kiosk_manager.h" -#ifdef ENABLE_ERRCODE /* * The module definition. */ static napi_module _module = { .nm_version = 0, - .nm_filename = "app/ability/kioskmanager_napi.so/kiosk_manager.js", .nm_register_func = OHOS::AbilityRuntime::JsKioskManagerInit, .nm_modname = "app.ability.kioskManager", }; -/* - * The module registration. - */ -extern "C" __attribute__((constructor)) void NAPI_application_KioskManager_AutoRegister(void) -{ - napi_module_register(&_module); -} -#else -/* - * The module definition. - */ -static napi_module _module = { - .nm_version = 0, - .nm_filename = "application/kioskmanager_napi.so/kiosk_manager.js", - .nm_register_func = OHOS::AbilityRuntime::JsKioskManagerInit, - .nm_modname = "application.kioskManager", -}; - /* * The module registration. */ @@ -52,4 +32,3 @@ extern "C" __attribute__((constructor)) void NapiApplicationKioskManagerAutoRegi { napi_module_register(&_module); } -#endif diff --git a/interfaces/inner_api/ability_manager/BUILD.gn b/interfaces/inner_api/ability_manager/BUILD.gn index b897a32d92..179dd4d4a1 100644 --- a/interfaces/inner_api/ability_manager/BUILD.gn +++ b/interfaces/inner_api/ability_manager/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. +# Copyright (c) 2023-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/interfaces/inner_api/ability_manager/include/ability_manager_errors.h b/interfaces/inner_api/ability_manager/include/ability_manager_errors.h index 507a4a8278..2d1be7fb3e 100644 --- a/interfaces/inner_api/ability_manager/include/ability_manager_errors.h +++ b/interfaces/inner_api/ability_manager/include/ability_manager_errors.h @@ -847,6 +847,10 @@ enum { */ ERR_APP_NOT_IN_FOCUS = 2097354, + ERR_WRITE_KIOSK_UPDATE_APP_LIST_FAILED = 2097355, + + ERR_WRITE_KIOSK_STATUS_FAILED = 2097356, + /** * Native error(3000000) for target bundle not exist. */ diff --git a/interfaces/inner_api/ability_manager/include/kiosk_status.h b/interfaces/inner_api/ability_manager/include/kiosk_status.h index be24275b2f..5df85c30b4 100644 --- a/interfaces/inner_api/ability_manager/include/kiosk_status.h +++ b/interfaces/inner_api/ability_manager/include/kiosk_status.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2025 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,8 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef OHOS_ABILITY_RUNTIME_KIOSK_INFO_H -#define OHOS_ABILITY_RUNTIME_KIOSK_INFO_H +#ifndef OHOS_ABILITY_RUNTIME_KIOSK_STATUS_H +#define OHOS_ABILITY_RUNTIME_KIOSK_STATUS_H #include @@ -37,4 +37,4 @@ struct KioskStatus : public Parcelable { }; } // namespace AAFwk } // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_KIOSK_INFO_H +#endif // OHOS_ABILITY_RUNTIME_KIOSK_STATUS_H diff --git a/services/abilitymgr/abilitymgr.gni b/services/abilitymgr/abilitymgr.gni index 185b18e6a9..2ba8c41245 100644 --- a/services/abilitymgr/abilitymgr.gni +++ b/services/abilitymgr/abilitymgr.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/services/abilitymgr/include/ability_manager_proxy.h b/services/abilitymgr/include/ability_manager_proxy.h index 8b88f323f2..3ed33e2929 100644 --- a/services/abilitymgr/include/ability_manager_proxy.h +++ b/services/abilitymgr/include/ability_manager_proxy.h @@ -1735,30 +1735,12 @@ public: const std::string &intentName, InsightIntentInfoForQuery &info) override; - /** - * Update the list of applications allowed in Kiosk mode. - * @param appList, the vector of bundle names for applications allowed in Kiosk mode. - * @return Returns ERR_OK on success, others on failure. - */ int32_t UpdateKioskApplicationList(const std::vector &appList) override; - /** - * Enter Kiosk mode - * @return Returns ERR_OK on success, others on failure. - */ int32_t EnterKioskMode(sptr callerToken) override; - /** - * Exit Kiosk mode - * @return Returns ERR_OK on success, others on failure. - */ int32_t ExitKioskMode(sptr callerToken) override; - /** - * Get current Kiosk mode information. - * @param kioskStatus, the structure to store Kiosk mode details. - * @return Returns ERR_OK on success, others on failure. - */ int32_t GetKioskStatus(AAFwk::KioskStatus &kioskStatus) override; private: diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index e71fa1b6d4..97bde0aae1 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -2075,30 +2075,12 @@ public: const std::string &intentName, InsightIntentInfoForQuery &info) override; - /** - * Update the list of applications allowed in kiosk mode. - * @param appList, the list of application bundle names that are allowed in kiosk mode. - * @return Returns ERR_OK on success, others on failure. - */ int32_t UpdateKioskApplicationList(const std::vector &appList) override; - /** - * Enter kiosk mode - * @return Returns ERR_OK on success, others on failure. - */ int32_t EnterKioskMode(sptr callerToken) override; - /** - * Exit kiosk mode - * @return Returns ERR_OK on success, others on failure. - */ int32_t ExitKioskMode(sptr callerToken) override; - /** - * Retrieve the current kiosk mode configuration and status. - * @param kioskStatus, the structure to store kiosk configuration and status information. - * @return Returns ERR_OK on success, others on failure. - */ int32_t GetKioskStatus(AAFwk::KioskStatus &kioskStatus) override; std::shared_ptr GetAbilityInterceptorExecuter(); diff --git a/services/abilitymgr/include/interceptor/kiosk_interceptor.h b/services/abilitymgr/include/interceptor/kiosk_interceptor.h index 251f589fe7..bab7d13f0d 100644 --- a/services/abilitymgr/include/interceptor/kiosk_interceptor.h +++ b/services/abilitymgr/include/interceptor/kiosk_interceptor.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_KIOSK_INTERCEPTOR_INTERCEPTOR -#define OHOS_KIOSK_INTERCEPTOR_INTERCEPTOR +#ifndef OHOS_KIOSK_INTERCEPTOR_H +#define OHOS_KIOSK_INTERCEPTOR_H #include "ability_interceptor_interface.h" namespace OHOS { @@ -26,4 +26,4 @@ public: } // namespace AAFwk } // namespace OHOS -#endif // OHOS_KIOSK_INTERCEPTOR_INTERCEPTOR +#endif // OHOS_KIOSK_INTERCEPTOR_H diff --git a/services/abilitymgr/include/kiosk_manager.h b/services/abilitymgr/include/kiosk_manager.h index ea7cf33ae7..5e9c99915b 100644 --- a/services/abilitymgr/include/kiosk_manager.h +++ b/services/abilitymgr/include/kiosk_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -44,7 +44,7 @@ private: DISALLOW_COPY_AND_MOVE(KioskManager); int32_t ExitKioskModeInner(const std::string &bundleName); bool IsInKioskModeInner(); - void notifyKioskModeChanged(bool isInKioskMode); + void NotifyKioskModeChanged(bool isInKioskMode); bool IsInWhiteListInner(const std::string &bundleName); std::function GetEnterKioskModeCallback(); std::function GetExitKioskModeCallback(); diff --git a/services/abilitymgr/src/ability_manager_proxy.cpp b/services/abilitymgr/src/ability_manager_proxy.cpp index 379d6bce9a..70e2450b36 100644 --- a/services/abilitymgr/src/ability_manager_proxy.cpp +++ b/services/abilitymgr/src/ability_manager_proxy.cpp @@ -6612,7 +6612,7 @@ int32_t AbilityManagerProxy::UpdateKioskApplicationList(const std::vector info(reply.ReadParcelable()); if (!info) { TAG_LOGE(AAFwkTag::ABILITYMGR, "read KioskStatus fail"); - return ERR_UNKNOWN_OBJECT; + return ERR_READ_RESULT_PARCEL_FAILED; } kioskStatus = *info; return reply.ReadInt32(); diff --git a/services/abilitymgr/src/ability_manager_stub.cpp b/services/abilitymgr/src/ability_manager_stub.cpp index 1b56b22d21..9c05a808bf 100644 --- a/services/abilitymgr/src/ability_manager_stub.cpp +++ b/services/abilitymgr/src/ability_manager_stub.cpp @@ -4658,7 +4658,7 @@ int32_t AbilityManagerStub::UpdateKioskApplicationListInner(MessageParcel &data, auto result = UpdateKioskApplicationList(appList); if (!reply.WriteInt32(result)) { TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); - return ERR_INVALID_VALUE; + return ERR_WRITE_RESULT_CODE_FAILED; } return NO_ERROR; } @@ -4669,7 +4669,7 @@ int32_t AbilityManagerStub::EnterKioskModeInner(MessageParcel &data, MessageParc auto result = EnterKioskMode(token); if (!reply.WriteInt32(result)) { TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); - return ERR_INVALID_VALUE; + return ERR_WRITE_RESULT_CODE_FAILED; } return NO_ERROR; } @@ -4680,7 +4680,7 @@ int32_t AbilityManagerStub::ExitKioskModeInner(MessageParcel &data, MessageParce auto result = ExitKioskMode(token); if (!reply.WriteInt32(result)) { TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); - return ERR_INVALID_VALUE; + return ERR_WRITE_RESULT_CODE_FAILED; } return NO_ERROR; } @@ -4690,13 +4690,13 @@ int32_t AbilityManagerStub::GetKioskStatusInner(MessageParcel &data, MessageParc KioskStatus kioskStatus; int result = GetKioskStatus(kioskStatus); if (!reply.WriteParcelable(&kioskStatus)) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "write kiosk info fail"); - return ERR_INVALID_VALUE; + TAG_LOGE(AAFwkTag::ABILITYMGR, "write kiosk status fail"); + return ERR_WRITE_KIOSK_STATUS_FAILED; } if (!reply.WriteInt32(result)) { TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); - return ERR_INVALID_VALUE; + return ERR_WRITE_RESULT_CODE_FAILED; } return NO_ERROR; } diff --git a/services/abilitymgr/src/interceptor/kiosk_interceptor.cpp b/services/abilitymgr/src/interceptor/kiosk_interceptor.cpp index b476c1b380..ac3d1e2579 100644 --- a/services/abilitymgr/src/interceptor/kiosk_interceptor.cpp +++ b/services/abilitymgr/src/interceptor/kiosk_interceptor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -21,10 +21,11 @@ namespace AAFwk { int KioskInterceptor::DoProcess(AbilityInterceptorParam param) { auto bundleName = param.want.GetElement().GetBundleName(); - if (!KioskManager::GetInstance().IsInKioskMode()) { + auto& kioskManager = KioskManager::GetInstance(); + if (!kioskManager.IsInKioskMode()) { return ERR_OK; } - if (!KioskManager::GetInstance().IsInWhiteList(bundleName)) { + if (!kioskManager.IsInWhiteList(bundleName)) { return ERR_KIOSK_MODE_NOT_IN_WHITELIST; } return ERR_OK; diff --git a/services/abilitymgr/src/kiosk_manager.cpp b/services/abilitymgr/src/kiosk_manager.cpp index 75b3abacfa..070a6243c7 100644 --- a/services/abilitymgr/src/kiosk_manager.cpp +++ b/services/abilitymgr/src/kiosk_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -104,7 +104,7 @@ int32_t KioskManager::EnterKioskMode(sptr callerToken) kioskStatus_.kioskBundleName_ = bundleName; kioskStatus_.kioskBundleUid_ = IPCSkeleton::GetCallingUid(); GetEnterKioskModeCallback()(); - notifyKioskModeChanged(true); + NotifyKioskModeChanged(true); return ERR_OK; } @@ -130,7 +130,7 @@ int32_t KioskManager::ExitKioskModeInner(const std::string & bundleName) return ERR_NOT_IN_KIOSK_MODE; } GetExitKioskModeCallback()(); - notifyKioskModeChanged(false); + NotifyKioskModeChanged(false); kioskStatus_.Clear(); return ERR_OK; } @@ -164,7 +164,7 @@ bool KioskManager::IsInKioskModeInner() return kioskStatus_.isKioskMode_; } -void KioskManager::notifyKioskModeChanged(bool isInKioskMode) +void KioskManager::NotifyKioskModeChanged(bool isInKioskMode) { std::string eventData = isInKioskMode ? EventFwk::CommonEventSupport::COMMON_EVENT_KIOSK_MODE_ON @@ -195,7 +195,7 @@ std::function KioskManager::GetEnterKioskModeCallback() std::function KioskManager::GetExitKioskModeCallback() { auto exitKioskModeCallback = []() { - TAG_LOGI(AAFwkTag::ABILITYMGR, "EnterKioskMode"); + TAG_LOGI(AAFwkTag::ABILITYMGR, "ExitKioskMode"); KioskManager::GetInstance().RemoveKioskInterceptor(); }; return exitKioskModeCallback; diff --git a/services/abilitymgr/src/kiosk_status.cpp b/services/abilitymgr/src/kiosk_status.cpp index 3e12a716c1..34e457ac3d 100644 --- a/services/abilitymgr/src/kiosk_status.cpp +++ b/services/abilitymgr/src/kiosk_status.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/test/unittest/ability_interceptor_test/ability_interceptor_test.cpp b/test/unittest/ability_interceptor_test/ability_interceptor_test.cpp index a2787bb152..32e13ec352 100644 --- a/test/unittest/ability_interceptor_test/ability_interceptor_test.cpp +++ b/test/unittest/ability_interceptor_test/ability_interceptor_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/test/unittest/ability_manager_client_branch_test/ability_manager_stub_mock_test.h b/test/unittest/ability_manager_client_branch_test/ability_manager_stub_mock_test.h index d921dc3782..3863558db5 100644 --- a/test/unittest/ability_manager_client_branch_test/ability_manager_stub_mock_test.h +++ b/test/unittest/ability_manager_client_branch_test/ability_manager_stub_mock_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/test/unittest/ability_manager_proxy_test/ability_manager_stub_mock.h b/test/unittest/ability_manager_proxy_test/ability_manager_stub_mock.h index 51597818fa..0fa986f622 100644 --- a/test/unittest/ability_manager_proxy_test/ability_manager_stub_mock.h +++ b/test/unittest/ability_manager_proxy_test/ability_manager_stub_mock.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/test/unittest/ability_manager_service_twelfth_test/ability_manager_service_twelfth_test.cpp b/test/unittest/ability_manager_service_twelfth_test/ability_manager_service_twelfth_test.cpp index 0c5a095520..db6e10de5c 100644 --- a/test/unittest/ability_manager_service_twelfth_test/ability_manager_service_twelfth_test.cpp +++ b/test/unittest/ability_manager_service_twelfth_test/ability_manager_service_twelfth_test.cpp @@ -1131,24 +1131,6 @@ HWTEST_F(AbilityManagerServiceTwelfthTest, KioskManager_ExitKioskMode_Fail_01, T ASSERT_EQ(result, ERR_KIOSK_MODE_NOT_IN_WHITELIST); } -/* - * Feature: KioskManager - * Function: ExitKioskMode - * SubFunction: NA - * FunctionPoints: KioskManager ExitKioskMode - */ -HWTEST_F(AbilityManagerServiceTwelfthTest, KioskManager_ExitKioskMode_Fail_02, TestSize.Level1) { - std::vector bundleNames; - bundleNames.emplace_back("com.test.demo"); - bundleNames.emplace_back("com.test.demo2"); - bundleNames.emplace_back("com.test.demo3"); - auto result = KioskManager::GetInstance().UpdateKioskApplicationList(bundleNames); - ASSERT_EQ(result, ERR_OK); - auto callerToken = MockToken(AbilityType::PAGE); - result = KioskManager::GetInstance().ExitKioskMode(callerToken); - ASSERT_EQ(result, ERR_NOT_IN_KIOSK_MODE); -} - /* * Feature: KioskManager * Function: GetKioskStatus diff --git a/test/unittest/ability_manager_stub_test/ability_manager_stub_impl_mock.h b/test/unittest/ability_manager_stub_test/ability_manager_stub_impl_mock.h index 64683eb59a..65f3338c40 100644 --- a/test/unittest/ability_manager_stub_test/ability_manager_stub_impl_mock.h +++ b/test/unittest/ability_manager_stub_test/ability_manager_stub_impl_mock.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/test/unittest/ability_manager_stub_test/ability_manager_stub_test.cpp b/test/unittest/ability_manager_stub_test/ability_manager_stub_test.cpp index 9bd2971b9e..308976ae2d 100644 --- a/test/unittest/ability_manager_stub_test/ability_manager_stub_test.cpp +++ b/test/unittest/ability_manager_stub_test/ability_manager_stub_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at