1 /* 2 * Copyright (c) 2021 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_BUNDLEMGRSERVICE_SERVICE_H 17 #define OHOS_BUNDLEMGRSERVICE_SERVICE_H 18 19 #include "service.h" 20 21 #include "nocopyable.h" 22 23 namespace OHOS { 24 const unsigned int BMS_INSTALL_MSG = 100; 25 const unsigned int BMS_UNINSTALL_MSG = 101; 26 const unsigned int BMS_SCAN_PACKAGE_MSG = 102; 27 const unsigned int BMS_REGISTER_CALLBACK_MSG = 103; 28 29 class BundleMgrService : public Service { 30 public: GetInstance()31 static BundleMgrService *GetInstance() 32 { 33 static BundleMgrService instance; 34 return &instance; 35 } 36 ~BundleMgrService() = default; 37 Identity *GetIdentity(); 38 39 private: 40 BundleMgrService(); 41 static const char *GetServiceName(Service *service); 42 static BOOL ServiceInitialize(Service *service, Identity identity); 43 static TaskConfig GetServiceTaskConfig(Service *service); 44 static BOOL ServiceMessageHandle(Service *service, Request *request); 45 46 private: 47 Identity identity_; 48 DISALLOW_COPY_AND_MOVE(BundleMgrService); 49 }; 50 } // namespace OHOS 51 #endif // OHOS_BUNDLEMGRSERVICE_SERVICE_H 52