Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19bdc8da authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Reduce unnecessary process lookup by pid" into main

parents 05ef6674 dfdc6aa7
Loading
Loading
Loading
Loading
+3 −12
Original line number Diff line number Diff line
@@ -1137,23 +1137,14 @@ 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();
    }
    }

    /**
     * Return the device configuration info used by the process corresponding to the input pid.
+3 −4
Original line number Diff line number Diff line
@@ -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() {