Don't use a copy of window params when showing a dialog.

When a Dialog's show() method is called, it makes a copy (l) of its window param
and change the copy's softInputMode before calling wm.addView(). This call ends
up calling WindowManagerGlobal.addView(view, l, display, parentWindow),
which in turn sets the application token from the parentWindow into l and stores
l on its mParams map.

Later, when the dialog layout is changed (for example, if it's resized), the
original params ends up passed to WindowManagerGlobal.updateViewLayout(),
which in turn updates it's internal mParams with it, hence losing the
application token (as the token was set in the copy).

Then, when Autofill (and possibly Assist) is triggered to that activity, the
Dialog's view hierarchy is ignored because WindowManagerGlobal.getRootViews()
ignores views whose params do not have an application token.

This CL fixes this issue by passing the original dialog's param to the wm
method and resetting the softInputMode that was changed, rather than making a
copy.

Test: atest DialogLauncherActivityTest
Test: manual verification with Twitch

Fixes: 68816440

Change-Id: I55f510ab7a44030bc368221b7db1a221bc2e09c8
1 file changed