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

Commit d1a010f2 authored by Robert Carr's avatar Robert Carr
Browse files

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
parent 4b925948
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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 */);
            }
        }
+13 −0
Original line number Diff line number Diff line
@@ -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;
    }
}