From 9bc47736362d03b3f099bf018255571457403c1f Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Wed, 10 Aug 2016 14:44:22 -0700 Subject: [PATCH] Removed child windows from WindowToken window list With the window container hierarchy model, containers should only link to their direct children and delegate any operation on decendants of their children to their children. Bug: 30060889 Change-Id: I99ca0d181d54cfe75bbe24c1b0daaa06cf7cfd9a --- .../server/am/ActivityStackSupervisor.java | 4 +- .../com/android/server/wm/AppWindowToken.java | 449 +++-------- .../java/com/android/server/wm/Session.java | 2 +- .../core/java/com/android/server/wm/Task.java | 15 +- .../android/server/wm/WindowContainer.java | 5 + .../server/wm/WindowManagerService.java | 51 +- .../com/android/server/wm/WindowState.java | 706 +++++++++++++++++- .../server/wm/WindowStateAnimator.java | 3 +- .../server/wm/WindowSurfacePlacer.java | 2 +- .../com/android/server/wm/WindowToken.java | 110 +-- 10 files changed, 854 insertions(+), 493 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index 0a47e4068d4dc..8e0fcc187af68 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -2464,7 +2464,7 @@ public final class ActivityStackSupervisor implements DisplayListener { // entrance of the new window to be properly animated. // Note here we always set the replacing window first, as the flags might be needed // during the relaunch. If we end up not doing any relaunch, we clear the flags later. - mWindowManager.setReplacingWindow(topActivity.appToken, animate); + mWindowManager.setWillReplaceWindow(topActivity.appToken, animate); } mWindowManager.deferSurfaceLayout(); @@ -2506,7 +2506,7 @@ public final class ActivityStackSupervisor implements DisplayListener { // If we didn't actual do a relaunch (indicated by kept==true meaning we kept the old // window), we need to clear the replace window settings. Otherwise, we schedule a // timeout to remove the old window if the replacing window is not coming in time. - mWindowManager.scheduleClearReplacingWindowIfNeeded(topActivity.appToken, !kept); + mWindowManager.scheduleClearWillReplaceWindows(topActivity.appToken, !kept); } if (!deferResume) { diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java index df212bcacc1a6..66fa976433ba4 100644 --- a/services/core/java/com/android/server/wm/AppWindowToken.java +++ b/services/core/java/com/android/server/wm/AppWindowToken.java @@ -20,15 +20,11 @@ import static android.app.ActivityManager.StackId; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; -import static android.view.WindowManagerPolicy.TRANSIT_ENTER; -import static android.view.WindowManagerPolicy.TRANSIT_EXIT; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ANIM; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_APP_TRANSITIONS; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ADD_REMOVE; -import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_LAYERS; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_LAYOUT_REPEATS; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ORIENTATION; -import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_RESIZE; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STARTING_WINDOW; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_VISIBILITY; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WINDOW_MOVEMENT; @@ -37,7 +33,6 @@ import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; import static com.android.server.wm.WindowManagerService.H.NOTIFY_ACTIVITY_DRAWN; import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_NONE; import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_WILL_PLACE_SURFACES; -import static com.android.server.wm.WindowManagerService.WINDOWS_FREEZING_SCREENS_TIMEOUT; import static com.android.server.wm.WindowManagerService.logWithStack; import com.android.server.input.InputApplicationHandle; @@ -50,7 +45,6 @@ import android.graphics.Rect; import android.os.Binder; import android.os.IBinder; import android.os.Message; -import android.os.RemoteException; import android.os.SystemClock; import android.util.Slog; import android.view.IApplicationToken; @@ -132,6 +126,8 @@ class AppWindowToken extends WindowToken { boolean startingDisplayed; boolean startingMoved; boolean firstWindowDrawn; + private final WindowState.UpdateReportedVisibilityResults mReportedVisibilityResults = + new WindowState.UpdateReportedVisibilityResults(); // Input application handle used by the input dispatcher. final InputApplicationHandle mInputApplicationHandle; @@ -162,19 +158,10 @@ class AppWindowToken extends WindowToken { } void sendAppVisibilityToClients() { - final int N = windows.size(); - for (int i=0; i