• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 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_BUNDLE_SELF_CALLBACK_H
17 #define OHOS_BUNDLE_SELF_CALLBACK_H
18 
19 #include <algorithm>
20 #include <vector>
21 
22 #include "appexecfwk_errors.h"
23 #include "bundle_manager.h"
24 #include "liteipc_adapter.h"
25 #include "nocopyable.h"
26 
27 namespace OHOS {
28 class BundleSelfCallback {
29 public:
GetInstance()30     static BundleSelfCallback &GetInstance()
31     {
32         static BundleSelfCallback instance;
33         return instance;
34     }
35     ~BundleSelfCallback();
36     const SvcIdentity *RegisterBundleSelfCallback(InstallerCallback &installerCallback);
37     const InstallerCallback GetCallback();
38 private:
39     BundleSelfCallback() = default;
40     static int32_t Callback(const IpcContext* context, void *ipcMsg, IpcIo *io, void *arg);
41     int32_t GenerateLocalServiceId();
42     InstallerCallback installerCallback_ { nullptr };
43     SvcIdentity *svcIdentity_ { nullptr };
44 
45     DISALLOW_COPY_AND_MOVE(BundleSelfCallback);
46 };
47 } // namespace
48 #endif // OHOS_BUNDLE_SELF_CALLBACK_H