• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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 OHOS_ABILITY_RUNTIME_AMS_MGR_STUB_H
17 #define OHOS_ABILITY_RUNTIME_AMS_MGR_STUB_H
18 
19 #include <map>
20 
21 #include "iremote_stub.h"
22 #include "nocopyable.h"
23 #include "string_ex.h"
24 #include "ams_mgr_interface.h"
25 
26 namespace OHOS {
27 namespace AppExecFwk {
28 class AmsMgrStub : public IRemoteStub<IAmsMgr> {
29 public:
30     AmsMgrStub();
31     virtual ~AmsMgrStub();
32 
33     virtual int OnRemoteRequest(
34         uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
35 
36     /**
37      * UpdateExtensionState, call UpdateExtensionState() through the proxy object, update the extension status.
38      *
39      * @param token, the unique identification to update the extension.
40      * @param state, extension status that needs to be updated.
41      * @return
42      */
43     virtual void UpdateExtensionState(const sptr<IRemoteObject> &token, const ExtensionState state) override;
44 private:
45     int32_t HandleLoadAbility(MessageParcel &data, MessageParcel &reply);
46     int32_t HandleTerminateAbility(MessageParcel &data, MessageParcel &reply);
47     int32_t HandleUpdateAbilityState(MessageParcel &data, MessageParcel &reply);
48     int32_t HandleUpdateExtensionState(MessageParcel &data, MessageParcel &reply);
49     int32_t HandleRegisterAppStateCallback(MessageParcel &data, MessageParcel &reply);
50     int32_t HandleReset(MessageParcel &data, MessageParcel &reply);
51     int32_t HandleAbilityBehaviorAnalysis(MessageParcel &data, MessageParcel &reply);
52     int32_t HandleKillProcessByAbilityToken(MessageParcel &data, MessageParcel &reply);
53     int32_t HandleKillProcessesByUserId(MessageParcel &data, MessageParcel &reply);
54     int32_t HandleKillProcessWithAccount(MessageParcel &data, MessageParcel &reply);
55     int32_t HandleKillApplication(MessageParcel &data, MessageParcel &reply);
56     int32_t HandleAbilityAttachTimeOut(MessageParcel &data, MessageParcel &reply);
57     int32_t HandlePrepareTerminate(MessageParcel &data, MessageParcel &reply);
58     int32_t HandleKillApplicationByUid(MessageParcel &data, MessageParcel &reply);
59     int32_t HandleKillApplicationSelf(MessageParcel &data, MessageParcel &reply);
60     int32_t HandleGetRunningProcessInfoByToken(MessageParcel &data, MessageParcel &reply);
61     int32_t HandleGetRunningProcessInfoByPid(MessageParcel &data, MessageParcel &reply);
62     int32_t HandleSetAbilityForegroundingFlagToAppRecord(MessageParcel &data, MessageParcel &reply);
63     int32_t HandleStartSpecifiedAbility(MessageParcel &data, MessageParcel &reply);
64     int32_t HandleRegisterStartSpecifiedAbilityResponse(MessageParcel &data, MessageParcel &reply);
65     int32_t HandleGetApplicationInfoByProcessID(MessageParcel &data, MessageParcel &reply);
66     int32_t HandleUpdateApplicationInfoInstalled(MessageParcel &data, MessageParcel &reply);
67     int32_t HandleSetCurrentUserId(MessageParcel &data, MessageParcel &reply);
68     int32_t HandleGetBundleNameByPid(MessageParcel &data, MessageParcel &reply);
69 
70     using AmsMgrFunc = int32_t (AmsMgrStub::*)(MessageParcel &data, MessageParcel &reply);
71     std::map<uint32_t, AmsMgrFunc> memberFuncMap_;
72 
73     DISALLOW_COPY_AND_MOVE(AmsMgrStub);
74 };
75 }  // namespace AppExecFwk
76 }  // namespace OHOS
77 #endif  // OHOS_ABILITY_RUNTIME_AMS_MGR_STUB_H
78