Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c0036c7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Revert "More debug for security loggin broadcast"" into sc-dev am: 9ce47a5a am: 16091172

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15028974

Change-Id: I7bd35a2c92f610df478215b40fa114900a48bc49
parents 23f427c2 16091172
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -8030,8 +8030,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
            inForeground = true;
            inForeground = true;
            receiverComponent = resolveDelegateReceiver(
            receiverComponent = resolveDelegateReceiver(
                DELEGATION_SECURITY_LOGGING, action, userId);
                DELEGATION_SECURITY_LOGGING, action, userId);
            // STOPSHIP(b/185004808): remove excessive log.
            Slogf.d(LOG_TAG, "Delegate for security logs broadcast: " + receiverComponent);
        }
        }
        if (receiverComponent == null) {
        if (receiverComponent == null) {
            receiverComponent = getOwnerComponent(userId);
            receiverComponent = getOwnerComponent(userId);
+2 −9
Original line number Original line Diff line number Diff line
@@ -64,7 +64,7 @@ class SecurityLogMonitor implements Runnable {
        mLastForceNanos = System.nanoTime();
        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";
    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}
     * 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()) {
        while (!Thread.currentThread().isInterrupted()) {
            try {
            try {
                final boolean force = mForceSemaphore.tryAcquire(POLLING_INTERVAL_MS, MILLISECONDS);
                final boolean force = mForceSemaphore.tryAcquire(POLLING_INTERVAL_MS, MILLISECONDS);
                if (DEBUG) Slog.d(TAG, "Retrieving next batch, force=" + force);

                getNextBatch(newLogs);
                getNextBatch(newLogs);


                mLock.lockInterruptibly();
                mLock.lockInterruptibly();
@@ -469,11 +469,6 @@ class SecurityLogMonitor implements Runnable {
                return;
                return;
            }
            }
            final int logSize = mPendingLogs.size();
            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)) {
            if (logSize >= BUFFER_ENTRIES_NOTIFICATION_LEVEL || (force && logSize > 0)) {
                // Allow DO to retrieve logs if too many pending logs or if forced.
                // Allow DO to retrieve logs if too many pending logs or if forced.
                if (!mAllowedToRetrieve) {
                if (!mAllowedToRetrieve) {
@@ -512,7 +507,6 @@ class SecurityLogMonitor implements Runnable {
        synchronized (mForceSemaphore) {
        synchronized (mForceSemaphore) {
            final long toWaitNanos = mLastForceNanos + FORCE_FETCH_THROTTLE_NS - nowNanos;
            final long toWaitNanos = mLastForceNanos + FORCE_FETCH_THROTTLE_NS - nowNanos;
            if (toWaitNanos > 0) {
            if (toWaitNanos > 0) {
                if (DEBUG) Slog.d(TAG, "Forcing security logs throttled");
                return NANOSECONDS.toMillis(toWaitNanos) + 1; // Round up.
                return NANOSECONDS.toMillis(toWaitNanos) + 1; // Round up.
            }
            }
            mLastForceNanos = nowNanos;
            mLastForceNanos = nowNanos;
@@ -521,7 +515,6 @@ class SecurityLogMonitor implements Runnable {
            if (mForceSemaphore.availablePermits() == 0) {
            if (mForceSemaphore.availablePermits() == 0) {
                mForceSemaphore.release();
                mForceSemaphore.release();
            }
            }
            if (DEBUG) Slog.d(TAG, "Forcing security logs semaphore released");
            return 0;
            return 0;
        }
        }
    }
    }