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