• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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;
18 
19 import com.android.adservices.service.Flags;
20 
21 import java.util.concurrent.TimeUnit;
22 
23 /**
24  * Class for holding privacy related parameters.
25  * All values in this class are temporary and subject to change based on feedback and testing.
26  */
27 public final class PrivacyParams {
28 
29     /**
30      * Max reports for 'Navigation' {@link Source}.
31      */
32     public static final int NAVIGATION_SOURCE_MAX_REPORTS = 3;
33 
34     /**
35      * Max reports for 'Event' {@link Source}.
36      */
37     public static final int EVENT_SOURCE_MAX_REPORTS = 1;
38 
39     /**
40      * Max reports for Install Attributed 'Navigation' {@link Source}.
41      */
42     public static final int INSTALL_ATTR_NAVIGATION_SOURCE_MAX_REPORTS = 3;
43 
44     /**
45      * Max reports for Install Attributed 'Event' {@link Source}.
46      */
47     public static final int INSTALL_ATTR_EVENT_SOURCE_MAX_REPORTS = 2;
48 
49     /**
50      * Rate limit window for (Source Site, Destination Site, Reporting Site, Window) privacy unit.
51      * 30 days.
52      */
53     public static final long RATE_LIMIT_WINDOW_MILLISECONDS = TimeUnit.DAYS.toMillis(30);
54 
55     /**
56      * Early reporting window for 'Navigation' {@link Source}.
57      * 2 days and 7 days.
58      */
59     public static final long[] NAVIGATION_EARLY_REPORTING_WINDOW_MILLISECONDS = new long[]{
60             TimeUnit.DAYS.toMillis(2), TimeUnit.DAYS.toMillis(7)
61     };
62 
63     /**
64      * Early reporting window for 'Event' {@link Source}.
65      * No windows.
66      */
67     public static final long[] EVENT_EARLY_REPORTING_WINDOW_MILLISECONDS = new long[]{ };
68 
69     /**
70      * Early reporting window for Install Attributed 'Navigation' {@link Source}. 2 days and 7 days.
71      */
72     public static final long[] INSTALL_ATTR_NAVIGATION_EARLY_REPORTING_WINDOW_MILLISECONDS =
73             NAVIGATION_EARLY_REPORTING_WINDOW_MILLISECONDS;
74 
75     /**
76      * Early reporting window for Install Attributed 'Event' {@link Source}.
77      * 2 days.
78      */
79     public static final long[] INSTALL_ATTR_EVENT_EARLY_REPORTING_WINDOW_MILLISECONDS =
80             new long[]{ TimeUnit.DAYS.toMillis(2) };
81 
82     /** {@link Source} Noise probability for 'Event'. */
83     public static final double EVENT_NOISE_PROBABILITY = 0.0000025D;
84 
85     /** {@link Source} Noise probability for 'Navigation'. */
86     public static final double NAVIGATION_NOISE_PROBABILITY = 0.0024263D;
87 
88     /**
89      * {@link Source} Noise probability for 'Event' which supports install attribution.
90      */
91     public static final double INSTALL_ATTR_EVENT_NOISE_PROBABILITY = 0.0000125D;
92 
93     /**
94      * {@link Source} Noise probability for 'Navigation' which supports install attribution.
95      */
96     public static final double INSTALL_ATTR_NAVIGATION_NOISE_PROBABILITY =
97                 NAVIGATION_NOISE_PROBABILITY;
98 
99     /**
100      * {@link Source} Noise probability for 'Event', when both destinations (app and web) are
101      * available on the source.
102      */
103     public static final double DUAL_DESTINATION_EVENT_NOISE_PROBABILITY = 0.0000042D;
104 
105     /**
106      * {@link Source} Noise probability for 'Navigation', when both destinations (app and web) are
107      * available on the source.
108      */
109     public static final double DUAL_DESTINATION_NAVIGATION_NOISE_PROBABILITY = 0.0170218D;
110 
111     /**
112      * {@link Source} Noise probability for 'Event', when both destinations (app and web) are
113      * available on the source and supports install attribution.
114      */
115     public static final double INSTALL_ATTR_DUAL_DESTINATION_EVENT_NOISE_PROBABILITY = 0.0000208D;
116 
117     /**
118      * {@link Source} Noise probability for 'Navigation', when both destinations (app and web) are
119      * available on the source and supports install attribution.
120      */
121     public static final double INSTALL_ATTR_DUAL_DESTINATION_NAVIGATION_NOISE_PROBABILITY =
122             DUAL_DESTINATION_NAVIGATION_NOISE_PROBABILITY;
123 
124     /**
125      * Trigger data cardinality for 'Event' {@link Source} attribution.
126      */
127     public static final int EVENT_TRIGGER_DATA_CARDINALITY = 2;
128 
129     /**
130      * Trigger data cardinality for 'Navigation' {@link Source} attribution.
131      */
132     private static final int NAVIGATION_TRIGGER_DATA_CARDINALITY = 8;
133 
getNavigationTriggerDataCardinality()134     public static int getNavigationTriggerDataCardinality() {
135         return NAVIGATION_TRIGGER_DATA_CARDINALITY;
136     }
137 
138     /** Min expiration value in seconds for attribution reporting register source. */
139     public static final long MIN_REPORTING_REGISTER_SOURCE_EXPIRATION_IN_SECONDS =
140             TimeUnit.DAYS.toSeconds(1);
141 
142     /**
143      * Max expiration value in seconds for attribution reporting register source. This value is also
144      * the default no expiration was specified.
145      */
146     public static final long MAX_REPORTING_REGISTER_SOURCE_EXPIRATION_IN_SECONDS =
147             TimeUnit.DAYS.toSeconds(30);
148 
149     /**
150      * Minimum limit of duration to determine attribution for a verified installation.
151      */
152     public static final long MIN_INSTALL_ATTRIBUTION_WINDOW = TimeUnit.DAYS.toSeconds(1);
153 
154     /**
155      * Maximum limit of duration to determine attribution for a verified installation.
156      */
157     public static final long MAX_INSTALL_ATTRIBUTION_WINDOW = TimeUnit.DAYS.toSeconds(30);
158 
159     /**
160      * Default and minimum value for cooldown period of source which led to installation.
161      */
162     public static final long MIN_POST_INSTALL_EXCLUSIVITY_WINDOW = 0;
163 
164     /**
165      * Maximum acceptable install cooldown period.
166      */
167     public static final long MAX_POST_INSTALL_EXCLUSIVITY_WINDOW = TimeUnit.DAYS.toSeconds(30);
168 
169     /** Minimum time window after which reporting origin can be migrated */
170     public static final long MIN_REPORTING_ORIGIN_UPDATE_WINDOW = TimeUnit.DAYS.toMillis(1);
171 
172     /**
173      * L1, the maximum sum of the contributions (values) across all buckets for a given source
174      * event.
175      */
176     public static final int MAX_SUM_OF_AGGREGATE_VALUES_PER_SOURCE = 65536;
177 
178     /** Amount of bytes allocated for aggregate histogram bucket */
179     public static final int AGGREGATE_HISTOGRAM_BUCKET_BYTE_SIZE = 16;
180 
181     /** Amount of bytes allocated for aggregate histogram value */
182     public static final int AGGREGATE_HISTOGRAM_VALUE_BYTE_SIZE = 4;
183 
184     /** Minimum time an aggregate report is delayed after trigger */
185     public static final long AGGREGATE_MIN_REPORT_DELAY = TimeUnit.MINUTES.toMillis(10L);
186 
187     /** Maximum time an aggregate report is delayed after trigger */
188     public static final long AGGREGATE_MAX_REPORT_DELAY = TimeUnit.MINUTES.toMillis(60L);
189 
190     /**
191      * Max distinct web destinations in a source registration.
192      */
193     public static final int MAX_DISTINCT_WEB_DESTINATIONS_IN_SOURCE_REGISTRATION = 3;
194 
195     /**
196      * Max distinct enrollments with source registration per
197      * { Publisher X Advertiser X TimePeriod }.
198      */
199     private static final int MAX_DISTINCT_ENROLLMENTS_PER_PUBLISHER_X_DESTINATION_IN_SOURCE = 100;
200 
getMaxDistinctEnrollmentsPerPublisherXDestinationInSource()201     public static int getMaxDistinctEnrollmentsPerPublisherXDestinationInSource() {
202         return MAX_DISTINCT_ENROLLMENTS_PER_PUBLISHER_X_DESTINATION_IN_SOURCE;
203     }
204 
205     private static final int MAX_FLEXIBLE_EVENT_REPORTS = 20;
206 
getMaxFlexibleEventReports()207     public static int getMaxFlexibleEventReports() {
208         return MAX_FLEXIBLE_EVENT_REPORTS;
209     }
210 
211     private static final int MAX_FLEXIBLE_EVENT_TRIGGER_DATA_CARDINALITY = 8;
212 
getMaxFlexibleEventTriggerDataCardinality()213     public static int getMaxFlexibleEventTriggerDataCardinality() {
214         return MAX_FLEXIBLE_EVENT_TRIGGER_DATA_CARDINALITY;
215     }
216 
217     private static final int MAX_FLEXIBLE_EVENT_REPORTING_WINDOWS = 5;
218 
getMaxFlexibleEventReportingWindows()219     public static int getMaxFlexibleEventReportingWindows() {
220         return MAX_FLEXIBLE_EVENT_REPORTING_WINDOWS;
221     }
222 
223     private static final int PRIVACY_EPSILON = 14;
224 
getPrivacyEpsilon()225     public static int getPrivacyEpsilon() {
226         return PRIVACY_EPSILON;
227     }
228 
229     public static final double NUMBER_EQUAL_THRESHOLD = 0.0000001d;
230 
231     // place holder for future change
232     private static final double MAX_FLEXIBLE_EVENT_INFORMATION_GAIN = Double.MAX_VALUE;
233 
234     /**
235      * Maximum early reporting windows configured through {@link
236      * Flags#MEASUREMENT_EVENT_REPORTS_VTC_EARLY_REPORTING_WINDOWS} or {@link
237      * Flags#MEASUREMENT_EVENT_REPORTS_CTC_EARLY_REPORTING_WINDOWS}.
238      */
239     public static final int MAX_CONFIGURABLE_EVENT_REPORT_EARLY_REPORTING_WINDOWS = 2;
240 
getMaxFlexibleEventInformationGain()241     public static double getMaxFlexibleEventInformationGain() {
242         return MAX_FLEXIBLE_EVENT_INFORMATION_GAIN;
243     }
244 
PrivacyParams()245     private PrivacyParams() {
246     }
247 }
248