Merge "Reduce the visibility of logging to statsd to package-private" into main
This commit is contained in:
commit
8ce8574207
4 changed files with 50 additions and 23 deletions
|
|
@ -313,7 +313,6 @@ class CertificateTransparencyDownloader extends BroadcastReceiver {
|
|||
status.reason());
|
||||
} else {
|
||||
// TODO(b/384935059): handle blocked domain logging
|
||||
// TODO(b/384936292): add additionalchecks for pending wifi status
|
||||
mLogger.logCTLogListUpdateFailedEvent(
|
||||
downloadStatusToFailureReason(status.reason()), failureCount);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,12 +16,8 @@
|
|||
|
||||
package com.android.server.net.ct;
|
||||
|
||||
import static com.android.server.net.ct.CertificateTransparencyStatsLog.CERTIFICATE_TRANSPARENCY_LOG_LIST_UPDATE_FAILED;
|
||||
|
||||
/** Helper class to interface with logging to statsd. */
|
||||
public class CertificateTransparencyLogger {
|
||||
|
||||
public CertificateTransparencyLogger() {}
|
||||
/** Interface with logging to statsd for Certificate Transparency. */
|
||||
public interface CertificateTransparencyLogger {
|
||||
|
||||
/**
|
||||
* Logs a CTLogListUpdateFailed event to statsd, when no HTTP error status code is present.
|
||||
|
|
@ -29,9 +25,7 @@ public class CertificateTransparencyLogger {
|
|||
* @param failureReason reason why the log list wasn't updated (e.g. DownloadManager failures)
|
||||
* @param failureCount number of consecutive log list update failures
|
||||
*/
|
||||
public void logCTLogListUpdateFailedEvent(int failureReason, int failureCount) {
|
||||
logCTLogListUpdateFailedEvent(failureReason, failureCount, /* httpErrorStatusCode= */ 0);
|
||||
}
|
||||
void logCTLogListUpdateFailedEvent(int failureReason, int failureCount);
|
||||
|
||||
/**
|
||||
* Logs a CTLogListUpdateFailed event to statsd, when an HTTP error status code is provided.
|
||||
|
|
@ -40,13 +34,7 @@ public class CertificateTransparencyLogger {
|
|||
* @param failureCount number of consecutive log list update failures
|
||||
* @param httpErrorStatusCode if relevant, the HTTP error status code from DownloadManager
|
||||
*/
|
||||
public void logCTLogListUpdateFailedEvent(
|
||||
int failureReason, int failureCount, int httpErrorStatusCode) {
|
||||
CertificateTransparencyStatsLog.write(
|
||||
CERTIFICATE_TRANSPARENCY_LOG_LIST_UPDATE_FAILED,
|
||||
failureReason,
|
||||
failureCount,
|
||||
httpErrorStatusCode
|
||||
);
|
||||
}
|
||||
}
|
||||
void logCTLogListUpdateFailedEvent(
|
||||
int failureReason, int failureCount, int httpErrorStatusCode);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (C) 2024 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.server.net.ct;
|
||||
|
||||
import static com.android.server.net.ct.CertificateTransparencyStatsLog.CERTIFICATE_TRANSPARENCY_LOG_LIST_UPDATE_FAILED;
|
||||
|
||||
/** Implementation for logging to statsd for Certificate Transparency. */
|
||||
class CertificateTransparencyLoggerImpl implements CertificateTransparencyLogger {
|
||||
|
||||
@Override
|
||||
public void logCTLogListUpdateFailedEvent(int failureReason, int failureCount) {
|
||||
logCTLogListUpdateFailedEvent(failureReason, failureCount, /* httpErrorStatusCode= */ 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logCTLogListUpdateFailedEvent(
|
||||
int failureReason, int failureCount, int httpErrorStatusCode) {
|
||||
CertificateTransparencyStatsLog.write(
|
||||
CERTIFICATE_TRANSPARENCY_LOG_LIST_UPDATE_FAILED,
|
||||
failureReason,
|
||||
failureCount,
|
||||
httpErrorStatusCode
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,18 +18,18 @@ package com.android.server.net.ct;
|
|||
|
||||
import static android.security.Flags.certificateTransparencyConfiguration;
|
||||
|
||||
import static com.android.net.ct.flags.Flags.certificateTransparencyJob;
|
||||
import static com.android.net.ct.flags.Flags.certificateTransparencyService;
|
||||
|
||||
import android.annotation.RequiresApi;
|
||||
import android.content.Context;
|
||||
import android.net.ct.ICertificateTransparencyManager;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.provider.DeviceConfig;
|
||||
import android.provider.DeviceConfig.Properties;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.server.SystemService;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/** Implementation of the Certificate Transparency service. */
|
||||
|
|
@ -62,7 +62,7 @@ public class CertificateTransparencyService extends ICertificateTransparencyMana
|
|||
downloadHelper,
|
||||
signatureVerifier,
|
||||
new CertificateTransparencyInstaller(),
|
||||
new CertificateTransparencyLogger());
|
||||
new CertificateTransparencyLoggerImpl());
|
||||
mCertificateTransparencyJob =
|
||||
new CertificateTransparencyJob(context, dataStore, downloader);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue