Remove getLeash from WindowContainerToken

If the WindowContainer was revoked from a registered organizer, the
client could still call getLeash to system server and control the leash
for the WindowContainer. Instead, pass the leash back to the client in
onTaskAppeared and onDisplayAreaAppeared. Once the WindowContainer is
revoked from the client, the leash will reference the old
WindowContainer SurfaceControl and will not be able to control the
WindowContainer anymore.

Test: Split screen
Test: DisplayAreaOrganizerTest
Test: WindowOrganizerTest
Bug: 154558563
Change-Id: I1f6eb987a2a3fecfef912a3009ee52989c85ff4b
diff --git a/core/java/android/window/DisplayAreaOrganizer.java b/core/java/android/window/DisplayAreaOrganizer.java
index f3ef5a0..a2fd128 100644
--- a/core/java/android/window/DisplayAreaOrganizer.java
+++ b/core/java/android/window/DisplayAreaOrganizer.java
@@ -21,6 +21,7 @@
 import android.annotation.TestApi;
 import android.os.RemoteException;
 import android.util.Singleton;
+import android.view.SurfaceControl;
 
 /**
  * Interface for WindowManager to delegate control of display areas.
@@ -64,7 +65,8 @@
         }
     }
 
-    public void onDisplayAreaAppeared(@NonNull DisplayAreaInfo displayAreaInfo) {}
+    public void onDisplayAreaAppeared(@NonNull DisplayAreaInfo displayAreaInfo,
+            @NonNull SurfaceControl leash) {}
 
     public void onDisplayAreaVanished(@NonNull DisplayAreaInfo displayAreaInfo) {}
 
@@ -76,8 +78,9 @@
     private final IDisplayAreaOrganizer mInterface = new IDisplayAreaOrganizer.Stub() {
 
         @Override
-        public void onDisplayAreaAppeared(@NonNull DisplayAreaInfo displayAreaInfo) {
-            DisplayAreaOrganizer.this.onDisplayAreaAppeared(displayAreaInfo);
+        public void onDisplayAreaAppeared(@NonNull DisplayAreaInfo displayAreaInfo,
+                @NonNull SurfaceControl leash) {
+            DisplayAreaOrganizer.this.onDisplayAreaAppeared(displayAreaInfo, leash);
         }
 
         @Override