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_SCREENSAVER_ABILITY_SLICE_H 17 #define OHOS_SCREENSAVER_ABILITY_SLICE_H 18 19 #include <ability_info.h> 20 #include <ability_loader.h> 21 #include <bundle_info.h> 22 #include "components/root_view.h" 23 #include "components/ui_image_animator.h" 24 #include "event_listener.h" 25 #include "ui_config.h" 26 #include "want.h" 27 28 namespace OHOS { 29 class ScreensaverAbilitySlice : public AbilitySlice { 30 public: ScreensaverAbilitySlice()31 ScreensaverAbilitySlice() : rootView_(nullptr), imageAnimator_(nullptr), exitListener_(nullptr) {} 32 virtual ~ScreensaverAbilitySlice(); 33 34 protected: 35 void OnStart(const Want &want) override; 36 void OnInactive() override; 37 void OnActive(const Want &want) override; 38 void OnBackground() override; 39 void OnStop() override; 40 41 private: 42 void SetCyclePlayView(); 43 44 RootView* rootView_; 45 UIImageAnimatorView* imageAnimator_; 46 EventListener* exitListener_; 47 }; 48 } // namespace OHOS 49 #endif 50