From b372f5062b5d02db7e364d65bed321d92473c323 Mon Sep 17 00:00:00 2001 From: Rubin Xu Date: Mon, 21 Jun 2021 10:08:07 +0000 Subject: [PATCH] Revert "More debug for security loggin broadcast" This reverts commit 25f228087f4ba1411de7064b8b3462663a59c314. Reason for revert: was temporary logging to investigate 185004808 and caused 191563556 Bug: 191563556 Change-Id: I0939a8e95f096c03fa157354630a9cba1edb59a9 --- .../devicepolicy/DevicePolicyManagerService.java | 2 -- .../server/devicepolicy/SecurityLogMonitor.java | 11 ++--------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index c374f84781ddd..fa24e5238820e 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -8027,8 +8027,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { inForeground = true; receiverComponent = resolveDelegateReceiver( DELEGATION_SECURITY_LOGGING, action, userId); - // STOPSHIP(b/185004808): remove excessive log. - Slogf.d(LOG_TAG, "Delegate for security logs broadcast: " + receiverComponent); } if (receiverComponent == null) { receiverComponent = getOwnerComponent(userId); diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/SecurityLogMonitor.java b/services/devicepolicy/java/com/android/server/devicepolicy/SecurityLogMonitor.java index 0741c81bb528b..c29de905d3701 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/SecurityLogMonitor.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/SecurityLogMonitor.java @@ -64,7 +64,7 @@ class SecurityLogMonitor implements Runnable { mLastForceNanos = System.nanoTime(); } - private static final boolean DEBUG = true; // STOPSHIP if true. + private static final boolean DEBUG = false; // STOPSHIP if true. private static final String TAG = "SecurityLogMonitor"; /** * Each log entry can hold up to 4K bytes (but as of {@link android.os.Build.VERSION_CODES#N} @@ -427,7 +427,7 @@ class SecurityLogMonitor implements Runnable { while (!Thread.currentThread().isInterrupted()) { try { final boolean force = mForceSemaphore.tryAcquire(POLLING_INTERVAL_MS, MILLISECONDS); - if (DEBUG) Slog.d(TAG, "Retrieving next batch, force=" + force); + getNextBatch(newLogs); mLock.lockInterruptibly(); @@ -469,11 +469,6 @@ class SecurityLogMonitor implements Runnable { return; } final int logSize = mPendingLogs.size(); - if (DEBUG) { - Slog.d(TAG, String.format( - "notifyDeviceOwnerOrProfileOwnerIfNeeded, size: %d now: %d next: %d", - logSize, SystemClock.elapsedRealtime(), mNextAllowedRetrievalTimeMillis)); - } if (logSize >= BUFFER_ENTRIES_NOTIFICATION_LEVEL || (force && logSize > 0)) { // Allow DO to retrieve logs if too many pending logs or if forced. if (!mAllowedToRetrieve) { @@ -512,7 +507,6 @@ class SecurityLogMonitor implements Runnable { synchronized (mForceSemaphore) { final long toWaitNanos = mLastForceNanos + FORCE_FETCH_THROTTLE_NS - nowNanos; if (toWaitNanos > 0) { - if (DEBUG) Slog.d(TAG, "Forcing security logs throttled"); return NANOSECONDS.toMillis(toWaitNanos) + 1; // Round up. } mLastForceNanos = nowNanos; @@ -521,7 +515,6 @@ class SecurityLogMonitor implements Runnable { if (mForceSemaphore.availablePermits() == 0) { mForceSemaphore.release(); } - if (DEBUG) Slog.d(TAG, "Forcing security logs semaphore released"); return 0; } }