• 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 #ifndef OHOS_ABILITY_ABILITY_START_WITH_WAIT_OBSERVER_STUB_H
17 #define OHOS_ABILITY_ABILITY_START_WITH_WAIT_OBSERVER_STUB_H
18 
19 #include <map>
20 #include <mutex>
21 
22 #include "ability_start_with_wait_observer_data.h"
23 #include "ability_start_with_wait_observer_interface.h"
24 #include "iremote_stub.h"
25 
26 namespace OHOS {
27 namespace AAFwk {
28 
29 class AbilityStartWithWaitObserverStub : public IRemoteStub<IAbilityStartWithWaitObserver> {
30 public:
31     AbilityStartWithWaitObserverStub() = default;
32     virtual ~AbilityStartWithWaitObserverStub() = default;
33 
34     int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
35 
36     int32_t OnNotifyAATerminateWithWait(MessageParcel& data, MessageParcel& reply);
37 
38 private:
39     DISALLOW_COPY_AND_MOVE(AbilityStartWithWaitObserverStub);
40 };
41 
42 class AbilityStartWithWaitObserverRecipient : public IRemoteObject::DeathRecipient {
43 public:
44     using RemoteDiedHandler = std::function<void(const wptr<IRemoteObject> &)>;
45     explicit AbilityStartWithWaitObserverRecipient(RemoteDiedHandler handler);
46     virtual ~AbilityStartWithWaitObserverRecipient() = default;
47     void OnRemoteDied(const wptr<IRemoteObject> &remote) override;
48 
49 private:
50     RemoteDiedHandler handler_;
51 };
52 } // namespace AAFwk
53 } // namespace OHOS
54 #endif // OHOS_ABILITY_ABILITY_START_WITH_WAIT_OBSERVER_STUB_H