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_ABILITY_RUNTIME_SNAPSHOT_H
17 #define OHOS_ABILITY_RUNTIME_SNAPSHOT_H
18 
19 #include <iremote_broker.h>
20 
21 #ifdef SUPPORT_GRAPHICS
22 #include "pixel_map.h"
23 #endif
24 
25 namespace OHOS {
26 namespace AAFwk {
27 /**
28  * @class Snapshot
29  * Snapshot info
30  */
31 class Snapshot {
32 public:
33     Snapshot() = default;
34     ~Snapshot() = default;
35 #ifdef SUPPORT_GRAPHICS
GetPixelMap()36     const std::shared_ptr<OHOS::Media::PixelMap>& GetPixelMap() const
37     {
38         return pixelMap_;
39     }
SetPixelMap(const std::shared_ptr<OHOS::Media::PixelMap> & pixelMap)40     void SetPixelMap(const std::shared_ptr<OHOS::Media::PixelMap>& pixelMap)
41     {
42         pixelMap_ = pixelMap;
43     }
44 private:
45     std::shared_ptr<OHOS::Media::PixelMap> pixelMap_ = nullptr;
46 #endif
47 };
48 
49 /**
50  * @class ISnapshotHandler
51  * Snapshot handler, use to get snapshot
52  */
53 class ISnapshotHandler : public OHOS::IRemoteBroker {
54 public:
55     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.aafwk.SnapshotHandler");
56 
57     enum {
58         TRANS_ID_GET_SNAPSHOT
59     };
60 
61     /**
62      * @brief Get the Snapshot object
63      * @param token remote object token
64      * @param snapshot the application snapshot
65      * @return int32_t function result
66      */
67     virtual int32_t GetSnapshot(const sptr<IRemoteObject>& token, Snapshot& snapshot) = 0;
68 };
69 } // namespace AAFwk
70 } // namespace OHOS
71 #endif // OHOS_ABILITY_RUNTIME_SNAPSHOT_H
72