• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 Google LLC
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 package com.google.android.libraries.mobiledatadownload;
17 
18 /**
19  * Responsible for configuring MDD.
20  *
21  * <p>All default implementations match default_value from GCL ignoring conditional_values, etc,
22  * unless noted otherwise.
23  */
24 public interface Flags {
25   // LINT.IfChange
26 
27   // FeatureFlags
clearStateOnMddDisabled()28   default boolean clearStateOnMddDisabled() {
29     return false;
30   }
31 
mddDeleteGroupsRemovedAccounts()32   default boolean mddDeleteGroupsRemovedAccounts() {
33     return false;
34   }
35 
broadcastNewlyDownloadedGroups()36   default boolean broadcastNewlyDownloadedGroups() {
37     return true;
38   }
39 
logFileGroupsWithFilesMissing()40   default boolean logFileGroupsWithFilesMissing() {
41     return true;
42   }
43 
deleteFileGroupsWithFilesMissing()44   default boolean deleteFileGroupsWithFilesMissing() {
45     return true;
46   }
47 
dumpMddInfo()48   default boolean dumpMddInfo() {
49     return false;
50   }
51 
enableDebugUi()52   default boolean enableDebugUi() {
53     return false;
54   }
55 
enableClientErrorLogging()56   default boolean enableClientErrorLogging() {
57     return false;
58   }
59 
fileKeyVersion()60   default int fileKeyVersion() {
61     return 2;
62   }
63 
testOnlyFileKeyVersion()64   default boolean testOnlyFileKeyVersion() {
65     return false;
66   }
67 
enableCompressedFile()68   default boolean enableCompressedFile() {
69     return true;
70   }
71 
enableZipFolder()72   default boolean enableZipFolder() {
73     return true;
74   }
75 
enableDeltaDownload()76   default boolean enableDeltaDownload() {
77     return true;
78   }
79 
enableMddGcmService()80   default boolean enableMddGcmService() {
81     return true;
82   }
83 
enableSilentFeedback()84   default boolean enableSilentFeedback() {
85     return true;
86   }
87 
migrateToNewFileKey()88   default boolean migrateToNewFileKey() {
89     return true;
90   }
91 
migrateFileExpirationPolicy()92   default boolean migrateFileExpirationPolicy() {
93     return true;
94   }
95 
downloadFirstOnWifiThenOnAnyNetwork()96   default boolean downloadFirstOnWifiThenOnAnyNetwork() {
97     return true;
98   }
99 
logStorageStats()100   default boolean logStorageStats() {
101     return true;
102   }
103 
logNetworkStats()104   default boolean logNetworkStats() {
105     return true;
106   }
107 
removeGroupkeysWithDownloadedFieldNotSet()108   default boolean removeGroupkeysWithDownloadedFieldNotSet() {
109     return true;
110   }
111 
cacheLastLocation()112   default boolean cacheLastLocation() {
113     return true;
114   }
115 
locationCustomParamS2Level()116   default int locationCustomParamS2Level() {
117     return 10;
118   }
119 
locationTaskTimeoutSec()120   default int locationTaskTimeoutSec() {
121     return 5;
122   }
123 
addConfigsFromPhenotype()124   default boolean addConfigsFromPhenotype() {
125     return true;
126   }
127 
enableMobileDataDownload()128   default boolean enableMobileDataDownload() {
129     return true;
130   }
131 
mddResetTrigger()132   default int mddResetTrigger() {
133     return 0;
134   }
135 
mddEnableDownloadPendingGroups()136   default boolean mddEnableDownloadPendingGroups() {
137     return true;
138   }
139 
mddEnableVerifyPendingGroups()140   default boolean mddEnableVerifyPendingGroups() {
141     return true;
142   }
143 
144   /** Controls whether daily maintenance includes {@link MobileDataDownload#collectGarbage}. */
mddEnableGarbageCollection()145   default boolean mddEnableGarbageCollection() {
146     return true;
147   }
148 
mddDeleteUninstalledApps()149   default boolean mddDeleteUninstalledApps() {
150     return true;
151   }
152 
enableMobstoreFileService()153   default boolean enableMobstoreFileService() {
154     return true;
155   }
156 
enableDelayedDownload()157   default boolean enableDelayedDownload() {
158     return true;
159   }
160 
gcmRescheduleOnlyOncePerProcessStart()161   default boolean gcmRescheduleOnlyOncePerProcessStart() {
162     return true;
163   }
164 
gmsMddSwitchToCronet()165   default boolean gmsMddSwitchToCronet() {
166     return false;
167   }
168 
enableDaysSinceLastMaintenanceTracking()169   default boolean enableDaysSinceLastMaintenanceTracking() {
170     return true;
171   }
172 
enableSideloading()173   default boolean enableSideloading() {
174     return false;
175   }
176 
enableDownloadStageExperimentIdPropagation()177   default boolean enableDownloadStageExperimentIdPropagation() {
178     return false; // TODO(b/201463803): flip to true once rolled out.
179   }
180 
181   // Controls verification of isolated symlink structures.
182   // By default, verification is ON. if this flag is set to false, verification will be turned OFF.
enableIsolatedStructureVerification()183   default boolean enableIsolatedStructureVerification() {
184     return true;
185   }
186 
enableRngBasedDeviceStableSampling()187   default boolean enableRngBasedDeviceStableSampling() {
188     return true;
189   }
190 
191   /**
192    * Controls the key used for file download deduping.
193    *
194    * <p>By default, this flag is FALSE, so file download deduping is performed using the destination
195    * file uri. If this flag is enabled (TRUE), file download deduping will use NewFileKey.
196    */
enableFileDownloadDedupByFileKey()197   default boolean enableFileDownloadDedupByFileKey() {
198     return false;
199   }
200 
201   // PeriodicTaskFlags
maintenanceGcmTaskPeriod()202   default long maintenanceGcmTaskPeriod() {
203     return 86400;
204   }
205 
chargingGcmTaskPeriod()206   default long chargingGcmTaskPeriod() {
207     return 21600;
208   }
209 
cellularChargingGcmTaskPeriod()210   default long cellularChargingGcmTaskPeriod() {
211     return 21600;
212   }
213 
wifiChargingGcmTaskPeriod()214   default long wifiChargingGcmTaskPeriod() {
215     return 21600;
216   }
217 
218   // MddSampleIntervals
mddDefaultSampleInterval()219   default int mddDefaultSampleInterval() {
220     return 100;
221   }
222 
mddDownloadEventsSampleInterval()223   default int mddDownloadEventsSampleInterval() {
224     return 1;
225   }
226 
groupStatsLoggingSampleInterval()227   default int groupStatsLoggingSampleInterval() {
228     return 100;
229   }
230 
apiLoggingSampleInterval()231   default int apiLoggingSampleInterval() {
232     return 100;
233   }
234 
cleanupLogLoggingSampleInterval()235   default int cleanupLogLoggingSampleInterval() {
236     return 1000;
237   }
238 
silentFeedbackSampleInterval()239   default int silentFeedbackSampleInterval() {
240     return 100;
241   }
242 
storageStatsLoggingSampleInterval()243   default int storageStatsLoggingSampleInterval() {
244     return 100;
245   }
246 
networkStatsLoggingSampleInterval()247   default int networkStatsLoggingSampleInterval() {
248     return 100;
249   }
250 
mobstoreFileServiceStatsSampleInterval()251   default int mobstoreFileServiceStatsSampleInterval() {
252     return 100;
253   }
254 
mddAndroidSharingSampleInterval()255   default int mddAndroidSharingSampleInterval() {
256     return 100;
257   }
258 
259   // DownloaderFlags
downloaderEnforceHttps()260   default boolean downloaderEnforceHttps() {
261     return true;
262   }
263 
enforceLowStorageBehavior()264   default boolean enforceLowStorageBehavior() {
265     return true;
266   }
267 
absFreeSpaceAfterDownload()268   default int absFreeSpaceAfterDownload() {
269     return 500 * 1024 * 1024; // 500mb
270   }
271 
absFreeSpaceAfterDownloadLowStorageAllowed()272   default int absFreeSpaceAfterDownloadLowStorageAllowed() {
273     return 100 * 1024 * 1024; // 100mb
274   }
275 
absFreeSpaceAfterDownloadExtremelyLowStorageAllowed()276   default int absFreeSpaceAfterDownloadExtremelyLowStorageAllowed() {
277     return 2 * 1024 * 1024; // 2mb
278   }
279 
fractionFreeSpaceAfterDownload()280   default float fractionFreeSpaceAfterDownload() {
281     return 0.1F;
282   }
283 
timeToWaitForDownloader()284   default int timeToWaitForDownloader() {
285     return 120000; // 2 minutes
286   }
287 
downloaderMaxThreads()288   default int downloaderMaxThreads() {
289     return 2;
290   }
291 
downloaderMaxRetryOnChecksumMismatchCount()292   default int downloaderMaxRetryOnChecksumMismatchCount() {
293     return 5;
294   }
295 
296   // LINT.ThenChange(<internal>)
297 }
298