1*6fa6b5e2SAndroid Build Coastguard Worker// Copyright 2022 Google LLC 2*6fa6b5e2SAndroid Build Coastguard Worker// 3*6fa6b5e2SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License"); 4*6fa6b5e2SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License. 5*6fa6b5e2SAndroid Build Coastguard Worker// You may obtain a copy of the License at 6*6fa6b5e2SAndroid Build Coastguard Worker// 7*6fa6b5e2SAndroid Build Coastguard Worker// http://www.apache.org/licenses/LICENSE-2.0 8*6fa6b5e2SAndroid Build Coastguard Worker// 9*6fa6b5e2SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software 10*6fa6b5e2SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS, 11*6fa6b5e2SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*6fa6b5e2SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and 13*6fa6b5e2SAndroid Build Coastguard Worker// limitations under the License. 14*6fa6b5e2SAndroid Build Coastguard Worker// The main purpose of mirroring external protos here is to separate API and 15*6fa6b5e2SAndroid Build Coastguard Worker// storage protos. The same tag numbers are used for making migration work. 16*6fa6b5e2SAndroid Build Coastguard Worker 17*6fa6b5e2SAndroid Build Coastguard Workersyntax = "proto2"; 18*6fa6b5e2SAndroid Build Coastguard Worker 19*6fa6b5e2SAndroid Build Coastguard Workerpackage mdi.download.internal; 20*6fa6b5e2SAndroid Build Coastguard Worker 21*6fa6b5e2SAndroid Build Coastguard Workerimport "google/protobuf/any.proto"; 22*6fa6b5e2SAndroid Build Coastguard Workerimport "google/protobuf/timestamp.proto"; 23*6fa6b5e2SAndroid Build Coastguard Workerimport "transform.proto"; 24*6fa6b5e2SAndroid Build Coastguard Worker 25*6fa6b5e2SAndroid Build Coastguard Workeroption java_package = "com.google.mobiledatadownload.internal"; 26*6fa6b5e2SAndroid Build Coastguard Workeroption java_outer_classname = "MetadataProto"; 27*6fa6b5e2SAndroid Build Coastguard Worker 28*6fa6b5e2SAndroid Build Coastguard Worker// Mirrors mdi.download.ExtraHttpHeader 29*6fa6b5e2SAndroid Build Coastguard Worker// 30*6fa6b5e2SAndroid Build Coastguard Worker// HTTP headers are described in https://tools.ietf.org/html/rfc7230#section-3.2 31*6fa6b5e2SAndroid Build Coastguard Worker// as key:value, where the value may have a whitespace on each end. 32*6fa6b5e2SAndroid Build Coastguard Workermessage ExtraHttpHeader { 33*6fa6b5e2SAndroid Build Coastguard Worker optional string key = 1; 34*6fa6b5e2SAndroid Build Coastguard Worker optional string value = 2; 35*6fa6b5e2SAndroid Build Coastguard Worker} 36*6fa6b5e2SAndroid Build Coastguard Worker 37*6fa6b5e2SAndroid Build Coastguard Worker// This proto is used to store file group metadata on disk for internal use. It 38*6fa6b5e2SAndroid Build Coastguard Worker// consists of all fields mirrored from DataFileGroup and an extra field for 39*6fa6b5e2SAndroid Build Coastguard Worker// bookkeeping. 40*6fa6b5e2SAndroid Build Coastguard Worker// 41*6fa6b5e2SAndroid Build Coastguard Worker// The tag number of extra fields should start from 1000 to reserve room for 42*6fa6b5e2SAndroid Build Coastguard Worker// growing DataFileGroup. 43*6fa6b5e2SAndroid Build Coastguard Worker// 44*6fa6b5e2SAndroid Build Coastguard Worker// Next id: 1001 45*6fa6b5e2SAndroid Build Coastguard Workermessage DataFileGroupInternal { 46*6fa6b5e2SAndroid Build Coastguard Worker // Extra information that is kept on disk. 47*6fa6b5e2SAndroid Build Coastguard Worker // 48*6fa6b5e2SAndroid Build Coastguard Worker // The extension was originally introduced in cl/248813966. We are migrating 49*6fa6b5e2SAndroid Build Coastguard Worker // away from the extension. However, we still need to read from fields in the 50*6fa6b5e2SAndroid Build Coastguard Worker // extension. Reuse the same tag number as the extension number to read from 51*6fa6b5e2SAndroid Build Coastguard Worker // the extension. 52*6fa6b5e2SAndroid Build Coastguard Worker optional DataFileGroupBookkeeping bookkeeping = 248813966; 53*6fa6b5e2SAndroid Build Coastguard Worker 54*6fa6b5e2SAndroid Build Coastguard Worker // Unique name to identify the group. It should be unique per owner package. 55*6fa6b5e2SAndroid Build Coastguard Worker // In GMSCore, use the module name as the prefix of the group name. 56*6fa6b5e2SAndroid Build Coastguard Worker // 57*6fa6b5e2SAndroid Build Coastguard Worker // Ex: A group name in mdisync module could be named: mdisync-profile-photos. 58*6fa6b5e2SAndroid Build Coastguard Worker // 59*6fa6b5e2SAndroid Build Coastguard Worker // This shouldn't ideally be something like "config", and 60*6fa6b5e2SAndroid Build Coastguard Worker // instead should better define the feature it will be used for. 61*6fa6b5e2SAndroid Build Coastguard Worker // 62*6fa6b5e2SAndroid Build Coastguard Worker // Ex: "icing-language-detection-model", "smart-action-detection-model" 63*6fa6b5e2SAndroid Build Coastguard Worker optional string group_name = 1; 64*6fa6b5e2SAndroid Build Coastguard Worker 65*6fa6b5e2SAndroid Build Coastguard Worker // The name of the package that owns this group. If this field is left empty, 66*6fa6b5e2SAndroid Build Coastguard Worker // the owner is assumed to be the package name of the host app. 67*6fa6b5e2SAndroid Build Coastguard Worker // 68*6fa6b5e2SAndroid Build Coastguard Worker // The files will only be downloaded onto the device if the owner package is 69*6fa6b5e2SAndroid Build Coastguard Worker // present on the device. 70*6fa6b5e2SAndroid Build Coastguard Worker // 71*6fa6b5e2SAndroid Build Coastguard Worker // Ex: "com.google.android.gms", "com.google.android.apps.bugle" 72*6fa6b5e2SAndroid Build Coastguard Worker optional string owner_package = 6; 73*6fa6b5e2SAndroid Build Coastguard Worker 74*6fa6b5e2SAndroid Build Coastguard Worker // Client set version number used to identify the file group. 75*6fa6b5e2SAndroid Build Coastguard Worker // 76*6fa6b5e2SAndroid Build Coastguard Worker // Note that this does not uniquely identify the contents of the file group. 77*6fa6b5e2SAndroid Build Coastguard Worker // It simply reflects a snapshot of client config changes. 78*6fa6b5e2SAndroid Build Coastguard Worker // For example: say there's a file group 'language-detector-model' that 79*6fa6b5e2SAndroid Build Coastguard Worker // downloads a different file per user locale. 80*6fa6b5e2SAndroid Build Coastguard Worker // data_file_group { 81*6fa6b5e2SAndroid Build Coastguard Worker // file_group_name = 'language-detector-model' 82*6fa6b5e2SAndroid Build Coastguard Worker // file_group_version_number = 1 83*6fa6b5e2SAndroid Build Coastguard Worker // file { 84*6fa6b5e2SAndroid Build Coastguard Worker // url = 'en-model' 85*6fa6b5e2SAndroid Build Coastguard Worker // } 86*6fa6b5e2SAndroid Build Coastguard Worker // } 87*6fa6b5e2SAndroid Build Coastguard Worker // data_file_group { 88*6fa6b5e2SAndroid Build Coastguard Worker // file_group_name = 'language-detector-model' 89*6fa6b5e2SAndroid Build Coastguard Worker // file_group_version_number = 1 90*6fa6b5e2SAndroid Build Coastguard Worker // file { 91*6fa6b5e2SAndroid Build Coastguard Worker // url = 'es-model' 92*6fa6b5e2SAndroid Build Coastguard Worker // } 93*6fa6b5e2SAndroid Build Coastguard Worker // } 94*6fa6b5e2SAndroid Build Coastguard Worker // Note that even though the actual contents of the file group are different 95*6fa6b5e2SAndroid Build Coastguard Worker // for each locale, the version is the same because this config was pushed 96*6fa6b5e2SAndroid Build Coastguard Worker // at the same snapshot. 97*6fa6b5e2SAndroid Build Coastguard Worker // 98*6fa6b5e2SAndroid Build Coastguard Worker // Available GMS v18+. 99*6fa6b5e2SAndroid Build Coastguard Worker optional int32 file_group_version_number = 10; 100*6fa6b5e2SAndroid Build Coastguard Worker 101*6fa6b5e2SAndroid Build Coastguard Worker // DEPRECATED 102*6fa6b5e2SAndroid Build Coastguard Worker // MDD team recommends to use explicit properties instead. 103*6fa6b5e2SAndroid Build Coastguard Worker optional google.protobuf.Any custom_property = 20 [deprecated = true]; 104*6fa6b5e2SAndroid Build Coastguard Worker 105*6fa6b5e2SAndroid Build Coastguard Worker // Custom metadata attached to the file group. 106*6fa6b5e2SAndroid Build Coastguard Worker // 107*6fa6b5e2SAndroid Build Coastguard Worker // This allows clients to include specific metadata about the group for their 108*6fa6b5e2SAndroid Build Coastguard Worker // own processing purposes. The metadata will be stored with the group and 109*6fa6b5e2SAndroid Build Coastguard Worker // accessible when the file group is retrieved. 110*6fa6b5e2SAndroid Build Coastguard Worker // 111*6fa6b5e2SAndroid Build Coastguard Worker // This property should only be used if absolutely necessary. Please consult 112*6fa6b5e2SAndroid Build Coastguard Worker // with <internal>@ if you have questions about this property or a potential 113*6fa6b5e2SAndroid Build Coastguard Worker // use-case. 114*6fa6b5e2SAndroid Build Coastguard Worker optional google.protobuf.Any custom_metadata = 27; 115*6fa6b5e2SAndroid Build Coastguard Worker 116*6fa6b5e2SAndroid Build Coastguard Worker reserved 21; 117*6fa6b5e2SAndroid Build Coastguard Worker 118*6fa6b5e2SAndroid Build Coastguard Worker // Mirrors mdi.download.DataFileGroup.AllowedReaders 119*6fa6b5e2SAndroid Build Coastguard Worker enum AllowedReaders { 120*6fa6b5e2SAndroid Build Coastguard Worker ALL_GOOGLE_APPS = 0; 121*6fa6b5e2SAndroid Build Coastguard Worker ONLY_GOOGLE_PLAY_SERVICES = 1; 122*6fa6b5e2SAndroid Build Coastguard Worker ALL_APPS = 2; 123*6fa6b5e2SAndroid Build Coastguard Worker } 124*6fa6b5e2SAndroid Build Coastguard Worker 125*6fa6b5e2SAndroid Build Coastguard Worker // Defines who is allowed to read this file group. Currently the options are: 126*6fa6b5e2SAndroid Build Coastguard Worker // 127*6fa6b5e2SAndroid Build Coastguard Worker // ALL_GOOGLE_APPS: accessible to all Google 1p Apps. 128*6fa6b5e2SAndroid Build Coastguard Worker // ONLY_GOOGLE_PLAY_SERVICES: accessible to only GMS Core. 129*6fa6b5e2SAndroid Build Coastguard Worker // 130*6fa6b5e2SAndroid Build Coastguard Worker // If this field is not explicitly set it defaults to "ALL_GOOGLE_APPS". 131*6fa6b5e2SAndroid Build Coastguard Worker // 132*6fa6b5e2SAndroid Build Coastguard Worker // Available GMS v20+. 133*6fa6b5e2SAndroid Build Coastguard Worker optional AllowedReaders allowed_readers_enum = 12; 134*6fa6b5e2SAndroid Build Coastguard Worker 135*6fa6b5e2SAndroid Build Coastguard Worker // Length of time (in seconds) for which a file group version will live after 136*6fa6b5e2SAndroid Build Coastguard Worker // since a newer version became fully downloaded. Clients should set this time 137*6fa6b5e2SAndroid Build Coastguard Worker // to be more than the time in which they call MDD to refresh their data. 138*6fa6b5e2SAndroid Build Coastguard Worker // NOTE: MDD will delete the file group version within a day of this time. 139*6fa6b5e2SAndroid Build Coastguard Worker // Ex: 172800 // 2 Days 140*6fa6b5e2SAndroid Build Coastguard Worker optional int64 stale_lifetime_secs = 3; 141*6fa6b5e2SAndroid Build Coastguard Worker 142*6fa6b5e2SAndroid Build Coastguard Worker // The timestamp at which this filegroup should be deleted, even if it is 143*6fa6b5e2SAndroid Build Coastguard Worker // still active, specified in seconds since epoch. 144*6fa6b5e2SAndroid Build Coastguard Worker // NOTE: MDD will delete the file group version within a day of this time. 145*6fa6b5e2SAndroid Build Coastguard Worker optional int64 expiration_date_secs = 11; 146*6fa6b5e2SAndroid Build Coastguard Worker 147*6fa6b5e2SAndroid Build Coastguard Worker // Specify the conditions under which the file group should be downloaded. 148*6fa6b5e2SAndroid Build Coastguard Worker optional DownloadConditions download_conditions = 13; 149*6fa6b5e2SAndroid Build Coastguard Worker 150*6fa6b5e2SAndroid Build Coastguard Worker // Setting this flag to true will mean that the downloaded files will appear 151*6fa6b5e2SAndroid Build Coastguard Worker // to be in a directory by themselves. 152*6fa6b5e2SAndroid Build Coastguard Worker // The file name/file path of the exposed file will be the filename set in the 153*6fa6b5e2SAndroid Build Coastguard Worker // file.relative_file_path field, OR if that field is empty, the file name 154*6fa6b5e2SAndroid Build Coastguard Worker // from the file.url_to_download field. This enables downloaded files to refer 155*6fa6b5e2SAndroid Build Coastguard Worker // to each other by name. 156*6fa6b5e2SAndroid Build Coastguard Worker // It's invalid to set this flag to true if two files end up with the same 157*6fa6b5e2SAndroid Build Coastguard Worker // file path. 158*6fa6b5e2SAndroid Build Coastguard Worker // Valid on iOS, cMDD, and aMDD. 159*6fa6b5e2SAndroid Build Coastguard Worker // 160*6fa6b5e2SAndroid Build Coastguard Worker // NOTE: For aMDD, this feature is not available if Android Blob Sharing is 161*6fa6b5e2SAndroid Build Coastguard Worker // enabled or if using an API level below 21 (L). If either case is true, this 162*6fa6b5e2SAndroid Build Coastguard Worker // option will be ignored. 163*6fa6b5e2SAndroid Build Coastguard Worker optional bool preserve_filenames_and_isolate_files = 14; 164*6fa6b5e2SAndroid Build Coastguard Worker 165*6fa6b5e2SAndroid Build Coastguard Worker // List of files in the group. 166*6fa6b5e2SAndroid Build Coastguard Worker repeated DataFile file = 2; 167*6fa6b5e2SAndroid Build Coastguard Worker 168*6fa6b5e2SAndroid Build Coastguard Worker // Tag for the network traffic to download this file group. 169*6fa6b5e2SAndroid Build Coastguard Worker // Tag space is determined by the host app. 170*6fa6b5e2SAndroid Build Coastguard Worker // For Gmscore, the tag should come from: 171*6fa6b5e2SAndroid Build Coastguard Worker // <internal> 172*6fa6b5e2SAndroid Build Coastguard Worker optional int32 traffic_tag = 16; 173*6fa6b5e2SAndroid Build Coastguard Worker 174*6fa6b5e2SAndroid Build Coastguard Worker // Extra HTTP headers to apply when downloading all files in the group. 175*6fa6b5e2SAndroid Build Coastguard Worker repeated ExtraHttpHeader group_extra_http_headers = 17; 176*6fa6b5e2SAndroid Build Coastguard Worker 177*6fa6b5e2SAndroid Build Coastguard Worker reserved 19; 178*6fa6b5e2SAndroid Build Coastguard Worker 179*6fa6b5e2SAndroid Build Coastguard Worker // Unique identifier of a DataFileGroup config (i.e. a "snapshot") created 180*6fa6b5e2SAndroid Build Coastguard Worker // when using MDD Ingress API. 181*6fa6b5e2SAndroid Build Coastguard Worker optional int64 build_id = 23; 182*6fa6b5e2SAndroid Build Coastguard Worker 183*6fa6b5e2SAndroid Build Coastguard Worker // A fingerprint allowing clients to identify a DataFileGroup 184*6fa6b5e2SAndroid Build Coastguard Worker // config based on a given set of properties (i.e. a "partition" of 185*6fa6b5e2SAndroid Build Coastguard Worker // any file group properties). This can be used by clients as an exact match 186*6fa6b5e2SAndroid Build Coastguard Worker // for a class of DataFileGroups during targeting or as a compatibility check. 187*6fa6b5e2SAndroid Build Coastguard Worker optional string variant_id = 26; 188*6fa6b5e2SAndroid Build Coastguard Worker 189*6fa6b5e2SAndroid Build Coastguard Worker // The locales compatible with the file group. This can be different from the 190*6fa6b5e2SAndroid Build Coastguard Worker // device locale. 191*6fa6b5e2SAndroid Build Coastguard Worker // 192*6fa6b5e2SAndroid Build Coastguard Worker // Values in this list may be exact locales (e.g. "en-US") or language-only 193*6fa6b5e2SAndroid Build Coastguard Worker // ("en-*"). 194*6fa6b5e2SAndroid Build Coastguard Worker // Example 1: locale = ["en-US"]; // compatible with "en-US" only 195*6fa6b5e2SAndroid Build Coastguard Worker // Example 2: locale = ["en-US", "en-CA"]; // compatible with "en-US" or 196*6fa6b5e2SAndroid Build Coastguard Worker // // "en-CA" 197*6fa6b5e2SAndroid Build Coastguard Worker // Example 3: locale = ["en-*"]; // compatible with all "en" locales 198*6fa6b5e2SAndroid Build Coastguard Worker repeated string locale = 25; 199*6fa6b5e2SAndroid Build Coastguard Worker 200*6fa6b5e2SAndroid Build Coastguard Worker reserved 28; 201*6fa6b5e2SAndroid Build Coastguard Worker 202*6fa6b5e2SAndroid Build Coastguard Worker // If a group enables preserve_filenames_and_isolate_files 203*6fa6b5e2SAndroid Build Coastguard Worker // this property will contain the directory root of the isolated 204*6fa6b5e2SAndroid Build Coastguard Worker // structure. Specifically, the property will be a string created from the 205*6fa6b5e2SAndroid Build Coastguard Worker // group name and a hash of other identifying properties (account, variantid, 206*6fa6b5e2SAndroid Build Coastguard Worker // buildid). 207*6fa6b5e2SAndroid Build Coastguard Worker // 208*6fa6b5e2SAndroid Build Coastguard Worker // currently only used in aMDD. 209*6fa6b5e2SAndroid Build Coastguard Worker optional string isolated_directory_root = 1000; 210*6fa6b5e2SAndroid Build Coastguard Worker 211*6fa6b5e2SAndroid Build Coastguard Worker reserved 4, 5, 7, 8, 9, 15, 18, 22, 24; 212*6fa6b5e2SAndroid Build Coastguard Worker} 213*6fa6b5e2SAndroid Build Coastguard Worker 214*6fa6b5e2SAndroid Build Coastguard Worker// Mirrors mdi.download.DataFile 215*6fa6b5e2SAndroid Build Coastguard Worker// 216*6fa6b5e2SAndroid Build Coastguard Worker// A data file represents all the metadata to download the file and then 217*6fa6b5e2SAndroid Build Coastguard Worker// manage it on the device. 218*6fa6b5e2SAndroid Build Coastguard Worker// Next tag: 22 219*6fa6b5e2SAndroid Build Coastguard Worker// 220*6fa6b5e2SAndroid Build Coastguard Worker// This should not contain any fields that are marked internal, as we compare 221*6fa6b5e2SAndroid Build Coastguard Worker// the protos directly to decide if it is a new version of the file. 222*6fa6b5e2SAndroid Build Coastguard Worker// LINT.IfChange(data_file) 223*6fa6b5e2SAndroid Build Coastguard Workermessage DataFile { 224*6fa6b5e2SAndroid Build Coastguard Worker // A unique identifier of the file within the group, that can be used to 225*6fa6b5e2SAndroid Build Coastguard Worker // get this file from the group. 226*6fa6b5e2SAndroid Build Coastguard Worker // Ex: "language-detection-model" 227*6fa6b5e2SAndroid Build Coastguard Worker optional string file_id = 7; 228*6fa6b5e2SAndroid Build Coastguard Worker 229*6fa6b5e2SAndroid Build Coastguard Worker // Url from where the file is to be downloaded. 230*6fa6b5e2SAndroid Build Coastguard Worker // Ex: https://www.gstatic.com/group-name/model_1234.zip 231*6fa6b5e2SAndroid Build Coastguard Worker optional string url_to_download = 2; 232*6fa6b5e2SAndroid Build Coastguard Worker 233*6fa6b5e2SAndroid Build Coastguard Worker // Exact size of the file. This is used to check if there is space available 234*6fa6b5e2SAndroid Build Coastguard Worker // for the file before scheduling the download. 235*6fa6b5e2SAndroid Build Coastguard Worker // The byte_size is optional. If not set, MDD will try with best effort to get 236*6fa6b5e2SAndroid Build Coastguard Worker // the file size using the HTTP HEAD request. 237*6fa6b5e2SAndroid Build Coastguard Worker optional int32 byte_size = 4; 238*6fa6b5e2SAndroid Build Coastguard Worker 239*6fa6b5e2SAndroid Build Coastguard Worker // Enum for checksum types. 240*6fa6b5e2SAndroid Build Coastguard Worker // NOTE: do not add any new checksum type here, older MDD versions would break 241*6fa6b5e2SAndroid Build Coastguard Worker // otherwise. 242*6fa6b5e2SAndroid Build Coastguard Worker enum ChecksumType { 243*6fa6b5e2SAndroid Build Coastguard Worker // Default checksum is SHA1. 244*6fa6b5e2SAndroid Build Coastguard Worker DEFAULT = 0; 245*6fa6b5e2SAndroid Build Coastguard Worker 246*6fa6b5e2SAndroid Build Coastguard Worker // No checksum is provided. 247*6fa6b5e2SAndroid Build Coastguard Worker NONE = 1; 248*6fa6b5e2SAndroid Build Coastguard Worker 249*6fa6b5e2SAndroid Build Coastguard Worker reserved 2 /* SHA256 */; 250*6fa6b5e2SAndroid Build Coastguard Worker } 251*6fa6b5e2SAndroid Build Coastguard Worker 252*6fa6b5e2SAndroid Build Coastguard Worker optional ChecksumType checksum_type = 15; 253*6fa6b5e2SAndroid Build Coastguard Worker 254*6fa6b5e2SAndroid Build Coastguard Worker // SHA1 checksum to verify the file before it can be used. This is also used 255*6fa6b5e2SAndroid Build Coastguard Worker // to de-duplicate files between different groups. 256*6fa6b5e2SAndroid Build Coastguard Worker // For most files, this will be the checksum of the file being downloaded. 257*6fa6b5e2SAndroid Build Coastguard Worker // For files with download_transform, this should contain the transform of 258*6fa6b5e2SAndroid Build Coastguard Worker // the file after the transforms have been applied. 259*6fa6b5e2SAndroid Build Coastguard Worker // The checksum is optional. If not set, the checksum_type must be 260*6fa6b5e2SAndroid Build Coastguard Worker // ChecksumType.NONE. 261*6fa6b5e2SAndroid Build Coastguard Worker optional string checksum = 5; 262*6fa6b5e2SAndroid Build Coastguard Worker 263*6fa6b5e2SAndroid Build Coastguard Worker // The following are <internal> transforms to apply to the downloaded files. 264*6fa6b5e2SAndroid Build Coastguard Worker // Transforms are bi-directional and defined in terms of what they do on 265*6fa6b5e2SAndroid Build Coastguard Worker // write. Since these transforms are applied while reading, their 266*6fa6b5e2SAndroid Build Coastguard Worker // directionality is reversed. Eg, you'll see 'compress' to indicate that the 267*6fa6b5e2SAndroid Build Coastguard Worker // file should be decompressed. 268*6fa6b5e2SAndroid Build Coastguard Worker 269*6fa6b5e2SAndroid Build Coastguard Worker // These transforms are applied once by MDD after downloading the file. 270*6fa6b5e2SAndroid Build Coastguard Worker // Currently only compress is available. 271*6fa6b5e2SAndroid Build Coastguard Worker // Valid on Android. iOS support is tracked by b/118828045. 272*6fa6b5e2SAndroid Build Coastguard Worker optional mobstore.proto.Transforms download_transforms = 11; 273*6fa6b5e2SAndroid Build Coastguard Worker 274*6fa6b5e2SAndroid Build Coastguard Worker // If DataFile has download_transforms, this field must be provided with the 275*6fa6b5e2SAndroid Build Coastguard Worker // SHA1 checksum of the file before any transform are applied. The original 276*6fa6b5e2SAndroid Build Coastguard Worker // checksum would also be checked after the download_transforms are applied. 277*6fa6b5e2SAndroid Build Coastguard Worker optional string downloaded_file_checksum = 14; 278*6fa6b5e2SAndroid Build Coastguard Worker 279*6fa6b5e2SAndroid Build Coastguard Worker // Exact size of the downloaded file. If the DataFile has download transforms 280*6fa6b5e2SAndroid Build Coastguard Worker // like compress and zip, the downloaded file size would be different than 281*6fa6b5e2SAndroid Build Coastguard Worker // the final file size on disk. Client could use 282*6fa6b5e2SAndroid Build Coastguard Worker // this field to track the downloaded file size and calculate the download 283*6fa6b5e2SAndroid Build Coastguard Worker // progress percentage. This field is not used by MDD currently. 284*6fa6b5e2SAndroid Build Coastguard Worker optional int32 downloaded_file_byte_size = 16; 285*6fa6b5e2SAndroid Build Coastguard Worker 286*6fa6b5e2SAndroid Build Coastguard Worker // These transforms are evaluated by the caller on-the-fly when reading the 287*6fa6b5e2SAndroid Build Coastguard Worker // data with MobStore. Any transforms installed in the caller's MobStore 288*6fa6b5e2SAndroid Build Coastguard Worker // instance is available. 289*6fa6b5e2SAndroid Build Coastguard Worker // Valid on Android. iOS support is tracked by b/118759254. 290*6fa6b5e2SAndroid Build Coastguard Worker optional mobstore.proto.Transforms read_transforms = 12; 291*6fa6b5e2SAndroid Build Coastguard Worker 292*6fa6b5e2SAndroid Build Coastguard Worker // List of delta files that can be encoded and decoded with base files. 293*6fa6b5e2SAndroid Build Coastguard Worker // If the device has any base file, the delta file which is much 294*6fa6b5e2SAndroid Build Coastguard Worker // smaller will be downloaded instead of the full file. 295*6fa6b5e2SAndroid Build Coastguard Worker // For most clients, only one delta file should be enough. If specifying 296*6fa6b5e2SAndroid Build Coastguard Worker // multiple delta files, they should be in a sequence from the most recent 297*6fa6b5e2SAndroid Build Coastguard Worker // base file to the oldest. 298*6fa6b5e2SAndroid Build Coastguard Worker // This is currently only supported on Android. 299*6fa6b5e2SAndroid Build Coastguard Worker repeated DeltaFile delta_file = 13; 300*6fa6b5e2SAndroid Build Coastguard Worker 301*6fa6b5e2SAndroid Build Coastguard Worker enum AndroidSharingType { 302*6fa6b5e2SAndroid Build Coastguard Worker // The dataFile isn't available for sharing. 303*6fa6b5e2SAndroid Build Coastguard Worker UNSUPPORTED = 0; 304*6fa6b5e2SAndroid Build Coastguard Worker 305*6fa6b5e2SAndroid Build Coastguard Worker // If sharing with the Android Blob Sharing Service isn't available, fall 306*6fa6b5e2SAndroid Build Coastguard Worker // back to normal behavior, i.e. download locally. 307*6fa6b5e2SAndroid Build Coastguard Worker ANDROID_BLOB_WHEN_AVAILABLE = 1; 308*6fa6b5e2SAndroid Build Coastguard Worker } 309*6fa6b5e2SAndroid Build Coastguard Worker 310*6fa6b5e2SAndroid Build Coastguard Worker // Defines whether the file should be shared and how. 311*6fa6b5e2SAndroid Build Coastguard Worker // NOTE: currently this field is only used by aMDD and has no effect on iMDD. 312*6fa6b5e2SAndroid Build Coastguard Worker optional AndroidSharingType android_sharing_type = 17; 313*6fa6b5e2SAndroid Build Coastguard Worker 314*6fa6b5e2SAndroid Build Coastguard Worker // Enum for android sharing checksum types. 315*6fa6b5e2SAndroid Build Coastguard Worker enum AndroidSharingChecksumType { 316*6fa6b5e2SAndroid Build Coastguard Worker NOT_SET = 0; 317*6fa6b5e2SAndroid Build Coastguard Worker 318*6fa6b5e2SAndroid Build Coastguard Worker // If the file group should be shared through the Android Blob Sharing 319*6fa6b5e2SAndroid Build Coastguard Worker // Service, the checksum type must be set to SHA256. 320*6fa6b5e2SAndroid Build Coastguard Worker SHA2_256 = 1; 321*6fa6b5e2SAndroid Build Coastguard Worker } 322*6fa6b5e2SAndroid Build Coastguard Worker 323*6fa6b5e2SAndroid Build Coastguard Worker optional AndroidSharingChecksumType android_sharing_checksum_type = 18; 324*6fa6b5e2SAndroid Build Coastguard Worker 325*6fa6b5e2SAndroid Build Coastguard Worker // Checksum used to access files through the Android Blob Sharing Service. 326*6fa6b5e2SAndroid Build Coastguard Worker optional string android_sharing_checksum = 19; 327*6fa6b5e2SAndroid Build Coastguard Worker 328*6fa6b5e2SAndroid Build Coastguard Worker // Relative file path and file name to be preserved within the parent 329*6fa6b5e2SAndroid Build Coastguard Worker // directory when creating symlinks for the file groups that have 330*6fa6b5e2SAndroid Build Coastguard Worker // preserve_filenames_and_isolate_files set to true. 331*6fa6b5e2SAndroid Build Coastguard Worker // This filename should NOT start or end with a '/', and it can not contain 332*6fa6b5e2SAndroid Build Coastguard Worker // the substring '..'. 333*6fa6b5e2SAndroid Build Coastguard Worker // Working example: "subDir/FileName.txt". 334*6fa6b5e2SAndroid Build Coastguard Worker optional string relative_file_path = 20; 335*6fa6b5e2SAndroid Build Coastguard Worker 336*6fa6b5e2SAndroid Build Coastguard Worker // Custom metadata attached to the file. 337*6fa6b5e2SAndroid Build Coastguard Worker // 338*6fa6b5e2SAndroid Build Coastguard Worker // This allows clients to include specific metadata about the file for their 339*6fa6b5e2SAndroid Build Coastguard Worker // own processing purposes. The metadata will be stored with the file and 340*6fa6b5e2SAndroid Build Coastguard Worker // accessible when the file's file group is retrieved. 341*6fa6b5e2SAndroid Build Coastguard Worker // 342*6fa6b5e2SAndroid Build Coastguard Worker // This property should only be used if absolutely necessary. Please consult 343*6fa6b5e2SAndroid Build Coastguard Worker // with <internal>@ if you have questions about this property or a potential 344*6fa6b5e2SAndroid Build Coastguard Worker // use-case. 345*6fa6b5e2SAndroid Build Coastguard Worker optional google.protobuf.Any custom_metadata = 21; 346*6fa6b5e2SAndroid Build Coastguard Worker 347*6fa6b5e2SAndroid Build Coastguard Worker reserved 1, 3, 6, 8, 9; 348*6fa6b5e2SAndroid Build Coastguard Worker} 349*6fa6b5e2SAndroid Build Coastguard Worker// LINT.ThenChange( 350*6fa6b5e2SAndroid Build Coastguard Worker// <internal>, 351*6fa6b5e2SAndroid Build Coastguard Worker// <internal>) 352*6fa6b5e2SAndroid Build Coastguard Worker 353*6fa6b5e2SAndroid Build Coastguard Worker// Mirrors mdi.download.DeltaFile 354*6fa6b5e2SAndroid Build Coastguard Worker// 355*6fa6b5e2SAndroid Build Coastguard Worker// A delta file represents all the metadata to download for a diff file encoded 356*6fa6b5e2SAndroid Build Coastguard Worker// based on a base file 357*6fa6b5e2SAndroid Build Coastguard Worker// LINT.IfChange(delta_file) 358*6fa6b5e2SAndroid Build Coastguard Workermessage DeltaFile { 359*6fa6b5e2SAndroid Build Coastguard Worker // These fields all mirror the similarly-named fields in DataFile. 360*6fa6b5e2SAndroid Build Coastguard Worker optional string url_to_download = 1; 361*6fa6b5e2SAndroid Build Coastguard Worker optional int32 byte_size = 2; 362*6fa6b5e2SAndroid Build Coastguard Worker optional string checksum = 3; 363*6fa6b5e2SAndroid Build Coastguard Worker 364*6fa6b5e2SAndroid Build Coastguard Worker // Enum of all diff decoders supported 365*6fa6b5e2SAndroid Build Coastguard Worker enum DiffDecoder { 366*6fa6b5e2SAndroid Build Coastguard Worker // Default to have no diff decoder specified, will thrown unsupported 367*6fa6b5e2SAndroid Build Coastguard Worker // exception 368*6fa6b5e2SAndroid Build Coastguard Worker UNSPECIFIED = 0; 369*6fa6b5e2SAndroid Build Coastguard Worker 370*6fa6b5e2SAndroid Build Coastguard Worker // VcDIFF decoder 371*6fa6b5e2SAndroid Build Coastguard Worker // Generic Differencing and Compression Data Format 372*6fa6b5e2SAndroid Build Coastguard Worker // For more information, please refer to rfc3284 373*6fa6b5e2SAndroid Build Coastguard Worker // The VcDiff decoder for GMS service: 374*6fa6b5e2SAndroid Build Coastguard Worker // <internal> 375*6fa6b5e2SAndroid Build Coastguard Worker VC_DIFF = 1; 376*6fa6b5e2SAndroid Build Coastguard Worker } 377*6fa6b5e2SAndroid Build Coastguard Worker // The diff decoder used to generate full file with delta and base file. 378*6fa6b5e2SAndroid Build Coastguard Worker // For MDD as a GMS service, a VcDiff decoder will be registered and injected 379*6fa6b5e2SAndroid Build Coastguard Worker // in by default. Using MDD as a library, clients need to register and inject 380*6fa6b5e2SAndroid Build Coastguard Worker // in a VcDiff decoder, otherwise, an exception will be thrown. 381*6fa6b5e2SAndroid Build Coastguard Worker optional DiffDecoder diff_decoder = 5; 382*6fa6b5e2SAndroid Build Coastguard Worker 383*6fa6b5e2SAndroid Build Coastguard Worker // The base file represents to a full file on device. It should contain the 384*6fa6b5e2SAndroid Build Coastguard Worker // bare minimum fields of a DataFile to identify a DataFile on device. 385*6fa6b5e2SAndroid Build Coastguard Worker optional BaseFile base_file = 6; 386*6fa6b5e2SAndroid Build Coastguard Worker 387*6fa6b5e2SAndroid Build Coastguard Worker reserved 4; 388*6fa6b5e2SAndroid Build Coastguard Worker} 389*6fa6b5e2SAndroid Build Coastguard Worker// LINT.ThenChange( 390*6fa6b5e2SAndroid Build Coastguard Worker// <internal>, 391*6fa6b5e2SAndroid Build Coastguard Worker// <internal>) 392*6fa6b5e2SAndroid Build Coastguard Worker 393*6fa6b5e2SAndroid Build Coastguard Worker// Mirrors mdi.download.BaseFile 394*6fa6b5e2SAndroid Build Coastguard Workermessage BaseFile { 395*6fa6b5e2SAndroid Build Coastguard Worker // SHA1 checksum of the base file to identify a file on device. It should 396*6fa6b5e2SAndroid Build Coastguard Worker // match the checksum field of the base file used to generate the delta file. 397*6fa6b5e2SAndroid Build Coastguard Worker optional string checksum = 1; 398*6fa6b5e2SAndroid Build Coastguard Worker} 399*6fa6b5e2SAndroid Build Coastguard Worker 400*6fa6b5e2SAndroid Build Coastguard Worker// Mirrors mdi.download.DownloadConditions 401*6fa6b5e2SAndroid Build Coastguard Worker// 402*6fa6b5e2SAndroid Build Coastguard Worker// Next id: 5 403*6fa6b5e2SAndroid Build Coastguard Workermessage DownloadConditions { 404*6fa6b5e2SAndroid Build Coastguard Worker // TODO(b/143548753): The first value in an enum must have a specific prefix. 405*6fa6b5e2SAndroid Build Coastguard Worker enum DeviceStoragePolicy { 406*6fa6b5e2SAndroid Build Coastguard Worker // MDD will block download of files in android low storage. Currently MDD 407*6fa6b5e2SAndroid Build Coastguard Worker // doesn't delete the files in case the device reaches low storage 408*6fa6b5e2SAndroid Build Coastguard Worker // after the file has been downloaded. 409*6fa6b5e2SAndroid Build Coastguard Worker BLOCK_DOWNLOAD_IN_LOW_STORAGE = 0; 410*6fa6b5e2SAndroid Build Coastguard Worker 411*6fa6b5e2SAndroid Build Coastguard Worker // Block download of files only under a lower threshold defined here 412*6fa6b5e2SAndroid Build Coastguard Worker // <internal> 413*6fa6b5e2SAndroid Build Coastguard Worker BLOCK_DOWNLOAD_LOWER_THRESHOLD = 1; 414*6fa6b5e2SAndroid Build Coastguard Worker 415*6fa6b5e2SAndroid Build Coastguard Worker // Set the storage threshold to an extremely low value when downloading. 416*6fa6b5e2SAndroid Build Coastguard Worker // IMPORTANT: if the download make the device runs out of disk, this could 417*6fa6b5e2SAndroid Build Coastguard Worker // render the device unusable. 418*6fa6b5e2SAndroid Build Coastguard Worker // This should only be used for critical use cases such as privacy 419*6fa6b5e2SAndroid Build Coastguard Worker // violations. Emergency fix should not belong to this category. Please 420*6fa6b5e2SAndroid Build Coastguard Worker // talks to <internal>@ when you want to use this option. 421*6fa6b5e2SAndroid Build Coastguard Worker EXTREMELY_LOW_THRESHOLD = 2; 422*6fa6b5e2SAndroid Build Coastguard Worker } 423*6fa6b5e2SAndroid Build Coastguard Worker 424*6fa6b5e2SAndroid Build Coastguard Worker // Specify the device storage under which the files should be downloaded. 425*6fa6b5e2SAndroid Build Coastguard Worker // By default, the files will only be downloaded if the device is not in 426*6fa6b5e2SAndroid Build Coastguard Worker // low storage. 427*6fa6b5e2SAndroid Build Coastguard Worker optional DeviceStoragePolicy device_storage_policy = 1; 428*6fa6b5e2SAndroid Build Coastguard Worker 429*6fa6b5e2SAndroid Build Coastguard Worker // TODO(b/143548753): The first value in an enum must have a specific prefix. 430*6fa6b5e2SAndroid Build Coastguard Worker enum DeviceNetworkPolicy { 431*6fa6b5e2SAndroid Build Coastguard Worker // Only download files on wifi. 432*6fa6b5e2SAndroid Build Coastguard Worker DOWNLOAD_ONLY_ON_WIFI = 0; 433*6fa6b5e2SAndroid Build Coastguard Worker 434*6fa6b5e2SAndroid Build Coastguard Worker // Allow download on any network including wifi and cellular. 435*6fa6b5e2SAndroid Build Coastguard Worker DOWNLOAD_ON_ANY_NETWORK = 1; 436*6fa6b5e2SAndroid Build Coastguard Worker 437*6fa6b5e2SAndroid Build Coastguard Worker // Allow downloading only on wifi first, then after a configurable time 438*6fa6b5e2SAndroid Build Coastguard Worker // period set in the field download_first_on_wifi_period_secs below, 439*6fa6b5e2SAndroid Build Coastguard Worker // allow downloading on any network including wifi and cellular. 440*6fa6b5e2SAndroid Build Coastguard Worker DOWNLOAD_FIRST_ON_WIFI_THEN_ON_ANY_NETWORK = 2; 441*6fa6b5e2SAndroid Build Coastguard Worker } 442*6fa6b5e2SAndroid Build Coastguard Worker 443*6fa6b5e2SAndroid Build Coastguard Worker // Specify the device network under which the files should be downloaded. 444*6fa6b5e2SAndroid Build Coastguard Worker // By default, the files will only be downloaded on wifi. 445*6fa6b5e2SAndroid Build Coastguard Worker // 446*6fa6b5e2SAndroid Build Coastguard Worker // If your feature targets below v20 and want to download on cellular in 447*6fa6b5e2SAndroid Build Coastguard Worker // these versions of gms, also set allow_dowload_without_wifi = true; 448*6fa6b5e2SAndroid Build Coastguard Worker optional DeviceNetworkPolicy device_network_policy = 2; 449*6fa6b5e2SAndroid Build Coastguard Worker 450*6fa6b5e2SAndroid Build Coastguard Worker // This field will only be used when the 451*6fa6b5e2SAndroid Build Coastguard Worker // DeviceNetworkPolicy = DOWNLOAD_FIRST_ON_WIFI_THEN_ON_ANY_NETWORK 452*6fa6b5e2SAndroid Build Coastguard Worker // MDD will download the file only on wifi for this period of time. If the 453*6fa6b5e2SAndroid Build Coastguard Worker // download was not finished, MDD will download on any network including 454*6fa6b5e2SAndroid Build Coastguard Worker // wifi and cellular. 455*6fa6b5e2SAndroid Build Coastguard Worker // Ex: 604800 // 7 Days 456*6fa6b5e2SAndroid Build Coastguard Worker optional int64 download_first_on_wifi_period_secs = 4; 457*6fa6b5e2SAndroid Build Coastguard Worker 458*6fa6b5e2SAndroid Build Coastguard Worker // TODO(b/143548753): The first value in an enum must have a specific prefix. 459*6fa6b5e2SAndroid Build Coastguard Worker enum ActivatingCondition { 460*6fa6b5e2SAndroid Build Coastguard Worker // The download is activated as soon the server side config is received and 461*6fa6b5e2SAndroid Build Coastguard Worker // the server configured download conditions are satisfied. 462*6fa6b5e2SAndroid Build Coastguard Worker ALWAYS_ACTIVATED = 0; 463*6fa6b5e2SAndroid Build Coastguard Worker 464*6fa6b5e2SAndroid Build Coastguard Worker // The download is activated when both server side activation conditions 465*6fa6b5e2SAndroid Build Coastguard Worker // are satisfied and the client has activated the download on device. 466*6fa6b5e2SAndroid Build Coastguard Worker // 467*6fa6b5e2SAndroid Build Coastguard Worker // Clients can activate this group using the activateFileGroup API. 468*6fa6b5e2SAndroid Build Coastguard Worker // <internal> 469*6fa6b5e2SAndroid Build Coastguard Worker DEVICE_ACTIVATED = 1; 470*6fa6b5e2SAndroid Build Coastguard Worker } 471*6fa6b5e2SAndroid Build Coastguard Worker 472*6fa6b5e2SAndroid Build Coastguard Worker // Specify how the download is activated. By default, the download is 473*6fa6b5e2SAndroid Build Coastguard Worker // activated as soon as server configured activating conditions are satisfied. 474*6fa6b5e2SAndroid Build Coastguard Worker optional ActivatingCondition activating_condition = 3; 475*6fa6b5e2SAndroid Build Coastguard Worker} 476*6fa6b5e2SAndroid Build Coastguard Worker 477*6fa6b5e2SAndroid Build Coastguard Worker// This proto contains extra information about a file group for bookkeeping. 478*6fa6b5e2SAndroid Build Coastguard Worker// Next tag: 6 479*6fa6b5e2SAndroid Build Coastguard Workermessage DataFileGroupBookkeeping { 480*6fa6b5e2SAndroid Build Coastguard Worker // The epoch time (seconds since 1/1/1970) at which this stale file group will 481*6fa6b5e2SAndroid Build Coastguard Worker // be deleted. 482*6fa6b5e2SAndroid Build Coastguard Worker optional int64 stale_expiration_date = 1; 483*6fa6b5e2SAndroid Build Coastguard Worker 484*6fa6b5e2SAndroid Build Coastguard Worker // The timestamp (epoch time, milliseconds since 1/1/1970) that the file group 485*6fa6b5e2SAndroid Build Coastguard Worker // was first received. 486*6fa6b5e2SAndroid Build Coastguard Worker // 487*6fa6b5e2SAndroid Build Coastguard Worker // If this is an update on an existing group, then the timestamp from the old 488*6fa6b5e2SAndroid Build Coastguard Worker // group is used if no files were updated. 489*6fa6b5e2SAndroid Build Coastguard Worker optional int64 group_new_files_received_timestamp = 2; 490*6fa6b5e2SAndroid Build Coastguard Worker 491*6fa6b5e2SAndroid Build Coastguard Worker // The timestamp (epoch time, milliseconds since 1/1/1970) at which the group 492*6fa6b5e2SAndroid Build Coastguard Worker // was first marked as downloaded. 493*6fa6b5e2SAndroid Build Coastguard Worker optional int64 group_downloaded_timestamp_in_millis = 3; 494*6fa6b5e2SAndroid Build Coastguard Worker 495*6fa6b5e2SAndroid Build Coastguard Worker // The timestamp (epoch time, milliseconds since 1/1/1970) that MDD starts 496*6fa6b5e2SAndroid Build Coastguard Worker // downloading the file group for the first time. 497*6fa6b5e2SAndroid Build Coastguard Worker optional int64 group_download_started_timestamp_in_millis = 4; 498*6fa6b5e2SAndroid Build Coastguard Worker 499*6fa6b5e2SAndroid Build Coastguard Worker // The total count of download periodic tasks needed to fully download the 500*6fa6b5e2SAndroid Build Coastguard Worker // file group. 501*6fa6b5e2SAndroid Build Coastguard Worker optional int32 download_started_count = 5; 502*6fa6b5e2SAndroid Build Coastguard Worker} 503*6fa6b5e2SAndroid Build Coastguard Worker 504*6fa6b5e2SAndroid Build Coastguard Worker// Key used by mdd to uniquely identify a client group. 505*6fa6b5e2SAndroid Build Coastguard Workermessage GroupKey { 506*6fa6b5e2SAndroid Build Coastguard Worker // The name of the group. 507*6fa6b5e2SAndroid Build Coastguard Worker optional string group_name = 1; 508*6fa6b5e2SAndroid Build Coastguard Worker 509*6fa6b5e2SAndroid Build Coastguard Worker // The package name of the group owner. A null value or empty value means 510*6fa6b5e2SAndroid Build Coastguard Worker // that the group is not associated with any package. 511*6fa6b5e2SAndroid Build Coastguard Worker optional string owner_package = 2; 512*6fa6b5e2SAndroid Build Coastguard Worker 513*6fa6b5e2SAndroid Build Coastguard Worker // The account associated to the file group. 514*6fa6b5e2SAndroid Build Coastguard Worker optional string account = 5; 515*6fa6b5e2SAndroid Build Coastguard Worker 516*6fa6b5e2SAndroid Build Coastguard Worker // Whether or not all files in a fileGroup have been downloaded. 517*6fa6b5e2SAndroid Build Coastguard Worker optional bool downloaded = 4; 518*6fa6b5e2SAndroid Build Coastguard Worker 519*6fa6b5e2SAndroid Build Coastguard Worker // The variant id of the group for identification purposes. 520*6fa6b5e2SAndroid Build Coastguard Worker // 521*6fa6b5e2SAndroid Build Coastguard Worker // This is used to ensure that groups with different variants can have 522*6fa6b5e2SAndroid Build Coastguard Worker // different entries in MDD metadata, and therefore have different lifecycles. 523*6fa6b5e2SAndroid Build Coastguard Worker // 524*6fa6b5e2SAndroid Build Coastguard Worker // Note that clients can choose to opt-in to a SINGLE_VARIANT flow where 525*6fa6b5e2SAndroid Build Coastguard Worker // different variants replace each other on-device (only single variant can 526*6fa6b5e2SAndroid Build Coastguard Worker // exist on a device at a time). In this case, an empty variant_id is set here 527*6fa6b5e2SAndroid Build Coastguard Worker // so groups with different variants share the same GroupKey and are subject 528*6fa6b5e2SAndroid Build Coastguard Worker // to the same lifecycle, even though the DataFileGroup does have a non-empty 529*6fa6b5e2SAndroid Build Coastguard Worker // variant_id. 530*6fa6b5e2SAndroid Build Coastguard Worker // 531*6fa6b5e2SAndroid Build Coastguard Worker // Because of the SINGLE_VARIANT flow and because groups may still be added 532*6fa6b5e2SAndroid Build Coastguard Worker // with no variant_id associated, using this property to tell if the 533*6fa6b5e2SAndroid Build Coastguard Worker // associated file group has a variant_id is unreliable. Instead, the 534*6fa6b5e2SAndroid Build Coastguard Worker // variant_id set within a DataFileGroup should be used as the source of truth 535*6fa6b5e2SAndroid Build Coastguard Worker // about the group (such as when logging). 536*6fa6b5e2SAndroid Build Coastguard Worker optional string variant_id = 6; 537*6fa6b5e2SAndroid Build Coastguard Worker 538*6fa6b5e2SAndroid Build Coastguard Worker reserved 3; 539*6fa6b5e2SAndroid Build Coastguard Worker} 540*6fa6b5e2SAndroid Build Coastguard Worker 541*6fa6b5e2SAndroid Build Coastguard Worker// Group Key properties that apply to all groups with that key. 542*6fa6b5e2SAndroid Build Coastguard Workermessage GroupKeyProperties { 543*6fa6b5e2SAndroid Build Coastguard Worker // Whether this group key has been activated on the device. 544*6fa6b5e2SAndroid Build Coastguard Worker optional bool activated_on_device = 1; 545*6fa6b5e2SAndroid Build Coastguard Worker} 546*6fa6b5e2SAndroid Build Coastguard Worker 547*6fa6b5e2SAndroid Build Coastguard Worker// SharedFile is a internal data structure of the SharedFileManager. 548*6fa6b5e2SAndroid Build Coastguard Workermessage SharedFile { 549*6fa6b5e2SAndroid Build Coastguard Worker optional string file_name = 4; 550*6fa6b5e2SAndroid Build Coastguard Worker optional FileStatus file_status = 5; 551*6fa6b5e2SAndroid Build Coastguard Worker 552*6fa6b5e2SAndroid Build Coastguard Worker // This field will be used to determine if a file can be retrieved from the 553*6fa6b5e2SAndroid Build Coastguard Worker // Android Blob Sharing Service. 554*6fa6b5e2SAndroid Build Coastguard Worker optional bool android_shared = 8; 555*6fa6b5e2SAndroid Build Coastguard Worker 556*6fa6b5e2SAndroid Build Coastguard Worker // The maximum expiration date found for a downloaded data file. If 557*6fa6b5e2SAndroid Build Coastguard Worker // {@code android_shared} is set to true, this field stores the current lease 558*6fa6b5e2SAndroid Build Coastguard Worker // expiration date. The default value is 0. 559*6fa6b5e2SAndroid Build Coastguard Worker // See <internal> for more details. 560*6fa6b5e2SAndroid Build Coastguard Worker optional int64 max_expiration_date_secs = 9; 561*6fa6b5e2SAndroid Build Coastguard Worker 562*6fa6b5e2SAndroid Build Coastguard Worker // Checksum used to access files through the Android Blob Sharing Service. 563*6fa6b5e2SAndroid Build Coastguard Worker optional string android_sharing_checksum = 10; 564*6fa6b5e2SAndroid Build Coastguard Worker 565*6fa6b5e2SAndroid Build Coastguard Worker // If the file is downloaded successfully but fails checksum matching, we will 566*6fa6b5e2SAndroid Build Coastguard Worker // attempt to delete the file so it can be redownloaded from scratch. To 567*6fa6b5e2SAndroid Build Coastguard Worker // prevent unnecessary network bandwidth, we keep track of the number of these 568*6fa6b5e2SAndroid Build Coastguard Worker // attempts in this field and stop after a certain number. (configurable by a 569*6fa6b5e2SAndroid Build Coastguard Worker // download flag). 570*6fa6b5e2SAndroid Build Coastguard Worker optional int32 checksum_mismatch_retry_download_count = 11; 571*6fa6b5e2SAndroid Build Coastguard Worker 572*6fa6b5e2SAndroid Build Coastguard Worker reserved 1, 2, 3, 6, 7; 573*6fa6b5e2SAndroid Build Coastguard Worker} 574*6fa6b5e2SAndroid Build Coastguard Worker 575*6fa6b5e2SAndroid Build Coastguard Worker// Metadata used by 576*6fa6b5e2SAndroid Build Coastguard Worker// com.google.android.libraries.mobiledatadownload.MobileDataDownloadManager 577*6fa6b5e2SAndroid Build Coastguard Workermessage MobileDataDownloadManagerMetadata { 578*6fa6b5e2SAndroid Build Coastguard Worker optional bool mdd_migrated_to_offroad = 1; 579*6fa6b5e2SAndroid Build Coastguard Worker optional int32 reset_trigger = 2; 580*6fa6b5e2SAndroid Build Coastguard Worker} 581*6fa6b5e2SAndroid Build Coastguard Worker 582*6fa6b5e2SAndroid Build Coastguard Worker// Metadata used by 583*6fa6b5e2SAndroid Build Coastguard Worker// com.google.android.libraries.mobiledatadownload.SharedFileManager 584*6fa6b5e2SAndroid Build Coastguard Workermessage SharedFileManagerMetadata { 585*6fa6b5e2SAndroid Build Coastguard Worker optional bool migrated_to_new_file_key = 1; 586*6fa6b5e2SAndroid Build Coastguard Worker optional int64 next_file_name = 2; 587*6fa6b5e2SAndroid Build Coastguard Worker} 588*6fa6b5e2SAndroid Build Coastguard Worker 589*6fa6b5e2SAndroid Build Coastguard Worker// Collects all data used by 590*6fa6b5e2SAndroid Build Coastguard Worker// com.google.android.libraries.mobiledatadownload.internal.Migrations 591*6fa6b5e2SAndroid Build Coastguard Workermessage MigrationsStore { 592*6fa6b5e2SAndroid Build Coastguard Worker enum FileKeyVersion { 593*6fa6b5e2SAndroid Build Coastguard Worker NEW_FILE_KEY = 0; 594*6fa6b5e2SAndroid Build Coastguard Worker ADD_DOWNLOAD_TRANSFORM = 1; 595*6fa6b5e2SAndroid Build Coastguard Worker USE_CHECKSUM_ONLY = 2; 596*6fa6b5e2SAndroid Build Coastguard Worker } 597*6fa6b5e2SAndroid Build Coastguard Worker optional bool is_migrated_to_new_file_key = 1; 598*6fa6b5e2SAndroid Build Coastguard Worker optional FileKeyVersion current_version = 2; 599*6fa6b5e2SAndroid Build Coastguard Worker} 600*6fa6b5e2SAndroid Build Coastguard Worker 601*6fa6b5e2SAndroid Build Coastguard Worker// Collects all data used by 602*6fa6b5e2SAndroid Build Coastguard Worker// com.google.android.libraries.mobiledatadownload.internal.FileGroupsMetadata 603*6fa6b5e2SAndroid Build Coastguard Workermessage FileGroupsMetadataStore { 604*6fa6b5e2SAndroid Build Coastguard Worker // Key must be a serialized GroupKey. 605*6fa6b5e2SAndroid Build Coastguard Worker map<string, DataFileGroupInternal> data_file_groups = 1; 606*6fa6b5e2SAndroid Build Coastguard Worker // Key must be a serialized GroupKey. 607*6fa6b5e2SAndroid Build Coastguard Worker map<string, GroupKeyProperties> group_key_properties = 2; 608*6fa6b5e2SAndroid Build Coastguard Worker repeated DataFileGroupInternal stale_groups = 3; 609*6fa6b5e2SAndroid Build Coastguard Worker} 610*6fa6b5e2SAndroid Build Coastguard Worker 611*6fa6b5e2SAndroid Build Coastguard Worker// Collects all data used by 612*6fa6b5e2SAndroid Build Coastguard Worker// com.google.android.libraries.mobiledatadownload.internal.SharedFilesMetadata 613*6fa6b5e2SAndroid Build Coastguard Workermessage SharedFilesMetadataStore { 614*6fa6b5e2SAndroid Build Coastguard Worker // The key must be a serialized NewFileKey. 615*6fa6b5e2SAndroid Build Coastguard Worker map<string, SharedFile> shared_files = 1; 616*6fa6b5e2SAndroid Build Coastguard Worker} 617*6fa6b5e2SAndroid Build Coastguard Worker 618*6fa6b5e2SAndroid Build Coastguard Workerenum FileStatus { 619*6fa6b5e2SAndroid Build Coastguard Worker // The file has never been seen before. 620*6fa6b5e2SAndroid Build Coastguard Worker NONE = 0; 621*6fa6b5e2SAndroid Build Coastguard Worker // The file has been subscribed to, but download has not been attempted. 622*6fa6b5e2SAndroid Build Coastguard Worker SUBSCRIBED = 1; 623*6fa6b5e2SAndroid Build Coastguard Worker // The file download is currently in progress. 624*6fa6b5e2SAndroid Build Coastguard Worker DOWNLOAD_IN_PROGRESS = 2; 625*6fa6b5e2SAndroid Build Coastguard Worker // Downloading the file failed. 626*6fa6b5e2SAndroid Build Coastguard Worker DOWNLOAD_FAILED = 3; 627*6fa6b5e2SAndroid Build Coastguard Worker // The file was downloaded completely, and is available for use. 628*6fa6b5e2SAndroid Build Coastguard Worker DOWNLOAD_COMPLETE = 4; 629*6fa6b5e2SAndroid Build Coastguard Worker // The file was corrupted or lost after being successfully downloaded. 630*6fa6b5e2SAndroid Build Coastguard Worker CORRUPTED = 6; 631*6fa6b5e2SAndroid Build Coastguard Worker // Status returned when their is an error while getting the file status. 632*6fa6b5e2SAndroid Build Coastguard Worker // This is never saved on disk. 633*6fa6b5e2SAndroid Build Coastguard Worker INTERNAL_ERROR = 5; 634*6fa6b5e2SAndroid Build Coastguard Worker} 635*6fa6b5e2SAndroid Build Coastguard Worker 636*6fa6b5e2SAndroid Build Coastguard Worker// Key used by the SharedFileManager to identify a shared file. 637*6fa6b5e2SAndroid Build Coastguard Workermessage NewFileKey { 638*6fa6b5e2SAndroid Build Coastguard Worker // These fields all mirror the similarly-named fields in DataFile. 639*6fa6b5e2SAndroid Build Coastguard Worker optional string url_to_download = 1 [deprecated = true]; 640*6fa6b5e2SAndroid Build Coastguard Worker optional int32 byte_size = 2 [deprecated = true]; 641*6fa6b5e2SAndroid Build Coastguard Worker optional string checksum = 3; 642*6fa6b5e2SAndroid Build Coastguard Worker optional DataFileGroupInternal.AllowedReaders allowed_readers = 4; 643*6fa6b5e2SAndroid Build Coastguard Worker optional mobstore.proto.Transforms download_transforms = 5 644*6fa6b5e2SAndroid Build Coastguard Worker [deprecated = true]; 645*6fa6b5e2SAndroid Build Coastguard Worker} 646*6fa6b5e2SAndroid Build Coastguard Worker 647*6fa6b5e2SAndroid Build Coastguard Worker// This proto is used to store state for logging. See details at 648*6fa6b5e2SAndroid Build Coastguard Worker// <internal> 649*6fa6b5e2SAndroid Build Coastguard Workermessage LoggingState { 650*6fa6b5e2SAndroid Build Coastguard Worker // The last time maintenance was run. This should be updated every time 651*6fa6b5e2SAndroid Build Coastguard Worker // maintenance is run. 652*6fa6b5e2SAndroid Build Coastguard Worker // Note: the current implementation only uses this to determine the date of 653*6fa6b5e2SAndroid Build Coastguard Worker // the last log event, but in the future we may want more granular 654*6fa6b5e2SAndroid Build Coastguard Worker // measurements for this, so we store the timestamp as-is. 655*6fa6b5e2SAndroid Build Coastguard Worker optional google.protobuf.Timestamp last_maintenance_run_timestamp = 1; 656*6fa6b5e2SAndroid Build Coastguard Worker 657*6fa6b5e2SAndroid Build Coastguard Worker // File group specific logging state keyed by GroupKey, build id and version 658*6fa6b5e2SAndroid Build Coastguard Worker // number. 659*6fa6b5e2SAndroid Build Coastguard Worker repeated FileGroupLoggingState file_group_logging_state = 2; 660*6fa6b5e2SAndroid Build Coastguard Worker 661*6fa6b5e2SAndroid Build Coastguard Worker // Set to true once the shared preferences migration is complete. 662*6fa6b5e2SAndroid Build Coastguard Worker // Note: this field isn't strictly necessary at the moment - we could just 663*6fa6b5e2SAndroid Build Coastguard Worker // check that the file_group_logging_state is empty since no one should write 664*6fa6b5e2SAndroid Build Coastguard Worker // to the network usage monitor shared prefs since the migration will be 665*6fa6b5e2SAndroid Build Coastguard Worker // installed at the same cl where the code is removed. However, if we were to 666*6fa6b5e2SAndroid Build Coastguard Worker // add more fields to FileGroupLoggingState, it would be less straightforward 667*6fa6b5e2SAndroid Build Coastguard Worker // to check for migration state - so having this boolean makes it a bit safer. 668*6fa6b5e2SAndroid Build Coastguard Worker optional bool shared_preferences_network_usage_monitor_migration_complete = 3; 669*6fa6b5e2SAndroid Build Coastguard Worker 670*6fa6b5e2SAndroid Build Coastguard Worker // Info to enable stable sampling. See <internal> for more 671*6fa6b5e2SAndroid Build Coastguard Worker // info. This field will be set by a migration on first access. 672*6fa6b5e2SAndroid Build Coastguard Worker optional SamplingInfo sampling_info = 4; 673*6fa6b5e2SAndroid Build Coastguard Worker} 674*6fa6b5e2SAndroid Build Coastguard Worker 675*6fa6b5e2SAndroid Build Coastguard Worker// This proto is used to store state for logging that is specific to a File 676*6fa6b5e2SAndroid Build Coastguard Worker// Group. This includes network usage logging and maybe download tiers (for 677*6fa6b5e2SAndroid Build Coastguard Worker// <internal>). 678*6fa6b5e2SAndroid Build Coastguard Worker// 679*6fa6b5e2SAndroid Build Coastguard Worker// NEXT TAG: 7 680*6fa6b5e2SAndroid Build Coastguard Workermessage FileGroupLoggingState { 681*6fa6b5e2SAndroid Build Coastguard Worker // GroupKey associated with a file group -- this is used to populate the group 682*6fa6b5e2SAndroid Build Coastguard Worker // name and host package name. 683*6fa6b5e2SAndroid Build Coastguard Worker optional GroupKey group_key = 1; 684*6fa6b5e2SAndroid Build Coastguard Worker 685*6fa6b5e2SAndroid Build Coastguard Worker // The build_id associated with the file group. 686*6fa6b5e2SAndroid Build Coastguard Worker optional int64 build_id = 2; 687*6fa6b5e2SAndroid Build Coastguard Worker 688*6fa6b5e2SAndroid Build Coastguard Worker // The variant_id associated with the file group. 689*6fa6b5e2SAndroid Build Coastguard Worker optional string variant_id = 6; 690*6fa6b5e2SAndroid Build Coastguard Worker 691*6fa6b5e2SAndroid Build Coastguard Worker // The file group version number associated with the file group. 692*6fa6b5e2SAndroid Build Coastguard Worker optional int32 file_group_version_number = 3; 693*6fa6b5e2SAndroid Build Coastguard Worker 694*6fa6b5e2SAndroid Build Coastguard Worker // The number of bytes downloaded over a cellular (metered) network. 695*6fa6b5e2SAndroid Build Coastguard Worker optional int64 cellular_usage = 4; 696*6fa6b5e2SAndroid Build Coastguard Worker 697*6fa6b5e2SAndroid Build Coastguard Worker // The number of bytes downloaded over a wifi (unmetered) network. 698*6fa6b5e2SAndroid Build Coastguard Worker optional int64 wifi_usage = 5; 699*6fa6b5e2SAndroid Build Coastguard Worker} 700*6fa6b5e2SAndroid Build Coastguard Worker 701*6fa6b5e2SAndroid Build Coastguard Worker// Next id: 3 702*6fa6b5e2SAndroid Build Coastguard Workermessage SamplingInfo { 703*6fa6b5e2SAndroid Build Coastguard Worker // Random number generated and persisted on device. This number should not 704*6fa6b5e2SAndroid Build Coastguard Worker // change (unless device storage/mdd is cleared). It is used as a stable 705*6fa6b5e2SAndroid Build Coastguard Worker // identifier to determine whether MDD should log events. 706*6fa6b5e2SAndroid Build Coastguard Worker optional int64 stable_log_sampling_salt = 1; 707*6fa6b5e2SAndroid Build Coastguard Worker 708*6fa6b5e2SAndroid Build Coastguard Worker // When the stable_log_sampling_salt was first set. This will be used during 709*6fa6b5e2SAndroid Build Coastguard Worker // roll out to determine which devices have enabled stable sampling for a 710*6fa6b5e2SAndroid Build Coastguard Worker // sufficient time period. 711*6fa6b5e2SAndroid Build Coastguard Worker optional google.protobuf.Timestamp log_sampling_salt_set_timestamp = 2; 712*6fa6b5e2SAndroid Build Coastguard Worker} 713