Skip to content
Snippets Groups Projects
Commit 9260d804 authored by Ahmad Khalil's avatar Ahmad Khalil Committed by Automerger Merge Worker
Browse files

Merge "VibrationSettings: add synchronized control for access of...

Merge "VibrationSettings: add synchronized control for access of mProcStatesCache" into main am: 266f845d am: 190201f6 am: ed9c88c9

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



Change-Id: I7c22df9fcc57f0a98b9feb80c3ccda912a2687ee
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 47ec040a ed9c88c9
No related branches found
No related tags found
No related merge requests found
......@@ -833,18 +833,24 @@ final class VibrationSettings {
private final SparseArray<Integer> mProcStatesCache = new SparseArray<>();
public boolean isUidForeground(int uid) {
return mProcStatesCache.get(uid, ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND)
<= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND;
synchronized (this) {
return mProcStatesCache.get(uid, ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND)
<= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND;
}
}
@Override
public void onUidGone(int uid, boolean disabled) {
mProcStatesCache.delete(uid);
synchronized (this) {
mProcStatesCache.delete(uid);
}
}
@Override
public void onUidStateChanged(int uid, int procState, long procStateSeq, int capability) {
mProcStatesCache.put(uid, procState);
synchronized (this) {
mProcStatesCache.put(uid, procState);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment