diff options
| author | 2024-11-01 22:36:29 +0000 | |
|---|---|---|
| committer | 2024-11-01 23:20:53 +0000 | |
| commit | 5a07caa8cd5b4c2f24cd9099c4bf27e33d5592df (patch) | |
| tree | 7570a70b5000d040dc766b52d33645b5fbf07ae7 | |
| parent | b142103e050e3cb70d7a328fdc82154af6263253 (diff) | |
Use UserHandle.isCore() instead of Process.myUid() < Process.FIRST_APPLICATION_UID to determine if the process is a system process.
This is more robust and will work even if the process is running in a multi-user context.
Change-Id: Idf1d0db3236085702bafb6d48758dd209d06e4f5
Flag: build.RELEASE_PACKAGE_MESSAGEQUEUE_IMPLEMENTATION
| -rw-r--r-- | core/java/android/os/CombinedMessageQueue/MessageQueue.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/java/android/os/CombinedMessageQueue/MessageQueue.java b/core/java/android/os/CombinedMessageQueue/MessageQueue.java index 081ae6933544..66f4198ad31c 100644 --- a/core/java/android/os/CombinedMessageQueue/MessageQueue.java +++ b/core/java/android/os/CombinedMessageQueue/MessageQueue.java @@ -21,6 +21,7 @@ import android.annotation.NonNull; import android.annotation.TestApi; import android.compat.annotation.UnsupportedAppUsage; import android.os.Process; +import android.os.UserHandle; import android.ravenwood.annotation.RavenwoodKeepWholeClass; import android.ravenwood.annotation.RavenwoodRedirect; import android.ravenwood.annotation.RavenwoodRedirectionClass; @@ -112,7 +113,7 @@ public final class MessageQueue { MessageQueue(boolean quitAllowed) { if (!sUseConcurrentInitialized) { - sUseConcurrent = Process.myUid() < Process.FIRST_APPLICATION_UID; + sUseConcurrent = UserHandle.isCore(Process.myUid()); sUseConcurrentInitialized = true; } mQuitAllowed = quitAllowed; |