• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "form_refresh/refresh_impl/form_data_refresh_impl.h"
17 
18 #include "form_refresh/strategy/refresh_check_mgr.h"
19 #include "form_refresh/strategy/refresh_exec_mgr.h"
20 
21 namespace OHOS {
22 namespace AppExecFwk {
23 
FormDataRefreshImpl()24 FormDataRefreshImpl::FormDataRefreshImpl() {}
~FormDataRefreshImpl()25 FormDataRefreshImpl::~FormDataRefreshImpl() {}
26 
RefreshFormRequest(RefreshData & data)27 int FormDataRefreshImpl::RefreshFormRequest(RefreshData &data)
28 {
29     const std::vector<int32_t> checkTypes = { TYPE_UNTRUST_APP, TYPE_CALLING_USER };
30     CheckValidFactor factor;
31     factor.formId = data.formId;
32     factor.record = data.record;
33     factor.callingUid = data.callingUid;
34     int ret = RefreshCheckMgr::GetInstance().IsBaseValidPass(checkTypes, factor);
35     if (ret != ERR_OK) {
36         return ret;
37     }
38 
39     ret = RefreshExecMgr::UpdateByProviderData(data.formId, data.providerData, false);
40     if (ret != ERR_OK) {
41         HILOG_ERROR("update provider data failed, ret:%{public}d, formId:%{public}" PRId64, ret, data.formId);
42         return ret;
43     }
44 
45     return ERR_OK;
46 }
47 } // namespace AppExecFwk
48 } // namespace OHOS