diff options
| author | 2024-09-10 15:31:11 +0800 | |
|---|---|---|
| committer | 2024-09-10 15:31:11 +0800 | |
| commit | d62230abcf2c78a7ffe69a899694796f7ed78e71 (patch) | |
| tree | 1fd28c762e1eb8a90f04e54db47ac2b1498d08b7 /api/api.go | |
| parent | 8834b35c199efdd9ad3ea7ce24cf7439579a165b (diff) | |
Use display of parent window if available
In case the app uses attrs.token on display 2 but the context
is display 1. E.g.
var wm = display1Context.getSystemService(WindowManager)
wm.addView(paramForDisplay2)
Then attrs.token should have a higher priority to choose the target
display. Otherwise the add-window will fail because it tries to
find the display2 window from display1.
Note that getDisplayContentOrCreate only accepts token that maps to
a WindowToken. e.g. from
ActivityRecord.Token (Activity#getActivityToken)
-> ActivityRecord (extends WindowToken)
or IBinder -> WindowToken
So if the given attrs.token specifies View#getWindowToken (sub-window),
it won't be able to find the corresponding WindowToken from
DisplayContent#mTokenMap.
The View#getWindowToken is the IWindow of ViewRootImpl. So it can be
found from WMS#mWindowMap (IWindow -> WindowState). Then it is enough
to know the target display even if the given display id is wrong.
Bug: 338376012
Flag: EXEMPT bugfix
Test: atest WindowManagerServiceTests# \
testAddWindowWithSubWindowTypeByWindowContext
Change-Id: I992389c089d7401cf42a981227b51e92bc7c3436
Diffstat (limited to 'api/api.go')
0 files changed, 0 insertions, 0 deletions