• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 #ifndef SERVICES_EDM_PLUGIN_INCLUDE_MANAGE_KEEP_ALIVE_APPS_PLUGIN_H
17 #define SERVICES_EDM_PLUGIN_INCLUDE_MANAGE_KEEP_ALIVE_APPS_PLUGIN_H
18 
19 #include "ability_manager_interface.h"
20 #include "bundle_mgr_interface.h"
21 #include "message_parcel.h"
22 #include "iplugin.h"
23 #include "iremote_stub.h"
24 
25 #include "basic_array_string_plugin.h"
26 
27 namespace OHOS {
28 namespace EDM {
29 class ManageKeepAliveAppsPlugin : public IPlugin, public BasicArrayStringPlugin {
30 public:
31     ManageKeepAliveAppsPlugin();
32     ErrCode OnHandlePolicy(std::uint32_t funcCode, MessageParcel &data, MessageParcel &reply,
33         HandlePolicyData &policyData, int32_t userId) override;
OnHandlePolicyDone(std::uint32_t funcCode,const std::string & adminName,bool isGlobalChanged,int32_t userId)34     void OnHandlePolicyDone(std::uint32_t funcCode, const std::string &adminName, bool isGlobalChanged,
35         int32_t userId) override{};
36     ErrCode OnGetPolicy(std::string &policyData, MessageParcel &data, MessageParcel &reply, int32_t userId) override;
37     ErrCode OnAdminRemove(const std::string &adminName, const std::string &currentJsonData,
38         const std::string &mergeJsonData, int32_t userId) override;
OnAdminRemoveDone(const std::string & adminName,const std::string & currentJsonData,int32_t userId)39     void OnAdminRemoveDone(const std::string &adminName, const std::string &currentJsonData,
40         int32_t userId) override {};
41     ErrCode GetOthersMergePolicyData(const std::string &adminName,
42         std::string &othersMergePolicyData) override;
43 
44 private:
45     ErrCode SetOtherModulePolicy(const std::vector<std::string> &data, int32_t userId,
46         std::vector<std::string> &failedData) override;
47     ErrCode RemoveOtherModulePolicy(const std::vector<std::string> &data, int32_t userId,
48         std::vector<std::string> &failedData) override;
49     ErrCode AddKeepAliveApps(std::vector<std::string> &keepAliveApps, int32_t userId);
50     ErrCode RemoveKeepAliveApps(std::vector<std::string> &keepAliveApps, int32_t userId);
51     void ParseErrCode(ErrCode &ret);
52     void GetErrorMessage(ErrCode &errCode, std::string &errMessage);
53     sptr<AAFwk::IAbilityManager> GetAbilityManager();
54     sptr<AppExecFwk::IAppControlMgr> GetAppControlProxy();
55 };
56 } // namespace EDM
57 } // namespace OHOS
58 
59 #endif /* SERVICES_EDM_PLUGIN_INCLUDE_MANAGE_KEEP_ALIVE_APPS_PLUGIN_H */
60