Merge "Add the ability to reset dropbox rate limiter with a shell command." am: 1a0d812cd8 am: 7f94f53ee2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2201637 Change-Id: I84c4c212bd5e804193d4ce3d86b1bd7e08a1c174 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -17793,6 +17793,13 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
mCoreSettingsObserver.onChange(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the dropbox rate limiter
|
||||
*/
|
||||
void resetDropboxRateLimiter() {
|
||||
mDropboxRateLimiter.reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Kill processes for the user with id userId and that depend on the package named packageName
|
||||
*/
|
||||
|
||||
@@ -350,6 +350,8 @@ final class ActivityManagerShellCommand extends ShellCommand {
|
||||
return runSetBgAbusiveUids(pw);
|
||||
case "list-bg-exemptions-config":
|
||||
return runListBgExemptionsConfig(pw);
|
||||
case "reset-dropbox-rate-limiter":
|
||||
return runResetDropboxRateLimiter();
|
||||
default:
|
||||
return handleDefaultCommands(cmd);
|
||||
}
|
||||
@@ -3374,6 +3376,11 @@ final class ActivityManagerShellCommand extends ShellCommand {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int runResetDropboxRateLimiter() throws RemoteException {
|
||||
mInternal.resetDropboxRateLimiter();
|
||||
return 0;
|
||||
}
|
||||
|
||||
private Resources getResources(PrintWriter pw) throws RemoteException {
|
||||
// system resources does not contain all the device configuration, construct it manually.
|
||||
Configuration config = mInterface.getConfiguration();
|
||||
|
||||
@@ -19,11 +19,13 @@ package com.android.server.am;
|
||||
import android.os.SystemClock;
|
||||
import android.text.format.DateUtils;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
|
||||
/** Rate limiter for adding errors into dropbox. */
|
||||
public class DropboxRateLimiter {
|
||||
private static final String TAG = "DropboxRateLimiter";
|
||||
// After RATE_LIMIT_ALLOWED_ENTRIES have been collected (for a single breakdown of
|
||||
// process/eventType) further entries will be rejected until RATE_LIMIT_BUFFER_DURATION has
|
||||
// elapsed, after which the current count for this breakdown will be reset.
|
||||
@@ -105,6 +107,15 @@ public class DropboxRateLimiter {
|
||||
mLastMapCleanUp = now;
|
||||
}
|
||||
|
||||
/** Resets the rate limiter memory. */
|
||||
void reset() {
|
||||
synchronized (mErrorClusterRecords) {
|
||||
mErrorClusterRecords.clear();
|
||||
}
|
||||
mLastMapCleanUp = 0L;
|
||||
Slog.i(TAG, "Rate limiter reset.");
|
||||
}
|
||||
|
||||
String errorKey(String eventType, String processName) {
|
||||
return eventType + processName;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user