summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Riddle Hsu <riddlehsu@google.com> 2024-02-22 06:58:08 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-02-22 06:58:08 +0000
commit19bdc8dad5eda4913ae06b51a0344640fe1ca254 (patch)
treeabff09f269f8c4767dc9c5e1a66a09cb24d56b68
parent05ef6674c54770e88b815d9e57b80bf599158278 (diff)
parentdfdc6aa708249e1f7412f8ea4303943f69ba46b8 (diff)
Merge "Reduce unnecessary process lookup by pid" into main
-rw-r--r--services/core/java/com/android/server/wm/ActivityTaskManagerService.java15
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java7
2 files changed, 6 insertions, 16 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index eb618ef13f6c..24c228e88c1c 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -1137,22 +1137,13 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
* Return the global configuration used by the process corresponding to the input pid. This is
* usually the global configuration with some overrides specific to that process.
*/
- Configuration getGlobalConfigurationForCallingPid() {
+ private Configuration getGlobalConfigurationForCallingPid() {
final int pid = Binder.getCallingPid();
- return getGlobalConfigurationForPid(pid);
- }
-
- /**
- * Return the global configuration used by the process corresponding to the given pid.
- */
- Configuration getGlobalConfigurationForPid(int pid) {
if (pid == MY_PID || pid < 0) {
return getGlobalConfiguration();
}
- synchronized (mGlobalLock) {
- final WindowProcessController app = mProcessMap.getProcess(pid);
- return app != null ? app.getConfiguration() : getGlobalConfiguration();
- }
+ final WindowProcessController app = mProcessMap.getProcess(pid);
+ return app != null ? app.getConfiguration() : getGlobalConfiguration();
}
/**
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 0e1641a0edbd..90f5b62b4a08 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -2838,10 +2838,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
// For child windows we want to use the pid for the parent window in case the the child
// window was added from another process.
final WindowState parentWindow = getParentWindow();
- final int pid = parentWindow != null ? parentWindow.mSession.mPid : mSession.mPid;
- final Configuration processConfig =
- mWmService.mAtmService.getGlobalConfigurationForPid(pid);
- return processConfig;
+ final Session session = parentWindow != null ? parentWindow.mSession : mSession;
+ return session.mPid == MY_PID ? mWmService.mRoot.getConfiguration()
+ : session.mProcess.getConfiguration();
}
private Configuration getLastReportedConfiguration() {