Removes user states in AttentionManagerService.

Bug: 137567755
Test: manual tests
Change-Id: I7ca7f2025172ddbf93a8f41c6123512ca0180b8f
This commit is contained in:
Yi Jiang
2019-10-24 15:13:15 -07:00
parent cabc32d247
commit 0f0431ec53

View File

@@ -23,7 +23,6 @@ import static android.service.attention.AttentionService.ATTENTION_FAILURE_UNKNO
import android.Manifest;
import android.annotation.Nullable;
import android.annotation.UserIdInt;
import android.app.ActivityManager;
import android.attention.AttentionManagerInternal;
import android.attention.AttentionManagerInternal.AttentionCallbackInternal;
import android.content.BroadcastReceiver;
@@ -300,7 +299,8 @@ public class AttentionManagerService extends SystemService {
@GuardedBy("mLock")
@VisibleForTesting
protected UserState getOrCreateCurrentUserStateLocked() {
return getOrCreateUserStateLocked(ActivityManager.getCurrentUser());
// Doesn't need to cache the states of different users.
return getOrCreateUserStateLocked(0);
}
@GuardedBy("mLock")
@@ -318,7 +318,8 @@ public class AttentionManagerService extends SystemService {
@Nullable
@VisibleForTesting
protected UserState peekCurrentUserStateLocked() {
return peekUserStateLocked(ActivityManager.getCurrentUser());
// Doesn't need to cache the states of different users.
return peekUserStateLocked(0);
}
@GuardedBy("mLock")