• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.adservices.service.measurement.reporting;
18 
19 import android.annotation.Nullable;
20 
21 import java.util.Optional;
22 
23 /** POJO for storing aggregate and event reporting status */
24 public class ReportingStatus {
25 
26     /** Enums are tied to the AdservicesMeasurementReportsUploaded atom */
27     public enum UploadStatus {
28         UNKNOWN,
29         SUCCESS,
30         FAILURE
31     }
32 
33     public enum FailureStatus {
34         UNKNOWN,
35         ENROLLMENT_NOT_FOUND,
36         NETWORK,
37         DATASTORE,
38         REPORT_NOT_PENDING
39     }
40 
41     public enum UploadMethod {
42         UNKNOWN,
43         REGULAR,
44         FALLBACK
45     }
46 
47     private UploadStatus mUploadStatus;
48 
49     private FailureStatus mFailureStatus;
50 
51     private UploadMethod mUploadMethod;
52 
53     @Nullable private Long mReportingDelay;
54 
ReportingStatus()55     public ReportingStatus() {
56         mUploadStatus = UploadStatus.UNKNOWN;
57         mFailureStatus = FailureStatus.UNKNOWN;
58         mUploadMethod = UploadMethod.UNKNOWN;
59     }
60 
61     /** Get the upload status of reporting. */
getUploadStatus()62     public UploadStatus getUploadStatus() {
63         return mUploadStatus;
64     }
65 
66     /** Set upload status of reporting. */
setUploadStatus(UploadStatus status)67     public void setUploadStatus(UploadStatus status) {
68         mUploadStatus = status;
69     }
70 
71     /** Get the failure status of reporting. */
getFailureStatus()72     public FailureStatus getFailureStatus() {
73         return mFailureStatus;
74     }
75 
76     /** Set failure status of reporting. */
setFailureStatus(FailureStatus status)77     public void setFailureStatus(FailureStatus status) {
78         mFailureStatus = status;
79     }
80 
81     /** Get the upload method of reporting. */
getUploadMethod()82     public UploadMethod getUploadMethod() {
83         return mUploadMethod;
84     }
85 
86     /** Set upload method of reporting. */
setUploadMethod(UploadMethod method)87     public void setUploadMethod(UploadMethod method) {
88         mUploadMethod = method;
89     }
90 
91     /** Get registration delay. */
getReportingDelay()92     public Optional<Long> getReportingDelay() {
93         return Optional.ofNullable(mReportingDelay);
94     }
95 
96     /** Set registration delay. */
setReportingDelay(Long reportingDelay)97     public void setReportingDelay(Long reportingDelay) {
98         mReportingDelay = reportingDelay;
99     }
100 }
101