History log of /frameworks/base/services/core/java/com/android/server/wm/WindowState.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e6bcaf134aed92a00dc5c9ee789e8a7185ffb861 27-May-2016 Chia-I Wu <olv@google.com> Fix clipRect transform rounding errors

For clipRect.right and clipRect.bottom, we need to round them up.

Bug: 28864193
Change-Id: I2bd30eec8a8093e0fdcc7ce8484a0610fd068792
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
fed100742011bbc3092925c37e9f2df4ab04b6b5 26-May-2016 Robert Carr <racarr@google.com> Ensure surfaces only resize during relayout.

For clients which use an indeterminate measure spec in their
layout params (MATCH_PARENT). We could try and change their window size
due to a stack resize, before the client calls relayout. This isn't
safe as the client never had an opportunity to pause rendering, so it
could be in the middle of producing a frame for the old size to suddenly
find the buffer size change underneath it.

Bug: 28559097
Change-Id: I3982936fdf85c22def2f9c754d5508e029e4a84d
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
f58631a6a265a12a64a5c697178e0f4784f562ac 25-May-2016 Chong Zhang <chz@google.com> Destroy saved surfaces if one of the last visible windows gets removed

Also, if by the time the app is closing, a window is still invisible
in layout (or is already removed), mark the window as mAnimatingExit,
so that the surface is destroyed (or saved again). If it's marked
for removal, the window gets removed as well.

bug: 28913302
Change-Id: Ifa3dc0742f9c8c09d741fd64dcdc01b49075628c
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
e292eb3d4d0a2809b760eb849dc77c0f47e9494c 21-May-2016 Chong Zhang <chz@google.com> Don't include removed window when counting interesting windows

Also do not give input focus to window that's already marked for removal.
The input channel is already disposed and input manager will treat these
as null focus.

bug: 28797800

Change-Id: I3cb2d514a7286847f1ad6af3f629d04c303d3cbd
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
7fae7be59514ba6a7fdc10bdb47c9a9fe09d2cef 19-May-2016 Andrii Kulian <akulian@google.com> Merge "Clear mResizedWhileNotDragResizing flag after reporting" into nyc-dev
cbbcc0f79582b0157c03325074166da53e617c73 18-May-2016 Chong Zhang <chz@google.com> Request a traversal when a saved surface gets redrawn

When a saved surface gets redrawn, we need to return true in
finishDrawingLocked, so that a traversal is requested. This is
needed to update allDrawn/allDrawnExcludingSaved. Some delayed
window removal may be waiting for these flags.

bug: 28797800
Change-Id: I0b58b356e9c580422eb3ff81e8afb2a164cf6e43
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
eb1d322d1cfc8c7547967bc7e20b1fe3499ec90d 17-May-2016 Andrii Kulian <akulian@google.com> Clear mResizedWhileNotDragResizing flag after reporting

Currently mResizedWhileNotDragResizing flag is not cleared after
reporting resize to client, which causes sending lots of resize
messages and relayouts on app side.
This CL introduces another flag to track reporting to app.

Bug: 28696195
Change-Id: Ib5b6ea3e5f499c96057182f4b20583734dea56c4
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
26c8c42bbb2b998e609983886fad5968f033268d 10-May-2016 Jorim Jaggi <jjaggi@google.com> Also freeze configuration when freezing bounds

We also need to freeze the override configuration so we don't report
the new configuration too early, which leads to bugs.

Bug: 27915587
Change-Id: Idffadbb02ab0311796caa760ae1f467fd2d17768
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
8e4bda9e0f7411a3bfad0c625177f67248ff8a12 05-May-2016 Chong Zhang <chz@google.com> Fix a flicker when window is removed during entering animation

When animation is started with saved surfaces, app may decide to
remove one of the child windows during early animation and replace
it with a new window. This causes the app below (usually Recents)
to show through for one or more frames.

If we started animation early with a window, delay removal of
that window until the app is allDrawn in the "traditional sense"
(i.e. allDrawn without using any saved surfaces).

bug: 28742353
Change-Id: I4ef663a947b737aae96c3ccfe13a9f4c1d0567f0
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
9214704eac0af4b0d138a195bcea6fecef523ea5 09-May-2016 Chong Zhang <chz@google.com> Fixes for restoring more than one child surfaces

App may have more than one windows and subwindows. Remember which ones
are visible at the last setAppVisibility time, and restore only those
that was visible then. If the app itself requested to hide a window
before that, we don't want to use the window for early animation.

Also move mAnimatingWithSavedSurface into WindowState as it needs to
be tracked per window.

bug: 27455025
bug: 28296945

Change-Id: I3ed1879634fa7709de699d4518d8fcfc91a85554
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
c26aabadc3a88af6cdfe50fa163eb48c0330c90e 10-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Remove replaced window if we aren't animating its exit." into nyc-dev
21bbc5a775ea65318d1250b0406c2573128d285e 10-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fixed bug with pop-up window placement at the bottom in split-screen" into nyc-dev
d0a166a37d384f21ea595b187041e9e0894e4e7c 09-May-2016 Wale Ogunwale <ogunwale@google.com> Remove replaced window if we aren't animating its exit.

Allow removal of replaced window if it isn't running an exit animation
and wasn't set to run an exit animation.

Bug: 28411852
Change-Id: I916d7c9461691bc58367d012113fefe9c6485127
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
7cd4b01af3ae88f9db036510f4769c27f45bb4b2 07-May-2016 Wale Ogunwale <ogunwale@google.com> Fixed bug with pop-up window placement at the bottom in split-screen

WindowState.mInsetFrame is used to represent a temp. offset of a task
due to something like docked stack resizing or IME currently on screen.
In the case of pop-up windows (or any child window that wants to layout
in the parent frame) we were incorrectly setting the containing frame
because we were checking to see if the mInsetFrame wasn't empty. This
check isn't needed for child windows that want to layout in parent frame
because the parent frame will already have the mInsetFrame applied to
its frame which will automatically trickle down to the display and content
frame it forwards to its child windows to use.

Bug: 28389714
Change-Id: If89d40845a5a14aa60abcdedef2385b1fe7bfee3
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
52b952a296b84283db9041de96e2ff408b221572 07-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Reset transparent region when saving a surface" into nyc-dev
3131bdec7049f54b58a808328286b759cd9bb43c 06-May-2016 Chris Craik <ccraik@google.com> Reset transparent region when saving a surface

Fixes: 28432088

Ensure a transparent region on a saved surface is reset for future use,
since the surface should be like-new if used again.

This prevents an issue where the region - used to signal a portion of
content doesn't need to be composited - is persisted when a saved
surface is reused. The client assumes it's new and in default
state (composite everything), but the window is clipped when composited.

Change-Id: Icf2ec94c735679d715aded58de7eab12e9c43367
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
51d1d9165aeef4315207900fe1ea36b3ae55ab29 04-May-2016 Wale Ogunwale <ogunwale@google.com> Don't keep dead window with borrowed app token visible

If the window was add by a client using another client's app token,
we don't want to keep the dead window around for this case since
this funcationality is meant for 'real' apps.

Bug: 28467642
Change-Id: Ie4fdd9f90b122439a2fbcc60085ebfdb562d5c6d
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
5117e273eca0b15ef057d0c2440546799c17edf4 03-May-2016 Chong Zhang <chz@google.com> Apply IME adjust to newly added window

bug: 28390108
Change-Id: I72132d68cb41056fb69f2fe38fa13f2b3c9ce3d6
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
e42d0e102dbdf5287703389183a69019b64fc35e 03-May-2016 Wale Ogunwale <ogunwale@google.com> Don't remove all app token windows when window client dies

AppWindowToken can contain windows from multiple clients (Processes)
If one of the client dies we shouldn't remove all windows in the app
token. We should only remove dea windows.

Bug: 28467642
Change-Id: I8be6a98e0acc79719158567114f4902066069c1b
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
b60a830f8b192eadb6c94bdef99967cc2cddafff 27-Apr-2016 Chong Zhang <chz@google.com> Merge "Request a wallpaper update pass when wallpaper target is set to visible" into nyc-dev
4d7369adb3cf0e713d25abaefa74d6627ecb086e 26-Apr-2016 Chong Zhang <chz@google.com> Request a wallpaper update pass when wallpaper target is set to visible

Usually wallpaper target gets updated when some wallpaper target window
finishes drawing. However in some cases, Recents app could be set to
visible again before its stopped. (Which could happen when we started
opening transition into some app with a saved surface, but the app draws
so slow so that when user pressed Recents button again, the app still
hasn't delivered first frame.) In this case, the surface is already
drawn and we won't get a finish drawing again. We need to make sure the
wallpaper target is updated.

bug: 27742244
Change-Id: I8ff53f15f95bae8a99a5a0fd11e24e0186dc3345
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
dbe44ac48d79a8dacd0ae22fec296fda39066bf6 23-Apr-2016 Jorim Jaggi <jjaggi@google.com> Fix stuck windows in multi-window

Window manager checked for the full display size so isHiddenFromUserLocked
always returned true but activity manager and other places in window manager
thought it would be visible which created a really weird state.

Bug: 28344326
Change-Id: I98daefbcc64bf7a5196588c25d2cbc5ee046a77d
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
5f23a57707687e51d31b1641c5824e016d717556 23-Apr-2016 Jorim Jaggi <jjaggi@google.com> Fix layout for child windows

Turns out that we also need to fit child windows to display in all
cases except NO_LIMITS is set.

Bug: 27991404
Change-Id: I34a12bbf9d0169bdb770e0e96f4b994146063e90
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
edaf305651ad56de9f024f5746619ac139b2e52d 23-Apr-2016 Chong Zhang <chz@google.com> Force a relayout when task is resized while not drag resizing.

mResizedWhileNotDragResizing is set is task bounds is resized, however
individual window's size may not change (eg. a floating dialog). The
relayout window may not come and the mResizedWhileNotDragResizing
flag won't get cleared.

bug: 28111853
Change-Id: If8bb79cc07d9c67d6e5685b0adc24a9ce2623ec6
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
4c5aa51717b1858132ffc5c9804f409a161283ec 19-Apr-2016 Wale Ogunwale <ogunwale@google.com> Don't crop windows not on defualt display to stack bounds.

There are some windows that live on other displays while there app
and main window live on the default display (e.g. casting...). We
don't want to crop this windows to the stack bounds which is only
currently supported on the default display.

Bug: 26782253
Change-Id: I45648cc6fe8729e35f5b28eb06207aac6c263cdf
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
d450aa9ac5b30897abf14f76a9ae2a5d76bc5331 16-Apr-2016 Jorim Jaggi <jjaggi@google.com> Fix IME layout

When introducing the fitToDisplay variable, it should have been

fitToDisplay = task != null -> (implies) !task.isFloating();

but was written as task != null && !task.isFloating.

Bug: 28182018
Change-Id: If0be86f1ed8bb88914ce167e9f5273b6b3dc2571
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
bb9fb194f85225fcf0360fc53da51f12a649bd1b 15-Apr-2016 Rob Carr <racarr@google.com> Merge changes Id603816c,I86e41324,I025d0558,I44d8dbac,Iabfc2e81, ... into nyc-dev

* changes:
Only set mResizedWhileNotDragResizing for base windows.
Fix Task dim with docked resize.
Correct window replacement string comparison.
Replace DimLayers with windows.
Prevent premature window replacement.
Correctly prevent entrance animation for replacing windows.
Replace secondary app windows across activity relaunch.
9fe459da7ee3fd462a646b638f647c917c229eb4 08-Apr-2016 Robert Carr <racarr@google.com> Replace DimLayers with windows.

When replacing windows seamlessly we should also
replace their DimLayers.

Bug: 26668339
Change-Id: I44d8dbacf1b2213cfb882a40a1c878666a1ebef0
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
dcdca58cd5eb60a32de583eda5a334eb17f38034 08-Apr-2016 Robert Carr <racarr@google.com> Prevent premature window replacement.

maybeRemoveReplacedWindows is called when any window
has reported drawing, we have to verify that we have
actually ourselves drawn, before commencing the replacement.

Bug: 26668339
Change-Id: Iabfc2e813989381f9f20f3bb111100911405686b
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
b439a63fdf9398e46ca44811fbfde35fd02911c4 08-Apr-2016 Robert Carr <racarr@google.com> Correctly prevent entrance animation for replacing windows.

Prevention of entrance animation for seamlessly replacing windows,
was not working for non child windows. To correct it, we simply bail
from applying the app entrance transition.

Bug: 26668339
Change-Id: I4349e6aef55c3957d81a0a168cf6ac1d7c8866f1
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
3fb1c81394f98b025b488774916b7580f9e31dab 13-Apr-2016 Wale Ogunwale <ogunwale@google.com> Merge changes Ieefeb843,Ic2a94b09 into nyc-dev

* changes:
Update surface insets on window elevation changes.
Fixed bug with cropping out drop shadow for pinned stack.
656f6506fbbee34f2f66f013702ad860b738a73a 12-Apr-2016 Jorim Jaggi <jjaggi@google.com> Fix calculation of content insets

When calculating all the frames and insets, we need to use the actual
frame instead of layoutContainingFrame. To do this, we layout mFrame
with layoutContaining/layoutDisplayFrame, calculate all the content
frames and insets, and then offset everything by the constant offset.

Bug: 28075359
Change-Id: I78f0a54ca2a0cc6c7c8be21153c2b2c8f1d5c0a9
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
d1a010f279447bbf2b186e4c24ff6bdb8ecedbf0 08-Apr-2016 Robert Carr <racarr@google.com> 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
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
b72c9ad721e5ff5b9d5a45ca4ba2608940815388 12-Apr-2016 Jorim Jaggi <jjaggi@google.com> No input for windows in minimized docked stack

Also make them unfocusable, and don't focus the docked
stack when tapping into it in that state.

Bug: 27972642
Change-Id: Ic24ff9a5f39f596fe4a2f50567566d4400f9c125
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
daea3572b3dcf2a40033896425e90c6bce52acc2 08-Apr-2016 Andrii Kulian <akulian@google.com> Fix minimal size for tasks in right-hand pane

Minimal size adjustment was not applying correctly to right-hand pane.
Also when task with minimal size set was moved to docked stack on the
right, first configuration was calculated only for its visible part.

Bug: 27621228
Change-Id: I36bc5cdfe08056ee1aea8b0cc08fd28e87e578cc
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
b918f1bfb81fefa156282c98929248f28035efd7 08-Apr-2016 Rob Carr <racarr@google.com> Merge "Do not crop children to task bounds while resizing." into nyc-dev
2487ce70a7c28313d5e2c7a5cc8ef3d999d05ac9 08-Apr-2016 Robert Carr <racarr@google.com> Do not crop children to task bounds while resizing.

When we are resizing the task bounds might be smaller than
the stack bounds. We don't want to clip to the task bounds here,
so we use an expanded rectangle, making sure to expand it
large enough for giant surfaces.

Bug: 27676101
Change-Id: I1a324a474a89e4652ccd15ebd853b0b8815a48f5
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
fd2bd1b343619cec59a28a58e2e9caa7f65f022d 07-Apr-2016 Robert Carr <racarr@google.com> Fix regression breaking SurfaceView in docked.

We don't need to subtract the insets again when
we are laying out in the attached window frame,
as pf will already have them subtracted.

Bug: 27687126
Change-Id: If9c093c5a811ceb7b62bd27a1dd17742b04d898e
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
6bab4cf52d53074b7d353738ebd014c72366774d 07-Apr-2016 Wale Ogunwale <ogunwale@google.com> Fixed bug with cropping out drop shadow for pinned stack.

The surface crop we apply to windows in the pinned stack was based on
the stack bounds. However, the windows in the pinned stack have a
drop shadow that extends outside the stack bounds to make them appear
floating so they were out displayed. We now extand the crop for windows
in stacks that have shadows and occupy the entire stack space to that
their drop shadows are visible.

Bug: 27364161
Change-Id: Ic2a94b091a93e7145a5455b494f0b689118eb5e3
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
f3df0aaa326538085adc8aca35a3eaff85ab3c70 07-Apr-2016 Jorim Jaggi <jjaggi@google.com> Fix flicker when docking task

Bug: 28051193
Change-Id: I191c01f90c775a26fce6e6f73a0573a0be91a61f
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
f583427b0de21037b9bda8a8a66b1ca4e4e1c9b9 05-Apr-2016 Jorim Jaggi <jjaggi@google.com> Fix dialog placement

When calculating the frame for non-fullscreen windows, we incorrectly
used the wrong bounds to calculate the frame, which lead to wrong
positioning.

To fix this, we use the inset bounds, which we consider the source
of truth for all layout related aspects, to calculate the frame,
and then offset everything by the difference between the inset bounds
and the task bounds to position them correctly.

Bug: 28012565
Bug: 27860956
Bug: 27441808
Change-Id: I90d45054e0bcce78d021ad2cd20e5ef7f79ded3d
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
d900337da8977c518fb05f2cc0c467f2d50a1b23 05-Apr-2016 Andrii Kulian <akulian@google.com> Fix override insets when dragging divider in split-screen

Previously, if frame extended beyond screen, override inset was set
to zero for corresponding dimension. This caused issues while dragging
down in vertical split-screen because navigation bar inset was not
included.
This CL sets override inset value as a difference between corresponding
content area dimension and screen dimension.

Bug: 27970692
Change-Id: I5bd16077a7deb039516bc9e11aa58315f809455a
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
e15fb0172c38a69551aedc43a28a24cd7c9647bf 05-Apr-2016 Rob Carr <racarr@google.com> Merge "Do not constrain width/height of child windows at layout." into nyc-dev
84e69c3bbb21c35b9b42e90ae40356a4e889235b 04-Apr-2016 Rob Carr <racarr@google.com> Merge changes I7d406cc8,Id6cf70ea into nyc-dev

* changes:
Do not set docked divider as IME target.
Fix IME adjustment for docked.
6c71c0b86b67080bd79d695d0e3a1c9d00e38d98 02-Apr-2016 Chong Zhang <chz@google.com> Never "save" if the surface control is null.

This may or may not happen, but putting in some preventative measure and
extra logging to help debug crashes related to null mSurfaceController.

bug: 27533667
Change-Id: I010147da819402c48efd26a7cc631776052a702d
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
fc03b2bdb7596106b46075e5524514820faccbdd 01-Apr-2016 Robert Carr <racarr@google.com> Fix IME adjustment for docked.

If we look in PhoneWindowManager offsetInputMethodWindow
lw we see mContentBottom will be updated to account
for the input methods appearance. Now if we look
at the non SOFT_INPUT_ADJUST_RESIZE case
in layoutWindowLw "normal window" (L4625)
we can see pf will be set to the adjusted mContentBottom
while cf will retain the non adjusted mDockBottom. So
adjustment by cf isn't sufficient we need to use pf. I've
preserved the existing behavior for freeform, until there
is more time to understand the desired behavior here, but
it seemed to make more sense for docked to reduce the available
area from the bottom rather than move the top offscreen.

Bug: 26387930
Change-Id: Id6cf70ea2b584939e24a12f9a32986c096f3d3eb
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
1d2bacb1005b30bcc3d76423ff5fa46af2faaffb 30-Mar-2016 Robert Carr <racarr@google.com> Do not constrain width/height of child windows at layout.

We wish to allow them to extend beyond the parent boundaries
if they really want a surface that big, and be cropped,
at a later stage.

Bug: 25986646
Change-Id: I650e6d07dcc2aa9eb659860c832685f1a587a1b0
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
933076d80561751618f462b26309ce9e4c3ff3bf 30-Mar-2016 Andrii Kulian <akulian@google.com> Refactor usages of Picture In Picture and Multi Window (1/4)

Bug: 27365860
Change-Id: I1590e430a12ceb84cb83da295e0bf7e4378fea96
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
3e670dc06d78333c617f7a8fc8afef1f2a8fb810 28-Mar-2016 Andrii Kulian <akulian@google.com> Merge "Don't set insets if task frame doesn't fit the screen" into nyc-dev
0b46f3c72c324bc9b8890ed9b81951bbeec70fdd 14-Mar-2016 Jorim Jaggi <jjaggi@google.com> Implement transition for docking task in recents #2

- Put window into resizing mode when docking it from recents,
so it fills the "void".
- Send whole task bitmap window as the thumbnail, to make
the transition smoother.

Bug: 27607141
Change-Id: Ib647d44d9777f1155deab818d1fd5425c1bdd3d1
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
192086eb8aff3fb873a7e03ade0b81652aacf25f 11-Mar-2016 Jorim Jaggi <jjaggi@google.com> Implement transition for docking task in recents #1

- When the docking transition is happening, defer updating
the bounds of the home stack until the transition is done.
This is to preserve the scrim which is drawn in the recents
activity.
- Use the PROLONG_AT_START infrastructure to hide the task
in recents when starting the app transition.
- When recents finally get resized at the end of the transition,
reset it's draw state so we don't move the old surface around,
and the new surface gets drawn at the new position, to avoid
flickering.
- Remove hack around not layouting docked divider if it's not
visible, it's not needed anymore and resulted in a wrong
initial position.
- Fix animation selection for docked stack divider.
- Make sure win.moved() always gets called.

Bug: 27607141
Change-Id: I76c35f09461f044a90e2c88335008284b5839cc0
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
157fea650baf5e0bb7cc4b482ebd718234c2c918 24-Mar-2016 Rob Carr <racarr@google.com> Merge "Do not adjust child windows placement for fit to display." into nyc-dev
3d93897a56f24c0ccbccd64d85915ac56bfe2406 24-Mar-2016 Robert Carr <racarr@google.com> Do not adjust child windows placement for fit to display.

Consider the case where we have made a child windows parent
and task smaller in the docked stack but the client has not
yet caught up and requested a new size for the child window.
In this case it is possible for the child windows requested
layout to extend beyond the bounds of the available display area
(in this case the containing frame). Our intended behavior is
to clip this extra area, while preserving the relative offset
of the child and parent window. If we apply gravity to fit within
the display frame, the behavior will instead be to modify
this offset in order to reduce the amount of cropped window.
While this is a sensible idea for laying out fullscreen tasks, it
is not helpful for windows layed out in the parent frame.

Bug: 27687126
Bug: 27676101
Bug: 27601572
Change-Id: I80607a29506dc5a127ac0eab12c2aeb9450e13f6
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
a9d168c486aa9ec78485b0de80efe8652c14fc54 23-Mar-2016 Andrii Kulian <akulian@google.com> Don't set insets if task frame doesn't fit the screen

Set right and/or bottom insets to zero if the frame of the
task in multi-window mode doesn't fit the screen.
This covers the case when task has minimal width/height
which don't fit the visible area and task should be cropped.

Bug: 27621228
Change-Id: I741f1ef2e0994f7db0d49450fbb271e75f17a775
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
5c791ab40ba191243b4bd0764afb18db68186d30 24-Mar-2016 Rob Carr <racarr@google.com> Merge "Transform app animator crop to child window space." into nyc-dev
945d197182e52e7f323ffb8527d45ec7dcfe97e3 23-Mar-2016 Wale Ogunwale <ogunwale@google.com> Don't save secure surfaces.

We don't want to save secure surfaces since their content shouldn't
be shown while the app isn't on screen and content might leak
through during the transition animation with saved surface.

Bug: 19940527
Bug: 27747315
Change-Id: Ie664e1015845e05ec01572a9d9c3574173ac2f91
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
f3b72c7b4dfc1e858340552f792f8f47ebd515e3 22-Mar-2016 Robert Carr <racarr@google.com> Transform app animator crop to child window space.

The AppAnimator will not know about child windows
relative offsets to the containing frame and so
will express crops in the wrong coordinate space.

Bug: 25986646
Change-Id: I3af291aa60455b753c2e61d4eebb77ace902ff15
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
ae35fef616c14f721cf12d6a0f78bef9fef5df9d 16-Mar-2016 Chong Zhang <chz@google.com> Apply temp inset bounds to child window if it's not empty

bug: 27676101
bug: 27687126
Change-Id: Iab1129cc0224194e7a9d11d0454bc7af6897a6e8
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
b20ecd6d5e21be6d0cc3be849271ee8bdf20262e 14-Mar-2016 Chong Zhang <chz@google.com> Merge "Fixing misc issues that leads to black screen when pressing Home" into nyc-dev
65d15d03326456457039dde69ae37e9ae1db6d6e 14-Mar-2016 Chong Zhang <chz@google.com> Fixing misc issues that leads to black screen when pressing Home

- Make sure to clear usingTransferredAnimation flag together when
setting app animator's animation to null. Not clearing it will cause
setAppVisibility to not apply dummy animation (placeholder)
to a closing app token while it should, and the closing app token will
then exit early before the opening app is ready, since it doesn't have
any animation set. This causes a brief blank period.

- When app relayout to invisible, make sure to mark mWinAnimator's
mAnimating to true if we decided exit animation is running. Note that
even if we didn't actually apply the animation (which could happen if
the window is no longer visible by policy), if the app token itself is
under any animation, we need to mark mAnimating otherwise the clean up
code in FinishExit will not run, and the window will be stuck in
Exiting state.

- We no longer change mAnimatingExit flag in setAppVisibility(), but
wait for app's relayoutWindow calls to change it if applicable.
setAppVisibilty doesn't apply the animation until transition is good
to go. Setting the flag without the animation applied will disable
setTokenVisibilityLocked and relayoutWindow to actually apply the
animation, because they may think the window is no longer visible.

bug: 27391256

Change-Id: I292305847d742cdbb5ebe6aa8daa5d83bf65483b
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
9185fb07c4df49fe604f9535505634f86aeac1c4 12-Mar-2016 Wale Ogunwale <ogunwale@google.com> Disable FLAG_LAYOUT_NO_LIMITS window flag in multi-window mode

FLAG_LAYOUT_NO_LIMITS allows a window to extend its dimensions outside
the screen area by setting the display frame to a really big value.
We don't want this in multi-window mode since all window frames should
be limited to their parent task/stack dimensions.

Bug: 27577275
Change-Id: Ie0a8b8c13de91561e06dadc27aac3a5ba209d05b
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
899327f5cbbfb0eae5562b262ccea860c98f6bc4 26-Feb-2016 Jorim Jaggi <jjaggi@google.com> Animation for docking task gesture

- Don't move recents window around during the animation
- Set the correct task size shortly after docking, so recents
starts with the correct size to avoid jank.
- Add staggered animation in recents.

Bug: 27154882
Change-Id: I7c56102feba9c3f6cb86cb5f1d87f0ad3b29c721
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
33fde7d098d6fb68bfacc390f5f5a2cf865a203b 06-Mar-2016 Wale Ogunwale <ogunwale@google.com> Fixed IndexOutOfBoundsException when removing child windows

The size of the list reduces when a child window is removed from the
list. So, we copy the window list and loop from the last entry to the
first when removing to avoid IndexOutOfBoundsException.

Bug: 27345523
Change-Id: I15986e418d29ee5035dc9d4c4f728ad33bfe6999
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
adef831761017d6d84d7bd4a388714a04fb73d66 03-Mar-2016 Rob Carr <racarr@google.com> Merge "Reimplement PIP animation to not use drag resizing." into nyc-dev
e0a1e3ae716ec62eb264c21842c2603067b8a73c 03-Mar-2016 Rob Carr <racarr@google.com> Merge "Ensure we apply override configuration to the global one." into nyc-dev
1493fdd325890b8c4ffdad4857108a18601f9779 03-Mar-2016 Rob Carr <racarr@google.com> Merge "Update mCompatFrame in applyGravityAndUpdateFrame." into nyc-dev
acd7a22cd7fe1c2d1a1ba6ed8e97e4e21dd31a1d 03-Mar-2016 Rob Carr <racarr@google.com> Merge "Fix pinned stack frame computation." into nyc-dev
0d00c2e25bf8816dbd99f4fcd5c8221e80826a95 01-Mar-2016 Robert Carr <racarr@google.com> Reimplement PIP animation to not use drag resizing.

When using drag resizing it is difficult to keep big surface
surfaces (e.g. main app windows) and child windows in sync
as we resize. Furthermore it's difficult to resize child windows
quick enough to achieve more than a few frames a second as we have
to propagate through the client UI thread. Our new implementation
uses window scaling.

Bug: 26454664

Change-Id: Iac96619cefc075b1412cfeba3d3c9bcd7ce22f52
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
c24d8f9c48b00530b2ca057d15b00d4306949daf 01-Mar-2016 Robert Carr <racarr@google.com> Ensure we apply override configuration to the global one.

We are confusing clients by sending the correctly merged
override and global configurations through the primary
ActivityManager channel but then sending only
the global configuration through the window manager channels
ensure we always merge the configurations prior to sending
them to the client.

Bug: 26454664
Change-Id: I7183365e1c414f9a68564338c60e2f5283ddb57d
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
6e18c5edb5494c4889f9910a8679872df5fa4d6e 01-Mar-2016 Robert Carr <racarr@google.com> Update mCompatFrame in applyGravityAndUpdateFrame.

We need to make sure mCompatFrame is always updated when
mFrame is. In the reposition child case we will have
applyGravityAndUpdateFrame without computeFrameLw
so we were previously failing to do so.

Bug: 26454664
Change-Id: Ibad1644d38e6d78e5e96eff7b3c6763bd1c92f9b
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
e627558feffa4ffe6435d7d13eda3d89f7c08095 01-Mar-2016 Robert Carr <racarr@google.com> Fix pinned stack frame computation.

We want to compute the frames for pinned like we do for freeform
as we are not constraining layout to the suggested display area by the
PhoneWindowManager. Also update applyGravityAndUpdateFrame
to not clip frames to the display for child windows. In the case
of computeFrameLw this would not be a problem as we would then
go on to overwrite mFrame anyway, but in the case of repositionChild
it could create issues (where we have applyGravityAndUpdateframe without
compute frame).

Bug: 26454664
Change-Id: I6fd4c9f37060d51003d041566368edd2b9eb7afd
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
47e36a3e270ff3e94750d730ac2a9f0bdfe96c04 01-Mar-2016 Chong Zhang <chz@google.com> Force disconnect when the surface is about to be saved.

Some client will not disconnect, and if we're saving the surface (instead
of destroying it), we need to make sure the surface is disconnected.
Otherwise the client won't be able to reconnect to the same surface.

bug: 27295820
Change-Id: I471b8fbe8f590c900e17a017167466fc8a70b87a
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
9017ec0b150ee19ca1041b61c2560dff759686d7 25-Feb-2016 Wale Ogunwale <ogunwale@google.com> Remove starting window whenever the acitvity is stopped

The main app window will never finish drawing at this point so there
is nothing to trigger the removal of the starting window.

Also, set ActivityRecord.mStartingWindowShown to true for some cases
where we were telling WM to show starting window but not setting the
flag that would later be used for clean-up.

Bug: 26659857
Change-Id: I7a8582521853f1f95b77d8b08f4dd0cf778f8cbf
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
0ffd49cbe0ab4c13fd5528abacade898a8cff481 13-Feb-2016 Jorim Jaggi <jjaggi@google.com> Always consume bottom insets when navigation bar is force shown

When an app requests SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION but we
force show the navigation bar, we need to treat for the app like
there is no virtual navigation bar on the device. Because if you
combine it with FLAG_HIDE_NAVIGATION, you'd expect the navigation
bar gets hidden but it doesn't, so there could be content that
overlaps with the navigation bar.

Bug: 27157904
Change-Id: I088e02eae2e723c35e9cb4873de6b1325458533b
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
5e6968db630d26872306c4b23aa2c600d83ed454 20-Feb-2016 Jorim Jaggi <jjaggi@google.com> Fix disappearing windows after moving divider to side

Because we only hide the surface when the clip rect got empty
but never showed it again if it got non-empty, app windows
disappeared after moving the docked stack divider to the
edge of the screen. Now we reshow the surfaces if the clip-rect
gets non-empty.

However, this introduces another bug while dismissing the docked
stack: Because we move all windows to the fullscreen stack, we resize
them but until the app transition starts, it can take a while and
during this time the app surface would be visible with the wrong
bounds. To fix this, we notify the windows that we are repositioning
ourselves in our stack. When applying the clip-rect, we detect that
situation and then we set the clip rect to empty if it was just empty
before and we just moved in the stack, to fix this very specific
issue.

I'm really not proud of this solution but at this point we can't
revisit how app transitions are executed in terms of timing and
ordering, so I thought this little hack is the best solution at
this point.

Bug: 26588506
Change-Id: I78305f7f7ef6c3da3c126a58d751117fcee23ca9
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
8fa4522b24065d15535e17eed7cd5370b878a4c5 20-Feb-2016 Jorim Jaggi <jjaggi@google.com> Recents transition fixes

- Make sure to destroy the saved surfaces while we resize a task. The
usual destroying mechanism doesn't work here because we don't add the
windows to WMS.mResizingWindows.
- Make sure not to save the surface when a resize happened after the
window has been marked as gone (exiting). In this case, we resize the
task, so we add the window to mResizingWindows, but then when we don't
layout the window because win.isGoneForLayout() == true, so it would
save a surface that has the wrong size.
- Ensure the configuration of the top task when dismissing the docked
stack. First, this speeds up when the user navigates to it in the
fullscreen stack. Second, it fixes some other weirdness with saving
surfaces.
- Only exclude windows from layout when hidden is requested, so when
transitioning from hidden -> shown, the app immediately gets the
updated size when the task was resized when the window was hidden.

Bug: 27276087
Change-Id: I6faf016724136d984b259d184af58d41684f3425
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
c48a354733ff150e4a07f6b0743009001aa4f48d 20-Feb-2016 Wale Ogunwale <ogunwale@google.com> Clean-up WindowState if exit animation is done before app finishes

In ag/862571 we prevent window states from been removed before the
app is stopped since it can still be rendering to the surface.
The CL also left WindowState.mExiting as true after the exit
transition animation runs. This is okay if the app finishes before
the exit animation is done, but if the exit animation finishes before
the app finishes, then we will always think we need to run an exit
animation and not remove the windows when the app and later activity
manager tries to remove the windows.
mExiting is used to mean exiting animation is running, if it is set to
true then all the code assumes an exit animation is still running and
doesn't remove the window state.
- Always set mExiting when animation is done.
- Renamed mExiting to mAnimatingExit so it is more clear what it is used
for
- Allow window state to be removed is the current surface isn't shown.
This should be save since there won't be any visual effect to the user.
- Rename WindowState.mClientRemoveRequested to WindowState.mWindowRemovalAllowed
and move setting it to true into WMS.removeWindow() so it catches all cases.
- Cleaned-up the code some to be a little clearer.

Bug: 27112965
Change-Id: I6f03d3c75b5b7728e42ceadc8703df40a3b4ae63
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
dd6e4c19842c83778efda0e4887854fc121e9faa 18-Feb-2016 Jorim Jaggi <jjaggi@google.com> Do not put floating windows into drag resize mode

Not really useful and creates a lot of "jank".

Bug: 27099358
Change-Id: Id1c5e09cc9731f64c5f52f9c187ccbda468ea26e
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
4113ffac61596dc83409b2d7d3143cdfbbe01841 18-Feb-2016 Chong Zhang <chz@google.com> Make sure mExiting is cleared when app is set to visible

Reset mExiting even if we are not going to do enter animation.

Also make sure has surface state is set correctly if restoring.

bug: 27235356

Change-Id: Ie6e78baefc8242015ed9c37ab221c39860682ab2
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
c662d8e94620c84b2fa57bfd6e45690f0c349d89 06-Feb-2016 Jorim Jaggi <jjaggi@google.com> Make sure we call reportResized exactly once when drag starting

If there was another layout happening before the app called
relayoutWindow(), we were issuing multiple reportResized calls,
leading to multiple relayoutWindow() calls, slowing everything
down.

Change-Id: I1f3da04bb7581c655567e1d1a6fe0f8c83c0ffda
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
989b58a633ed6f2192a172855525d86477452884 10-Feb-2016 Vladislav Kaznacheev <kaznacheev@google.com> Update pointer icon when View.setPointerIcon is called

Currently the updated pointer icon is only displayed after
the next mouse move.

Bug:27107871
Change-Id: Ieed57b07fe44699735179cf57968a9bb08981396
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
e26334ba1a5c7880c67b931a6ca73941167712e9 12-Feb-2016 Jorim Jaggi <jjaggi@google.com> Merge "Handle light status bar for split-screen" into nyc-dev
86905582411c5c77a3e7641589cf206c6e5770f5 10-Feb-2016 Jorim Jaggi <jjaggi@google.com> Handle light status bar for split-screen

In split-screen the light status bar flag for one side of the
status bar can be different from the other side.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR is now reported for both
the fullscreen stack and docked stack, but not anymore in the
"default" SysUI visibility field when reporting a visibility
change to SystemUI. The change also reports the docked stack
and the fullscreen stack bounds, so SystemUI can guard tinting
the icons on whether the icon is one of the areas.

When calculating the light status bar flag in PWM, we keep track
of the top fullscreen opaque window state for the docked and
fullscreen stack separately.

Bug: 24365214
Change-Id: Id2240a86d75bf96e0138ec7652a4793859f56e3c
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
dcb68145236b9ed9f6ea6ee9456db2fca456df3c 10-Feb-2016 Jorim Jaggi <jjaggi@google.com> Reset docked stack resizing when divider dies

Bug: 27062375
Change-Id: I699f8d99ceab8405bcb973942787ee80caea12b2
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
69abc194f32b5c955ac7beaf6db37269d596172d 05-Feb-2016 Jorim Jaggi <jjaggi@google.com> Multi-window optimizations #1

- When the window doesn't have a surface, do not add it to
mResizingWindows, so we don't report unnecessary resizes
- computeDragResizing => false when window is not visible, so we
never enter resizing mode even if the window decides to relayout
in the background

Change-Id: I8e6cdef86f1579d128973d4f2f12e87bf9b65524
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
e12aece4cad849efbbe6a806f132613a56699230 03-Feb-2016 Robert Carr <racarr@google.com> Ensure surfaces stay alive until activity stop.

Prior to this commit in this case of activity pause, with finishing=true
the activity manager will notify us of app visibility and we will begin
an exit animation. When this exit animation finishes, we will destroy
the application surface (unless its eligible for saving). However there
are two cases where this breaks down:

1. The exit animation finishes before the activity thread handles
the stop transition. Many activities stop rendering on Pause
but many do not and it is totally legal to do so. Sometimes this
results in non fatal dequeue buffer errors and sometimes results in
fatal errors with Pixel Buffers, etc...
2. We may resume the activity shortly after asking the window manager
to pause it. If the window wasn't eligible for animation, we will
immediately destroy it after being told of the visibility change
following PAUSE_FINISHING. It's possible for this to complete
before we process the resume. On the other hand the client
happilly processes the resume and transitions back from PAUSE
and then crashes once it attempts to use it's surface.

In this commit we have the activity manager notify the window manager
when an application has actually finished (or we have timed out
waiting). For windows which have not been explicitly removed by the
client, we defer destruction until we have received both this signal
and the animation has completed.

Bug: 26793431
Change-Id: Ib6ee8fbdd1f03450fbbfd62468a19e97774befab
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
af78708e98e931dcb987a54268c24d3475668e05 06-Feb-2016 Chong Zhang <chz@google.com> Merge "Check wallpaper visibility to determine if wallpaper is obscuring apps."
66bf071d117fe82028123c1a237edb27bfd85f0b 05-Feb-2016 Chong Zhang <chz@google.com> Check wallpaper visibility to determine if wallpaper is obscuring apps.

bug: 26948569
Change-Id: I710893ee086dce441cb5e2744fc721d3e1a2fd8a
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
a9f9b37823a5f046078594c96c262c127afdee1c 05-Feb-2016 Wale Ogunwale <ogunwale@google.com> Reset docked divider to the middle of the screen if sys-ui dies

It is possible for the docked divider to be in an unstable location
when sys-ui dies. E.g sys-ui animating the divider from behind the
nav bar. When this occurs we reset the divider to the middle of the
screen so that the system remains in a useable state. Otherwise, the
docked stack can be fullscreen always preventing the user from going
into any other application.

Bug: 26965731
Change-Id: Icd254fffe69da4ee3f2efb4ff1d210a778703f64
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
9511b0f1e9ac629a4a747a0c9373d33ab33cfc32 30-Jan-2016 Jorim Jaggi <jjaggi@google.com> Fix bug where surface was not clipped off during resizing

When dragging the divider in a way such the task size goes through
the following transition

- Half size
- Full screen
- Half size

the surface wasn't clipped off anymore. This was because in full
screen configuration, computeDragResizing() == false thus when
going full screen -> half size, we reset the draw state to
DRAW_PENDING to get notified when it has finished drawn. However,
this also broke clipping.

In order to fix this, we always put the window into a resizing mode
no matter whether the bounds are fullscreen or not.

However, this introduces an ugly flickering on the navigation bar,
when going into docked mode, because the app doesn't draw navigation
bar background in resize mode.

To fix that, we calculate the presence of navigation bar whether the
window is fullscreen, and not just whether it's resizing. For that,
we need to calculate the presence in BackdropFrameRenderer, by using
the insets just sent by window manager.

Change-Id: Idf56df4ae7fefe67d068bc2eeda8dc4d83bbefb7
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
d1a668fd9a1a7ea81a50a9bfc5a1ac188bb47dc7 02-Feb-2016 Rob Carr <racarr@google.com> Merge "Allow saving child surfaces."
7098dbd4d6a7337c6299d386e74f5ec328348229 01-Feb-2016 Robert Carr <racarr@google.com> Allow saving child surfaces.

We can and should save child surfaces as the client side window
state hasn't been torn down in the case where we would otherwise save.
So, if we destroy the Surface, the client will continue to render
and crash.

Bug: 26793431
Bug: 25780116
Bug: 26777815
Change-Id: Ia043b7af24b9370fc17a5b57226566f94c08ba4e
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
bfc2f8f6c8ac4156e76a50c88a9ac36d864cee36 30-Jan-2016 Chong Zhang <chz@google.com> Some fixes for saved surfaces

- If we have a saved surface, and app relayouts to visible before we
started entry animation, we need to restore the saved surfaces.
Otherwise the surface might get stuck in the saved state, because
we may not get to run any animation after this relayout.

- Keep track of the allDrawn while we're using the saved surfaces,
so that we can rely on allDrawn itself, instead of whether we're
using saved surfaces.

- If the app is set to visible when it's exiting, clear the exiting
flags. Also, save the surface if we cancel an exiting animation.

- More debug logging.

bug: 26819496
Change-Id: Ie42c6eea7879632d82f24ed09c3b6e737dd6d8a4
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
b1faf60b896afe235175354ffd90290ff93a54b4 27-Jan-2016 Wale Ogunwale <ogunwale@google.com> Use resizeMode integer instead of resizeable boolean.

Changes activity manager and window manager to use resizeMode
as defined by ActivityInfo#resizeMode instead of a boolean.

Bug: 26774816
Change-Id: I8cef46d9fba6bfdd21df7da63ed5d5330ad03d4b
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
d757376678682c9795db90a58590f344120ab4d7 29-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Merge "Don't apply overscan insets to freeform windows."
01ef404d5d2b978c2460a761ca60bc61ba75bb2c 29-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Don't apply overscan insets to freeform windows.

Overscan gets applied when window frame is outside of the display frame.
This is a natural situation for freeform windows, so they should not
receive the overscan inset. Applying overscan insets causes the
application content to get squashed, when we resize the freeform window
and part of it is outside of the display.

Bug: 26009343
Change-Id: Ib614fb8c7170c3b6d69614b813674853e1204eef
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
f1fa7908f6e942f1506ffa860bd59529b675f2f2 29-Jan-2016 Chong Zhang <chz@google.com> Merge "Enable logging for surface create/destroy."
a8975bd3696278445cb6ffd426eade0ac2449dd7 29-Jan-2016 Chong Zhang <chz@google.com> Enable logging for surface create/destroy.

bug: 26819496
Change-Id: I969b87122126df994c5bd5af177b672bcab5b7dd
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
84fa3351a21b37d02fafd634a8de65cf6cd04c4d 26-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Animate pinned stack resizing.

This introduces animating of stack bounds within window manager
module. It also uses this type of animation when moving an activity from
fullscreen stack to pinned stack.

Bug: 25672053
Change-Id: I75914a685d10021f8a7535b47ef12b6920b3fd5e
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
a4a58efe8203d63a9a6bf78b0fa9f2992b25871b 27-Jan-2016 Jorim Jaggi <jjaggi@google.com> Fix app staying in drag resizing when undocking

When dismissing the docked stack, the fullscreen stack stayed in drag
resize mode because it got a relayout, but because the bounds didn't
change (it switches to the fullscreen layout a bit earlier) it never
called WM.relayoutWindow, so it stayed in drag resize mode indefinitely.

To fix this, introduce forceRelayout in Window.resized(), which makes
sure the client always calls relayoutWindow. Set this to true whenever
drag resizing is changing.

For some very weird reason this also broke that home button was not
responding anymore.

Bug: 26806532
Change-Id: I4b39c1c419a166aa7093c31226f2a4915f642328
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
3fd20fe8d8ff269b9253999dc8fc95a7a5269aef 24-Jan-2016 Wale Ogunwale <ogunwale@google.com> Don't keep visible windows in pinned stack on screen when app dies

We previously introduced logic that keeps an apps visible windows on
screen when the app dies. This was to help with the situation where
freeform apps might be killed by the low memory killer and we want
to preserve the space on screen and relaunch the app when the user
interacts with the window again.
However, this doesn't work for windows in the pinned stack since
they an normally not focusable/interactable.
We no longer do this for windows in the pinned stack.

Bug: 24913379
Bug: 26609941
Change-Id: Ie2e7f7d7c7a8c0ef6c1662517f558c385201c433
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
eb22e8ed42bb146060e8ffc94444f70ea47fda04 21-Jan-2016 Chong Zhang <chz@google.com> Fixes for broken saved surface

- Reset and restore the visibility flags and hasSurface states when
surface is saved or restored. When the surface is in saved stated,
we have to make the rest of the system believe that the window has
no surface.

- Set app windows to 'mExiting' when we start a transistion because
window manager changes the visibility of the app. We can't rely on
receiving a relayoutWindow from the app to invisible. We need to
mark it exiting so that when the transition is done, the surfaces
get removed (or saved if possible) promptly.

- We need to save the surface if the app token is the last one in
a task, regardless of whether it's visible, this means the whole
task is going into background. But if the app has another visible
token on top of it, we don't need to save it. For example one
activity launches another activity, in this case we don't want to
save the surface of the activity on the bottom.

bug: 26573100

Change-Id: Id845f87b30cda1cebcc12ad2ac8dbf19a068a86e
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
55bd026e75259f73f598e22a351c96f1a1e3007e 16-Jan-2016 Wale Ogunwale <ogunwale@google.com> Merge "Don't mark wallpaper windows as visible when it's surface is hidden."
329b7e5fa521d9befcf889e24882231b4cf2b5c5 16-Jan-2016 Wale Ogunwale <ogunwale@google.com> Don't mark wallpaper windows as visible when it's surface is hidden.

Also, cleaned up the visibility methods a little.

Bug: 26440195
Change-Id: I27451e980b437f6c4e1e5488d8ada42312a113bb
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
2e95a488e0a12d4263d101e888fdd89fd123aec3 15-Jan-2016 Jorim Jaggi <jjaggi@google.com> More optimization while dragging docked divider

- Make sure mPendingBackdropFrame gets also set when if the window
triggers a relayout on it's own, so it doesn't call into window manager
all the time.
- Set the insets of the docked divider to empty so we don't trigger a
layout when we are just moving it - it doesn't need it in any case.
- Send a window move message to the divider when it moved
- Update attach info in all move cases, update light center

The whole resize operation now only takes around 4ms per frame, and
leaves a lot more resources for the apps to do configuration changes.

Bug: 25015474
Change-Id: Ica48129570a0fc858a89c21f46abf3442efb0224
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
defd8f3b22a3b75175c52958d5e7ce0c3ef4c52a 13-Jan-2016 Chong Zhang <chz@google.com> Merge "Several fixes for docking non-resizeable tasks"
f66db43063e4409206f1572fa1bac4f87c431f9a 13-Jan-2016 Chong Zhang <chz@google.com> Several fixes for docking non-resizeable tasks

- Keep track of original task bounds and scrolled bounds separately,
so that we can reset the scrolling when the it's no longer in effect.

- Calculate the vertical offset for the toast on top half using the
content rect. The original toast position was relative to the bottom
of the content rect, not the display rect.

- Move toast display to prepareSurfaceLocked, as performShowLocked() may
not be called if the app surface is already shown.

related-to: b/26451625
related-to: b/26447921

Change-Id: I82113683c9e3c3beb4938dbd0829d0abf491efd9
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
84389571531e48962802a5f90206e326054a3d31 13-Jan-2016 Chong Zhang <chz@google.com> Fix rect convert from screen to surface coordinates with scaling

When there is scaling, the top/left coordinates are also scaled. They
could be non-zero if the app is being cropped (eg. due to two-finger
scroll).

bug: 26451625
Change-Id: I90d537347b312d2438993780f52b023c2332eb68
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
2a88fc31cf16b419fdd23c9841ffdbfe7af9d966 12-Jan-2016 Chong Zhang <chz@google.com> Apply scroll to windows added to a non-resizeble task that's docked

bug: 26447921
Change-Id: I933e277137fb127a9e961035cf48cba2bef52042
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
f596cd519a01d6796c0c2e1e92901a3a5874bb92 05-Jan-2016 Chong Zhang <chz@google.com> Some fixes for docking from navigation bar use case

- Do not set replace window if we are keeping the window.

- After we received the app's addWindow request, do a reset of the
timeout timer to give the app more time to finish drawing. This
reduces the chance of the flash due to the old window being removed
before new window is drawn.

- If we really hit timeout limit, make sure the replaced window
is removed by using removeWindowInnerLocked(), not removeWindowLocked().
The latter does not actually remove the window if it's exiting,
and this leaves the window in the stack and marked not for
for replacing, then it can never be removed.

bug: 26324082

Change-Id: I59594798079481cba9490c4754de1b16533e72fe
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
6d8e06bad4a8cda1893a67ee1014c39c93dca557 05-Jan-2016 Wale Ogunwale <ogunwale@google.com> Don't set replacing flag in starting windows.

When ever an app is changing stacks we set replacing flag on all it's
windows. Starting windows can be part of an apps window list, but is
added by window manager not the app. So, when we set replacing flag
on the starting window it can cause the starting window never to be
cleaned up since we are expecting the client to replace it which will
never happen since it was added by window manager.
We shouldn't be setting replacing flag on starting windows since they
can never be replaced.

Bug: 26294740
Change-Id: I0a4f1e44188e96e73614130cbea02a3860850f58
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
81fe2d1f0adc9e752d7f1a410d66af6a326fd6e2 21-Dec-2015 Jorim Jaggi <jjaggi@google.com> Refine snap position behavior

- Use the stable insets to communicate the system insets to the
docked divider view.
- When calculating the sizes for the snap positions, exclude the
system insets.
- Add 3 snap position modes: 16:9 in one window, 1:1, 16:9 in the
other (phone portrait). Only 1:1 (phone landscape). Fixed relation,
1:1, 1 - fixed relation (tablet portrait/landscape).

Change-Id: If2166c5fb99f12535eeab5de18e9f5aaf433d77c
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
0429f3522bca5bb86378dd3f013f995484ddbed6 22-Dec-2015 Jorim Jaggi <jjaggi@google.com> Freeze task bounds when relaunching

To make sure that task is only laid out with the size
that matches the current configuration, we have to "freeze"
the task bounds when we send a configuration change. Without this
change, it could happen that the app already laid out with the new
task bounds, but still had the old configuration, leading to
wrong layouts.

Bug: 26311778
Bug: 25015474

Change-Id: I8d3a3fdf3735f446a4affbbdb4986dafc97623a5
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
dc249c4ae7c7838928f53f151bfda8a6817b8784 15-Dec-2015 Jorim Jaggi <jjaggi@google.com> Change behavior when resizing docked stack

- Add an API resizeDockedStack to resize the docked stack
and supply temporary task bounds, which can be different from
the stack bounds.
- Use that API in SystemUI to only switch task bounds when
crossing thresholds, so we have less flickering and more
predictable resizing.

Bug: 25015474
Bug: 26311778
Change-Id: Id5c9277dd908ccc28f95dab023efc914757a50d0
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
6cae765b67d3a3b37e2cacbc9816665b5bc080b9 26-Dec-2015 Wale Ogunwale <ogunwale@google.com> Added support for android.R.attr#alwaysFocusable

Allows an activity to always be focusable regardless of if it is in a
stack whose activities are normally not focusable. For example, activities
in pinned stack aren't focusable. This flag allows them to be focusable.

Also, changed ActivityInfo.#{resizeable, supportsPip} to use flags.

Bug: 26273032
Bug: 26034613
Change-Id: I8c63e6d3256757e2e6931e08b8a65269f5169d35
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
bd0d937303ae54d8a5bb5f08080c4164302daefc 29-Dec-2015 Chong Zhang <chz@google.com> Notify client when the window is moved because of a resize

We need to notify the client that the window has moved if a resize
results in a move without size change. This makes sure that relevent
info on client side (such as mAttachInfo.mWindowLeft/Top) gets updated
to the new frame. Things like View.getLocationOnScreen() may depend
on these to function.

Bug: 25565385
Change-Id: I5b9ded0b16243c14494f9a69257d56570ee8996d
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
8216eb2221ad5ad6615d3966f43844268756f3c8 18-Dec-2015 Wale Ogunwale <ogunwale@google.com> Added PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME window flag

Allows us to differentiate between child windows that always want to be
laid-out in the parent frame regardless of multi-windowing mode
(PopupWindows) and those that don't (SurfaceViews).

Bug: 26255254
Change-Id: Icbc245a24f9a38698444196846ddb25016ef7e2a
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
79f268d92ae5e5beca7fd802e973978872e7fa90 18-Dec-2015 Wale Ogunwale <ogunwale@google.com> Correctly set mContainingFrame for PopupWindows in multi-window mode

For child windows we want to base their containing frame on their
parent frame and not the task bounds.

Bug: 26255254
Change-Id: Ic211c31e69df16fdbdb7b7ba2022379c5f4a87c0
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
92e432c30e2304272c2f5b1b33366f32c3d763cf 16-Dec-2015 Filip Gruszczynski <gruszczy@google.com> Refactor and improve window layering.

This CL moves layer calculation into a separate class, so the whole
logic can be encapsulated. It also extracts special cases from the
general loop and instead applies them at the end. This simplifies the
logic in the main algorithm and makes it clearer what needs to happen
for special cases.

Bug: 26144888

Change-Id: I87347bf0198bd0d3cd09e4231b4652ab979f2456
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
a1eb439eee65138280c560f96e2a6896f9c9112c 10-Dec-2015 Robert Carr <racarr@google.com> Move window replacement tracking to window state.

In preparation for supporting replacement of child windows
we make replacement per window rather than per app.

Bug: 26070641

Change-Id: Ifa332086599c125611e430219c9497bae7e2ce31
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
51a1b875c2ba1bf086c849871dd340cfee2ccfaa 08-Dec-2015 Robert Carr <racarr@google.com> Apply cropping to resizing surfaces.

Apply crop to surfaces even while we resize them. In the case of
SurfaceView, the SurfaceView will be much slower to resize than the
main window. Without crop, this causes the SurfaceView to jut past
the bounds of the main window as it is shrinking. With crop we can
ensure the crop moves with the border in the same SurfaceFlinger
transaction.

Bug: 26010823
Change-Id: Ifb32422de8d18363bd956a457e9efe8cf26678e5
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
f34a04cca9b7f34eff533866ec11233777876ebf 08-Dec-2015 Filip Gruszczynski <gruszczy@google.com> Fix freeform to recents animating window being cuttoff.

The window will appear cutoff during the animation if the window was
cropped due to stack or decor bounds before the animation started. We
need to disable the cropping (both from decor and from stack bounds)
for the duration of the animation.

Unfortunately, by disabling cropping of a freeform window to the stack
bounds, we will make it appear above the docked window during the
animation (because the animation will lift the layer). To fix this, we
need to treat the docked stack like the pinned stack and assume it's
always on top for the layering purposes.

CL also includes refactoring of mSystemDecorRect and
mLastSystemDecorRect which can be moved from WindowState to
WindowStateAnimator and made private there.

Bug: 24913782
Change-Id: Idbea99ba04e9449d0563d0c02636f8b4b63087f7
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
0bd180d8880b3d1b9677f154c034a2af840b4796 08-Dec-2015 Filip Gruszczynski <gruszczy@google.com> Improve debugging setup for window manager package.

This moves debug flags to a dedicated class and also provides a
mechanism to either have fine grained tags or one common tag for easier
grepping the logcat. This mimicks the approach in activity manager
package.

Change-Id: Ie8c08b9a3d8b182335ee5547ee05d21b5933db6b
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
13f7be9e0424266be4bf3b5c8c7fdc161e4fe091 03-Dec-2015 Robert Carr <racarr@google.com> Move surface save state tracking to WindowState.

In the current set up, surface saving is managed by the app window
token. So when destroySavedSurfaces is called, all saved surfaces
assosciated with a given app will be destroyed. This causes pretty weird
behavior where hiding child windows can destroy the parent window. We
move this tracking to WindowState and allow child windows to exempt themselves.

Bug: 25780116
Change-Id: I3ab92221d83297092dfd98a71e6a5fe96381de8b
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
a4740c02e6d76fd9f6240978020d182c13474a2a 04-Dec-2015 Rob Carr <racarr@google.com> Merge "Fix repositionChild positioning."
31e2848cc0dcb13ae0d8244a917fb2a4b1c73fbc 03-Dec-2015 Robert Carr <racarr@google.com> Fix repositionChild positioning.

Two seperate issues corrected. First top and left
were swapped as parameters to repositionChild. Second
the recent change to update attributes was incomplete.
Updating the attributes fixes the size and scaling
but its also necessary to update the frame in order
to trigger an update to mShownPosition. Extract and
use a method applyGravityAndUpdateFrame to do so.

Bug: 25791641
Change-Id: Id0b98d587e8acf163121b28eb377c4cf83ebc58b
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
d045c829a470b7c95daaa4786f7164ee8130546c 02-Dec-2015 Wale Ogunwale <ogunwale@google.com> Prevent windows in pinned stack from gaining window focus.

Windows in the pinned stack shouldn't receive input keys, so we prevent
they from gaining window focus so the focus/input keys goes to the stack
below the pinned stack.

Also, cleaned up some code.

Bug: 25580816
Change-Id: Iea1f944d167310233c3dbaea140a4ada568bb815
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
64cdc1458bcf0d09781463a6e421b9b870b09687 30-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Remove dock divider surface when it's not visible.

We achieve the removal by notifying System UI about the visibility of
the dock divider. This way System UI can change visibility of the root
view, which in turn will cause the WMS to destroy or create the surface
as necessary.

Bug: 25844096
Bug: 25683717

Change-Id: Idbc33368db697a059af49106dfadb80c3d7d06c1
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
19723a4a2bca0660f7ee7c29926af285d94ab5a2 26-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Revert "Destroy docked divider surface when it's hidden."

This reverts commit cb5f57bc580d7f73b93c8f504daa4dcd74cdce72.

Change-Id: I1f77e1ccd5382ed57b8e4165afd79db5223f51c1
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
55149303d14adb242f29bf4e91e9428affff9628 25-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Only create surface when showing window if it destroys it when hiding.

The visibility of a window might be toggled to true even when it doesn't
have a surface, which is a case for windows under the lock screen. We
can't blindly create surfaces in that case, but only do it for the
windows that destroy their surfaces when they are hidden.

Bug: 25879215
Change-Id: I6cf2c6810ce02fba0d2207a56de9924c0270dfeb
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
b15758ab7a6481717d0d29612e870d7241061c31 17-Nov-2015 Chong Zhang <chz@google.com> Support scrolling for non-resizeable tasks in side-by-side mode

Display toast when a non-resizeable task is put into side-by-side mode.

Scroll the task upon a two-finger scroll gesture.

bug: 25433902

Change-Id: I69967056a564cfe7773afb80aa7e7ea7167a791a
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
cb5f57bc580d7f73b93c8f504daa4dcd74cdce72 24-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Destroy docked divider surface when it's hidden.

Also includes bunch of small refactorings:
* destroying surfaces is now fully contained within
WindowManagerServices and mDestroySurface can be privatized;
* WMS.isDockedStackResizingLocked can be removed;
* mScreenCaptureDisabled changes from being SparseArray<Boolean> to
SparseBooleanArray, which not only avoids boxing but also makes code
simpler (no need to check for null)

Bug: 25844096
Change-Id: I0e5462760ffbc947ce6dc52ef429fa270ffc6786
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
95cdbd6f6d0fd8f4ec9d68a3ed8845a1ac6aa541 23-Nov-2015 Chong Zhang <chz@google.com> Merge "Fix black wallpaper when docking a non-resizeable task"
0abb20f37425fcde40f56e8dcaf7f191db820415 19-Nov-2015 Chong Zhang <chz@google.com> Fix black wallpaper when docking a non-resizeable task

Separate WindowState.isFullscreen into two methods, isFrameFullscreen()
that returns whether the window frame is fullscreen, and
isObscuringFullscreen(), which returns whether the window is actually
covering fullscreen.

In case of a docking task that's non-resizeable, the window frame is
fullscreen but since the stack is not fullscreen, the window is cropped
to stack bounds and is not obsuring the screen.

bug: 25433902

Change-Id: I7cd80381601fdc1fe87d04608b6a453806920590
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
030979c1e4ad269efa747eb3c03a4b0e3d820f55 21-Nov-2015 Jorim Jaggi <jjaggi@google.com> Don't play animation when docking stack with affordance

Change-Id: I1bb8ae4047e3de3a4ea159e7fad718914b9b5ba7
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
f52dd205b9d31e0edcfdfff4ed98259c07ca38b7 16-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Don't animate move triggered by resizing using dock divider.

Also includes some small, nice refactoring:
* move code that sets the move animation into WindowStateAnimator;
* a few fields can be made private in WindowStateAnimator this way;
* one boolean flag in WindowStateAnimator popped out as unused after
being privatized, so could be deleted.

Bug: 25690109
Change-Id: I8144114244892c4f27aff21455e8e76eddbd039f
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
053c8e4ef4a8cbc89506b661dd6ef51a301a895c 16-Nov-2015 Wale Ogunwale <ogunwale@google.com> Crop window input region to stack bounds.

Prevents the input region of a window from extending outside
the stack bounds. For example, if you have a non-sizeable
activity in docked mode you don't want the app getting touchs
when you tap on the side occupied by the other app.

Bug: 25710884
Change-Id: I044b4e87448fbd3eb51822e6d71e8ed8d06f55ec
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
3cd48043a32a9406980dd0daf49d90704a9ab4dc 16-Nov-2015 Wale Ogunwale <ogunwale@google.com> Set-up dummy animation when setting a replacing window token

Set-up dummy animation so we can start treating windows associated
with the replacing app token like they are in transition before the
new app window is ready for us to run the real transition animation.
This allows us to make the right decisions at various call points
where an animation is expected to be running for a replacing window
but the real animation isn't set yet.

Also, removed unused field indicating if an app token is animating
a replacement window since it was always set to true and checked/set
to the same value as AppWindowToken.mWillReplaceWindow.

Bug: 25645069
Change-Id: Ie216ed5bd60fb2a15da61c7050c9344c48b1c5fb
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
d04690878db8304d59ad7be468639eca7e4d6a21 12-Nov-2015 Chong Zhang <chz@google.com> Merge "Fixes for touch exclusion region"
d8ceb85512f8dc2dac6ef07fc72f89a75095e3d7 11-Nov-2015 Chong Zhang <chz@google.com> Fixes for touch exclusion region

- Evaluate touch exclusion region on per-task basis, instead of per
window. Smallest unit for exclusion is Task, if task has more than
one app window, we still need to use the visible area of the task
to do focus transfer properly.

- Only add back the touch region for focused task after all tasks
are processed for eclusion, otherwise the focused area could be
removed from exclusion incorrectly.

- Skip app windows that's exiting or hidden.

bug: 25494928

Change-Id: I972ba2149431557e7420b1095d9496a6cd821bdb
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
c010798bbd0ebb9c76aedb0ea8457bd77e8d113c 12-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Fix missing dock divider."
ae10080b99b6c3b2fec9b6e4c72f8bdaa379a940 12-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Fix missing dock divider.

When invisible the dock divider would have its bounds adjusted to size
0, 0 and that would be sent to Surface Flinger. When it becomes visible
we immediately adjust the size of the surface, but it's too late for
Surface Flinger and it returns wrong size to the renderer. By not
adjusting the dock divider bounds when it's invisible, Surface Flinger
will always hold good size. The position will be adjusted when the
divider gets visible.

Bug: 25612050

Change-Id: Iab0798d6545ae0f8b46eabfe7e4100079779bd06
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
4c9ba52acad52f1c1087415e04b2a17614707e40 11-Nov-2015 Chong Zhang <chz@google.com> Fixes for dim bounds and touch bounds

- Change dimming and touch related usage to use task's "max visible
bounds", which is the app within a task that's covering the maximum
visible area looking down from top. This solves the problem where
an app pops up a dialog window. We should dimming (and allow touch)
the entire task area, not just the dialog's visible area.

- Fix initial bounds used in drag moving/resizing, this should be
visible bounds of the app main window, not the original task bounds.

- Fix touch region set up for freeform apps, even when task is not
full screen, we should get the max visible bounds first (as freeform
app could have dialogs too).

bug: 25494928
bug: 25487005
bug: 25613403

Change-Id: Ib1c6a1665fb83ded2fcb0a7ea92cf1def5372edd
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
f9ca399362dfba15b25f4348033eee9624363aed 10-Nov-2015 Chong Zhang <chz@google.com> Merge "Fix crash on invalid dimlayer"
eb917324e4f552f3b9c4894edcda38487f06b353 10-Nov-2015 Chong Zhang <chz@google.com> Fix crash on invalid dimlayer

If the app is already removed, don't apply any more dim on the window
that's pending removal. It causes invalid DimState to be added back
to the controller, and we crash as these don't have valid dimlayers.

bug: 25570092
Change-Id: I7e3c56c6eb636fdcb01d9bba90f77b3885e216fb
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
2f40db7357edfc0ccd7753a53b470a161dfebbf2 09-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Fix blink when docking a window."
78a08ee876794586e1d429e67d4b94209415ea5a 09-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Fix blink when docking a window.

We need to be very precise about removing the old window when the new
one is shown. The right moment is immediately after the first frame
of the new window entrance animation gets commited. This requires
more infrastructure and flags, rather than depending on the old ones
and hoping that they will match our needs.

Bug: 25075151

Change-Id: I0fdbf38d0915ded3300d75fc7268e619b574bcf5
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
d153c4f6f014ea37212cf268d9de8b6abb7240fe 07-Nov-2015 Chong Zhang <chz@google.com> Fix flicker when releasing drag of divider

bug: 25564523
Change-Id: I9c19f40f27cc80b8e6e0e98a0d6455941bd624e7
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
8f3978fc35e1084a763e206a1a2a3ec79ecb2eb1 06-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Fix windows disappearing when resizing freeform or docked."
10a80e0b5b2efb3a65b66dfa8b6fee6d0904ea42 06-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Fix windows disappearing when resizing freeform or docked.

Also includes some code clarity improvements: mHasSurface is set using a
setter, some fields get private.

Change-Id: I2f834880493c008fdccf07ff6ebfebd2e26690a9
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
dcf467ca36130aa719a4954da7578217147b20a0 05-Nov-2015 Jorim Jaggi <jjaggi@google.com> Fix flicker at the end of docked stack divider animation

Because w.isDragResize() was still true but we already
cleared the flag of the divider controller that it was
resizing, there was a frame at the end of the resize
operation at which all stack surfaces were placed at 0/0,
leading to a flicker.
Fix flicker at the end of docked stack divider animation

Because w.isDragResize() was still true but we already
cleared the flag of the divider controller that it was
resizing, there was a frame at the end of the resize
operation at which all stack surfaces were placed at 0/0,
leading to a flicker.

Change-Id: I126765a31703e5405687bcc511960a41024eb652
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
a7262a8956ae06cb83e26b6b81f4a1ff6f40907e 03-Nov-2015 Jorim Jaggi <jjaggi@google.com> Immediately start resizing when touching docked divider

Before, the surface was made full-screen only after
a certain amount of time. Now, immediately make the surface
full-screen, as soon as the divider is touched, to make
resizing much snappier.

Bug: 24507122
Change-Id: I9425785fca4e62964a959a432c80a81d346602c5
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
253a20fad8703e21c7298fe66e0f3f53d4e63c14 03-Nov-2015 Jorim Jaggi <jjaggi@google.com> Fix black holes and flickering in docked resizing

When we start a resize with the docked stack divider,
set the surface background to be full-screen, and use
the traditional surface clipping/positioning in window
manager to adjust the size. This ensures that we don't
have any black holes because of asynchronicity (except
at the very beginning, but this can be worked around
later), and the position of the right/bottom activity
is always in sync with the position of the divider.

Also fix a bug in NonClientDecorView where the first
request to draw was dropped (because the thread hasn't
started up yet), and the main thread was waiting for it
indefinitily.

Bug: 24507122
Change-Id: I623bd48d5be64fac2fba45241b84f265944d200d
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
61f39a7b988f6a22681a3f9e0bf8121f72ff88c4 29-Oct-2015 Jorim Jaggi <jjaggi@google.com> Migrate docked divider drawing to SysUI

Move docked divider drawing to SysUI. This let's us have real
time shadows in the future. Keep DockedStackDividerController
for placing/visibility in window manager.

Change-Id: I82c10add626d30f2ba180ee2a21cdbe6ddfe0371
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
63a35e2343468a04e360f0514c6c9dc03068c185 06-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Fix minor problems when resizing/maximizing docked window.

When maximizing the transition should originate from visible bounds, so
the first frame matches what is visible to the user. When switching to
the big surface, we only need to increase the layer by one, instead of
having artificially large value. If we use the large value, it will
cause a flicker over system windows.

Also includes some cleanup, like static imports and necessary logging.

Bug: 24913915

Change-Id: I84d7594622aa639e2008c662f941edf9c20b3202
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
e6a8351bc715999d1e42dcc1003a6eda6c318dd9 04-Nov-2015 Robert Carr <racarr@google.com> Extract application window usage of SurfaceController.

Abstract the usage of SurfaceController from wm w.r.t
application windows in to a new WindowSurfaceController
class. This class tracks boring book keeping, logging,
errors, etc...to lend clarity to difficult policy
code in WindowStateAnimator et al.

Change-Id: Ifcd5d48a51e68564f49e799ae793b320cac88645
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
84cc5e320df461f6b7f2173833e62880ecc5af8e 04-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Split code out from WMS.realyoutWindow.

Change-Id: If57237013d87d864c219e5f6415de3d360cbbe75
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
acf11408fd98515657e43010c7f7a0a83b034628 05-Nov-2015 Chong Zhang <chz@google.com> Discard input events sent to dead window

And add a check to skip repositioning if window doesn't have a
valid input channel.

bug: 25345787
Change-Id: I555eb9a2ce258d77cd69c53c323dc3db646c773f
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
14b4e57c1ba427f07186dbff8491242162028c71 04-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Remove blink during the freeform -> recents transition.

We achieve the desired result by prolonging the last frame of the
animation until recents tells that it drew its content. The CL also
includes cleanup that moves code that depends heavily on WindowState
fields into that class.

Bug: 24913782
Change-Id: I5ee5b18504dd4a86c24033d17eca21cd31936bca
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
112eb8c1f76fff6a670d7c5f85e8c3d656cd3aa8 02-Nov-2015 Chong Zhang <chz@google.com> Save window when an app died while it's visible

- If an app died visible, keep the dead window and leave it on screen.

- Apply 50% dim over the dead window to indicate it's no longer active.

- Monitor touch inputs on the dead window and restart the app on tap.

bug: 24913379
Change-Id: I911da4e6135f2bffaf3b1bbe6f911ff689a278ff
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
c356b2a5371627992084f05bf5ab7b95d80d3967 02-Nov-2015 Rob Carr <racarr@google.com> Merge "Ensure crop rect is scaled appropriately."
9cac3b4d4629f10423e293a77f3c2184ba867817 30-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Fix bug preventing resizing of freeform apps.

Also move the calculation of the touchable region to WindowState, since
it calls many methods from there.

Change-Id: I7f799277f4ed8a62b1ac8240f2b21d31a095a693
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
58f2913f179f430439b4806bc15f8fd1ca6d24e4 29-Oct-2015 Robert Carr <racarr@google.com> Ensure crop rect is scaled appropriately.

Crop rectangles are scaled to layer space. Previously
we were doing this for transformation applied crops but
failing to do so for stack applied crops. This ensures
we never fail.

Bug: 23974105
Change-Id: I82f59a8696b87253f92cd89fe675aaeab0ecb38d
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
bef461f6129044bc092f0c3693bfc122d1acb6d1 27-Oct-2015 Chong Zhang <chz@google.com> Several fixes for saved surface

- Do not save if the exiting app is no longer top of task

- Mark saved surfaces as invalid when recoving memory, they will
be reclaimed if they're hidden.

- Save surface when visibility changed to GONE

- Discard saved surface after rotation

- Misc minor fixes and clean-up

bug: 19940527

Change-Id: I5760c7a7b4bf37ef6bdd39cae793a97cf7579429
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
db20b5f7a1fdb847f2266df0fbae6046dc95c757 23-Oct-2015 Chong Zhang <chz@google.com> Use saved window surface to start entering animation

When app is paused, keep the window surface around. Use it to start
enter animation if size remains unchanged on next launch.

bug: 19940527
Change-Id: Icf88d81f08b59e8bd946e410611f5098b253eb10
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
b6e66624629448b7a8c8d5d1ec62f87ba109546d 26-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Improve infrastructure for replacing windows.

We need to be more precise when removing the window that is being
replaced. We used to depend on the fact that we can remove it after
the first draw of the new added window. However, due to resizing the
old window might reset its draw state and that will trigger a removal
of that window.

We need to add an information about the window that is replacing the
old one and only when this new window draws itself, we remove the old
one.

This improves the transition after maximizing docked window. This is
a situation where first resize operation finishes and immediately
after we have a replacement operation.

Bug: 24914011
Change-Id: Ia8e5bb7872787e663ba23f26588f9c4db1a5e574
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
955b2fc732382022959889e90694801c36b8a71a 15-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Disable stack cropping for docked animating windows only.

Non docked windows should be cropped by the stack bounds when they
animate. An example of this is having both a docked activity and a full
screen activity resuming together. The full screen activity should be
cropped.

Bug: 24913915

Change-Id: I35ed71e7625f2fcdb5c51649be9f33d5773c162c
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
2a6a2c2de8ce2743679f488f056f22cd1adfd726 14-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Change WindowState.mShownFrame to WindowState.mShownPosition.

We never use this field as a rectangle, we only depend on its left-top
corner. Using a frame is only confusing about the purpose of this field.

Change-Id: I5d6e6321db4fa3203bb7e0f1975ae6ddd1ec09bb
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
9b6861911a02a3d1bf22ece1eeabb35ce9e979f5 07-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Fix frequent recreation of dock divider surface."
b537b18110cefc141f2ad35991b16b245b63c230 07-Oct-2015 Wale Ogunwale <ogunwale@google.com> Allow docked mode windows to layout content under screen decors

We previously prevented this because we were not sure which approach
would be better. It seems the preferred approach is to allow windows
to layout content under screen decors except if they are in the
freeform workspace.

Bug: 24365214
Change-Id: I4021154f577368390a5909d8f5a3524b2d716394
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
a6a72d911d3c77d08416df4b5a97175932906a5c 07-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Fix frequent recreation of dock divider surface.

The recreation is triggered by content insets changing on every
move, because the content frame used to be full screen. The content
frame should instead be the same as the frame, and content insets
should always be zeroed.

Bug: 24718795

Change-Id: Ia5435d64bfad951885dbcd4200ba6ffc8b7c7ead
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
0689ae903628f12ff073376b655b9d972533796b 01-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Fix lack of dim layer behind "Power off" window.

This enables dim behind functionality for both tasks and stacks and
groups it inside a controller that manages the dim layers (including
shared dim layers for full screen tasks/stacks).

Bug: 24331704

Change-Id: I0d1ba996d9e00d05e0203166b82268da00fbb35e
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
23c0cc974fb3fdd49f5232e2df903aac2fdb6e7f 29-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Refactoring: create method for marking display as needing layout."
e92179d676e9df89d72f73e8c6eadd157270d86f 27-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Refactoring: create method for marking display as needing layout.

Change-Id: Ib040d053bf5011587d4383e89c6206a783387b72
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
f370a5b3035766dab1237f74a4439eb2dddeb24b 28-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Resizing docked stack by dragging dock divider."
3ddc5d60967a5daa2ebf0ede98b71093bb8cc4ae 24-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Resizing docked stack by dragging dock divider.

Change-Id: Icc9df00446780f8cd81df4654ace07f33346e901
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
cad05a0a1f6643d19a556ebacf70a0130a524d6d 25-Sep-2015 Wale Ogunwale <ogunwale@google.com> Added trace points for task/stack resizing.

Change-Id: I6c812d92f3822528890b5d875c228b5bd1210bff
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
9184ec686072e9343c9dd73cf45324e5e89e042f 24-Sep-2015 Chong Zhang <chz@google.com> Use visible frame instead of task bounds for detecting resize start

Initial task bounds might be adjusted (for status bar, etc.). Touch
should be set up using visible frames instead of task bounds.

bug: 24336351
Change-Id: I944e3185a06c39b451432bdda5ad87880a0482f3
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
466f3216505bd039a285881e06ead631331fe368 22-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Showing docked stack divider window.

When there is docked stack, we want to show a "handle" through which the
user will resize the docked stack. We add it from the system process,
because we want to avoid IPC calls.

Change-Id: If15fd2a0fcb7077446d1ba6c533acb3028a42039
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
cf5c5f2c4ef1a9e151c426ad6a90d2094716932f 22-Sep-2015 Chong Zhang <chz@google.com> Merge "Misc fixes for window moving and resizing"
3005e75585dcda30b64603e320e0711b583624dd 19-Sep-2015 Chong Zhang <chz@google.com> Misc fixes for window moving and resizing

- Do not skip resizeTask if we're starting or ending drag. We need
the relayout because surface mode is changing.

- When we're changing the surface mode, need to wait for the first
draw to finish before we can modify shown frame. Otherwise there
could be 1 old frame displayed with new position, which makes the
window position look a bit off.

- Clean up dragResizing/dragResizeChanged flags.

Change-Id: Ia396d6b88fd616ad57aa8cd24ca7e1161add7205
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
2b19b6046cd7273ddd2818a2fbb8d3f0eaaa623a 19-Sep-2015 Wale Ogunwale <ogunwale@google.com> Don't set input bounds for task to the stack bounds.

3b2658011819cfe1bed61763bb666bde6e919f79 tried to fix a
problem where the task could be dragged outside its stack
bounds. However, the input bounds was been set to the
entire stack bounds which prevented input from going to
other tasks in the stack.
We now intersect with the stack bounds.

Bug: 24201913
Change-Id: Ibb84bc099b6709ceb865f114b5e9857c5ab2ef1a
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
87975b77bcebc786706117c7e8de9c29bd89631c 17-Sep-2015 Chong Zhang <chz@google.com> Merge "Place surface at screen't top-left when doing drag resizing"
5a2f2cb3de21beaa0b760bb0be1928909012f81e 17-Sep-2015 Wale Ogunwale <ogunwale@google.com> Fixed issue with relaying-out sysui when resizing a freeform task.

WindowState.getTask() was returning the focusedApp task for windows
without an AppToken (e.g. status bar, nava bar, wallpaper). We then
check to see if the config associated with the task has changed and
tell the client window to resize if it as. The config would have
changed in this case since we are using the focus app task
(task we are currently resizing) to determine config changes for all
windows without appTokens. Changed the logic so this is no longer the
case.

Also, cleaned-up the use of getTask().

Bug: 23939846
Change-Id: I473671021282695d282a8a2b82d679722273ca09
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
0275e397f482a1f25745a66c5db68c3a6c863951 17-Sep-2015 Chong Zhang <chz@google.com> Place surface at screen't top-left when doing drag resizing

Instead of letting the client render to (0,0) and moving the surface
around, put the surface at a fixed location, and let the client render
to the screen position within the surface.

This fixes the window shaking problem when resizing by dragging window's
top-left corner. The frame rect used in last draw is lagging window
manager's latest bounds for the window, moving the surface's position
would make the window's bottom-right corner appears moving (while it's
supposed to be stationary).

bug: 23793966

Change-Id: Ideb152fc48502f8e9672235f10b044889235e7df
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
61b009e0591df4fcaf5c57c6ce598044263d952f 17-Sep-2015 Wale Ogunwale <ogunwale@google.com> Don't crop home activity windows to stack bounds.

We crop windows to their stack bounds when the docked stack
exists. We don't want to do this for the home activity since
the docked stack isn't visible when the home activity is visible.

Change-Id: Ibb3157dabbb6c979358ddc2098a01c6ddf6540e8
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
3b2658011819cfe1bed61763bb666bde6e919f79 16-Sep-2015 Wale Ogunwale <ogunwale@google.com> Use stack bounds to determine input bounds for window.

We were previously using the task bounds to determine the input
bounds for the window. This doesn't work for the case where the
docked stack is next to a non-resizeable activity/task. In this
case the task is still fullscreen, but the window surface is
cropped to the stack size which isn't fullscreen since the docked
stack is up. By using the stack bounds the input region matches
what is displayed on screen.

Change-Id: Ia4d2b3a7a050eff38d651e511f5822c4428e137d
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
231b06e7d302762a2680fd5f15b41ec7848a439f 16-Sep-2015 Wale Ogunwale <ogunwale@google.com> Increased window resize handle to 30dp.

It was very hard to hit the drag target with 10dp.

Also, centralized dip to pixel conversion with window manager.

Change-Id: Idc8a90dd55113aa731eaaa8b04af6b74a1176546
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
09b21efb97d539543259b33e2da9d4c7a41966c8 14-Sep-2015 Chong Zhang <chz@google.com> Use fullscreen sized buffer for drag resizing

- When drag resizing starts, set the surface size to fullscreen
(plus any surface insets requested by win attrs), so that we don't
reallocate buffers and the buffers don't get rejected by surfaceflinger
due to size-mismatch.

- When drag resizing ends, restore the surface size to the original.

- Update shown frame before setSurfaceBoundariesLocked(), as the top-left
of the window could change, we need to update the surface position. This
fixes incorrect window positing during resizing by corners on top/left.

- When doing tap-detection, skip non-freeformed tasks. This fixes the
bug where clicking near border of a window could dismiss it.

Change-Id: I5dc9fc34ff05685320b8fe5d491b9c066c6726e8
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
8e89b31a62fb9ec5ad33908c5e8e9c7ab2fd949f 10-Sep-2015 Chong Zhang <chz@google.com> Move window moving and resizing handling to WindowManager

- add a startMoving API to initiate a window move from app, once
the move starts WindowManager will take over the event handling.

- detect touch events along window's outside border and start
a resize if necessary

Change-Id: Ic7e8baba34e0aa27a43173e044ffb46e93e219e0
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
24966d4789c7a2054650ec1a5ed7450f0d691224 06-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Refactorings for Window Manager module.

Following improvements were applied:
* extract code from a very large method
WindowSurfacePlacer.performSurfacePlacementInner into
WindowsurfacePlacer.applySurfaceChangesTransaction; smaller methods
are easier to understand;
* WindowStateAnimator.showSurfaceRobustlyLocked can be privatized, it
is only called from one place; also there is unnecessary check for
whether mSurfaceControl is not null;
* prepareAppTransition code can be mostly moved into AppTransition;
it calls mostly methods from this class; as a result some methods
from AppTransition can be privatized;
* requestTraversalLocked can be moved into WindowSurfacePlacer, which
allows mTraversalScheduled to be a private field inside the placer;
this way WindowSurfacePlacer can nicely control and hide the need for
layouts.

Change-Id: I99006c859ef224f5dad933f5c15d2cb2b9738a9e
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
55a309f8e2a972a2f0ef0cd86736d3c2f47a75f6 05-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Maximize animation when activity is relaunched.

This is the first step towards maximize operation animations. It
builds upon preserving old window and starts clip+translate animation
of the new window from the frame of the old window. It mostly uses the
existing infrastructure, expanding the idea of opening apps list to
include also relaunching apps and treating maximize operation as an app
transition.

Change-Id: I7be402bd329c2fe5bf7d53a2a910532286a8b194
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
76cc44f31c6cc20c4bc2d6ec46c4b37da1a811a3 04-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Defer removal of relaunching activity window due to config change.

This is the first step towards having a better maximization experience.
When the window gets replaced during relaunch of maximized activity we
keep the old window around until the new one is added.

Change-Id: Ia8ce26aee6577740cd38096ed2633216a07ceb60
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
4501d23cedbaaa33a7a28a76af61e7b097dc2d66 02-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Refactor layout and surface placement into a separate class.

OMG, WindowManagerService below 10kLOC. Barely.

Change-Id: I7062c10c767c01c08466b3903736ee35b341f2a5
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
1a1d8316757e9529154e297576a574a36f5a763f 27-Aug-2015 Filip Gruszczynski <gruszczy@google.com> Fix multi window thumbnail animation to the top of the screen.

mContainingFrame might be larger than mFrame in the free form stack. We
need to use the final frame to calculate where the animation goes. Also,
instead of detecting full screen and dialog windows, we can just check
if the window is free form to determine if we should use the multi
window animation.

Bug: 23554941
Change-Id: I71969aad5d39974b3da929aeed0b29ef9a71b516
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
f932e56bd8abd737e471e841f175c787c4f20826 20-Aug-2015 Skuhne <skuhne@google.com> Adding a touchable area around a task

To allow task/window resizing through decors drawn
outside the task bounds (e.g. shadows) on the free form
desktop.

Bug: 23324672
Change-Id: Iaf88ec658e235aa74317a0f33d25fee83f959ac3
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
7577c46a243c7843de79e83c177870d8467cb9ee 20-Aug-2015 Wale Ogunwale <ogunwale@google.com> Merge "Moved window manager wallpaper control into separate class"
e8069dcfcff15e060fc397b9ed5ea8b915b1cfa7 18-Aug-2015 Wale Ogunwale <ogunwale@google.com> Moved window manager wallpaper control into separate class

Change-Id: Ia3c12065678992614667dc210d4611a1250ca22b
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
81c524a66480d44b51600abee24c28d66603f15e 12-Aug-2015 Skuhne <skuhne@google.com> Adding move window functionality for free form desktop

This patch adds the capability to move / drag a floating window on
the desktop when it has a non client decor capition.

It also adds the framework necessary adjustments to keep the window
in a visible area without relayout'ing the window upon move.

Bug: 21738328
Bug: 23176762
Change-Id: I0927e98902d8172f58d21c19c249936a81181678
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
f0cae3fd845dd2a84c5833eaa4ff6e3aa565af0a 06-Aug-2015 Wale Ogunwale <ogunwale@google.com> Removed some spammy WindowManager logs.

Bug: 22940651
Change-Id: I0f0e011ef71151c3608b1ee118a94b384dd0a75c
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
e4a0c5722b1d8db95dfc842d716452dbbf02c86d 30-Jun-2015 Wale Ogunwale <ogunwale@google.com> Allow stacks to hold tasks on various sizes.

Tasks are now resizeable just like stacks. Adjusting the size
of a stack will also adjust the size of all it's containing
tasks. This model allows us to be more flexible
in using stacks as workspaces (like you would have in a
desktop environment) and tasks as the resizeable windows
within the workspace.

Also added "adb shell dumpsys window visible-apps" for
getting the list of visible app windows.

Bug: 22068114
Bug: 19182363

Change-Id: I5bf77063252a5abae4e327f6fc42e607091749f9
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
76d2fe42880bd37b80c01fb68c31a4c619ddfdeb 09-Jul-2015 Adrian Roos <roosa@google.com> Fix black keyguard / missing status bar

The status bar window was stuck in the READY_TO_SHOW state
because it was not policy visible, whereas the policy
was waiting for the window to become HAS_DRAWN.

Now BarController also updates states if the window
is READY_TO_SHOW, which in turn allows the window to
become visible and HAS_DRAWN.

Bug: 22072099
Change-Id: I1836c276723ee2205d7d5759be079f02aaa23e2e
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
5e4c382d15968c757fb9c5783cbd420156ea8ad2 09-Jun-2015 Filip Gruszczynski <gruszczy@google.com> resolved conflicts for merge of 17ba2e6c to mnc-dev

Change-Id: I9177f0e994e1e8fba02faf5a13f2dcec950ec5e0
17ba2e6c49b62c8763895aa6b81ffc06d7f3bc34 06-Jun-2015 Filip Gruszczynski <gruszczy@google.com> am aaf1811d: Calculate outsets before window frame adjustment.

* commit 'aaf1811dda607f10ab0f0ae80fd2b2b7cf9d0069':
Calculate outsets before window frame adjustment.
aaf1811dda607f10ab0f0ae80fd2b2b7cf9d0069 05-Jun-2015 Filip Gruszczynski <gruszczy@google.com> Calculate outsets before window frame adjustment.

Bug: 21635628
Change-Id: I2d818e6d543c885dca2d19553bad5ce1adda95a6
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
7c3185e0b45c6fe6e61b9d9da85cc12f8d7f68df 02-Jun-2015 Doris Liu <tianliu@google.com> Merge "Fix calls to Rect.intersect(Rect) in package com.android.server.wm" into mnc-dev
06d582d4e42893e7e061477004d991d35b5f0d78 01-Jun-2015 Doris Liu <tianliu@google.com> Fix calls to Rect.intersect(Rect) in package com.android.server.wm

This CL checks for the return value for Rect.intersect(Rect) for whether
there is actually an intersection before taking the calling rect as the
intersection. In addtion, this CL handles the cases where there is no
intersection (Rect.intersect(Rect) returns false).

bug: 7368679
Change-Id: I7d5ef7059ac432170470a108c0d6dece230ec0b3
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
a61e23f13b970f68c98934d3ec1569a481ddc567 01-Jun-2015 Filip Gruszczynski <gruszczy@google.com> am 35a803be: Only use outsets for full screen windows.

* commit '35a803beec9ce508fd53ab7e4111f2f9f87296c1':
Only use outsets for full screen windows.
35a803beec9ce508fd53ab7e4111f2f9f87296c1 28-May-2015 Filip Gruszczynski <gruszczy@google.com> Only use outsets for full screen windows.

Change-Id: I1d89c314b0f9944dfa417ce066c397073d51466e
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
2217f61e51ba4b19c56b19297c1e9cf74d7d860f 26-May-2015 Filip Gruszczynski <gruszczy@google.com> Revert "Revert "resolved conflicts for merge of 47249f2a to mnc-dev""

This includes the fix for the broken dialog windows. The outsets will
only be calculated and applied if the window is full screen, since
they don't make much sense otherwise.

This reverts commit 4bb6b751fbbb218e8a298db4aa008472a0aa8d31.

Change-Id: I977a85a78c990c1840784dc0be0dddd5a6d84e6b
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
d6623618b28906d058ac61623e11853ebe9ad1de 23-May-2015 Selim Cinek <cinek@google.com> Fixed logspam and handling subwindows with the input consumer

Bug: 21402648
Change-Id: I4c1c73487dfd19ba452ff2077d8541547f149c3b
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
4bb6b751fbbb218e8a298db4aa008472a0aa8d31 23-May-2015 Dianne Hackborn <hackbod@google.com> Revert "resolved conflicts for merge of 47249f2a to mnc-dev"

This reverts commit c7becb7ee78881646251ff4846e63eb6b96bf7ec, reversing
changes made to 8562b08f04c1309cf40db1e749d612b6824f1d12.
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
c7becb7ee78881646251ff4846e63eb6b96bf7ec 21-May-2015 Filip Gruszczynski <gruszczy@google.com> resolved conflicts for merge of 47249f2a to mnc-dev

This is a merge of chin support.

Change-Id: I436b751b3c4aaa6b46cfcdb475e02eedfa5a5635
47249f2a9e49aa9626369517315eafc6b42fd8e9 21-May-2015 Filip Gruszczynski <gruszczy@google.com> am cb89ac84: Merge "Support for devices with a chin." into cw-d-mr1-dev

* commit 'cb89ac84c621e047d81873428325dfd747b90a6b':
Support for devices with a chin.
3e11bf33a6094da92d97702213aa12c67b21c4d1 20-Apr-2015 Filip Gruszczynski <gruszczy@google.com> Support for devices with a chin.

Information about the chin is now part of the config.xml instead of the
theme. It is retrieved by WindowManagerService and passed to the clients
as insets. Clients can adjust their behavior in a way that makes it
invisible to the user, that part of the surface doesn't actually exist.

Bug: 19908853

Change-Id: Iedf57bf3c848201b854f91ffeb3b59187d375c1f
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
6b3e0587a052121fd572fd609abcbc75a89d53d6 28-Apr-2015 Craig Mautner <cmautner@google.com> Merge "Notify client of all window movements." into mnc-dev
4557c08c1574da324759798f0d56782ae2956bef 27-Apr-2015 Craig Mautner <cmautner@google.com> Notify client of all window movements.

Previously only the animated movements were reported.

Fixes bug 19817982.

Change-Id: Icebc723be87aa948b72a2ea7cd94d5a0472990be
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
85b90abdf942f7347a829b9f4c576b02345d2579 28-Apr-2015 Wale Ogunwale <ogunwale@google.com> Set non-starting visible resumed activity as resumed activity for the stack

When ensuring visible activities for a stack we check to see if there is
already a resumed activity on the stack, so if we need to start an
activity that needs to be visible, we start it in the paused state
if there is already a resumed activity in the stack. This was't
taking into account a non-starting, visible, and resumed activity.

One case this can happen is if the currently resumed activity in
the stack becomes translucent and the activity behind it needs to
be started because it was previously destroyed due to low memory.

Bug: 19636839
Change-Id: I31670fd64d3bcbbf41823f51518ca603c7412e92
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
a6ab5c4efbbf438693fa976b54ac84c033109df0 24-Apr-2015 Wale Ogunwale <ogunwale@google.com> Cleaned-up unused session argument.

Change-Id: Iff9d0df5f1643c581767a41a1ba4b1d43e5b45d8
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
de8b3fa6cb2b4d2f5db3beb95c035586f4e9f644 23-Apr-2015 Craig Mautner <cmautner@google.com> Merge "Fix bad crop on clip reveal animation"
80b1f64280829e7d483302c23518e9d937e7340a 22-Apr-2015 Craig Mautner <cmautner@google.com> Fix bad crop on clip reveal animation

For non-fullscreen apps the dimensions of the app window must be used
to set up the animation.

Fixes bug 18392184.

Change-Id: Ia1681e4a2cb74be2f820cb76ddc7c651a5e4aab6
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
b171abbca82044b9f2d1998dd4cb42adfb1113fa 22-Apr-2015 Wale Ogunwale <ogunwale@google.com> Don't limit fullscreen stack window size to parent window size

A previous change limited the size of a window to the parent window
size at max. so that child windows don't extend outside their parent
stack when resized in a multi-window environment. This broke the
wallpaper positioning functionality since the wallpaper is no longer
bigger than it's containing stack so it can't be scrolled. Now, we
only limit the window size to the parent window size if the window
stack is not fullscreen.

Bug: 19434096
Bug: 19225079
Change-Id: I1a8788727e6c4a91da45d8a87850093ef5a24edf
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
6dfdfd6741c5a3dd8d8a49ddbd6ee5dfe2fd292d 15-Apr-2015 Wale Ogunwale <ogunwale@google.com> Added attribute showForAllUsers that deprecates showOnLockScreen

The new name is more meaningful to what the attribute actually does.

Also, force the FLAG_SHOWN_WHEN_LOCKED flag for windows that belong
to acitivties with the showForAllUsers attribute set.

Bug: 20227306
Change-Id: Ifd49166c3ec0e67ae43addc0fb30038523332ea5
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
950fbdff24fc1a76089d14314bc9d66fb346502c 04-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am 6491923d: am 972099c7: am 1d359daa: Merge "Remove the window whose client process has died or become zombie"

* commit '6491923d047be80e073941efb70c4c46c81d1410':
Remove the window whose client process has died or become zombie
972099c752d97ed8235eab59cabc7f722c7fab95 04-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am 1d359daa: Merge "Remove the window whose client process has died or become zombie"

* commit '1d359daa607042417d095aaa83b78befc1b5f8a3':
Remove the window whose client process has died or become zombie
1d359daa607042417d095aaa83b78befc1b5f8a3 04-Apr-2015 Olawale Ogunwale <ogunwale@google.com> Merge "Remove the window whose client process has died or become zombie"
950ee77fc729526f91646f44616e1e62d9eef076 11-Jul-2014 tiger_huang <tiger_huang@htc.com> Remove the window whose client process has died or become zombie

Window Manager Service would fail to report window-resized to the
process which has become zombie. This would cause the window to
freeze screen continuously. In this case, we assume the process has
died and remove its window to recycle resources and to prevent it from
freezing the screen.

Change-Id: Ic7384731bf9a1fa8b9602d4f1dbee7492db126c5
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
f9c814978e41e56d07701a6795d768abbf7b2be8 26-Feb-2015 Wale Ogunwale <ogunwale@google.com> Account for IME and screen decors when laying out a resized window.

* Adjust position of target IME resized window if it is been obscured
by the IME.
* Make sure resized window frame is within content frame so it doesn't
extend to the screen decoration regions.

Bug: 19424276
Bug: 19500488
Change-Id: I561338101697e10ea5072ee65a180dd0155d0da4
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
1fb55286438967f82e305a8449c0528a7cd07fce 24-Feb-2015 Chad Jones <chadj@google.com> resolved conflicts for merge of 57bb5f5c to master

Change-Id: Id5dfe7fc919305658312771a031c0764cef5515c
57bb5f5c8bf1875d2c6843237f518e5a1f9fe597 24-Feb-2015 Joe LaPenna <jlapenna@google.com> am c0c39516: Merge "Hold a wake lock while dozing when display updates are pending." into lmp-mr1-modular-dev

* commit 'c0c395162ff14b83694158663470ad60e065d9a9':
Hold a wake lock while dozing when display updates are pending.
c2932a1be3e320679034212698aff376d5104dbe 21-Nov-2014 Jeff Brown <jeffbrown@google.com> Hold a wake lock while dozing when display updates are pending.

When the display state is DOZE or DOZE_SUSPEND, assume this means
that the AP may go to sleep at any time so hold a wake lock for
a little while starting when traversals are scheduled to ensure
that the AP remains awake long enough to draw and post the frame
to the display hardware.

This patch is somewhat approximate but should be good enough for
most devices today.

Note that the implementation uses the window manager to ensure that
the window which wants to draw is actually visible before acquiring
the wake lock. There is a cost to this test (a round-trip) which
should not be significant today since we do not expect apps to draw
more than one frame or two while dozing. However, if we wanted to
support animations in general, we might want to optimize it or
eliminate the check altogether (since we can already account for
the app's use of the wake lock).

Another way to implement this functionality might be for the view
hierarchy to listen for the power manager to report that it has entered
a non-interactive power state before deciding to poke draw locks.
This would be somewhat more accurate than watching the display state.
Also, the draw lock timeout logic could be implemented more directly
instead of using an ordinary timed wake lock.

Bug: 18284212
Change-Id: I84b341c678303e8b7481bd1620e634fe82cc4350
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
cd3884dfb246855c059e15db376f0935af68d949 18-Feb-2015 Adrian Roos <roosa@google.com> Set the light status flag based on right window

The flag needs to be set based on the top window that is either
reaching beneath the status bar or is dimming.

Bug: 19233606
Change-Id: I7b97f6869e3b7d5ae2b7030122b311ee9e13871f
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
7c72668f19d404b01412abc67937b1b5c660df71 07-Feb-2015 Wale Ogunwale <ogunwale@google.com> Adjust activity display metrics based on stack configuration.

Apps normally use context.getResources().getDisplayMetrics()
or getWindowManager().getDefaultDisplay() to get information
about the screen dimensions. Not all the screen space is available
for apps in a multi-window environment, so we limit the dimensions
of the display object exposed to the app to that of the containing
stack.

Bug: 19225079
Bug: 19354838
Change-Id: I8dc3a6c9b99ecedcca28fc4ddaba9f31feb4f871
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
94596654393f4a9eac972eb6c06eae458e0ba453 07-Feb-2015 Wale Ogunwale <ogunwale@google.com> Limit window display frame to size of containing stack

Some widgets like the PopupWindow use the display frame from
WindowManager to figure-out where to place content. We want to
limit the size of the display frame to the containing stack in
a multi-window environment so widgets and apps don't place
contents outside the containing stack of the window.

Bug: 19225079
Bug: 19286146
Change-Id: I58e2db47f6696260d7641cf5d588c4f2db6aff5a
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
30cc7bf612db01f3bc710dbef85159d3f57eb021 05-Feb-2015 Wale Ogunwale <ogunwale@google.com> Make sure window frame fits in the containing frame.

Bug: 19225079
Change-Id: I6af20cff685dd83f7cc7685a6d987334e023ee8b
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
dd11d4d6d35fd33625116a97e53b1026879b80bf 03-Feb-2015 Wale Ogunwale <ogunwale@google.com> Fixed issue with resized stack sticking to the top of the screen.

WindowState.mUnderStatusBar wasn't set correctly when the stack was
resized before the window was added to it. Changed to use
TaskStack.mUnderStatusBar instead which will always have the
correct answer.

Bug: 19204013
Change-Id: Ib4660302c6a2aebd47bff354c1efab93a1e1a255
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
783f28691e27b7b116730fad4f9fd9c083bab283 27-Jan-2015 Wale Ogunwale <ogunwale@google.com> Merge "Support activities in the same process having different resources."
83162a90278d9d52d8fca7ee20ba314b452261de 26-Jan-2015 Craig Mautner <cmautner@google.com> Eliminate groupId and add task to AppWindowToken

Simplifies access by eliminating indirect referencing.

Fixes bug 18088522 item #15.

Change-Id: I9049192a7f3e1028d60c4f2d4d4a0d4aad590aa4
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
60454dbc4d815c90ff2713e224953d6547fc3ad5 24-Jan-2015 Wale Ogunwale <ogunwale@google.com> Support activities in the same process having different resources.

Activities can be of various sizes in a multi-window environment.
This change allows them to have override configurations that allows
different resources to the loaded if needed.

Bug: 19002213
Change-Id: Ib2c7be0b427f5ce05e7a362bcdd496ddbc9164f0
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
9c69c3199637d33d2db754f53a3f3161b7df7153 09-Dec-2014 Adrian Roos <roosa@google.com> am 87427ce5: am 456e6674: Merge "Revert "Fix calculation of overscan insets in WindowState."" into lmp-mr1-dev

* commit '87427ce5035e860b5d90e8a1788ee44e31bec504':
Revert "Fix calculation of overscan insets in WindowState."
3236f3a93acab03ad2f0cf68faf39273ffb8e2a7 09-Dec-2014 Adrian Roos <roosa@google.com> Revert "Fix calculation of overscan insets in WindowState."

This reverts commit ff778fe450ca2d0e554aa6aee7a9da1cda46d4d5.

Bug: 18659737
Change-Id: I1efc59edfb8ded946cc14f5c4d6f532ac291bd81
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
73f0e9a3feec091f67c9db00ce2d3116b6d91fbd 08-Dec-2014 Filip Gruszczynski <gruszczy@google.com> am 91a5dd9b: am e6a2ff2b: Merge "Fix calculation of overscan insets in WindowState." into lmp-mr1-dev

* commit '91a5dd9b435982eaad9ac4d8443199d260ef7208':
Fix calculation of overscan insets in WindowState.
ff778fe450ca2d0e554aa6aee7a9da1cda46d4d5 05-Dec-2014 Filip Gruszczynski <gruszczy@google.com> Fix calculation of overscan insets in WindowState.

Bug: 18630625
Change-Id: I19b0c8627c3b9d61923e68c59fce9bddb2751c3d
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
1da25f9331892be262289e3ce00dde23e685db03 22-Nov-2014 Olawale Ogunwale <ogunwale@google.com> am 50884b5b: am f1058308: Merge "Add window to child window list with correct order"

* commit '50884b5b65516a9f2233d9e8349c41843f137dca':
Add window to child window list with correct order
e2a98a7492a44170f70f4d564372b5ac97090c21 13-Nov-2014 tiger_huang <tiger_huang@htc.com> Add window to child window list with correct order

The original logic of comparing with mBaseLayer of two child windows
of the same parent was wrong, because the mBaseLayer is always the
same.

After adding two child windows with the same positive sublayer, the
one added later should have greater z-order. The order should be
consistent with WindowManagerService.addAttachedWindowToListLocked()

Change-Id: I789179aee61d141fad86bd24262fabfb1e517e66
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
44f60cca7bb31e2f9b4b7bf25bb2e0cfb0e3e1e1 07-Nov-2014 Jorim Jaggi <jjaggi@google.com> Fix lockscreen launch animations once and for all

In SysUI, make sure not to dismiss Keyguard multiple times when just
waiting for a deferred dismissal, so WindowManager doesn't get
multiple calls to keyguardGoingAway.

Change heuristics how notifying Keyguard about activity drawn works.
Always notify Keyguard after executing an app transition, and notify
it also when not doing a transition after a startActivity call.

For that to work, update AppWindowToken.startingDisplayed also when
the window is displayed, but force hidden because of Keyguard.

Further, handle the case correctly when a window gets added during
the Keyguard exit animation by overriding the start time for the
animation of that new window. Also don't apply a transition animation
for a window when executing keyguard exit animation, so by removing
a starting window we don't break this animation.

Last but not least, tell Keyguard to start exiting immediately if
animations for exiting are disabled, like when going to phone/camera
on lockscreen. Before, we always had a delay of 1 second because we
waited for the timeout.

Bug: 1599196
Bug: 18272544
Change-Id: I596b2489f814b934abd256e16079d3d3f326e209
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
c0d2d0ad6ddcd23b7bbe6b1a5668d6d719e4c86c 01-Nov-2014 Craig Mautner <cmautner@google.com> Animate starting windows when keyguard dismissed.

Starting windows are displayed prior to their app windows visibility
being set. Consequently the WindowToken.hidden boolean for starting
windows is still true even when it is shown. The keyguard logic uses
the method WindowState.isVisibleNow to determine whether to animate
each window. This method incorrectly determined that starting windows
were not visible based on WindowToken.hidden and consequently didn't
animate in the starting window.

This change fixes isVisibleNow() to correctly determine when
starting windows are visible and animates them in as part of the
keyguard transition.

This change also adds keyguard debug.

Partially fixes bug 15991916.

Change-Id: Iac3e5f3f33876be5801ec619bbe7a1579e648322
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
674f55e515d0895475d136f7793f6ce9929d859c 28-Oct-2014 Wale Ogunwale <ogunwale@google.com> Merge "Added documentation for various window frame types." into lmp-mr1-dev
c6061fa78822080e5b7849b243611a778da6c198 21-Oct-2014 Wale Ogunwale <ogunwale@google.com> Added documentation for various window frame types.

Change-Id: I56cacc41634ea0f3c8fbc509522d9260231964ab
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
393b1c1e88cbdd0f65c8f217c495dbbe8de9125d 19-Oct-2014 Wale Ogunwale <ogunwale@google.com> Fix issue #17789629: PopupWindow overlaps with navigation bar.

The Lollipop release introduced a feature that allowed
apps to extend under the navigation bar. This also means
any popup window that is anchored to the bottom of its
parent window will overlap with the navigation bar if the
parent window is extending underneath the navigation bar.

This change introduces a new window flag
(FLAG_LAYOUT_ATTACHED_IN_DECOR) that allows the app to
specify if the popup window should be attached to the decor
frame of the parent window thereby avoiding an overlap
with the screen decorations.

By default the flag is set on SDK version LOLLIPOP_MR1 or
greater and cleared on lesser SDK versions.

Also, replaced flags FLAG_NEEDS_MENU_KEY and
PRIVATE_FLAG_NEEDS_MENU_KEY_SET with needsMenuKey state
variable to make room for the new
FLAG_LAYOUT_ATTACHED_IN_DECOR flag.

Bug: 17789629
Change-Id: I2150e0c6ac688c966c0e8f7e54d42fd20285bea6
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
8eb48d26ccbde07140da3e798ca32182814ea237 24-Sep-2014 Chet Haase <chet@google.com> Avoid drawing the starting window twice

Logic in WindowState caused a delayed layout on the starting window,
which forced another layout/draw pass, which was unnecessary. Making
the resize call happen sooner means that that request gets lumped in
with a pending layout request, so there's only one resulting draw.

This saves not only the second drawing operation, but also the creation
of an extra buffer in SurfaceFlinger for that second draw request. This
buffer is temporary, but can be quite large on some devices and push
the system over the memory edge in extreme situations. It's difficult
to track this memory usage difference as the buffer resides at a very
low level in the system. But you can see in systrace that the second
allocation (and the second draw) is not happening after the fix.

Issue #17570761 Constrain starting window to only one buffer

Change-Id: I0e0fff7efdc812730706afccbfb020dea3f8d3e2
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
067e5f68b9216b233df1c6529db182ff9b2887ab 08-Sep-2014 Dianne Hackborn <hackbod@google.com> Add new wallpaper features for insets and offsets.

Issue #17394151: WallpaperService / Engines need to get notified
of WindowInsets

Issue #17394203 Wallpapers need a system API to be shifted in order
to support burn in protection

Adds a new API on WallpaperManager to set additional offsets to
make wallpapers extend beyond the display size.

Insets are now reported to wallpapers, to use as they may. This
includes information about the above offsets, so they can place
their content within the visible area. And to help with this, also
expose the stable offsets APIs in WindowInsets which is also very
useful information for the wallpaper.

Another new API on WallpaperManager to set a raw offset to apply
to the wallpaper window, forcing it to move on the screen regardless
of what the wallpaper is drawing.

Fix wallpapers when used with overscan enabled, so they still extend
out across the entire screen. Conveniently, the above new window
insets information is very useful for this case as well!

And a new wallpaper test app for all this stuff.

Change-Id: I287ee36581283dd34607609fcd3170d99d120d8e
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
c2f20b66fd28c10e2ec8654bd74cb501eb7f837b 08-Aug-2014 Amith Yamasani <yamasani@google.com> No need to send PRE_BOOT_COMPLETED for new users

Since the primary purpose is to upgrade databases, no need
to send this broadcast. If system apps care to be informed early
on new user creation, USER_INITIALIZE is an early broadcast.

Also remove some logs that spew when switching users.

Bug: 16846465
Change-Id: Ibd7f8630ce1f41f8cadbda616de05844b127d1a8
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
fa10423fa00f3495e451016acba9b6848eb995c9 21-Jun-2014 Adrian Roos <roosa@google.com> Add stable insets for stable system windows

Adds a new kind of inset that only accounts for stable system
windows like the system or navigation bar.

Bug: 15457292
Change-Id: I681b711f6f40a94c25b7acd3a44eb3539486afab
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
f391ebccea9090fac64201d284641be3882f857a 13-Jun-2014 Chad Jones <chadj@google.com> resolved conflicts for merge of 4849aa86 to master

Change-Id: I7ec55bdb7a3a1618f33dfdb3b19b2bd201789677
be63495101dba3b0c3c496cdd810df9e30e926d4 12-Jun-2014 Craig Mautner <cmautner@google.com> Fix permission problem and NPE

Remove uid before calling into Window Manager. Restore afterwards.

Check for null stack value before dereferencing.

Fixes bug 15591112.

Change-Id: Ida3de556940440162c91b8c1614d0f21e364abd8
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
f7174e87b6007000777b0124de9cef70d8618788 12-Jun-2014 Svetoslav <svetoslavganov@google.com> Fix backwards compatibility for introspected windows.

1. The APIs for introspecting interactive windows were reporting only
the touchable windows but were missing the focused window. The user
can interact with the latter by typing, hence it should always be
reported. Also this was breaking backwards compatibility as if the
focused window is covered by a modal one, the focused window was not
reporeted and this was putting the active window in a bad state as
the latter is either the focused window or the one the user is touching.

2. Window change events are too frequent as on window transition things
are chanign a lot. Now we are trottling the windows changed events
at the standard recurring accessibility event interval.

3. Fixed a wrong flag comparison and removed some unneded code.

buy:15434666
bug:15432989

Change-Id: I825b33067e8cbf26396a4d38642bde4907b6427a
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
4604abc97d7dd757bb76ff9b7fcf343dc4a15212 11-Jun-2014 Svetoslav <svetoslavganov@google.com> Moving and resizing windows not reported propely for accessibility.

When the position and size of a window changes we have to report that
to the accessibility layer if the window introspection is enabled.

bug:15569915

Change-Id: I3f869e0a582592bfa5f3743d5c2133ee8cb39b34
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
e30e02f5d9a9141c9ee70c712d4f9d52c88ea969 28-May-2014 Dianne Hackborn <hackbod@google.com> Add system layer for voice interaction services.

New window layer that voice interaction service windows
go in to. Includes a new voice-specific content rectangle
that voice activities are placed in to.

Add specific animations for this layer, sliding down from
the top (though this can be customized by the voice interaction
service).

Also add the concept of activities running for voice interaction
services for purposes of adjusting the animation used for them,
again sliding from the top, but not (yet?) customizable by the
voice interaction service.

Change-Id: Ic9e0e8c843c2e2972d6abb4087dce0019326155d
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
47a3e65acc35cd3061bf3867e8b20753870fd892 22-May-2014 Winson Chung <winsonc@google.com> Small perf tweaks.
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
19ab828aa581e398e50c6f42ff4863c6ee522203 07-May-2014 Craig Mautner <cmautner@google.com> Account for windows on non-app display.

When an app launches a window on a different display than the one
the app is on, make sure and return the window's display, not the
app's display.

Fixes bug 12906650.

Change-Id: Ie418db023672f7944729fc60d457c4c1d850dc1f
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
ffa80df57848a41aeba692d177c701676c58c65f 02-Apr-2014 Kenny Guy <kennyguy@google.com> am 1ccace91: Merge "Rename related users to profiles."

* commit '1ccace916c8fdc61f1a8db6677aed518d31647e6':
Rename related users to profiles.
2a764949c943681a4d25a17a0b203a0127a4a486 02-Apr-2014 Kenny Guy <kennyguy@google.com> Rename related users to profiles.

Rename the related user concept as profiles.
When returning profiles of a user include the
user as a profile of itself.

Change-Id: Id5d4f29017b7ca6844632ce643f10331ad733e1d
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
380ecb81db52a9d0197ca969951d07b91c20d2b9 14-Mar-2014 Jorim Jaggi <jjaggi@google.com> Make Keyguard a library and make StatusBar the new Keyguard.

This change achieves a couple of things:
- Let Keyguard be a library, so we can use it in SystemUI.
- Introduce FLAG_KEYGUARD for windows and deprecate TYPE_KEYGUARD. Make
all the TYPE_KEYGUARD behaviour dependant on the flag.
- Implement a new KeyguardService in SystemUI, and bind that service
from PhoneWindowManager.
- Introduce BaseStatusBar.setKeyguardState and inflate
KeyguardSimpleHostView there and use FLAG_KEYGUARD for the window, such
that the status bar window essentially gets the Keyguard.

Bug: 13635952
Change-Id: I059d80d8b9b9818a778ab685f4672ea2694def63
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
9cf34e2ee4cb3d2e14c2863298ad3a2fafc31d39 23-Mar-2014 Craig Mautner <cmautner@google.com> Revert "Apply FLAG_SHOW_WHEN_LOCKED within tasks."

This reverts commit f7ad855718dc576a1618a54035b82e92356aa0d8.

After careful consideration this would prove to be a security leak to leave it in. Tasks could deliberately launch dialog activities that don't want to be seen in an unsecure setting. These would then be visible over the task background.

Change-Id: Ia7e984bc9616573af6c7772f6ea0f2dd588bb85d
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
f7ad855718dc576a1618a54035b82e92356aa0d8 21-Mar-2014 Craig Mautner <cmautner@google.com> Apply FLAG_SHOW_WHEN_LOCKED within tasks.

If the bottommost fullscreen window of a task has FLAG_SHOW_WHEN_LOCKED
set then show all windows of the task that are above that window.

Fixes bug 13558398.

Change-Id: Ied8ada54efbb079eaf375470b2eae749e5551c24
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
734983fff35d9ed2b7a9848bdfbca401887d0dd8 05-Mar-2014 Amith Yamasani <yamasani@google.com> Allow related users to show activities on primary user

Make ActivityManager and WindowManager understand related users.

Task stack will now contain interleaved tasks for related users,
but still group regular users separately from groups of related users.

InputMethodManagerService permits related users to invoke IME and receive
key events.

Change-Id: I3bd87b32aec69c3f8d470c8b29b144f4e849c808
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
38f7dcd7dcb5d98d86f19f3c4725aea89f9792ff 06-Feb-2014 Craig Mautner <cmautner@google.com> DO NOT MERGE. Test for Configuration differences before changing.

Changing Configuration first and then testing for changes yields a
result indicating no change.

Fixes bug 12904769.

Change-Id: If7e39e843f15b1143d9877497d595511afabd020
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
d1c2c5421181b988f09fd12d9633e2a7c2a8ab60 06-Feb-2014 Craig Mautner <cmautner@google.com> Test for Configuration differences before changing.

Changing Configuration first and then testing for changes yields a
result indicating no change.

Fixes bug 12904769.

Change-Id: If7e39e843f15b1143d9877497d595511afabd020
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
df88d73092c62a1a3cd2b2056ca63ae2e70cc238 27-Jan-2014 Craig Mautner <cmautner@google.com> Add IIntentSender to ActivityContainer.startActivity

PendingIntents and IntentSenders can now be launched. Still does not
work once the host activity has been paused and resumed.

Window manager TaskStacks now exist independently of Displays and app
windows persist after Displays are removed below them. Attaching the
stack to a new Display does not yet restore the windows to it.

Fixes bug 12747909.

Change-Id: I509007ee23fda400b353f483cf6ecce08177763b
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
e0a3884cb627efc650e19fbe76b1b3343468cf57 17-Dec-2013 Craig Mautner <cmautner@google.com> Extend stack management to other displays.

- Abandon ActivityContainer.startActivity() in favor of
IActivityManager.startActivityAsUserInContainer().
- Modify Am to test starting an activity on a container.
- Create a DisplayContext as the base context if the activity token
is on a different display.
- Test for home display in more cases when manipulating home stack.
- Rename mDisplayInfos => mActivityDisplays.
- Create new method for moving task to front of stack regardless of
which display it is on.

Change-Id: I4fcb83ae844c5839ee3e2722229623d1a80ed921
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java
9158825f9c41869689d6b1786d7c7aa8bdd524ce 22-Nov-2013 Amith Yamasani <yamasani@google.com> Move some system services to separate directories

Refactored the directory structure so that services can be optionally
excluded. This is step 1. Will be followed by another change that makes
it possible to remove services from the build.

Change-Id: Ideacedfd34b5e213217ad3ff4ebb21c4a8e73f85
/frameworks/base/services/core/java/com/android/server/wm/WindowState.java