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 MEDIA_SERVER_H 17 #define MEDIA_SERVER_H 18 19 #include "media_service_stub.h" 20 #include "system_ability.h" 21 #include "nocopyable.h" 22 23 namespace OHOS { 24 namespace Media { 25 class __attribute__((visibility("default"))) MediaServer : public SystemAbility, public MediaServiceStub { 26 DECLARE_SYSTEM_ABILITY(MediaServer); 27 public: 28 explicit MediaServer(int32_t systemAbilityId, bool runOnCreate = true); 29 ~MediaServer(); 30 31 // IStandardMediaService override 32 sptr<IRemoteObject> GetSubSystemAbility(IStandardMediaService::MediaSystemAbility subSystemId, 33 const sptr<IRemoteObject> &listener) override; 34 35 protected: 36 // SystemAbility override 37 void OnDump() override; 38 void OnStart() override; 39 void OnStop() override; 40 int32_t Dump(int32_t fd, const std::vector<std::u16string>& args) override; 41 42 private: 43 void OnAddSystemAbility(int32_t systemAbilityId, const std::string &deviceId) override; 44 }; 45 } // namespace Media 46 } // namespace OHOS 47 #endif // MEDIA_SERVER_H 48