• 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 OHOS_ABILITY_RUNTIME_NATIVE_CHILD_NOTIFY_INTERFACE_H
17 #define OHOS_ABILITY_RUNTIME_NATIVE_CHILD_NOTIFY_INTERFACE_H
18 
19 #include "iremote_broker.h"
20 
21 namespace OHOS {
22 namespace AppExecFwk {
23 
24 class INativeChildNotify : public IRemoteBroker {
25 public:
26     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.NativeChildNotify");
27 
28     /**
29      * Notify native child process started.
30      *
31      * @param nativeChild child process ipc object
32      */
33     virtual void OnNativeChildStarted(const sptr<IRemoteObject> &nativeChild) = 0;
34 
35     /**
36      * Notify native child process start failed.
37      *
38      * @param errCode failed error code
39      */
40     virtual void OnError(int32_t errCode) = 0;
41 
42     /**
43      * Notify native child process exit.
44      *
45      * @param pid child process pid
46      * @param signal child process exit signal
47      * @return Returns ERR_OK on success, others on failure.
48      */
49     virtual int32_t OnNativeChildExit(int32_t pid, int32_t signal) = 0;
50 
51     enum {
52         // ipc id for OnNativeChildStarted
53         IPC_ID_ON_NATIVE_CHILD_STARTED = 0,
54 
55         // ipc id for OnError
56         IPC_ID_ON_ERROR = 1,
57 
58         IPC_ID_ON_NATIVE_CHILD_EXIT = 2
59     };
60 };
61 
62 } // OHOS
63 } // AppExecFwk
64 
65 #endif // OHOS_ABILITY_RUNTIME_NATIVE_CHILD_NOTIFY_INTERFACE_H