Enable process state change logs, when they result in uid state changes

When we receive a new process state, log in the dumpsys the process
state, if the state results in a new capability or uid state

Test: build
Bug: 270555157
Change-Id: I12fca8533005099d0f21a3fca95b825217ca0722
This commit is contained in:
Nate Myren
2023-03-02 14:17:28 -08:00
parent 2e528630e8
commit 9d33835c31

View File

@@ -213,8 +213,6 @@ class AppOpsUidStateTrackerImpl implements AppOpsUidStateTracker {
@Override
public void updateUidProcState(int uid, int procState, int capability) {
mEventLog.logUpdateUidProcState(uid, procState, capability);
int uidState = processStateToUidState(procState);
int prevUidState = mUidStates.get(uid, AppOpsManager.MIN_PRIORITY_UID_STATE);
@@ -226,6 +224,10 @@ class AppOpsUidStateTrackerImpl implements AppOpsUidStateTracker {
&& (uidState != prevUidState || capability != prevCapability))
|| (pendingStateCommitTime != 0
&& (uidState != pendingUidState || capability != pendingCapability))) {
// If this process update results in a capability or uid state change, log it. It's
// not interesting otherwise.
mEventLog.logUpdateUidProcState(uid, procState, capability);
mPendingUidStates.put(uid, uidState);
mPendingCapability.put(uid, capability);
@@ -386,10 +388,8 @@ class AppOpsUidStateTrackerImpl implements AppOpsUidStateTracker {
private static class EventLog {
// These seems a bit too verbose and not as useful, turning off for now.
// DCE should be able to remove most associated code.
// Memory usage: 16 * size bytes
private static final int UPDATE_UID_PROC_STATE_LOG_MAX_SIZE = 0;
private static final int UPDATE_UID_PROC_STATE_LOG_MAX_SIZE = 200;
// Memory usage: 20 * size bytes
private static final int COMMIT_UID_STATE_LOG_MAX_SIZE = 200;
// Memory usage: 24 * size bytes