• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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_MEDIA_DFX_REPORTER_H
17 #define OHOS_MEDIA_DFX_REPORTER_H
18 
19 #include <string>
20 
21 #include "thumbnail_data.h"
22 
23 namespace OHOS {
24 namespace Media {
25 
26 struct AlbumFusionDfxDataPoint {
27     int64_t albumFusionTag;
28     int64_t reportTimeStamp;
29     int32_t albumFusionState; // 1: Before fusion starts 2: After fusion successfully finished 3: when fusion fails
30     int32_t imageAssetCount;
31     int32_t videoAssetCount;
32     int32_t numberOfSourceAlbum;
33     int32_t numberOfUserAlbum;
34     int32_t totalAssetsInSourceAlbums;
35     int32_t totalAssetsInUserAlbums;
36     std::string albumDetails;
37     std::string hiddenAssetInfo;
38 };
39 
40 class DfxReporter {
41 public:
42     DfxReporter();
43     ~DfxReporter();
44 
45     void ReportTimeOutOperation(std::string &bundleName, int32_t type, int32_t object, int32_t time);
46     int32_t ReportHighMemoryImageThumbnail(std::string &path, std::string &suffix, int32_t width, int32_t height);
47     int32_t ReportHighMemoryVideoThumbnail(std::string &path, std::string &suffix, int32_t width, int32_t height);
48     void ReportThumbnailError();
49     void ReportCommonBehavior();
50     void ReportDeleteStatistic();
51     void ReportDeleteBehavior(std::string bundleName, int32_t type, std::string path);
52     void ReportThumbnailGeneration(const ThumbnailData::GenerateStats &stats);
53     void ReportPhotoInfo(int32_t localImageCount, int32_t localVideoCount, int32_t cloudImageCount,
54         int32_t cloudVideCount);
55     void ReportAlbumInfo(const std::string &albumName, int32_t albumImageCount, int32_t albumVideoCount,
56         bool isLocal);
57     void ReportDirtyCloudPhoto(const std::string &data, int32_t dirty, int32_t cloudVersion);
58     void ReportCommonVersion(int32_t dbVersion);
59     void ReportAnalysisVersion(const std::string &analysisName, int32_t version);
60     void ReportAdaptationToMovingPhoto();
61     static int32_t ReportCloudSyncThumbGenerationStatus(const int32_t& downloadedThumb, const int32_t& generatedThumb,
62         const int32_t& totalDownload);
63     static void ReportStartResult(int32_t scene, int32_t errorCode, int32_t startTime);
64     void ReportPhotoRecordInfo();
65     static int32_t ReportMedialibraryAPI(const std::string& callerPackage, const std::string& saveUri);
66     static int32_t ReportAlbumFusion(const AlbumFusionDfxDataPoint& reportData);
67 };
68 } // namespace Media
69 } // namespace OHOS
70 
71 #endif  // OHOS_MEDIA_DFX_REPORTER_H