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.logger; 17 18 import com.google.android.libraries.mobiledatadownload.Flags; 19 import com.google.android.libraries.mobiledatadownload.Logger; 20 import com.google.android.libraries.mobiledatadownload.internal.logging.LogUtil; 21 import com.google.mobiledatadownload.LogEnumsProto.MddDownloadResult; 22 23 /** The event logger for {@code FileGroupPopulator}'s. */ 24 public final class FileGroupPopulatorLogger { 25 26 private final Logger logger; 27 private final Flags flags; 28 FileGroupPopulatorLogger(Logger logger, Flags flags)29 public FileGroupPopulatorLogger(Logger logger, Flags flags) { 30 this.logger = logger; 31 this.flags = flags; 32 } 33 34 /** Logs the refresh result of {@code ManifestFileGroupPopulator}. */ logManifestFileGroupPopulatorRefreshResult( MddDownloadResult.Code code, String manifestId, String ownerPackageName, String manifestFileUrl)35 public void logManifestFileGroupPopulatorRefreshResult( 36 MddDownloadResult.Code code, 37 String manifestId, 38 String ownerPackageName, 39 String manifestFileUrl) { 40 int sampleInterval = flags.mddDefaultSampleInterval(); 41 if (!LogUtil.shouldSampleInterval(sampleInterval)) { 42 return; 43 } 44 } 45 46 /** Logs the refresh result of {@code GellerFileGroupPopulator}. */ logGddFileGroupPopulatorRefreshResult( MddDownloadResult.Code code, String configurationId, String ownerPackageName, String corpus)47 public void logGddFileGroupPopulatorRefreshResult( 48 MddDownloadResult.Code code, String configurationId, String ownerPackageName, String corpus) { 49 int sampleInterval = flags.mddDefaultSampleInterval(); 50 if (!LogUtil.shouldSampleInterval(sampleInterval)) { 51 return; 52 } 53 } 54 } 55