Replace secondary app windows across activity relaunch.

Windows of TYPE_APPLICATION (as opposed to TYPE_BASE_APPLICATION)
are not child windows in the sense of SurfaceView, etc, as they are
independent windows like Modal Dialogs rather than embedded parts
of other windows. Still though, we expect them to reappear following
activity relaunch, and they won't be covered by window preservation,
so we need to mark them for replacement.

Bug: 26668339
Change-Id: I652b4137085f6ef4d6c9d54de609727f966ef4d6
This commit is contained in:
Robert Carr
2016-04-07 22:36:22 -07:00
parent 4b92594857
commit d1a010f279
2 changed files with 14 additions and 1 deletions

View File

@@ -499,7 +499,7 @@ class AppWindowToken extends WindowToken {
+ " with replacing child windows.");
for (int i = allAppWindows.size() - 1; i >= 0; i--) {
final WindowState w = allAppWindows.get(i);
if (w.isChildWindow()) {
if (w.shouldBeReplacedWithChildren()) {
w.setReplacing(false /* animate */);
}
}

View File

@@ -82,6 +82,7 @@ import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_LAYOUT_CHILD_
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH;
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
@@ -2704,4 +2705,16 @@ final class WindowState implements WindowManagerPolicy.WindowState {
}
return winY;
}
// During activity relaunch due to resize, we sometimes use window replacement
// for only child windows (as the main window is handled by window preservation)
// and the big surface.
//
// Though windows of TYPE_APPLICATION (as opposed to TYPE_BASE_APPLICATION)
// are not children in the sense of an attached window, we also want to replace
// them at such phases, as they won't be covered by window preservation,
// and in general we expect them to return following relaunch.
boolean shouldBeReplacedWithChildren() {
return isChildWindow() || mAttrs.type == TYPE_APPLICATION;
}
}