Killing the client process only if the uid matches

If the client process was killed by lmkd or other,
and its pid rescued by any process. Then it may be
killed by mistaken.

Bug: 312576121

Change-Id: I577372953c5f9090d11dbf9ca5bd67e1f5dd9408
Signed-off-by: liulvping <liulvping@xiaomi.com>
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 0469961..afd2c50 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -3489,7 +3489,9 @@
             // just kill it. And if it is a window of foreground activity, the activity can be
             // restarted automatically if needed.
             Slog.w(TAG, "Exception thrown during dispatchAppVisibility " + this, e);
-            android.os.Process.killProcess(mSession.mPid);
+            if (android.os.Process.getUidForPid(mSession.mPid) == mSession.mUid) {
+                android.os.Process.killProcess(mSession.mPid);
+            }
         }
     }