History log of /frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e9dc82ee4d94e76ab76aade84acde5a870b2aba8 23-Jun-2017 Wale Ogunwale <ogunwale@google.com> Fixed some rotation while unlocking screen issue.

- Don't use snapshot that is in different orientation than the current
display orientation. This is a follow up to a previous CL whose
implementation wasn't complete.
- Disabled fixed for unnecessary relaunches when unlocking with
fingerprint sensor introduced in ag/2310557. This causes regression in
the experience from N. We still have the relaunches, but we cover up the
delay by displaying the apps starting window.
- Added more trace log points.

Fixes: 62796190
Fixes: 62904487
Bug: 38494778
Test: go/wm-smoke and manual verification of bug.
Change-Id: Id161a334cb4455dd9eb25c6bb63d5bb3f8a6f1f0
(cherry picked from commit dfb7fb259828a6cfa222b76398da9e430e94fd90)
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4958ad283f06452480569f317feea862ad5981e4 22-Jun-2017 Wale Ogunwale <ogunwale@google.com> Added more systrace points to window manager

To help debug performance issues

Test: external/chromium-trace/systrace.py -t 3
Bug: 62796190
Change-Id: Ie6012a895174053c4732fb58b9365546fdb979de
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2ca51820f038fe612bc39906b40825b537ff54e5 15-Jun-2017 Sudheer Shanka <sudheersai@google.com> Merge "Use correct timestamps of events for logging." into oc-dev
7831f0c436fd7a3dfa7a12764cdac929c996187c 15-Jun-2017 Jorim Jaggi <jjaggi@google.com> Merge "Actually do not hold WM lock while closing transaction" into oc-dev
04c3cc6d12012dcb39f8aef9a07143d91328ba77 15-Jun-2017 Jorim Jaggi <jjaggi@google.com> Merge "Use splashscreen if we can't fill horizontaly with snapshot" into oc-dev
e9ff4606449c075d464e667410392e23afab7a45 15-Jun-2017 Jorim Jaggi <jjaggi@google.com> Actually do not hold WM lock while closing transaction

Test: go/wm-smoke
Test: Quick switch 100x, observe no delay
Change-Id: I46022a23f749c52ba7f46e105679d728277970bd
Fixes: 62444483
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
42befc64c43377bfcec0e8cfe6fbcb9fdf5f0953 13-Jun-2017 Jorim Jaggi <jjaggi@google.com> Use splashscreen if we can't fill horizontaly with snapshot

A gap at the right side of the snapshot looks pretty bad. Thus,
we use a splash screen in case there would be a gap on the right
side. However, we don't want to do this from recents as we'd
produce another flicker

Test: go/wm-smoke
Test: Open app portrait, go launcher, rotate, open app landscape
Test: Open app landscape, go launcher rotate, open app portrait
Fixes: 62094756
Change-Id: Iaf1fecced822685187477a4698fa6b67c6e485d7
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8ab4d1114564d725e8a2e6da1bd1be9eab76eb7d 13-Jun-2017 Bryce Lee <brycelee@google.com> Merge "Address issues surrounding freezing by display." into oc-dev
c766db0a54679cd67884d7366cee8b6e8ecd447c 12-Jun-2017 Sudheer Shanka <sudheersai@google.com> Use correct timestamps of events for logging.

Currently when WM detects certain events, it will notify the logger
of these events asynchronously and logger uses the timestamp at which it
gets notified to log these events. It's possible that the delay between
when the event actually occurs and when the logger gets notified could be
large. So for better accuracy, WM should also pass on the event timestamp
to the logger.

Bug: 62375480
Test: Triggered sysui_multi_action event logs and verified that
APP_TRANSITION_DELAY_MS is less than APP_TRANSITION_WINDOWS_DRAWN_DELAY_MS.
Test: When the system is not busy, the timestamps we used to log earlier
and timestamps we log with this change are almost same.
Change-Id: I5f62654a6b7f179d821c0082b180246c8a569df1
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d18712695c6b8861e6b22f9ef64709022ae94ee1 12-Jun-2017 Bryce Lee <brycelee@google.com> Address issues surrounding freezing by display.

The first issue is the animating a display as a consequence of the
freezing due to configuration change during construction. This
additional animation is not expected and interferes with tests
expecting for the original display contents to be shown intact. This
CL addresses the issue by not freezing while the display is not ready
(before construction is finished).

The second problem addressed is book-keeping for
DisplayContentsAnimators in WindowAnimator. Currently, a getter
method is used internally to reference these animators, which
generates them if not present and adds them to the animation
iteration. In the case we set an animation on a display that no
longer exists (which can be the case after unfreezing), we end up
recreating this object. This can lead to us trying to animate a
non-existent DisplayContent. This CL prevents creating an animator
for a non-existent display and adjusts the methods using this getter
to handle this case.

Fixes: 62460846
Fixes: 62461229
Bug: 35486733
Bug: 62541591
Test: go/wm-smoke
Test: open and close projected android auto mode repeatedly and
ensure display correctness
Test: cts-tradefed run singleCommand cts-dev --module CtsMediaTestCases --test android.media.cts.EncodeVirtualDisplayTest#testEncodeVirtualDisplay

Change-Id: I60ade6f97440c8fa01b10e36c019865cf1fd0730
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4a526c124554e75dc4bc11a682645a73bd47d501 16-May-2017 Winson Chung <winsonc@google.com> Ensure that we use SF Vsync Choreographer for the PiP transition.

- Move the bounds animation onto the animation thread
- Remove existing code referencing the old sf-vsync choreographer
- Add ability for ValueAnimator subclasses to reference a different
AnimationHandler, which uses a different FrameCallbackProvider with the
sf-vsync choreographer in the animations that require it
- Ensure that PiP touch events are batched and sent aligned with the
sf-vsync
- Move GC onto its own thread to not block other BackgroundThread calls

Bug: 36371375
Test: android.server.cts.ActivityManagerPinnedStackTests
Test: bit FrameworksServicesTests:com.android.server.wm.BoundsAnimationControllerTests
Test: go/wm-smoke

Change-Id: I6a41b35a4e4d4d6dbea82c2673452825fe3ffa58
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f1285916c3ab259b216e5f3da3dba397c8e898b8 10-Jun-2017 Wale Ogunwale <ogunwale@google.com> Added 'dumpsys activity lastanr'

Allows for dumping the activity state during the last anr. This will
also be included in collected bug reports.

Bug: 38121026
Test: Cause an anr to occur and run 'adb shell dumpsys activity lastanr'
Change-Id: I1e4200f9e5cc16bfab98e5af31fc599cdd54cd11
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
245281c056a5b880486671157b48d6c4e5815ce1 07-Jun-2017 Jorim Jaggi <jjaggi@google.com> Boost android.anim and wm lock sections to -10 during transition

-4 is not enough if we have to compete against RT and main thread
from top app that have -10. Boost it more during app transitions

Test: Inspect systrace, make sure priorities are right, including
getting reset after the transition.
Test: Open Chrome 100x
Test: go/wm-smoke

Change-Id: Id6b060b8aafded67b4bae61b6e8960e37976b096
Fixes: 36631902
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
fdb3d31504bdaaad923d4add22cec9ba1ed5585f 08-Jun-2017 Jeff Sharkey <jsharkey@google.com> Merge "Add timeout to StrictMode flash." into oc-dev
65ac7619f9f6dceb83c26ce1a1bf7bfbaf2f57da 07-Jun-2017 Jeff Sharkey <jsharkey@android.com> Add timeout to StrictMode flash.

Consider an app that requests that a StrictMode border be shown, and
then immediately crashes. We'd end up showing the bars indefinitely,
which is a terrible UX.

This CL enqueues a second message to tear down the bars if nobody
asks for them to be taken down within 1 second.

Test: manual app that crashed after showing violation bars
Bug: 37787765
Change-Id: I45d2078d0dcaa94e8f24087d028f5f06d12c4349
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
08b953dd2eb6545d21f78ba5584937ffd53d2194 06-Jun-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Disabled task snapshot for TV" into oc-dev
e681cecd85283ead9f7489dde6088518d750ae69 06-Jun-2017 Keyvan Amiri <keyvana@google.com> Disabled task snapshot for TV

This was causing memory leaks when opening/closing Apps view. Will
disable this feature on TV since we are running low on RAM.

Bug: 62040693
Bug: 62359697
Test: go/wm-smoke
Change-Id: Ida290e8babc83a998a55efd10d602eb7f05f3102
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8f85358fe4bab8ac3ca0b77905d51725a531a436 06-Jun-2017 Bryce Lee <brycelee@google.com> Associate freezing display with a target display id.

Currently, start/stop freezing is always associated with the default
display. As a result, any animations that result from freezing will
occur on the default display. One situation this happens is during a
configuration change, where a screen rotation can be triggered. In
the case of adding a secondary display, a configuration change is
always triggered to apply the override configuration at the display
level. As a result, the default display exhibits a rotation animation
upon unfreezing during surface placement.

This changelist passes down the display id associated with the action
so that the animations may be applied to the right display. In the
scenario described perviously, the secondary display id is passed down
and therefore is the target of the rotation animation during
unfreezing.

Fixes: 35486733
Test: go/wm-smoke
Test: cts-tradefed run singleCommand cts-dev --module CtsViewTestCases --test android.view.cts.SurfaceViewSyncTest#testSmallRect
Change-Id: I87e56f5901934327fc50b3c7e543b5e36b8ff34f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2c9f203aad9df59171be155c45b7ed2654499d6a 02-Jun-2017 Wale Ogunwale <ogunwale@google.com> Track added/removed window when focus is null

Improves the blaming of ANRs by determining if an app added windows
after it was launched.

Bug: 38121026
Test: Log inspection
Change-Id: Id86c1981150cf546c92d786ad45d5c2dda5573e0
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
39e8819755aa3581a8faea7d14a17023258b69a4 31-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Added missing lock and clean up locked function that wasn't locked" into oc-dev
4e73123c5238000afed9c11ec1d2e52a8114c117 31-May-2017 Winson Chung <winsonc@google.com> Merge changes from topic 'hw_bitmap' into oc-dev

* changes:
DO NOT MERGE Updating AnimationSpec and related internal APIs to use GraphicBuffer.
Update code to draw into hardware bitmaps.
aa7fa0135366b80d9bfdb7dffb6795b365a40607 25-May-2017 Winson Chung <winsonc@google.com> DO NOT MERGE Updating AnimationSpec and related internal APIs to use GraphicBuffer.

- This reduces the copy of the hardware bitmap when it is
parceled/unparceled.

Bug: 38507414
Bug: 62021436
Test: Launch Overview to/from app, ensure that the header bar shows
Test: go/wm-smoke

Change-Id: I85a9a59a0a3699d1642158061d10fddef34393c3
Signed-off-by: Winson Chung <winsonc@google.com>
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
bfa81adfbe1819d55737dbbb2fb9157e50dbe022 25-May-2017 Wale Ogunwale <ogunwale@google.com> Fix unnecessary relaunches when unlocking with fingerprint sensor.

When the device is unlocked using the fingerprint sensor in an
orientation opposite to the lockscreen orientation, the app that
will be visible is first relaunched in the current lockscreen
orientation and then later relaunched in the correct orientation.
If the keygaurd is going away then:
- Don't let keyguard affect device orientation. We want to use the
orientation of the app that will be visible.
- Allow the rotation sensor to be enabled even though draw isn't
complete so window manager can get the updated or last rotation
reading.
- Don't clear the previous proposed sensor reading to allow
window manager to use the information to update the orientation as
needed vs. falling back to the previous orientation.

Change-Id: I8369723d6a77f2c602f1ef080371fa7cd9ee094e
Fixes: 38494778
Test: Launch an app that doesn't fix orientation like clock, hold
the device in landscape, press the power button, unlock the device
using the fingerprint sensor, and verify the the app isn't
relaunched.
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d79885346055a8b256823b76c68b62df51bca2e9 31-May-2017 Matthew Ng <ngmatthew@google.com> Added missing lock and clean up locked function that wasn't locked

There was a missing lock that systemui would call to register a docked
stack listener. Since it was missing, it is assumed that two threads
went into a race condition which caused it to crash when handling begin
before finish broadcasts for the same DockedStackDividerController.
Also moved getDefaultDisplayContentLocked call that was not locked to a
locked area.

Change-Id: I3c7ef805024aaf0f5f7c4ab68fc779797114a038
Fixes: 62104210
Test: go/wm-smoke
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ff4cc4ebb516a39c6f3252a240a57646c3354484 19-May-2017 Keun-young Park <keunyoung@google.com> Merge "Wait for keyguard draw before stopping boot animation" into oc-dev
4136d2d54b986a09b237aee30974d3c00d308338 08-May-2017 Keun-young Park <keunyoung@google.com> Wait for keyguard draw before stopping boot animation

- Add check for keyguard drawn before stopping boot animation.
Otherwise blank screen can happen.
- Bind to keyguard service when sysui is launched to reduce waiting
time later.
- Increase keyguard timeout to 5 secs if it is not boot completed.
Otherwise (= normal screen on), keep the current 1 sec.
This timeout can still lead into blank screen so use bigger timeout
during boot-up to prevent such case.

bug: 37867510
Test: many reboots

Change-Id: Ibfdc42d295bb1d3f5b4ea316fe5aca9ab875e4be
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
64900ad13ccaa78b163d73783d484ccc4a7c607d 19-May-2017 Jorim Jaggi <jjaggi@google.com> Merge "Take snapshot when screen is turning off" into oc-dev
51304d7380b6122ac55645fd9085ba071b04afa9 17-May-2017 Jorim Jaggi <jjaggi@google.com> Take snapshot when screen is turning off

Since we can't take a snapshot when screen is turned off, we need
to snapshot before we are turning the screen off. For this, we
- Add a callback from DisplayPowerController to give policy a
chance to do something before display will be turned off.
- Implement this callback by taking snapshots of all visible
tasks.

Test: Inspect logs/traces about screen off blocking to make sure
callback is working correctly.
Test: Insert artificial 500ms delay in onScreenTurningOff and make
sure we are unblocking screen off when turning on screen in the
meantime.
Test: Open Maps, go to recents, open maps again, scroll to another
location, toggle power button, make sure the old location isn't
shown during unlock.

Change-Id: I489f31358f838d418f894f996495946084f136a4
Fixes: 37107783
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f383c24749ae6bfcf8f8cee26fe7bc6897f7511c 18-May-2017 Jeff Sharkey <jsharkey@android.com> Unbreak even more APK 26 apps running on "O" preview/beta builds.

Bug: 38391358
Test: builds
Change-Id: Ic48f9cb53da3ed8241e5d40d3096304ee4dfebd2
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3106ae0131a55497a20973d17ad73580bf3cb7cf 16-May-2017 Wale Ogunwale <ogunwale@google.com> Fixed leak of app token in exiting list.

- Remove app token from exiting list when it's last window is removed.
- Remove app token from exiting list when it's removal isn't delayed.

Test: Launch a few apps and press back and make sure the exit app to
list dump is empty.
Fixes: 38337456

Change-Id: Ia2f22c6f1add5f867e25583ec38ffccc71217ee7
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f5b6818009a70d77a272ca9b7b2aa167507dfd07 16-May-2017 Rob Carr <racarr@google.com> Merge "Preserve non-floating state when entering pinned stack." into oc-dev
ff43ef4d7a57d5a3afcc278fbc782cdded5d7e20 13-May-2017 Jorim Jaggi <jjaggi@google.com> Relayout before creating surface

Since we create starting window surfaces immediately (instead of
waiting for app visibility), we hit a weird corner case in which
the surface was created before the window was laid out. Thus, a
little bit later, we had to call SurfaceControl.setSize, which
made the whole transaction blocking, meaning that we blocked until
the next vsync before returning to the client (starting window).

Fix this by running a layout if the window wasn't laid out yet.

Test: Open hot app, see latency go down by an average of 8ms (up
to 16ms better!)

Bug: 32668632
Change-Id: I9817afc72127e32d7f8f4e497e0dccd7f180a9c0
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
18f622f08ce84bfb1a6cf19bca33d3ef0ad4aca9 08-May-2017 Robert Carr <racarr@google.com> Preserve non-floating state when entering pinned stack.

When transitioning between the fullscreen and pinned states
we often have a situation where we go from having a navigation and
status bar in the window to not. We'd like to use the source bounds
animation to crop these out rather than a sudden jump or scaling
but in order to do so we need to ensure they last until the end
of the animation. We track this state, and return the appropriate
value from isFloating. Furthermore, we add support to the bounds
animation to use the content frame as a source bounds when there
is no source bounds present, this means that we can crop out the
navigation and status bar so they will be invisible by the end of
the animation.

Bug: 37531386
Test: Manual
Change-Id: I72c549e3a3318534428d17b68ebee5832c32e6d7
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d193972a7fa6fe692f2a1c58c50dbc6ed22603c7 09-May-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fixed issue with associating WindowToken with null binder." into oc-dev
399c869d25395cb5fb81fb2190c2d894bff3c50f 08-May-2017 Wale Ogunwale <ogunwale@google.com> Revert "Only allow AM to update display orientation based on app containers"

This reverts commit 5f1ae6aaca78a14d25e28042df32df642ab3d29e.

This caused b/38021942.

Change-Id: Idb23e5ede7aaa4a927e148c0daab3f56ac449d66
Fixes: 38021942
Bug: 37550022
Test: manual
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2f569ed618f0eb834efb7a27c57d8ca43bcf4f1b 08-May-2017 Wale Ogunwale <ogunwale@google.com> Fixed issue with associating WindowToken with null binder.

App don't have to specify a LayoutParams.token when adding a window to
the system, however when they don't WM maps all the windows to a single
WindowToken mapped to a null IBinder. This isn't correct since the
windows can be coming from different apps and also null binder shouldn't
be used to map tokens.
We now:
1. Associate the WindowToken with the IWindow client for bookkeeping in
WM if the app didn't specify LayoutParams.token for the window it is
adding.
2. Throw an illegal argumenet exception we we try to associate a null
binder with a window token or null window token with a binder on a
display.

Fixes: 38021710
Test: Start an alert window, lock and unlock the phone, long press to
bring up power dialog, and tap outside it to make sure it goes away.

Change-Id: I6816b7fb9b9a0a8f5387062bada862eb75004e4f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5f1ae6aaca78a14d25e28042df32df642ab3d29e 02-May-2017 Wale Ogunwale <ogunwale@google.com> Only allow AM to update display orientation based on app containers

Activity manager choregraphs several app states when starting an
activity including when the display orientation should be updated based
on the app that is now in the foreground. It is possible for a call to
originate within WM after AM adds the starting app token, but before AM
makes the app visible and resumed. E.g. A relayout call due to a
starting window. When this happens WM can prematurely update the display
orientation with incomplete information causing the starting app to be
in an incorrect orientation initially.
To fix this problem we now only factor in app containers (stacks, task,
..) when updating the display orientation if the call to update is
coming from AM. Otherwise we only use the non-app/system containers to
determine the orientation or return the last orientation.

Change-Id: I431ce9260ee31257732311a548c62cbcdb27eae7
Fixes: 37550022
Test: Launch 2 apps that don't fix orientation and use the recent button
to switch between them while holding the device in landscape.
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9c844410572cd432f589d3e1c5a8ea5b67647775 28-Apr-2017 Winson Chung <winsonc@google.com> Fixing test due to null PiP default bounds.

- Also moving the default bounds call into the pinned stack window
controller

Bug: 37682538
Test: bit FrameworksServicesTests:com.android.server.am.ActivityStackSupervisorTests\#testReplacingTaskInPinnedStack

Change-Id: Id6608d484617ec1a596e608aab649a082b4b1e95
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
0f8764485b055d5f4904a3db201ca338b398347a 26-Apr-2017 Wale Ogunwale <ogunwale@google.com> Merge "Reduce use of static variables in window manager unit tests" into oc-dev
11cc516a925ac7fc814dbb0a79a7f0abfbfe1ce1 26-Apr-2017 Wale Ogunwale <ogunwale@google.com> Reduce use of static variables in window manager unit tests

This was causing test cross-contamination since different test might
expect different states from the variables.

Bug: 37682538
Test: tons of it!
Change-Id: Ie8a1ea400695b6346d7dfa3369b5c44bb467a33d
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b8bb3f713763688f394b24e06f1b0ddbec09f26a 25-Apr-2017 Rob Carr <racarr@google.com> Merge "WindowManager: Take care with Surface lifetime during relayout to invisible." into oc-dev
89a28ab018d5ee3e16c99f2d5b4f4f8e05ca6125 25-Apr-2017 Robert Carr <racarr@google.com> WindowManager: Take care with Surface lifetime during relayout to invisible.

In the relayout to invisible case where we choose not to apply an exit
animation, we would call to WindowState#destroyOrSaveSurface bypassing
the app stopped check. Notice WindowManagerService.java L1953 we could
enter the relayout to invisible even if the client has not requested it
if clientHidden were set to true (but not yet processed by the client). This means
we can destroy the surface ahead of any notification to the client. We instead
need to use the WindowState#destroySurface variant
and respect the app token mAppStopped flag. #destroySurface expects
mDestroying to have been set by the exit animation, so we will also need
to set that. If destruction is deferred, it will be completed later by
AppWindowToken#notifyAppStopped

Bug: 36561071
Bug: 37533373
Test: Manual from repro in bug.
Change-Id: If91b4c75fdbcbf87007551860f9eb64dbec9e032
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3fc176913a947fae8df28d19d896216a07491a8f 24-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fixed transition animation from pipable activities" into oc-dev
8997322ed3c8014e1833323b71e5a8d34e6a9e14 24-Apr-2017 Wale Ogunwale <ogunwale@google.com> Fixed transition animation from pipable activities

- Defer telling the client it is hidden if it can enter Pip and isn't
current stopped or stopping. This gives it a chance to enter Pip in
onPause().
- Once pause is complete set the visiblity to false to stop deferring
hiding client.
- Don't allow FLAG_RESUME_WHILE_PAUSING activity to resume until the
currently resumed activity is puased if the currently resumed activity
can enter Pip.
- Detach child surfaces added by the client process in
WindowState.sendAppVisibilityToClients() right before we notify the
client.

Test: manual
Change-Id: I3848f2b93f4f1d3ceec5a1ccd2e127c614f70fe4
Fixes: 37370508
Fixes: 37622341
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
88db7b39cfd736e8e26f112028cb76911d97da3a 24-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Insert missing breaks" into oc-dev
d8a5777bf87555979b3f8297cb3cdccb9e34a4cd 15-Apr-2017 Jorim Jaggi <jjaggi@google.com> Insert missing breaks

Found you!

Test: Go multi-window, go fullscreen, hammer home button
Change-Id: I019d89b95588ab2a0e33d9ef2bdc7240111162d0
Fixes: 36339388
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e287e19fda1821bd88c3578bab0586628d0fd7e5 21-Apr-2017 Wale Ogunwale <ogunwale@google.com> Fixed pinned stack lockscreen interaction

- Use focused stack to determine of an activity can occlude the
lockscreen instead of the topmost stack. The topmost stack should be the
pinned stack which we don't want to decide if the lockscreen should be
occluded. Should be based on the stack that can contain a resume
activity.
- Make sure the remove AppWindowToken from the display if some one ever
calls removeImmediately() directly on it. This makes sure internal
states are clean-up correctly if the removal wasn't triggered from the
AM side.
- Remove some logs that end up causing confusion for testers thinking
something is broken.

Change-Id: I635f6c9a372882ff33d2e9780a1407f78cddf457
Fixes: 37208509
Test: android.server.cts.KeyguardLockedTests#testShowWhenLockedActivityAndPipActivity
Test: android.server.cts.KeyguardLockedTests#testShowWhenLockedPipActivity
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d6475a682d9651a651f60856baef9b17b4633b13 17-Apr-2017 Yohei Yukawa <yukawa@google.com> A new power button mode to hide the IME when shown

As discussed in Bug 33038203 on certain platforms there is a demand
that the power button can change the behavior depending on whether an
IME window is shown on the screen or not. The behavior requested here
can be summarized into two parts:

* Hide the IME window if it is shown [1]
* Go to the home screen if no IME window is shown

This CL implements the above request by introducing a new config mode
for config_shortPressOnPowerBehavior. Note the definition of when an
IME is shown is often tricky than people would expect. The way this
CL is implemented is to propagate IME window state from
InputMethodManagerService (IMMS) to PhoneWindowManager via
WindowManagerService regarding when the back button on the NavBar for
phones/tablets should be shown as an IME dismiss key [2].

[1]: Even with this CL the IME still is allowed to ignore the request
to hide the software keyboard. Currently there is no official
protocol to forcefully hide the software keyboard. How to deal
with such a situation is a long standing TODO task.
[2]: Internally this is controlled by the following IMMS fields:
- InputMethodManagerService#mImeWindowVis
- InputMethodManagerService#mBackDisposition
Note that those fields rely on self-report from the IME. To be
precise, the base implementation of InputMethodService is
responsible for report back its internal state to IMMS when
necessary. The important point is that, although this could
allow a malicious IME to confuse the system UI to some extent,
supporting malicious IMEs is not clearly a goal of Android.
Anyway, the definition of when an IME is shown is a kind of
hot topic in several system services recently. Hopefully we
can come up with better definition and reliable mechanism in
a future release.

Fixes: 33824860
Test: Manually verified as follows
1. Change config_shortPressOnPowerBehavior to "5"
2. Rebuilt the OS image and flash it to the device
3. Make sure that the power button works like a home button
if software keyboard is not shown.
4. Open dialer and focus in to the text field shown on top
5. Make sure that the AOSP keyboard is shown.
6. Run 'adb shell dumpsys input_method' to observe the
following line:
mImeWindowVis=Active|Visible
7. Tap the power button to make sure that the AOSP keyboard
gets dismissed.
8. Tap the power button again to make sure that it works
as if a home button.
Test: Manually tested as follows
1. Open dialer and focus in to the text field to show an IME
2. Run 'adb shell dumpsys window policy' to make sure
mDismissImeOnBackKeyPressed=true
3. Tap the back button to dismiss the IME
4. Run 'adb shell dumpsys window policy' to make sure
mDismissImeOnBackKeyPressed=false
Change-Id: I20721547c73360a70b5fc5cbe06824d577d1768a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
40a5f935acea488086ea1b6df7d5d09e74ea518f 14-Apr-2017 Winson Chung <winsonc@google.com> Fixing animating bounds regression.

- Prior to ag/1954388, we used getAnimatingBounds() to get the final target
bounds if animating or the current otherwise, but since we needed the
target bounds to calculate the window scale even after the animation
completes, the clearing of mBoundsAnimationTarget was removed.

This inadvertently broke the check in getAnimatingBounds() from ever
returning the current bounds (as it's never empty)! This CL fixes the
issue, and renames the related methods to better reflect what they are
doing going forward.

This caused a regression when calculating and notifying SysUI of the
movement bounds, which was never the current bounds, but the default
bounds. Leading the IME change to trigger the PIP to move down.

Bug: 37242422
Test: android.server.cts.ActivityManagerPinnedStackTests
Test: Source hint rect animation still works

Change-Id: I532b0928ebfeaf95e9754a0254306af6fbb35833
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3a68287c6cbb5327f824515fa128117300806fac 10-Apr-2017 Winson Chung <winsonc@google.com> Tightening up rotation behavior for PIP (1/3)

- Defer getting the default bounds until after the task has been reparented
to the pinned stack
- Also move pinned stack-related methods into pinned stack window
controller and listener

Bug: 36879891
Test: android.server.cts.ActivityManagerPinnedStackTests

Change-Id: Ib2bd81ad9e2a3829b556177010f39c7512ba35bf
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
bc4bd823d9b7acaf6fd715e24496bab2731de0be 08-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes I5d41419a,I763be06c into oc-dev

* changes:
Introduce android.anim thread in system_server
Fix thread booster
ed7993b5d147a6741d26fe0b16cc9fa5e34ceaee 28-Mar-2017 Jorim Jaggi <jjaggi@google.com> Introduce android.anim thread in system_server

We create a new thread on which everything is running that
directly impacts window animations, i.e. layout, anim tick and
starting window creation. This is such that any work on
android.display can not lead to jank in the window animation,
specifically lock contention on activity manager lock that blocks
callbacks from android.display into AM can not lead to window
animation jank.

Test: Run animation, take systrace, make sure animation is on
android.anim
Test: AppWindowContainerControllerTestTest: AppWindowContainerControllerTestss
Fixes: 36792959

Change-Id: I5d41419a709b7984724e7053a3afdcc1ffe1aaa2
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a10fc7e294771dc97536a3fdae6f2d105bb3ed55 06-Apr-2017 Wale Ogunwale <ogunwale@google.com> Don't show alert window notifications when in Vr mode.

Change-Id: I6ef60682197f6581fb101598290b2390ea676091
Fixes: 35854095
Test: manual
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
36db127e4733ea8ef41a96be5b683e1a2e705677 28-Mar-2017 Jorim Jaggi <jjaggi@google.com> Boost thread priority when holding the WM lock

Test: Take systrace of open app, make sure thead is boosted while
doing stuff in WM
Test: Run WmSlam with and without boosting. Observe an
improvement.
Bug: 36631902
Change-Id: Iadb036f8d12bbf59091466500e82207cf6fa85d5
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a52fc49845d1103dea2380f34b96e2a22ea1801e 04-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Themes: Apply themes to system_server safely" into oc-dev
cd097993399f94aa663c5fad50e444b75e6ee5dd 24-Mar-2017 Andrii Kulian <akulian@google.com> Update display contents when metrics change

There are two separate overrides for display metrics in DisplayManager
and WindowManager:
- In DM - LogicalDisplay#mOverrideDisplayInfo, in most cases not null.
- In WM - DisplayContent#mBaseDisplayWidth/Height/Density, different
from #mInitialDisplayWidth/Height/Density values when some metrics are
forced.

When display was resized its windows weren't updated because of
two problems: old LogicaDisplay#mOverrideDisplayInfo was preventing
WM from detecting the change and override (base) display metrics were
never updated by resize.

When display size changes:
- Before this CL:
DM receives DISPLAY_CHANGED event, it updates internal values and
WM is notified about them with a message. In most cases there is an
override obtained from WM and WM doesn't get new values from
LogicalDisplay#getDisplayInfoLocked().

- With this CL:
WM will requests real updated values from DM without any overrides
and will decide whether to apply them or not: if there is no override
in WM - it will apply values from WM, otherwise it will keep the
override. Also it will always update initial display metrics if there
is a real change detected.

Bug: 35258051
Bug: 34164473
Bug: 36518752
Test: android.server.cts.ActivityManagerDisplayTests
Test: #testDisplayResize
Test: #testForceDisplayMetrics
Change-Id: I2495c27797f11f9aaee4ea06648a8ccd29ac5b62
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
fe9a53bc45fd0124a876dc0a49680aaf86641d3e 31-Mar-2017 Jeff Sharkey <jsharkey@android.com> Consistent dump() permission checking.

This change introduces new methods on DumpUtils that can check if the
caller has DUMP and/or PACKAGE_USAGE_STATS access. It then moves all
existing dump() methods to use these checks so that we emit
consistent error messages.

Test: cts-tradefed run commandAndExit cts-dev -m CtsSecurityTestCases -t android.security.cts.ServicePermissionsTest
Bug: 32806790
Change-Id: Iaff6b9506818ee082b1e169c89ebe1001b3bfeca
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ac52f2892d5c72c26387d510093ddfc741a8a632 30-Mar-2017 Winson Chung <winsonc@google.com> Ensure we show the PiP menu in response to KEYCODE_WINDOW.

Bug: 36687605
Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testWindowButtonEntersPip
Change-Id: I0bb35fd666eb6a438e4676267f6726b44bffb3db
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a82b62678a0e1eaba50ec5adce93862683dac065 22-Mar-2017 Adam Lesinski <adamlesinski@google.com> Themes: Apply themes to system_server safely

Creates a new UI Context for UI based operations.
This UI Context is wired up the same way a normal app
Context would be, and is subject to change when overlays
are enabled/disabled.

For this reason, only UI should be using this new Context.
All other operations should be using the original system Context
so that changing themes don't impact the regular operations of
system_server.

Also added some sanity checks at key places where we show UI
(ShutdownThread, BaseErrorDialog).

Bug: 36059431
Test: $ adb shell am crash com.android.settings
Test: Observe crash and power off dialogs are blue with PixelTheme
Change-Id: I87227ee2e0be1e72dcde8f482b37725cb687260b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
27cec32496090efd153327f4fc5a5cecc6f59d9b 21-Mar-2017 Bryce Lee <brycelee@google.com> Add configuration for maximum UI width.

This changelist adds config_maxUiWidth, a new system resource
configuration which specifies the maximum width the user interface
can operate in. If the physical or specified width is greater than
this value, dimensions and density are scaled down accordingly. The
native mode resolution can be still discovered through
Display.Mode#getPhysicalWidth/getPhysicalHeight.

Test: Defined override for development device and verified values.
Test: bit FrameworksServicesTests:com.android.server.wm.DisplayContentTests#testMaxUiWidth
Change-Id: I12e7ad52f2aa8014e143bc7e80b020c9b24ed9c8
Fixes: 25820708
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
aa79aa1055cfd890a97dc331e8eb6d0350945123 22-Mar-2017 Rob Carr <racarr@google.com> Merge "Amend "Fix various flashes when..." CL"
38691e9d8f4cf4d77bfb2f21d2eb71fec1cc1cf4 22-Mar-2017 Andrii Kulian <akulian@google.com> Merge "Revert "Update display contents when metrics change""
b6c5c0d902f8afd6108d49f43be4b8abfef3a8b0 22-Mar-2017 Andrii Kulian <akulian@google.com> Revert "Update display contents when metrics change"

This reverts commit eddb7c0985e1fac8bdbeaaed40c678c0dc9da321.

Reason for revert: b/36518752

Bug: 36518752
Change-Id: I39773db7b8d02aec360ca80d02b3c161ccf02786
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e7cc44d8140dbf8ef1e2736869a4f40c38d57cf3 21-Mar-2017 Robert Carr <racarr@google.com> Amend "Fix various flashes when..." CL

Missing cosmetic changes from last patch set due to
a rebase error on my part.

Test: Cosmetic
Change-Id: I3a8a68e8cecd1947cd9e54d5fcfe8bb4a792265b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e4e40af10b94a82fa2fad0af176a0a5927dc3136 22-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Update display contents when metrics change"
eddb7c0985e1fac8bdbeaaed40c678c0dc9da321 21-Mar-2017 Andrii Kulian <akulian@google.com> Update display contents when metrics change

There are two separate overrides for display metrics in DisplayManager
and WindowManager:
- In DM - LogicalDisplay#mOverrideDisplayInfo, in most cases not null.
- In WM - DisplayContent#mBaseDisplayWidth/Height/Density, different
from #mInitialDisplayWidth/Height/Density values when some metrics are
forced.

When display was resized its windows weren't updated because of
two problems: old LogicaDisplay#mOverrideDisplayInfo was preventing
WM from detecting the change and override (base) display metrics were
never updated by resize.

When display size changes:
- Before this CL:
DM receives DISPLAY_CHANGED event, it updates internal values.
In most cases there is an override obtained from WM and WM doesn't
get new values from LogicalDisplay#getDisplayInfoLocked().

- With this CL:
DM receives DISPLAY_CHANGED event, it updates internal values and
resets the override received from WM. WM will receive updated values
and will decide whether to apply them or not: if there is no override
in WM - it will apply values from WM, otherwise it will keep the
override. In both cases WM will eventually update its own override
and will update the override in DM.

Bug: 35258051
Bug: 34164473
Test: android.server.cts.ActivityManagerDisplayTests
Test: #testDisplayResize
Test: #testForceDisplayMetrics
Change-Id: I80795434a6a35adb0577fbce334d76fabd2fa03d
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
6914f0838e460666e9ec260213e1feb6aa7443dc 21-Mar-2017 Robert Carr <racarr@google.com> Fix various flashes when moving stacks.

In this CL we fix two new pinned stack reparenting flashes and
implement a new approach to an old docked stack flash fix, which had
been broken in refactoring.

First we examine the case of dismissing the docked stack and
WindowState#notifyMovedInStack. Previously we invoked this
when reparenting from the docked to the fullscreen stack
(by way of position in stack). It was used to solve an issue
where we were visually hidden by the docked stack crop, but we were
still waiting on an animation pass to set the hidden flag. Our old solution
was if mJustMovedInStack was set, we would just defer updating our crop until
one animation pass had occurred.

We broke this incidentally in refactoring by not calling the
method that sets it anymore. However it's somewhat brittle so I was
hesitant to restore it. The fundamental requirement is for the
ActivityManager to perform multiple operations (change stack, update
visibility) in a single atomic step and this wasn't expressed clearly.

This mirrors some challenges we have with the pinned stack transitions
as well.

1. When dismissing the pinned stack, we move the task to the
fullscreen stack. We need a mechanism to prevent its bounds from
updating before its visibility is updated.
2. When moving to fullscreen while over home, we have layering issues
with the home stack, as we will be moved to the fullscreen stack before the
fullscreen stack is brought to the front of the home stack. This may
not seem like a visibility issue, but if the home activity were simply
hidden the layering wouldn't matter!

Evidently, all three of these issues can be solved with a batching
mechanism from ActivityManager to WindowManager. As all changes are
ultimately Surface changes, SurfaceControl.open/closeTransaction
provides such a mechanism. The only additional complication is that
normally visibility updates on SurfaceControl are deferred to the
animation thread, which may not execute within the bounds of our
transaction. This however, is easily dealt with: In AppWindowToken, if
we are becoming hidden without animation, then we simply apply this
change without waiting for the UI thread

Bug: 35396882
Bug: 34857388
Bug: 36393204
Bug: 36462635
Test: Intensive manual testing of dismissing docked and pinned stack + pinned->fullscreen transition.
Change-Id: Ic110797670cc7ff656a580fd186d4deb44fa54dd
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
35e3f53a30588b79e0309fdbeef29a8c18eef65d 17-Mar-2017 Jorim Jaggi <jjaggi@google.com> Also store reduced resolution screenshots

In order to speed up loading time when scrolling through it
in recents. They will be used in recents in the next CL. Also, we
use JPG instead as loading JPG is much faster than PNG.

Test: TaskSnapshotPersisterLoaderTest
Test: TaskSnapshotCacheTest
Bug: 34829962
Change-Id: I4c74b26969ae459bd3b1a42707011a49f425abd9
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
af3a400ead86f29ca355613dbe3a13b6fc3243d3 20-Mar-2017 Bryce Lee <brycelee@google.com> Do not defer wm display logic when called from am.

Currently we process any remove/add/change logic from the activity
manager to the window manager through a handler message. This opens
the possibility of the activity manager requesting display state
from a window manager that is a step behind.

This change modifies the call behavior so that these changes are done
synchronously between the two managers.

Change-Id: Icd19f37c62bfb7aad10fab2e1b21e41ac75052b5
Fixes: 35741135
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test CtsServicesHostTestCases android.server.cts.ActivityManagerDisplayTests#testCreateMultipleVirtualDisplaysH
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
446079600ece83b22cb91865bcbeb694292b0108 16-Mar-2017 Andrii Kulian <akulian@google.com> Separate global and override config sent to client

There is some flakiness in View#onConfigurationChanged callback -
if ViewRootImpl receives config update earlier than ActivityThread,
it may not detect the configuration change and skip inner updates.
Also now ViewRootImpl assumes that it receives the global config as
a param, but instead it gets merged config from WM. This means that
ViewRootImpl#sConfigCallbacks was sending incorrect values to the
recipients.

This CL switches to sending global and override configuration to the
client separately. Also in case if there is a corresponding activity,
it first updates it and waits for update callback to ViewRootImpl.
This way global config and override config for activity will always
be set first and resources will be updated before inner state of
ViewRootImpl is updated.

Bug: 35870157
Bug: 34164473
Test: android.server.cts.ActivityManagerDisplayTests
Test: testOnMovedToDisplayCallback
Change-Id: Ic9e7541cf25ecfac6ec90e48f7efb0ece91f657e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
287452cf404d5a7bacb78d0b763bb6c04010cbed 16-Mar-2017 Rob Carr <racarr@google.com> Merge "Delete some SurfaceView support code."
d0a2cd306104ca6fc8af70d5a3d905ec54d5dc6e 14-Mar-2017 Robert Carr <racarr@google.com> Delete some SurfaceView support code.

repositionChild, performDeferredDestroy, and SurfaceControl with
background were all only used by SurfaceView and are now no longer
required in the wm.

Test: Only red.
Change-Id: Icb773572e6d6202f78a6d23b2431fbfacbe272c6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
74922c63e1dfba074aa9219034e48a161bdfba5b 13-Feb-2017 Casey Burkhardt <caseyburkhardt@google.com> Display magnification via the nav bar Accessibility Button

Adds support for invoking display magnification by first selecting
the Accessibility Button, then touching an area of the screen to
magnify.

Bug: 30960346
Test: Manual
Change-Id: Ifd8a355562f204182e34bd37f71a3637d85cf0e1
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
06d07d6c73f5cf2d7f4975cda4d29870b4f34c3b 14-Mar-2017 Andrii Kulian <akulian@google.com> Move rotation methods to DisplayContent

This moves some of the rotation logic applied to displays
from WindowManagerService to DisplayContent. No changes in
logic.

Bug: 34242678
Test: android.server.cts.ActivityManagerDisplayTests
Test: #testRotationNotAffectingSecondaryScreen
Test: android.server.cts.ActivityManagerAppConfigurationTests
Change-Id: Ica8b5d700dea82edfc6b51b10be3362fc89854b0
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3878ca3333da1bf5cbc83d33e5e8b3ce68c8c5e4 03-Feb-2017 Jorim Jaggi <jjaggi@google.com> Fix multi-dimen app transition delay tron event

Make sure to log everything.

Test: Open app, inspect log.
Test: com.android.systemmetrics.functional.AppStartTests

Bug: 33086172
Change-Id: I6fdfef625c09267dcf20724e853cf7471abc86c9
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
376c6471da391d09e6a9d840321865a6871ccf14 14-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Associate rotation watchers with displays"
35fa3c26adcb5f6577849fd0df5228b1f67cf2c6 11-Mar-2017 Andrii Kulian <akulian@google.com> Associate rotation watchers with displays

Displays can be rotated separately and rotation watcher clients
are only interested in rotation of some specific display. This CL
adds displayId to rotation watchers and only informs them about
changes on their display.

Bug: 34242678
Test: Manual and debug.
Change-Id: If0f03804da0392c2b14a4e7c2d6a06068ad8760b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
0de9e5ca3ddb69b4d3d9f3756f03d29f09b81469 14-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Lower-overhead version of LockGuard."
5f3e93451e87d72c513e75c5d5459a4bd2cc41b2 13-Mar-2017 Jeff Sharkey <jsharkey@android.com> Lower-overhead version of LockGuard.

Instead of building up a giant set of all locks inside the system
server, there are only a handful that we're interested in watching:
specifically those below the ActivityManagerService lock.

This change adds a index-based variant of lock registering and
checking, which has much lower overhead that doesn't bring a device
to its knees. It's disabled by default, but can be enabled on local
development builds.

Currently uses the boostPriorityForLockedSection() hook in AMS to
check for lock inversions when enabled.

Test: builds, boots, no AMS lock inversions detected
Bug: 35410906
Change-Id: I473d634d23c08538029412a1254bf4f92b96fb84
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8ee7285128c3843401d4c4d0412cd66e86ba49e3 10-Mar-2017 Andrii Kulian <akulian@google.com> Move rotation tracking to DisplayContent

This CL moves rotation tracking from WindowManagerService to
DisplayContent. This way displays can be rotated independently and
rotation of the main display won't affect rotation of secondary
ones.

Bug: 34242678
Test: android.server.cts.ActivityManagerDisplayTests
Test: testRotationNotAffectingSecondaryScreen
Change-Id: Ic46aaa523482b31ff5ec77f0c2908ceda1156fc0
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
208e2644618af7474f399089c264f0da1cfb0c81 11-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Updated alert window notification to new UX spec."
d76881e002cf1e266b5080b05d1aee80fc760770 10-Mar-2017 Wale Ogunwale <ogunwale@google.com> Updated alert window notification to new UX spec.

- Updated strings
- Removed action button
- Clicking on notification takes user to alert window permissions
activity

Bug: 36069437
Test: Manual
Change-Id: I32e59ed3faa7fba1641660095d59f5ebf9acec43
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
cfdfd997bd3aa8e32d9d1eefddb1d5921c1db5ee 10-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Modify SurfaceView to use SurfaceFlinger child surfaces."
8e44f6c46822028a853c41610d2289e299987af0 10-Mar-2017 Wale Ogunwale <ogunwale@google.com> Revert "Have WM use token info. from IMMS to determine IME target window"

This reverts commit daab865344fcfa45fe2789e43462f730a44fba64.

IMMS is currently sending wrong target candidates, so we need to revert
this until we figure-out what is going on there :(

Bug: 31559891
Bug: 35903813
Test: DisplayContentTests
Change-Id: I5c5beff4bac1b0781fa6663b13ff0dfe83a7806b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d5c7dd6da810a6b89151b337bea79fd817e6b72a 08-Mar-2017 Robert Carr <racarr@google.com> Modify SurfaceView to use SurfaceFlinger child surfaces.

Here we have SurfaceView bypass the WindowManager and speak
directly to SurfaceFlinger using child surfaces. We also
implement some logic in the WM to handle child surfaces
in various Surface replacement scenarios.

For those following along in the revert Saga, this
also includes the follow up CLs to the original CL.
- Surface inset calculation
- Animation fixes.

The error causing the revert was an incorrect JNI signature
around deferTransactionUntilSurface. I've noted it inline.

Bug: 28858420
Bug: 31518219
Bug: 34888808
Bug: 35588318
Bug: 35396882
Test: Existing tests still pass (except for the ones that don't and will be deleted).
Change-Id: Ie56b6f7ab16f32d7fc459b8eba26594337ad55de
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
30d69eaf868d2c8a9440f49b9a611c40a9f1ac1d 08-Mar-2017 Lei Yu <jackqdyulei@google.com> Merge "Add BatterySaverPolicy for power save mode"
455e90add22835d0744fc0f5c2feb5fcaf03b28f 10-Feb-2017 jackqdyulei <jackqdyulei@google.com> Add BatterySaverPolicy for power save mode

The BatterySaverPolicy is designed to consolidate all battery saver
knobs into a central location. Usually it is consistent to
mLowPowerModeEnabled unless it gets different data for specific
service. By adding these knobs, we can effectively tune the battery
saver.

This cl sets up the framework for BatterySaverPolicy and updates
following service to get battery saver data from BatterySaverPolicy

1. GnssLocationProvider
2. VibratorService
3. WindowManagerService
4. BackupManagerService
5. SoundTriggerService
6. NetworkPolicyManagerService

Screen brightness will come in a following cl.

Bug: 34693888
Test: FrameworksServicesTests

Change-Id: I6b040e93391614b44d136a485faa4a332c396e51
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5aec7b90310ba05f9816fd89030ba41ce48c568e 08-Mar-2017 Wonsik Kim <wonsik@google.com> Revert "Modify SurfaceView to use SurfaceFlinger child surfaces."

This reverts commit cd4aeef88052571365d4e193a2c41e2e6d145491.

Bug: 36027342
Bug: 36015884
Change-Id: Ifd5b69caf64d65a8cd6570b7fe1fb6abe90e30b8
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
baa7b721dc8ee22f8e5f8c373fe6ab1630446f0f 04-Mar-2017 Winson Chung <winsonc@google.com> Small fixes and tweaks to PiP transition.

- Fixing case where default bounds did not account for ime height
- Ensuring that we using the animating/target bounds when calculating
the new ime-offset bounds
- Tweaking transition interpolators and durations

Bug: 35396882
Test: android.server.cts.ActivityManagerPinnedStackTests
Change-Id: Ia22ea0008d834c47a3f26bf2e1f484c72fae8736
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
cd4aeef88052571365d4e193a2c41e2e6d145491 03-Mar-2017 Robert Carr <racarr@google.com> Modify SurfaceView to use SurfaceFlinger child surfaces.

Here we have SurfaceView bypass the WindowManager and speak
directly to SurfaceFlinger using child surfaces. We also
implement some logic in the WM to handle child surfaces
in various Surface replacement scenarios.

For those following along in the revert Saga, this
also includes the follow up CLs to the original CL.
- Surface inset calculation
- Animation fixes.

The error causing revert was a deferTransactionUntil(-1)...-1
cast to uint, defer transaction until MAX_UINT.

Bug: 28858420
Bug: 31518219
Bug: 34888808
Bug: 35588318
Bug: 35396882
Test: Existing tests still pass (except for the ones that don't and will be deleted).
Change-Id: Ib37236950a1dd3c4f9f4b58fd41ef9003c0557ef
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2ff633cbc3368678133ef94fcc7895183f4ce9b8 03-Mar-2017 Rob Carr <racarr@google.com> Merge "Revert "Modify SurfaceView to use SurfaceFlinger child surfaces.""
3896db14751f16f4053e8fa4a82c3d6803054e5b 03-Mar-2017 Jeff Tinker <jtinker@google.com> Revert "Modify SurfaceView to use SurfaceFlinger child surfaces."

This reverts commit 693f3432ae77d1fcfaaf9d168de861192aacb4c4.

P0: When playing encrypted content the Fugu displays a blank screen.

Test: with topic "surfaceview-without-wm" reverted, encrypted playback
works on ToT oc-release. See repro steps in 35917840#12.

bug:35917840

Change-Id: I37fa1e427daff3a1c18ed1c92d035421d891f67c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
6d41026f1b3dc910c9d34ab89993a280dc9679cf 01-Mar-2017 Bryce Lee <brycelee@google.com> Clean up closing apps list when clearing anAppWindowToken's task.

Previously it was possible for an AppWindowToken to be removed while
on the closing apps list, used in transition animations. During these
transitions, the visibility of the token is modified. Since
visibility relies on the WindowContainer parent, a
NullPointerException would occur.

This changelist addresses the issue by making sure to remove any
AppWindowToken from this list when its task is set to null.

Change-Id: Id9234822b228f4658f04d42ac0fe7b49ded6f5a1
Fixes: 35352214
Test: manual (primarily code inspection)
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
0e06ccf488bb7744709b8f3421f3a5a2f5ae69f7 01-Mar-2017 Rob Carr <racarr@google.com> Merge "Modify SurfaceView to use SurfaceFlinger child surfaces."
693f3432ae77d1fcfaaf9d168de861192aacb4c4 19-Dec-2016 Robert Carr <racarr@google.com> Modify SurfaceView to use SurfaceFlinger child surfaces.

Here we have SurfaceView bypass the WindowManager and speak
directly to SurfaceFlinger using child surfaces. We also
implement some logic in the WM to handle child surfaces
in various Surface replacement scenarios.

Bug: 28858420
Bug: 31518219
Bug: 34888808
Bug: 35588318
Bug: 35396882
Test: Existing tests still pass (except for the ones that don't and will be deleted).
Change-Id: Icb7259365b51ebe8c7f6c7cd4f9ba29f9fce08a4
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b1dc328990316ff355d8281e2586f98d13cf7152 28-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Have WM use token info. from IMMS to determine IME target window"
daab865344fcfa45fe2789e43462f730a44fba64 24-Feb-2017 Wale Ogunwale <ogunwale@google.com> Have WM use token info. from IMMS to determine IME target window

Window Manager currently places the IME above the highest window
that can possibly be using the IME. While this method works for
most cases, it does cause some animation jank if the window making
the IME visible is below an other window that could possibly make
the IME visible, but isn't. When this happens the IME is displayed
on-top of which we don't want since the top app isn't making the
IME visible.
We now rely on a strong signal from the input method manager service
WMS.updateInputMethodWindowStatus() to depend which window is actually
using the IME so the window manager can z-order things correctly.

Fixes: 31559891
Test: bit FrameworksServicesTests:com.android.server.wm.DisplayContentTests
Change-Id: I524aa9dbeb764aac15034a13adf9381304c38fa6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
52577dbc0cb51a3765991b5ca92bbe7718fcc97d 27-Feb-2017 Justin Klaassen <justinklaassen@google.com> Fix build using ANDROID_COMPILE_WITH_JACK=false

services/core/.../wm/WindowManagerService.java:5175:
error: cannot find symbol
final class H extends Handler {

Bug: 32709235
Test: lunch aosp_x86-eng && make -j32 ANDROID_COMPILE_WITH_JACK=false
Change-Id: I8c5990cf5a244cc2cc784673225397f9d1a74923
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4098172f467e6fab5fea96d84ba8e36e032542ca 23-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Ensure we use the fullscreen stack bounds when expanding PiP."
55893331fb3c23067ede1463fe06c7bb6519141c 18-Feb-2017 Winson Chung <winsonc@google.com> Ensure we use the fullscreen stack bounds when expanding PiP.

- When in split screen, the PiP needs to animate to the fullscreen stack
bounds when expanding.
- Created PinnedStackWindowController to house pinned-stack specific
logic.

Bug: 35396882
Test: Expand PiP activity while split

Change-Id: If7397843743ce11b676f5566eba90e3442289fec
Signed-off-by: Winson Chung <winsonc@google.com>
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2ce1160ed664515db6003ff4622a57c60c4ab22b 22-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Revert "Update display contents when metrics change""
6addf5d7094e780498a10a5c761e9089d71dd9c8 21-Feb-2017 Bryce Lee <brycelee@google.com> Revert "Update display contents when metrics change"

This reverts commit d7f8f942e56ce96042879c582db1541283c78a3d.

Reason for revert: causing b/35349518

Fixes:35349518
Bug:35258051
Change-Id: I5233bee6696f76313868bb36fd0da4225e5ac038
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2d8f7e80beb0c4762faca9d37539524377da43c2 21-Feb-2017 Rob Carr <racarr@google.com> Merge changes I670fe942,I87eaf866,I4a729457

* changes:
Pinned stack animation: Fix inset logic.
Pinned stack animation: Trigger window preservation when dropping shadows.
Pinned stack animation: Prevent window preservation during animation.
387e4c61338ddf7aee89d10c8aac329e9562b831 13-Feb-2017 Wale Ogunwale <ogunwale@google.com> Display on-going notification for apps using alert windows.

Allows the user to associate alert windows with specific apps
and revoke the permission if they want.

Test: manual
Bug: 33256752
Change-Id: Ie28325b6bb799b3df253770ebe655f97ebbadd90
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
943002b47346ea82b4e69dca033cc03086969dd1 16-Feb-2017 Wale Ogunwale <ogunwale@google.com> Set importance for processes displaying app-overlays based on visibility

We were previously setting this based on when the window was added and
removed. This can lead to issues where an app isn't allowed to show
alert windows so window manager hides the window after the permission is
revoked, but the window still exist in the system so the process
importance will still be high. We now set the process importance based
on if it has visible window surfaces or not.

Bug: 33256752
Test: cts/.../run-test CtsAppTestCases android.app.cts.AlertWindowsTests
Change-Id: I4e406a94683ec0eecc0911d0195e641c693e1c4a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
c91d1c3e5623490834495b12547a38313e89bb5b 16-Feb-2017 Robert Carr <racarr@google.com> Pinned stack animation: Trigger window preservation when dropping shadows.

When resizing from smaller to large we go in two phases. First we resize to large + insets
so that we can scale up without pixelation. Then once we have reached our target we remove
the insets. As pointed out in the previous CL we don't want the window preservation
mechanism for the first size change, but it is perfect for removing the shadows. Otherwise
we have an issue where the client jumps, as when the shadows are removed we need to update
the position in synchronization with the client drawing.

Bug: 35396882
Test: Move skeleton app to fullscreen and verify no position jump at end.
Change-Id: I87eaf866f5a5ed058844670eeadffc34c061a378
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
15c4454970ce333e221fb4a2ceb4cb266f7ae442 16-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow setImeWindowStatus with null startInputToken"
ba422045d793564a9e69f5fbd0fa28255edfeb1c 16-Feb-2017 Winson Chung <winsonc@google.com> Merge "Reducing number of configuration changes during PiP transition."
ee2a7ed3d971f83134a2b28258dd2e56f9634f94 16-Feb-2017 Yohei Yukawa <yukawa@google.com> Allow setImeWindowStatus with null startInputToken

This is a follow up CL to my previous CL [1], which caused an unexpected
side effect that leads the current IME to crash due to a too strict
requiremnt.

It turns out that it was too early for us to start requiring non-null
StartInputToken in InputMethodManagerService#setImeWindowStatus()
because in many places we have assumed that an IME can show/hide its
software keyboard even before an IME target window is associated with
the IME.

There are two major cases that we missed:

- InputMethodManager#showSoftInputFromInputMethod(IBinder, int):

This method does not require that the calling IME is already bound
to an IME target window.

- InputMethodManager#showSoftInputUnchecked(int ,ResultReceiver):

This @hide method allows the caller application to let current IME
show the software keyboard with bypassing all the normal focus
management tasks in InputMethodManager. We should seriously
consider to deprecate this @hide method, but to do that we have to
clean up some internal components and SearchView in the support
library that still rely on this method.

Bug 35395372 is triggered by the second scenario, but until we sort out
all the possible corner cases, we should allow null startInputToken as a
valid request, like we had have done so before the CL [1] introduced
such a validation.

[1]: I9921b381e02106dbffff5e0b3d13f0a1245ce807
6db3bfe33d92127d203ec872a0b353585a99f256

Test: Made sure Bug 35395372 is no longer reproducible, that is,
1. Flash a new image and complete the setup wizard on a
direct-boot unaware device.
2. Set a device password and require it upon each device boot.
3. adb reboot
4. Observe the default IME does not crash because of
InvalidParameterException thrown by IMMS.
Test: Made sure IMM#showSoftInputFromInputMethod(IBinder, int) does
not throw an InvalidParameterException even in an extreme case.
1. Rebuild LatinIME with the following code in LatinIME.java
@Override
public AbstractInputMethodImpl onCreateInputMethodInterface() {
return new InputMethodService.InputMethodImpl() {
@Override
public void attachToken(IBinder token) {
super.attachToken(token);

final InputMethodManager imm =
getSystemService(InputMethodManager.class);
final IBinder imeToken =
getWindow().getWindow().getAttributes().token;
imm.showSoftInputFromInputMethod(imeToken, 0);
}
};
}
2. adb install -r LatinIME.apk
3. adb shell ime enable com.android.inputmethod.latin/.LatinIME
4. adb shell ime set com.android.inputmethod.latin/.LatinIME
5. Tap any text field.
4. Observe LatinIME does not crash because of
InvalidParameterException thrown by IMMS.
Bug: 34628091
Bug: 35079353
Fixes: 35395372
Change-Id: Ib9448c551d9a30776a999c27a5ff20f1a095633a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
7d95df4971cfaa68e2fa84ce6f8656cc548616b5 15-Feb-2017 Andrii Kulian <akulian@google.com> Always check front stack on its current display

Previously checks for front stacks were looking among
stack on primary display only. This doesn't make any
sense for stacks on secondary screens, so let's always
check among other stacks on its current display.

Bug: 34862802
Test: Manual.
Change-Id: I29ee160d455719d75f4a5981a6ba9c60f3d90084
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
bdc646f5d514259d9aae975bac64363947db0d32 13-Feb-2017 Winson Chung <winsonc@google.com> Reducing number of configuration changes during PiP transition.

- Fixes issue with the incorrect calculation of configuration smallest
width for floating and always-fullscreen stacks. Fullscreen stacks
now have the smallest width matching the display, and floating stacks
are set to the smallest size of their bounds.
- This CL also ensures that we test the combined global/override configs
for changes in case changes when moving between stacks results in a
shift in the configuration between the parent to the override of the
child (ie. when going from fullscreen -> pinned)
- Also ensure that we are animating to the right fullscreen bounds for
the PiP transition, accounting for the insets when calculating the config
change the same way we would do for fullscreen tasks.

Bug: 33779483
Test: android.server.cts.ActivityManagerConfigChangeTests passes
Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testSingleConfigurationChangeDuringTransition
Change-Id: I2c2b695572cd17087d522cf6c8ebd105e57e08b8
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
722ba4c7519210a53cebd761a6a565415f4e6307 14-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Update display contents when metrics change"
3400795aecc8b1c139dd0726716545118b125f47 14-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Propagate setImeWindowStatus() to WMS"
d7f8f942e56ce96042879c582db1541283c78a3d 14-Feb-2017 Andrii Kulian <akulian@google.com> Update display contents when metrics change

When display was resized its windows weren't updated because of
two problems: old LogicaDisplay#mOverrideDisplayInfo was preventing
WM from detecting the change and base display metrics were never
updated by resize.

Bug: 35258051
Test: android.server.cts.ActivityManagerDisplayTests
Test: #testDisplayResize
Change-Id: I30155e4d83e61ffe969c81dfcf932f3f3882cc59
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
69e68024220d3f18b08cbb314c7991f8f76cbe49 13-Feb-2017 Yohei Yukawa <yukawa@google.com> Propagate setImeWindowStatus() to WMS

setImeWindowStatus() introduced in the previous CL [1] can help
WindowManagerService (WMS) address Bug 34628091. As a preparation
this CL has InputMethodManagerService propagate relevant information
to WMS WMS for later use.

[1]: I9921b381e02106dbffff5e0b3d13f0a1245ce807
db2afde0e584904ee4ce115ce176a4dfe1773990

Test: Verified the callback in WindowManagerService as follows:
1. Rebuild the system with DEBUG_INPUT_METHOD=true
2. adb logcat -s WindowManager:*
to make sure the visibility passed to
WindowManagerService#updateInputMethodWindowStatus matches
to the actual IME window visibility
Bug: 34628091
Bug: 35079353
Change-Id: I54fb1faf513883a54293a756e4c9d2ae9453d778
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
dfabcb1ca015fe76f395e19997048bf8eca6eafb 13-Feb-2017 David Stevens <stevensd@google.com> Merge "Handle focused tasks on multiple displays"
d993a573d7fcf1a69d35528cae4dd96581c9aacd 05-Feb-2017 Wale Ogunwale <ogunwale@google.com> Set oom adj for processes displaying app-overlays to PERCEPTIBLE_APP_ADJ

For processes with a window of type TYPE_APPLICATION_OVERLAY adjust their
oom importance to PERCEPTIBLE_APP_ADJ to reduce the chance of them getting
killed by the low-memory-killer since they are displaying something that
is perceptible to the user.

Also z-order TYPE_DREAM windows above alerts windows.

Bug: 33256752
Test: cts/.../run-test CtsAppTestCases android.app.cts.AlertWindowsTests
Change-Id: I4c05a9fee6fad61399bf4d10c8647467cc596ca6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ee9e277033d959211ba733a480355d41a2f32705 10-Feb-2017 David Stevens <stevensd@google.com> Handle focused tasks on multiple displays

When the focused task changes displays, make sure to mark the whole
previous display as not part of a focused task.

This change also adds an adb am command to change the task focus.

Test: android.server.cts.ActivityManagerDisplayTests
Test: #testStackFocusSwitchOnTouchEvent
Bug: 35214007
Change-Id: I9cb7372c21a0b592abb6f6d910077ff5097dd6cf
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f24a170ab23edf84ecee508bb620db43dc11c0e1 09-Feb-2017 Sudheer Shanka <sudheersai@google.com> Remove user-specific data in WMS when the user is removed.

Change-Id: I60c8dd07dcc9d2a34cab1b8f16e5b1e1789d822f
Fixes: 32028192
Test: manual
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2a82fe587b850061ace024d2025047554987c10d 02-Feb-2017 Winson Chung <winsonc@google.com> Refactor PiP logic in preparation for expanded state.

- #1: Move logic for handling IME size changes into SysUI, and only rely
on PinnedStackController to provide bounds when first entering
PiP and on rotation
- #2: Doing #1 allows us to move PipMotionHelper to SysUI completely, which
lets us aggregate the animation calls out of PipTouchHandler
- #3: Add proper callbacks to the listeners when the movement bounds
changed from config change, ime change, or aspect ratio change. This
allows SysUI to calculate the associated movement bounds for the
expanded state, and we can then remove the corresponding WM call.
It also means that SysUI is the only thing that needs to know about
the expanded state.
- #4: Fix issue where TV was getting the default bounds, not taking the
aspect ratio when the PiP was entered into account. Doing #3
allows us to report the right bounds.
- #5: Remove dead code related to edge snapping/minimizing now that they
are on by default and associated tuner setting, and controller
callbacks

Test: android.server.cts.ActivityManagerPinnedStackTests (all existing tests pass)

Change-Id: I3ef361bdf8d44094b4c0a11c70ba4db7d697fdec
Signed-off-by: Winson Chung <winsonc@google.com>
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5cd907d3d6ceebf8731ef1f69347cce6f76109e9 26-Jan-2017 Wale Ogunwale <ogunwale@google.com> Alert Windows behavioral changes

- Introduced TYPE_APPLICATION_OVERLAY window type. Can be used by apps
to display windows on top of other app windows, but below critical
system windows.
- Deprecate alert window types TYPE_PHONE, TYPE_SYSTEM_ALERT,
TYPE_SYSTEM_OVERLAY, TYPE_PRIORITY_PHONE, and TYPE_SYSTEM_ERROR.
Apps should now use TYPE_APP_OVERLAY for this.
- Apps targetting O or greater are not allowed to add the old alert
window types.
Apps targetting less than O can still add the old types.
Apps with permission INTERNAL_SYSTEM_WINDOW (system signature apps) can
still add the old types.
- Z-order old alert windows types below TYPE_APPLICATION_OVERLAY if
they are added by an app without the INTERNAL_SYSTEM_WINDOW permission.

Test: android.server.cts.AlertWindowsTests
Bug: 33256752
Change-Id: I12170955a7a333151d3387c169b51c53c32164fc
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a99952c18db3e40ea50eb36bf8978ac29cf1fbb3 01-Feb-2017 Bryce Lee <brycelee@google.com> Merge "Revert "Allow opening activity to specify orientation.""
2fb7de3d51bea5daf8790c0bc5070bd2ecba2a2a 01-Feb-2017 Bryce Lee <brycelee@google.com> Revert "Allow opening activity to specify orientation."

This reverts commit f0a6fdbf53882949db0a141693dd33302b42d51b.

Reason for revert: Submitted before complete.

Change-Id: I545ff45b5e870c79d66884b7a2a80981293b1b24
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
26dbff358ce258af5c3ef31ef4f98c976961fa94 01-Feb-2017 Bryce Lee <brycelee@google.com> Merge "Allow opening activity to specify orientation."
f0a6fdbf53882949db0a141693dd33302b42d51b 24-Jan-2017 Bryce Lee <brycelee@google.com> Allow opening activity to specify orientation.

An activity's window is initially not visible. This means it is not
accounted for until it becomes visible, which means requested
orientations will not be honored until after onCreate.

This changelist removes the visibility check previously used determining
the orientation.

This changelist also addresses an issue where an ActivityRecord member
variable tracking the last configuration sent was not being initially
updated.

Fixes: 33844887
Fixes: 33814250
Fixes: 34165818
Fixes: 34177026
Fixes: 33809086
Fixes: 34111451

Test: Verified reported issues fixed in apps mentioned in bugs
Test: Added additional unit tests to exercise override getOrientation.

Change-Id: I26b7e808b6f3d857543e3a187b6c318e88afa063
Signed-off-by: Bryce Lee <brycelee@google.com>
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3bf2e57f8d8823f02c4e1d7bc954c4ed7c68ab84 22-Nov-2016 Albert Chaulk <achaulk@google.com> Propagate surface type and owner through to SurfaceFlinger.

This allows VrWindowManager to identify things like permission
dialogues in the list of SurfaceFlinger layers that show up while a
VR application is running and display them without leaving VR mode.

Bug: 30984984
Test: Run VR application, request permission at runtime, observe and
accept permission in VrWindowManager without leaving VR mode.

Change-Id: I347313b5fcd08dea3cd6fddfaeb15640938e3a87
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
408afbf06040ea29d1a9d60e9dc50d1923068de4 25-Jan-2017 Romain Guy <romainguy@google.com> Change configuration's color mode based on the display's color mode

Bug: 32984164
Test: CtsContentTestCases

Change-Id: Iedc7d1cc488b80718576082667b6e96956c4f847
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
1666e317dc1a17e9435246ec6c8209dbb6ee3696 16-Dec-2016 Wale Ogunwale <ogunwale@google.com> Added StackWindowContainerController

For linking ActivityStack in AMS to TaskStack window container in WMS.

Change-Id: I8b9eaef49e62854d59b22d27f80f5935a5a4d7fc
Bug: 30060889
Test: bit FrameworksServicesTests:com.android.server.wm.StackWindowContainerControllerTests
Test: bit FrameworksServicesTests:com.android.server.wm.TaskWindowContainerControllerTests
Test: Existing test pass and manual testing.
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2899a69295a92d1222a5c75e0f656ea898b03b95 23-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes I72139780,I8e563654

* changes:
Fix screenshotting with includeDecor=true in multi-window
Implement restoring & correct caching of snapshots
7361babf94baa985eaa8bd2e94fcb16f00670998 16-Jan-2017 Jorim Jaggi <jjaggi@google.com> Implement restoring & correct caching of snapshots

Introduce a retrieval cache that holds the last accessed
snapshots, in addition to the cache of the activities
that are the top most activtiy of a task that have a
running process.

Change everything to use an integer id instead of a Task object
to work around the issue that some tasks SystemUI might access
might not exist in WM yet (not yet restored from recents).

Don't put anything in the cache on the SystemUI side, but still
retrieve the thumbnails after a task changed event to make sure
the cache on the system_server side is fresh.

Test: runtest frameworks-services -c
com.android.server.wm.TaskSnapshotCacheTest

Bug: 31339431
Change-Id: I8e56365459a677735320adaa169da8fb033ceab0
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4cbec883f103b9c6bf553ef4f77df492287d30dc 21-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Set permissions for launching on private displays"
fb1bf69d5d7fc8c45e3ddbb8916e21ae57432ff1 17-Jan-2017 Andrii Kulian <akulian@google.com> Set permissions for launching on private displays

- System UIDs must be allowed to launch anything and everywhere.
- Display owner must be allowed to launch activities on it.
- Apps that are already on target display must be allowed to launch
there.
- All other apps mustn't be allowed to launch on private displays.

Bug: 34230873
Test: android.server.cts.ActivityManagerDisplayTests
Test: #testPermissionLaunchFromSystem
Test: #testPermissionLaunchFromAppOnSecondary
Test: #testPermissionLaunchFromOwner
Test: #testPermissionLaunchFromDifferentApp
Change-Id: Ic98005649a6368370c512e822cba4e9decc18ae9
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f9084ecae2e0f042730ab32b9c94204a0e21bb2a 16-Jan-2017 Jorim Jaggi <jjaggi@google.com> Persist task snapshots to disk

So they can be used again after rebooting or when the process gets
killed, but the snapshot is still used for recents.

Also implement TaskSnapshotLoader, to restore it from disk. The
infrastructure around restoring and caching snapshots for recents
will be implemented in the next CL.

Test: runtest frameworks-services -c
com.android.server.wm.TaskSnapshotPersisterLoaderTest

Bug: 31339431
Change-Id: Iaec03c4cc92e04b6dd7e623bca755ddc92613bce
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2ec59897cf892666146f378825d2adcf972248ac 18-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes I01e81b9c,I532c2d74

* changes:
Add a listener when task snapshots change
When app dies, destroy snapshot
fb9d78afb77b1d304b24f470a637244d52a7e1df 05-Jan-2017 Jorim Jaggi <jjaggi@google.com> Add a listener when task snapshots change

Since we start recents before we take the snapshot, we need to add
a mechanism to inform recents about task snapshots changes.

We add a new method to TaskStackChangedListener,
onTaskSnapshotChanged, which gets called whenever a task snapshot
changes. Then, SystemUI registers such a listener and updates the
task thumbnail view for the specific task.

Test: Open app, press recents, make sure thumbnail is up-to-date
Bug: 31339431
Change-Id: I01e81b9cd11886da734da671c68d5732aa51009f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
10abe2fe297ce1ec60c15a3bd947757aee5b14b3 03-Jan-2017 Jorim Jaggi <jjaggi@google.com> When app dies, destroy snapshot

Also destroy snapshot when we remove the AppWindowToken.

Test: runtest frameworks-services -c
com.android.server.wm.SnapshotCacheTest
Test: Open app, go home, kill app, make sure snapshots are
destroyed.

Change-Id: I532c2d7499a86164175f9fcbc8b77c6eb6bfeae6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
059df13f3253dceb9d38c29d708e355221faedab 17-Jan-2017 Andrii Kulian <akulian@google.com> Merge "Add unit tests for 180 degree rotation"
6c7dcd8a46f1c43257512451a773ae53a3de4336 17-Jan-2017 Andrii Kulian <akulian@google.com> Merge "Relayout window when rotated landscape <-> seascape"
6a7a85991d38e1e0fc6d33edede5be64e67560c7 12-Jan-2017 Jorim Jaggi <jjaggi@google.com> Use screenshotToBuffer

To avoid copying buffers. Yay!

Test: Open app, go to recents, make sure screenshot is showing.
Bug: 31339431
Change-Id: I62736b8ba9ca45155d602286de8280304160bbd6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b2e37802995e710c4a4d7b28e35c0b584ad2be7a 11-Jan-2017 Andrii Kulian <akulian@google.com> Relayout window when rotated landscape <-> seascape

When 180 degree rotation happens there is no real configuration
change, so an application window could miss an update, which
caused visual artifacts.
In this CL layout is forced when rotation changes.

Test: Unit tests in ag/1778638.
Bug: 33607506
Change-Id: Ia1e3375212bade9061d6e1d9679604e67c50da20
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4ede3e0d0a9e76c701db19e073d2d1ff487d2a64 12-Jan-2017 Andrii Kulian <akulian@google.com> Add unit tests for 180 degree rotation

These tests if an app window token reports resize when device is
rotated from landscape to seascape.
There is also some additional plumbing to be able to perform a
rotation in unit test. Also dynamic stacks are now allowed to
influence the orientation of the device.

Test: bit FrameworksServicesTests:com.android.server.wm.AppWindowTokenTests
Bug: 33607506
Change-Id: I7b23e2de48d56c9fe485eae6a165378dbbbd08bb
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e2c77f903504766102fe545af40c3e4ebcb3adc7 29-Dec-2016 Jorim Jaggi <jjaggi@google.com> Handle content insets for snapshots

Pass information about content insets of a snapshotted task to
SystemUI and use it there to correctly offset the snapshot
when drawing.

Test: Open app, go to recents, make sure app aligns before
and after the animation.
Bug: 31339431
Change-Id: I2ff9bd44534bd8f66b591385da1e1e3aec40b6c5
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
02886a82d876aa5e31a92444fec70208599c509c 06-Dec-2016 Jorim Jaggi <jjaggi@google.com> Initial implementation of snapshots

All this functionality is hidden behind a flag. If this flag is
active, we disable the regular screenshots.

Instead, we take a screenshot when an app transition for which a
task is disappearing is starting. The screenshot gets stored
into a gralloc buffer. SystemUI uses a new method to retrieve
a snapshot gralloc buffer and then draws it using GraphicBuffer.
createHardwareBitmap().

When starting an existing activity in an existing tasks, or when
bringing an existing tasks to front from recents, we add a new
snapshot starting window. For that, we reuse the existing
starting window, but when creating the window, we use a fake
window that draws the contents of the starting window.

Test: runtest frameworks-services -c
com.android.server.wm.TaskSnapshotControllerTest
Bug: 31339431
Change-Id: If72df07b3e56f30413db5029d0887b8c9665aaf4
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e1fe7fa288a34ecaaab390f49ef540edc4a6c52d 16-Dec-2016 Wale Ogunwale <ogunwale@google.com> Added TaskWindowContainerController

For linking TaskRecord in AMS to Task window container in WMS.

Bug: 30060889
Test: bit FrameworksServicesTests:com.android.server.wm.AppWindowContainerControllerTests
Test: bit FrameworksServicesTests:com.android.server.wm.TaskWindowContainerControllerTests
Test: Existing test pass and manual testing.
Change-Id: I16248f3e96e5087ba24198a48a3bd10a12ae76a6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ba41f4b9e3629c097cdd7b6538c5bcf4602728b8 15-Dec-2016 Jorim Jaggi <jjaggi@google.com> Clean up starting window to prepare for saved surfaces

- Move all starting window logic to AppWindowContainerController
- Use startingView to hold any kind of contents for startingWindow
- Remove some conflicting code which looks very old and doesn't
apply anymore.

Test: Make sure starting window still works.

Bug: 31339431
Change-Id: I018dd013ab7e64a44932b6d54ae9bb4a47f315d3
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
6fd63e4df682dfbcc2b86393216a31bd2163e484 07-Jan-2017 Andrii Kulian <akulian@google.com> Merge "Fix selecting focused stack with secondary displays"
7fc22812ce8ef74f9d005f33c30dbeb2ea837ab3 28-Dec-2016 Andrii Kulian <akulian@google.com> Fix selecting focused stack with secondary displays

When the last activity finishes in the stack we're looking for other
stacks and making it focused. However we weren't doing that if the
stack was on a secondary display, so the focused stack records were
not updated in stack supervisor.

Now we're looking for other stacks on the same display first. If there
is nothing focusable left - shifting focus to next focusable display.

Test: android.server.cts.ActivityManagerDisplayTests
Test: #testStackFocusSwitchOnDisplayRemoved
Test: #testStackFocusSwitchOnStackEmptied
Change-Id: Ifbb893e12cbe9c4928b949a86fc8bc027de181e4
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
26c0dfed7a0cd54abafdd0ccbb5b757506d51c76 14-Dec-2016 Wale Ogunwale <ogunwale@google.com> Support for WindowContainer controllers and listeners

- WindowContainerController class allows a component outside window manager
to create a window container and communicate directly with it to make
changes. For example, the ActivityRecord class in activity manager uses the
AppWindowContainerController class to create and communicate with
AppWindowToken window container class which is its counterpart on the window
manager side.
- WindowContainerListener interface allows a component outside WM to get
notified of changes to a window container. For example, the ActivityRecord
class in AM implements the AppWindowContainerListener interface to get
notified of changes to the AppWindowToken container.

Bug: 30060889
Test: Existing tests pass and manual testing.
Test: bit FrameworksServicesTests:com.android.server.wm.WindowContainerControllerTests
Test: bit FrameworksServicesTests:com.android.server.wm.WindowContainerTests
Change-Id: I2896bfa46a80b227052528c7da8cf4e56beab4bc
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
555a59ad27412a08eb0b8f2724a36ba3443d90b2 04-Jan-2017 Tony Mak <tonymak@google.com> Allow current profiles to disable keyguard

Test: make cts -j20 && cts-tradefed run cts --module CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testScreenCaptureDisabled_allowedPrimaryUser
It is not really a CTS verifies the change directly.
But I can observe that keyguard is dismissed by a test running in managed profile

Bug: 34049587
Change-Id: I94e3d0cd01b10f31745781f35fdc8e3554994db8
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4a3258fa1dfc030ef22cb0bd1b1ab0afa71c9392 30-Dec-2016 Robert Carr <racarr@google.com> Do not wait for configuration when it won't change.

When updating orientation the configuration won't change
if we are rotating 180 degrees. It seems previously there were
redundant calls to setNewConfiguration et. al. clearing this flag.
Those aren't happening anymore, so it doesn't get cleared, leaving
the screen frozen.

Test: Manual repro of bug steps.
Bug: 33956442
Change-Id: I01c612a6d7f920ad7abf64aa97558bebde6bb49c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d276563b38907647ce70940e1e90603826df6ab4 13-Dec-2016 Andrii Kulian <akulian@google.com> Add positionChildAt method to WindowContainer

Added method to change the position of a child among siblings.
It accepts int value, which can either specify a target position
or POSITION_TOP/POSITION_BOTTOM.
When child is moved to top or bottom, there is an option to also
perform same action on parents. This will effectively move the
entire branch of the hierarchy tree to top/bottom.

Test: bit FrameworksServicesTests:com.android.server.wm.WindowContainerTests
Test: #testPositionChildAt
Test: #testPositionChildAtIncludeParents
Test: #testPositionChildAtInvalid
Test: bit FrameworksServicesTests:com.android.server.wm.TaskStackContainersTests
Test: bit FrameworksServicesTests:com.android.server.wm.TaskStackTests
Change-Id: I6ade787487055f1c9a305afea64270c243196614
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a29eb98d9fba99528f0809c448daf2ddae37de7e 14-Dec-2016 Winson Chung <winsonc@google.com> Adding support for PIP actions.

- Introduced generic RemoteAction to represents an action
that can be made across processes with an icon and text
description based on a Notification action.
- Modified PinnedStackController to ensure that it notifies
the listeners from the source of truth, this ensures that
SysUI is in the right state if killed and re-registers
itself.

Test: Enable menu & minimize in SystemUI tuner.
Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testNumPipActions

Change-Id: I5b5d0cf9de3f06b5687337d59cfb91e17355bdb1
Signed-off-by: Winson Chung <winsonc@google.com>
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
72919d2c310db04fdb860e926ccb0bfe6e3aef08 09-Dec-2016 Wale Ogunwale <ogunwale@google.com> Untangle creation of Task from addition of AppToken in WM.

Makes it easier to follow what is going on and also clean-up in
preparation of stand way for AM to interact with containers in WM.

Test: Existing tests pass and manual testing
Change-Id: I91754b6d974dce2f696453cdaed175efb0f10c73
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
40db029cfeb263b5b672ca687c347e58ed2ad2ae 28-Jun-2016 Jorim Jaggi <jjaggi@google.com> Light navigation bar support (1/2)

Test: Open an app that has this flag set.

Test: android.systemui.cts.LightBarTests

Bug: 29058491
Change-Id: Idaff65fdd5c59b68ae9920726c9ea50b53f96675
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
322347ba58f02b960dc87eca3cb0ebe0455c9253 02-Dec-2016 skuhne@google.com <skuhne@google.com> Adding orientation preserving resizing

Adding freeform resizing to activities which require
a certain orientation. This is needed for e.g. ARC++.

Bug: 33267688
Test: runtest frameworks-services -c com.android.server.wm.TaskPositionerTests
Test: Visually on ARC++
Change-Id: If708c1602cb2ff464174389af4648ad767b0b079
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
cb566f368bc3b83640f3f75f64c1e29641e362df 07-Dec-2016 Mark Renouf <mrenouf@google.com> Revert "Allow power button to close an input method" am: 28f0e5bf48
am: fc526f6e84

Change-Id: Ifcf2f842c91677128e458dd7256013263543937f
28f0e5bf48e2d02e1f063670e435b1232f07ba03 02-Dec-2016 Mark Renouf <mrenouf@google.com> Revert "Allow power button to close an input method"

This reverts commit d28e907183fe48afc1ea0cb4f939b738cbcc2506.
Test: manually tested

BUG: 33038203
Change-Id: I7a4c6e95a69abb2e40df73509b6e67b93eacf6ff
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
6213caa42d89cc446de4f8f9ba00630f166f23cc 02-Dec-2016 Wale Ogunwale <ogunwale@google.com> Revert "Revert "WindowList be gone!""

This reverts commit ffa5a9de0c127cb77ddec625fea101ddddb7ad32.

Bug: 33098800
Bug: 33098294
Test: Existing tests pass.
Change-Id: I5803a010c5a224dd1cf452a4a7beb3a4c0a043f4
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3d0bfd9530bc51c52aec027eaf6d0dba918efc99 05-Dec-2016 Wale Ogunwale <ogunwale@google.com> Prevent orphaning of windows when token is removed

When the owner of a window token requests window manager to remove the
token, we were removing it from it's parent which orphaned the token
and all it's windows and prevented them from being accessed from calls
like forAllWindows(). This problem wasn't visible before as the token
windows would still be in the window list, so they can still be accessed
for the exit animation transition which eventually removes them.
We no longer remove tokens from their parent we when are asked to remove
them from the system. We just set WindowToken.setExiting() so the token
can be removed once all its windows are removed at the end of the exit
animation.

Also,
- In AppWindowToken.removeIfPossible() and Task.removeIfPossible(), call
removeImmediately() instead of parent.removeChild() to make sure the
token and its windows are properly clean-up and avoid orphaning if they
aren't.
- Added DisplayContent.reParentWindowToken() for changing the display a
window token is on which is different from DisplayContent.removeWindowToken
which prepares the token and it's windows to be removed from the system.
- Renamed WindowToken.explicit to WindowToken.mPersistOnEmpty which is
what it does.

Fixes: 33098800
Test: bit FrameworksServicesTests:com.android.server.wm.WindowTokenTests
Test: Make sure toast windows don't persist on screen.
Change-Id: I40e0e8832141514b614e79d8e95cd27f24e52366
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2a66bdb6fb2c988c939685470976ee0214a09673 02-Dec-2016 Jorim Jaggi <jjaggi@google.com> Merge "Don't prepare transition if token is not visible"
b198b74c145218e9f4f596f9ba847873cf60e060 01-Dec-2016 Wale Ogunwale <ogunwale@google.com> Don't send SCREEN_ORIENTATION_UNSET to apps.

SCREEN_ORIENTATION_UNSET is an internal implementation detail of how WM
now handles WindowContainer requesting a specific orientation. The
container will return SCREEN_ORIENTATION_UNSET for getOrientation method
if it should affect the device orientation under specific conditions like
when it isn't visible. However, we still want to return the requested
app orientation if someone from outside WM asked for it regardless of if
the app is visible or not.

Bug: 33067025
Test: Adding a new document in the Drive app with the scan option doesn't crash.
Change-Id: I53aee1afaa311994520f573139aea9a0d87bc8e6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
aaaf9cf8260716a82d1d38444029989c7069312a 29-Nov-2016 Jorim Jaggi <jjaggi@google.com> Don't prepare transition if token is not visible

This led to an issue that atoken was added to opening apps,
regardless of its requested visibility state, thus making apps
visible that should not be visible at all, because once it's
added to opening apps, it will become visible when the app
transition is being executed.

Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test
android.server.cts.KeyguardTests#testUnoccludeRotationChange

Bug: 32771855
Change-Id: I375db25658ff95a6c6cc8e204486a1e73d2b2b88
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
cf952e74b0079f3ff0b8cf5351bbf1bebfb06617 01-Dec-2016 Mark Renouf <mrenouf@google.com> Allow power button to close an input method am: d28e907183 am: 8da4ced46c
am: 9a21708ec6

Change-Id: I63d939d4dbd889cbd6f83ef101d817ccd561d707
fed8c7dc7366c9e0f477a5b3fa057380c6bf77f8 01-Dec-2016 Mark Renouf <mrenouf@google.com> Allow power button to close an input method
am: d28e907183

Change-Id: I26176ab20b90ca2c5d286b3f34bfacc6527018b5
8da4ced46c8a8ac67dd43f8178b6c8d28d73a64a 01-Dec-2016 Mark Renouf <mrenouf@google.com> Allow power button to close an input method
am: d28e907183

Change-Id: I0324d14bde85e3461d0fe605f3b83496b25b9c75
d28e907183fe48afc1ea0cb4f939b738cbcc2506 29-Nov-2016 Mark Renouf <mrenouf@google.com> Allow power button to close an input method

BUG: 33038203
Change-Id: I5c44dc49db6b960b4e3e42545bfbbab62f357f08
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
7b62df8556ff6febd8137b9a8bcd755b1f93a1f9 30-Nov-2016 vinodkrishnan <vinodkrishnan@google.com> Revert "DO NOT MERGE Wear Fwk: Disable Animations for A11y"

This reverts commit 8500f26d51e2ba0de7b6cd18bec5f85e5ca40e1d.

Change-Id: I6408fa3f307d7611443e26b24d3876c1a1f92fdc
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ca007a6284d487bc560e62a7dd5ebe04334cb6c1 23-Nov-2016 Andrii Kulian <akulian@google.com> Check if the display is attached when updating config

The display might not be added yet or be already detached when
config is updated.

Bug: 32983305
Test: android.media.cts.EncodeVirtualDisplayWithCompositionTest
Test: #testVirtualDisplayRecycles
Change-Id: I3b0e52e8ebb93a57ab6b0e80c0599db33ce2ae03
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d25cf04e9880c69d370bab21de0068cec5502267 29-Nov-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add explicit method to dismiss Keyguard"
cd941213a237073fea567f0faf0098ec23459fb5 27-Nov-2016 Nick Kralevich <nnk@google.com> Revert more integrity check changes.

The integrity checking features never shipped as part of a release.
Delete the stale code.

This conceptually reverts the following commits:

* c7d64c134ae786cc41af78a3e7dfbfeda8be4287
* ee2b49283261f7b4518ec7c98f568f883f817c9d

Test: Device boots and no obvious problems.
Change-Id: I8d1589b38ddbcdf26f5132476b8cdfba7ef439cd
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ffa5a9de0c127cb77ddec625fea101ddddb7ad32 23-Nov-2016 Jorim Jaggi <jjaggi@google.com> Revert "WindowList be gone!"

This reverts commit 4551c8bbee4114fa884938dbe90ac0d06ca78fc5.

Reason for revert: Broke a lot of things!

Bug: 33098800
Bug: 33098294
Change-Id: I307b1c7ee39445d6155a4bbce2bf5f289de55285
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
241ae10b2189f449e57d8d660235ac56d8fb1b80 03-Nov-2016 Jorim Jaggi <jjaggi@google.com> Add explicit method to dismiss Keyguard

The flag is a bit clunky for most cases, and a method is more
clear.

Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test
android.server.cts.KeyguardTests

Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test
android.server.cts.KeyguardLockedTests

Test: runtest systemui -c
com.android.systemui.keyguard.DismissCallbackRegistryTest

Bug: 30961403
Bug: 27422134
Change-Id: I39de90c7cfecd99350a74f72cd76418e337f2b79
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4551c8bbee4114fa884938dbe90ac0d06ca78fc5 10-Nov-2016 Wale Ogunwale <ogunwale@google.com> WindowList be gone!

The use of DisplayContent.mWindow list to track all windows is
no longer needed as we can now get windows through the window
container hierarchy with methods like forAllWindows. The window
list was also a very complicated logic to understand and maintain,
so it won't be missed :)

Bug: 30060889
Test: Existing tests pass
Change-Id: I590cb33aa0f42bcd4a26ddce102f05e657f54144
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
db8e106fa35ca75f4a8bf9795edc7676fbf8e003 16-Nov-2016 Andrii Kulian <akulian@google.com> Don't include sysUI insets on secondary displays

Currently there is a single instance of WindowManagerPolicy
used in Window Manager and it is configured according to
primary display settings. Because of that it reports display
size with navigation bar insets even for secondary displays.

This CL adds displayId param, so it can adjust reported metrics
correctly when requested.

Bug: 32910901
Test: android.display.cts.DisplayTest
Change-Id: I14967fc13907c4fde17aed6a769d03cbde3ec1be
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
7c73dd6a204f82794bac25fa13a4e5f6b9e4a99e 15-Nov-2016 Wale Ogunwale <ogunwale@google.com> Merge "Removed WallpaperController dependency on WindowList."
dc589ac82b5fe2063f4cfd94c8ae26d43d5420a0 11-Nov-2016 Sudheer Shanka <sudheersai@google.com> Update usage of ActivityManagerNative.

- Remove references to ActivityManagerProxy.
- Add isSystemReady to ActivityManager.

Bug: 30977067
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test android.server.cts
adb shell am instrument -e class com.android.server.am.ActivityManagerTest,com.android.server.am.TaskStackChangedListenerTest \
-w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I07390b6124fb1515821f5c0b37baf6ae74adc8fa
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f4ebe2e2ccfcbce9de7ad0c3b5399971201f66fd 09-Nov-2016 Wale Ogunwale <ogunwale@google.com> Removed WallpaperController dependency on WindowList.

WallpaperController now accesses the container hierarchy directly
to determine the state of the wallpaper windows and targets.

Bug: 30060889
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test \
android.server.cts.ActivityManagerTransitionSelectionTests

Change-Id: Ib70beaf340f257ad4e1093cc127f81e7adf41636
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
059de0230bb81b6089606392a3d842d20394247e 13-Nov-2016 Wale Ogunwale <ogunwale@google.com> Merge "Removed used of DisplayContent.getReadOnlyWindowList()"
7075d79cabb3c23540bdcbd07b772705a14e932f 11-Nov-2016 Winson Chung <winsonc@google.com> Merge "Adding API for apps to specify their aspect ratio when entering PIP."
84a3834a0c23c4fee4f909f986ba6975a87c807b 09-Nov-2016 Winson Chung <winsonc@google.com> Adding API for apps to specify their aspect ratio when entering PIP.

Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testEnterPipAspectRatio
Test: #testEnterPipExtremeAspectRatios

Change-Id: I9efba942b9a6451dec07428fe1e428ef4a896867
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d1880960581d526cbaed0566d522987d9301b293 08-Nov-2016 Wale Ogunwale <ogunwale@google.com> Removed used of DisplayContent.getReadOnlyWindowList()

Changed the call points to use DisplayContent.forAllWindows() to
get windows on the display.

Test: Existing tests pass.
Change-Id: I6f8bf15ba246fac69c4a496ebb1d9e0b9b6a95a2
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
72c532acbb11db8205bc9b5e2ae760b1ec34d1aa 10-Nov-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Traverse window hierarchy without window list"
446e723c0885773716f365328aa4a7c242a6c9a2 10-Nov-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "The big Keyguard transition refactor (8/n)"
b783fd8a0866ad0c18dff333af73e2d49ff2b680 04-Nov-2016 Wale Ogunwale <ogunwale@google.com> Traverse window hierarchy without window list

Added support for to get all windows in the hierarchy without needing
to use WindowList concept which is a very complicated implementation
in the code base.
This implementation walks the hierarchy node by node returns windows
in order to the caller using a callback.

Test: bit FrameworksServicesTests:com.android.server.wm.DisplayContentTests
Change-Id: I2719f7c96f26dad23f91c1c589be88712bd224b8
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e69c93181f1f313dcedd07f677af1cea953fdf16 01-Nov-2016 Jorim Jaggi <jjaggi@google.com> The big Keyguard transition refactor (8/n)

Don't force mKeyguardGoingAway, as this never recovers. Make sure
to only show the dismissing Keyguard activtiy and recover the
state when trusted state changes.

Test: Make sure Keyguard is in a trusted state, start an activity
with FLAG_DISMISS_KEYGUARD from FLAG_SHOW_WHEN_LOCKED activity
and make sure there is no flicker.

Bug: 32057734
Change-Id: I5d212f6f9d5430250b22c8370f45dc95756432d2
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
664e8e582957315ef4c4f3106614e1b4205191ab 09-Nov-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Move wallpaper related methods to WallpaperToken"
879ff721bed9999540c0b03acf4843886b7c3a75 05-Nov-2016 Jorim Jaggi <jjaggi@google.com> Move wallpaper related methods to WallpaperToken

It was a bit weird to have them in WindowToken, so we create
WallpaperToken where they have a better home.

Test: Device still boots, wallpaper scrolling still
works.
Change-Id: I81576420f31e01a0ac615f6dcb73fec201b14be8
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
964c68e03a3a5034ab2a3533be450cc9abf9b2cb 28-Oct-2016 Phil Weaver <pweaver@google.com> Send accessibility event on window title change.

Forcing the layout params to be sent to
WindowManagerService, and from there to accessibility
to generate the event.

Bug: 27857482
Test: Adding corresponding CTS.
Change-Id: I24fc97e16b95799259e4c472b6f1052a1dd00a56
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
cb291f38f8aa1517ca66c7331765becb47442edd 04-Nov-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add shell command to move activity stacks between displays"
839def9b549b6279aabd4150b304999e58d15762 02-Nov-2016 Andrii Kulian <akulian@google.com> Add shell command to move activity stacks between displays

Also rename "stack movetask" command to be consistent with other
shell commands.

Test: New CTS tests coming soon.
Change-Id: I3d7e04e0ae8ea76c27c3e4c1e286d5cd4539870c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3a9316945432d79eebd08b7122b2222a1983d8a9 03-Nov-2016 Wale Ogunwale <ogunwale@google.com> Order non-app window containers.

- Add non-app window tokens to the display child container based on
their base layer so the highest based layer is z-ordered on-top.
- Separated DisplayContent.mNonAppWindowContainers into
mAboveAppWindowContainer and mBelowAppWindowContainer where the former
contains non-app windows that should be z-ordered on-top of all app
windows and the later contains non-app windows that should be
z-ordered below app windows.
- Change wallpaper base layer to 1 so that it is always below all other
window types.
- Add Ime related windows/tokens to DisplayContent.mImeWindowContainers
so that we can track them together
- Use alternative binder token when adding window TYPE_INPUT_METHOD_DIALOG
so that it can properly be associated as an IME token in WM vs. with
system_server or sys-ui token.

Test: Existing tests pass.
Bug: 30060889
Change-Id: Ib53e09af12545868c3741d83aaccb7311c872b41
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ad5d2846432b38a89df8d3fa7062f761a7c9abd8 02-Nov-2016 Jorim Jaggi <jjaggi@google.com> Cleanup dumpstate for CTS tests

Change-Id: Iefd7f2863b1a2d8974d0cd1c27b1d3b2d3ffbe8e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ac2561e8206ac42921bb6ddbb0a5972fb360e394 01-Nov-2016 Wale Ogunwale <ogunwale@google.com> Make window token add/remove APIs require displayId

Window tokens can now only be on one display, so we now require clients
that want to add/remove window tokens to specify the display they would
like the token to be created on. This simplifies the token handling code
in WM and will be useful moving forward for clients that want to add
windows to external displays.

Test: Existing tests pass
Change-Id: I6b2d8d58a913b3624f1a9a7bebbb99315613f103
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5974b4df49eb3c861d87962ea47580eee4beae31 02-Nov-2016 Jorim Jaggi <jjaggi@google.com> Merge changes from topic 'keyguard_refactor'

* changes:
The big keyguard transition refactor (6/n)
The big keyguard transition refactor (5/n)
The big keyguard transition refactor (4/n)
The big keyguard transition refactor (3/n)
The big keyguard transition refactor (2/n)
The big keyguard transition refactor (1/n)
ce55e84315ba20297d58d4f8a15428a9b9b6adb5 02-Nov-2016 Yorke Lee <yorkelee@google.com> Merge "Add a config flag to control app transitions"
044e2aef397a811c09f6d48b34e2c460b53d1e25 31-Oct-2016 Yorke Lee <yorkelee@google.com> Add a config flag to control app transitions

Bug: 32289964
Test: Build and verify that app transitions still work
and can be controlled by overlay

Cherry-picked from I78e88c4e7d3c32493c11be451b0c5ca59f68be83
Change-Id: I78e88c4e7d3c32493c11be451b0c5ca59f68be83
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8d78693157cb3fa7ab1c9072ef913af4d67c6314 27-Oct-2016 Jorim Jaggi <jjaggi@google.com> The big keyguard transition refactor (6/n)

Cleanup:
- Make sure all the state is nicely dumped.
- Remove some unused stuff.
- Fix a flicker when occluded -> unlocked

Bug: 32057734
Change-Id: Id87e26adccef740d608b325c2dc1f6db14dd4ec3
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
77e104322920cb93c0ac3d5f101115826728d3d1 27-Oct-2016 Jorim Jaggi <jjaggi@google.com> The big keyguard transition refactor (3/n)

Notify activity manager when dreaming showing state changed so
KeyguardController can update the occluded state when the device
is dreaming.

Test: Set dreaming while charging, wait until screen times out,
make sure that dream is occluding Keyguard.
Bug: 32057734
Change-Id: Ied6f485d9b4a1526cb4cd5f0701f86b1ea05830a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5a108c225a81cedacb1cec9b5b1986f2f3eff75c 13-Oct-2016 Jorim Jaggi <jjaggi@google.com> The big keyguard transition refactor (2/n)

Introduce UnknownVisibilityController, which keeps track of apps that
may or may not be visible when launching an activity behind Keyguard.
When Keyguard is occluded and we launch another activity, we don't
know whether we still have to keep Keyguard occluded until the app
has gone through the resume path and issued a relayout call to update
the Keyguard flags.

This class keeps track of that state and defers the app transition
until the unknown visibility of all apps is resolved.

Test:
1) Have an occluding activity that starts another occluding
activity, ensure that there is no flicker.
2) Have an occluding activity while the Keyguard is insecure, start
a DISMISS_KEYGUARD activity, ensure there is no flicker.
3) runtest frameworks-services -c com.android.server.wm.UnknownVisibilityControllerTest

Bug: 32057734
Change-Id: I5145b272722ab8c31dd7c5383286f5c9473e26a4
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
fe762344f4475a3a336bb46aef2d59c1fabf32ab 13-Oct-2016 Jorim Jaggi <jjaggi@google.com> The big keyguard transition refactor (1/n)

The heart of this change are two things:
1) Instead of using the force hide mechanism to hide windows behind
Keyguard, we actually make the activities invisible in activity manager.
2) When Keyguard is going away, we change the visibilities in activity
manager and run an app transition.

At the very core we move the responsibility of hiding activities to
ActivityStack, which checks whether Keyguard is showing, and then
hides all non-show-when-locked activities. For that, we need to check
whether any window of an activity has SHOW_WHEN_LOCKED set. We
introduce a callback from WM -> AM in case these Keyguard flags have
changed.

Furthermore, we decide whether to occlude Keyguard in KeyguardController,
which just checks whether the top activity has SHOW_WHEN_LOCKED set. When
this state changes, we prepare an occlude/unocclude app transition, and
in PWM we just inform the Keyguard about the animation so SysUI can play
along this animations in a mostly synchronized manner.

Since we now use an app transition when unlocking the phone, we get
lockscreen launch animations for free - window manager automatically
waits until the activity is drawn, or directly executes the transition
if there is nothing to animate. Thus, we can remove all the infrastructure
around "waitingForActivityDrawn".

The logic to show/hide non-app windows is moved to policy, and we add the
ability to run animations on non-app windows when executing an app
transition.

Test:
1) runtest frameworks-services -c com.android.server.wm.AppTransitionTests
2) Manually test unlocking Keyguard:
2a) Without security
2b) With security
2c) With security but trusted
2d) Portrait while activity behind is in landscape
3) Test launching things from Keyguard
3a) Without security
3b) With security
3c) Launch camera without security
3d) Launch camera with security
3e) Launch camera with securtiy and trusted
3f) Launch voice affordance
4) Set no notifications on lockscreen, drag down, make sure you get
the correct animation
5) Test clicking "emergency" on bouncer
5b) Test "Emergency info" on emergency dialer
5c) Test clicking edit button on emergency info, should show pattern on
Keyguard

Bug: 32057734
Change-Id: Icada03cca74d6a612c1f988845f4d4f601087558
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
423af758c91a25ce99cd3387009d53e19b4423a3 31-Oct-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Introduced ReadOnlyWindowList"
655332c641ccb12ee1ae3ce89135ca847fba1abf 31-Oct-2016 Winson Chung <winsonc@google.com> Creating PinnedStackController.

- Creating a PinnedStackController to keep track of the state of the PIP
to prevent changes in the system (ie. IME showing) and user interaction
from clobbering each other.
- Refactoring calls in AM into WM/controller

Test: android.server.cts.ActivityManagerPinnedStackTests

Change-Id: Ie59dfd45d5c54764ba69a589b3b8148845e92cc3
Signed-off-by: Winson Chung <winsonc@google.com>
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f7cab10b796d0f66eb690867ba327b4bb00165e3 26-Oct-2016 Wale Ogunwale <ogunwale@google.com> Introduced ReadOnlyWindowList

7th and Final step in making the modification of a display's
WindowList private to DisplayContent.
ReadOnlyWindowList provides an interface for external classes to
DisplayContent to access the window list without being able to
modify it. This will be important in upcoming CLs where it is
important for us to keep track of when the window list changes.

Bug: 30060889
Test: Manual testing and existing tests pass.

Change-Id: I4de0b258a40fd4b21ef9cc9e3401488f76d25f83
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8500f26d51e2ba0de7b6cd18bec5f85e5ca40e1d 27-Oct-2016 Vinod Krishnan <vinodkrishnan@google.com> DO NOT MERGE Wear Fwk: Disable Animations for A11y

- When Accessibility is turned on, Android Wear devices become unusable.
Add an option to disable animations, will be disabled in an overlay.

Bug: 24985771

Change-Id: If5fc44705d56579b305abd48a0d820f306b9be10
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
debcf7603f574478e8dd11af415796f4fa6976f0 27-Oct-2016 Andrii Kulian <akulian@google.com> Merge "Refactor stack removal methods"
6d6fb401c79aadeb35cfc66cd36cb30f92d3552f 27-Oct-2016 Andrii Kulian <akulian@google.com> Refactor stack removal methods

Refactor some parts of stack removal to make methods implementations
correspond to their names.

Change-Id: Ie686c463d67232d9d5fd96468fe3911003d22471
Test: Manual and existing tests still pass.
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
303c6b78b645a9a655e09677e4856269d278a85d 25-Oct-2016 Winson Chung <winsonc@google.com> Fix wrong bounds being used in landscape.

- Ensure we use the right display size when calculating PIP bounds.
- Also update interface to take the display id.

Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testPinnedStackDefaultBounds
Test: #testPinnedStackMovementBounds

Change-Id: I01fd8ba6dee212c29a9a092673ee8f7843e41af6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5406e7ade87c33f70c83a283781dcc48fb67cdb9 21-Oct-2016 Andrii Kulian <akulian@google.com> Apply display override config for secondary displays

Now display-specific settings, such as dimensions and orientation,
are stored in display override config. For default display it is
mirroring the global config. Each time when global config is updated,
override of the default display should be updated too and vice versa.

Test: Existing and manual tests still pass.
Change-Id: Ic6c2190092d328820f314a05bed43c875db18170
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
494009b8e3d6c2751d0c6983f24b56971f6bdf9d 21-Oct-2016 Wale Ogunwale <ogunwale@google.com> Removed WMS.getDefaultWindowListLocked()

6th step in trying to make the WindowList private to DisplayContent.
The method was another an indirect way to the the window list
from the display content.

Test: Manual testing and existing tests pass.
Change-Id: I26de316b8c20dd891a214fb40ef3991a0e895442
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e6f806e4fa5c73d6cd6334f6aafa4c7688fd3aca 21-Oct-2016 Wale Ogunwale <ogunwale@google.com> Moved display related getting of orientation into DisplayContent

5th step in trying to make WindowList private to DisplayContent.
Exact code to get orientation in WMS that is display specific
because it iterates over the window list into the DisplayContent
object.

Test: Manual testing and exiting test pass.
Change-Id: Iced72322cdebdde83882802af4a9decf323f20e1
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
0303c5723edfdb4f2db37543544d7cbe9b14df97 20-Oct-2016 Wale Ogunwale <ogunwale@google.com> Have DisplayContent be the call point for adjusting wallpaper windows

4th step in trying to make the WindowList private to DisplayContent
Have the rest of the system call DisplayContent when they need to
adjust the position of the wallpaper windows in the window list
instead of calling WallpaperController directly. That way the display
content can control the window list that the wallpaper controller sees.

Test: Existing tests pass and manual testing.
Change-Id: Iaa7f421d7cd24d36e5a83e091f77b4a08d0ae123
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
824ab5c4be2a3c3f7240178438126567d00bddec 20-Oct-2016 Wale Ogunwale <ogunwale@google.com> Removed WindowManagerService.getWindowListLocked()

3rd step in trying to make the WindowList private to DisplayContent.
The method was another an indirect way to the the window list
from the display content.

Test: Manual testing and existing tests pass.
Change-Id: Ifb0548a91b5bc64461e14f63256b61b8fa5e2e0c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ae9adbfb758712caaf11b4ba5c5fd15848dcc3c5 19-Oct-2016 Wale Ogunwale <ogunwale@google.com> Removed WindowState.getWindowList()

2nd step in trying to make the WindowList private to DisplayContent.
WindowState.getWindowList() was an indirect way to the the window list
from the display content.

Test: Manual testing and existing tests pass.
Change-Id: I634ed446661371e70b99c701c23e1bdd59ada0bc
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
cfca258639f81b33dd60aa9c05dbc4f4190ac11e 19-Oct-2016 Wale Ogunwale <ogunwale@google.com> Fixed monkey test failure

Avoid duplicate attempt to remove WindowToken from its parent
container when removeImmediately is called by first removing the
token from the display before calling super.removeImmediately
which only tries to remove the child from the parent container
if it is still attached to the parent.

Also, added test for the failure case the monkey test was
triggering.

Bug: 32239922
Test: WindowTokenTests.testChildRemoval passes
Change-Id: I4153669d18260d956c4b570944d2f48516d692ac
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
c69694abbdbfa3f0bedb034e7cc86823a72ff781 18-Oct-2016 Wale Ogunwale <ogunwale@google.com> Have DisplayContent be the call point for assigning window layers

First step in trying to make the WindowList private to DisplayContent
Have the rest of the system call DisplayContent when they need to
assign layers to windows instead of calling WindowLayersController
directly. That way all the various call points don't need to get
the WindowList from DisplayContent to pass on to WindowLayersController.

Test: Existing tests pass.
Change-Id: If869abf7ba1c33b575908006ae5ad1557abc361c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b0f3b836b9fe98d395fdbadf2cdd3603f4e0145a 17-Oct-2016 Wale Ogunwale <ogunwale@google.com> Clean up use of DisplayContent from WindowState.

Follow up to ag/1483993 where WindowTokens can now only be on one display.
Clean-up some existing code that dealt with having WindowTokens on
multiple displays.

Test: Existing tests pass.
Change-Id: Ie908eda37bc44097dea773b0fc163d35cc9baf35
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
011c85729ae5799b85c694b831ad6a8e632878cd 15-Oct-2016 Winson Chung <winsonc@google.com> Merge "Adding PIP input consumer."
412754816d2b8e83f0f5f860b13f09f53d2da05f 11-Oct-2016 Winson <winsonc@google.com> Adding PIP input consumer.

- This CL provides the framework for manipulating the pinned stack using
an input policy (to be determined later) provided by the SystemUI.

Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testNonTappablePipActivity

Change-Id: I025c41fff26ed05a35d68e59f10330680ed11ea8
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b9a07c3e59ea47377110ce00a0fd43047d411969 12-Oct-2016 Wale Ogunwale <ogunwale@google.com> Fixed issue with IME window not been added to its window token

This looks like a coding error that has always existed. The window
was added to the display window list, but not to its window token.
The issue was exposed by the switch to using the window container
hierarchy since the window was not a child of the token it wasn't
showing up in the hierarchy.

Test: Run 'adb shell dumpsys window containers' and make use the
InputMethod window shows up in the print-out.

Change-Id: I43cb5d6b3f266c1be54dd27def4c13e1ef98a4fa
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e56e9b65070d11ab01e0f5191922262e199715c2 14-Oct-2016 Andrii Kulian <akulian@google.com> Merge "Use ConfigurationContainer for holding configs in AM hierarchy"
1779e6108ab264689b7d5e5c42ba3cbca6c8189f 13-Oct-2016 Andrii Kulian <akulian@google.com> Use ConfigurationContainer for holding configs in AM hierarchy

Extract configuration holding and handling into separate class
and use it both in hierarchy in AM.

Change-Id: I19ca20152f7473af2c4a7bbedeff69422b1454eb
Test: ConfigurationContainerTests
Test: Existing and manual tests still pass.
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
aa9dd1040baf686592747209b8f3a7d29e0e7be5 13-Oct-2016 Robert Carr <racarr@google.com> Correct recently introduced logic error in seamless rotation detection. am: e441e7f15f am: bcbf6707b0
am: 486238f787

Change-Id: I0713af3eac681192e3fd411418ae87c5b062f611
e441e7f15f28c4281e18eba339755344809ce6e7 12-Oct-2016 Robert Carr <racarr@google.com> Correct recently introduced logic error in seamless rotation detection.

The code detecting whether we should rotate seamlessly (which for
example we do not support for 180 degree rotations) was moved to before
mRotation was updated, so it was always passing the same value for old
and new rotation, and we were failing to perform the 180 degree rotation
check. Correct this.

Test: Rotate the device 180 degrees at once while in Camera. Things look ok.
Bug: 32025371
Change-Id: I0ef08e8cc4e5d87fdff6d839381196c2b52e71d5
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
360a8bce7386dc9b231c698af1730e04362b6c2e 10-Oct-2016 Wale Ogunwale <ogunwale@google.com> Switch WindowState to get display content from its window token

WindowState no longer needs to track what display it is on now
that the window token can only be on one display.

Test: Existing tests pass.
Change-Id: Ia0530d73da0b1ecc17f596ec62c933637bd1c2c3
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
02319a61927041cc4d3632e94c501b7277f0bda5 27-Sep-2016 Wale Ogunwale <ogunwale@google.com> Associate WindowToken object with only one display at a time

WindowTokens were global objects that contained windows that could
be on multiple displays. This model does not work with the
WindowContainer hierarachy as children (window tokens) can not have
mulitple parents (displays).
We now:
- Track the mapping of binder tokens to window tokens per display
instead of globally . So, you can have a binder token map to
individual WindowToken objects per display.
- WMS.addWindowToken is used to create a WindowToken that clients
can then later add windows to. However, when addWindowToken is called
we don't know the display the client(s) would like to add window to.
So, we track binder tokens that we are allowed to add window for in
the RootWindowContainer and create a window token for the binder on
a specific display when we try to add a window.

Bug: 30060889
Test: Manual testing and existing tests pass.
Change-Id: I81a52a32b01c33ed32169d2da0506b688ea9bc8a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d4a00a027265e5abfae335e38bd17fd744e3a2c3 10-Oct-2016 Wale Ogunwale <ogunwale@google.com> Cleaned-up some code in WindowManager

This CL has no functional changes and I am just breaking this change
out of another large CL I am working on.

Test: existing tests pass.
Change-Id: I4c93e2b1820dc31ba28f81692f2f8f6081e1f315
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9538380376d301d126d5aedd830868622cb32559 08-Oct-2016 Colin Cross <ccross@android.com> resolve merge conflicts of 5e664d9 to master

Test: mm -j
Change-Id: I86391311447efdfac47d2d33425dae7ea3057fd1
02896ab71376aa3d9386c5e5abc51c97b69b10c5 05-Oct-2016 Wale Ogunwale <ogunwale@google.com> Fixed issue with screen rotation not working for landscape<->seascape

Problem as introduced in the refactor to change how configuration works
in activity manager in ag/1460784. With the new change we don't call back
into window manager to set new configuration if there are no changes.
The new change is correct, however window manager was relying on this to
unfreeze the display since the rotation changed.
We now have activity manager return if it updated the configuration to
window manager when the rotation changes do window manager can decide
if it needs to perform additional actions like unfreezing the display.

Bug: 31916697
Test: CTS and Manual testing.
CTS: cts-tradefed run commandAndExit cts-dev --module CtsServicesHostTestCases --test android.server.cts.ActivityManagerDockedStackTests
Manual: Launch an app that suports all orientations and rotate it from
landscape to seascape.
Change-Id: I36ddeff1ccc9f6089227147b117a865571b8571e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b14d4abc16ec7dd48737ab829e3f84b12017db7c 04-Oct-2016 Robert Carr <racarr@google.com> Prevent any rotation while seamless rotation is pending.

Various errors occur when using even the normal rotation animation while
seamless rotation is pending. So we just defer the rotation like we do
for the normal animation. Since we are doing this, we need to track
when seamless rotation finishes so we can perform a post-rotate
rotation if required.

Bug: 31749456
Change-Id: I99f189306c690ce868496460e9ca7dcc95e4ccdc
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
45f6a2718adea9592a3ead1a9ef8055c7819b02e 04-Oct-2016 Robert Carr <racarr@google.com> Prevent triggering orientation changes until previous completes.

Currently we defer rotation while the screen rotation animation
is animating, but there is an additional interval after the animation
completes where the display may not yet be unfrozen and attempting to
rotate again will not work.

Bug: 31749456
Change-Id: I5f6830d85fb326d5032b597cbed1b767f0b627f5
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9d9d8f1c0f66172d89e50e8fd12a8c2a3de221ac 29-Sep-2016 Wale Ogunwale <ogunwale@google.com> Cleaned-up RootWindowContainer.applySurfaceChangesTransaction

- Move functionality for determining interesting and all drawn states
of an app token based on the current window we are processing into
AppWindowToken.updateDrawnWindowStates() since it is mostly touching
AppWindowToken variables. Some of the fields can now be made private.
- Removed WindowContainer.updateAllDrawn() and related overrides. We
now have RootWindowContainer collect the app tokens that need to be
processed and call them directly.
- Move code to report window move to client into
WindowState.reportWindowMovedIfNeeded().
- Move WMS.updateResizingWindows() functionality to
WindowState.updateResizingWindow() as it mostly updates window state
internals.

Bug: 31794753
Test: Manual testing and existing unit tests pass.
Change-Id: I7588217d05d3e8971ce61795cb8568d835779c5e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
834bbbd753b73e7a84403910cab9e27f688b74a8 30-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add override and merged config to WindowContainer"
441e4494682144aec2ec7f19060464af3d29c319 30-Sep-2016 Andrii Kulian <akulian@google.com> Add override and merged config to WindowContainer

This consolidates usages of override and full (merged)
configs in WM objects and also adds support of per-display
configurations. Having full configs allows us to get
current applied config at any level.

Test: Manual tests pass. Added some new to WindowContainerTests.
Change-Id: I996770433c80da41265f3e14048bd23cead097f9
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2b06bfc6e90aa293c7058fc6b1d1cf22fbb2ada2 28-Sep-2016 Wale Ogunwale <ogunwale@google.com> Made DisplayContent.mLayoutNeeded private scoped.

And, added accessor methods for it to make it easier to
debug who is setting it.

Bug: 31794753
Test: Existing tests pass.
Change-Id: I517c3e5cc7535cb90c47c112d42fa1dbf0b81583
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d9eb6ce22aa631699fb3ca9af5bfc037ca3f3733 24-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fixed some test failure and log warnings."
ba51ca2c8c100ccd5f1bb7a5f34f674b12184399 23-Sep-2016 Wale Ogunwale <ogunwale@google.com> Fixed some test failure and log warnings.

- Make DisplayContent.attachStack and moveStack use the same code
path for adding child stack so they both account for the presence
of pinnded stack.
- Don't call DC.attachStack on a stack that is already on the
display. Use DC.removeStack instead to just make sure it is at the
right z-order on the display.
- Use WindowContainer.getName() when for exception messages to have
a more concise print-out for the error.
- Only try to remove a task from a stack when positioning if the task
is contained in the stack.
- Throw an exception if we try to remove a task that isn't contained
in a stack.
- Skip checking of exiting or waiting for replacement when rebuilding
window list for app tokens that are exiting.
- Properly display and intent output from WC.dumpChildrenNames().
- Have DisplayContent WindowContainer type always return true for
fillsParent() and isVisible() as displays always fill their parent
and always visible for now.

Bug: 31624623
Test: Failing test passes.
Change-Id: I8a84770feb1fd278716755cdec2900fddb9940de
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
11c26c22a25701391d740e1c945ac9b183631999 23-Sep-2016 Robert Carr <racarr@google.com> resolve merge conflicts of 668ac75 to master

Test: This is a merge resolution.
Change-Id: I553b8fcdc661a6ea26cdcf1ae31f774ba7750c79
4d44f2da95f4f0abb6965b6abf70b629d3c42b69 23-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Switched RootWindowContainer to use WindowContainer."
b4928a3c5651cd413d6315e2164a09c640f8b3e0 23-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Added RootWindowContainer"
d7755fe8d58dda06a77480d25107cf1b364cd78f 23-Sep-2016 Robert Carr <racarr@google.com> Fix animation glitch with overlapping orientation changes. am: 42769fff6f am: f7f12caa73
am: 022505eb69

Change-Id: If73dd0a1f65a83af13e8621a6ae191c938b9668e
eaabfabd84bda2975ef5bb9a9bff6d10c328913c 17-Sep-2016 Wale Ogunwale <ogunwale@google.com> Switched RootWindowContainer to use WindowContainer.

This completes the first pass of defining a hierarchy in
window manager :)

WindowManagerService is now less than 10,000 line \o/

Bug: 30060889
Test: Manual testing and existing tests still pass.
Change-Id: Ib349220e9355d1894bd62294e7696827f033887f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e05f5014905569d69d33ff323a3c62c046552789 17-Sep-2016 Wale Ogunwale <ogunwale@google.com> Added RootWindowContainer

RootWindowContainer will be the root/head of the window hierarchy.
Also, moved all access of DisplayContent into RootWindowContainer.

Bug: 30060889
Test: Manual testing and existing tests still pass.
Change-Id: Icdf80a4c053578fb91221e6f2b672e197054a6bf
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
95e413c781237ebc448b04907dc35d7458bee3df 23-Sep-2016 Robert Carr <racarr@google.com> Avoid entering display freeze mode when using seamless rotation.
am: 73a1fa7f2c

Change-Id: I269f1d0566f82885b43247aa7174db9615e88b7c
f7f12caa73d8f267e996583b3af1a99485876971 23-Sep-2016 Robert Carr <racarr@google.com> Fix animation glitch with overlapping orientation changes.
am: 42769fff6f

Change-Id: I5315a5707d0f20ba1879f7002fcf6ea54a42da72
1012458343643e899ed8ca2684380b92d73fb47b 16-Sep-2016 Wale Ogunwale <ogunwale@google.com> Switched DisplayContent to use WindowContainer

Bug: 30060889
Test: Manual testing and existing tests still pass.
Change-Id: I99f2e38da417f62e8aa65bb6582aba53fd528c1b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
7184f8804f6fadf1caf0f47cc3f0c4fbf652566b 22-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Avoid entering display freeze mode when using seamless rotation." into nyc-mr1-dev
2ff503b002baf97a4312b87d8638be4825f04ad3 22-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix animation glitch with overlapping orientation changes." into nyc-mr1-dev
73a1fa7f2cb27e615945a6d4e530fe9bfc7b35cc 21-Sep-2016 Robert Carr <racarr@google.com> Avoid entering display freeze mode when using seamless rotation.

If we enter seamless rotation through the
Activity#setRequestedOrientation->updateOrientationFromAppTokens(conf,
ibinder) codepath, it will helpfully try to freeze the display for us
after updating the orientation. Normally only
updateRotationUncheckedLocked does this and so the seamless rotation
logic there would prevent it...however in this path we fail to prevent
it and strange strange things happen.

Bug: 30642017
Change-Id: I12e94905781975f59384d609d12fa54b9fa4fba0
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
42769fff6ffe3369333ff8366f7eede5da9f2637 20-Sep-2016 Robert Carr <racarr@google.com> Fix animation glitch with overlapping orientation changes.

Imagine the following scenario:
1. We want to begin a new app transition to an app which will change the
orientation.
2. A rotation animation from a previous rotation change is in progress.
3. Windows have finished drawing the first orientation change,
so the display is already unfrozen.
In this case, we won't have a chance to select the new orientation which
our pending transition requires, because updateRotationUncheckedLocked
will bail due to the existing animation being in progress. This causes
the app behind to be revealed in the incorrect orientation (sometimes
creating landscape launchers) and the transition to be interrupted
halfway by the screenshot. In this case we can just defer the app
transition until the rotation animation has had a chance to complete.

Bug: 31098404
Change-Id: I1ae1041d3018d5681b46cd39c2d582861f0b014e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
329011cf402666678c47cd238a5170208a5bbc27 21-Sep-2016 Winson <winsonc@google.com> Removing private system ui flags from status bar flags logic. am: ab216609f1 am: b7a673ed95
am: dccfd4394e

Change-Id: Ie8bbbfb5c24957f64036e8de23d6a29e6669ea18
25c1636258eadefb8ca476575ee1a0201f546b4a 21-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fixed smoke test failures"
fa854ebaecbcc41f67deab75e99fbd7a546e187b 20-Sep-2016 Wale Ogunwale <ogunwale@google.com> Fixed smoke test failures

- Don't try to remove window from token in WMS.postWindowRemoveCleanupLocked
since it is already removed from the token before the post remove clean-up
code is called.
- In WindowToken use removeChild when removing all windows which makes sure
the right fields are set on the child.

Bug: 31624623
Test: Manual testing and failing test now passes.
Change-Id: Ibe40b5baa49b13732b3c9876f96195d393f9f49b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3a507b5da984efc6fa895e30b770a44f65a07d34 20-Sep-2016 Andrii Kulian <akulian@google.com> Extract global configuration update

- Separated config update in AM into several methods.
- Updated global config update in WM to reconfigure and
notify all displays.
- Removed redundant list of displays that are waiting for
configuration update.

Test: Manual testing and existing tests still pass.
Change-Id: I60d3013301267bd668348565dcd0a68e09023a0e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ab216609f1608e61827d955fcc9fd0560bc52e4d 09-Aug-2016 Winson <winsonc@google.com> Removing private system ui flags from status bar flags logic.

- Prevent third party apps from inadvertently changing internal SystemUI
flags through a call to setSystemUiVisibility(). These flags are only
set in the individual SystemUI components and can be updated in WMS
directly.

Bug: 29875297
Change-Id: I5ea238c8fb16a0eccd6e993d95a912acb359cee6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
718071bcaff14244e228ada86de7b20fa0ea0cfb 20-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Move updating stack override config to ActivityStack"
c463e06ede4671043bf8fe800566adbcf43aa6c1 19-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes Idcc4cdd4,I75add6a9,I2aeda867,I1ff912c4

* changes:
WindowManager: Include sigil in RemoteSurfaceTrace format.
Pass SurfaceTrace through WM command in binary format.
Log transaction state to RemoteSurfaceTrace.
WindowManager RemoteSurfaceTrace infrastructure
1e32e025ad5677ce4e3697ca026c2019fe0bd8e9 17-Sep-2016 Andrii Kulian <akulian@google.com> Move updating stack override config to ActivityStack

Also added some multi-display TODOs.

Change-Id: Iada3f84c4f57c9623fc7f116819d4e0267ebc32a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
230804a3ebaeb4324c33c6e5f56ca18f3760efb0 19-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Use Configuration#unset() instead of #setToDefaults() for clearing"
b10330d5191ebb50c397d8f3de50fda44698337a 16-Sep-2016 Andrii Kulian <akulian@google.com> Use Configuration#unset() instead of #setToDefaults() for clearing

Now Configuration.EMPTY has fontScale set to 0 instead of default 1.
To get config equal to empty unset() method should be used.
Because of incorrect usage of setToDefaults() there was a black flash
when exiting split-screen because override config was no completely
empty. Fixing that also allows us to simplify things a bit when checking
if override config changed.

Bug: 31533188
Test: manual - long-press overview to enter split-screen, repeat to exit.
Change-Id: I6bf7994ff88ebb42db2e2357b762857710432a58
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
68e5c9e93a8f1542cd988ac01ba1d98381ff4893 14-Sep-2016 Robert Carr <racarr@google.com> Log transaction state to RemoteSurfaceTrace.

Test: cts-tradefed run singleCommand cts -o --module CtsWindowManagerHostTestCases --test android.server.cts.SurfaceViewMovementTests#testSurfaceMovesWithParent
Change-Id: I2aeda867f0071bf6ac715153ab842a9f16cafa44
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3b716249cc2f94aa9842576b618998c28593be90 17-Aug-2016 Robert Carr <racarr@google.com> WindowManager RemoteSurfaceTrace infrastructure

Add "wm surface-trace" command which enables tracing of surface
commands to be switched on at runtime. Primarily intended for use
by WM CTS tests. First target in CTS will be to use show/hide
events to eliminate polling in WM tests and increase speed. Next up
looking at things like verifying various transitions and relaunch
scenarios are flicker free. Later we may want to look at a smarter
or more structured format...but it's really not much hassle to parse
the commands off a pipe so I wanted to get us started.

Test: cts-tradefed run singleCommand cts -o --module CtsWindowManagerHostTestCases --test android.server.cts.SurfaceViewMovementTests#testSurfaceMovesWithParent
Change-Id: I1ff912c405a6cb9996ee9b6e2c465d57706191ba
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f6192868fa4fcf85130ef40a90d0c96fbbca761d 10-Sep-2016 Wale Ogunwale <ogunwale@google.com> Switched Task to use WindowContainer

Bug: 30060889
Test: Manual testing and existing tests still pass.
Change-Id: Ia56767e47ad3df400e3aa2650f6386cca14659a7
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
828882a2da9c56c8a983b00da5d9902722aab7ea 17-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Configuration renaming and minor cleanup in AM and WM"
8072d11f6a41a68600a15623ca5316ca0def1856 16-Sep-2016 Andrii Kulian <akulian@google.com> Configuration renaming and minor cleanup in AM and WM

- Configuration members in AM and WM are renamed to
mGlobalConfiguration.
- Renamed parameters names in some methods to better represent
their meaning.
- Added and fixed some docs.

Change-Id: Ie51f687fe4c10dbce776435f29d6b853fda50eec
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3f4433dadb7627153939ebb7d88d080c132b7f7f 19-Aug-2016 Wale Ogunwale <ogunwale@google.com> Made Task.mAppTokens private scoped

Also, remove TaskStack.getTask() method.

Bug: 30060889
Change-Id: I1ed9710ff630b390d28e6f2146db4202e2bc860b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9adfe5776d42c9ddfd4394958993304c9d355229 09-Sep-2016 Wale Ogunwale <ogunwale@google.com> Moved rebuilding of display WindowList to DisplayContent

Some of this is also in WindowContainer and its children.
However, I hope we can remove the concept of window list in
the future.

Bug: 30060889
Change-Id: I9e531327643c28a0ba35baa812b9c2942993d7b7
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
63d4ecc7a5c23f1ebbd3d71e5054041d90df9762 09-Sep-2016 Wale Ogunwale <ogunwale@google.com> Moved window focus calculation to DisplayContent

In prep. for using WindowContainer.

Bug: 30060889
Change-Id: Ide3022b3129b3d190f631a07d7589a27c434e0c3
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5136249a7147fb205e1b861c1d42a7d1f13b73cc 09-Sep-2016 Wale Ogunwale <ogunwale@google.com> Support for specifying orientation in WindowContainer

Also,
- Fixed failing tests when they are ran as a package vs.
individual classes due to multiple window manager instance.
- Correct some isVisible logic to so a window container that
is invisible is not said to be visible, because one of its
children is visible.

Bug: 30060889
Change-Id: I1bb8730361be2a9f5ce88cd59b7d57d5a459bde6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
15ead903c69b043eeb44fc627929d4919e985df3 02-Sep-2016 Wale Ogunwale <ogunwale@google.com> Some code clean-up in WindowManager.

- Renamed DisplayContent.findTaskForControlPoint to
DisplayContent.findTaskForResizePoint as it is trying to find a task
from the resize point.
- Renamed DisplayContent.checkForDeferredActions to
DisplayContent.onCompleteDeferredRemoval as the method removes containers
whose removal were deferred.
- Added methods TaskStack.hasMultipleTaskWithHomeTaskNotTop() and
topTaskIsOnTopLauncher()
- And some other minor clean-up relating to me trying to break-up a big CL.

Change-Id: I64d03cbd9ee69bf8fa0013a49283cd434b7c8fbe
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
dab82cc04c9349b70ab723abb4c23fe666247c75 08-Sep-2016 Alan Viverette <alanv@google.com> Change density for the correct user am: df3a7cab8f am: 55768028fd
am: 48818fa811

Change-Id: I19f5810159ed772ac8ed1e9d498f8fe0036a95d0
44f2180c554684d8ce015116ad057dca06bba87d 02-Sep-2016 Wale Ogunwale <ogunwale@google.com> Introduced WindowContainer.hasContentToDisplay

We have lots of "is visible" methods and this change is an attempt
to rename one of the methods to match closer to what is actually does
and differentiate it from other "is visible" methods.

WC.hasContentToDisplay() returns true if the container or one of its
children as some content it can display or wants to display
(e.g. app views or saved surface).

WC.isVisible() returns true if the container or one of its children
is considered visible from the WindowManager perspective which usually
means valid surface and some other internal state are true.

Bug: 30060889
Change-Id: Ifbd6c277eb65a53b8035b6f34fc45196962632c1
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
df3a7cab8f534584bcef83e222372e1be9be12c5 06-Sep-2016 Alan Viverette <alanv@google.com> Change density for the correct user

Bug: 30839993
Change-Id: I5368accddfc4a03b8025a257b4155fcdc6197f11
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
94cee2b6125db6cc47e210c9dd45906d6a7c4382 06-Sep-2016 Wale Ogunwale <ogunwale@google.com> Merge "Added WindowContainer.removeImmediately to support immediate removal"
14af62567400ef46854f44df3bd1ef5b8a2d70f9 03-Sep-2016 Andreas Gampe <agampe@google.com> WindowManagerService: Fix rename

Follow-up to 71c510236c92c14efae6ff00e68cf9ad38f51c32. Required
because of a6cc361e34337c7fe293a56713910faf0f2f302c.

Bug: 30150688
Test: m
Change-Id: I68e8951c354a1f590040bffb0259198cf80ae463
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
7704af8d82de3debc4f258eea50cc185a082495b 03-Sep-2016 Svetoslav Ganov <svetoslavganov@google.com> Fix NPE am: 4b81252610 am: 8b26f5ee31
am: 11f2fa58c1

Change-Id: I4fbc8e07d2486520e327b14d464f4518ffa84a3e
71c510236c92c14efae6ff00e68cf9ad38f51c32 03-Sep-2016 Svetoslav Ganov <svetoslavganov@google.com> resolve merge conflicts of bde1d34 to master

Change-Id: Id3cef32bb97cfe8483001e71207b65bc0bc6e304
4b812526104f060aefe5cca029786bf11977b0b1 03-Sep-2016 Svetoslav Ganov <svetoslavganov@google.com> Fix NPE

bug:30150688

Change-Id: I2ae0cb76b2f6f0b47241bccc6922f1034183cc75
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
aa07653d2eea38a7a5bda5944c8a353586916ae9 02-Aug-2016 Svetoslav Ganov <svetoslavganov@google.com> Prevent apps to overlay other apps via toast windows

It was possible for apps to put toast type windows
that overlay other apps which toast winodws aren't
removed after a timeout.

Now for apps targeting SDK greater than N MR1 to add a
toast window one needs to have a special token. The token
is added by the notificatoion manager service only for
the lifetime of the shown toast and is then removed
including all windows associated with this token. This
prevents apps to add arbitrary toast windows.

Since legacy apps may rely on the ability to directly
add toasts we mitigate by allowing these apps to still
add such windows for unlimited duration if this app is
the currently focused one, i.e. the user interacts with
it then it can overlay itself, otherwise we make sure
these toast windows are removed after a timeout like
a toast would be.

We don't allow more that one toast window per UID being
added at a time which prevents 1) legacy apps to put the
same toast after a timeout to go around our new policy
of hiding toasts after a while; 2) modern apps to reuse
the passed token to add more than one window; Note that
the notification manager shows toasts one at a time.

bug:30150688

Change-Id: Ia1dae626bd9e22541be46edb072aa288eb1ae414
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
571771c3fc912e63f83b75693c0f3c85ec9622da 26-Aug-2016 Wale Ogunwale <ogunwale@google.com> Added WindowContainer.removeImmediately to support immediate removal

There are 2 types of window conatiner removals. The ones that happen
immediately and the ones that are deferred until the system is in
a good state to handle them. WindowContainer and its child classes
now support both through WC.removeImmediately() and WC.removeIfPossible()
methods.
The method names create a consistency in the codebase and also makes is
obvious what the methods will do.

Bug: 30060889
Change-Id: I459c2eef17e20cefc42e9cc542c9a3c69fc9b898
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
686ae0e3a9a380ec38f77f665375e85f73632443 26-Aug-2016 Wale Ogunwale <ogunwale@google.com> Removed debug code that is never.

We have never enabled this in all my time on the team, so instead
of including it in the re-factoring I am doing I am just goint to
remove it.

Change-Id: Ia13c8ed53e4771b0cc70834692f31afd972421ef
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d1c3791659572529dbc749b70d1c33bda1bdbc32 16-Aug-2016 Wale Ogunwale <ogunwale@google.com> Switched WindowToken/AppWindowToken to use WindowContainer

Bug: 30060889
Change-Id: Ia82aedfd9ea86410acdcd3a55a7a7fc456be2fc3
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9bc47736362d03b3f099bf018255571457403c1f 10-Aug-2016 Wale Ogunwale <ogunwale@google.com> Removed child windows from WindowToken window list

With the window container hierarchy model, containers should only
link to their direct children and delegate any operation on
decendants of their children to their children.

Bug: 30060889
Change-Id: I99ca0d181d54cfe75bbe24c1b0daaa06cf7cfd9a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
32cbdcc8c098b4a42212b3da345b929abad8ad6e 31-Aug-2016 Jorim Jaggi <jjaggi@google.com> resolve merge conflicts of c5bafe2 to master

Change-Id: I19dd5c88c664313c2f8b47d8f8fd556f630c8bf1
6626f54e658e3da44fab8a5cd6d9d3d4852e2cd1 22-Aug-2016 Jorim Jaggi <jjaggi@google.com> Add animation when unoccluding windows (1/2)

Before there was a jump-cut when a window that was occluding Keyguard
was going away, leading to an ugly flicker. To fix this, we do the
following.

- Always show windows with FLAG_SHOW_WHEN_LOCKED above lockscreen, even
if they don't "match" the currently occluding app (which is null in the
animation case)
- Move wallpaper behind last window that is not hidden by policy, so the
window doesn't get occluded by the wallpaper.
- Add a flag in the setOccluded call whether to animate or not. SystemUI
then plays a nice animation when it's set.
- Override the animation to always be the animation that happens when we
exit a window which is revealing the wallpaper behind, to make it
consistent with the home screen case.

Fixes: 30829255
Change-Id: Ib3fe20fc9003a0f9f291c974740f044ed8707e75
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9f92bc2602204562bc6d241b8c16c7349721a1c0 27-Aug-2016 Chong Zhang <chz@google.com> DO NOT MERGE -- Only use saved surface if started by launcher or moved to front
am: 813be138ae

Change-Id: Id64071882a0b90212b92234a4d0bdc67f2ee5e1a
813be138ae6f1fbe60a9efc082a30e7d25d03f7e 25-Aug-2016 Chong Zhang <chz@google.com> DO NOT MERGE -- Only use saved surface if started by launcher or moved to front

Restrict saved surface to launcher start (ACTION_MAIN&CATEGORY_
LAUNCHER), or there is no intent at all (eg. task being brought to
front). If the intent is something else, likely the app is going
to show some specific page or view, instead of what's left last time.

This solves problems like the launcher shortcuts on DeckClock,
each of them is a different intent and will show one specific
view regardless of last states. Another example is Chrome tab
opened directly by action VIEW to open some URL.

(Note that this doesn't solve the problem with Chrome homescreen
shortcuts, it will still start with saved surface (if Chrome
is already open). This is because the shortcut is a trampoline
activity that starts the real chrome tab activity, but when
the trampoline is started, the whole task is already brought
to front, and ChromeTab could become visible with the task
before we actually start it.)

bug: 31055479
bug: 27747315

Change-Id: Id3e61c61ef516b0edc1f174320f02661222f226b
(cherry picked from commit ad24f96def42016049de05220593aa049b136def)
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ad24f96def42016049de05220593aa049b136def 25-Aug-2016 Chong Zhang <chz@google.com> Only use saved surface if started by launcher or moved to front

Restrict saved surface to launcher start (ACTION_MAIN&CATEGORY_
LAUNCHER), or there is no intent at all (eg. task being brought to
front). If the intent is something else, likely the app is going
to show some specific page or view, instead of what's left last time.

This solves problems like the launcher shortcuts on DeckClock,
each of them is a different intent and will show one specific
view regardless of last states. Another example is Chrome tab
opened directly by action VIEW to open some URL.

(Note that this doesn't solve the problem with Chrome homescreen
shortcuts, it will still start with saved surface (if Chrome
is already open). This is because the shortcut is a trampoline
activity that starts the real chrome tab activity, but when
the trampoline is started, the whole task is already brought
to front, and ChromeTab could become visible with the task
before we actually start it.)

bug:27747315

Change-Id: Id3e61c61ef516b0edc1f174320f02661222f226b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
da08b4e8f579c25fbba5da6b79bb8880fabd17f1 23-Aug-2016 Chong Zhang <chz@google.com> Make sure surface control is really valid before giving it to client am: 7581cddf25 am: d3edf1e799
am: c3dd655b71

Change-Id: I78cf78f376d20db5d50ad0bd8d735287b414eaa4
7581cddf2515e9ec7c834549118b8db27e3a494f 22-Aug-2016 Chong Zhang <chz@google.com> Make sure surface control is really valid before giving it to client

Checking mSurfaceControl!=null is not enough to ensure the surface is
valid. tryStartExitingAnimation() could destroy/save the surface before
app is stopped, if it decided the surface is no longer needed.

Use WSA.hasSurface() to check if the surface control is really valid.

bug: 30766796
Change-Id: I7724f1929d4ebc3f9a7a3b19eec638d7a7d7b910
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
508a47a75586732f698690e3845b5c10f354eb9c 18-Aug-2016 Brian Carlstrom <bdc@google.com> Add missing import to fix build

Change-Id: I01d195d5bbe0372c8a35aad526e300848b31dd0e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
921f8e35d82f567b21a2faba6032b6e8f4f6f70c 17-Aug-2016 Chong Zhang <chz@google.com> resolve merge conflicts of 9391bc5 to master

Change-Id: I6de231781233826b399688dc8ead70ba515b1ccb
5e09ceb6419ec03758881bb0df6615840d8e0f5c 17-Aug-2016 Chong Zhang <chz@google.com> Add new window type TYPE_DRAWN_APPLICATION
am: fea963edee

Change-Id: If7acf1349b87d4be88a9b4f9fbd984bbd4aca8ad
f925b8df927a93b20174cde16989cd739421e48c 16-Aug-2016 Chong Zhang <chz@google.com> Merge "Add new window type TYPE_DRAWN_APPLICATION" into nyc-mr1-dev
9e47cf9a1716c4a02fb6806af7263f1ee6b3e5c2 16-Aug-2016 Robert Carr <racarr@google.com> Limit seamless rotation to TRANSFORM_INVERSE_DISPLAY children. am: aab09158e9 am: 878507072a
am: 25596584aa

Change-Id: Iafee88d9e01139a31c4694e963d6e674646895b4
fea963edeeb60c76465c0d644078def191f41e0f 16-Aug-2016 Chong Zhang <chz@google.com> Add new window type TYPE_DRAWN_APPLICATION

This type behaves like a normal TYPE_APPLICATION, except that WM
will always wait for it to be drawn before starting a transition.

WM always waits for TYPE_BASE_APPLICATION (main window), but for
TYPE_APPLICATION, it only waits if the window relayouts to visible
and gets a surface before the main window is drawn. If main window
itself is ready very fast, transition could start without the other
window.

bug: 30830849
Change-Id: Ife71a9812db7c8eba6ee4ead10ce4f31d9e93b40
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
aab09158e91d6e80e36ef06429d6227413a499b0 15-Aug-2016 Robert Carr <racarr@google.com> Limit seamless rotation to TRANSFORM_INVERSE_DISPLAY children.

In what can only be called an unfortunate workaround we require
seamlessly rotated child windows to have the
TRANSFORM_TO_DISPLAY_INVERSE
flag. Due to limitations in the client API, there is no way for the
client to set this flag in a race free fashion. If we seamlessly rotate
a window which does not have this flag, but then it gains it,
we will have an incorrect visual result (rotated buffer contents). This
means if we want to support seamlessly rotating windows which could gain
this flag, we can't seamlessly rotate windows which don't have it. This
unfortunately limits seamless rotation in N to Camera framework users,
native code, and applications without child windows. This is unfortunate
but having the camera work was always our primary use case, and it's not
as if we are offering an API for it, it's a behind the scenes
enhancement of ROTATION_ANIMATION_JUMPCUT.

Bug: 30171992
Change-Id: I082e323ee569cfc1ff2559657cc22194c251c7ec
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2c5439972f308995f14c3744db12248f1a9a48fc 13-Aug-2016 Colin Cross <ccross@android.com> resolve merge conflicts of f95418e to master

Change-Id: If2b4d34b3ba64f61214b72fd71f8767500e68a53
f8eca405c1140691cb7cb8ab8f3dc05e05cb7955 05-Aug-2016 Alison Cichowlas <asc@google.com> Add restart to GlobalActions.

Update power icon in GlobalActions for consistency
with new restart icon.

Bug: 30395806
Change-Id: I5ab20c15c889384fb685fc678fbf9ed912fcde5d
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
64b103a8c58926f63d9ef4c037534a7df87d07ef 10-Aug-2016 Vladislav Kaznacheev <kaznacheev@google.com> Dispose WMS.DragInputEventReceiver on the correct thread

WindowManagerService.DragInputEventReceiver should be disposed
on the same handler where input is being handled. This is required
to avoid races between nativeFinishInputEvent and native dispose.

Bug: 26927018
Change-Id: Ib476dc0e8a8825e1df81f1557d48b619b7f9dd8c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
c837e4bc0d86e65751de699c1f6e0502c7d4ef4d 08-Aug-2016 Evan Rosky <erosky@google.com> Merge changes Idfd40156,Ic903fc25

* changes:
Make user-switch transitions customizable
Add support for custom user-switch UI
b5bf7ee0c6f2156a8e67a8a005e31efa4b9f5e4c 08-Aug-2016 Wale Ogunwale <ogunwale@google.com> Merge "Replaced use of AppWindowToken.allAppWindows with WindowToken.windows"
78ab4f10d44f0e2b5a39556868c88ba4f57bac9f 08-Aug-2016 Wale Ogunwale <ogunwale@google.com> Merge "Add child windows to their parent WindowToken"
13a58a91d362e74933b3064a65be4bf4449cfdc4 28-Jul-2016 Evan Rosky <erosky@google.com> Make user-switch transitions customizable

Make UserSwitcherController subclassable

Add ability for keyguard to animate in without a screen freeze
by adding a keyguardAnimatingIn state that WindowAnimator and
WallpaperController can use to prevent graphical glitches

Bug: 29329555
Change-Id: Idfd40156538b4bfb1777ad1a9a566e7da54e8f32
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
1839645126c8e7e0909e8ed8f0686c2122ba6078 28-Jul-2016 Evan Rosky <erosky@google.com> Add support for custom user-switch UI

Given config_customUserSwitchUi, AM/UserController will not show any
UI during user-switch (no dialog or screen-freeze).

Provides a mechanism (WM.setSwitchingUser) by which a custom user-switch
UI can notify WM/Keyguard when it expects a user-switch operation to
be running.

Bug: 29329555
Change-Id: Ic903fc251d7ec3a54bc6a77906d3afa45a6a5fac
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4825b680f6ca934dc178613c9361a68aa29950e2 05-Aug-2016 Chong Zhang <chz@google.com> Fix WM missing stack/task when activity is force stopped and restarted am: d9d35bdfcf am: c35df3de2f
am: a7250e4291

Change-Id: I64e75a8d48088e7a2e8fe90992e2feb80eb478a4
c35df3de2f8a56f83c5019d85e7100cf8ce1d94e 05-Aug-2016 Chong Zhang <chz@google.com> Fix WM missing stack/task when activity is force stopped and restarted
am: d9d35bdfcf

Change-Id: I7f1c5c33cc90c06b0870241e09b96e47e2b58c28
82c5197d860aaf7f47c6664cd2fa5f346e88a6f6 05-Aug-2016 Chong Zhang <chz@google.com> Merge "Fix WM missing stack/task when activity is force stopped and restarted" into nyc-mr1-dev
92fc37294c474fd47b4439736c6cf700c4e46a27 05-Aug-2016 Wale Ogunwale <ogunwale@google.com> Replaced use of AppWindowToken.allAppWindows with WindowToken.windows

After ag/1290328 the 2 list now contain the same entries. The only
different is allAppWindows is not sorted and windows is. Removing
allAppWindows and only having one windows list for a token object
reduces confusion in the codebase and also removes a major source
of bugs.

Bug: 30060889
Change-Id: I6e9a3a4b52cfd686788fe18f4fd6c9b0731f10bd
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a6cc361e34337c7fe293a56713910faf0f2f302c 04-Aug-2016 Wale Ogunwale <ogunwale@google.com> Add child windows to their parent WindowToken

Previously child windows were contained in their own WindowToken
and also added to the parent window AppWindowToken.allAppsWindow.
This complicated the token organization within WM as it was sometimes
confusing which list to use WindowTokens.windows or appAppsWindow which
led to many bugs fixed and still existing. I can't think of a good
reason why the child windows just can't be tracked with the parent token
so we will do that and fix whatever bug may come.
This paves the way to consolidate WT.windows and AWT.appAppsWindow list
since they will contain the same entries now and also fits in with the
hierarchy model we will be using with WindowContainers.

Also
- Removed WindowState.mRootToken since a window and its children will now
be in the same WindowToken.
- Fixed NPE in WindowState.getTopParentWindow()
- Temp. workaround to not re-add child windows in WT.reAddAppWindows since
WindowState.reAddWindowLocked() will re-add any children of the parent
window we are adding. Workaround can be removed when the class is switched
to use WindowContainer.

Bug: 30060889
Change-Id: I604ba4cce9ff8df4e81353cb648d6f54aa27084f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
20ea6a378b96de7c1b3b39fd0db93b1b3f6a9635 05-Aug-2016 Wale Ogunwale <ogunwale@google.com> Merge changes I732ec7da,I7e56bc51,Ib21472a7

* changes:
Removed unneeded search for root token in WindowState ctor.
Add new WindowToken to WMS.mTokenMap when constructed
Replaced use of WT.appWindowToken with WT.asAppWindowToken
d9d35bdfcf0e18ae16c0f59290b860700fb6e62f 05-Aug-2016 Chong Zhang <chz@google.com> Fix WM missing stack/task when activity is force stopped and restarted

When activity process is force-stopped (like in the case we need to stop
it to allow debugger), activity record is removed and a new instance is
added. Depending on timing, adding of new record could happen before
or after old record is removed. If it added after old record is removed,
then the removal could cause AM to also remove the task AND the stack
(if the activity is the last one).

On WM side however, the task/stack removal could be delayed due to
animation. So when AM attaches a new stack, we end up with two stacks
with the same stack id in the DisplayContent. Also, AM reuses the last
used taskId after it's deleted. So WM is confused and didn't add a new
task record. Then when the delayed stack removal fires everything is gone.

We need to use a different task id when creating a new task record, even
if the last created task is already deleted. Also when attaching a new
stack to WM, first check if we already have such a stack in DisplayContent,
if so, reattach it and don't create a duplicate.

bug: 30465601
Change-Id: Ic399a32c54f6acdcbb9a0c6155599331d55df232
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
67ef02fd9f594e76bde044c731b78d4f92ca1c92 05-Aug-2016 Robert Carr <racarr@google.com> WindowManager: Restore update behavior of mLastFrame. am: dbf61b64b1 am: 47b2f590e4
am: b763f03bbc

Change-Id: I9652dc6f700e703636997a9f6b29c6a662cacd1a
47b2f590e4c26219309f0bafb570a8146d3c2fee 05-Aug-2016 Robert Carr <racarr@google.com> WindowManager: Restore update behavior of mLastFrame.
am: dbf61b64b1

Change-Id: Ic9ff28e601a72140104936a9a0a0d1571beba523
d51f38ae38088c351e5a1ea45f6c6818aaaead7c 05-Aug-2016 Rob Carr <racarr@google.com> Merge "WindowManager: Restore update behavior of mLastFrame." into nyc-mr1-dev
0659029fd2ee5b4185f34e98ebd2b5d97c85ed16 05-Aug-2016 Jorim Jaggi <jjaggi@google.com> Fix flickering issues with FLAG_SHOW_WHEN_LOCKED and fingerprint wake am: e93e6f9deb am: f6929c4750
am: 864de6a179

Change-Id: Ide3b6febc8a2daf751a94a9ae8ae0d2bcfddf51f
9f25beee3a8cd6f452534006ea9068178cbb4ce1 02-Aug-2016 Wale Ogunwale <ogunwale@google.com> Made AppWindowToken.allAppWindows private

Pre-clean-up before switching class to using WindowContainer.

Bug: 30060889
Change-Id: Ic3d47d47b922668eeb70988ce883267b46ca9d72
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
0b5adb38a7d5983ef129b017b9cc18ea52b8c070 04-Aug-2016 Wale Ogunwale <ogunwale@google.com> Add new WindowToken to WMS.mTokenMap when constructed

Adding it to the map in the ctor makes it easier to follow what is
going on and reduces the chance of errors in the future.

Bug: 30060889
Change-Id: I7e56bc51be1067c6f4ad47188679d2fbabb04921
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2049dbf0e9f658c1f5234fb0a1f0af6942b7eb58 03-Aug-2016 Wale Ogunwale <ogunwale@google.com> Replaced use of WT.appWindowToken with WT.asAppWindowToken

Not a perfect implementation, but slightly less confusing as
the child class is no longer a member variable of the parent
class.

Also renamed WindowToken.service to WindowToken.mService to be
consistent with how we name in other places.

Bug: 30060889
Change-Id: Ib21472a784a4f24e7789d443876cf0912d9e89de
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
dbf61b64b15e2533cadf7d721731c4be2db4e426 04-Aug-2016 Robert Carr <racarr@google.com> WindowManager: Restore update behavior of mLastFrame.

We need to always update mLastFrame like we used to. Moving
the update inside the conditional caused it to not update on position
changes.

Bug: 30665565
Bug: 30641229
Change-Id: Ic71e8a8f91765870ebe2c0559f61aa83540c3a0d
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e93e6f9deb8d3c044d673ffb771b73b2346486a3 04-Aug-2016 Jorim Jaggi <jjaggi@google.com> Fix flickering issues with FLAG_SHOW_WHEN_LOCKED and fingerprint wake

The whole sequence is different as Keyguard is occluded. Thus, we are not
doing the normal keyguard exit sequence, but jump directly to dismissing
the Keyguard.

Normally the sequence is:
- keyguardDone
- notifyScreenTurningOn
- startKeyguardExitAnim

In the occluded case, it is:
- keyguardDone
- startKeyguardExitAnim
- notifyScreenTurningOn

Now, the following issues cause the flickering in the occluded case, which
are normally not causing any breakage:
- There was an issued with the draw callback not being reset and reused
at the wrong time.
- mWakeAndUnlocking was not cleared soon enough. This caused a timeout if
notifyScreenTurningOn happens after starKeyguardExitAnim
- We always need to wait for the Keyguard host window, as isForceHiding
isn't set in this case

Change-Id: Id8d0f9fec79ec63b36659513f97c724147c7521f
Fixes: 30483392
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e4da0c145e89274f98c683d4e045644400ea1a18 29-Jul-2016 Wale Ogunwale <ogunwale@google.com> Made WindowToken.windows protected.

Pre-clean-up before switching class to using WindowContainer.

Bug: 30060889
Change-Id: I2a0c09e99b742fa32e9cbe96e3bf97e5415da2c3
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a2f247e6a63eefc70866202abbec0e3af3768695 02-Aug-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Revert "Prevent apps to overlay other apps via toast windows"" into nyc-mr1-dev
2fc661a453c8dd0f62c4e567641ab282f2f2c5fe 02-Aug-2016 Svetoslav Ganov <svetoslavganov@google.com> Revert "Prevent apps to overlay other apps via toast windows"

bug:30150688

This reverts commit dc24f937b031f5f4e153dbfeaa51e96415a09b71.

Change-Id: Id7e8ddbf82ab426f55a5296791f1e8ebb61514bc
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
455fac5e807119b5e7e4289a8fef022790485271 21-Jul-2016 Wale Ogunwale <ogunwale@google.com> Removed use of WindowState.mTargetAppToken

Instead of keeping track of the ime target app token in each ime window state
for the purpose of adjusting the animation layer, we now just check if it is
a ime window and there is an ime target when we want to adjust the animation
layer.

Also correct some use of WindowTokens.windows to AppWidowToken.allAppWindows
in AppWindowToken since that contains all the windows associated with the app
token.

Bug: 30060889
Change-Id: Iba1a6076d0ed09413a0802d02c92b9b32ad50891
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
fea7cfce8b6afe9a90c6b8353ae6bf10696c49d4 01-Aug-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Prevent apps to overlay other apps via toast windows" into nyc-mr1-dev
dc24f937b031f5f4e153dbfeaa51e96415a09b71 26-Jul-2016 Svet Ganov <svetoslavganov@google.com> Prevent apps to overlay other apps via toast windows

It was possible for apps to put toast type windows
that overlay other apps which toast winodws aren't
removed after a timeout.

Now for apps targeting SDK greater than N MR1 to add a
toast window one needs to have a special token. The token
is added by the notificatoion manager service only for
the lifetime of the shown toast and is then removed
including all windows associated with this token. This
prevents apps to add arbitrary toast windows.

Since legacy apps may rely on the ability to directly
add toasts we mitigate by allowing these apps to still
add such windows for unlimited duration if this app is
the currently focused one, i.e. the user interacts with
it then it can overlay itself, otherwise we make sure
these toast windows are removed after a timeout like
a toast would be.

We don't allow more that one toast window per UID being
added at a time which prevents 1) legacy apps to put the
same toast after a timeout to go around our new policy
of hiding toasts after a while; 2) modern apps to reuse
the passed token to add more than one window; Note that
the notification manager shows toasts one at a time.

bug:30150688

Change-Id: Icc8f8dbd060762ae1a7b1720e96c5afdb8aff3fd
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
621366655718cb3c1152566a334af99599fec6ba 29-Jul-2016 Robert Carr <racarr@google.com> Only restore saved surfaces in the last visible rotation. am: 237028ae3b am: 5db2a3bb4c
am: 7784ce236f

Change-Id: I1d0a70bc143448bac4be26a7cf640c0c1a515da4
dd1e66f737271dedded652cfae69a0cd7d46a86c 16-Jun-2016 Jiaquan He <hejq@google.com> Add more onTopLauncher support.

- Add onTopLauncher checking for TaskRecord.
- Add onTopLauncher to the window manager.

Bug: 28425537
Change-Id: Ic9e53db891dc42463a1a77b106ba93438a052181
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
237028ae3be891dd1dbc392a51fd768474de5df7 26-Jul-2016 Robert Carr <racarr@google.com> Only restore saved surfaces in the last visible rotation.

Sometimes we see a sequence like this when transitioning
between apps causes rotation changes.

1. New app becomes visible, causing the orientation to change
2. Old app gets marked as invisible, at this point its window
are still visible from client, so surface is marked as eligible
to be saved.
3. Old app calls relayout to invisible, we save surface.

Now if we restore the Surface it will be in the wrong orientation. It
never had a visible layout in the new one, it was just covered up
by the screenshot. To address this we track the rotation a window was
last visibily laid out in. If it doesn't match our current
rotation we can't use the saved surface.

Bug: 30171992
Change-Id: If814131810b6d01c5112afd145072a13a30b0401
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b2f464103973057bc2dc070eba6fd807b745db24 22-Jul-2016 Chong Zhang <chz@google.com> Clean up surfaces when app is resumed without being stopped. am: 45e6d2dc8b
am: b76adc5117

Change-Id: I35c39c4fc49a953262b5b6ab4cbc2dca2ddf0b8f
b76adc511701d5069c191570066e68538bd946c3 22-Jul-2016 Chong Zhang <chz@google.com> Clean up surfaces when app is resumed without being stopped.
am: 45e6d2dc8b

Change-Id: I9ae5c2a9c6a93246338221252cf943db6763e1c4
e86da3bc62e2ec650d69477ab7655aa7255be473 22-Jul-2016 Chong Zhang <chz@google.com> Merge "Clean up surfaces when app is resumed without being stopped." into nyc-mr1-dev
39d3c994fa59bb077eb5ec1d7c2d4cf61b159b54 22-Jul-2016 Robert Carr <racarr@google.com> Also report resize when frame changes without inset change. am: 31aa98bea8
am: e0b66c2964

Change-Id: Ib5b72acf703743db393174e6a58c6fa2d96c851a
ddde4706529d1246db711baef6d9cfa61c15b3ca 22-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix undefined fontScale issue in Configuration"
45e6d2dc8b8b7bd4e588368179d8d4b05fc6810c 21-Jul-2016 Chong Zhang <chz@google.com> Clean up surfaces when app is resumed without being stopped.

When quickly toggling between two apps, app could be resumed while
it's stopping but not yet stopped. Upon resuming, it could have
surfaces that's marked mDestroying and waiting for the stopped
to be destroyed.

We need to dispose these surfaces properly. If the window is already
removed, we destroy them. Otherwise, clear mDestroying flag so that
the window is ready to be used again. Leaving mDestroying=true makes
the window ineligible for certain things such as receiving wallpaper.

bug: 30255354
Change-Id: Id881653550595ab8e702d6950949bf202ac5a0d9
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
31aa98bea8b41e4e0e1f0c78be18dce8ef597f79 21-Jul-2016 Robert Carr <racarr@google.com> Also report resize when frame changes without inset change.

Currently we report resize via two main code paths:
1. Insets change.
2. Drag resizing/resized while not drag resizing.
Unfortunately the case of IME dismissal with SOFT_INPUT_ADJUST_RESIZE
will not trigger either. For #1, both the content and the parent frames
are adjusted together (similar to a docked resize), and so we won't
produce any insets beyond the system ones. For #2, we would only hit this
path if we went through the Task, but this all happens in PhoneWindowManager
layout. Prior to 3ccc5273 ("only resize during relayout"), the lack of
resize reporting wasn't a significant issue, as we would go ahead
and resize the dialog anyway. Assuming it wasn't in the middle of a
frame it would eventually catch up and render things correctly. Following
this change though we need to ensure we trigger the client calling relayout.
We accomplish this simply by also reporting frame changes.

Bug: 30191926
Change-Id: I95c7553e5e219e4a50c92f4d47621a32567a626f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
c46befc7cb8260e6bdcaedaf0e8c63418d74f13b 20-Jul-2016 Wale Ogunwale <ogunwale@google.com> Merge changes Ia451b623,I1dd2c460

* changes:
Switched WindowState to use WindowContainer for managing children
Added WindowContainer and WindowContainerTest classes.
c4e7f7abb4b75aaab8d33aae92ffa5ca1f53aba4 20-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Made WindowState.mParentWindow private scoped."
bad43fcae487a19865c174483c11829379817c8a 19-Jul-2016 Adam Lesinski <adamlesinski@google.com> Fix undefined fontScale issue in Configuration

When using a Configuration object as a delta for use
as an update to an existing Configuration object,
the fontScale property is always defaulted to 1.0, which
is not considered "undefined". That means that fontScale will
always get overridden to 1.0.

This changes the undefined value of fontScale to 0.0, which is
set when the Configuration object is constructed. Thankfully,
the documentation for Configuration states that until
Configuration#setToDefaults() is called, the Configuration is in
an invalid state. That means that apps can not rely on fontScale == 1.0
without calling setToDefaults().

Bug:29924927
Change-Id: I19342c55f7057423f1ca8c5d8dce1dff07617d90
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e4343ef468d4425d96b45e98a8556c2a76f9e030 19-Jul-2016 Wale Ogunwale <ogunwale@google.com> Switched WindowState to use WindowContainer for managing children

Bug: 30060889
Change-Id: Ia451b623123210514e79f830f92f6459169911b6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
caa53afa0cae85a69da1b5bfb9b8368b152c917b 17-Jul-2016 Wale Ogunwale <ogunwale@google.com> Made WindowState.mParentWindow private scoped.

Bug: 30060889
Change-Id: Ic1d702cb6329fb2f03d006939f5610681d1d07bd
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d5fde61c755d1521898dec2972849e672b37180b 20-Jul-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge \\"Revert \\"Prevent apps to overlay other apps via toast windows\\"\\" into nyc-mr1-dev am: 78fa7a1b3f
am: d6c4cf03e3

Change-Id: Iebc613fbecb372dbb39a9110c1b3123150b6ce5d
78fa7a1b3f8a5a227807f426a5d4fdc2a26e7998 20-Jul-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Revert "Prevent apps to overlay other apps via toast windows"" into nyc-mr1-dev
f1395d730a499b6420ee7593f3a5236eca637bfb 20-Jul-2016 Svetoslav Ganov <svetoslavganov@google.com> Revert "Prevent apps to overlay other apps via toast windows"

This reverts commit b3b22cba86dd6e010c5fac3d044990f155a33381.

Change-Id: I905e7435893fab49f03fdb708f4ab5a9d2c9cbae
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
adde52ee32b656bb436f7e92f39f7d0d97cc9306 16-Jul-2016 Wale Ogunwale <ogunwale@google.com> Made WindowState.mChildWindow private scoped

This involved:
- Moving method that operated on mChildWindows and mostly touched
WindowState fields into WindowState class.
- Creating new methods for getting information about child windows
outside WindowState class instead of accessing the child list directly.
- And, tests ;)

Bug: 30060889
Change-Id: I339cecb926b44b5db7ead1970e356304d5429c8f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9d14790d299d1e2b96db287601c86f82850019c9 16-Jul-2016 Wale Ogunwale <ogunwale@google.com> Track hidden state of window in itself vs. all child windows.

It makes the code easier to follow if the hidden state of a window
is tracked in itself vs. all chils windows. Child windows can call
WS.isParentWindowHidden to get the hidden state of their parent window.

Also, moved the performShowLocked method from WindowStateAnimator to
WindowState since most of the fields modified in the method belong to
WindowState.

And, don't forget the test for the change ;)

Bug: 30060889
Change-Id: I5be13b936a2284fd8fe10218b80fe41cc197d1a7
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4ce896ca7afb2d32e58f340856d077491be23016 19-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Added foundation for supporting unit tests in WindowManager"
b699ce0d06eb6be91c0be0a791d8d8d7c68b4f41 18-Jul-2016 Wale Ogunwale <ogunwale@google.com> Added foundation for supporting unit tests in WindowManager

- Check for null where appropriate when using WM from a test
- Inject WindowManagerPolicy for test can have its own policy
- Added skeleton for WindowStateTests that will contain tests
for WindowState class.

Bug: 30060889
Change-Id: I0cd7d50c98de16c7412759401075c4bb48d13dfe
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f6d56f92fffa94c058951744f12a9194dc0f10f1 18-Jul-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Update windows before sending a window state change event"
3f94a2e35cfc5d274d7b457f00cdfc0e491556cc 18-Jul-2016 Chong Zhang <chz@google.com> Merge "Remove two-finger scroll specific code"
2e2c81a8d67f6ceccf178c5c7264d27e8c72e9ff 15-Jul-2016 Chong Zhang <chz@google.com> Remove two-finger scroll specific code

Revert changes in ag/845161, ag/843943 and ag/817515 that's added
specifically for two-finger scroll mode.

Change-Id: I8679a3bd5b3907180d33d99e3a071e7edfb2ed96
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
951f0e1d4d925c84759508fed40da2c9a9450619 16-Jul-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge \\"Prevent apps to overlay other apps via toast windows\\" into nyc-mr1-dev am: e2d148b008
am: cd263d56d2

Change-Id: I4971baf5ef2a522f8acea091023936e033f23cea
b082d7d63fea23a94f74af2f3080bae6ad3af391 15-Jul-2016 Chong Zhang <chz@google.com> Merge \\"Don\\'t release surface if relayout is visible\\" into nyc-mr1-dev am: 465376c5ae
am: 8e8c07cd2e

Change-Id: Icbd15f921c450c4951f6cfaa345c1746e560600c
e2d148b008d18a8e8cd042fba5c394bdd1d5527f 15-Jul-2016 Svetoslav Ganov <svetoslavganov@google.com> Merge "Prevent apps to overlay other apps via toast windows" into nyc-mr1-dev
b3b22cba86dd6e010c5fac3d044990f155a33381 15-Jul-2016 Svet Ganov <svetoslavganov@google.com> Prevent apps to overlay other apps via toast windows

It was possible for apps to put toast type windows
that overlay other apps which toast winodws aren't
removed after a timeout like toasts are.

Now to add a toast window one needs to have a special
token. The token is added by the notificatoion manager
service only for the lifetime of the shown toast and
is then removed including all windows associated with
this token.

This prevents apps to add arbitrary toast windows. The
token is passed in the app domain in the request to
construt and add the toast window which allows a bad
app to add arbitrary toast windows. However, this is
fine since the token will be invalided and all of its
windows removed after the toast for which it was
create times out.

We do not care of braking apps that add toast windows
directly due to the security and privacy implications
of arbitrary UI redressing. Also we have dedicated
Toast APIs which are the way to add this time of UI.

bug:30150688

Change-Id: I65372c81a791489de89fb2886cc96392c28680bb
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
546fd255d4ef5481088243b94a7c6929cd9e2779 15-Jul-2016 Chong Zhang <chz@google.com> Don't release surface if relayout is visible

There is a delay from the point we notify the client to go invisible,
to the point that request is handled. If a relayout VISIBLE happens
during this period, we need to give the client a surface so that any
pending draws will go through.

bug: 30066966

Change-Id: I0cd4e4be49f3d2d8f726963ed9e23bf0327e1d0f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
fd138896d5fc0c4ec3e46ad923fa4935ceaabdeb 14-Jul-2016 Svetoslav Ganov <svetoslavganov@google.com> Update windows before sending a window state change event

Change-Id: Ie25b75ccc739dcacbbffd2b3a32fe65086882c64
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
7ed4d37b74850e2ed5dfd50109dc6fa919904c7c 10-Jul-2016 Wale Ogunwale <ogunwale@google.com> Rename WindowState.mAttachedWindow to WindowState.mParentWindow

Helps with code clarity and reduces confusion for upcoming WM
object modeling changes.
Also, along the same lines changes locations that check to see if
WS.mAttachedWindow wasn't null to determine if the window is a child
window to use WS.isChildWindow method instead.

Bug: 30060889
Change-Id: I9b975ab9ff9bf09cdd3c0dcaddd3bf9232e88be8
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9dc28243c03c38bf9c7735451efe56c83681261b 13-Jul-2016 Zak Cohen <zakcohen@google.com> Merge \\"Adds a screenshot wallpaper method to WallpaperManagerService.\\" into nyc-mr1-dev am: b4d4ce31ab
am: ee2f46485e

Change-Id: Ia7b738db6f73c89e97537f9b1c0d5cb7fd161616
b4d4ce31ab92ddaf1e8ef337b5ba73ea852a2ac9 13-Jul-2016 Zak Cohen <zakcohen@google.com> Merge "Adds a screenshot wallpaper method to WallpaperManagerService." into nyc-mr1-dev
7c43bcb6a3a38bc64b170e4f8623f0bdd8aee6ca 13-Jul-2016 Rob Carr <racarr@google.com> Merge \\"When display is frozen prefer preserving orientation.\\" into nyc-mr1-dev am: b6a77f4786
am: 11cfba59eb

Change-Id: I18be206e0baf4530a7289c4c0522dabf2883f29b
92ca6d067ba7f1c363cdcc67b57046c7c5b94a3d 12-Jul-2016 Robert Carr <racarr@google.com> When display is frozen prefer preserving orientation.

While the display is frozen, we just want to preserve the orientation
from changing. Otherwise we will have strange loops as
SHOW_WHEN_LOCKED windows appear/dissapear over relaunch.

Bug: 29994732
Bug: 29542506
Bug: 29942346
Change-Id: Iec5f79db0cf5001c3c8e5d6a7a0136b758e0a934
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3683fb1e1d9a4f4f672e9083ae3d5e31c7034c8f 11-Jul-2016 Zak Cohen <zakcohen@google.com> Adds a screenshot wallpaper method to WallpaperManagerService.

Bug: 29963541

Change-Id: If0a574004f8bddf1ba170587a8187253fe045ef4
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8942204d935c5417154a8dd3cb90db3f47193d63 01-Jul-2016 Robert Carr <racarr@google.com> Merge changes I38cff63b,Id3739bbc,If052cd8c into nyc-mr1-dev am: 30efa24b11
am: 0dbe6db014

Change-Id: I3f0fd113bf9dc063f3bc60301f9a7ddf7d16581d
30efa24b11ee7ca751d3390986a1ee682551ce0e 01-Jul-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes I38cff63b,Id3739bbc,If052cd8c into nyc-mr1-dev

* changes:
Fix synchronization error for Seamless rotation.
Disable seamless rotation while animating.
Force CROSSFADE rotation when launching from double tap gesture.
0baa1bc6655c28865190e53252fdbe1f1ae2b8ed 01-Jul-2016 Robert Carr <racarr@google.com> Fix synchronization error for Seamless rotation.

Missing synchronized block in timeout codepath.

Bug: 28823590
Change-Id: I38cff63b559b5f8cd65698af27a1100208ff2600
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
fd10cd1989966d01011a0cf75f3282f3e12ca5a6 30-Jun-2016 Robert Carr <racarr@google.com> Force CROSSFADE rotation when launching from double tap gesture.

When activity transition triggers a rotation change, the starting
window will normally be the top window at the time we try
to select the window animation. However, these layout params won't
have the apps rotation animation set (as the client code will set that
on the real window, not the starting window). Eventually we would
like to add API to specify rotation animation via manifest to solve
this problem cleanly. In the mean time, we can force a specific rotation
animation from the double tap gesture, and clean up some camera
ugliness. We accomplish this by attaching an animation hint to
ActivityOptions.

Bug: 28838855
Change-Id: If052cd8cbae76651da43f3b4c590cd9dcc1afc0f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4c62cbda12ec606f19fbdfddebae0d72fcaa4f55 30-Jun-2016 Chong Zhang <chz@google.com> Merge \\"Apply animation in relayout invisible the old way\\" into nyc-mr1-dev am: 8f54d32b99
am: 8ca3333d90

Change-Id: Iaa6f622142eab1454d5bd769a532f010d4509078
39b80e5c417ff915ca9097683e848597ccee7849 30-Jun-2016 Chong Zhang <chz@google.com> Apply animation in relayout invisible the old way

We skipped the applyAnimationLocked to work around a problem with
cached animation loading, however app could be animating without
window animator (only app animator) in which case we shouldn't do
the relayout for potential focus change.

Revert to the old behavior and let applyAnimationLocked decide if
we want to relayout for focus change.

bug: 29874980
Change-Id: I6fdfbe41cbafd7017477c0eda9b4fd26e66c517f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
0eabb4e28686af09c3362a12a4b8b3fc174e2590 29-Jun-2016 Chong Zhang <chz@google.com> Merge \\"Add a few trace points for animation loading.\\" into nyc-mr1-dev am: 8e3b57aad5
am: e9fdaf5561

Change-Id: I185770c171f6b1c297915b3e97acac332291bc77
8784be6fe485939c3ae758edbcbbcb85d2b123ae 29-Jun-2016 Chong Zhang <chz@google.com> Add a few trace points for animation loading.

Also make sure focusMayChange is set as before commit 8c5d42.
We only want to skip the applyAnimationLocked if animation is
already set, make sure the rest are equivalent.

bug: 29405575

Change-Id: I8342b82d9e6e02fab002e16ffcde4a7479bf6867
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
6e6c0c465ff35006a4603d51ec0cc08f6e4d0dbb 27-Jun-2016 Wale Ogunwale <ogunwale@google.com> Merge \\"Fixed bug with continuously changing orientation while dreaming\\" into nyc-mr1-dev am: 8a009f43bf
am: 87ac10dbca

Change-Id: I8a96d50971eddaa3214a3278f90d6eb3d4f2e7cc
8a009f43bfcec0f3488e412669f6fb0a55caf36e 27-Jun-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fixed bug with continuously changing orientation while dreaming" into nyc-mr1-dev
64969a35cea21e35371973b30d6fd04499403036 27-Jun-2016 Wale Ogunwale <ogunwale@google.com> Merge \\"Reset relaunching count is app dies during re-launch\\" into nyc-mr1-dev am: 45f8aaca7c
am: b89cd36085

Change-Id: Ie22a2fafb6991761ac42cef1e513d7e8ff03a565
049b6d89277f67ae210fdc4428df80a306556cfb 27-Jun-2016 Wale Ogunwale <ogunwale@google.com> Fixed bug with continuously changing orientation while dreaming

If the keyguard is locked while the device is dreaming in landscape
mode, the display will be frozen. When this happens we want to continue
to use the orientation the keyguard forced since that will be the
orientation used once the display is no longer frozen vs. switching to
the orientation of the top activity.

Bug: 29542506
Change-Id: I30a8370357735dcdff336a562ca248aa9206ae29
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8fd75428b409ad926e54178ec0dcd47012255d2c 24-Jun-2016 Wale Ogunwale <ogunwale@google.com> Reset relaunching count is app dies during re-launch

WindowManager keeps a count of how many relaunches an app is told
to do so that it can defer app transtions until the relaunches are
done. If the app porcess is killed during one of the relaunches
the app will never report back that it is done relaunching, so
app transtions into the app will not happen until will timeout
from waiting for the app.
We now notify WM of this situation so it can clear the relaunching
count for the app.

Bug: 29551109
Change-Id: Ibadba9f73e6e1bde141385aa8a0e066fbc0c5764
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
564e703b7836d3657a8f78b233cdbd3977ffd128 24-Jun-2016 Chong Zhang <chz@google.com> Merge \\"Do not load exit animation again if window is already animating\\" into nyc-mr1-dev am: 1156c52b03
am: 53539ae535

Change-Id: I0865f3fedf3e5971ae8fb6716907fd8e81c8e6ec
8c5d422e0265887d182434d3ac467231fee4588c 24-Jun-2016 Chong Zhang <chz@google.com> Do not load exit animation again if window is already animating

Transition can be started as soon as the entering app is drawn.
If the exiting app relayouts to invisible after transition started,
don't load the exit animation again.

bug: 29405575
Change-Id: I05ba4f733afb9426626db113be721a6bf888f093
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
0db4052d51fb48b6a19a72f75b49103054ff4219 22-Jun-2016 Robert Carr <racarr@google.com> resolve merge conflicts of 79116da to master

Change-Id: Ia6e42d99097da86e23b9d33659259d264a365c45
6da3cc0237d2483ead16a7013d1326bccc5112af 17-Jun-2016 Robert Carr <racarr@google.com> Implement seamless rotation mode.

Add a rotation mode which does not require freezing
the screen. For situations like Camera where only small
elements move on screen, this allows for seamless changes
of display orientation. This is achieved by transforming the
windows with their current buffer in the same transaction that
we rotate the display. We set things up so the windows are
frozen this way until they submit buffers in the new orientation.
There is a special case in the Camera window itself, and it's use
of NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY. In this case the buffer
contents are rotated by SurfaceFlinger and will never resize, for these
windows we just need to update the scaling matrix.

Bug: 28823590
Change-Id: I52dc6a86fcb3c08f736f0977ba3975a24fb8136c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
0933cf3f1541fbc7cbaa5405d8b7a403c51276cd 17-Jun-2016 Yorke Lee <yorkelee@google.com> Merge \\\"Limit global drags to apps targeting SDK 24 and above\\\" into nyc-dev am: f33af2285b am: 3d80871032
am: 11e3bf5d30

Change-Id: I6a99d04fd3f9fb229f532838350313169cec502a
0e8524719559f0be9c8145dbf9f52100e1fb60c3 15-Jun-2016 Yorke Lee <yorkelee@google.com> Limit global drags to apps targeting SDK 24 and above

Bug: 29127791

Change-Id: Ib5f85a207bdb79eeac0418fda78e452d225761bc
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
cb274ba3f7ce817700f9d562d821f98b97daf8fd 15-Jun-2016 Robert Carr <racarr@google.com> Merge \\\"Unbreak Javadoc on getAttestationChallenge()\\\" into nyc-dev am: 2c2f8acdab am: 31eece5af9
am: 3cff553f3a

Change-Id: Ifb518a33e93dfdeb86233c0a063fa32703d3e448
3e5df9fb50f98ae3738bef5c8dbddcbbb4a4b95d 15-Jun-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Toast timeout: Just strip FLAG_KEEP_SCREEN_ON" into nyc-dev
1ba1d6f3f351b6072cbee6f40876edd2a249535b 15-Jun-2016 Wale Ogunwale <ogunwale@google.com> Merge \\\"Make sure task exists in WM before trying to set the resizing state\\\" into nyc-dev am: 39647560d1 am: d0e51b0e89
am: 82d0424841

Change-Id: I2ca6829b9a65597ffee0e33a27056c0a5f99e898
291aea2202495ca090b053695cbbe2e20a06d40b 11-Jun-2016 Robert Carr <racarr@google.com> Toast timeout: Just strip FLAG_KEEP_SCREEN_ON

We added the toast timeout to fix b/21693547. Where the client
leaks non visible toasts which end up keeping the screen on.
Simply removing the toast windows as we were doing previously,
isn't very good though. If the timeout fires when an app could
still use the toast (e.g. due to long pause under debugger),
the app could crash. It's not obvious how (if even possible
without API semantic/guarantee change) to prevent this issue
from the client side. Furthermore, #33 at b/21693457 implies that
we need to respect FLAG_KEEP_SCREEN_ON even for windows that
never submitted a buffer. With time constraints as they are,
the only solution I can think of that solves both without
chance of regression is just stripping FLAG_KEEP_SCREEN_ON when the
timeout fires.

Bug: 29105388
Change-Id: Ic2df897f86acf814ea3d4f911a0532d65af0c19f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d6aee18cabe75cbd4e98bfa380dffb89d89e0efc 14-Jun-2016 Wale Ogunwale <ogunwale@google.com> Make sure task exists in WM before trying to set the resizing state

It is possible for a task to be removed from the WM and stack in AM
while resizing (e.g. app crashes). In this case we want to make sure
the task exist in WM before we try to set the dock resizing state vs.
depending on the fact that the task is in recent list in AM.

Bug: 29325623
Change-Id: Ib89a7bfe12fe1f2c4c6c56ac9e13b0052ea2b4ec
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2e2d9956861f121291df9af0b49c6013420e43f4 09-Jun-2016 Jim Miller <jaggies@google.com> Merge \\\"Always re-enable keyguard state when the user switches.\\\" into nyc-dev am: 9e94c455f8 am: 6e5ff1cb99
am: f716a049d4

Change-Id: I0fe6a3fe2e2002c9c89593390aa68348362eb62e
e051f6f1fdb5e21cbed394d29dfcab5c642e4129 13-May-2016 Michael Wright <michaelwr@google.com> Rename PointerIcon and Pointer Capture APIs

This is a response to API council feedback.

Bug: 26830970
Change-Id: I1be541a53e3943d06640169671824f7daea15462
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3e6ac81d7d618bd4f9b51c03c9226c8801e0d450 04-Jun-2016 Jim Miller <jaggies@google.com> Always re-enable keyguard state when the user switches.

This fixes a bug where an app running as a secondary unlocked
user could overwrite the current keyguard disabled state.

Fixes bug 28817843

Change-Id: I2cd88c41906a082c3a58ed06d74f901e304af500
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
373cc89727ef2d480e1a0ad05adbcf9415e890b8 28-May-2016 Jorim Jaggi <jjaggi@google.com> Fix weirdness when home task forces rotation am: a6c05d5151 am: ca0e846528
am: 9e5ec8eefe

* commit '9e5ec8eefed5e1e7eb842a158564fad6cedd5d3f':
Fix weirdness when home task forces rotation

Change-Id: Ie254c705ef82defa8b566234675d83bb4ee9ac63
62538ce113a4f3bbd89e13326e512f921d8af0c3 28-May-2016 Jorim Jaggi <jjaggi@google.com> Merge "Close IME when attaching dock stack" into nyc-dev am: c5fc6c602c am: 819cbb3dd3
am: bdcfbf442b

* commit 'bdcfbf442b8a8f46ece20cd9048430532cadcca4':
Close IME when attaching dock stack

Change-Id: Id8ad2640a632f7d53f9f5ec175542fff4d3d7127
46bbf358c1e9ae25884dcee6d5fcf7d153222c5a 28-May-2016 Rob Carr <racarr@google.com> Merge "Merge "Ensure surfaces only resize during relayout." into nyc-dev am: 58f1167ecf am: c67c7c0799" into nyc-mr1-dev-plus-aosp
am: 61903f9151

* commit '61903f9151fd9dfad544bafed96a34b6825a6e41':
Ensure surfaces only resize during relayout.

Change-Id: Ic42c07fa74583d9052a824a4b707dc35b200507c
a6c05d5151027f902c5c56bded008cbe15bd6301 27-May-2016 Jorim Jaggi <jjaggi@google.com> Fix weirdness when home task forces rotation

- Make sure to retain the state when divider goes through a configuration
change in order to avoid that nothing happens when entering multi-window.
Save the state in DividerState and use a handler that's independant of the
attached state.
- Don't allow home task to dictate orientation unless the docked stack is
minimized. This caused a lot of weird bugs because when docking a task,
home stack gets moved to front, and if home task is front of stack, it
temporarily might dictate the rotation but later not anymore so this
causes two rapid configuration changes which may cause a lot of weirdness.

Change-Id: I6a2308af893cd8413ee8801e5b964f6ddc0abd51
Fixes: 28943853
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3c5d0f104109048ba55308f81ca0ce7fa1afb626 25-May-2016 Jorim Jaggi <jjaggi@google.com> Close IME when attaching dock stack

So we don't end up with animation weirdness.

Bug: 28905720
Change-Id: I04124995dd99fa26d2e9be467c5976d7b20810a7
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
58f1167ecf03c4cdce7e881ccf7c0e0506c14613 27-May-2016 Rob Carr <racarr@google.com> Merge "Ensure surfaces only resize during relayout." into nyc-dev
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/WindowManagerService.java
9fc0d01486afef820a0ec6456ed593a9c0d5ecf8 26-May-2016 Chong Zhang <chz@google.com> Merge "Update dock stack create mode after rotation if dock side changed" into nyc-dev am: e55e4b7f73 am: 5dfed87e37
am: 2c7e700aad

* commit '2c7e700aade0282dc3eeb333b195a4a48f7ef9dc':
Update dock stack create mode after rotation if dock side changed

Change-Id: I08ed26fdb872591270a024336e6fec841e9b576c
e55e4b7f73be3b3babd28581a839d0b9700d555d 26-May-2016 Chong Zhang <chz@google.com> Merge "Update dock stack create mode after rotation if dock side changed" into nyc-dev
73d4b44ce3198b0b4ac477a64d5f12a152dba549 25-May-2016 Chong Zhang <chz@google.com> Update dock stack create mode after rotation if dock side changed

On some devices (such as tablets) dock stack could be created on top,
but put to right after rotation. Dock create mode needs to be updated
in this case, otherwise when a new stack is attached to the display
(for example launch into now-cropped fullscreen stack),
attachDisplayContent() will use wrong dock mode to derive the bounds.

bug: 28942558
Change-Id: I83e66aeac94bd3f96c4b6a0a740acf76234bbe82
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
75a8a36c52f2149a5bc81177f5b312cf1ea18fb4 25-May-2016 Robert Carr <racarr@google.com> Merge "Force pending transactions to flush before screenshot." into nyc-dev am: 39e8022a75 am: 1d4f1cda2d
am: e19176832f

* commit 'e19176832f6685d0ec60321079860440dbb47d3f':
Force pending transactions to flush before screenshot.

Change-Id: I6df85677fad4666bcdb84cd4ae8d023f70f0a8e3
39e8022a75507be06179c3de7358cebb1bb22e06 25-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Force pending transactions to flush before screenshot." into nyc-dev
438266a4f7c0d3c817ef45908c2c99b9b4330081 25-May-2016 Chong Zhang <chz@google.com> Merge "Destroy saved surfaces if one of the last visible windows gets removed" into nyc-dev am: 15818e1156 am: 51cc0f48d7
am: 29f0dc25d2

* commit '29f0dc25d206e09e2a0a9ce48c086acd1c3bbbc1':
Destroy saved surfaces if one of the last visible windows gets removed

Change-Id: I2bceaa55d82c5dc829aa653077ab03171d5ea83a
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/WindowManagerService.java
e9953b1752a583058e639ef3de456988ab6ef7bf 24-May-2016 Robert Carr <racarr@google.com> Force pending transactions to flush before screenshot.

Following 14e54ba747 (ag/1043009) we need to push an empty
synchronous transaction if we want to ensure all previous
transactions have occured before taking a screenshot. In
light of Bug 7552304 it seems wise to do this before screenshoting
applications.

Bug: 27098060
Bug: 7552304
Change-Id: I6d7dfbe634a288c55449d2f1d6fbbfc13bab08ad
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
43d8369dfc2c6463e0af87f85bdd78b579b6648e 23-May-2016 Chong Zhang <chz@google.com> Merge "Don\'t throw RemoteException from new NLS APIs" into nyc-dev am: 28d9ef8112 am: 9ab291e20e
am: c7436a657d

* commit 'c7436a657d7f3879ac6ed78eb7f2353305b6c4ad':
Don't include removed window when counting interesting windows

Change-Id: I22176db892d527f7af75cf4a6691cdca142d1272
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/WindowManagerService.java
06a24fb5af63e9f8a2e65ed040f36d4e56cb645e 19-May-2016 Andrii Kulian <akulian@google.com> Merge "Clear mResizedWhileNotDragResizing flag after reporting" into nyc-dev am: 7fae7be595 am: 67cae3965b
am: 2d334f4d02

* commit '2d334f4d02b230a1dbb895d4a9688bbd12d7451d':
Clear mResizedWhileNotDragResizing flag after reporting

Change-Id: Ic9f69956f510db792b8159917fb06b6abb3ce84b
7fae7be59514ba6a7fdc10bdb47c9a9fe09d2cef 19-May-2016 Andrii Kulian <akulian@google.com> Merge "Clear mResizedWhileNotDragResizing flag after reporting" into nyc-dev
a1e0cebf3a18ac097d370e21d698e079f974bfff 19-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "DO NOT MERGE Rename PointerIcon and Pointer Capture APIs" into nyc-dev
6aa65afc2517a7341429d0cad07c71a87c84a582 18-May-2016 Chong Zhang <chz@google.com> Merge "Use focused app\'s stack for IME adjustment" into nyc-dev am: 65ee55457d am: e5bbbea494
am: afe4482b4a

* commit 'afe4482b4ab20acea3d7a3282578dca0fdf666bd':
Use focused app's stack for IME adjustment

Change-Id: Iee5d2fe0bc9d1ec002f7d7fd7a11caf0e24cf290
65ee55457dc39c3e30c677d9126565799b50a8dc 18-May-2016 Chong Zhang <chz@google.com> Merge "Use focused app's stack for IME adjustment" into nyc-dev
b8da4a7fa86155022f5a8d177c288d0817ce8c3e 18-May-2016 Chong Zhang <chz@google.com> Use focused app's stack for IME adjustment

Don't use mInputMethodTarget as it could be set to some system alert
window that has both FLAG_NOT_FOCUSABLE and FLAG_ALT_FOCUSABLE_IM,
and it's not actually taking inputs.

bug: 28328085
Change-Id: I38263f64fec13a5e10357499ebc97671389ba69a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f9d9ce7705475874c82af04eb9b208a7fb556792 13-May-2016 Michael Wright <michaelwr@google.com> DO NOT MERGE Rename PointerIcon and Pointer Capture APIs

This is a response to API council feedback.

Bug: 26830970
Change-Id: Ia2d284b5c1ab8365bedfdc37d129be4b8146036b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
fde6b69095aafe25189a35aebbd7236e805c4281 17-May-2016 Wale Ogunwale <ogunwale@google.com> Merge "Fixed bugs with starting windows when displayng forcedResized activity" into nyc-dev am: b406dd20ee am: 33cffe3717
am: f5a87d86bf

* commit 'f5a87d86bf08b564d2db00bf626092721e348e61':
Fixed bugs with starting windows when displayng forcedResized activity

Change-Id: Ie5cf7842a219fedd849bc161899df113f383c944
b406dd20eee28eedb8e9f330a0459d630c026515 17-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fixed bugs with starting windows when displayng forcedResized activity" into nyc-dev
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/WindowManagerService.java
3a14fb79163d0e1d8c9882d720a10c6a0ecd419e 17-May-2016 Jorim Jaggi <jjaggi@google.com> Handle multi-window for inset hint am: 23bf5462f0 am: b7bd18bdc6
am: bf9a7566df

* commit 'bf9a7566df02f7754ffeeba523cc904f73c0a45c':
Handle multi-window for inset hint

Change-Id: I033c6ad295bf235d181ad0fbfe5025cdcad5b4c2
3b23239d6ec9ded858d75f272ca1a677c5c431f9 14-May-2016 Wale Ogunwale <ogunwale@google.com> Fixed bugs with starting windows when displayng forcedResized activity

- Added ActivityOption to mark a starting activity as a taskOverlay
activity. That is the activity will always be the top activity of the
task and doesn't cause the task to be moved to the front when it is added.
- Only set the starting window state of the ActivityRecord to shown if
window manager actually showed the starting window for the activity.
Avoids incorrectly trying to remove starting window for an activity that
didn't show any.
- When starting additional activity in a task, transfer the starting
window from the top most activity with a starting window. It is possible
the top most window does have a starting window like in the case of the
forcedResized activity.
- Only ensure visiblity of an activity we are starting in a task whose top
activity is a task overlay. They need to start in the visible-paused state
and not the resumed state which just causes extra churn in the system.
- Always add additional starting activities in a task with an overlay
activity below the overlay activity.

Bug: 28751186
Change-Id: I3624a4313ae9c406d42c67a3537f67ad685791af
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
23bf5462f05b33ce4390d8370520e43b74dbec09 14-May-2016 Jorim Jaggi <jjaggi@google.com> Handle multi-window for inset hint

We need to incorporate task bounds when calculating the inset hint
so we don't specify something wrong to the client which we correct
immediately after.

Bug: 28697105
Change-Id: I23cec7d6cc62a4d982e0796a867e803d4cce0803
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
7e4ef1a3198daee07c768806dd1f7c9f628bd0f7 16-May-2016 Yohei Yukawa <yukawa@google.com> Merge "Make IMS#clearInsetOfPreviousIme() reliable." into nyc-dev am: cef3337cb5 am: a1c905caf3
am: c7aeaff113

* commit 'c7aeaff113ab3c525bab5ad79fce05ae895d93a7':
Make IMS#clearInsetOfPreviousIme() reliable.

Change-Id: I188b8ebb263d67c1bdcefcd4e9fedf390a199969
833bdcedceee60a873694a77587393abfc830eb5 16-May-2016 Yohei Yukawa <yukawa@google.com> Make IMS#clearInsetOfPreviousIme() reliable.

This is a follow-up to my previous CL [1] for Bug 15922840 so that we
can clear the following variables in a more reliable way.
- PhoneWindowManager#mLastInputMethodWindow
- PhoneWindowManager#mLastInputMethodTargetWindow

The idea behind CL [2] is that when InputMethodManagerService (IMMS) is
switching from an IME to another IME, IMMS can send a signal to
WindowManagerService (WMS) to remember the current IME's inset so that
the system can continue using it to reduce jank until the new inset is
specified by the next IME. As summarized in Bug 28781358, however, if
the next IME does not show the window after the IME switch, WMS (or
PhoneWindowManager to be precise) keeps using the previous IME's inset
unexpectedly until the new IME shows its window. All we have seen in
Bug 15922840 and Bug 26663589 fall into this category.

The idea of this CL is just adding a hidden API to InputMethodManager so
that InputMethodService#clearInsetOfPreviousIme() can surely terminate
the IME transition state managed in PhoneWindowManager, rather than
relying on a hack of calling SoftInputWindow#show() and
SoftInputWindow#hide(), which actually does not work for Bug 26663589.

[1]: Ib04967f39b2529251e4835c42e9f99dba2cf43f2
2977eb7b6ce82309a1bb1ba4ab698f503cb0388a
[2]: I5723f627ce323b0d12bd7b93f5b35fc4d342b50c
792faa2c16d319e874a1d633f964a78266d5f3f2

Note that addressing all the corner cases in [2] still requires lots of
non-trivial change. Hence this CL focuses only on Bug 26663589 (and
the case we handled in Bug 15922840).

Bug: 26663589
Change-Id: Ib567daa009c1139858dccadcfc6a04465ebecf36
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
debb183902f7a7b079cc1491bfe5761c5cbe950e 14-May-2016 Jorim Jaggi <jjaggi@google.com> Merge "Also freeze configuration when freezing bounds" into nyc-dev am: 7f303bced8 am: 3e96d18285
am: d9558cbfcf

* commit 'd9558cbfcfa819a802f17507254995fe26ed5343':
Also freeze configuration when freezing bounds

Change-Id: I920e8557bb59dfdc9ead1a7993efa60c25f18b81
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/WindowManagerService.java
4835bf843c16f4dd60efbe0047f0c285b139fe87 13-May-2016 Jorim Jaggi <jjaggi@google.com> Don\'t allow any app to specify rotation unless in home task am: 0f6a6c4bc1 am: c38966194b
am: 8c3c9a9489

* commit '8c3c9a9489fc47a22435733e3a7b4aa4907fa2a5':
Don't allow any app to specify rotation unless in home task

Change-Id: I639bb6c7372b425fb971121ab402eada9b5f5feb
0f6a6c4bc15fee726ef9aeb0d99b1204767f431d 12-May-2016 Jorim Jaggi <jjaggi@google.com> Don't allow any app to specify rotation unless in home task

The previous logic was racy/buggy in a sense so that the non-home app
could still force the orientation when the divider was still minimized.
The logic is cleaned up so only the home task can force the orientation
in multi-window.

Change-Id: I9eccf86d9fa442375d6eca400cb6ac0815c9fa10
Fixes: 28675152
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ed177fed33e891edf8ffc22a94305a69b35bc21a 13-May-2016 Chong Zhang <chz@google.com> Merge "Fix a flicker when window is removed during entering animation" into nyc-dev am: a285fdeb16 am: 8f6a9ca5e2
am: 8926e45299

* commit '8926e452991725ac7f6bf41d7f65279c7c625b80':
Fix a flicker when window is removed during entering animation

Change-Id: I2dd41625d485fbc49909bb23340c1ac9dc472c3a
8dc584b1c41157123761aa74490b2f370bc77888 13-May-2016 Keisuke Kuroyanagi <ksk@google.com> Merge "Adjust divider when IME height is changed." into nyc-dev am: 36d1296cf4 am: 727b2bcc92
am: bcc245860d

* commit 'bcc245860df5733abeee17c29cf2e63ad79451ca':
Adjust divider when IME height is changed.

Change-Id: Ib37516ef267a2d2c6fde6b3e6a22f8b9d5552e87
a285fdeb160e822a2e1fe2fb6bd80ce91afcf181 13-May-2016 Chong Zhang <chz@google.com> Merge "Fix a flicker when window is removed during entering animation" into nyc-dev
36d1296cf4f074599015b424161402f9b07da8ab 13-May-2016 Keisuke Kuroyanagi <ksk@google.com> Merge "Adjust divider when IME height is changed." into nyc-dev
c3d3af0330f6c49bb5b50719643b99b5bef5b5b0 13-May-2016 Chong Zhang <chz@google.com> Merge "Fix replacing window timeouts" into nyc-dev am: a63e1325b5 am: c624b78907
am: e828cd8637

* commit 'e828cd8637c251dcb5db844a7becd79e219cf23b':
Fix replacing window timeouts

Change-Id: I63f7a3a11e58b3a1c3628a0467df803788fb407d
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/WindowManagerService.java
19d9a8f47625319406f593d4ec71de0c8df1fcfe 13-May-2016 Keisuke Kuroyanagi <ksk@google.com> Adjust divider when IME height is changed.

Previously, divider was adjusted for IME when IME window visibility is
changed. However, IME size can be changed without changing IME window
visibility. For example, when hardware keyboard key is pressed to show
emoji layout.
This CL checks if IME height has been changed and adjust divider position
properly.

Bug: 28389933
Change-Id: I9a561bd4796a0513c8b5c493884946883f160907
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a63e1325b595d84dea7d33cb2e2c149acb326204 13-May-2016 Chong Zhang <chz@google.com> Merge "Fix replacing window timeouts" into nyc-dev
32de365bd82a748cc366aee50d281faca9d44815 13-May-2016 Chong Zhang <chz@google.com> Fix replacing window timeouts

Do not post app token with the timeout message, instead put the token
in a list and post empty message only.

bug: 28744782
Change-Id: If809d8ee16bcc31067f25ae5696b62d09ea4b864
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
1df1dec749f6ae944ef02e65ea3eba16937728f3 12-May-2016 Robert Carr <racarr@google.com> Merge "Don\'t notify windows of resize during PIP animation." into nyc-dev am: 562ea5ceb5 am: 7c98d0211f
am: 57ba8c724b

* commit '57ba8c724b4bbe63fcd30b2bdb15db0f443558ee':
Don't notify windows of resize during PIP animation.

Change-Id: Iac8cf3e607c02250934b1ec6e35672e04c0e3665
562ea5ceb5e10a3ea4dfd3825b2d639fbc6506b0 12-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't notify windows of resize during PIP animation." into nyc-dev
e4874a1a4d51e9ecd3c8dfca1321ef4f8fab9e7e 11-May-2016 Robert Carr <racarr@google.com> Don't notify windows of resize during PIP animation.

We are notifying windows of resize as the frame moves (even though the
size does not change) during the pinned animation, confusing and
upsetting the client. We do want to notify it of the one resize
at the beginning or end of the animation, so we can't just block
reportResized on bounds animating. Luckily the other area that adds
windows to reportResized (Task) is smart enough to only do so if the
size has actually changed and not just movement, so we let those reports
go through and block ones initiating from here (which doesn't perform
a check that the size has actually changed).

Bug: 28559097
Change-Id: If1f983e7cc875175ce1d098c385478a9922dea67
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
10b889de7d0c9271e3fb47c87a8ed140bee9c271 12-May-2016 The Android Automerger <android-build-merger@google.com> stephenli Manually merge commit '68fffa5'

* commit '68fffa5': (23 commits)
Fix smallest width configuration calculation
docs: DoDS, wearable reference docs
Switch the default text selection handles to Material style.
docs: Noted minor API changes in release notes
docs: added "billions" doc in Distribute>Essentials
Remove wear design pages redirecting to design/wear
correct the support library redirects to redirect whole path
Stop saving ActionMenuItemView state.
Fix iterator double-advance in ContentObserverController
TIF: Remove the uniqueness check for track ID from notifyTracksChanged
Update and add attributes to the JavaDoc for VectorDrawable
Use Q=100 JPEG instead of PNG for wallpaper display
Fix issue #28400000: Settings memory UI still showing z-ram...
docs: Updated support library revision history for 23.4.0
docs: Updates to notifications for DP3
docs: Added emoji section to api overview.
Fixed a bug where the QS was animating wrong when closing
Fix KeyguardManager.isSecure() to observe work profile
cherrypick from mnc-docs docs: Updated APK Signature Scheme v2 doc.
Docs: Added new Whitelist feature to Data Saver for DP3
...
63c09fd6cd5db31180c3db119d097fb3c5a0e505 12-May-2016 Jorim Jaggi <jjaggi@google.com> Merge "Fix smallest width configuration calculation" into nyc-dev
8563943bd39107b5a7ff9ea475592d0040423ba1 07-May-2016 Jorim Jaggi <jjaggi@google.com> Fix smallest width configuration calculation

For calculating the smallest width, we need to iterate through all possible
orientations, snap the task bounds to a valid snap target and then use the
smallest width across all orientations.

In addition to that, when flinging the divider handle to the bottom of the
screen, we need to pass in fullscreen task bounds to avoid that this new
logic applies so the maximizing app only receives one configuration change.

Change-Id: I37aa9a40938517dfaf26770eb41327d76aec7c62
Fixes: 28469673
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e4044bb617ea849939058d953e250fcd540c75cc 11-May-2016 Jim Miller <jaggies@google.com> Fix KeyguardManager.isSecure() to observe work profile

The fix passes the calling userId instead of the current userId to
allow apps running as managed profiles to work.

Fixes bug 28666104

Change-Id: I9f8676ab11bd581d9e67b2b9f385036d4d3576ee
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
1f5c16125cb4ebfedd1b9ed3128453d133de534d 10-May-2016 Chong Zhang <chz@google.com> Merge "Fixes for restoring more than one child surfaces" into nyc-dev am: 7e7449f18a am: 132b269bd5
am: 7a2717ec84

* commit '7a2717ec84d21fdf1daa74bf7579e6bce969c9d2':
Fixes for restoring more than one child surfaces

Change-Id: I90c166eb42c186de8cdb73976bd365a8fc617586
7e7449f18af5485fd49d9401fb887435224ebde2 10-May-2016 Chong Zhang <chz@google.com> Merge "Fixes for restoring more than one child surfaces" into nyc-dev
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/WindowManagerService.java
6a3d9f834f6394b4d4952a016b9511705ee62a7c 10-May-2016 Jorim Jaggi <jjaggi@google.com> Merge "Don\'t even try adjusting when dock is minimized" into nyc-dev am: 4b8ab89eca am: 4dfe430cae
am: 7c3130fa43

* commit '7c3130fa434ad6b82b94c4f8b05141423ae1b7fa':
Don't even try adjusting when dock is minimized

Change-Id: If985526097adbcec17bb7c646f3a480d3e2259f2
1ae68bfd59c811aca4be28be4c56c3ecf1d53b34 10-May-2016 Jorim Jaggi <jjaggi@google.com> Don't even try adjusting when dock is minimized

Bug: 28652219
Change-Id: I61fa515ec945e1da6b9e7a53766abea2fb1e606e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
71be47fc611fbf9395847e20035843fb54bc0be0 09-May-2016 Wale Ogunwale <ogunwale@google.com> Merge "Don\'t include IME in app screenshot while in multi-window mode" into nyc-dev am: de5a7afc79 am: b201170cdc
am: eb17f74cc4

* commit 'eb17f74cc4739150f0a9feaedb0585d2f5560196':
Don't include IME in app screenshot while in multi-window mode

Change-Id: I7502c6ad6b469d2e242398f378b945901b41efe5
a5434dd987ca976d677e5e247e35ccca529338d2 08-May-2016 Wale Ogunwale <ogunwale@google.com> Don't include IME in app screenshot while in multi-window mode

We don't screenshot the IME in multi-window mode because the frame
of the IME might not overlap with that of the app. E.g. IME target
app at the top in split-screen mode and the IME at the bottom
overlapping with the bottom app.

Bug: 28446505
Change-Id: Iae4f7eafa582779a4cf2aba3d83c4d9f76a4ccca
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
1ac8f6bc698307a6cb3c5e0363dbdaf5f03b3b84 06-May-2016 Wale Ogunwale <ogunwale@google.com> Merge "Fixed deadlock between AM and WM when animating pinned stack." into nyc-dev am: 3a94ec5617 am: f8c77eee6d
am: 99a4f256fc

* commit '99a4f256fca3e0f40784229fcdfdebba718e4bc4':
Fixed deadlock between AM and WM when animating pinned stack.

Change-Id: Icdfecbe863df3b91e42e16c6275302c2526b1a5a
3a94ec56173170306b2304c858dbbeb99c3c93cc 06-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fixed deadlock between AM and WM when animating pinned stack." into nyc-dev
2ba712905fe70d70024912fc27f99dfe0dc4bf94 05-May-2016 Wale Ogunwale <ogunwale@google.com> Fixed deadlock between AM and WM when animating pinned stack.

In Ie18cc04ceeabd94093017f79676253e1189f5249 we delay ending the
pinned stack animation until app transition is done. However, the
signal that app transition is done comes in with the window manager
lock held and the we call into AM to do some additional work which
requires AM lock to be aquired. Since AM depends on WM we shouldn't
be holding the WM lock while calling into AM since AM can call into
WM with its lock held. We now post a runnable to finish the pinned
stack animation without the WM lock held.

Bug: 28564514
Change-Id: I8450123e992e569a74609883de810cdc611ced81
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4d1cd18333629d71c229b3cb79c8aa1c59df5e75 05-May-2016 Robert Carr <racarr@google.com> Merge "Prepare to replace windows across recreate()." into nyc-dev am: ea162c3c79 am: b9d2502eac
am: 45c6eb2164

* commit '45c6eb21648f9977057471d1f41beb275512a449':
Prepare to replace windows across recreate().

Change-Id: I08c6f599d36fabb4f52ba23e9794c28203cc65b5
ea162c3c7992b01d8d56766a94e56a0cee3fe3b2 05-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Prepare to replace windows across recreate()." into nyc-dev
2d5c8ec560583d2542f9c5f583a268fd166a84a8 05-May-2016 Android Build Merger (Role) <android-build-merger@google.com> Merge "Merge "Debug traces to facilitate screen timeout debugging" into nyc-dev am: 6afe594461 am: 242eadabea am: c4c65f211e"
9efe823a3f82102438100d66c3444430046bd16e 05-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Reset mouse pointer to default when moving away from the window edge"
43faf5c5cb839360dc5aff34d52243d6fc400c85 05-May-2016 Chong Zhang <chz@google.com> Merge "Debug traces to facilitate screen timeout debugging" into nyc-dev am: 6afe594461 am: 242eadabea
am: c4c65f211e

* commit 'c4c65f211e3c40ee00dd0be796fe0d0a4080378b':
Debug traces to facilitate screen timeout debugging

Change-Id: Id698967d9d1d11c2d086584b60fa1fe3766df091
6afe594461930e83cbf5ecf181bf43fcba0060dd 05-May-2016 Chong Zhang <chz@google.com> Merge "Debug traces to facilitate screen timeout debugging" into nyc-dev
4ffc3180121b36eec2577b3c311ad4da44c3af56 05-May-2016 Chong Zhang <chz@google.com> Debug traces to facilitate screen timeout debugging

bug: 27522448
Change-Id: I4d51be316e4aedecffb7001126849d7c6136d517
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
77bdfb512f963701082c5c78e9a9db00b167fcb6 03-May-2016 Robert Carr <racarr@google.com> Prepare to replace windows across recreate().

When the activity locally recreates itself, nothing
on the server side is able to prepare preserving windows,
or replacing windows. The activity was trying to defer
removing the old window, but it was just waiting
until the new one was created, not until it was drawn,
thus resulting in a flicker. It's easy to backpack on the
existing replacement infrastructure.

Bug: 28221875
Change-Id: I55fc4ca78e9e11809473fedd8b30b6a6350cf852
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
916bde55076e26aec077a78bdffd5cf2409fa7d9 04-May-2016 Chong Zhang <chz@google.com> Merge "Apply IME adjust to newly added window" into nyc-dev am: 7095d92afc am: 525a0d7da1
am: e363b4719c

* commit 'e363b4719cdc15ecf8cb2c81f980ee5a8809d818':
Apply IME adjust to newly added window

Change-Id: I20614d5232f2a236f3bcfc9712ec42ce36a474e8
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/WindowManagerService.java
6f0b045d5778b38cab97be5a1bca602f4ffb88f7 30-Apr-2016 Vladislav Kaznacheev <kaznacheev@google.com> Reset mouse pointer to default when moving away from the window edge

Bug: 28476151
Change-Id: I15bd2408fb3b7fc58fc9936318c0ec9eda504c22
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
24daba249eec925a75206be58dc53466f7f6ffa0 03-May-2016 Wale Ogunwale <ogunwale@google.com> Merge "Don\'t remove all app token windows when window client dies" into nyc-dev am: 87a18d9e2b am: 8066abb0f8
am: 33f0495e6d

* commit '33f0495e6d88de70c6524aa4aed5f19a43775494':
Don't remove all app token windows when window client dies

Change-Id: I4c84f8323e65e0964e0b7a78fde48ce28881e9bf
87a18d9e2bff2562ca11d6cfcaa5693be4027ba3 03-May-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Don't remove all app token windows when window client dies" into nyc-dev
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/WindowManagerService.java
dd6005ba3510c6908f00917223cb88c61a1695b2 02-May-2016 Jorim Jaggi <jjaggi@google.com> Merge "Fix minimized dock stack for translucent activity over home task" into nyc-dev am: 424d35c048 am: 924ed1d0d2
am: a05b86e85e

* commit 'a05b86e85ebc00658d60462bbe1c3bab85ebe671':
Fix minimized dock stack for translucent activity over home task

Change-Id: If50745d6da2c21aa6e7142d8b0c60e6b52255ddb
d3ec507160eec964f687d3b03b0f126b3394e95f 29-Apr-2016 Jorim Jaggi <jjaggi@google.com> Fix minimized dock stack for translucent activity over home task

Previously, we only looked at whether home task is going away or
getting visible. This doesn't work anymore, as we also need to
un-minimize docked stack if another task is visible with translucency
over the home task.

Change-Id: I993f58a25d99d2ef9f562f7d1587c2dec0d05142
Fixes: 28434466
Fixes: 27906038
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9d9cdc52d7057a203f6876321eb9d581189d6e13 28-Apr-2016 Jorim Jaggi <jjaggi@google.com> Merge "Fix issues with docked stack not un-minimizing" into nyc-dev am: b72b265c85 am: a6436d1921
am: 8f5d680eb5

* commit '8f5d680eb5bdd16794f7fa6830259118f9135966':
Fix issues with docked stack not un-minimizing

Change-Id: I0348e26dac14d820e05b12ef5304286a545f2a5c
b72b265c85b2315c306de78d00365087c24375ce 28-Apr-2016 Jorim Jaggi <jjaggi@google.com> Merge "Fix issues with docked stack not un-minimizing" into nyc-dev
3be66e53cc267f4e7194475cb4864c3a3bb15c64 28-Apr-2016 Robert Carr <racarr@google.com> Merge "Delay pinned animation finish during app transition." into nyc-dev am: 08c4dfb am: cb1198a52e
am: 5daac13a17

* commit '5daac13a17d7fb79c594023b51d24df8dc2706e0':
Delay pinned animation finish during app transition.

Change-Id: I950bfccc1ad4ba2505001e65f6c1e5624c0e0f92
08c4dfba82fff75a2530bf8c694a40b306f8396e 28-Apr-2016 Rob Carr <racarr@google.com> Merge "Delay pinned animation finish during app transition." into nyc-dev
fa7fcfc61a790f2a8a412261676e039ddafc00d8 28-Apr-2016 Jorim Jaggi <jjaggi@google.com> Fix regression with docking from recents transition am: 363ab98 am: 07cd1fe6
am: 0849b51

* commit '0849b51d4cc8b44469806208f3328db94c96a2da':
Fix regression with docking from recents transition

Change-Id: If005cd4dbc6dcfd308ec87a959073f61e6c923dc
363ab98fced07bf7647355367be9e6ef76751450 27-Apr-2016 Jorim Jaggi <jjaggi@google.com> Fix regression with docking from recents transition

Because we move the task to the front in startRecentsActivity, we
always overrode the app transition type. Instead, we should remove
this logic and keep a flag whether the animation was prolonging was
finished already. If it was finished already, don't start the
prolonging when starting the transition.

Bug: 27154882
Change-Id: I1cd9e323867726ebd4b131ed5c13c3834d0f1107
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
af558e1419aba5b89b9ee8c2fdafa508e6de8d84 28-Apr-2016 Jorim Jaggi <jjaggi@google.com> Fix issues with docked stack not un-minimizing

- Add minimize state to dump
- If the docked app goes through a configuration change while the
docked stack is minimizing, the window list becomes temporarily empty,
and thus Task.isVisibleForCurrentUserLocked == false. Since we already
check at the beginning of the animation, we need to finish the minimize
animation on the docked stack no matter what happens.
- Adjust the condition when to notify divider controller about app
visibility. It turns out that under some conditions an animation is set,
but the app is not an element of mClosingApps nor mOpeningApps, so we
missed the visibility change of the home task
- Use getTopAppToken instead of getTopVisibleAppToken. When the token is
about to hide, it's already hiddenRequested, so we skipped changing the
minimize adjustment.

Change-Id: Ib9e2e3f6a5da7b7854b49857299a236e47baa6fc
Fixes: 28184044
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
0c4d1d7d6f1882aa7384f2d4be6a005b8004a584 28-Apr-2016 Jaewan Kim <jaewan@google.com> Merge "Fix NPE when WindowManagerDebugConfig.DEBUG_SCREENSHOT is true" into nyc-dev am: cc3cb5a am: 5847634
am: 285814f

* commit '285814fe1517ec8d7fd49e6291112ee7848d6da8':
Fix NPE when WindowManagerDebugConfig.DEBUG_SCREENSHOT is true

Change-Id: Ideaacbd1dcaacd5279fbf6a88cf69527198709bf
f7b54457ea01478c0005881b77521eddc052f15a 28-Apr-2016 Keun-young Park <keunyoung@google.com> Merge "fix recursion for config change" into nyc-dev am: 3279050 am: f4ba64b
am: 398c36c20

* commit '398c36c2097afd1dda5f74166edf7e5bc07804c4':
fix recursion for config change

Change-Id: I5b123ec61372def7387bd3dd05d256b69e74c738
e58aa1628218f2c28fe952101280260bb09eb663 28-Apr-2016 Phil Weaver <pweaver@google.com> Merge "Fix several accessibility magnification issues." into nyc-dev am: 1f70f0b am: 44e272b
am: 5a4be4d

* commit '5a4be4d8a26e844ade76f836163de6c4047ca263':
Fix several accessibility magnification issues.

Change-Id: I362ed6a9717465668120e75d63ca3e07ab7c7c4d
cc3cb5a009bd0fb7c56ce3731a5ba8b3c95db772 28-Apr-2016 Jaewan Kim <jaewan@google.com> Merge "Fix NPE when WindowManagerDebugConfig.DEBUG_SCREENSHOT is true" into nyc-dev
3279050c259279954ca61462689020b0b75feb3b 28-Apr-2016 Keun-young Park <keunyoung@google.com> Merge "fix recursion for config change" into nyc-dev
1f70f0b7d60ad0b98fe6597162769bce8b85e3ed 28-Apr-2016 Phil Weaver <pweaver@google.com> Merge "Fix several accessibility magnification issues." into nyc-dev
e3dd9f8c71b8420d449bf45a93be140be9ecd471 28-Apr-2016 Keun-young Park <keunyoung@google.com> fix recursion for config change

- update mTempConfig from mCurConfig first to decide if
config is changed or not. This fixes recursion of putting
new config again from reconfigureDisplay
- ignore setNewConfiguration if there is no change in configuration
This fixes another recursion due to config change -> app restart
loop

bug: 28381048

Change-Id: I4c2e6072b269baf9fa11d4b8073f0800c0e0d28d
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
70439244ba1abc4f32357d2ee8ff38f73158fe37 11-Mar-2016 Phil Weaver <pweaver@google.com> Fix several accessibility magnification issues.

Clarifying region used for magnification as "magnificationRegion",
both in the public API and in the code. There's been significant
confusion about what "magnfifiedRegion" means. Removing
"availableRegion" from everywhere except where it's required, as
that region was identical to magnified/magnification region.

Trying to shut down magnification was a complex situation where
animations in progress and new magnification requests were tricky to
handle correctly. It was not possible to guarantee that the
magnification callbacks were unregistered consistently. There were
at least two situations that led to phone restarts:
1. If a triple tap was detected between unregistering the callbacks
and shutting down the input filter. In this case the magnification
request would go through.
2. If an animation had just started when magnification was turned
off, so the current magnification was 1.0 but the animator was
about to change it. In this case the callbacks would be unregistered,
and then the animator would start changing the magnification.

This change makes registering and unregistering magnification atomic.
It also makes MagnificationController stick around indefinitely once it
is created, registering and unregistering as needed to support
magnification gestures and services that control magnification. Services
that merely query the status of magnification no longer register for
callbacks.

One part of shutting down is turning off the animation and guaranteeing
that it won't try to make further changes. Adding a flag to
SpecAnimationBridge and a lock in that class so we can guarantee that
nothing happens when we aren't registered for magnification callbacks.

Also reconfiguring all accessibility options when a service stops to
make sure that only the features required by the current configuration
are enabled.

Bug: 27497138
Bug: 27821103
Change-Id: If697cbd34b117d82c8eee1ba7d0254089ee4241d
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f9aa2a966eefb464775287aa4966c82641fac5f1 26-Apr-2016 Robert Carr <racarr@google.com> Delay pinned animation finish during app transition.

Sometimes in the case of pinned animation, we end
up with multiple animations on screen. For example when
transitioning pip->fullscreen, we are typically closing recents,
and replacing it with a task behind. We need to delay swapping ourselves
to the fullscreen stack until this app transition has finished,
otherwise we will be in the fullscreen stack with the transitioning app,
but not transitioning ourselves and thus assigned a lower Z-order.

Bug: 28333917
Bug: 27793381
Bug: 28332969
Change-Id: Ie18cc04ceeabd94093017f79676253e1189f5249
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
61cf9167fe397cbc43fbd088a7dae6f5e0e5de9c 27-Apr-2016 Robert Carr <racarr@google.com> Merge "Clear opaque flag when surface insets change." into nyc-dev am: a249166 am: 8ecd4c6
am: 2090c1c

* commit '2090c1ce6cbbb693f714e16f0d96d4a3a9a1e4c4':
Clear opaque flag when surface insets change.

Change-Id: Ic146af21dfbe610117dd8f45198214ec97f809d7
c6c5d8dc5bb3802591670d000432531cbd60018e 21-Apr-2016 Jaewan Kim <jaewan@google.com> Fix NPE when WindowManagerDebugConfig.DEBUG_SCREENSHOT is true

Bug: 28410270
Change-Id: I547556bec20a756735edad1692c64d6bd5a13773
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a249166839dca19f8f01154d3a4f58c54413a441 27-Apr-2016 Rob Carr <racarr@google.com> Merge "Clear opaque flag when surface insets change." into nyc-dev
03f0faaf2f0b6e594f4402a8f9fc65ebd42e7909 27-Apr-2016 Chong Zhang <chz@google.com> Merge "Request a wallpaper update pass when wallpaper target is set to visible" into nyc-dev am: b60a830 am: e46060a
am: 0f0361f

* commit '0f0361f417e9164875bafa10782a3f73fbf9618f':
Request a wallpaper update pass when wallpaper target is set to visible

Change-Id: Ic5dc15b29e034c3db1a5a2a0a619bf8353678276
b80d781f1dbe7b47af3be9d269542241d52e8a53 27-Apr-2016 Robert Carr <racarr@google.com> Clear opaque flag when surface insets change.

In addition to the pixel format there is an extra
force opaque flag. We only update this on creation,
but we need to respond to changing SurfaceInsets forcing
an otherwise opaque surface to become translucent.

Bug: 27364161
Change-Id: I13c69d1271412a0bc71e936867c58d5c413ab56b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
b5c4b7226f45cd746ded906502c79daf92b892e1 26-Apr-2016 Jorim Jaggi <jjaggi@google.com> Fix a few issues with occluded Keyguard am: c5804af am: a5bc2fe
am: 4e9959e

* commit '4e9959e10d6e824c4098e28cf9a903dd9b58a26b':
Fix a few issues with occluded Keyguard

Change-Id: I74e577d68decb7c53780e96f3bee20813ce9c516
c5804afa73edbf229e789570d288e66f70b54fa2 26-Apr-2016 Jorim Jaggi <jjaggi@google.com> Fix a few issues with occluded Keyguard

- When we get a collapse before the layout happened in SystemUI,
don't expand the panel after the layout.
- Don't reset waitingToShow when coming out of sleep. This will cause
win.isVisibleOrBehindKeyguardLw to return false and then occluded
state will change rapidly from true -> false -> true, leading to
flickering in SysUI.

Bug: 23898941
Change-Id: I2b941188de777086bb2b477f5bfc00cc0cd6abe0
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
75629e8ddb1b79a43c2712012e3c7b944effc5b6 23-Apr-2016 Chong Zhang <chz@google.com> Merge "Force a relayout when task is resized while not drag resizing." into nyc-dev am: b6cd42a am: b279889
am: d782bf9

* commit 'd782bf9c85dd2026b210b87f9d8d653e76963b04':
Force a relayout when task is resized while not drag resizing.

Change-Id: Ic04a2ba0730483b500b02c801d7474fb2fa04145
b6cd42a925136f6354555c9c1033d20fbaadd139 23-Apr-2016 Chong Zhang <chz@google.com> Merge "Force a relayout when task is resized while not drag resizing." into nyc-dev
dce419dc524c15abf331961194fc98fdabfa73a3 23-Apr-2016 Jorim Jaggi <jjaggi@google.com> Merge "Fix black flicker when closing IME" into nyc-dev am: ce83dcf am: 488d395
am: 22f7c87

* commit '22f7c8700f03fcef64595487dbb8f006e47eda85':
Fix black flicker when closing IME

Change-Id: Iff93d5248e1711283c65ae195a648bfbc89eb901
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/WindowManagerService.java
ce83dcf4f7ed2082c72b062c7388a4314419e225 23-Apr-2016 Jorim Jaggi <jjaggi@google.com> Merge "Fix black flicker when closing IME" into nyc-dev
0a9be9f63bbb5932ca16e92f61ee4f4b7e5f21e9 22-Apr-2016 Adrian Roos <roosa@google.com> Merge "Fix IME for status bar in docked mode" into nyc-dev am: 93536af am: 45efe3a
am: 22fe2cd

* commit '22fe2cd3d7027a91671d5d078721832f119ab533':
Fix IME for status bar in docked mode

Change-Id: I521000c7b3c1310d4fc723f5074118bee13725bc
1c30ff2912088ca452027d23dac4e7183f0b0afe 22-Apr-2016 Wale Ogunwale <ogunwale@google.com> Merge "Reconfigure display info. after configuration changes." into nyc-dev am: 10f4f44 am: 3cd052d
am: 59ec9b4

* commit '59ec9b4e22fad89d5937e3a306a2d7452cc50d27':
Reconfigure display info. after configuration changes.

Change-Id: I2b2f2c5cb26a3404f2e0c6b1a2a4001df8e9b2d1
4c753d52cd4544a64a0c3bb9b1b0895cab8799f8 22-Apr-2016 Jorim Jaggi <jjaggi@google.com> Fix black flicker when closing IME

When closing the IME in docked adjusted mode, we still need to pass
in the IME window so we can still execute the logic to delay starting
the animation, so we don't see a black hole before the animation is
started.

Bug: 28175599
Change-Id: I606d30bd63b5e909fdebd78b0aa4968bd9f26c24
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
93536af56d70c516760a796a1731237acce14f54 22-Apr-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix IME for status bar in docked mode" into nyc-dev
ae712e5708aeb2579bcfa38794e840350a992d97 22-Apr-2016 Adrian Roos <roosa@google.com> Fix IME for status bar in docked mode

If the dock divider is visible, window manager raises the IME from the
app's layer on top of the divider. However if the IME was targeting the
status bar, it would also remove it from the status bar's layer and
move it atop the divider (but below the status bar).

To fix this, we now only perform the adjustment to the IME's layer if
that moves the IME up, but never down.

Change-Id: I1308f51b98fffee64a5075c49697f5bc177ea32e
Fixes: 28024606
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ccdb00ccc5ce332edfdc6729ecd99ae39295b990 22-Apr-2016 Wale Ogunwale <ogunwale@google.com> Reconfigure display info. after configuration changes.

Some of the information reported for a display is dependent on resources to do
the right calculations. For example, {@link DisplayInfo#smallestNominalAppWidth}
and company are dependent on the height and width of the status and nav bar
which change depending on the current configuration.

Bug: 28182307
Change-Id: I2ba5de4bcfb3fa3ad334e69eb192bd15f8f7ebb2
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
34366a20504520288af17fff27440608b50398fd 22-Apr-2016 Jorim Jaggi <jjaggi@google.com> Merge changes I7261cf87,Icabfcf47,I09e6b032,I252cf139,If85ade73, ... into nyc-dev am: a51388d653 am: 9e1e02dcf9
am: 8e14c21556

* commit '8e14c215569eb7ad95382450f3bbaa3869f6718e':
Revert "Death to synchronous transactions (2/2)"
Fix a few weird state issues from race-conditions
Fix lifecycle bug in when calling positionTask
Animation fixes when task is not resumed
Keep stack from mReuseTask
Final fixes for growing recents transition

Change-Id: I51f7307237984768636bc78b680afa62916d78f8
a51388d6536bd57c2bbcf18e84d87763d388dbf7 22-Apr-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge changes I7261cf87,Icabfcf47,I09e6b032,I252cf139,If85ade73, ... into nyc-dev

* changes:
Revert "Death to synchronous transactions (2/2)"
Fix a few weird state issues from race-conditions
Fix lifecycle bug in when calling positionTask
Animation fixes when task is not resumed
Keep stack from mReuseTask
Final fixes for growing recents transition
5c80c41ee0ef808e7c8234087c5538531a16f5bb 20-Apr-2016 Jorim Jaggi <jjaggi@google.com> Final fixes for growing recents transition

- Make sure to reposition windows during animations to avoid that
they lag one frame behind.
- Don't put windows that are gone for layout into resizing mode.
- Don't layout windows that are gone for layout, to avoid resizing
the surface but the client won't draw anymore.

Change-Id: I809feffef00f9a086b44504126e03f509eb7f190
Fixes: 27855229
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2212d9740eb8a2a38bbd47ee8eb7f308935718d0 21-Apr-2016 Chong Zhang <chz@google.com> Merge "Make sure don\'t adjust IME when docked left-right" into nyc-dev am: 5da7a4a3f0 am: b35794163c
am: fde28d0188

* commit 'fde28d0188ac7334312077e69b0bb60ea3db8be5':
Make sure don't adjust IME when docked left-right

Change-Id: Ia2719f8ab62f61a3b0ed512c7aa11d13711c59a6
41de79e22050e3975636e50ab3954cf4be6bc6d8 21-Apr-2016 Chong Zhang <chz@google.com> Make sure don't adjust IME when docked left-right

bug: 28295645
Change-Id: Ia8f7f9a92fcc562bd672abae4d3ddfd6e6201a79
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
1a848c8cb6f23e3b24484f62342d34048ed75170 21-Apr-2016 Chong Zhang <chz@google.com> Merge "Fix dead surface/window left on screen" into nyc-dev am: 289395b1fe am: 786302f2fa
am: 45fe37670a

* commit '45fe37670abc3d34109d34ee26dd2fb889a5dd4b':
Fix dead surface/window left on screen

Change-Id: I6de9240fe74354900f2939fde05e25af0b80670f
289395b1feca65fc758384bb2d5c12f1c78500c1 21-Apr-2016 Chong Zhang <chz@google.com> Merge "Fix dead surface/window left on screen" into nyc-dev
1a58903babd6e28ca57008f39285b06a55340188 21-Apr-2016 Wale Ogunwale <ogunwale@google.com> Merge "Exclude IME dialogs from tap outside task bounds funcationality" into nyc-dev am: 4d07c88919 am: 10138a7c3e
am: 4b74e4876e

* commit '4b74e4876e7d5710730f71ab4e7a94fdda4ed4c1':
Exclude IME dialogs from tap outside task bounds funcationality

Change-Id: I534422658d14f79fae54376aec7749dbd3b3d470
3cc58ddd3c39580d0c008d1cf7138d5634be1b90 21-Apr-2016 Chong Zhang <chz@google.com> Fix dead surface/window left on screen

If the surface is explicitly hidden while we're changing resizing mode,
we need to discard the preserved surface immediately, otherwise it could
linger around on screen.

Do not mark mAnimatingExit in setTokenVisibilityLocked. This flag can only
be set after client relayouts to invisible. There we set mAnimatingExit and
mAnimating, so that when animation finishes the surface is marked to be
destroyed. If we marke it too early (and not mark mAnimating at the same
time), the surface may get stuck in exiting state.

bug: 28236574
Change-Id: I5cc916dfa698113e1d783a66547e1878469a9879
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4d07c8891913a338d13ffe56133e24b0d167519f 21-Apr-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Exclude IME dialogs from tap outside task bounds funcationality" into nyc-dev
1f1926152734eb9508d8cc2c5ed487027a470579 21-Apr-2016 Wale Ogunwale <ogunwale@google.com> Exclude IME dialogs from tap outside task bounds funcationality

We don't want tapping on these windows to cause a change in app
focus.

Bug: 28184155
Change-Id: Ibd4ca15b2154c2e83a11f4a2a3edb4356cbfbfed
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8864c4be7159505f7a1ab7af732a9775e141719b 21-Apr-2016 Chong Zhang <chz@google.com> Merge "Fix IME adjust when stack focus changes while IME is visible" into nyc-dev am: 3966fb9 am: 35e1368
am: 060eeca

* commit '060eeca69b139fdbd469014252975b994d110d9e':
Fix IME adjust when stack focus changes while IME is visible

Change-Id: Id0e63318b92bb8e5ce97d48e62d31100f12f420e
f347ab5eddd63dbcbb4a70a94ec0916b3db46569 19-Apr-2016 Chong Zhang <chz@google.com> Fix IME adjust when stack focus changes while IME is visible

- Use two values to animate divider width adjustment separately
from stack position adjustment. For example IME is visible
with focus on bottom stack, then user clicks top stack. In this
case bottom stack position should go back to unadjusted, but
divider should remain thinner.

- If we need to start a new animation during an existing animation,
start the motion from where the existing animation left off, so
that it doesn't look discontinuous.

- Do not adjust if IME is not actually focused on any stack. This
could happen when swiping down the status bar.

bug: 28175599
Change-Id: I802def5d1c13ebe11094eb28fc5a0b0c309e4d76
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
dd907aece8e1a5317920cb12ad5ca52b19b8bc4b 20-Apr-2016 Robert Carr <racarr@google.com> Merge "Place InputMethod after DockedDivider in window list." into nyc-dev am: f815e1b am: a4449d3
am: 49a4661

* commit '49a46610d7836c4dd94199ed7dee887cbafa4b10':
Place InputMethod after DockedDivider in window list.

Change-Id: I442ed575a50afc9682761ad60a88b433f0d472a7
e63e01a661b62c0c1b72efb646eb8b6332abe4a8 19-Apr-2016 Robert Carr <racarr@google.com> Place InputMethod after DockedDivider in window list.

We need to ensure that the InputMethod ends up
after the docked divider so it will have a higher
Z-order for input.

Bug: 28184654
Change-Id: Ifbe943312a82a79e850f106cc906f3749737710d
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b7947b49c4128f74349c30b8f67bff50711d68c5 19-Apr-2016 Wale Ogunwale <ogunwale@google.com> Merge "Use right starting window resource in multi-window mode." into nyc-dev am: 3eefb4c am: a2ce89c
am: 55ca92d

* commit '55ca92d9a8fc0b0736eadd158ff215da52a82129':
Use right starting window resource in multi-window mode.

Change-Id: I4c0cf10fcfd19d4a2eff35f098496e1b330221fe
3eefb4c313d0269f7e8bd226bdcc2d039f9e5608 19-Apr-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Use right starting window resource in multi-window mode." into nyc-dev
dfc18623edfd35778c1f2c8efab12dfeff98ded7 17-Apr-2016 Wale Ogunwale <ogunwale@google.com> Use right starting window resource in multi-window mode.

Use the override configuration for the task the app is contained
in to generate resources for the starting window.

Bug: 28220001
Change-Id: I6fdf39a6d6de41287b44b25861a76f58fe58dd53
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d518c4417052470ee9aebc483073425805f85bcd 19-Apr-2016 Chong Zhang <chz@google.com> Merge "Misc fixes for IME adjust" into nyc-dev am: b1dea03 am: a175022
am: 0c5c48a

* commit '0c5c48a497e4cdd963fd9fd7d0f386b0236b0dd1':
Misc fixes for IME adjust

Change-Id: I89cd3f97aca695f8c1a747e68d13bf0bc474fa05
b1dea03f0a72923793895048e1a5aac0d4e485c5 19-Apr-2016 Chong Zhang <chz@google.com> Merge "Misc fixes for IME adjust" into nyc-dev
198afac5ce6c8b85d5d8b374f4a7169104ef6eed 15-Apr-2016 Chong Zhang <chz@google.com> Misc fixes for IME adjust

- Use thinner divider when IME adjusted

- Dim non-focused stack

- Restrict IME adjustment so that top pane is shrunk to 30% at most

- Move top stack up together with IME adjust

- Move bottom stack up even when not focused for thinner divider

bug: 28175599

Change-Id: I83556535e5a171f0ec28d88429186fa1315b910c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
391c7aac3e6f091667207e3a169022ce2d2249ed 16-Apr-2016 Vladislav Kaznacheev <kaznacheev@google.com> Ignore drag-related input events while a drop is being finalized

Currently if the client app is taking too long to respond to ACTION_DROP
then DragInputEventReceiver will continue handling input events,
and subsequent drags will send additional ACTION_DRAG_LOCATION
and ACTION_DROP events (which will be extremely confusing for clients).

This CL ignores all input between the moments when a drag is completed
and when ACTION_DROP and ACTION_DRAG_ENDED are properly dispatched.

Bug: 28075787
Change-Id: I92259145c5d2e64b16a640f82a2ecf98bd53cc45
(cherry picked from commit 742ec0ebed9fb13fb8b023db1e1755c0ed7b77cb)
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
853304c0b11921db142a3945ab66fae5f0cc7d8a 18-Apr-2016 Tony Mak <tonymak@google.com> Show work challenge in if user in docked stack is locked

Register docked stack listener in ActivityManagerService.
If the docked stack is leaving minimized state, check whether the user
of the docked stack is locked. If yes, show credential confirmation.
Also, we now show work challenge in home task.

And we now scan the entire top task to handle the case the work app is
somewhere in the middle of the task. (eg: open personal camera in work app)

Bug: 27565539
Bug: 28094505

Change-Id: Iaf0738f43ae916a535b17949ec0f322bbfb194dc
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
681fc7b2670542aae0f3b9ef8f6c7a88db984ea9 15-Apr-2016 Jorim Jaggi <jjaggi@google.com> Fix wrong transition when dock minimized and docked app launched

When having an app docked and then going home, and then launching
the app from the homescreen, we had a wrong transition because
getTopMost task was already set to the launched app, because
getRunningTasks doesn't exclude the docked stack. Instead of adding
flags for getRunningTasks, which sounds risky, we just pass a "force"
value when we launch recents in this state.

Bug: 27154882
Change-Id: Iee4512fed13115dbbe8b74413ff1fa9b87afa0ef
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ff71d20ff357a33c30e1e3b474e51ad47d5c5d3a 14-Apr-2016 Jorim Jaggi <jjaggi@google.com> Put windows into resizing during IME adjust animation

Because the IME animates in with translucency there was a black hole
visible at the bottom. This CL puts the window into resizing mode,
waits until the change is commited, and then starts the animation

Bug: 28175599
Change-Id: Ib31c1e765639e5490208bccba77b25318ec8dc71
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
eb88d83fc5da8ea05033c03bbb9f0d4b804ba162 14-Apr-2016 Jorim Jaggi <jjaggi@google.com> Add nice animation when adjusting for IME in multi-window

- Run a separate animation when we need to adjust for the IME. We
can't use the attached animation because the adjustment animation
needs to be longer than the IME animation.
- Also run an animation when IME is disappearing.
- Adjust IME exit animation to better match with adjustment exit
animation.
- Make sure to update adjust for IME when entry/exit animation of
IME is starting, to avoid flickers.
- Don't update the IME window in PhoneWindowManager for layout
until the animation has started. This lead to an issue where the
content inset was set too large too early.

Bug: 27154882
Bug: 28175599
Change-Id: I09a33413e307f84d6c3cf4ae928c280f7ad48348
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
fd950bd6ff659f87fd87dd435207899bac65d991 15-Apr-2016 Rob Carr <racarr@google.com> Merge "Synchronize future unsync transactions to last sync." into nyc-dev
de16f96c7e66b7a643ecc7b6c1a8fb70737f5250 15-Apr-2016 Winson Chung <winsonc@google.com> Merge "Take app screenshots in 565." into nyc-dev
e34279035acf43e23172960503e6380dc8037e50 14-Apr-2016 Chong Zhang <chz@google.com> Fix crash due to null uri in ContentObserver.onChange

Also make sure we don't respond to unrecognized changes.

bug: 27291666
Change-Id: I110445231d15427e1fe9e225ed0520af262f740e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a5fdde9d15fbdf1aaeb61e1cf0c128af3aeb7b67 15-Apr-2016 Winson <winsonc@google.com> Take app screenshots in 565.

- Or to be specific, SurfaceFlinger can’t easily take 565 screenshots,
so convert them when creating the ashmem bitmap.

Bug: 28151300
Change-Id: Ic7586659a41cc19c322136f77a1c52ef68c22707
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b33daec8c2e9e12cdb9c7e5db388656fd8aff98f 14-Apr-2016 Rob Carr <racarr@google.com> Merge "Add WindowManager side timeout for toasts." into nyc-dev
70f0d229c02b91d7b987c4972b9b08bb9dcd04b5 11-Apr-2016 Robert Carr <racarr@google.com> Add WindowManager side timeout for toasts.

If the thread a toast is shown on is shut down,
the attempt to post the hide message to it's handler
will fail and it will never request removal. If this was
only some application background thread we will also not
receive a death notification. It seems best to use a timeout
to ensure we don't need the clients cooperation, espescially
as toasts can keep the screen on.

Bug: 21693547
Change-Id: I1d6e54ded5b9e2050daedc4d263e2e21fbe69862
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
adf85cac3acc6f132c15b0f05d902a12f5777e38 13-Apr-2016 Jorim Jaggi <jjaggi@google.com> Trace screenshotApplications

Bug: 27864285
Change-Id: I5b2b84e5369d136af5057bbfadc3fe4e9b38ab30
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a28e8cc50ffa37cd739518b34985e21ca88466d8 09-Apr-2016 Jorim Jaggi <jjaggi@google.com> Do not transfer starting window to translucent activity

When starting the "App may not work in split-screen" activity which
is translucent we used to transfer the starting window, and then the
frame was drawn quickly so the starting window from the behind was
removed, leading to a black hole.

Bug: 28094732
Change-Id: I828f0ea8b0465a5a113fd76a82d33177c8faa566
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4661e816e7997cab865f1b456b2dab924bcdbcda 13-Apr-2016 Chong Zhang <chz@google.com> Add ContentObserver for animation scale changes

bug: 27291666

Change-Id: Ic80af9d1cb0c58fb2decbe66591e29c584384a23
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
af80db4489d591837e114e75f5040d75b61e6804 08-Apr-2016 Jorim Jaggi <jjaggi@google.com> Fix a few issues with non-resizable info activity

- If stack doesn't have focus, we execute TASK_TO_FRONT transition.
Set the correct animation for this transition type.
- Make sure to execute app transition when we are finishing an
activity that isn't resumed.
- Correctly set mAnimatingExit for the case if the activity is
already paused.

Bug: 27327287
Bug: 27154882
Change-Id: I253938727ba0eea76ebadba242315bd2d305d0b4
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d06e606b98af3cf9d35f786a16fee85bcdf260d8 08-Apr-2016 Jorim Jaggi <jjaggi@google.com> Do not retry taking screenshots

We are holding the activity manager lock during a sleep() :-(, which
is a really really bad idea, and leads to delays in certain cases.

Bug: 28026841
Change-Id: I0855350ee429907e4597e5813c7e4fefd889319d
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
679c807210e4d741b4c65ac67d298d1d56abf3ee 08-Apr-2016 Robert Carr <racarr@google.com> Synchronize future unsync transactions to last sync.

This ensures we don't push through an unsynchronized
update while a synchronized one is pending. If the
synchronized one is no longer pending, then our
transaction is applied anyway and things continue as normal.

Bug: 27098060
Change-Id: I08fe8f848848d25d01b1696e0340fcce61ac554f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f44f5a460e9610e027a3b6257b1cf904dc3afbc7 03-Mar-2016 dcashman <dcashman@google.com> Add setting and detection of ro.sys.safemode property.

Bug: 28008032
Change-Id: I6b19b32df615becd88a56a337c999b57011c6200
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
7c3912e4abc71886ad41e7be67d4eff41974d21f 08-Apr-2016 Jorim Jaggi <jjaggi@google.com> Merge "Dismiss docked stack when opening non-resizable activity" into nyc-dev
d53f09254ed48365d3a5149d640437d76aed2e5d 07-Apr-2016 Jorim Jaggi <jjaggi@google.com> Dismiss docked stack when opening non-resizable activity

- Also move the toast to SysemUI as a cleanup.

Bug: 27341740
Bug: 28026841
Change-Id: Ic6196ed75511751c6fadb12fa24574c881100f65
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
c4dd32586d423a87c78ce963b0992db65d2300df 07-Apr-2016 Jorim Jaggi <jjaggi@google.com> Merge "Fix flicker when docking task" into nyc-dev
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/WindowManagerService.java
da8ec0d0df9a4c5cd017ed3d9f4c348bd5e45445 06-Apr-2016 Winson Chung <winsonc@google.com> Merge changes I0efc513b,Ibe45ba62 into nyc-dev

* changes:
Adding more logging of the state to the bug report.
Disable landscape aspect-scaled behavior for TV.
11c62e17af9096f76d4532f26cacd809c3a5ef53 06-Apr-2016 Jorim Jaggi <jjaggi@google.com> Dynamic density change handling

- In PWM, make sure to read the height values after the new
configuration has been applied.
- Reset all navigation bar button icons when density changes.
- Adjust height of notification bar.
- Reload divider height values in SysUI and WM.
- Snap divider handle to a new position after loading the
new configuration, as the snap points change.

Bug: 26844819
Bug: 27450471
Bug: 27921696
Change-Id: I9e28f0c49f6367c5fcfac010e7a6e98a42e85996
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
b20247636b0e0a75edcd327a047b9ea7a9d21b77 06-Apr-2016 Winson <winsonc@google.com> Disable landscape aspect-scaled behavior for TV.

Bug: 27923205
Change-Id: Ibe45ba62a9de9c03480844235efc97e8b8299e61
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9745ea35361141a94e775920a941f913af01134a 06-Apr-2016 Lenka Trochtova <ltrochtova@google.com> Merge "Put disallow-safe-boot restriction to system settings to make it accessible during boot." into nyc-dev
52c30b0cf84524bec30515ad6343646d3c5b187a 06-Apr-2016 Chong Zhang <chz@google.com> Merge "Set up none transition for relaunching apps during screen freeze" into nyc-dev
6474f0e02b9a00c1f69f985c0d73cf7f8c0fb073 24-Mar-2016 Lenka Trochtova <ltrochtova@google.com> Put disallow-safe-boot restriction to system settings
to make it accessible during boot.

BUG: 26251884

Change-Id: I1dee58dfc2aa746e0e97a6675c611c6e313ec91c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f6711474341d3a998c9a82dfe6ada94d3bf9b6ad 06-Apr-2016 Andrei Stingaceanu <stg@google.com> Keyboard Shortcuts: protect against NPE in WindowManagerService

Using an unresponsive app [while (true) { Thread.sleep(1000) }]
produces NPE:

WindowManager: Window Manager Crash
WindowManager: java.lang.NullPointerException: Attempt to read
from field 'android.view.IWindow
com.android.server.wm.WindowState.mClient' on a
null object reference
WindowManager: at com.android.server.wm.WindowManagerService
.requestAppKeyboardShortcuts
(WindowManagerService.java:10628)

Which puts down SysUI (and requires restarting SysUI).

Protect against this by checking for nulls. The end result
is that the dialog is no longer shown for unresponsive apps
and SysUI does not break.

Bug: 27914463
Change-Id: I37f0b0d5980f6ddc50f3bb778582d23ee1c7e9c3
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4f408eee9aebc6748c092b3d8d224d225bd0983f 06-Apr-2016 Chong Zhang <chz@google.com> Set up none transition for relaunching apps during screen freeze

Set up a none transition for the relaunching apps, and add them
to mOpeningApps so that display unfreeze wait for these apps to draw.

bug: 27834014
Change-Id: Id8f98c8160bdb92e93fbf948fde1d3bfece4eaa9
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9da141fe5ca3c8272681f6d3ea3f6871a2bc76c2 05-Apr-2016 Robert Carr <racarr@google.com> Do not set docked divider as IME target.

If we do this, we will fail to adjust the proper IME target
to make it visible. Accomplish relative ordering of IME and
Docked Divider in WindowLayersController instead.

We need to take care that adjustSpecialWindows won't push windows
down if they are already positioned above the highest application
layer. We also take care to not adjust the IME if the docked divider
isn't really visible.

Bug: 26387930
Change-Id: I26ca36c4f7ecf9d97f44e15c67df82b8154a169c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
c0b8c119d311645450e923bae2b4e030b18d3632 05-Apr-2016 Chong Zhang <chz@google.com> Merge "Add the app back to mOpeningApps if transition is unset but ready." into nyc-dev
81a1c176ba0b703626ad46707aae3c1c4c4c18c9 04-Apr-2016 Chong Zhang <chz@google.com> Add the app back to mOpeningApps if transition is unset but ready.

This means a rotation is started while we have a transition pending,
and startFreezingDisplayLocked() called mAppTransition.freeze() to
cancel the transition by setting it to TRANSIT_UNSET but ready
immediately. Screen unfreeze will wait for mOpeningApps to empty.
handleAppTransitionReadyLocked() will remove the app from
mOpeningApps once it's drawn, and allow screen to unfreeze.

We don't add the app to mOpeningApps if the transition is neither
set nor ready. We don't have any transtition and the app won't be
removed from mOpeningApps.

bug: 27784481
bug: 27391256
Change-Id: Id2c0759732593121769c402ae0c6edde3ebc7dc6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f98b1d4dba0ce7deeba142789163f3ab2c31b9aa 05-Apr-2016 Yohei Yukawa <yukawa@google.com> Revert "Do not set docked divider as IME target."

This reverts commit ebe9c0dbebbd8c2a23a76ff827b90e66ce3813bf [1],
because it caused a regression that IME window becomes transparent on
the lock screen (Bug 28013209).

[1]: I7d406cc88aae40a8b22c1fc1d856ccb7b6bb4558

Bug: 26387930
Bug: 28013209
Change-Id: I11243703030e34b917136b69a35245e9ef73c87c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
bd9993662d3145bfac5bf9b8aeaf0a3cd088948b 05-Apr-2016 Robert Carr <racarr@google.com> Correct screenshot bounds calculation.

If we intersect each window in the application with
our screenshot bounds we will end up reduced to the bounds
of the smallest window. Modify logic to just check for
intersection without modifying the bounds.

Bug: 27996291
Change-Id: Ib0ebb6bd02a313f67f1562dabcfb394efa8f16cf
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
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.
133b07a0a7bed8493203d80778fb8716f1784085 04-Apr-2016 Chong Zhang <chz@google.com> Merge "Fix missing exit animation when app is closed during starting window" into nyc-dev
57f3d4632bf2482ace8316ec9d38098dbe25fbc9 02-Apr-2016 Chong Zhang <chz@google.com> Fix missing exit animation when app is closed during starting window

When the transistion starts and we setTokenVisibilityLocked, mark all
relevant window flags on a starting window that's running exit animation.
This makes sure the starting window is removed when animation finishes.

bug: 27747191
Change-Id: I917ca18583e31db9a3e49ea70aae932c242877b8
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
409635b20bca7f13ad36ecb55c34efda5d523b1c 02-Apr-2016 Jorim Jaggi <jjaggi@google.com> Allow app to force orientation if dock minimized

Change-Id: I4bf1346de83922f866095465470e1a1c305b71a1
Fixes: 27437129
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
167bbfac24b1e78576b18c0522218838dfdf57bb 31-Mar-2016 Chong Zhang <chz@google.com> Avoid extra relaunch when rotating side-by-side apps

Update configuration with WM first and check if the stacks need to be
resized due to the update. If so, let activity manager resize the stacks
inline, instead of letting WM schedule another pass of resizeStack. This
way the configuration will be updated to the latest before ensureActivity-
ConfigurationLocked, and we don't need another relaunch there.

bug: 27834014

Change-Id: Ib761a96cada0c3247b0480f18370670c593159da
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ebe9c0dbebbd8c2a23a76ff827b90e66ce3813bf 01-Apr-2016 Robert Carr <racarr@google.com> Do not set docked divider as IME target.

If we do this, we will fail to adjust the proper IME target
to make it visible. Accomplish relative ordering of IME and
Docked Divider in WindowLayersController instead.

Bug: 26387930
Change-Id: I7d406cc88aae40a8b22c1fc1d856ccb7b6bb4558
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
0d50d8660dac35f7eceb5d74756de0417095b427 30-Mar-2016 Vladislav Kaznacheev <kaznacheev@google.com> Add wallpaper input consumer to WindowManagerService

This is an input consumer similar to the one used when hiding the navbar,
but placed above wallpapers. It might be useful for processing touch
events over "desktop" in freeform MW mode.

Re-landing I9d6d28a624f750ad48fc39f9b149dd1f989cceba after fixing build.

Bug:26688904
Change-Id: I89fdabd9c72cdd4a1d7ca626c33ddc99ddea97f9
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2769e7ebe9d9c5b7f1d10b21b32787b98522339f 31-Mar-2016 Vladislav Kaznacheev <kaznacheev@google.com> Revert "Add wallpaper input consumer to WindowManagerService"

This reverts commit 6013a558262d149023b32ab175c9b885b6c5b81d.

Change-Id: I2711afe2e97a8b9a4bd94193202cb83113b3bd7e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
6013a558262d149023b32ab175c9b885b6c5b81d 30-Mar-2016 Vladislav Kaznacheev <kaznacheev@google.com> Add wallpaper input consumer to WindowManagerService

This is an input consumer similar to the one used when hiding the navbar,
but placed above wallpapers. It might be useful for processing touch
events over "desktop" in freeform MW mode.

Bug:26688904
Change-Id: I9d6d28a624f750ad48fc39f9b149dd1f989cceba
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
603248d909e7383aff39c29cea0e50cdc75143e1 30-Mar-2016 Robert Carr <racarr@google.com> Update surface size even when preserving geometry.

A recent change is causing some apps to request their
SurfaceView size before requesting visibility. We won't
apply this because of the View.GONE check in WMS. Once the app
becomes visible, it thinks the surface size hasn't changed
locally, so it appends PRESERVE_GEOMETRY to let the render thread
and reposition child control the layout size. Now we will never
set a requested width/height though and end up with 0. The line
to not update requested size while preferring geometry was
required when we were using SCALING_MODE_NO_SCALE_CROP, as
making the size smaller would apply immediately (with
the surface size acting as a reduced crop until we got a new
buffer), but now that we are using SCALING_MODE_FREEZE there
are no problems.

Bug: 27914300
Change-Id: Ic0997ab3950f3eac360260e9939b6f2ee6667453
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ffe309816989457f71a39a84d22fb06fe5b6e8d5 30-Mar-2016 Rob Carr <racarr@google.com> Merge "Ensure we change SurfaceView size from UI thread." into nyc-dev
4c78ba65435326987e2901f3384b81836149b299 29-Mar-2016 Chong Zhang <chz@google.com> Merge "Animate IME adjustment for docked stack through the divider" into nyc-dev
0b10c335c72cb610e71432a61f315e7670b9af41 29-Mar-2016 Robert Carr <racarr@google.com> Ensure we change SurfaceView size from UI thread.

We need to change the SurfaceView size from the UI thread
so that we can appropriately deliver the SurfaceChanged
callback. We also need to not preserve geometry
in this case, as if we don't update the surface
and layout size together we could get scaling. This still has
some potential for holes, as transactions are not synced with
the parent renderer, but we have other methods to avoid
these in the case of resizing. This fixes the remaining
issues with content sizing and surface view "out of sync".

Bug: 27780983
Bug: 27687126
Bug: 27676101

Change-Id: Idd7864f00e5cf7a4eb32dd66c0b389292a788069
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
baba78319b954e8e42b8ecfc03b5fedc28a6168b 24-Mar-2016 Chong Zhang <chz@google.com> Animate IME adjustment for docked stack through the divider

This makes sure the top stack crop, divider position and bottom stack
surface position moves together with the IME window. Currently the
bottom stack and divider are moving together but top stack crop is
changed immediately.

bug: 27779495
Change-Id: I653ad9093621b218d9c11b0bb2efdddb1d33763e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4d2a42336be1dc57093c70a351f407cf0f58c967 29-Mar-2016 Alan Viverette <alanv@google.com> Merge "Various fixes for MagnificationController" into nyc-dev
59e53a164e1e8d19830f16b6e3a743c7ebe0c1aa 28-Mar-2016 Alan Viverette <alanv@google.com> Various fixes for MagnificationController

- Ensure initial magnified and available regions are set
- Correctly offset magnified bounds by left coordinate
- Cancel ongoing animations before unregistering callbacks

Bug: 22718911
Bug: 27871383
Change-Id: Iaff63be856598d1f8edb2d94158bbd75045c86ec
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8448f339f9207aa1e554b1a1e537ce269462807a 14-Mar-2016 Jorim Jaggi <jjaggi@google.com> Implement transition for docking task in recents #4

Convert aspect scaled animations from using scaling to achieve
the translation to use translation animations directly. We set
the pivot point to the middle of the thumbnail and then manually
translate the surface.

This will allow us to use curved motion in transition when docking
a task from recents.

Bug: 27607141
Change-Id: I5ef3bf2352baace2a3829097d2d7da8f04857ec6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
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/WindowManagerService.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/WindowManagerService.java
d3c454db291e2780c4ad5fe8b5d9e8ce3fbea114 25-Mar-2016 Griff Hazen <griff@google.com> Detect ranchu as emulator

Bug: 27780791

Change-Id: I23e5511acfba22260714874baf5e9380480b22bf
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
6a7c90a12b5e5250e0350d35ca6547b26630653f 11-Mar-2016 Jorim Jaggi <jjaggi@google.com> Implement clip modes during animation

Introduce modes how surfaces are clipped to the stack bounds
during transitions.

Use setFinalCrop to implement STACK_CLIP_AFTER_ANIM.

Add logic to determine which stack clip mode to use.

Bug: 26559810
Change-Id: I8edc47de3aaf1ef12055cefd8ceb8df536c5109a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4bbbeaa68b3d2c8ecf4918b98999469b7ca3a813 24-Mar-2016 Chong Zhang <chz@google.com> Merge "Do not adjust bounds for IME until IME is actually displayed" into nyc-dev
fcd7e80b21cc9db6be00e37371401ea1d0938796 10-Mar-2016 Clara Bayarri <clarabayarri@google.com> Keyboard Shortcuts: plumb deviceId through

Bug: 27673736
Change-Id: Ie72807aa8c2bfd142b081a6a915e101c16d31473
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b58bbccd2d230901e93191bf8b244708014b0a38 23-Mar-2016 Chong Zhang <chz@google.com> Do not adjust bounds for IME until IME is actually displayed

When the IME window is just relayout to visibe but not drawn yet,
the given insets of the IME window may not be set. Adjusting the docked
stack at the time may cause wrong bounds to be used. So we wait until
the IME window is actually displayed before moving the bottom stack.

Also move the divider together with the bottom stack when adjusting
for the IME window. This makes it look less janky.

We still have issues with the top stack's bounds changed too early,
which has to be fixed separately.

bug: 27779495
Change-Id: Ic53dc261d430a40677154be5b312a992aab49c79
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
6136273888c42faad74dce19ec49904a55affc15 22-Mar-2016 Chong Zhang <chz@google.com> Don't change geometry in relayout if preserve geometry is requested

This causes scaling to be applied in the relayout window since the
requested size won't match the window size. Apply the requested size
in repositionChild instead.

bug: 27676101
Change-Id: I03beee2b9fe118a6be329b5fd1338d54e48d9a22
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e75a9adfbd37f9ec1a9324caceb9d5d7ceed217c 19-Mar-2016 Wale Ogunwale <ogunwale@google.com> Added support to specify animation duration when resizing stack

Needed for sys-ui to control the duration of various Pip transitions.

Bug: 27674339
Change-Id: I7bad27aaa19755a73c594e88b88b56db033e1a45
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
197438180978b91be2ada57b1a1a88832e63bff5 15-Mar-2016 Chong Zhang <chz@google.com> Merge "Fix black frame when unlocking device via clicking on notification" into nyc-dev
dea4bd980cdede60e3e315a77a879b91e1b1de01 15-Mar-2016 Chong Zhang <chz@google.com> Fix black frame when unlocking device via clicking on notification

- Make sure to tell the app to start drawing if it has been stopped, app
could be stopped in visible state.

- When activity is started with NEW_TASK + CLEAR_TASK flags, skip
resuming of the soon-to-be-removed activity, and run enter animation
directly on the new activity. Resuming the old activity causes delay,
and we also run extra enter-exit transition in short succession which
cause glitches.

bug: 27391256
Change-Id: I390ef9fc9855d70a4a9642c06c87cbe548b8b466
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
7400f82699c76618d5ca24d6528580afb4695dbf 15-Mar-2016 Adrian Roos <roosa@google.com> Merge "Don't show wallpaper when backdrop is visible" into nyc-dev
d5c2db630fc816e2d9154a61ccbd6770bc57cff8 09-Mar-2016 Adrian Roos <roosa@google.com> Don't show wallpaper when backdrop is visible

Hides the wallpaper when it's not needed and fixes
the unlock animation to not unnecessairly show the
wallpaper if neither the Keyguard nor the underlying
app need it.

Also fixes a bug where the enter animation had a background
set, which led to uglyness when no wallpaper is involved.

Bug: 27533740
Change-Id: I667c6f7ca6c0e1ff7e9f793c6ddc13f6da8387b1
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
deee942be151fec441a912dbb6e500a191762a8c 15-Mar-2016 Wale Ogunwale <ogunwale@google.com> Merge "Added input freeze reason string." into nyc-dev
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/WindowManagerService.java
481355a45df5a8e5c57b1058f48cb1102b05ebc0 14-Mar-2016 Rob Carr <racarr@google.com> Merge "Use privateFlags for the preserve geometry check" into nyc-dev
b5e36b7fbe1e1710ff0f9152159ed00c0d34f9fd 11-Mar-2016 Johan Redestig <johan.redestig@sonymobile.com> Use privateFlags for the preserve geometry check

PRIVATE_FLAG_PRESERVE_GEOMETRY flag is set to privateFlag, thus this
path wasn't really used triggering side-effects with SurfaceView
placement.

Bug: 27607148
Author: Oleksiy Avramchenko <oleksiy.avramchenko@sonymobile.com>
Change-Id: Ic2708bbcc9c2ab1cfaf324b6fd539a1ad027429c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e89eeac54766633e482b51c15e99d2d93843ce26 12-Mar-2016 Wale Ogunwale <ogunwale@google.com> Added input freeze reason string.

To help debug b/27576902

Bug: 27576902
Change-Id: Ic3d2bb25842593efb11e195a1bbe19bed3bf7067
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
95b69f82316220bc40d227bf7208920eb6ed9283 11-Mar-2016 Jorim Jaggi <jjaggi@google.com> Merge "Add ability to swap docked/fullscreen stack" into nyc-dev
d47e7e1176dcf6961c7c9fce215f48f03a5098d1 01-Mar-2016 Jorim Jaggi <jjaggi@google.com> Add ability to swap docked/fullscreen stack

Adds tap affordance that moves all tasks of the docked
stack into the fullscreen stack as well as moves the top task
of the fullscreen stack into the docked stack.

Also make sure not to trigger focus switch when tapping the divider
handle. For that, add a method so SysUI can specify the touchable
region which then gets excludes for the focus switch touch region.

Bug: 27358134
Change-Id: I34f39c53cacc0b9c00f87a792b88c3f64a5f61e1
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
984600566be81ffeb2e25b43c96f6d158e16fa99 08-Mar-2016 Chong Zhang <chz@google.com> Merge "Some fixes for black screen when pressing home button" into nyc-dev
d78ddb409a8499c391322dd1e2b2a97446f9603d 03-Mar-2016 Chong Zhang <chz@google.com> Some fixes for black screen when pressing home button

Pressing home button sometimes involves a rotation (eg. when app is
running in landscape mode but launch is fixed portrait mode). This will
trigger a screen freeze, which clears the transition. We still need to
add the opening app to the opening list even if transition is unset,
otherwise it doesn't wait for app to draw first frame.

Also during rotation, app, launcher and wallpaper all get relaunched.
The transition can't start until the first frame on the new launcher
window comes back. We can't start it based on the draw state of the old
window, because the old window could get removed and readded shortly
after we start the transition, and it shows up as a black frame.

bug: 27391256
bug: 27295820
Change-Id: I346685076657eef209d0fab68f272e218b55e011
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
c7d64c134ae786cc41af78a3e7dfbfeda8be4287 25-Feb-2016 Sami Tolvanen <samitolvanen@google.com> Notify user when forced to boot into safe mode

When the device is forced into safe mode due to a security
compromise (persist.sys.audit_safemode has been set), notify
the user and provide access to a help article.

Bug: 27308928
Bug: 26902605
Change-Id: Ief7451f2d741eb888e5b111061aab5dc29525ea5
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8d5a542f66beae774354038f15dd1afe7fcf754b 04-Mar-2016 Wale Ogunwale <ogunwale@google.com> Clear app token mAppStopped when app resumes.

It is possible for an activity to be in the stopped state without
setting it's visiblility to false in window manager.
For example, the home acitivty behind the lock screen. Since the
lock screen isn't an activity it doesn't affect the visiblity set
of the home activity, so AM doesn't tell WM to hide the app token.
However, AM uses another channel to detect that the device is locked
and moves the activity into stopped state. WM on the other hand also
detects that the device is locked and hides the window surfaces of
all windows behind the lock screen. So, at this point AM has also
told WM that the activity is stopped. Once you unlock the screen
AM resumes the activity but doesn't report any visiblility changes to WM
since it's internal state didn't change. So, if you go from the home
activity to another app the home activity window will be destroyed
before the activity is stopped because mAppStopped is set to true.
We now set mAppStopped to false when the activity is resumed.

Bug: 27286867
Change-Id: Ic75456d30abd582fa44f932f5aeeb449950157ee
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2728bf4bf9c4bc73837f41d3bf0251a7de6c9e16 03-Mar-2016 Wale Ogunwale <ogunwale@google.com> Added more log points for add/remove in window manager.

Bug: 27286867
Change-Id: Iecb522a1ff7e093a8feef27fdd68c50b9a80d553
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3756cfe4b222888d6aa70464418c3e1cd9b3193a 29-Feb-2016 Wale Ogunwale <ogunwale@google.com> Changed logging format of lost windows to reduce confusion.

Bug: 27396828
Change-Id: I1ffbd69738f4baeda542908d23d591d1f30bc444
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
94ce94e96069ab6c2ece4864ba4c7692f3168352 25-Feb-2016 Muyuan Li <muyuanli@google.com> Allows components to register shortcut key.

The registered shortcut will be called from PhoneWindowManager,
before dispatching

Change-Id: If26128939b45a639c8895719a7a23ca433f39fd9
(cherry picked from commit 4da863c5a8872dcabb179a978a2b2157d9081679)
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
503d1ccce940e45a2f16bfe5f5a088692a740b52 26-Feb-2016 Wale Ogunwale <ogunwale@google.com> Merge "Clear starting window request if remove is requested before it is added" into nyc-dev
275561a74677f9d6c8f3f2cebc3cfea416ca586d 23-Feb-2016 Jorim Jaggi <jjaggi@google.com> App transition delay tracking

Add TRON logging for all kinds aspects when we execute an app transition.

Bug: 27295491
Change-Id: Icb0cbdb92d4d5fbfedadd40a017a50eb217058aa
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f40c11b11fd73493d0acc39baf8efeee4db7316f 26-Feb-2016 Wale Ogunwale <ogunwale@google.com> Clear starting window request if remove is requested before it is added

It is possible the add starting window to be scheduled and a remove request
come in before it is actually added. In this case we want to prevent the
addition of the starting window by clearing the AppWindowToken.startingData.

Bug: 26659857
Change-Id: I3ef6ea81d555e81b62e894003aadcc51d281b1ad
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
51605275957dd936f9ad379d6d525d5e995ebe08 25-Feb-2016 Jorim Jaggi <jjaggi@google.com> Show toast if app was forced to be resizable

Bug: 27327287
Change-Id: Iaf33f0ba27a6bfb240068b9cf21732b0870f4429
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
7aea4f49dececb3accf09f55a2b7f218c16f5887 24-Feb-2016 Jorim Jaggi <jjaggi@google.com> Only prolong animations for freeform

So we don't unnecessarily slow down the regular transition

Change-Id: I84e4bf0f9a7caf59dd20478166458f2642e98c80
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5dea9e79c240064526a2a20931e1fc9e0eea89f0 23-Feb-2016 Jorim Jaggi <jjaggi@google.com> Merge changes I78305f7f,I6faf0167 into nyc-dev

* changes:
Fix disappearing windows after moving divider to side
Recents transition fixes
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/WindowManagerService.java
826a2c12a6fc667c14828f83111e1f0a7b2befd1 23-Feb-2016 tiger_huang <tiger_huang@htc.com> Make accessing mWaitingForDrawn thread-safe

mWaitingForDrawn can be accessed by multiple threads, but it was not
protected by the mWindowMap lock perfectly.

Change-Id: I128ba1a00f40af83b051c0d1df4350d0635a9dff
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a6e9e24be53d2516138f487e340e46b8d0212d86 05-Feb-2016 Sami Tolvanen <samitolvanen@google.com> Support persist.sys.audit_safemode

Don't leave safe more if persist.sys.audit_safemode is set, unless the
current build date is newer than the specified value.

This allows us to keep the device in safe mode across reboots until an
OTA has been applied or user data is wiped.

Bug: 26902605
Change-Id: I781c3059ea8d4fb2f0c923e4488b1932d69678d3
(cherry picked from commit ee2b49283261f7b4518ec7c98f568f883f817c9d)
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ecbcadd27d1c00fddebbd2893251b05096252ee5 21-Feb-2016 Wale Ogunwale <ogunwale@google.com> Fixed bug with stack bounds getting out of alignment with screen rotation

Before updating the stack bounds due to rotation change, we need to make
sure both the configuration and the current display info. the stack is
using have been updated for the current rotation. Previously we were
updating is after configuration change, but the rotation might have changed
again by the time we get the configuraiton changed call and
TaskSack.updateDisplayInfo not called yet.

Bug: 26744649
Change-Id: Idfd30e78dc9c2fb521ff1957f043c3b1696a2a31
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9ecf7cfee8c681587bd7cf6468aff80178e2d2d9 20-Feb-2016 Wale Ogunwale <ogunwale@google.com> Merge "Clean-up WindowState if exit animation is done before app finishes" into nyc-dev
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/WindowManagerService.java
82c9dc951e8e19b9eab6120b6465e08c5d69beba 06-Feb-2016 Jorim Jaggi <jjaggi@google.com> Fix configuration calculation when task is non-fullscreen

Apparently only the navigation bar is excluded when calculating
Configuration.screenLayout. Make the calculation for non-fullscreen
tasks consistent with fullscreen tasks.

Change-Id: I027e41e49ffe95245116f3d134e0bc93af0ee450
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8fe7e0a88ecc4a995a3a86b2ef60143fb0ffa1b0 13-Feb-2016 Jorim Jaggi <jjaggi@google.com> Fix clip reveal animation in docked window case

- Move ClipRectTB/LRAnimation to wm package, because that's the only
place we use it.
- Extend ClipRectTBAnimation to combine it with translation animation
so the clipping gets applied after the translation.
- Fix clip reveal transitions when a window is docked.
- Make the docked divider minimizing animations synchronized with clip
reveal animation.

Bug: 27154882
Bug: 22174716

Change-Id: If5c94c777f3b51c6f53f6f34cc261bf3439cfc88
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
42625d1bc7ef99c4d4435e8cdebfe3eee57b8d97 12-Feb-2016 Jorim Jaggi <jjaggi@google.com> New behavior for docked stack when going home

- We keep the docked stack visible when home task is visible even
though it's not resizable.
- We introduce the a new concept called "minimizing" the docked stack,
which happens when going home. In this state, the docked stack is
clipped of almost completely.
- To achieve that, we introduce TaskStackBoundsAdjustController,
which adjusts the bounds of the docked stack when minimized. Also,
migrate the IME handling to this new class.
- We also need to inform SysUI that it is now minimized so it can
remove the drag affordance on the divider, and also make it a bit
smaller.
- When we detect an app transition, we check whether the home stack
gets visible/invisible. We then start an animation which runs in
sync with the normal app transition. For that we introduce
DockedStackDividerController.animate(), which performs the animation.

Bug: 27137961
Change-Id: I8623bc73cc6872bf28c5b1b8d5795974576811b2
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
722ff89fd1684179c342c3e9b6014c5499f90b90 18-Feb-2016 Wale Ogunwale <ogunwale@google.com> Protect against surfaceController and hasSurface getting out of sync.

WindowStateAnimator.mSurfaceController is set to null whenever a
surface is destroyed and WindowState.mHasSurface is set to false
shortly after that. However, it is possible for them to get out
of sync in a couple of places due to exceptions or duplicate destroy.
Consolidated the call to set WindowState.mHasSurface inside a finally
block in WindowStateAnimator.destroySurface
Also, cleaned up the code a little to that it is more obvious what is
going on.

Bug: 27235356
Change-Id: I7e6d0c1fb015531c393ac86dcaebebd134fad612
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5d6bdebfeed73ab5efff03c451b3ff7460935d00 13-Feb-2016 Vladislav Kaznacheev <kaznacheev@google.com> Move more drag-related code to DragState

Pure refactoring: moving the code manipulating
DragState member variable into DragState.

Change-Id: I1f9feff32c8b18ae0ff451030d026d4276fecd5b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
bcac3bd744a76fa166ada0ed299c96e0499c8033 17-Feb-2016 Vladislav Kaznacheev <kaznacheev@google.com> Merge "Fix cross-app drag and drop" into nyc-dev
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/WindowManagerService.java
7615130f55b2056b7f25107c84c45e04d85c7515 17-Feb-2016 Vladislav Kaznacheev <kaznacheev@google.com> Fix cross-app drag and drop

Bug:27219399
Change-Id: I37199d140ca451326754a321b3a15f82c18157fa
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
0a253a67d90b3728fe947e4fd70622fe2a5f2f64 12-Feb-2016 Vladislav Kaznacheev <kaznacheev@google.com> Merge "Make drag and drop comply with cross profile copy paste policy" into nyc-dev
da2f1943dfb23f080e6cd5f16d55eb958f1d2001 12-Feb-2016 Vladislav Kaznacheev <kaznacheev@google.com> Make drag and drop comply with cross profile copy paste policy

If UserManager.DISALLOW_CROSS_PROFILE_COPY_PASTE is false
then drag and drop is only possible between apps from the same
profile.

This CL also supports cross-profile content URI grants.

Bug:26772503
Change-Id: I2e160cfdc6259fee2ea5e561c6e21fc0547dca2e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e26334ba1a5c7880c67b931a6ca73941167712e9 12-Feb-2016 Jorim Jaggi <jjaggi@google.com> Merge "Handle light status bar for split-screen" into nyc-dev
2b63730837fbc1bf3ea80cc46a8ac2f00e144549 12-Feb-2016 Rob Carr <racarr@google.com> Merge "Correct error in window lifetime." 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/WindowManagerService.java
2b79af1e8a45776ba57cd38a50afe4a6c2f719aa 11-Feb-2016 Chong Zhang <chz@google.com> Mark activity as visible and not stopped after resume-relaunch.

After a resume-relaunch, the activity is assumed to be in resumed state,
and we'll not run the normal code for resume. But it needs to be marked
visible otherwise it will stuck in invisible state.

Also trade some AM traces for WM traces for further debugging.

bug: 27123118
Change-Id: I50ce5cde29f441115675db54523090ef86d95ea8
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
bc89e59295a39c9ce8f946d1f2c229d1ffdd6871 11-Feb-2016 Robert Carr <racarr@google.com> Correct error in window lifetime.

Correct a simple logic error where application stop state is incorrectly
reset.

Bug: 27112965
Change-Id: I3058378c1e240e0a02665ad479678723e14921aa
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
81ba11eccbc2519338782100c13cf4a5909ad6be 04-Feb-2016 Jorim Jaggi <jjaggi@google.com> Put dismiss end target at navigation bar

This makes the animation when exiting docked mode a bit nicer
when you fling the divider towards to the navigation bar. However,
since the divider ends at the navigation bar, we need to immediately
dismiss it instead of fading out when the divider is fully occluded
by the navigation bar.

Change-Id: Ic5432fd118cb71be36485667b2c537caf5065ce5
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ce14452a27acf0492d799ec88c619add3a630a88 06-Feb-2016 Wale Ogunwale <ogunwale@google.com> Fixed issue with drag resize state when animating pinned stack.

When animating the pinned stack, we set drag resizing on the top
most task in the stack. This has a couple of issues.
- Only the top most task is put in drag sizing mode and all other
task in the stack will not be in resizing mode.
- The top most task of the stack can change during the animation,
so we fail to clear the drag resize flag on the previous top task.

We now track drag sizing at the stack level and have the stack
drag resizing state affect its tasks drag resizing states.

Also added concept of continuing a bounds animation if the same
target called BoundsAnimationController.animateBounds before the
current animation is done. We don't send onAnimationEnd() for the
current animation that is been cancelled and don't send
onAnimationStarted() for the animation that will be replacing it.

Bug: 25672053
Change-Id: I64e89ed09d81e4802dacebc5818dfa1deb0d588f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
1a2941541a78b42f8181a37df6cd5623c38525f6 05-Feb-2016 Alan Viverette <alanv@google.com> Merge "Multi-user support for display density changes"
067e817585524aeb0fb2c5ff4444c21fadc3f0d3 04-Feb-2016 Jorim Jaggi <jjaggi@google.com> Only treat "null" bounds as fullscreen

When long pressing on the recents button, we made it one pixel smaller
than fullscreen so we don't dismiss the stack immediately again.
However, this is a huge hack, and lead to problems with navigation bar
background because there we actually rely on the fact whether
the window is fullscreen or not to determine whether to draw the
navigation bar background, which lead to flickering.

Bug: 26777526
Change-Id: Ifdfcf3ad4138bc88c5164177cd20f1ff1635085f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
0a932141980b576e0b9bcec9a077f55b7b269a02 02-Feb-2016 Jorim Jaggi <jjaggi@google.com> Exclude stable insets from task config

When a app is in fullscreen, we exclude navigation bar and status bar
size when calculating the config. However, when in multi-window, and
the task was almost fullscreen, the height/width reported to the app
was actually larger than when it was in fullscreen. In order to fix
this, exclude the stable insets when calculating the task
configuration, and also fix a bug when calculating the screen layout.

Change-Id: I843ae012fb3050c79643d125550aacb6e73d27da
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
3442c1232ce67a3ca390050110385eec9d82fec7 03-Feb-2016 Chong Zhang <chz@google.com> Merge "Do not adjust for IME window if docked stack is not visible"
feea9ca7d0300b487264fa637736d2a0c41e7678 03-Feb-2016 Chong Zhang <chz@google.com> Do not adjust for IME window if docked stack is not visible

getDockSide() will tell us the stack is docked on bottom even when
we're not in docked mode. So we have to check if docked stack is
visible first.

bug: 26940656
Change-Id: I8729b2502e2fa78ae51e97f5599c23f3d3ea62fc
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5e8d837894d38151c943677c8323860de1438bd0 03-Feb-2016 Alan Viverette <alanv@google.com> Multi-user support for display density changes

Bug: 26942569
Change-Id: Ie44aed00619c5e5604b3d48a3a9d0fc38b0ef0eb
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
0464a9345e7e3e666a84a3489cfffd5e45a21353 03-Feb-2016 Chong Zhang <chz@google.com> Disable WM loggings

bug: 26819496
Change-Id: Ib5258391101293c9aaca3b865e1f1580234bcbe3
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
961f4858f2a401366a6691c95b702a2baac67ea1 02-Feb-2016 Wale Ogunwale <ogunwale@google.com> Window resize reporting improvement when docked stack is created

There were a few issues with window resize reporting when a docked
stack is created that caused the client to get frames for fulscreen
even though the task was in split-screen mode.

- Ignore docked stack visibility when get bounds for other stack when
resizing due to docked stack.
- Immediately resize all other stacks in activity manager when the
docked stack is attached to the display.
- Defer surface layouts for the uncheck portion of moving a task to a
stack.
- Don't perform layout of all windows on a display when a stack is
attached to the display since it doesn't have any windows yet.

Bug: 26861802
Change-Id: I2c7f31153da48618e90607c98ec5b29492b6ef38
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
76e9d1d4be17e52c130e86171b6fd81b7d54a434 02-Feb-2016 Chong Zhang <chz@google.com> Merge "Transfer focus from the current focused window for two-finger scroll"
ecb44a328cd443ce658cb5e3cd97454f3e5d46ff 02-Feb-2016 Chong Zhang <chz@google.com> Transfer focus from the current focused window for two-finger scroll

When doing the two-finger scroll, we resize based on the main window.
However, the main window might not have focus (eg. diaglog displayed
on top). We need to grab focus from the window that actually has focus.

bug: 26604036
Change-Id: I05d0ed95c59901c925e242d4b9a856d1ca0a55f3
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
c6c89a82144f59475242c75d67529fed943ae30b 29-Jan-2016 Jorim Jaggi <jjaggi@google.com> Fix transition to recents in docked mode

Transition for non-compatible apps will be handled in a separate CL.

Change-Id: I9c474f7aa394e4f3eacd1845c78bee5874bd8a59
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
89db4366ae882816767d7abc3746958d793908d0 30-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Merge "Deliver onEnterAnimationComplete when there is no transition animation."
3b81c90efb05c4a3f75cfb39b571dcde4a77c856 30-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Deliver onEnterAnimationComplete when there is no transition animation.

Documentation says that Activity.onEnterAnimationComplete() will be
called when it's safe to draw, so developers can wait for this callback
to do work. In certain cases we never trigger this callback: when the
screen is frozen and there is no transition animation and the window
just popups into existence. In that case we should forcefully schedule
this callback, so that it can be used reliably.

Bug: 24005761
Change-Id: I2c20ca9bc7fa15ca53d9d492ad1c3f5f9608e8c4
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
b9b16a74e5543b7b707e55a7382bbe82d300e2e5 27-Jan-2016 Wale Ogunwale <ogunwale@google.com> Display warning toast when we try to launch unresizeable app in split-screen

Bug: 26774816
Change-Id: Ia85d9d89758041661391018f04feb6f8db4e56d9
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2e4089478f5c711340e3c5b43aba364ee6eb5de2 29-Jan-2016 Wale Ogunwale <ogunwale@google.com> Merge "Use resizeMode integer instead of resizeable boolean."
bd8a4b03ce3873d78f94fbefcdfc07d8e54b22ac 29-Jan-2016 Jason Monk <jmonk@google.com> Check QS window token types

Change-Id: Id72193b680a9a1bf2a353ed8f902057ace3dde20
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
49918b95e863b119d9c57fca698abb19ce429427 28-Jan-2016 Chong Zhang <chz@google.com> Merge "Shift bottom stack upward and fold top stack when IME is visible"
b816b862b0c73033f1ebd8070e77fcfe33605171 25-Jan-2016 Chong Zhang <chz@google.com> Shift bottom stack upward and fold top stack when IME is visible

bug: 26293982
Change-Id: If5f22037e12edb6d67b80ff1deb1be7a028aa76c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
80a5314ad3ff7c20f53ab8217f895dd02f5247af 27-Jan-2016 Winson Chung <winsonc@google.com> Merge "Fixing notification of the docked stack state for the current user."
dcf4826c522686dbccbc95e57762081c84ff1d6d 26-Jan-2016 Winson <winsonc@google.com> Fixing notification of the docked stack state for the current user.

- When there are multiple users, ensure that we check that there are
tasks in the docked stack for each user (instead of just the presence
of the docked stack) and re-notify listeners of the state of the
docked stack when the user is switched.

Change-Id: I911c4a32db187f9cd29d462309bd0cf7febb1993
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2ced3d531c6c5d82db59db79bf8f890fb7acf200 25-Jan-2016 Wale Ogunwale <ogunwale@google.com> Merge "Don't keep visible windows in pinned stack on screen when app dies"
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/WindowManagerService.java
1262dc039061a1c746335d9bf7a09056b42c84fa 22-Jan-2016 Michael Wright <michaelwr@google.com> Merge "Switch and store keyboard layouts based on IME subtype."
d5f7ed9fe9dc3590f6ef9cb7470e29e836a95907 19-Jan-2016 Michael Wright <michaelwr@google.com> Switch and store keyboard layouts based on IME subtype.

Rather than associate the keyboard layout solely with a specific
hardware model, we should also associate it with a given IME subtype.
This lets users switch between various languages and have the
keyboard change in unison with them so they can use the appropriate
layouts for each language.

This change adds initial support for associating IME subtypes and
keyboard layouts. We still need to:
- Remove support for the old style of layout association once the
Settings apps begins to use the new APIs
- Automatically select an appropriate layout based on the given
subtype (or set a reasonable universal default such as QWERTY)

Bug: 25752812

Change-Id: Ie88ce1ab77dbfe03ab51d89c1dc9e0a7ddbb3216
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
0102a8a8e957c38e8fe40e6cd184339ea9f38906 19-Jan-2016 Rob Carr <racarr@google.com> Merge "Replace SurfaceViews across resize trigerred relaunches."
23fa16b759f023ea18ab9f84e89df50d4b449dfd 13-Jan-2016 Robert Carr <racarr@google.com> Replace SurfaceViews across resize trigerred relaunches.

In resize modes where we are preserving the main application
window, we need to tell the WindowManager to prepare to replace
the child surfaces, or they will dissapear across relaunches.

Bug: 26070641
Change-Id: I864168688dc320e9280e651f9c5df614f52bc96c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
198dcbf5231761b7b644d9d7fbceb23e1f0f9aec 18-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Fix several small logging issues.

This includes:
1) invert HIDE_STACK_CRAWLS to SHOW_STACK_CRAWLS so it's immediately
clear from the config file that something is enabled (if anything is
true).
2) Merge stack collection code into a method, so we can remove the
repeated code.
3) Remove copying of some constants in AppTransition and just import
them directly.

Change-Id: I3190ee0a5963720ac6285b4f48b2705e84f04ab5
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
21e0917d73c4fe5c3f67ff3918d114b078499101 16-Jan-2016 Wale Ogunwale <ogunwale@google.com> Merge "Fix split-screen visible apps issue when screen is rotated on lockscreen"
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/WindowManagerService.java
4846ee3cc378001128680f2a3309c7e60bfcac75 07-Jan-2016 Jorim Jaggi <jjaggi@google.com> Optimize window relayouts when dragging divider

- Communicate the resize mode to ViewRootImpl. If it is a docked
divider resize, do not call relayout for every traversal.
- Do not call Task.resizeWindows() unconditionally when changing
Stack bounds. It might be just a move.
- However, not calling relayout breaks layout bounds while
relaunching. To fix that, do the following:
-- Inform ViewRootImpl that the activity just relaunched, and force
a relayout call in the next traversal so the client can pick up
the unfrozen bounds.
-- When unfreezing the bounds, cause a traversal in window manager.

Bug: 25015474
Change-Id: Iab9a445dabce4f6ec1e25957038fe40a4be65246
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ccb6ce2dcd8b833692f6c8a4a568fb938acfe058 15-Jan-2016 Wale Ogunwale <ogunwale@google.com> Fix split-screen visible apps issue when screen is rotated on lockscreen

When the keyguard is showing we say the docked stack is invisible so that
any activity that displays on top of the keyguard isn't cropped by the
docked stack. However this causes issues when the docked stack is resized
due to orientation change while the keyguard is showing.
We now ignore the visibility state of the docked stack when trying to get
bounds information for resizing while the keyguard is showing.

Bug: 25970565
Change-Id: I7479a1d0afed3b2edfb17848c56c5c3902b3709e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
75e097965cc273d33192555b0e65de3dbc1753ce 29-Jul-2015 Clara Bayarri <clarabayarri@google.com> Request Keyboard Shortcuts for SysUI Dialog via Window

Keyboard shortcuts are requested via WindowManager, and
the request pipes through to the view root and the window
callback.

Bug: 22405482
Change-Id: Ic0071e91c7b554be3ac9df71e9539ee8a60e822e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f2c9628cac0240b9a39b8eadddf4c0528cd45c2d 12-Jan-2016 Chong Zhang <chz@google.com> Merge "Apply scroll to windows added to a non-resizeble task that's docked"
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/WindowManagerService.java
737af724eb31f513386e91ee5510cc6991350937 31-Dec-2015 Jorim Jaggi <jjaggi@google.com> Snap docked stack after screen rotation

- Move DividerSnapAlgorithm to com.android.internal, also move
some utility stuff into DividerUtils which is used from both
SystemUI and window manager
- When the screen rotation changes, rotate the stacks like before
but then also snap the docked stack to a valid snap position.

Change-Id: I9e1aa13f42f398a25c9016e6f20395ee212e405b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
db02dc190feb11731af4af137f131c1377d3abbd 11-Jan-2016 Chong Zhang <chz@google.com> Merge "Fix black screen when launching app from Recents into non-docked area"
573e8e170656f0b5e24fed966890f4d9e68ec26b 11-Jan-2016 Chong Zhang <chz@google.com> Fix black screen when launching app from Recents into non-docked area

In this case, we're putting the app into a fullscreen stack that is
resized due to docked stack. When setting up the thumbnail scale up
animation, we have to treat this case as animating into freeform window,
as the containing frame will not be fullscreen, and it's not a clip
rect. For freeform windows, we set up scaling and translation, and
don't change the clip rect.

bug: 26435476
Change-Id: Ic1ac71bfc814afd62572027fa11663c80d903a2d
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3dc52ed1799f96deaf802a5304f7301463dec58f 11-Jan-2016 Winson Chung <winsonc@google.com> Revert "Snap docked stack after screen rotation"

This reverts commit e65d6bb2072471e63b93aa14a288bc59ed86208f.

Change-Id: I245aa9be3ea98ff742e02b02f6f1d344bc2e8182
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e65d6bb2072471e63b93aa14a288bc59ed86208f 31-Dec-2015 Jorim Jaggi <jjaggi@google.com> Snap docked stack after screen rotation

- Move DividerSnapAlgorithm to com.android.internal, also move
some utility stuff into DividerUtils which is used from both
SystemUI and window manager
- When the screen rotation changes, rotate the stacks like before
but then also snap the docked stack to a valid snap position.

Change-Id: Ifb0c65dfbdfca2343a76b12de982c0701fe0c3ab
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9817dd098dcb4e37e1bec8b1e44ddb25a89cf8ec 08-Jan-2016 Chong Zhang <chz@google.com> Transfer focus on any touch down action

Currently we are deliberately not transfering focus if the ACTION_UP
and ACTION_DOWN points are different. Removing this logic so that we
transfer the focus if user touched within a non-focused task.

If user is scrolling using a pointer device without touch action, it
will not result in focus transfer.

bug: 26040818

Change-Id: If1fd6b8405e1507f60be44f12b6fc599555b8ba7
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
495f1381817ab53040916f4630e5afe981987675 08-Jan-2016 Chong Zhang <chz@google.com> Merge "Remove dead window if its activity record is cleared from history"
7e8eeb79abe1a4b39b2f086aacefa48928307cb2 07-Jan-2016 Chong Zhang <chz@google.com> Remove dead window if its activity record is cleared from history

We keep the dead window if its activity record is kept. However, if
the activity doesn't have any saved state, the record will be removed
too, in that case we have to remove that window.

And add a "apps" option in window dump to retrieve all app windows
regardless of the visible states. We need this to get the windows
that's waiting for replacements.

bug: 26324082

Change-Id: I7179354fe85553a5436b26371d3ad7295a452ce3
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b34f48ff7153ea84eaf0e96fa31286af10fea287 08-Jan-2016 Rob Carr <racarr@google.com> Merge "Correct exit animation window retention logic."
8aa603d830950e40c0224e7f5900275ff29383a8 07-Jan-2016 Robert Carr <racarr@google.com> Correct exit animation window retention logic.

The current logic in removeWindow will retain windows
for exit animation if mExiting is true or if isAnimating is true.
In the case that mExiting is false, but perhaps isAnimating is
true (because we are opening or resuming), we could also enter this
code path. This means that if an application removes its window
during an entrance animation, the window could be incorrectly retained
as if for an exit animation. This incorrectly retained window could be
eligible to receive WM focus, despite already having its input handle
being set, this would cause a null focus to be copied to the
InputManager leading to the ANR we observe in linked bug.

Bug: 26157153
Change-Id: Ib02964bcdfba665d7e7162cea8ed96315870d805
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9ebbe6afe7a433f78ca3d30c9f215c53212c34ac 17-Nov-2015 Sriram Viswanathan <tvsriram@google.com> Changes to support navigation bar system UI in car mode.

The change has all the platform changes required to support
modifications in the navbar dimensions and custom icons in car mode.
The UX is not frozen yet, but have placeholder resources provided
by android auto UX engineers.
The change assumes that the car mode configuration is known to the
WindowManagerService and uses its current ui mode to request the
latest from the policy (PhoneWindowManager.java). The change is
modeled on the way rotation is handled, where the Policy knows the
different view attributes for uiMode and just returns back the
window sizes based on the current uiMode requested. The policy does
know the current uiMode, but the order of when that changes is not
deterministic [from logs it does happen before any request to update
UI occurs, but guess that could change].

Bug: 25996809
Change-Id: Ia46cbe5096382d26c9eb8ec74cf59a059b767edb
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f14fa1ec938b79673c6f6defdc666e610c6953a6 07-Jan-2016 Yohei Yukawa <yukawa@google.com> Merge "Stop lying about hardware keyboard presence."
557467b82d66c702bc2b2596d9e6a375fb0f9e2e 07-Jan-2016 Wale Ogunwale <ogunwale@google.com> Merge "Improved output for 'dumpsys window displays'"
bc98c55db4187021862d8fdeb332cbcd25e4749b 06-Jan-2016 Wale Ogunwale <ogunwale@google.com> Merge "[WindowManagerService] fix starting window issue"
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/WindowManagerService.java
b429e6826d394a63f81d1702efd714d640ddfb49 06-Jan-2016 Wale Ogunwale <ogunwale@google.com> Improved output for 'dumpsys window displays'

New format makes it easier to parse during CTS testing.

Bug: 19225708
Change-Id: Ia9a75ca92b6c10eefcb07cabea9852e514807b08
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
abc218009071244c211936bc91c96ed26220bc0d 04-Jan-2016 Ronnie Leng <ronnie.leng@gmail.com> [WindowManagerService] fix starting window issue

Symptom:
1. Acitivity A and B belong to same task.
2. A is started and start B in its code
3. B is opened with blank screen

If starting icon has been display, both startingWindow and
startingView should not be null.
Current logic only uses judgement on startWindow. In above
case, it leads startingView set to null as A and B shares
the same starting window due to same task. Then system will
not get chance to remove startingView as it is null.

It needs add judgement on startingView.

Based on https://android-review.googlesource.com/#/c/194370/

Change-Id: I6cfa1a3ebce93ce435cc2d9ada239b1e808988de
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
c46f41c5b5ea5b626ed729030de100223493948d 05-Jan-2016 Filip Gruszczynski <gruszczy@google.com> Fix flashing dialogs when IME enters/exits.

The flashing is caused by changing the shown frame of the window
prematurely, before the animation kicks in. After the animation kicks
in, the shown frame goes back to the original position and then animates
to the final position.

We need the shown calculation to happen during layout for resizing and
the layout might be triggered at any time before the animation is run.
In order to avoid flashing, we don't calculate shown frame for windows
that are animating during the layout and let the animation position the
shown frame correctly later.

Includes also logging for inset setting, which triggers layout run.

Bug: 26323134
Change-Id: Ibe1efae798415d3564c659aa94c2b94af92c743a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5098159ae31bc59aa3857fecb1847f8d7bb73e54 29-Dec-2015 Jorim Jaggi <jjaggi@google.com> Dim stack while dismissing

When dismissing the docked or fullscreen stack, a dim layer is
introduced for a nicer visual effect.

Change-Id: I9f12e331e978208aa9fd9e9883b3c8a36d4da3a0
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a6c934e2a3e6ddec6549cea55b7bece02348c6f8 21-Dec-2015 Jorim Jaggi <jjaggi@google.com> Use different asset when docked stack exists

- Add the ability to add a listener when the existence of the
docked stack changes.
- Register SystemUI as such a listener and switch the recents
button asset when docked stack exists.

Change-Id: I05350878c5adc7ad9f0399f0c42d8d1615d44d02
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
fe89d122e5b6b129b25d5d5316f690bd4ab93fbb 22-Dec-2015 Jorim Jaggi <jjaggi@google.com> Add infrastructure to track activitiy relaunches

As a preparation to start synchronizing task size
with activity relaunches, we need a infrastructure
so we know in AM/WM when an activity is relaunching
and when it's done relaunching.

Bug: 26311778
Bug: 25015474
Change-Id: Ied3795eddbcd112f6329494afbf13178ca49a799
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.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/WindowManagerService.java
7b739a802cb7d97460a0bf8a1e9774efe96fa552 21-Dec-2015 Yohei Yukawa <yukawa@google.com> Stop lying about hardware keyboard presence.

Here is a brief history of "Use Physical Keyboard", or "Show input
method", or SHOW_IME_WITH_HARD_KEYBOARD.

In Honeycomb, we introduced a mechanism which allows users to temporary
disconnect the physical keyboard connection from a UI [1]. That state
was temporary and non-persistent, but it was implemented to have
system-wide effect. Whenever the user turned on that temporarily
disconnected state, not only IMEs but also other processes would be
notified that Configuration#keyboard was changed to KEYBOARD_NOKEYS.
The UI to do that was available only in tablet UI at that point and
nothing changed in phones.

In JellyBean, we decided to port that UI to phone, and the "Use Physical
Keyboard" toggle switch found its new home on the IME switcher
dialog [2].

In Lollipop, we revised the wording for the toggle switch on the IME
switcher dialog. Now it's labeled as "Show input method" [3].

In Lollipop, we also decided to make the settings of "Show input method"
to be persistent as @hide entry in the secure settings [4].

[1] 2992ea782fa61780d8e0de7a36a2a84622f8694b
I136087ca4f726d0068d5983d7d3686787ba60c55
[2] cb598b11ea2c012bd15e7e7f44a3006f752c0b81
(Ica768083f95c33dc1e494a28ba7d8b6eb989b0ef)
[3] be11f3a5cea67c68a08c8da9ce85b3418501060a
(I9c8a7eb98b5277f1d09cc19fa7402e9b4cf51d92)
[4] b64e56aad3ffb267aec44308f57641a4c91caa83
(I2237ded850a0d4ab43ca441d0b7df13e0958e630)

Now, we have hard time making everyone happy. Having an easy way to
bring software keyboard back is probably still a valid use case, but
after several wording changes it is no longer obvious why
onConfigurationChanged() event is sent to all the processes as a
consequence of tapping that toggle.

In order to address above confusions, this CL removes the concept of
"temporarily disconnected physical keyboard" but tries to implement
"Show input method" functionality in InputMethodManagerService and
InputMethodService to keep the affordance that has been offered in the
IME switcher dialog. As long as the IME overrides
InputMethodService#onEvaluateInputViewShown() as follows, the behavior
of "Show input method" toggle remains the same except for processes
including IMEs no longer receive onConfigurationChanged() event with
faked Configuration#keyboard value.

@Override
public boolean onEvaluateInputViewShown() {
// If the default implementation returns true, recommend honoring
// it.
if (super.onEvaluateInputViewShown()) {
return true;
}

// Implement the logic that is specific to your IME here.
return myOnEvaluateInputViewShown();
}

Bug: 22517687
Change-Id: Id4d332e3909590c68345e10e1f2e18650efb2eb7
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
9149d2b117aef40f38a7d62c0f8c2bb76eb4e244 15-Dec-2015 Vladislav Kaznacheev <kaznacheev@google.com> Rename and simplify DropPermissionHolder

Rename DropPermissionHolder to DropPermissions and move
all server-side implementation details into a separate class.
Rename DragEvent.getDropPermissionHolder to
requestDropPermissions and make it take the permissions
implicitly.

Change-Id: Ia83f7cb8af07ce13ba9536d24b0f9d63331d8736
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
28ba3832142a963d800ba9fa56c1e06cc1dd97f7 15-Dec-2015 Rob Carr <racarr@google.com> Merge "Move window replacement tracking to window state."
5ad34c3e5b2328d1dbecfb83c69f3fe44b9ff832 14-Dec-2015 Wale Ogunwale <ogunwale@google.com> Merge "Fixed bug with task record not updating to fullscreen sometimes"
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/WindowManagerService.java
c18a05faf15111b6018e2599265853f0b21c66cb 14-Dec-2015 Yohei Yukawa <yukawa@google.com> Merge "Rotate IMEs (subtypes) by Meta+Space."
b4ec0a312de422440374638195d4709cc74227e9 14-Dec-2015 Wale Ogunwale <ogunwale@google.com> Fixed bug with task record not updating to fullscreen sometimes

null is normally passed in to AMS.resizeStack API if the caller wants
to change the stack size to fullscreen. However, it is possible for the
caller to also pass in a bounds that corresponds to the fullscreen bounds
of the display the stack is on. When this happens, the call to window
manager to resize the stack correctly detects that the bounds is equal
to the fullsceen bounds of the display and sets the stack to fullscreen,
but the task record state isn't updated to fullscreen since they were
previously calculated on the activity manager side.
We now check if the bounds corresponds to the fullscreen bounds on the
activity manager side and set it to null so that the task record state
is correctly updated.

Bug: 25683717
Change-Id: Ife753c6e6c034fd8df663ab897d245f1d354bda7
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ecf672288b7e2eac58e390e24c1454b56f9e2b8c 12-Dec-2015 Filip Gruszczynski <gruszczy@google.com> Exclude status and nav bar from focus monitor.

Bug: 26037712
Change-Id: Ie1cd442339f6d7e95ac949eb59b5da9a7a13559b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ae61f7118a92e097e854c840d5726c0920f5db0e 09-Dec-2015 Yohei Yukawa <yukawa@google.com> Rotate IMEs (subtypes) by Meta+Space.

With this CL, PhoneWindowManager starts monitoring Meta+Space to trigger
input method rotation.

Note that InputMethodManagerService currently supports only one way
rotation. Currently there is no difference in the behavior between
Meta+Space and Shift+Meta+Space. Reverse rotation will be supported in
a subsequent CL.

Bug: 25753404
Change-Id: I4005692215edfcf8bed3e86b1e07000148f986f5
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
0df9b0f4ec369b6fb373e0b7cbebed153af66ea7 09-Dec-2015 Robert Carr <racarr@google.com> Prevent crash when manipulating hidden SurfaceView.

repositionChild was attempting to perform placement
transactions on hidden views (which do not have a Surface)
leading to an exception being thrown. Furthermore lack
of a finally block prevented an open transaction from
being closed while unwinding and rendered the system unuable.
First we avoid performing transactions on windows without services.
Second we correct flow to ensure transactions are closed in case
an exception was thrown for other reasons.

Bug: 25780116
Change-Id: If103158506298c8f5ec1b01d7e1c73e55427804a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4407cbde63db301dc6383bc47b6dc95fa55fffaa 08-Dec-2015 Michael Wright <michaelwr@google.com> Merge "Add support for locking the screen when the lid is closed" am: 9dc3c36c9c am: 4d9e6190b1
am: 37c8bcbcc9

* commit '37c8bcbcc9f5098a2a7fde91a3b112abd35a85ad':
Add support for locking the screen when the lid is closed
37c8bcbcc9f5098a2a7fde91a3b112abd35a85ad 08-Dec-2015 Michael Wright <michaelwr@google.com> Merge "Add support for locking the screen when the lid is closed" am: 9dc3c36c9c
am: 4d9e6190b1

* commit '4d9e6190b186f1d2e1cd25defd0d6e12dd833b38':
Add support for locking the screen when the lid is closed
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/WindowManagerService.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/WindowManagerService.java
4d9e6190b186f1d2e1cd25defd0d6e12dd833b38 08-Dec-2015 Michael Wright <michaelwr@google.com> Merge "Add support for locking the screen when the lid is closed"
am: 9dc3c36c9c

* commit '9dc3c36c9cd796d90b65543567495d910d266e4c':
Add support for locking the screen when the lid is closed
7f864cc79d019bab27af991529512ac7b474069e 07-Dec-2015 Rob Carr <racarr@google.com> Merge "Move surface save state tracking to WindowState."
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/WindowManagerService.java
86fd6d156087d8abe0ac65451db2a6fa7f30722c 07-Dec-2015 Xiaohui Chen <xiaohuic@google.com> Do not force keyguard orientation to no sensor.

Fixing a bug that if the device is hold in landscape mode during
initial device setup, after the setup is done, the screen would rotate
to portrait mode and then back to landscape.

Bug: 25817950
Change-Id: Ibbcb7be01d8f14d7b6a98f069cb7eb3a94da12bb
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8294f82562afee6be176c986ff24156aacd32080 04-Dec-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Put PIP windows above transition animations."
114d5ca711775a632b1d2d4ec6c00eddff1bc776 04-Dec-2015 Filip Gruszczynski <gruszczy@google.com> Put PIP windows above transition animations.

PIP activities are already on top of everything else, but during
animation we increase the layer of the animated window for the duration
of the animation and it may cover the PIP. By forcing the same
adjustment on PIP windows we will keep them above animating windows.

Bug: 26015827
Change-Id: I8f7a87f41fed24b3e520fb599a94cf24cc2eeb50
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
7def60daa049271c0d595d2ff566965693ee88cd 13-Nov-2015 Edward Savage-Jones <edward.savage-jones@sonymobile.com> Add support for locking the screen when the lid is closed

This commit adds configurable support for lockscreen
behaviour when the user has a device cover/lid. This
is intended for lids with a viewing window so that the
user can see the time and interact with apps via the
window.

Change-Id: Id71883f66d1a180c4732912b3b59cabf9f4d7b6e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
85d5cc4959c5a5b6f9601b7df3e819cb2df09001 04-Dec-2015 Filip Gruszczynski <gruszczy@google.com> Force divider visibility reevaluation when system ui registers listener.

If system UI dies and then returns, we need to make sure it receives
information about visibility of the divider.

Bug: 26009659
Change-Id: I067d2023ce27b2d36723070127a18c71b694eb45
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e920098f31860824ca714f10b2e72dbff5442184 04-Dec-2015 Chong Zhang <chz@google.com> Merge "Fix window disappearing when docking a second app"
48a87a542684bcfd4d5356c7489f9f5f37510c71 04-Dec-2015 Chong Zhang <chz@google.com> Fix window disappearing when docking a second app

When moving app1 to docked stack, the app2 is resized while in background
(fullscreen stack). Because of the config change, mWillReplaceWindow is
marked true. But since the app2 is in GONE state, all updates of mFrame
are skipped. When it's made visible again, because mWillReplaceWindow is
set, update of mFrame in computeFrameLw() is still skipped, resulting in
wrong mFrame being used.

The fix here is to not set mWillReplaceWindow if the app is not visible,
as we don't need to preserve old window.

Also fix position change check.

bug: 25937471
Change-Id: Iea506296ebd5c2a108368fb2d1d77cdc31a36cdc
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
2998eef694f6e3bb348df98a6127890e71427381 03-Dec-2015 Wale Ogunwale <ogunwale@google.com> Set proper stack in WM when activity is moved to stack in AM

When an activity is moved to a stack using the
ActivityStack#moveActivityToStack API a new task is created to
hold the activity in the stack. However, when the new task is
created in the window manager side it uses the stack id of the
previous stack the activity was in. We now pass the stack to use
from activity manager to window manager.

Bug: 25987309
Bug: 25961636
Change-Id: Iecc71f6d9b3e70a8d88e134b42f7532ba5327bad
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8f7f3184d55850b1c4d2036319794151f564e9c0 18-Nov-2015 Jason Monk <jmonk@google.com> Allow QS tiles to open dialogs

Add a TYPE_QS_DIALOG window type, that is in the same layer as
apps and dialogs and such. It is guarded by having a token
that is granted by SysUI after a click has occured. If the
app shows a dialog before listening finishes (QS closes) then
the token will stay granted until the tile is removed by the
user, otherwise the token will be removed immediately to avoid
later dialogs.

Also fix a couple tiny TileService issues:
- Stop/Start listening reversed
- Fix javadoc referencing wrong action

Change-Id: Iedcdd5fd9a2af2b33eb7f6f17bb0e6c997879876
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b60206a5e799acd77999824856a641e57fe3e447 03-Dec-2015 Wale Ogunwale <ogunwale@google.com> Merge "Make sure tap detector is valid before trying to initialize."
abaa4ad84e6e09b16621c8d14630314cbcd1fdfa 03-Dec-2015 Wale Ogunwale <ogunwale@google.com> Make sure tap detector is valid before trying to initialize.

Bug: 25879224
Change-Id: Iefebeec9a0c75fe25d4e2476b797a003670b047a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a97268e2b8b4b765dea2e76d5603fe3d65d76d3a 02-Dec-2015 Rob Carr <racarr@google.com> Merge "Ensure we update window scale when repositioning child."
298a4dc8dd60700684f98dd6e959b854ea70faec 02-Dec-2015 Wale Ogunwale <ogunwale@google.com> Merge "Prevent windows in pinned stack from gaining window focus."
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/WindowManagerService.java
73d6dab44f57d789c5b680914308342f9ce652b8 01-Dec-2015 Chong Zhang <chz@google.com> Merge "Show toast for non-resizeble docked task under the task itself"
c806d90e656a24dc8f50ef0d3f8bc99b9ac65afe 30-Nov-2015 Chong Zhang <chz@google.com> Show toast for non-resizeble docked task under the task itself

Move the show toast code to WM, so that we can schedule to show the
toast when the app becomes visible. Otherwise the toast always shows
up a long time before the app itself.

bug: 25433902
bug: 25873338

Change-Id: I879f8e0570829934fac806c2861bda9f65e08969
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
353ad63fe13037f36253629655d89b4c7777fd1b 01-Dec-2015 Robert Carr <racarr@google.com> Ensure we update window scale when repositioning child.

In repositionChild we need to ensure we update the window scale
if the layout dimensions change without changing the surface size.
If we are doing such it seems to make more sense to update
the layout params than the window frame.

Bug: 25791641
Change-Id: I24ab0011936acb45e6cdf60af52edc8d9419d91e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.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/WindowManagerService.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/WindowManagerService.java
786e12d92f620ee55cac4ea624c989a4a877d865 25-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Destroy docked divider surface when it's hidden."
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/WindowManagerService.java
9ea2f7ba3155a455724f64e2d6a964ad4e99dfa5 24-Nov-2015 Jorim Jaggi <jjaggi@google.com> Add ability to supply initial bounds when docking task

Add an optional parameter in moveTaskToDockedStack to supply an
initial rect to be used when creating the dockeds tack. Pass in
the adjusted rect when dragging up from the navbar so it doesn't
flicker anymore.

Change-Id: Ieb3c8c73b9e2a769a2ec6270bd76a713201a2aed
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8b1871d74137d7e36ba0fed5608772f51f62015b 20-Nov-2015 Winson <winsonc@google.com> Adding tuner params for paging and full screen thumbnails.

- Adding “focused” stack state to support paging
- Changing the paging to match UX spec (only auto-page after the first
tap)
- Removing old header focus animation

Change-Id: Id72825b8a1b1c0a2238ee184a6695b13c1d8cb1c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.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/WindowManagerService.java
8b6f38c7c7dee7d0a543bfdb4cfd936b3fd42c07 20-Nov-2015 Vladislav Kaznacheev <kaznacheev@google.com> 'Drag and drop failed' animation

If the drop has not been consumed (DragState.mDragResult is false)
the drag shadow surface is not immediately destroyed, but animated
back into the position where the drag started.

The current animation is an OK placeholder, still waiting for the
final word from UX.

Bug: 24415573

Change-Id: Ia30135ce1e85655c8ba16e28dc69f0ebf9b36239
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
c954780a5a257fb00244f433c228eb55928f609a 20-Nov-2015 Rob Carr <racarr@google.com> Merge "Prevent SurfaceView flash while resizing."
84b0574cecf7eba313c78fa8d9176ac0d34ef103 18-Nov-2015 Robert Carr <racarr@google.com> Prevent SurfaceView flash while resizing.

We need to make sure we do not preserve
and destroy attached windows when entering
drag resize as we will not swap these windows
to the big surface. On a similar note,
we need to make sure we do not hide child windows
when destroying the parent window for preservation.

Change-Id: I98e02f08d0ea2d5f0032ec7691e865c536df19c6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
96daf32e4ed40619419ddef1cf96a870a3c0f193 19-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Fix crash when docking from recents.

The crash was happening because we were sending a future from sysui, but
that future would always return null animation specs when docking. This
makes it returns proper specs in that case. However, we need to still
protect ourselves from null specs when executing the future.

Bug: 25765339
Change-Id: I02d842ea31503169f6e053a1695d8896d2e4d97c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
be2ca45c62fce12e0c5190d829ca088b0142d3a8 18-Nov-2015 Chong Zhang <chz@google.com> Fix crash with animation specs

Change-Id: I72ed5b19aaede0c58ea0b8665409721824ec6480
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
1a4dfe593aafda057ac9cb3086b84588d88cd09f 15-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Synchronize recents to freeform transition.

Recents to freeform animation must hang on the first frame and inform
Recents to hide its views. This mirrors the transition from freeform
to Recents, where the animation needs to hang on the last frame.

We need a special window flag for recents to force a redraw after the
animation launches. At this point Recents will become not visible
from the perspective of the activity manager, which would prevent
further drawing. We make recents ignore that and instead depend on
window visibility which will change after recents exit animation
finishes.

Bug: 24913782
Change-Id: Ief743b7e6fcebb3d8789d4745fb122ac607c1cf0
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
214fb68767502f5fede643a062c1dc5975d75b27 17-Nov-2015 Alan Viverette <alanv@google.com> APIs for querying and controlling display magnification

Also separates magnification state and touch event handling. Moves
callbacks for window manager changes and display state changes into
the magnification controller.

Bug: 22718911
Change-Id: I3a8ba060a07d8f1f51856855a5f85601766fd45d
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
484d009cf6fda0ef34ab274e3dd556bb67d87d43 17-Nov-2015 Wale Ogunwale <ogunwale@google.com> Merge "Set-up dummy animation when setting a replacing window token"
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/WindowManagerService.java
608797e210dae48d4b9ece8aeaaa3293ecf066dd 13-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Remove unnecessary DisplayContent.mDisplaySizeLock synchronization.

All operations are performed with WindowManagerService.mWindowMap lock
held, therefore the second lock is not necessary.

Change-Id: I762fb322ddeb8b45191a3d297de0d33a10674f8a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5b2f199c85824af4659601f55a96340d77e7863c 14-Nov-2015 Chong Zhang <chz@google.com> Notify client of surface size change if it's changed from last relayout

Not just when it's changed during this relayout.

bug: 25596610

Also add the delayed surface to removal list regardless of the show
result, it won't be destroyed until window is ready to show but we
need to add it to the list first.

bug: 25666160

Change-Id: I6fceada1bdc1de0a5b5a4d6dc261957164817330
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
16b83907d133e7cf216dcf7f586584057969d410 13-Nov-2015 Wale Ogunwale <ogunwale@google.com> Merge "Fixed bug where stack crop wasn't applied when it should"
f4abc2b701c23978e8bd5e4fc3e183e519aede4a 13-Nov-2015 Chong Zhang <chz@google.com> Need to updateSurface if surface size was changed in relayoutWindow

On some chips, SurfaceControl.setSize will not take effect for several
frames. We have to also do a updateSurface/invalidate (which destroys
and creates the EGLSurface) to get the size right.

Keep track of SurfaceControl size changes in window manager, and pass
that to ViewRootImpl, so that a updateSurface is done either the surface
itself or its size is changed.

Note that we don't use frame size change to trigger updateSurface, because
frame size could be different from the surface size that window manager set.
For example during drag resizing, the surface size is fullscreen although
frame size changes constantly. Doing updateSurface upon frame size change
could cause us to do many unnecessary updateSurface.

bug: 25583942

Change-Id: I1989613a187bb6ef1c179bd2800c6a7b01fcdb3a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
69cf50f759e264aea0fc7d389ae85cd3121e4cb9 13-Nov-2015 Wale Ogunwale <ogunwale@google.com> Fixed bug where stack crop wasn't applied when it should

- Apply stack crop if window isn't animating when replacing window.
We were previously not applying the crop if replacing window regardless
of the animation state.
- Apply stack crop if the current docked window isn't animating.
We were previously not applying if any window in the system is animating.
- Also created setter/getter methods for WindowAnimator.mAnimating
to make debugging easier.

Bug: 25645069
Change-Id: I671549626e218358a7dea9e78bd0b2a1f1b3a51e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f9661eafa0de1e9fe0bdf12d8c23ad087ece8729 13-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Initialize DisplayContent base info when object is constructed" into cw-e-dev am: fe482e0bca
am: 0e6007d229

* commit '0e6007d22928da4c529a5fa773fbeeb441421804':
Initialize DisplayContent base info when object is constructed
4ff84631af5edc2a30be59c4a3d14afabbaec0cb 30-Sep-2015 Wale Ogunwale <ogunwale@google.com> Initialize DisplayContent base info when object is constructed

It is possible for an external process (e.g. sys-ui) to call into
WM to get the bounds of a stack in between the construction of the
DisplayContent object and SystemServer telling WM that the display
is ready. Incorrect bounds would be returned to the caller in this
case since the baseDisplayWidth/Height is only set when the displayReady
call is made.
We now initialize the base display information when the DisplayContent
object is created so any call to get the logical display rect of the
display will always return the right bounds. This should be okay as the
display manager is initialized way before window manager.

Bug: 22961090
Change-Id: Iebd688ad8f4c08556846fcebb543e58bd2c01414
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
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/WindowManagerService.java
14c040bdd9595871546af8a59f96c65445e438b2 11-Nov-2015 Chong Zhang <chz@google.com> Merge "Fixes for dim bounds and touch bounds"
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/WindowManagerService.java
7790fda948e0d878bfda72a18d132eabea0a49cf 11-Nov-2015 Wale Ogunwale <ogunwale@google.com> Merge "Set right bounds/configuration for task when positioned in stack."
40725b6f862deb76c687ca8de0a5da184d904bd3 10-Nov-2015 Rob Carr <racarr@google.com> Merge "Clarify geometry management for SurfaceView"
935e50292e1404dc5f1705b2a1719cdaee3072b0 10-Nov-2015 Wale Ogunwale <ogunwale@google.com> Set right bounds/configuration for task when positioned in stack.

When AMS.positionTaskInStack API is called we need to make sure
the task has the right bounds and configuration if it is moving
to a different stack.

Bug: 25501082
Change-Id: I2a80aa08a4ee52d860502ab16b6cdb432c954084
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
64aadd08491172e90f6d6512d8affc9a4cfa04cc 06-Nov-2015 Robert Carr <racarr@google.com> Clarify geometry management for SurfaceView

In the hardware accelerated case, RenderThread needs
to be the authority of information on the geometry of
the SurfaceView (this will occur via moving the
repositionWindow call to RenderThread). In order
to support this we have to enable calling relayoutWindow
without geometry (so that it will not fight with
repositionWindow). Add such a mode to relayoutWindow
and use it from SurfaceView. Add size to repositionChild
while we are here.

Bug: 22802885
Change-Id: Ie45132c22f34cc6ecfe2446912b30bd1df414406
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
291fdb0efc6eea850cda20c1a112249f3f36fcb2 10-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Don't treat dummy animation as exit animation.

This fixes a problem where recents would never be removed, because they
would run a dummy animation.

Bug: 25472312
Change-Id: I5767dc700966a49513e6338f4728c2ff275628ad
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
29ffd06d469ffb9931b8cfb29565f8ec82f18917 10-Nov-2015 Chong Zhang <chz@google.com> Merge "Don't hide wallpaper if surface is destroyed due to drag resizing"
6e21cf449af9858b69d7a6ae735d28dedbf2f4de 09-Nov-2015 Chong Zhang <chz@google.com> Don't hide wallpaper if surface is destroyed due to drag resizing

We change surface from small to fullscreen size upon resizing,
and keep the old surface around until first draw finishes on the
new surface. This shouln't affect wallpaper. Hiding the wallpaper
causes the background to black out on every surface mode toggle.

bug: 25439788
Change-Id: I28c957dfaf1cc7f28e28cc00d8e97b8efb905349
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
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/WindowManagerService.java
5e69fda6d9b1a08e2b0c1716ce65e03b2ea1c2d1 08-Nov-2015 Filip Gruszczynski <gruszczy@google.com> Ignore wallpaper when looking for a position for a free window.

Wallpaper wanders through the window list, for example to position
itself directly behind keyguard. Because of this it will break the
ordering based on WindowState.mBaseLayer. There might windows with
higher mBaseLayer behind it and we don't want the new window to
appear above them. An example of this is adding of the docked stack
divider. Consider a scenario with the following ordering (top to
bottom): keyguard, wallpaper, assist preview, apps. We want the dock
divider to land below the assist preview, so the dock divider must
ignore the wallpaper, with which it shares the base layer.

Bug: 25564817
Change-Id: I5bab792d972f845931b54db9f9ae5ff9a4a0e9b3
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
13d30660ef6da2d924e4fc943ccd187767ee0cd2 07-Nov-2015 Winson <winsonc@google.com> Fixing issue with canceling the thumbnail in addition to the app window.

Bug: 25392381
Change-Id: Ib507f53bcd2aad4771c2546f5e8bfe771769e9a2
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.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/WindowManagerService.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/WindowManagerService.java
2f7d292596bdba15e441046e3a2e047f37d6ea59 29-Oct-2015 Jorim Jaggi <jjaggi@google.com> Supply app transition specs with a future

Because we retain activity surfaces now, the app transition specs
which were calculated/generated after the onPause() call when going
from recents -> app were too slow. Instead, supply a cross-process
future, which gets fetched when the window manager is about to be
ready to execute the app transition. In practice, this still gets
executed immediately after the onPause call.

If we have a retained surface, this adds some latency, but since we
absolutely need the specs to execute the transition, we have that
latency no matter where exactly we generate the specs.

If we don't have a retained surface, the specs are not calculated on
the critical path, so it's faster.

Bug: 19940527
Change-Id: I80d2c6f6b3a6568a70339619ecefbc3bd8409bd8
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8382f98f6246c514106ca2bd88ab9f3c8d2ff5c8 06-Nov-2015 Bart Sears <bsears@google.com> Merge "Revert "Clarify geometry management for SurfaceView""
7d73643f7a3fbd635ba1818d6f819e551b7ffcf6 06-Nov-2015 Bart Sears <bsears@google.com> Revert "Clarify geometry management for SurfaceView"

This reverts commit 78a45f2bd8794d7a85e7443820862d466edf2324.

Change-Id: I782f688f52a85df84d9facef2fbf88c28f4a7082
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b9765b4c15924cc271d40fc4a1d63544f41e185d 06-Nov-2015 Rob Carr <racarr@google.com> Merge "Clarify geometry management for SurfaceView"
36ebe4c61821a471120b8f5ae7d85f51e8c64d9c 06-Nov-2015 Vladislav Kaznacheev <kaznacheev@google.com> Merge "Expose the desktop location of an unconsumed drag and drop"
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/WindowManagerService.java
78a45f2bd8794d7a85e7443820862d466edf2324 03-Nov-2015 Robert Carr <racarr@google.com> Clarify geometry management for SurfaceView

In the hardware accelerated case, RenderThread needs
to be the authority of information on the geometry of
the SurfaceView (this will occur via moving the
repositionWindow call to RenderThread). In order
to support this we have to enable calling relayoutWindow
without geometry (so that it will not fight with
repositionWindow). Add such a mode to relayoutWindow
and use it from SurfaceView. Add size to repositionChild
while we are here.

Change-Id: I12f85f586a38bf86367f3d964cb49f19003d441f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
c748241523e12121015e793f5f368638b98a11fe 05-Nov-2015 Vladislav Kaznacheev <kaznacheev@google.com> Expose the desktop location of an unconsumed drag and drop

When dispatching DragEvent for ACTION_DRAG_ENDED action
getX and getY will return the location of the drop if it was not
consumed by any app.

Consumed drops will return (0,0) location as before.

Bug: 25486808
Change-Id: Ic57d94b42de62d8327e9ce47d92ba335c21b8ae2
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.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/WindowManagerService.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/WindowManagerService.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/WindowManagerService.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/WindowManagerService.java
31b09bdcdd389e79c98f9623161ef43007ef6ae4 02-Nov-2015 Rob Carr <racarr@google.com> Merge "Sync SurfaceView position changes to parent render."
02a5a6bb9ba05bdf7517de90ede49fb535ea06ca 02-Nov-2015 Wale Ogunwale <ogunwale@google.com> Merge "Added StackId object for checking what features a stack supports"
3797c22ea16e932329ebffdc7e7ce09f9ecd9545 27-Oct-2015 Wale Ogunwale <ogunwale@google.com> Added StackId object for checking what features a stack supports

Helps make the code easier to follow since we are no longer checking
multiple stack ids at various decision points.

Bug: 25282299
Change-Id: Ifa6864a1ef56ce2eca4c94f87a4e0b993de987cd
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
c28098f69b8ba5d3039ecd0fa154e880f4613843 30-Oct-2015 Winson <winsonc@google.com> Add ability to cancel task window transitions.

Bug: 25392381

Change-Id: I45f48edc21c058df0e4c22ceaf7e9aef5899a29c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
1a5203dfd5264104db018b8a09d50075b1af9b2d 30-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Hide recents during freeform to recents animation.

Bug: 24913782
Change-Id: I6a5d3a638640571a902e095c4c0650b88eea0fb6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
64e516f5fa56d71bf6b5076e5620c30dc5810ba1 29-Oct-2015 Rob Carr <racarr@google.com> Sync SurfaceView position changes to parent render.

In order to provide pixel perfect movement of SurfaceViews
'within' other views (e.g. scrolling) we need to be able to
synchronize the attached (parent window) painting with the
movement of the SurfaceView (recall, SurfaceViews are positioned
behind their attached windows and the parent must render a
transparent region for the SurfaceView to appear). Provide
a new WindowManager method to reposition an attaching window
(that is to say, a window which has an attached window like
SurfaceView) and defer the transaction until the parent frame.
SurfaceView is hooked up to use this for movement. This is still
'racy' in the hardware accelerated case as the render thread
could be on either side of dequeing the frame we are working on.

Bug: 22802885
Change-Id: I025d2bdcbe15c1c11047cc0dbca2cf2b7d67c632
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a445a68fa4c89ad6645566d9bc0544f21617abc7 29-Oct-2015 Wale Ogunwale <ogunwale@google.com> Merge "Support for pinned stack to always be on-top of visible stacks"
1e60e0c61a3ec4b53aeae7fbe9c6da4d047a5d02 28-Oct-2015 Wale Ogunwale <ogunwale@google.com> Support for pinned stack to always be on-top of visible stacks

Bug: 25006507
Change-Id: I577e11224eead72dbb50def6be30b640707d2187
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
e29953c17550a1071426e32cd37bf030bbd76e73 28-Oct-2015 Ching Tzung Lin <ctlin@google.com> Merge "Consolidates config_windowOutsetBottom and circular_display_mask_offset" into cw-e-dev am: 36da2a208e am: c45009906a
am: a05beb29da

* commit 'a05beb29dac5c05a610783469566cf865d92a140':
Consolidates config_windowOutsetBottom and circular_display_mask_offset
a05beb29dac5c05a610783469566cf865d92a140 28-Oct-2015 Ching Tzung Lin <ctlin@google.com> Merge "Consolidates config_windowOutsetBottom and circular_display_mask_offset" into cw-e-dev am: 36da2a208e
am: c45009906a

* commit 'c45009906ade7b25b6c01c02113c044bd9290ffb':
Consolidates config_windowOutsetBottom and circular_display_mask_offset
c402520fe0fe8e85e2f905343ce2a2a740c48d9a 22-Oct-2015 Jorim Jaggi <jjaggi@google.com> Coalesce layout traversal when resizing stacks

When resizing the docked stack, the other stacks are also resized,
leading to multiple layout traversals. Coalesce these by
introducing the concept of layout traversal coalscing.

In addition, don't cause layout refreshs for the stacks that are
currently not visible.

Bug: 25015474
Change-Id: I5692d00c044572a1bbb3ea218b0c31572585f5bd
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
541f92cb19438678abfa888f1821ec2df334844b 26-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Clean up and document app transition animation loading.

We had three different sources of information about where the
animated window will start/end: appFrame, containingFrame,
containingWidth/Height. We can merge these into one, because
containingWidth/Height can be calculated from containingFrame and
appFrame is actually used only once and the containingFrame is not
used in the same scenario.

Also, documentation about the frames and insets. The rest is fairly
simple, but frames and insets need explanation of how they are used.

Finally, simplify naming.

Bug: 25246833

Change-Id: I0accc2f23792bca4e1b9941007c6249745e023ce
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
20070371f37db12d6f3e22763a0fbde4abdb2841 26-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Align the freeform to docking animation."
2dfcf840aa5d99aceab969e99a76625a12aa9b56 25-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Align the freeform to docking animation.

It was not aligned, because we didn't take into account that the
docked window will be cropped by the status bar and navigation
bar. We need to account for that when creating the animation.

Bug: 24913915
Change-Id: Idb82eefa14d65fe3bf6b25a9bd94c12dc8cbe648
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
077794468a1bfee705366e02ff226fda2366d456 26-Oct-2015 Vladislav Kaznacheev <kaznacheev@google.com> Merge "Fix drag and drop URI permission grants"
e71a321305381d039e3fe637f22e1f82b3dc9e91 24-Oct-2015 Vladislav Kaznacheev <kaznacheev@google.com> Fix drag and drop URI permission grants

Currently cross app drag and drop with content URIs
only works for Owner. This is because the source Uid
is initialized after a Binder.clearCallingIdentity call.
The real source app identity is lost and things work
by accident for Owner only.

Bug: 25232077
Change-Id: Iaaaa735a04909a3b05fae7a7a421dbf02206cd68
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f6e4c9da5f70604452a28cd308c3b0e4e47f7075 23-Oct-2015 Ching Tzung Lin <ctlin@google.com> Consolidates config_windowOutsetBottom and circular_display_mask_offset

Three phases involved:
phase 1: change all code references to circurlar_display_mask_offset to
config_windowOutsetBottom, and mark circular_display_mask_offset
deprecated.

phase 2: remove circular_display_mask_offset from device overlays

phase 3: remove circular_display_mask_offset symbol and default setting.

Bug:25220421
Change-Id: Ia3f77610dbbb964eb58c6b28f6206799d56c44c2
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
828613605cff46930ba6e634a1547442f3908e6d 16-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Improve docked & freeform task to front app transition.

Current transition animation assumes that it will go into fullscreen
mode. This makes it aware of the docked stack and makes it translate
from the click position to the final position. It also is aware of the
freeform bounds, so it can translate from the click position to the
freeform position.

Bug: 24913915
Change-Id: Idd42369e3ea86f85de851e2797ca9cef4b3842c2
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
cbc4e08fb53aacbe028228086d7344780fe81129 16-Oct-2015 Rob Carr <racarr@google.com> Merge "Revert "Sync SurfaceView position changes to parent render.""
7e1d861a9a3f76e1f79eb6806d4aa8bbeb560773 16-Oct-2015 Rob Carr <racarr@google.com> Revert "Sync SurfaceView position changes to parent render."

This reverts commit 6104dc95606b3399356dd011ca6d71fcd954154c.

Change-Id: If9d709bc65e7a817bd2c1b5768c7c33a9317638f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
70b7073fea4f1a342aeb19ea9ebe2d472ada2b99 16-Oct-2015 Rob Carr <racarr@google.com> Merge "Sync SurfaceView position changes to parent render."
6104dc95606b3399356dd011ca6d71fcd954154c 28-Sep-2015 Robert Carr <racarr@google.com> Sync SurfaceView position changes to parent render.

In order to provide pixel perfect movement of SurfaceViews
'within' other views (e.g. scrolling) we need to be able to
synchronize the attached (parent window) painting with the
movement of the SurfaceView (recall, SurfaceViews are positioned
behind their attached windows and the parent must render a
transparent region for the SurfaceView to appear). Provide
a new WindowManager method to reposition an attaching window
(that is to say, a window which has an attached window like
SurfaceView) and defer the transaction until the parent frame.
SurfaceView is hooked up to use this for movement. This is still
'racy' in the hardware accelerated case as the render thread
could be on either side of dequeing the frame we are working on.

Change-Id: Ic33915043380ab8cd9eb4920e224b35234ed867d
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5247523c90f452689f2b0fea3e91da54b117c8b4 13-Oct-2015 Wale Ogunwale <ogunwale@google.com> Merge "Don't set incorrect stack bounds when rotating screen in docked mode"
ffc11bb712343b634901fe2d0e0022e7e578dd5c 10-Oct-2015 Wale Ogunwale <ogunwale@google.com> Don't set incorrect stack bounds when rotating screen in docked mode

Both window manager and activity manager could decide what the bounds
of other stacks should be when the docked stack exist which can get
out of sync. Now window manager does the bounds calculation and
activity manager asks window manager what the bounds should be when
it needs to resize the stack.

Bug: 24738105
Change-Id: I97356f008b676d2f58a8b54fdb08735ab51394af
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
fe98b064bcf15f702027ece574787b0b8eb4ca20 12-Oct-2015 Chong Zhang <chz@google.com> Fix bogus warning in startResizingTask

win will be null if no window is found for resizing which is normal.

bug: 24814867
Change-Id: I16fc55af62b8f90643a3e85ca6d741db92fae958
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
0416695348eae12cae0baa5adee65004d0caabe5 12-Oct-2015 Vinu Deokaran <vinud@codeaurora.org> am 6be61a98: wm: call displayReady for all built in displays when system is ready.

* commit '6be61a98fccbadfdcfcefe9aa51d90bfb6c13901':
wm: call displayReady for all built in displays when system is ready.
6be61a98fccbadfdcfcefe9aa51d90bfb6c13901 16-Dec-2014 Vinu Deokaran <vinud@codeaurora.org> wm: call displayReady for all built in displays when system is ready.

When system has more than one built in display, displayReady needs
to be called for all built in displays when window manager is ready.
Otherwise, some system services, such as presentation, mediarouter,
etc, won't work on these displays.

Bug: 24103683
Change-Id: Ibf08074eff555c14a318236bd06e7b4855503140
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
838ba119761fb28ee72fb348f532906455214685 09-Oct-2015 Wale Ogunwale <ogunwale@google.com> Only request traversals if status bar visibility changed on reevaluation

Reduces the amount of churn in the system.

Change-Id: Ic1e93f1ed511fe95c551c08a06e239f0e5de93a0
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
665e9878f329db89f2f20f52a54e445ceb1ad798 09-Oct-2015 Wale Ogunwale <ogunwale@google.com> Merge "Schedule traversal instead performing it directly."
83009f2f3c4ce1256f4b2137b5857e69c562f9a8 09-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Schedule traversal instead performing it directly.

Performing layout traversal directly while evaluating status bar
visibility causes a recursive entry into layout traversal. We should
instead schedule another pass.

Change-Id: Ieb19a53f409863a45032a876d0b2bd2dfe8c30c6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d45f6fa725947dd90eb00ea76d3771800fc7e4e8 09-Oct-2015 Filip Gruszczynski <gruszczy@google.com> am e76aa227: am 0b45c2f8: am 21b37a5f: Merge "Make accessing mInputMethodTarget thread-safe"

* commit 'e76aa2275b63ec6502beedcf70e318563a126136':
Make accessing mInputMethodTarget thread-safe
0b45c2f87c0285b42eef96bbb8950d225334c60e 09-Oct-2015 Filip Gruszczynski <gruszczy@google.com> am 21b37a5f: Merge "Make accessing mInputMethodTarget thread-safe"

* commit '21b37a5fb46f3dcd20bba0c621d8859e1c8dc32e':
Make accessing mInputMethodTarget thread-safe
21b37a5fb46f3dcd20bba0c621d8859e1c8dc32e 09-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Make accessing mInputMethodTarget thread-safe"
6efc4619667a0b1bc4b558f290f9758369bbd191 09-Oct-2015 Wale Ogunwale <ogunwale@google.com> Merge "Added rules for status/nav bar customization when in multi-window mode"
6e94a9eb8709ddd3127e3c0103cd6a0f550f6e74 08-Oct-2015 Wale Ogunwale <ogunwale@google.com> Added rules for status/nav bar customization when in multi-window mode

Status & nav bars are always visible and opaque when freeform or docked
stack is visible

We still need to refactor the code to allow force opaque to be updated
independently for the status bar and nav. bar. Once that is done, the
status bar should be transcluent if freeform stack is visible and
docked stack isn't and the status bar should be opaque if freeform
& docked stack are both visible.

Bug: 24365214
Change-Id: I48ecc6067c9b0f7239c12c98eb46f3fcefacd4f9
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
97782b4042f3189c4e06463f8ab8122b26e77a29 08-Oct-2015 Chong Zhang <chz@google.com> Fix flash due to not freezing screen when start/end resizing

Instead of freezing the entire screen, preserve the window's old
surface and put it on a layer that's above other windows (while
still below the screen rotation freeze layer). Only remove the
surface when animation starts after the new drawing is received.

bug: 24715185

Change-Id: I1d2b873d339d672cea0f18679b5622cea69bd449
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
88470545fd747f9a1525d27b265f219d780858a2 08-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Fix build.

Change-Id: I69daaf2de679cb97609430051f18f7badc4d1e8a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f6818b873c983155ea4829c8baf0db001cae1000 07-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Make IME window draw above the dock divider window.

We achieve this by making the dock divider be a IME target. This
ensures the relationship between these two without adding a custom
rule inside layer assignment algorithm.

Bug: 24738244
Change-Id: Ieb32809d2bfa198c3f554a76cc40a9c40a1bf858
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
81cdf2b216196027fd45f4f5227057174b7f1c9d 07-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Dismissing of docked stack by dragging to the side."
57b6ccecc07274884b425839691fa04274b832bc 06-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Dismissing of docked stack by dragging to the side.

Bug: 24623909
Change-Id: Ic93b169442de1eb4dca9f65a87ae2b813bcef043
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d6bf7ac5ecacfb4a9a8e8c984df536c650587fa5 07-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Don't freeze the screen when resizing task or stack."
da74da78a1319bb6270aadbc23cd9f43990839b1 07-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Don't freeze the screen when resizing task or stack.

The freeze stops both the input to come and the drawing, which makes
the resize look like it's lagging. We use the display freezing to
prevent artifacts when using big surface for resizing. However,
freezing the whole display is too aggressive. We need subtler
approach.

Bug: 24575766
Change-Id: I8799e7989e937101129572142dfe6b28a7ed7692
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
080417fc278736c7f98842416ab20bc29b2003cf 06-Oct-2015 Wale Ogunwale <ogunwale@google.com> Prevent apps from affecting device orientation in freeform or docked mode

Bug: 24685213
Change-Id: I656670dab52196ba736ddffae658685413d70739
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
374abe11a07fe6c742a370da8445c250d908ef6f 05-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Fix dock divider going under application windows."
55a2a40abd53e9fb32399fe6b681d789032fd6dd 05-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Refactoring of WMS.addAppWindowToListLocked.

1) getTokenWindowsOnDisplay can be private;
2) in addAppWindowToListLocked the first operation should be checking
display content;
3) adding window to exiting window token extracted to a separate
method;
4) fetching window list directly from the display content, instead of
going through the window.
Change-Id: Ibe196fb6eea15b7800938bdaefcbe8cd1a76ca14
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e9512dfc03097170e0b1b7128935c6228b7d6464 05-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Fix dock divider going under application windows.

When windows are added they might be added on the top of the list of
windows that share the same base layer. Dock divider does share the
base layer with application windows, but should be always above them.

Bug: 24635258
Change-Id: I3b5b7e64b625b225100058b73a671a92b908173d
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
cd9c97db8de38fdfadab6411733f4680deebca07 04-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Adjust docked stack divider for orientation.

Bug: 24575031
Change-Id: Iabebaab386a5e4df3e9af36be329bc0384fd6c87
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
82c700f53b6afdc14e6ffdd7f7bf201fb1af8f46 01-Oct-2015 tiger_huang <tiger_huang@htc.com> Make accessing mInputMethodTarget thread-safe

Use the lock to prevent other threads clearing mInputMethodTarget
while we are accessing members of mInputMethodTarget, or it will
cause system server crash due to unexpected NullPointerException.

Change-Id: Iec3bed916a019827364ddaf63a89270a4c407a47
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
12a2ab4cc83df0df5450033e85d24fdc90cc63f3 01-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Revert "Refactoring: two more calls for WindowState.setDisplayLayoutNeeded.""
921171afcc7b3afb587573ba2614ca4e8c394667 01-Oct-2015 Filip Gruszczynski <gruszczy@google.com> Revert "Refactoring: two more calls for WindowState.setDisplayLayoutNeeded."

This reverts commit b3acc92bff3594b73eb80fad2a5fe79541e4a095.

Change-Id: Ief0f3ca1d45be5838a826494f64c65776868d188
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
30bc0ec2469d87a3c982beb24e12ab8d7a6e18b4 30-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Refactoring: two more calls for WindowState.setDisplayLayoutNeeded."
e95b0aef6d259ff9322bd9a34e36e61737844eee 30-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Improve visibility and layering of dock divider.

We adjust the visiblity of the divider now after every layout.

The divider was far too high in the priority list, based on the wrong
assumption that as a part of the system UI it needs to be constantly
visible. It should stay at the same level as applications, because it's
almost as a part of application.

Layering gets improved by having the relaunch animation receive zorder
top, just as if it was entering. The window that is being replaced fakes
this too, since it's not being animated, but should share the behavior.

Bug: 24500829

Change-Id: Iad3369a5ab6721b1bf7a94e8979dcf33e0805c7f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b3acc92bff3594b73eb80fad2a5fe79541e4a095 30-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Refactoring: two more calls for WindowState.setDisplayLayoutNeeded.

Change-Id: I2037bda03644f16ab03145eea257714b974a3059
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
fd04d8c8840c2a762e4f19c31310561263898621 30-Sep-2015 Wale Ogunwale <ogunwale@google.com> Initialize DisplayContent base info when object is constructed

It is possible for an external process (e.g. sys-ui) to call into
WM to get the bounds of a stack in between the construction of the
DisplayContent object and SystemServer telling WM that the display
is ready. Incorrect bounds would be returned to the caller in this
case since the baseDisplayWidth/Height is only set when the displayReady
call is made.
We now initialize the base display information when the DisplayContent
object is created so any call to get the logical display rect of the
display will always return the right bounds. This should be okay as the
display manager is initialized way before window manager.

Bug: 24505761
Change-Id: Iebd688ad8f4c08556846fcebb543e58bd2c01414
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b186388b673035f3a19bcc5d6f9dd8545549a224 30-Sep-2015 Wale Ogunwale <ogunwale@google.com> Merge "Report re-sized stacks/task as fullscreen when docked stack isn't visible"
e5ec210bb14619ff59b9adae31e3278f815a0ba6 29-Sep-2015 Wale Ogunwale <ogunwale@google.com> Merge "Inform activity manager of stack/task rotation bounds changes in WM"
f175e8a6d0d3f3ce6be94bde451e6e03f67d0705 29-Sep-2015 Wale Ogunwale <ogunwale@google.com> Report re-sized stacks/task as fullscreen when docked stack isn't visible

When a docked stack exist we resize all other stacks and crop their
window content to the stack size. This was also been done when the
docked stack exist, but not visible. E.g the primary user has a docked
stack, but the secondary user doesn't, so the windows of the secondary
user get cropped.
We now report stacks/task sizes as fullscreen whenever the docked stack
isn't visible.

Bug: 24366804
Change-Id: Ia3f24e6f7d33fc175348e27db24a15ce3027e6f7
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
1ed0d89e7e9a28a5dd52fdc40425466efd8d08ef 28-Sep-2015 Wale Ogunwale <ogunwale@google.com> Inform activity manager of stack/task rotation bounds changes in WM

Change-Id: I342093d8af1d397ab4894146f9b288bdfdc464f0
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
f77a6dbac6d8da23dea08449e930b29b62311ddb 27-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Refactoring: Delete AppWindowToken.willBeHidden field."
8aafd3a81ba4ffe04bc36990d18df9f2b8623743 27-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Refactoring: Delete AppWindowToken.willBeHidden field.

The only time AppWindowToken.willBeHidden is used is for determining
if the app should contribute to calculating orientation. In the same
check AppWindowToken.hiddenRequested will be or-ed with willBeHiden,
so it's enough that hiddenRequested to be set.

The only place where willBeHidden is set, is right before
WMS.setAppVisibility is called, which will set hiddenRequested.
Because of this willBeHidden is unnecessary.

Change-Id: Iea35f39f72e7f0dcd76205ef580f3a74cac72d08
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
49b80afaf9e71d6b5d4cab26f1459d84d1070f19 24-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Entry animation for docking windows.

We achieve the animation in the same way we would do that for maximizing
windows. We preserve the exiting window of relaunched activity until the
activity adds a new one. Then we animation the new window from the
bounds of the old window to the dock bounds.

This mostly reuses existing infrastructure for maximize animations, but
unfortunately needs scaling. The before window might be have one
dimension larger than after window and using cropping is not sufficient.

Change-Id: I9538ba983a0af1e64ea48aad6836173d6fd25f3b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.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/WindowManagerService.java
a6e902ec61ab1cd8f7d5df84deab6f26471c22fd 22-Sep-2015 Wale Ogunwale <ogunwale@google.com> Properly size tasks based on stack size.

There were a few places we weren’t doing this correctly

* When a new task is created the bounds should be the stack bounds
if the task is resizeable and not in freeform mode.
* When resizing a stack each task in the stack should be resized
base on if it is resizable vs. using the top running activity in
the stack to determine if all the tasks should be resized.

Change-Id: If3448c5629313e7e7fb91ffe8506014f16ad72db
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
87b21722c2336490ecf8b66f6acfc46ce8cc6f46 22-Sep-2015 Chong Zhang <chz@google.com> Change resizeTask's parameter resizedByUser to constants

to indicate who initiated the resize, or if the resize should be forced.

Change-Id: Ic7021f76bec677027cbf27deeb63f92ea911a75c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
83db929f0898dd8d44aed0eb02286da040c1531f 21-Sep-2015 Gus Prevas <kprevas@google.com> Resolved conflicts for 31bd01a1 to master.

Change-Id: I469d2e884831c38731b1de2604179fcdcea67ddb
31bd01a19f7ab409675b506c6f21b481d6a65c8c 21-Sep-2015 Gus Prevas <kprevas@google.com> am 448ada62: am 1f66ec8b: Merge "Allows starting window to be shown for swipe-dismiss windows." into cw-e-dev

* commit '448ada6286b5c3d172431ecf51ff3cd071c98c41':
Allows starting window to be shown for swipe-dismiss windows.
1f66ec8b908bb37c342c8bf97f74ecce913bfcc3 21-Sep-2015 Gus Prevas <kprevas@google.com> Merge "Allows starting window to be shown for swipe-dismiss windows." into cw-e-dev
e82f3c977cc52c27178486cd45c43861e86ad050 18-Sep-2015 Gus Prevas <kprevas@google.com> Allows starting window to be shown for swipe-dismiss windows.

This change removes the hack in WindowManagerService which
prevented a starting window from being created for a window with
the swipe-to-dismiss flag set. Per the comment in the file, a
starting window is not created for translucent windows (which a
swipe-to-dismiss window implicitly is) because the translucency
of the window interacts poorly with the default entry transition;
this does not apply to swipe-to-dismiss windows as they use a
different entry transition.

Removing this allows us to start the transition before the app
has finished drawing its UI (showing the app's theme's
default background drawable as suggested in
https://spec.googleplex.com/quantum/patterns/launch-screens.html)
which makes app launching on Wear much more responsive.

Bug: 23066614
Change-Id: I99b85aeb9a9fcce277239b6f430691c3abf86177
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
87975b77bcebc786706117c7e8de9c29bd89631c 17-Sep-2015 Chong Zhang <chz@google.com> Merge "Place surface at screen't top-left when doing drag resizing"
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/WindowManagerService.java
03b56c228a0492ad711acd6904c96493c13e44e9 17-Sep-2015 Vladislav Kaznacheev <kaznacheev@google.com> Merge "Handle content URI permissions on drop"
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/WindowManagerService.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/WindowManagerService.java
ede5f5480e58dac9f6ddbd36a3085592d79c98ef 16-Jul-2015 Vladislav Kaznacheev <kaznacheev@google.com> Handle content URI permissions on drop

Change-Id: I846071f01ecd1eff8e3a54a1806e68e1a4b335d2
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
b96e4b1ad1626cc1d115ffbedf10a5897689c8d7 16-Sep-2015 Filip Gruszczynski <gruszczy@google.com> am 8a416027: am 8d5f358d: am 41e13b0a: Update circular mask after display is ready.

* commit '8a4160275d5b90fd1576f85184e0e4da9a98b45c':
Update circular mask after display is ready.
8a4160275d5b90fd1576f85184e0e4da9a98b45c 15-Sep-2015 Filip Gruszczynski <gruszczy@google.com> am 8d5f358d: am 41e13b0a: Update circular mask after display is ready.

* commit '8d5f358dce44f64fcdde1b69261bbf18784a0d4a':
Update circular mask after display is ready.
41e13b0a68e49648d2f58738880bc3d6f93201cf 15-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Update circular mask after display is ready.

This fixes the situation where the circular mask is not applied because
the configuration is not reporting round screen. Configuration is
computed based on the display, so we can only depend on it having the
correct information after the display became ready.

Bug: 23689649
Bug: 23325855
Change-Id: I1e1fa307836f4053cfc4978da0239cb42c5af2c3
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
59a73ca331a786f95e08a99bbd16fbdf59280ae0 14-Sep-2015 Wale Ogunwale <ogunwale@google.com> Support creating docked stack at top/left/bottom/right half of screen

Change-Id: Id8d6f639ed67baadb856ce84a20af8929e04cb2e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b8d7948102e962741012103a8bb5c72a1ea1c4e2 12-Sep-2015 Wale Ogunwale <ogunwale@google.com> Merge "Don't relayout app contents when just changing app position"
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/WindowManagerService.java
2cc92f55c0257cdc837585b36987c610fb0a8251 09-Sep-2015 Wale Ogunwale <ogunwale@google.com> Don't relayout app contents when just changing app position

In WMS.resizeTasks we call task.resizeWindows() whenever the
task bounds changes which causes the app to do layout passes.
This isn't needed if we are just changing the position of the
task and not the size. This is currently causing unneeded churn
in the system and which leads to lag with the dragging operation.

Bug: 23901900
Change-Id: I339e31af3b657db6146dc1220bf5eb13e18b7876
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
05cc71dca19746aa86bc50d0bb1eff13990648c2 09-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Refactorings for Window Manager module."
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/WindowManagerService.java
bfac00a2160b2287b285aff253d12f03bfb015fe 09-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Better logging when starting window request is rejected.

Change-Id: Iba0469c7f00ab0cfe1901ef7e16a6e81cd045392
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d6a1692ef340608101c376fa2fd87d7c189bb906 08-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Refactoring of setting app starting window code.

This improves the code in following ways:
* move transferring of starting window into a separate method, so it can
be easier to understand;
* move checking of whether to display starting window from phone window
manager to window manager service; this has three benefits:
1) whole logic is in one place;
2) we don't need to schedule addition of a starting window, if we
would stop it later anyway;
3) we don't need to wait for creation of window style to decide, if a
window is floating.

Change-Id: Ibfbd87b84a7080e372211f162fa1865f8c5ab973
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
bba5a1514e83e2a075bd47b22a8d50a9d730653d 04-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Defer removal of relaunching activity window due to config change."
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/WindowManagerService.java
18eb3c9ccc171bb1beb97220f15c692ce7ba7d0d 04-Sep-2015 Filip Gruszczynski <gruszczy@google.com> Remove unused WMS.mBatteryStats.

Change-Id: I0ff684287ac27d77c6ca778b7b30666969c739aa
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
8dd46f7d81d50b7b24c26a46112369693bb143db 03-Sep-2015 Filip Gruszczynski <gruszczy@google.com> resolved conflicts for merge of 1ae66595 to master

Change-Id: I3ea98f0c6eaf3c9339ef00b6e5a8ae97c7b88655
1ae66595c046e9dc685fef5aa7e7c449dceba92f 03-Sep-2015 Filip Gruszczynski <gruszczy@google.com> am 521ded6e: am dbf8c0d9: am 991e4936: am cbacd4f0: Merge "Don\'t perform layout while adjusting displays/stacks state." into mnc-dev

* commit '521ded6e9dcb9e97843c89f6d7c87264107d4ef7':
Don't perform layout while adjusting displays/stacks state.
dbf8c0d9260f83b0d4d60c1dea1fbcd023ee5d29 02-Sep-2015 Filip Gruszczynski <gruszczy@google.com> am 991e4936: am cbacd4f0: Merge "Don\'t perform layout while adjusting displays/stacks state." into mnc-dev

* commit '991e493616a644b6bb7fdea9a99990520d77348a':
Don't perform layout while adjusting displays/stacks state.
991e493616a644b6bb7fdea9a99990520d77348a 02-Sep-2015 Filip Gruszczynski <gruszczy@google.com> am cbacd4f0: Merge "Don\'t perform layout while adjusting displays/stacks state." into mnc-dev

* commit 'cbacd4f0cee10b63adf6e2d482e7b4f62c0104a0':
Don't perform layout while adjusting displays/stacks state.
ebcc875f10f05db7365cd8afbf4e9425221ab14d 26-Aug-2015 Filip Gruszczynski <gruszczy@google.com> Move Configuration creation from Window Manager to Activity Manager.

Currently the construction of configuration is split between thease
two entities. This poses two problems: it's harder to follow the
construction logic and more importantly we can't determine if
configuration changes significantly before delegating work to the
Window Manager. This CL moves the configuration override logic to
the Activity Manager, since it both detects configuration changes and
informs clients about them. Window Manager becomes purely a recipient
of the information.

Change-Id: I075570ee055cce9c5665772fa8d4fe8ccb5c6313
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d66af6a65533e86468db402907b35ed3e96e6bec 31-Aug-2015 Filip Gruszczynski <gruszczy@google.com> Don't perform layout while adjusting displays/stacks state.

When we detach the stack from the display we are in an inconsistent
state. We need to finish that operation, before we start laying out
things again. Otherwise we will encounter subtle bugs, where stack is
partially closed, but still used during the layout.

Display detachment was already doing the right thing and scheduling a
layout after it finishes the display detach. However, removing the
stack's windows was triggering immediate relayout and causing a crash.

This CL also adds some missing synchronization around
WindowManagerService.mStackIdToStack, which is in most cases protected by
mWindowMap.

Bug: 22191609
Bug: 23615329
Change-Id: I1e2fc42e1a5b673be808acdec473f85f138d7062
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
7309b123c423504bb18e3d78dd22a36f7271676a 18-Aug-2015 Seigo Nonaka <nona@google.com> Leverage WindowManagerInternal for private communication.

This CL changes following four methods from direct calling of
WindowManagerService to calling via WindowManagerInternal.
- getInputMethodWindowVisibleHeight
(introduced by I0e920ee79c526c3aea6872b063cf294e2ab081c8)
- saveLastInputMethodWindowForTransition
(introduced by Idf7700271cf882dfbf35c9d16f0f173a791221bc)
- isHardKeyboardAvailable
(introduced by I8a6a4a7efce50bfaec114117e33f97f27b1ef950)
- setOnHardKeyboardStatusChangeListener
(introduced by Ica768083f95c33dc1e494a28ba7d8b6eb989b0ef)

This CL does mechanical code moving and does not change any behaviors.

Bug: 22285167
Change-Id: I08e506050a0e495d62236b46e487848c967d185d
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
1169f7da63aae6108f859a8589614000ea373113 25-Aug-2015 Jorim Jaggi <jjaggi@google.com> am 86c0ac7e: am 8373cf7d: am 5d552f2c: am 414985c4: Remove window from mWaitingForDrawn when policy hidden

* commit '86c0ac7ebd5a4f0a4b2c758fec734c0fbf93326a':
Remove window from mWaitingForDrawn when policy hidden
86c0ac7ebd5a4f0a4b2c758fec734c0fbf93326a 24-Aug-2015 Jorim Jaggi <jjaggi@google.com> am 8373cf7d: am 5d552f2c: am 414985c4: Remove window from mWaitingForDrawn when policy hidden

* commit '8373cf7d7583098c9fd47c23e4e411caea7441ee':
Remove window from mWaitingForDrawn when policy hidden
5d552f2cf733f39677fa4a8617e69566624b8cae 24-Aug-2015 Jorim Jaggi <jjaggi@google.com> am 414985c4: Remove window from mWaitingForDrawn when policy hidden

* commit '414985c422664c7f8d5dec5562b502907b965876':
Remove window from mWaitingForDrawn when policy hidden
414985c422664c7f8d5dec5562b502907b965876 22-Aug-2015 Jorim Jaggi <jjaggi@google.com> Remove window from mWaitingForDrawn when policy hidden

When doing a wake-and-unlock sequence and the app underneath hides
the status bar, we are dismissing Keyguard, the app gets focus, the
app hides the status bar BUT we haven't finished drawn yet, so we
are waiting until the timeout because w.hasDrawnLw() always returns
false. Remove window from pending list if it gets policy hidden.

Bug: 23431343
Change-Id: I27e8c6d4efb435a4d3b632a4a37c0de5b021c2e7
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4b27011c6dbde7420f39b61c94960c21314a6dc2 22-Aug-2015 Jorim Jaggi <jjaggi@google.com> am ab023c90: am a1415360: am 2021956a: am ab45a217: Make wake-and-unlock faster

* commit 'ab023c901598ffb478a78550874cb692217a82a8':
Make wake-and-unlock faster
ab023c901598ffb478a78550874cb692217a82a8 22-Aug-2015 Jorim Jaggi <jjaggi@google.com> am a1415360: am 2021956a: am ab45a217: Make wake-and-unlock faster

* commit 'a1415360d739a382bde8efa2fdb9cce4a1e8c00e':
Make wake-and-unlock faster
2021956a1c35dba2b88257dc4a8eed8fa0acd650 22-Aug-2015 Jorim Jaggi <jjaggi@google.com> am ab45a217: Make wake-and-unlock faster

* commit 'ab45a217b0002dcf586d529ab8581cacbbfc37e9':
Make wake-and-unlock faster
d970f5455546463710e01b2315d6ef47d72a825f 21-Aug-2015 Filip Gruszczynski <gruszczy@google.com> Split WMS.handleAppTransitionReadyLocked.

Not only some pieces can be split into smaller pieces, but it also
reveals some variables that can be removed or their scope narrowed.

Change-Id: I44c8c9a2535f857c666d5c4a521204e820dbc60b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ab45a217b0002dcf586d529ab8581cacbbfc37e9 21-Aug-2015 Jorim Jaggi <jjaggi@google.com> Make wake-and-unlock faster

- Scrims: When dismissing Keyguard, don't wait until the next frame
to start the animation. Saves 16ms
- Scrims: Skip first frame, because it's completely black anyways.
Saves 16ms.
- Don't wait with navigation bar to show until the screen has turned
on. Window manager is blocked on DisplayPowerController anyways, so
the animation will exactly be started when the screen turns on. Fixes
some jank as well.
- Window manager: Don't wait for the window below Keyguard for draw
completion until turning on screen. Saves a lot of time depending on
how the app is behaving.

Bug: 23401557
Change-Id: I9734f9a12143f0e3c0647e9aa066831a29a6de63
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
24ba8e2accf7e96d34440233cd5112629f89f6e1 21-Aug-2015 Stefan Kuhne <skuhne@google.com> Merge "Adding a touchable area around a task"
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/WindowManagerService.java
83fce9fc3a00d4538802f7d7a84570942089b346 20-Aug-2015 Chong Zhang <chz@google.com> am d08e4300: am 7efe9f67: am 5923d161: Merge "wm: call displayReady for all built in displays when system is ready."

* commit 'd08e4300eadb29bb6a6b494d0163d899baa8ef0a':
wm: call displayReady for all built in displays when system is ready.
d08e4300eadb29bb6a6b494d0163d899baa8ef0a 20-Aug-2015 Chong Zhang <chz@google.com> am 7efe9f67: am 5923d161: Merge "wm: call displayReady for all built in displays when system is ready."

* commit '7efe9f67f5e5626ff56db88204dd7108ff6195c9':
wm: call displayReady for all built in displays when system is ready.
9f38dd3d394e447f7c5d78de714f3eab946dfb77 20-Aug-2015 Chong Zhang <chz@google.com> am 7efe9f67: am 5923d161: Merge "wm: call displayReady for all built in displays when system is ready."

* commit '7efe9f67f5e5626ff56db88204dd7108ff6195c9':
wm: call displayReady for all built in displays when system is ready.
5923d161d0680a5ea107fa4104b0a6867237ba4a 20-Aug-2015 Chong Zhang <chz@google.com> Merge "wm: call displayReady for all built in displays when system is ready."
79a230f77737eba275b752f17ab0af8adf000a0a 20-Aug-2015 Yusuke Sato <yusukes@google.com> Merge "Add tracing calls for bootanim"
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/WindowManagerService.java
170192ab55812bd25124cf602042477c3ea042d1 17-Aug-2015 Filip Gruszczynski <gruszczy@google.com> Improve animating from recents to multi window state.

Previously all windows would start animating from a single thumbnail
that was clicked. Now each animates from its thumbnail, including
properly animating the thumbnail header. This involves System UI
providing information about the thumbnail setup and app transition code
using it to setup each individual animation.

Change-Id: I6f45c94af6bcbf6898b8ed757d83505af99ed6b1
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
46e01e92b8bfc139e503838883dace215a79614b 19-Aug-2015 Yusuke Sato <yusukes@google.com> Add tracing calls for bootanim

Change-Id: I38759a015e79485e45bdb58f96152a2145053c42
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b34a7ad1af54132b6b046ab8f768e0ffb81cf581 14-Aug-2015 Wale Ogunwale <ogunwale@google.com> Added support for docked stack

Docked stacks occupy a dedicated region on a display.
When a docked stack is present all other static stacks bounds
are restricted to the region of the screen not occupied by
the docked stack.

Change-Id: I6aec3aa19c41a7e756375002f3a925977b5533b5
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
dfb25d3fd513ccbe9a403e7b9a21c44d8382c703 14-Aug-2015 Filip Gruszczynski <gruszczy@google.com> Make thumbnail header animation match multi window thumbnail animation.

Change-Id: Ib21c7c6300d58f08132aadae3aa68439793936d2
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
71b0d2dba06bbb17b92b830c4adb795ad0211922 13-Aug-2015 Filip Gruszczynski <gruszczy@google.com> Thumbnail enter animations for multiwindow.

The multi-window differs from the full screen entrance animation by
using translation to make the window travel from the thumbnail to the
final position. It also takes into account the surface insets when
determining scaling animation. It doesn't use clipping at the moment,
but that would be a near future improvement.

Change-Id: I7f310850713448b820b9e94ac2f8fbf74563068c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9b1697cd8f3e87aa7a09b2f8a31ca034490c5e39 08-Aug-2015 Jason Monk <jmonk@google.com> am e0d9fe59: am 635270c5: am a01965e2: am 69a07d40: am 69ed3308: Merge "Allow system to disable lockscreen" into mnc-dev

* commit 'e0d9fe59856241fb34212b4ad160dbc8f76e4343':
Allow system to disable lockscreen
e0d9fe59856241fb34212b4ad160dbc8f76e4343 07-Aug-2015 Jason Monk <jmonk@google.com> am 635270c5: am a01965e2: am 69a07d40: am 69ed3308: Merge "Allow system to disable lockscreen" into mnc-dev

* commit '635270c5b69da17d80da5e165266ba655c12738e':
Allow system to disable lockscreen
a01965e22aafa58e7226dd2f0691985f3e8713ae 07-Aug-2015 Jason Monk <jmonk@google.com> am 69a07d40: am 69ed3308: Merge "Allow system to disable lockscreen" into mnc-dev

* commit '69a07d401a3d40de6d5f17eeaf642db12401fe2f':
Allow system to disable lockscreen
59769181a52cd7dc2da12ef324c6a2336540d627 07-Aug-2015 Jason Monk <jmonk@google.com> am 69ed3308: Merge "Allow system to disable lockscreen" into mnc-dev

* commit '69ed33087d77e32a1f1475adf00b9d87580960aa':
Allow system to disable lockscreen
b978ce7f25011add50e900d5745f3e066cddfd55 06-Aug-2015 Jason Monk <jmonk@google.com> Allow system to disable lockscreen

Even when there is a pin.

Bug: 22920549
Change-Id: Ib84e1c3ac67be0318d4186c66ee582a49969e373
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
706ed793409f800a2b8dfbe66ac6992d057549de 02-Aug-2015 Wale Ogunwale <ogunwale@google.com> Support creating/launching a task with non-fullscreen bounds

Change-Id: Icc6d6b25b5f6f236030e654a3eb3ec7f00287d2f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
61b47bb267dec696e1bb11f7c5eb6b9d2f4bd096 28-Jul-2015 Stefan Kuhne <skuhne@google.com> Adding the 'non client decor view' to free floating windows

This patch adds a new free floating window non client decor view which
has:
- Two buttons (maximize and close) as it meets our current UX design
- A Shadow which changes size with focus
- It's own view as preparation for the thread distributed drawing and
user interaction handling (resize handles, etc)

Missing is at this point:
- The button functionality itself.
- Changing/removing decors based on window type (once the needed
patches land.

bug: 21738666
bug: 21739152
Change-Id: I6e41f2a7470256cee7bae35029d7e8c43fb235dd
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5a5a1ca1764eeb99047b63cdc52b806afd0f998e 30-Jul-2015 Xiaohui Chen <xiaohuic@google.com> clean up UserHandle.USER_OWNER reference.

mCurrentProfileIds does not seem to need the initial value of USER_OWNER.

Bug: 19913735
Change-Id: I7eeff712fb366ccdffef4031f385416c165e7fd6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
22350a8c2ce619ea799bba67d1fbced03ef44355 03-Aug-2015 Yusuke Sato <yusukes@google.com> am 82e78074: am b98e2353: am 158560ad: Merge "Distinguish user-requested shutdown from power-related ones"

* commit '82e780743046e620b724c28023b580e0e624bb15':
Distinguish user-requested shutdown from power-related ones
82e780743046e620b724c28023b580e0e624bb15 03-Aug-2015 Yusuke Sato <yusukes@google.com> am b98e2353: am 158560ad: Merge "Distinguish user-requested shutdown from power-related ones"

* commit 'b98e235364c2b221521f622c546733b2862e4677':
Distinguish user-requested shutdown from power-related ones
a786bb6b1c53252bd3390ca68196d5eff93fa2ce 01-Aug-2015 Wale Ogunwale <ogunwale@google.com> Merge "Added support for static vs. dynamic stacks"
8a911ea8e838464f6b7d197c414e7f7f9a84ae58 01-Aug-2015 Dianne Hackborn <hackbod@google.com> am 2b38a45b: am 44ffe9cb: am cba2c596: am 6aa0843e: am fb68b0ad: Merge "Fix issue #21895842: Add is_assist_blocked to assist.ViewNode.NodeProperties" into mnc-dev

* commit '2b38a45bf37846d0a210369e41efd70738e3d591':
Fix issue #21895842: Add is_assist_blocked to assist.ViewNode.NodeProperties
ddc1cb2c15549ed23dce9d416680a009fa6ae23c 26-Jul-2015 Wale Ogunwale <ogunwale@google.com> Added support for static vs. dynamic stacks

Now that stacks represent workspaces we can define static
stacks which help shape the characteristics of the tasks
they contain. For example, fullscreen tasks/activities will
normally be launched in the stack with id
FULLSCREEN_WORKSPACE_STACK_ID, while freeform tasks/activities
will normally be launched in the stack with id
FREEFORM_WORKSPACE_STACK_ID.

Also, added ability to position a task at any index in a stack.

Bug: 22068114
Change-Id: Ib6c62a84b5f204fbf072755264c5c5eda6184f97
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
cba2c59612fc608c6f0e9c3823cac1435a2d29d8 01-Aug-2015 Dianne Hackborn <hackbod@google.com> am 6aa0843e: am fb68b0ad: Merge "Fix issue #21895842: Add is_assist_blocked to assist.ViewNode.NodeProperties" into mnc-dev

* commit '6aa0843ed95d3af828c8dc415053b91f3db25fac':
Fix issue #21895842: Add is_assist_blocked to assist.ViewNode.NodeProperties
c2369c5301c489195daa25894ea838cfa7f2a661 01-Aug-2015 Yusuke Sato <yusukes@google.com> am b98e2353: am 158560ad: Merge "Distinguish user-requested shutdown from power-related ones"

* commit 'b98e235364c2b221521f622c546733b2862e4677':
Distinguish user-requested shutdown from power-related ones
afb308d6519c56cf2b8001b33dade35e682ab241 31-Jul-2015 Dianne Hackborn <hackbod@google.com> Fix issue #21895842: Add is_assist_blocked to assist.ViewNode.NodeProperties

Change-Id: I928882d42d0546cc6a12e803d96131beaba76d4e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
705ffd1efe529bb291e90fa06e92c8090ee98627 22-Jul-2015 Yusuke Sato <yusukes@google.com> Distinguish user-requested shutdown from power-related ones

With this patch, when the user requested shutdown,
PowerManagerService sets sys.powerctl is set to
"shutdown,userrequested", and init runs fsck on shutdown.

When shutdown is triggered due to a low power state etc.,
the service sets the property to "shutdown,", and init
immediately shuts down the system without running the
command.

This is a follow-up CL for http://r.android.com/158525.

Bug: 21853106
Change-Id: Iae72990130fe9aa479c802f77301438190dbbfb3
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
0e95bc4fb2c9255223d1a27b1727416d81e4835c 29-Jul-2015 Vadim Tryshev <vadimt@google.com> Adding a drag flag to make drag shadow opaque.

The default is still a semitransparent shadow.

Bug: 22028725
Change-Id: I4b0090053fe28cc4ac009960b5b7866d1219a675
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
1997eb104d0161e0f691f3d0cf56d8b698a6e8d6 24-Jul-2015 Jorim Jaggi <jjaggi@google.com> am b3544372: am 929a82c8: am a0d142d9: am 5091ca9c: am ac73f1ef: Partially fix that beginning of animation is skipped

* commit 'b3544372ba519f96b37f77b3d986d7db1312f975':
Partially fix that beginning of animation is skipped
a0d142d9425e542b58721cbfcf7a032e7c503521 24-Jul-2015 Jorim Jaggi <jjaggi@google.com> am 5091ca9c: am ac73f1ef: Partially fix that beginning of animation is skipped

* commit '5091ca9c825c32336ce42d7b70eef323ddb9cb3c':
Partially fix that beginning of animation is skipped
ac73f1efea0cb23881571e18e87ffc7f388af7ad 22-Jul-2015 Jorim Jaggi <jjaggi@google.com> Partially fix that beginning of animation is skipped

When waiting for all the windows that belong to an activity, we
skipped the main window, in case it didn't had a surface yet. This
was a problem because with SurfaceViews: They set it's visibility
extremely early in the app visibility change cycle. Then, they don't
block with the callback to SurfaceHolder.Callback2.surfaceRedrawNeeded,
so window manager thinks it has drawn the first frame already. We don't
even have a surface for the main window yet, but we start the app
transition already because we think the only interesting window for this
app token is the SurfaceView, which has supposedly already drawn.

Bug: 22207948
Change-Id: I2ddb274000fa08866e193f4fd8db3788fc55e0f1
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
541e115f5c1021c0a40a47b4f7acfa44a8902d70 20-Jul-2015 Wale Ogunwale <ogunwale@google.com> am 03dbf19a: am 88d51c3c: am 7e640ede: am 81696d13: am bde85f74: Merge "Fixed issue with background user window consuming touch events" into mnc-dev

* commit '03dbf19a119caac06fd15cc7e3023a55f9ac06d8':
Fixed issue with background user window consuming touch events
7e640edeb3c501ee851e70aa633aa531a6f0b34d 20-Jul-2015 Wale Ogunwale <ogunwale@google.com> am 81696d13: am bde85f74: Merge "Fixed issue with background user window consuming touch events" into mnc-dev

* commit '81696d13360a00dd3a450e7ff97329e8560c4684':
Fixed issue with background user window consuming touch events
4eef94f2b82f4b86e6d78f752d0f8895acf78cee 18-Jul-2015 Wale Ogunwale <ogunwale@google.com> Fixed issue with background user window consuming touch events

When adding a window for a background user, it is possible for
the window to consume touch events because it is in the
COMMIT_DRAW_PENDING state. We allow the background user window
to transition READY_TO_SHOW state, but hide the window.

Change is based on https://android-review.googlesource.com/#/c/158772
and also reverts commits 6ee618509a392adb183c2e70390cd9e2031ff0d8
and 588932a53e63c0a7ee281dea22559c129b40eb99

Bug: 22531717
Bug: 22207948
Bug: 18510914
https://code.google.com/p/android-developer-preview/issues/detail?id=2667

Change-Id: I68d2e532c2b1def0d7b22c9b60e48110cf3cd686
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
07eee1750bbe1ef2de7b7571068310d5ea84cdc1 17-Jul-2015 Filip Gruszczynski <gruszczy@google.com> am e7cc39a3: am 41bb77bd: am ebb56d9b: am 550f1d4e: Merge "Delete overscan setting by both unique id and name." into cw-d-mr1-dev

* commit 'e7cc39a399fa6362d1062ab3e57f9cf40ec76279':
Delete overscan setting by both unique id and name.
ebb56d9b0c1567947ba2f98402a43920d9ba7ac0 17-Jul-2015 Filip Gruszczynski <gruszczy@google.com> am 550f1d4e: Merge "Delete overscan setting by both unique id and name." into cw-d-mr1-dev

* commit '550f1d4eb3c9b0131106490841a6a369df639133':
Delete overscan setting by both unique id and name.
0d38dc16a6a25c8285224c763fcc45121363b321 16-Dec-2014 Vinu Deokaran <vinud@codeaurora.org> wm: call displayReady for all built in displays when system is ready.

When system has more than one built in display, displayReady needs
to be called for all built in displays when window manager is ready.
Otherwise, some system services, such as presentation, mediarouter,
etc, won't work on these displays.

Change-Id: Ibf08074eff555c14a318236bd06e7b4855503140
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
1d0bd59014c466d5475b673cf66203206147998d 16-Jul-2015 Wale Ogunwale <ogunwale@google.com> am 69b301ec: am bc72debf: am 40d16bd0: am fd2a5f14: am 11813232: Merge "Animate app exit for cases where the app is already hidden before transition" into mnc-dev

* commit '69b301ec55db3c87f8e53629f3777ecdc31fd3b5':
Animate app exit for cases where the app is already hidden before transition
1181323230478e3027bbabbbaf769dcd4a11a0e4 16-Jul-2015 Wale Ogunwale <ogunwale@google.com> Merge "Animate app exit for cases where the app is already hidden before transition" into mnc-dev
b60c0f616c0863e3970bcacd82a793e561d99689 16-Jul-2015 Wale Ogunwale <ogunwale@google.com> Animate app exit for cases where the app is already hidden before transition

It is possible for an app token to be marked as hidden and exiting
because the previous activity destory is completed before we are
good-to-go with app transition since we are still waiting for the
opening app to be done drawing. In this case we don't apply the
exiting animation since the token is not changing visibility state
during the app transition (it is already hidden and we are telling
it to hide...).
We now allow the animation to load if the token is already hidden
and marked as exiting.

Bug: 22381703
Change-Id: I5c27b6c3c1f810f05b2d716122055c6f12d0a167
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
dd46de68adc038a659edb6b586c8b55856791403 16-Jul-2015 Billy Lau <billylau@google.com> am 1178526c: am 0d360d17: am fa2584f6: am da93454b: am 008409a2: Merge "Bug: 21589105 Rescoping SYSTEM_ALERT_WINDOW..." into mnc-dev

* commit '1178526c352a6784b520cd10a3a5686f9427d1b9':
Bug: 21589105 Rescoping SYSTEM_ALERT_WINDOW...
008409a2ea1feed095d53ce51429e4fed964c50c 16-Jul-2015 Billy Lau <billylau@google.com> Merge "Bug: 21589105 Rescoping SYSTEM_ALERT_WINDOW..." into mnc-dev
060275ffc7fbfc72b19871f7dd7aefb61a81a1fc 15-Jul-2015 Billy Lau <billylau@google.com> Bug: 21589105 Rescoping SYSTEM_ALERT_WINDOW...

AppOpsManager:
Changed the default mode for SYSTEM_ALERT_WINDOW to MODE_DEFAULT instead of
MODE_ALLOWED. Otherwise, an app that did not declare for this permission will
actually be allowed to perform OP_SYSTEM_ALERT_WINDOW, which is undesirable.
This change also allows callers to make their own decision based on the
current policy (M vs pre-M apps).

policy/PhoneWindowManager:
Added additional checks that will handle MODE_DEFAULT - this happens when an app
is newly installed but not yet configured.

wm/WindowManagerService:
Enriched some checks to include the treatment of MODE_DEFAULT - this will allow
pre-M apps uninterupted capability to draw on top of other apps.

Change-Id: I8de77730e158c97587427820cfba721bd5607bea
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
aa1a35ba277019827aca33014f1e09d01831fc7d 16-Jul-2015 Jim Miller <jaggies@google.com> am 2e56339a: am bcedcde8: am 204c2de8: am c7b0435c: resolved conflicts for merge of 1d4247c4 to mnc-dr-dev

* commit '2e56339a4a1133e9aface1c851f1ab67cff72109':
Improve tracking of screen on reasons.
280a64e793d081847c5dcea23ed9be38aa5332d2 13-Jul-2015 Dianne Hackborn <hackbod@google.com> Improve tracking of screen on reasons.

- New screen on app op to record the last time each app has
caused the screen to be turned on.
- New battery stats event that tells us the reason the screen
has been asked to turn on.
- Propagate out power manager API to specify the reason a caller
is asking to have the screen turned on.

Note that currently the window flag to turn the screen on bypasses
much of this because it is being handled in the window manager by
just directly telling the power manager to turn the screen on. To
make this better we need a new API where it can specify who it is
calling the API for.

Change-Id: I667e56cb1f80508d054da004db667efbcc22e971
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
0a012ba55dd79dfe087ad4bff46656283cb0b4a4 14-Jul-2015 Filip Gruszczynski <gruszczy@google.com> Delete overscan setting by both unique id and name.

When overscan with only zeros is set, it removes an entry by display's
unique identifier. It turns out in the past the readable name must have
been used in the past and there is a lingering value in the xml file.
This CL purges also the display name entry.

Bug: 22357152
Change-Id: Ie2daf76677eb96df474acb546491194d0aaf8bc0
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a5192842d74d517154dc2af07fda51a124731280 10-Jul-2015 Adrian Roos <roosa@google.com> am e5f3bebf: am 61e51e2b: am 41f9a76d: am 78da75c3: am 83e9525c: Merge "Fix premature clearing of clearable sysui flags" into mnc-dev

* commit 'e5f3bebfc21c87e94076ca03f76ab9e4a7e0b46b':
Fix premature clearing of clearable sysui flags
01f2d1ac7e035227ae81ca23217f06631923b559 10-Jul-2015 Adrian Roos <roosa@google.com> Fix premature clearing of clearable sysui flags

Fixes a bug where all clearable flags would be cleared even if
only a subset actually changes; new behavior is clearing only
the flags that actually got cleared.

Bug: 22331526
Change-Id: Icbb12121c977e48457692c054571521c6f6eb730
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2b54a189a2a6fb801152793125510d9c5a8d7948 08-Jul-2015 Wale Ogunwale <ogunwale@google.com> am 8f09d1b6: am fcf1da4b: am 9413e87a: am d8c77f4b: am 880a54f6: Merge "Cleaned-up logic for determining clip rect for transitions animations." into mnc-dev

* commit '8f09d1b64c512adc13b91ed18dde41e60417ff3b':
Cleaned-up logic for determining clip rect for transitions animations.
e7d7831ee10f675dcd8769326f3df67c47560f60 08-Jul-2015 Jorim Jaggi <jjaggi@google.com> am 862ecdcb: am 41657483: am 17bf58a3: am d4be15d5: am 588932a5: Always wait for the main app window before starting a transition

* commit '862ecdcb4b470f0af21446ef6f08777a5e50437a':
Always wait for the main app window before starting a transition
880a54f6d85f5880a79ff94b2116ab2c12ea2fd8 07-Jul-2015 Wale Ogunwale <ogunwale@google.com> Merge "Cleaned-up logic for determining clip rect for transitions animations." into mnc-dev
588932a53e63c0a7ee281dea22559c129b40eb99 02-Jul-2015 Jorim Jaggi <jjaggi@google.com> Always wait for the main app window before starting a transition

When waiting for all the windows that belong to an activity, we
skipped the main window, in case it didn't had a surface yet. This
was a problem because with SurfaceViews: They set it's visibility
extremely early in the app visibility change cycle. Then, they use
another thread to draw content. Thus, they have drawn their first
frame pretty fast, where the main thread might still be in the
activity lifecycle phases. Then, we don't even have a surface for the
main window yet, but we start the app transition already because we
think the only interesting window for this app token is the
SurfaceView, which has already drawn.

Bug: 22207948
Change-Id: I708add3aab00575ae1707b25622b9b4614472892
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
35a57f81a963eaa3739cfcacd4f9f309d433487f 02-Jul-2015 Wale Ogunwale <ogunwale@google.com> Cleaned-up logic for determining clip rect for transitions animations.

Previous logic led to several edge cases which fixes sometimes broke
other edge cases. New logic uses the clip rect provided by the
transformation as-is and doesn't try to adjust it based on window
flags. Correct clip rect is set in
WindowManagerService#applyAnimationLock using the content insets
before the animation is loaded.

Bug: 21727851
Bug: 20652683
Bug: 19523205
Bug: 15046646
https://code.google.com/p/android/issues/detail?id=161362
Change-Id: I2d4ed6196edb8ee8c401fe9a242aec70d3494574
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
0c9577008083f5ee8b66837e4f01471aaf207448 07-Jul-2015 Dianne Hackborn <hackbod@google.com> am 7a90c536: am bcbf4641: am 569984f2: am d178b2da: am 5c8498db: Merge "Add easy way to get device idle whitelist." into mnc-dev

* commit '7a90c536310796426f9f8be16265db2803bfd74b':
Add easy way to get device idle whitelist.
Don't prevent windows from drawing when they are just moving
Added support for mid-call enabled SRVCC conference call
MWI,phantom call,Suppl services, error codes
Rename VoLTE/WFC enable API to available - add VT available API.
Avoid IllegalStateException when generating/importing keys.
docs: Updated M Preview API Overview and Behavior Changes for Preview 2 release.
Unhide signal strength constants used by getLevel.
c5af4f8421926ea17cf51a9a53f91f5fec467588 02-Jul-2015 Jorim Jaggi <jjaggi@google.com> Don't prevent windows from drawing when they are just moving

Bug: 21292010
Change-Id: I0cf459d75e9749afa58a4b8649457b3908c8adeb
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
fb15033afc690230f17bf9f18aa0b7fa50eccd3c 04-Jul-2015 Filip Gruszczynski <gruszczy@google.com> am 9fbb1696: am 545c5b38: am 9f8e1f5d: am aabc9869: am 03850591: Handle outsets when resized is called due to rotation.

* commit '9fbb16964453087b3cc8a8eb63189c8f8bedbdb8':
Handle outsets when resized is called due to rotation.
4aa0ca6619397abbcfa622f803b11f794de053e8 03-Jul-2015 Filip Gruszczynski <gruszczy@google.com> am 2b5a6842: am cc7fa77e: am d40c423b: Merge "resolved conflicts for merge of 300ccf4a to mnc-dev" into mnc-dev

* commit '2b5a6842fdbb70c153bb691e86ce3fd0ac07ae60':
Calculate outset hint when adding window.
9f8e1f5d043a8c3980c1cc38779752c11620cf13 02-Jul-2015 Filip Gruszczynski <gruszczy@google.com> am aabc9869: am 03850591: Handle outsets when resized is called due to rotation.

* commit 'aabc9869a95928660271b7022e2756fff2654013':
Handle outsets when resized is called due to rotation.
aabc9869a95928660271b7022e2756fff2654013 02-Jul-2015 Filip Gruszczynski <gruszczy@google.com> am 03850591: Handle outsets when resized is called due to rotation.

* commit '03850591954faf5280fd581dd04cd6958eda0124':
Handle outsets when resized is called due to rotation.
03850591954faf5280fd581dd04cd6958eda0124 01-Jul-2015 Filip Gruszczynski <gruszczy@google.com> Handle outsets when resized is called due to rotation.

Rotation might change while the wallpaper is displayed. If outsets are
present, this must trigger a resized callback and the wallpaper must
take these accounts immediately into account before requesting relayout.

Bug: 22209764

Change-Id: I97f2670f384ccac792e7c2727eb0ef017ec66188
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d40c423b1cdccd61ed411b0b9e3fbefd47e99f9c 01-Jul-2015 Filip Gruszczynski <gruszczy@google.com> Merge "resolved conflicts for merge of 300ccf4a to mnc-dev" into mnc-dev
b400938058c243d38319aa0f410c15e3d9182a28 01-Jul-2015 Yohei Yukawa <yukawa@google.com> am aefe8e4d: am 93ed9858: am 63c4a718: Merge "Reland "Fixed constant window switching on lock screen..."" into mnc-dev

* commit 'aefe8e4d75415df97b2937684c06c2bb6310cd98':
Reland "Fixed constant window switching on lock screen..."
d1a092218b4b40cfd53a643e0ae01095815f4b30 01-Jul-2015 Yohei Yukawa <yukawa@google.com> Reland "Fixed constant window switching on lock screen..."

This is a manual reland of I3680256d41793f62def42fda00e26db1dcc9,
which was certainly merged into lmp-mr1-dev then auto-merged into
master but silently lost there for unknown reasons when
I8c42a1e6091b0fe1253e90265ac248087e was auto-merged into master.

Changes in WindowAnimator.java was already covered by
I2933eaf0ab55fe31cb382c46c411033e33a756e0 so this CL does not
include that change.

Bug: 18021493
Bug: 22158649
Change-Id: Ib1bf9f5bef44d0400230afc32231f7d1f3a1c98b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2987f616faca534a792686a53304c9932634310c 01-Jul-2015 Filip Gruszczynski <gruszczy@google.com> resolved conflicts for merge of 300ccf4a to mnc-dev

Change-Id: Ia315e314bfde0c066a2c25d93f8cbdc71fee0a14
300ccf4ab53e074fa5dfbac7c8eb7a4818b3ff74 30-Jun-2015 Filip Gruszczynski <gruszczy@google.com> am 0ec1328f: Calculate outset hint when adding window.

* commit '0ec1328f85a08a610868856c688ebb8196c79c17':
Calculate outset hint when adding window.
0ec1328f85a08a610868856c688ebb8196c79c17 25-Jun-2015 Filip Gruszczynski <gruszczy@google.com> Calculate outset hint when adding window.

Outsets aren't dynamic so they are a great candidate for a hint when the
window is added through the window manager. Thanks to this during first
view hierarchy measure or wallpaper window layout they are immediately
available and don't require multiple measure/layout passes.

Bug: 21593814
Change-Id: I573c15ffbbe4fcd8a6ed9c5e4fcd6cfbbcd7434f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b71ac8eccf0e7432f0900e1f758f08bbeb49387e 23-Jun-2015 Wale Ogunwale <ogunwale@google.com> am 59ab4b33: am 90cee497: am dd7705bb: Merge "Update surfaces secure flag on screen capture setting change" into mnc-dev

* commit '59ab4b336e392d769df4e27a2ac760510e0449fe':
Update surfaces secure flag on screen capture setting change
f5ad42f4324bfb7aa28f0967e2fcc89f55d6e91f 12-Jun-2015 Wale Ogunwale <ogunwale@google.com> Update surfaces secure flag on screen capture setting change

Also, added 'wm screen-capture [userId] [true|false]'
command.

Bug: 20934462
Change-Id: I14711003d7691fc4495428c12c9ff3457cd3773c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a48924f2841ff49885ab99a819ff3d94de201646 18-Jun-2015 Yusuke Sato <yusukes@google.com> Record WM_BOOT_ANIMATION_DONE in WindowManagerService

to track user-perceived boot performance. Even though we already
have BOOT_PROGRESS_ENABLE_SCREEN, that one is recorded before
WindowManagerService asks bootanim to exit. Since it takes a few
seconds for bootanim to exit (depending on desc.txt in the boot
animation zip file), WM_BOOT_ANIMATION_DONE would represent
user-perceived boot time better.

Bug: 21637637
Change-Id: I9d81dbf3fdb5dcd780e3fc3ca01c8ada4d6f16ef
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d56ec1d44479cac0820c6afe9aaa689fc47c431d 17-Jun-2015 Seigo Nonaka <nona@google.com> Fix IME window flickering during rotation.

This was introduced by Ifd15736b163ab,
performLayoutAndPlaceSurfacesLocked is called even if
computeNewConfigurationLocked() returns non-null object.
This is simply by mistake and now computeNewConfigurationLocked
never returns null. The only case we need to care is that
mDisplayReady is false, but there is nothing to do with that state.

Thus simply removes if segments from computeNewConfiguration.

Bug: 20823978

Change-Id: I527dfeddffb8d928d578f8d60d64f98557aa3dcb
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a8a0ac6940db9a035f535c61cf8e7588d18d2981 12-Jun-2015 Yohei Yukawa <yukawa@google.com> Merge "Do not access WindowManagerService#mCurrentUserId w/o lock." into mnc-dev
cf83fd263545de3e21035855bf9ec00e0c9b9147 12-Jun-2015 Yohei Yukawa <yukawa@google.com> Merge "Make WindowManagerService.SettingsObserver multiuser-aware." into mnc-dev
af7289dfa376f6dacedf5fa01ba85b4586310971 12-Jun-2015 Wale Ogunwale <ogunwale@google.com> Merge "Revert "Enabled WMS.DEBUG_STARTING_WINDOW"" into mnc-dev
92af789d854f06fd119abd373b2fe517c894737c 11-Jun-2015 Yohei Yukawa <yukawa@google.com> Do not access WindowManagerService#mCurrentUserId w/o lock.

This CL is not directly related to Bug #21766030 but is a
kind of follow up CL for I1d93095965c852ff90d8c7cc031c4755856.

Basically we should not access WMS#mCurrentUserId w/o lock.

Bug: 21766030
Change-Id: Ib06ace0a0b84d527e0d7cbcc2a7cb39b27be3794
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
6b4703cfa6eb488afa0255d5943b7a3ab3c01caf 11-Jun-2015 Yohei Yukawa <yukawa@google.com> Make WindowManagerService.SettingsObserver multiuser-aware.

WindowManagerService.SettingsObserver has been used to monitor
per-user settings hence we have to take care of multiuser
scenario.

So far it's acceptable to monitor settings changes for all the
users because following event handlers are already
multiuser-aware.
- WindowManagerService#updateShowImeWithHardKeyboard
- WindowManagerService#updateCircularDisplayMaskIfNeeded

Bug: 21766030
Change-Id: I1d93095965c852ff90d8c7cc031c4755856a7e41
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
31353c658180572a1744108137a99d45747ef92f 11-Jun-2015 Wale Ogunwale <ogunwale@google.com> Revert "Enabled WMS.DEBUG_STARTING_WINDOW"

Bug: 21587512
Bug: 21384482
This reverts commit 9573ae1deedecb8ce7b834e308e6b2db9064bb09.

Change-Id: I0008b75d6e900b26fc54d6cef412141215876648
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
011c133e3c98ccf95fe4626d30c739c5a35d986e 10-Jun-2015 Stefan Kuhne <skuhne@google.com> Merge "Dont create a dummy animation for a transferred animation" into mnc-dev
7dcf08c6b2778b60992005b16d8fb297e6ec499a 06-Jun-2015 Stefan Kuhne <skuhne@google.com> Dont create a dummy animation for a transferred animation

When multiple windows get created at once, multiple starting windows
will be created as well. The first window will get an animation and a
dummy animation. If another window will get shown shortly after, it
will receive the animation of the first starting window. However, no
new dummy animation should be created for it since otherwise it might
never get an animation end notification.

This CL also reverts previously added changes to ignore dummy animations.

reverted change: Ie907d31f51e130e245a70249a983d490f3d42b21

Bug: 21643278
Bug: 21403998
Change-Id: I228d77a2d9c3597df0eb9c340a65c0c592c35ce6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
c554b77b7392b97e0f455d8276b739e16147d6df 05-Jun-2015 Jorim Jaggi <jjaggi@google.com> Skip first frame for app transitions when possible

In most of our standard app transitions, the first frame of a
transition results in the same contents on the screen. This is
inefficient, as we can directly skip to the second frame of the
transition, introduce no jank, but execute the transition 16ms
faster.

Change-Id: If58337eae5558eae3acced691ae01c769f0ec2b9
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a1b35394b69145fe0a08eebb9d71ff8d54a4fca9 04-Jun-2015 Android (Google) Code Review <android-gerrit@google.com> Merge "Don't leak windows on removal with dummy animations" into mnc-dev
79f4718d7cb7e4a7b43dff9618bd4edd884ed6de 03-Jun-2015 Stefan Kuhne <skuhne@google.com> Don't leak windows on removal with dummy animations

Dummy animations might never end. Do not hold a window removal
for it.

Bug: 21403998
Change-Id: Ie907d31f51e130e245a70249a983d490f3d42b21
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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
16dbf0c79c6e8428c34f5da8c637baf5809f1748 02-Jun-2015 Wale Ogunwale <ogunwale@google.com> Merge "Enabled WMS.DEBUG_STARTING_WINDOW" into mnc-dev
9573ae1deedecb8ce7b834e308e6b2db9064bb09 02-Jun-2015 Wale Ogunwale <ogunwale@google.com> Enabled WMS.DEBUG_STARTING_WINDOW

To debug starting window issue reported in comment #38
of b/21384482

Bug 21384482

Change-Id: I2fbafda5fa79448057cf27a65d1be9b96894770e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
cbf400b1642913d8640ae0ce59e910e12d7e4f5d 02-Jun-2015 Olawale Ogunwale <ogunwale@google.com> Merge "WindowManagerService not propagating X and Y steps" 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/WindowManagerService.java
3aa33b3da04774d76e1a65b749667450dc81532b 01-Jun-2015 Mady Mellor <madym@google.com> Merge "Update button to BUTTON_STYLUS_PRIMARY" into mnc-dev
99bcc3eee23ed8bd15bd108d068d6f9f694e4393 01-Jun-2015 Filip Gruszczynski <gruszczy@google.com> Merge "Revert "Revert "resolved conflicts for merge of 47249f2a to mnc-dev""" into mnc-dev
0242b153aff4f9ff611c67494fcde0e8363f78d8 17-Apr-2015 Richard MacGregor <rmacgregor@cyngn.com> WindowManagerService not propagating X and Y steps

WindowManagerService received X and Y offset steps but failed to pass
them off to the relavent wallpaperservice.

Live wallpapers expect a valid value for xOffsetStep and yOffsetStep
when the WallpaperService.Engine::onOffsetsChanged function is called
As specified here:
https://developer.android.com/reference/android/service/wallpaper/WallpaperService.Engine.html
onOffsetsChanged(float,float, float, float, int, int)

See bug report:
https://code.google.com/p/android/issues/detail?id=173607

Change-Id: I532dedf2db055e27d6eca813e30346e37f52dc65
(cherry picked from commit e03ea68d0a7f7d7c60663feae587225cca3a3a5b)
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
c145b537193e49b304dd444405640cf61595871d 27-May-2015 Olawale Ogunwale <ogunwale@google.com> Revert "Revert "Remove debugging and skip InputMethod windows""

This reverts commit ea343e5f673e540f5d2504fe8ac17606f0bd5d94.
Reducing log spam from WM.

Change-Id: I56468a61b15d08eff1d89b0d648f29a0e868408c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
10cb5e2ac7f5e44037e26114ea0b0ab9d3028111 24-May-2015 Wale Ogunwale <ogunwale@google.com> Don't leak starting window when app crashes before adding windows

It is possible for us to leak an app starting window if the app it
is associated with fails to start before adding any windows. This
causes the starting window to permanently be visible at the layer
it occupies.

We now remove the starting window immediately when the app token
is been removed if it is the last window in the token and it isn't
animating.

Bug: 21375344
Change-Id: Ib3da148501645a44736c639c0181c3fabe0138e8
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
772fcb96f19fbd6b86ac562863714019909634bf 22-May-2015 Mady Mellor <madym@google.com> Update button to BUTTON_STYLUS_PRIMARY

MotioneEvent.BUTTON_SECONDARY is no longer used for M+, instead it will
be BUTTON_STYLUS_PRIMARY.

Bug: 21148238
Change-Id: If08a82e7be57798a2a747d29436e0411c76ef58f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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.
f83e824216435e45f36a3587e269888f791b2a01 20-May-2015 Selim Cinek <cinek@google.com> Fixed that touches where incorrectly consumed when fullscreen

The fake window that was added when View.SYSTEM_UI_FULL_SCREEN was
set consumed all touches, even those going to the SystemUI and not
just those of windows below. The input consumer is now correctly
positioned in the window order to only capture the right touches.
Clicks to the volume panel and the heads up now correctly go to the
right place instead of just unhiding the SystemUI bars.

Bug: 21089476
Change-Id: Ib53dfc0b33b70084ca607d0f044db30b6e6c91d6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
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/WindowManagerService.java
0bb478b7ff32ac3cd8f583f3852742e18a9c4bd6 19-May-2015 John Reck <jreck@google.com> Merge "Don't recreate the surface unnecessarily" into mnc-dev
80181b99c7be562b24095ee495712f7197229c74 19-May-2015 John Reck <jreck@google.com> Don't recreate the surface unnecessarily

Bug: 19896200

The flicker is caused because ViewRootImpl is
requesting a change from OPAQUE to TRANSLUCENT due
to the presence of a GLSurfaceView. However, WindowManager
will use this as a signal to recreate the SurfaceControl.

This is not actually correct, as the underlying format
of the SurfaceControl was *already* TRANSLUCENT due to being
hardware accelerated. Add a fast-path for this step
where the format didn't actually change such that all that is
necessary is for the OPAQUE flag to be flushed through
to SurfaceFlinger.

This doesn't address the larger, more complex issue of a surface
flickering if the pixel format really did need to change, but
this should address the common case.

Change-Id: Ia5275705733123a3d7929bf5951829415753e2b2
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
1ca9c687407b0a7cdc828837c2460ee581e08975 19-May-2015 Wale Ogunwale <ogunwale@google.com> Merge "Send AppTransitionFinish notification when there was no animation" into mnc-dev
01f280d376218c5a007fc29f70b876375ad24204 19-May-2015 Adam Powell <adamp@google.com> Migrate uses of config_windowIsRound to Configuration.isScreenRound

Move existing code that previously relied on config_windowIsRound to
use the new Configuration.isScreenRound() method. Also move the system
property override for emulators over to the initial setup of a Display
so that the configuration property is consistent with existing
expectations.

Remove config_windowIsRound from symbols.xml. The symbol now only
exists as a default value redirect for overlays already configured to
supply this value.

Change-Id: I24e6564030a6051c3ac7262868983b43e13eee65
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
49e7ff9647e6547c2b852944a5435a05794b9951 15-May-2015 Adam Powell <adamp@google.com> Add Configuration data for round displays

Add round values to the screenLayout field for Configuration
and a convenience method to check roundness.

Plumb this through the DisplayManager, making roundness the property
of a DisplayAdapter. The built-in main display will read the
configuration resource config_mainBuiltInDisplayIsRound to determine
its roundness. Device-specific resource overlays should set this to
true for devices with round primary displays.

By default, this config resource inherits from the existing
config_windowIsRound value currently used by some Android Wear
device configurations.

This change awaits another for aapt/native resources code to make the
resource filtering system aware of this property.

Change-Id: I1daced7ca6d6e172789e7c32bebfd43753bfa2ae
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b2694cc3ee0e042bcd6564c68bc0349668eed30f 13-Nov-2014 Riley Andrews <riandrews@google.com> Make return of screenshotApplications an ashmem immutable bitmap.

Bug 21037890
Change-Id: I47a2ba11d26ec03a6e2e847f5af61b44efa2aa69
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
74d2afdf0bc94c22e6cdce40854ff58ba5715de3 17-Apr-2015 Richard MacGregor <rmacgregor@cyngn.com> WindowManagerService not propagating X and Y steps

WindowManagerService received X and Y offset steps but failed to pass
them off to the relavent wallpaperservice.

Live wallpapers expect a valid value for xOffsetStep and yOffsetStep
when the WallpaperService.Engine::onOffsetsChanged function is called
As specified here:
https://developer.android.com/reference/android/service/wallpaper/WallpaperService.Engine.html
onOffsetsChanged(float,float, float, float, int, int)

See bug report:
https://code.google.com/p/android/issues/detail?id=173607

Change-Id: I532dedf2db055e27d6eca813e30346e37f52dc65
(cherry picked from commit e03ea68d0a7f7d7c60663feae587225cca3a3a5b)
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b7f3f92ac200fb22cd8d880b63a5c0ef2bad5354 27-Apr-2015 tiger_huang <tiger_huang@htc.com> Use the correct parent size to initialize animations

The original logic would use out-of-date parent sizes to initialize
animations. If the screen size is changed after assigning mAnimDw and
mAnimDh in the constructor of WindowStateAnimator, the fromDeltaY
(in the most cases) of TranslateAnimation would be initialized
incorrectly.

In this change, we always use up-to-date parent sizes to initialize
animations to prevent the issue.

https://code.google.com/p/android/issues/detail?id=170348

Change-Id: Ib9c609121228934bdb463263feb1924eb389c1d2
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a48eadbeb6fa34f27d6db7de51d3c01972ea2ebf 15-May-2015 Wale Ogunwale <ogunwale@google.com> Send AppTransitionFinish notification when there was no animation

Activity#onEnterAnimationComplete() is the hook that we advise app
developers to use to know when they are allowed to start drawing
(so they don't collide with the window transition animation).
However, it's not invoked if the window transition has no animation
(e.g. by calling Activity#overridePendingTransition(0,0).

Bug: 20823935
Change-Id: I5b286968b0cd3351e9a9224294d0a1e7faf8c654
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8a2978c9ab5edd97e1de97fdc2ac6c6e2f7bb02b 14-May-2015 Wale Ogunwale <ogunwale@google.com> Merge "Don't stop animation when starting windows app token changes" into mnc-dev
8ebc82a63f7e4818bb615cf980b961757c8d6587 14-May-2015 Wale Ogunwale <ogunwale@google.com> Don't stop animation when starting windows app token changes

If another activity is starting while we are still animating
the starting window of the previous activity to start, we
transfer the starting window of the old activity to the one that
is currently starting so we don't have to create another starting
window and also to reduce jank from the starting window animation
appearing to restart.

However, there were several conditions that led to the starting
window animation stopping when the transfers app tokens

1. Starting window animator not been removed from the previous
app token animator causing it to finish/remove the starting window
prematurily.
2. Starting window animator not been properly added to the new
app token animator causing the animation not be be picked up.
3. WMS.mSkipAppTransitionAnimation been set to false regardless of if
an app transition was actually prepared in WMS.prepareAppTransition()
4. WMS.mSkipAppTransitionAnimation not been set to true in all cases
where the starting window transfers tokens even though we don't want the
new app to do any transition animation is the starting window is
animating.
5. New app not setting its animation to dummy animation when the next
transition should be skipped due to starting window still animating.
6. Starting window animation been cleared for the new app in
WMS.handleAppTransitionReadyLocked() even for cases where we transferred
the animation from the previous app.

Also, cleaned up some code.

Bug: 20953232
Change-Id: I714d6bdfcdaeeaac29f9d464bab9f3e9c192e937
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
827e0facfefd0c0033dcfb1747b4fa6f80f9e0e2 07-May-2015 Jorim Jaggi <jjaggi@google.com> Make sure the app can draw a frame before unlocking

- The mechanism to stop windows drawing while window animator was
animating was somehow flaky. It relied on the fact that the client
would call relayout() whenever the animating state changed. This is
mostly the case, but not for lockscreen animations. Instead, we now
use a push model, where window manager tells the app that the state
has changed.
- In addition, it only stopped drawing if that window was animating,
but then only resumed drawing after all windows have finished
animating. Now, we do this per window, so we only stop drawing for
windows that are currently animating.
- We resume the top activity now at the very beginning of the
unlocking sequence. This gives the app a chance to draw a frame
before the user sees anything. If it's to slow, then we just use the
outdated framebuffer.

Bug: 19964562
Change-Id: Ifef8abd189a3146d854b81b9b948861e4d38c155
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
389beec68d09883112ee5ef88f0b2fa2aa369824 12-May-2015 Adrian Roos <roosa@google.com> Only dispatch systemUiVisibility when it actually changes

Bug: 19000727
Change-Id: I9302746281188186d18256d45fee681bd2ab50d5
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b3b9eb3cfc5b3b3609a5d01258315798b38a5cf9 12-May-2015 P.Y. Laligand <pylaligand@google.com> DO NOT MERGE - Display mode switches.

Knowledge of the various modes of a display is now available to apps, and they can request a specific mode for their windows.

b/18241736

Change-Id: I8eb16ff713e878512faca3ca6662254f08a9be7f
(cherry picked from commit 5c7773d86484aac5737667c604bd8fe8150c2136)
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5b36c49aea35f418276becdbdf3d733ee11fd976 27-Apr-2015 tiger_huang <tiger_huang@htc.com> Use the correct parent size to initialize animations

The original logic would use out-of-date parent sizes to initialize
animations. If the screen size is changed after assigning mAnimDw and
mAnimDh in the constructor of WindowStateAnimator, the fromDeltaY
(in the most cases) of TranslateAnimation would be initialized
incorrectly.

In this change, we always use up-to-date parent sizes to initialize
animations to prevent the issue.

https://code.google.com/p/android/issues/detail?id=170348

Change-Id: Ib9c609121228934bdb463263feb1924eb389c1d2
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
13428b5079e5b0c53efb2e5188f542fab1a7f91c 02-May-2015 Bryce Lee <brycelee@google.com> am f626c679: am a7f07fc3: Merge "Add configuration to allow animations during low power mode." into lmp-mr1-modular-dev

* commit 'f626c679fdd7e44c6cf0eb2d2f6be786636a90bc':
Add configuration to allow animations during low power mode.
f626c679fdd7e44c6cf0eb2d2f6be786636a90bc 30-Apr-2015 Bryce Lee <brycelee@google.com> am a7f07fc3: Merge "Add configuration to allow animations during low power mode." into lmp-mr1-modular-dev

* commit 'a7f07fc35ba647465503fe0cba3d4521b68d89c1':
Add configuration to allow animations during low power mode.
023de22cf2486f6c51b789c762439b6b1f026085 30-Apr-2015 Bryce Lee <brycelee@google.com> Add configuration to allow animations during low power mode.

On Android Wear, the stream ui needs to continue to be animated during
low power mode.

Bug: 20696607
Change-Id: I24a87eba8d86169d04a72012e0311357622db00a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.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/WindowManagerService.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/WindowManagerService.java
2ff8ca659ed8f78768a4872e569b203517d2bb0f 23-Apr-2015 Wale Ogunwale <ogunwale@google.com> Merge "Fixed bug with black background when exiting a wallpaper window."
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/WindowManagerService.java
a48a8db90ffd6f2439fd5ee2db59d9807ed9ba00 22-Apr-2015 Wale Ogunwale <ogunwale@google.com> Fixed bug with black background when exiting a wallpaper window.

* Defer hiding the wallpaper until all animations are done. We were
previously hiding the wallpaper once the closing app animation is
done which leads to the background of the opening app animation
going black since there is nothing to show there.

* Don't set the wallpaper_close_enter animation blackground
to black. This will also cause the background of the opening app
animation to go black once the wallpaper closing app animation is
done.

* Don't set task_open_enter animation blackground to black. This
can cause an undesired black frame during transition if the new
task is created on the home stack instead of an application stack.

Bug: 17098816
Bug: 19454410
Change-Id: I0e63d72b1748d7d2424119b3176f48476293af92
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
62b5b02c4f80bed47f8e2c542d4aa2d7bbeb7c08 17-Apr-2015 Mady Mellor <madym@google.com> Merge "Drag n drop for stylus"
f647832bd4ca9c083aa2748f2a21bc433cb26be3 17-Apr-2015 Jeff Brown <jeffbrown@google.com> Merge "Add support for disabling display scaling for development."
e40d785b7ab7aba533862181abcd95e06de13eb9 16-Apr-2015 Mady Mellor <madym@google.com> Drag n drop for stylus

This assumes the gesture used to initiate the drag and drop would be a
stylus touch + button press. This enables stylus users to drop an item
by releasing the button, if it was pressed at the beginning of the drag n
drop. Users could still lift the stylus from the screen to end the drop.

Bug: 19621008
Change-Id: I01051f541bedf006480d46e728498a20f153b322
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
d46747a1c64b6ca3282e8841833980ab91829436 16-Apr-2015 Jeff Brown <jeffbrown@google.com> Add support for disabling display scaling for development.

Added two new options to the wm command.

1. Set the screen size based on dips rather than pixels using the
current screen density.

eg. adb shell wm size 320dpx320dp

2. Disable automatic scaling of the contents of the display.
When combined with the previous command, this is useful for seeing
how the UI would behave if the screen remained at its current density
but changed physical size.

eg. adb shell wm scaling off

Bug: 19899223
Change-Id: I545f893ba4861494e995cf0457ebeba1050d28dc
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
792ae337758786c8efa793c3e28ecc63170e1a81 09-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am 33a68a52: am 343e291b: am e8a3c320: Merge "Prevent windows from freezing screen while timeout"

* commit '33a68a521f77a2070832ece271d1047ecf56de7e':
Prevent windows from freezing screen while timeout
343e291b67432427709a20e97f42fbc329c45c44 09-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am e8a3c320: Merge "Prevent windows from freezing screen while timeout"

* commit 'e8a3c320e658f6c7f8d1db3d8ad3c3f189c0f54e':
Prevent windows from freezing screen while timeout
951e27f344996ee8cba4d6defbe5e4fab3a08284 07-Apr-2015 tiger_huang <tiger_huang@htc.com> Prevent windows from freezing screen while timeout

The original logic lets windows be able to freeze screen again (by
setting win.mOrientationChanging=true) after WINDOW_FREEZE_TIMEOUT is
triggered before mInnerFields.mOrientationChangeComplete is set to
true. In this case, we would lose the protection of
WINDOW_FREEZE_TIMEOUT. If the app never finishes drawing the window,
the screen would keep freezing that the user cannot operate the
device.

Change-Id: I45a0a9e4b3f8d5b0b0043229bfa4890236ae8ab2
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4c8b7953f9d2b56477620124b3c0ce9e0d825cf2 07-Apr-2015 Wale Ogunwale <ogunwale@google.com> Revert "fix the flash caused by missing setMatrix() when surface size changes"

This reverts commit 7f97af11fba6a18ee6bc022f7197319ce54fa46f.
Change broke screen_on functionality when an alarm goes off.

Bug: 20096335
Bug: 18773834
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
bde7e467acf61516706c98a05edc23d25275b7ff 07-Apr-2015 Olawale Ogunwale <ogunwale@google.com> am d229f442: Merge "Add a timeout state to frozen windows"

* commit 'd229f442d5b8c2e600eaa4daeec0e771631ed83d':
Add a timeout state to frozen windows
3aacbbc02542a9694c706d02aa48b7bca1a8e3eb 06-Mar-2015 Craig Mautner <cmautner@google.com> Add a timeout state to frozen windows

When an activity stops drawing following a rotation the rotation
screenshot would become stuck on top of all the other windows. The
timeout was being acknowledged but mWindowsFreezingScreen was set to
true which kept stopFreezingDisplayLocked() from dismissing the
screen rotation animation.

By changing mWindowsFreezingScreen from a two state variable to a
three state variable, including a timeout state we allow
stopFreezingDisplayLocked() to continue and dismiss the screen
rotation animtion.

This change also reduces the APP_FREEZING_TIMOEOUT from 5 seconds to
2 seconds.

Bug: 15664090

Change-Id: Ida5aca002a82ec8fe1ea99f0ced814c5c8f01a95
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b9223015261afdec7e8686b732b298b809bf87dc 07-Apr-2015 Wale Ogunwale <ogunwale@google.com> Merge "Fixed bug with ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN not working"
91d4c1d97ad730c4a447a6c984d514cdbba1e4c6 07-Apr-2015 Wale Ogunwale <ogunwale@google.com> Merge "Enabled wait for wallpaper draw code, but reduced timeout to 500ms"
1f93cddda82401547cbd4f5a83e721315659b814 06-Apr-2015 Chong Zhang <chz@google.com> Merge "fix the flash caused by missing setMatrix() when surface size changes"
3fcb4a89750d6df42f850021cd754500fc084086 06-Apr-2015 Wale Ogunwale <ogunwale@google.com> Fixed bug with ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN not working

There were a few places in ActivityManager and WindowManager that we
were not taking the value of the flag into account when deciding
which task to be up top in multi-user mode.

Bug: 10533764
Change-Id: If2032ccd5f1a67b3ad4af376b4db7043e9070796
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
7f97af11fba6a18ee6bc022f7197319ce54fa46f 05-Jan-2015 Chong Zhang <chz@google.com> fix the flash caused by missing setMatrix() when surface size changes

bug: 18773834

Change-Id: I16e2f896e6fd70e9b130bb55ecefa8c2f08c684a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f49c92fb0815d4cb54063108811d1788453dd7b9 05-Apr-2015 Wale Ogunwale <ogunwale@google.com> Enabled wait for wallpaper draw code, but reduced timeout to 500ms

Bug: 19999277
Change-Id: I4ad4ed722d359d2a88c496eb1749aae572b3d4ad
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b1e8e5e505c46f988706ba4b83159ba51bcbd77f 03-Apr-2015 Olawale Ogunwale <ogunwale@google.com> Merge "Remove debugging for bug 19823482."
eb0e38a812ace6134a2e029f8084f099b6d44318 03-Apr-2015 Craig Mautner <cmautner@google.com> Remove debugging for bug 19823482.

Change-Id: Ibedfb3353e6f7f64e39ad076b329d9cd9657fe5f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
787bacd35a9d53c76f27ba565e5d5d97f86b73fd 01-Apr-2015 Craig Mautner <cmautner@google.com> am a54f2b16: am 8bed4843: am d720dedb: Merge "Clear the previous states before setting the new app visibility"

* commit 'a54f2b164a4e162069709fd1f3b3fb7ff08dcd47':
Clear the previous states before setting the new app visibility
8bed4843dc7f93a30e607dbb11012a04ca5dcf95 01-Apr-2015 Craig Mautner <cmautner@google.com> am d720dedb: Merge "Clear the previous states before setting the new app visibility"

* commit 'd720dedb03dfc937361e7e722171f8a1b9d74cf1':
Clear the previous states before setting the new app visibility
a9da39e86d2a0c1b41b465f0c7a8550d841ce6a5 13-Nov-2014 tiger_huang <tiger_huang@htc.com> Clear the previous states before setting the new app visibility

If setAppVisibility() is called multiple times in a short interval
while the screen is turned off between the calls, the visibility of
the app would be wrong. For example, the user may see the app under
the launcher, not the wallpaper under the launcher.

The flow to the issue:
1. Screen is on.
2. AM calls setAppVisibility() token=App A's token, visible=true
3. Screen is turned off.
4. AM calls setAppVisibility() token=App A's token, visible=false

Note:
a. In 2., WM would put App A into mOpeningApps, and tell it to be
visible.
b. In 4., because the screen is off now, App A would not be removed
from mOpeningApps. App A might be told to be invisible directly
through setTokenVisibilityLocked(), but it would be told to be
visible again in handleAppTransitionReadyLocked() later.

Change-Id: Icf3d69031ea2822245008248ec8f12bd57218880
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
0b037e93fce761f923330432f51aba40f9a316c8 31-Mar-2015 Craig Mautner <cmautner@google.com> Merge "Remove one ANR cause and add logging for another"
cceeb58c13ee426254a8a25fdd2b9d7e844fdbe2 31-Mar-2015 Craig Mautner <cmautner@google.com> Remove one ANR cause and add logging for another

For bug 19823482.

Change-Id: Ic44c4fd11ef92546118b09526c97446a92a7b4e7
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8501866d7480da2251fd8ad29fe918cc0c05c451 30-Mar-2015 Craig Mautner <cmautner@google.com> Merge "Still more debugging for bug 19823482"
7258118c066db8319237a99a73908134adfc619f 29-Mar-2015 Craig Mautner <cmautner@google.com> Still more debugging for bug 19823482

Change-Id: I2a9270ebd0a31c9dc62732b67c640191549d396e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a38dd32a4011361f7f95c07857718b6aacda5286 26-Mar-2015 Craig Mautner <cmautner@google.com> Merge "Do not set visibility of unstarted activities."
2568c3abcbfc93838fbc8fff270da0ead8878b40 26-Mar-2015 Craig Mautner <cmautner@google.com> Do not set visibility of unstarted activities.

If an activity is started in the stopped state then it shouldn't have
its window manager visibility set to visible. It also should not have
its screen frozen.

Fixes bug 19823482.

Change-Id: I74637a8eefcc97d1ef4d8ea3c661dc7c0c322f59
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
293e3586cf41f44088bde37990b8120d88ac35ed 13-Nov-2014 tiger_huang <tiger_huang@htc.com> Clear the previous states before setting the new app visibility

If setAppVisibility() is called multiple times in a short interval
while the screen is turned off between the calls, the visibility of
the app would be wrong. For example, the user may see the app under
the launcher, not the wallpaper under the launcher.

The flow to the issue:
1. Screen is on.
2. AM calls setAppVisibility() token=App A's token, visible=true
3. Screen is turned off.
4. AM calls setAppVisibility() token=App A's token, visible=false

Note:
a. In 2., WM would put App A into mOpeningApps, and tell it to be
visible.
b. In 4., because the screen is off now, App A would not be removed
from mOpeningApps. App A might be told to be invisible directly
through setTokenVisibilityLocked(), but it would be told to be
visible again in handleAppTransitionReadyLocked() later.

Change-Id: Icf3d69031ea2822245008248ec8f12bd57218880
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4c133412546dc849d977c13784833c8b29e38d41 24-Mar-2015 Craig Mautner <cmautner@google.com> Merge "Debug for bug 19823482."
e571433a841766e1b872e5ed2b879d81f223e3f1 24-Mar-2015 Craig Mautner <cmautner@google.com> Debug for bug 19823482.

And a skosh of refactoring.

Change-Id: Id80046bb16b8da4bff5a74ae87004c078d57e67b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a2e8de74102a0db34aa240baaecb2421afd11a8b 24-Mar-2015 Olawale Ogunwale <ogunwale@google.com> am 357d4ec8: am 3e305491: am 000293c9: Merge "Layout the window to be displayed if it would be resized"

* commit '357d4ec8b75dc53371c8eb39663720db6c63a6e9':
Layout the window to be displayed if it would be resized
3e305491cc24669305e22875c1fea337faed0b2c 24-Mar-2015 Olawale Ogunwale <ogunwale@google.com> am 000293c9: Merge "Layout the window to be displayed if it would be resized"

* commit '000293c93b41f69857f228d085b6f44b9afa34b0':
Layout the window to be displayed if it would be resized
000293c93b41f69857f228d085b6f44b9afa34b0 24-Mar-2015 Olawale Ogunwale <ogunwale@google.com> Merge "Layout the window to be displayed if it would be resized"
44f388a3edea3d9148a3d2d444bba21a4f9cd9d6 24-Mar-2015 Qiwen Zhao <zhao@google.com> Merge commit 'ff4bdd0b'
21637018f9bb0b605c8dc7c406b1437997a7aa37 26-Feb-2015 tiger_huang <tiger_huang@htc.com> Prevent unexpected rotation while going back to keyguard

The original logic would let the app hidden by keyguard be able to
decide the orientation. While going back from a show-when-locked app
to keyguard, there would be a short time that keyguard is unable to
decide the orientation, which causes WMS uses the wrong orientation
from the wrong app.

https://code.google.com/p/android/issues/detail?id=155640

Change-Id: Ibc17bfe4603f68b241dc7380459ec9de42a3e259
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
26d577b08f4cbd4d44f9cfc8360849293e2f2d0c 23-Mar-2015 Craig Mautner <cmautner@google.com> am f8a2ba51: Merge "Prevent unexpected rotation while going back to keyguard"

* commit 'f8a2ba511ee2dc5360f323c71eff5e0f2465dd99':
Prevent unexpected rotation while going back to keyguard
1263b2f1f2c30f2c7a390f71bd87f91c9015c4c3 26-Feb-2015 tiger_huang <tiger_huang@htc.com> Prevent unexpected rotation while going back to keyguard

The original logic would let the app hidden by keyguard be able to
decide the orientation. While going back from a show-when-locked app
to keyguard, there would be a short time that keyguard is unable to
decide the orientation, which causes WMS uses the wrong orientation
from the wrong app.

https://code.google.com/p/android/issues/detail?id=155640

Change-Id: Ibc17bfe4603f68b241dc7380459ec9de42a3e259
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
c3debf29d68fa711a98027d60cb33a66305d1d0a 19-Mar-2015 Vladislav Kaznacheev <kaznacheev@google.com> Start respecting View.DRAG_FLAG_GLOBAL flag.

Respect flags passed to startDrag (they used to be ignored).
Allow global drag&drop for text views.

Bug: 19548858
Change-Id: I981cfd617ebc6f5f2d59ebded798c22dc4920d38
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
27eac1d58fe0b7ca3a2e27f5ed64eff232745f45 17-Mar-2015 Dianne Hackborn <hackbod@google.com> Add ability to get a screenshot for assist.

New flag you pass in to startSession() to say you want it,
new callback on VoiceInteractionSession to receive it.

Change-Id: I61fdcfdee41a60d46036a2ef16681a9b4181115a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
1b4e56ac36c4d01e1ab4d95bb80888c6b80d0fd3 13-Mar-2015 Andreas Gampe <agampe@google.com> resolved conflicts for merge of 1d67698b to master

Change-Id: I866d342320c34e91494b4c70f27d0b79ec33358b
ce389e00cf365c5b0beb986472b4b39683adbe91 13-Mar-2015 Olawale Ogunwale <ogunwale@google.com> am 2f952916: am 1b4933d1: Merge "Wait for visible wallpaper drawn before starting app transitions"

* commit '2f9529168974fb6ca3a70372fd802e845e015bfd':
Wait for visible wallpaper drawn before starting app transitions
1d67698bb4c67ffa934d45edf7d5415d582a3c90 12-Mar-2015 Olawale Ogunwale <ogunwale@google.com> am 53729e29: Merge "Wait for opening apps ready before stopping freezing display"

* commit '53729e2933540307b090e64ee89cbae26c67de8f':
Wait for opening apps ready before stopping freezing display
2f9529168974fb6ca3a70372fd802e845e015bfd 12-Mar-2015 Olawale Ogunwale <ogunwale@google.com> am 1b4933d1: Merge "Wait for visible wallpaper drawn before starting app transitions"

* commit '1b4933d10eea59b091f263ebb3723f4d59a85d2b':
Wait for visible wallpaper drawn before starting app transitions
737298b93efaaebec452fae32358cf36783d6887 12-Mar-2015 Prashant Malani <pmalani@google.com> am 276d1bc9: am a98c21a6: Make circular mask thickness configurable

* commit '276d1bc929485e53ba4d4e93d4cc3ded3fcc2fc3':
Make circular mask thickness configurable
53729e2933540307b090e64ee89cbae26c67de8f 12-Mar-2015 Olawale Ogunwale <ogunwale@google.com> Merge "Wait for opening apps ready before stopping freezing display"
276d1bc929485e53ba4d4e93d4cc3ded3fcc2fc3 11-Mar-2015 Prashant Malani <pmalani@google.com> am a98c21a6: Make circular mask thickness configurable

* commit 'a98c21a662040a8afa75a35bd882c292f7ed8414':
Make circular mask thickness configurable
4a7f8b99f82559e3a2fa02c5499a4d77cd79c707 16-Feb-2015 tiger_huang <tiger_huang@htc.com> Wait for visible wallpaper drawn before starting app transitions

If the opening app has wallpaper, when the closing app starts hiding,
the wallpaper would be revealed. It would be nice if we play the app
transitions while opening apps, closing apps, and visible wallpapers
are all drawn.

https://code.google.com/p/android/issues/detail?id=150811

Change-Id: I3c7d140f6f6e43e18119e48f9cab441ee96b17e5
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a98c21a662040a8afa75a35bd882c292f7ed8414 11-Feb-2015 Prashant Malani <pmalani@google.com> Make circular mask thickness configurable

Obtain the circular mask thickness as a dimension so that it can
be customized per-device.

Change-Id: Ied88f91424c5cf4f25dd1e78cf22f0fd7ea7b0a4
Signed-off-by: Prashant Malani <pmalani@google.com>
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
51a5a7ccf9bbaf8c37a4f0b3758d485e2af9d60d 10-Mar-2015 Craig Mautner <cmautner@google.com> Revert "Revert "Add a timeout state to frozen windows""

Insert correct bug id:

Fixes bug 15664090.

This reverts commit 1a07846d4d7f1665345a27da11d0f8d518b3b431.

Change-Id: Id5fd52acc47cb6f50485c14e75a448511d806ae4
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
1a07846d4d7f1665345a27da11d0f8d518b3b431 10-Mar-2015 Craig Mautner <cmautner@google.com> Revert "Add a timeout state to frozen windows"

Wrong bug listed on comment. Resubmitting with correct bug listed.

This reverts commit a75e3e0b44e31ee5d042480d3da8d13cad56dc5a.

Change-Id: I49cb364c44763fd2d0c120d6998281d38571050b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
473db6fdfbf838ad7506d17dd8f46f127cbe1dd7 17-Feb-2015 tiger_huang <tiger_huang@htc.com> Wait for opening apps ready before stopping freezing display

When the screen rotation is changing, we will freeze the display
until all the window surfaces are all drawn (this is not including
windows which have no surface). If the opening app's window surface
is created after we stop freezing the display, there would be no
waiting for the app, and the user would see the black screen.

In this change, we would not only wait for the windows which have
surface, but also wait for the windows about to have surface before
stopping freezing display.

https://code.google.com/p/android/issues/detail?id=150921

Change-Id: I7de4db8ca902236f3e9f730b04dbde681cf8c032
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a75e3e0b44e31ee5d042480d3da8d13cad56dc5a 06-Mar-2015 Craig Mautner <cmautner@google.com> Add a timeout state to frozen windows

When an activity stops drawing following a rotation the rotation
screenshot would become stuck on top of all the other windows. The
timeout was being acknowledged but mWindowsFreezingScreen was set to
true which kept stopFreezingDisplayLocked() from dismissing the
screen rotation animation.

By changing mWindowsFreezingScreen from a two state variable to a
three state variable, including a timeout state we allow
stopFreezingDisplayLocked() to continue and dismiss the screen
rotation animtion.

This change also reduces the APP_FREEZING_TIMOEOUT from 5 seconds to
2 seconds.

Fixes bug 19595913.

Change-Id: Ida5aca002a82ec8fe1ea99f0ced814c5c8f01a95
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
924a18baa254a5f73e8e38b5730b1acd1e7faf19 25-Feb-2015 Filip Gruszczynski <gruszczy@google.com> am cf8c112e: am 01dd0e86: Merge "Force translucency from windowIsTranslucent on SwipeDismissLayout." into lmp-mr1-modular-dev

* commit 'cf8c112ed87752d79a869de9426b5c5a950b5c43':
Force translucency from windowIsTranslucent on SwipeDismissLayout.
cf8c112ed87752d79a869de9426b5c5a950b5c43 25-Feb-2015 Filip Gruszczynski <gruszczy@google.com> am 01dd0e86: Merge "Force translucency from windowIsTranslucent on SwipeDismissLayout." into lmp-mr1-modular-dev

* commit '01dd0e86546a5bf815dd9a6e7cd4b7bf8e8f5719':
Force translucency from windowIsTranslucent on SwipeDismissLayout.
23958c6e2ffd4e76a88bc553fe2874d2f5f3f5e2 24-Feb-2015 Filip Gruszczynski <gruszczy@google.com> Force translucency from windowIsTranslucent on SwipeDismissLayout.

Bug: 18799741

Change-Id: Ifb05869f1bf080d7555d7728dc085c41cc2c277c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
53a29a90f35f72462c0d6ad650921d5566c1f8f0 24-Feb-2015 Wale Ogunwale <ogunwale@google.com> Added ActivityManager API and AM command to resize a task.

Also fixed issue with ActivityStackSupervisor.moveTaskToStackLocked()
functionality not working correctly.

Change-Id: Ia13f1e92a7c59ce6543c226533ac8ea623488290
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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.
24bec7ce7adc3c0d693cfadcb4b28f5fc41555ae 04-Feb-2015 Jorim Jaggi <jjaggi@google.com> Implement nice transitions for light status bar

- When the flag changes, apply an animation from the current value
- When the flag change is caused by an app transition, synchronize
the status bar animation with the app transition animation.
PhoneWindowManager calculates the timings based on some heuristics
of the app transition animations and supplies these timings to
StatusBarService.

Bug: 19233606
Change-Id: I4f99afba8f1eebb3524699ed4d7fbafee5463a37
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
378756154fce86b53e91746583bfe15996ef680b 19-Feb-2015 Jorim Jaggi <jjaggi@google.com> Stop app transition based on mAppWindowAnimating field

Bug: 19440051
Change-Id: Ic385eab15cca8c5b814dc9cdbfd2d2f79fd84b02
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
77ba4803a510717032181e7cf0beca9d07f09733 18-Feb-2015 Jorim Jaggi <jjaggi@google.com> Add AppTransitionListener

Introduces the concept of a listener to be notified about app
transition events. The only client at the moment is window manager
which notifies activity manager about completed transitions, but this
can be used for various clients, including the status bar.

Bug: 19233606
Change-Id: Ia6fec5837b6eb4db90f3cb1c999d3f157ba6dd4a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
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/WindowManagerService.java
b3b8fef9e3a84eb72028f458bf213ba9bf54d39d 20-Feb-2015 Wale Ogunwale <ogunwale@google.com> Revert "Defer tap outside stack until multiwindows"

This reverts commit baf6bef001a582fea275bf891294cf1fe9d5472e.

Bug: 19424251
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4f9796e02851d3595b31ed9e85ddb8ce4089457f 20-Feb-2015 Craig Mautner <cmautner@google.com> Merge changes Ib2def344,Ifd15736b

* changes:
Permit layout when stopped if reporting draw
Refactor computeScreenConfigurationLocked and more.
df337277186868fc7285549cc637403cb99a454e 20-Feb-2015 Wale Ogunwale <ogunwale@google.com> Merge "Fixed issue with focused stack frame not displaying in multi-window."
b605f4af143bd129ec84bdafe89400cdc022ddc2 18-Feb-2015 Craig Mautner <cmautner@google.com> Refactor computeScreenConfigurationLocked and more.

- Recognizing that computeScreenConfigurationLocked() only returned
false if mDisplayReady was false allows multiple code
simplifications.
- Make computeNewConfigurationLocked() always return a non-null
value.
- Remove unused Session parameter from removeWindowInnerLocked().
- Just allocate mForceRemoves one time.
- Since ADJUST_WALLPAPER_VISIBILITY_CHANGED was unused have
adjustWallpaperWindowsLocked() return a boolean.
- Remove unused long parameter from handleNotObscuredLocked().

Change-Id: Ifd15736b163ab6e989f8ca32cf8f94b316386216
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4fecab570da64a1956352aedf1b3245d3ba26030 19-Feb-2015 Bill Yi <byi@google.com> Merge commit '32acf753e8989766f67fd5300d3eb467f707cc79' into HEAD
aa8a9b711d84f8e5f0b97bcbf80ce023331ba993 19-Feb-2015 Wale Ogunwale <ogunwale@google.com> Fixed issue with focused stack frame not displaying in multi-window.

Problem was caused by getting the canvas from the surface while
within a transaction.

Also, cleaned up code a little so it is clearer what is happening.

Bug: 19249857
Change-Id: I9ff1f612bc8a58a0e0c7939dbb400d083d8a7039
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
7fe224e8e90b76ffe50685d0360f8648c576cbf5 17-Feb-2015 Craig Mautner <cmautner@google.com> Refactor to split computeScreenConfigurationLocked

Split into two methods, one that updates the Display and
another that updates the Configuration.

Change-Id: I7b503311da5bfddea2650cdb7dbb447e7a1d09cc
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b1193ade255385d899d81e8d62ceaa97c7d6aeb6 17-Feb-2015 Wale Ogunwale <ogunwale@google.com> Merge "Apply stack dim layer to entire screen for system windows."
498e8c92d71ff4ccfd2a77bdc53160e8dc93c7fe 13-Feb-2015 Wale Ogunwale <ogunwale@google.com> Apply stack dim layer to entire screen for system windows.

System windows like alert dialogs are attached to the currently
focused stack even when the stack isn't full screen. This causes
the dim not to apply to other visible stacks when a system
window is up. Change applies the dim to the entire screen for
system windows since they extend outside a resized stack.

Bug: 19332229
Change-Id: I94affa6a652326bf2cf14b1b8bf54862c111c540
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2447a40fce4e073c6f92926e4f83548367953055 17-Feb-2015 Craig Mautner <cmautner@google.com> am c8036cdc: am 5d8f2491: am 2a005f6f: Merge "Prevent leaking surfaces from exiting windows"

* commit 'c8036cdc602a35a415fd66370c7621bb957f657e':
Prevent leaking surfaces from exiting windows
c8036cdc602a35a415fd66370c7621bb957f657e 17-Feb-2015 Craig Mautner <cmautner@google.com> am 5d8f2491: am 2a005f6f: Merge "Prevent leaking surfaces from exiting windows"

* commit '5d8f249104a1798b6c55ae1de4e5ea36a4babd53':
Prevent leaking surfaces from exiting windows
713abc2879c21106eb806739cfd51c2a81a9b401 16-Feb-2015 tiger_huang <tiger_huang@htc.com> Prevent leaking surfaces from exiting windows

AM would set the exiting app to be invisible twice by calling
setAppVisibility(). If the screen is turned off during these calls,
the window surfaces of this exiting app won't be destroyed.

The flow:
1. Screen is on
2. App A is finished
3. AM calls setAppVisibility() token=App A, visible=false
4. WM sets a dummy animation to App A
5. WM marks App A's wtoken.inPendingTransaction=true
6. Screen is turned off
7. AM calls setAppVisibility() token=App A, visible=false
8. WM calls setTokenVisibilityLocked() directly (screen is off)
9. WM sends app visibility to App A's client (ViewRootImpl)
10. WM clears the dummy animation from App A
11. App A's client calls WMS.relayoutWindow() to be not visible
12. WM sets App A's window mExiting=true but not destroy its surface
13. App A's window surface leaks...

Note:
a. The call in 3. is from ActivityStack.finishActivityLocked
b. The call in 7. is from ActivityStack.resumeTopActivityInnerLocked
c. In 10., App A won't get the real animation while screen is off
d. In 12., App A's inPendingTransaction=true; WM takes it's animating
e. mExiting won't be cleared because App A has no animation to
trigger WindowStateAnimator.finishExit()

After applying this patch, WM would destroy the surface in 12. of the
above flow.

Change-Id: I18b79ba96695ec80d57a85dc15cf92a9e7d3a6ef
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
682c8e509b494b8cd221d65df8f5e1f10e5f7bf1 13-Feb-2015 Dianne Hackborn <hackbod@google.com> Merge "Update voice interaction layer for new UI design."
ae6688b09649447e57468b3e7935691bc09ec9b9 12-Feb-2015 Dianne Hackborn <hackbod@google.com> Update voice interaction layer for new UI design.

Can switch from a pure overlay at the top of the screen,
to interactive mode with the voice UI drawing at the bottom
and pushing its target activity up like an IME.

Add mechanism to get assist data to the voice interaction UI.

Add some basic visualization of the assist data, outlining
where on the screen we have text.

Add a test ACTION_ASSIST handler, which can propagate the
assist data it gets to the voice interaction session so
you can see what kind of data we are getting from different
apps.

Change-Id: I18312fe1601d7926d1fb96a817638d60f6263771
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
50dd4c1c591ce22922cee539a73d2e9b821d1c9f 13-Feb-2015 Chet Haase <chet@google.com> Merge "Add ClipReveal window transition for application launch"
10e23ab61b820fb3149b2f89003753d98ebd6a80 12-Feb-2015 Chet Haase <chet@google.com> Add ClipReveal window transition for application launch

Issue #19362772 Better material launch animations

Change-Id: Ic94fde910b6b5554ee954dfbbf374949f9eb189d
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
c431e89a8bc9fcc6e5beb6efacd1d30500f5e574 11-Feb-2015 Craig Mautner <cmautner@google.com> Refactor of wallpaper methods.

Also remove token from mWallpaperTokens in cases where it might
have been missed.

Change-Id: I90befbf368b65e8c3403d5958e14355b884801a5
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b10e33ff804a831c71be9303146cea892b9aeb5d 04-Feb-2015 Jorim Jaggi <jjaggi@google.com> Split up android.policy into framework.jar and services.jar 1/3

Change-Id: Ifd69f1f3dd308a7e17a1442e2f3950da8b03cec4
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e7cfceb58df4046162004bae2152de1f216329da 05-Feb-2015 Craig Mautner <cmautner@google.com> Code cleanup.

Change-Id: Ie12fea5db28633a95fec440eb7a8c5a5a8c45a1b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9d3de4cfb42519fefe9d8b03c38ba440bd6bc886 02-Feb-2015 Wale Ogunwale <ogunwale@google.com> Support for activity to opt-in/out of resizeable/multi-window support.

Bug: 19178148
Change-Id: I5819a71cdc48e0af4add11a6d4a503ec5cbe5d63
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
6b6838e9679852e3a39a924c2c1437bd429df8df 29-Jan-2015 tiger_huang <tiger_huang@htc.com> Layout the window to be displayed if it would be resized

This patch fixes an issue which caused the resumed app to get the
wrong insets at first.

https://code.google.com/p/android/issues/detail?id=120421

Change-Id: I38c58121465372d1d66a7a98e386b0396d7d0f89
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5d49712960a75907229623f79e75928cbeb4887f 28-Jan-2015 Craig Mautner <cmautner@google.com> Merge "Remove TYPE_UNIVERSE_BACKGROUND from system"
616c118f8e41d361da51ad3b0d510845b4f79636 28-Jan-2015 Tim Kilbourn <tkilbourn@google.com> am a8a4ce97: am 597bb696: Merge "Add a config for whether to start in touch mode." into lmp-mr1-dev
automerge: 0048355

* commit '00483559b3f5fbdb6bc28ac617fbc0eaea2aa503':
Add a config for whether to start in touch mode.
4baf8d9e9e15704d52668f968cdf9bfd9c1f301c 28-Jan-2015 Craig Mautner <cmautner@google.com> am 604a9e28: am 5426e7ae: Merge "Defer tap outside stack until multiwindows" into lmp-mr1-dev
automerge: bf6af73

* commit 'bf6af73de6b24e53e9656da75b542d2f8caa77e6':
Defer tap outside stack until multiwindows
165be0c70d128f0ece876d54e1c7e95ef04c6960 28-Jan-2015 Craig Mautner <cmautner@google.com> Remove TYPE_UNIVERSE_BACKGROUND from system

An experiment that is over and has been occupying space.

Fixes bug 18088522 item #7

Change-Id: Ib0fcaa24243ed9b0581143e1d5114c1fd2b0aa6e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
783f28691e27b7b116730fad4f9fd9c083bab283 27-Jan-2015 Wale Ogunwale <ogunwale@google.com> Merge "Support activities in the same process having different resources."
00483559b3f5fbdb6bc28ac617fbc0eaea2aa503 27-Jan-2015 Tim Kilbourn <tkilbourn@google.com> am a8a4ce97: am 597bb696: Merge "Add a config for whether to start in touch mode." into lmp-mr1-dev

* commit 'a8a4ce97b3dd901d047a436943e9f80e0e8be820':
Add a config for whether to start in touch mode.
a8a4ce97b3dd901d047a436943e9f80e0e8be820 27-Jan-2015 Tim Kilbourn <tkilbourn@google.com> am 597bb696: Merge "Add a config for whether to start in touch mode." into lmp-mr1-dev

* commit '597bb6968be56c1b8b0629ba89fec409084cc112':
Add a config for whether to start in touch mode.
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/WindowManagerService.java
96268545435c30d628b3644830d9e054d575d8c9 22-Jan-2015 Tim Kilbourn <tkilbourn@google.com> Add a config for whether to start in touch mode.

Bug: 18925810
Change-Id: Ic9b956cde380cffcad7ca229f1669692b1743e6d
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
bf6af73de6b24e53e9656da75b542d2f8caa77e6 27-Jan-2015 Craig Mautner <cmautner@google.com> am 604a9e28: am 5426e7ae: Merge "Defer tap outside stack until multiwindows" into lmp-mr1-dev

* commit '604a9e280e8273f6ed1f1a50724c0d510cf09bb0':
Defer tap outside stack until multiwindows
604a9e280e8273f6ed1f1a50724c0d510cf09bb0 27-Jan-2015 Craig Mautner <cmautner@google.com> am 5426e7ae: Merge "Defer tap outside stack until multiwindows" into lmp-mr1-dev

* commit '5426e7ae93e0e728e0e12bc98a02c957d464cfe0':
Defer tap outside stack until multiwindows
baf6bef001a582fea275bf891294cf1fe9d5472e 27-Jan-2015 Craig Mautner <cmautner@google.com> Defer tap outside stack until multiwindows

Taps outside of the stack boundary were causing the current app to
lose focus. This led to timeouts waiting for the app to respond.

Disabling the tap recognition keeps the focus from changing. It will
be reenabled for multiwindows.

Fixes bug 17721767.

Change-Id: Iad854b19979390e73b97239e489ad7ef82e03d47
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
e3119b7d353e71d1f94ddff932b722b4d285931e 21-Jan-2015 Craig Mautner <cmautner@google.com> Refactor removeApp and removeTask for last removals.

Move app token removal to the AppWindowToken class so cleanup can
be done locally. Move task removal to the Task class so cleanup can
be done locally. Call task removal when the last app is removed.
Merge actions done prior to method calls into methods.

Fixes bug 18088522 item #12.

Change-Id: I5ce85d2bb309ceb82bd7404e27a56a7c31cd7359
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a30dc1709e146ceb82035af1282743fe93fa4504 21-Jan-2015 Craig Mautner <cmautner@google.com> am f1eb1cdc: am d22c8d99: Merge "Revert "Remove debugging and skip InputMethod windows"" into lmp-mr1-dev
automerge: b880c75

* commit 'b880c75eeb48002169627a4b33dbafad3f047421':
Revert "Remove debugging and skip InputMethod windows"
b880c75eeb48002169627a4b33dbafad3f047421 21-Jan-2015 Craig Mautner <cmautner@google.com> am f1eb1cdc: am d22c8d99: Merge "Revert "Remove debugging and skip InputMethod windows"" into lmp-mr1-dev

* commit 'f1eb1cdc65376ea32ece4f7a4c750abe48c9f3c7':
Revert "Remove debugging and skip InputMethod windows"
db370e1cbad96bb40472b57dc5940203bd07278a 21-Jan-2015 Craig Mautner <cmautner@google.com> am 6673d09a: Merge "Remove debugging and skip InputMethod windows" into lmp-mr1-dev automerge: d9a79b5 automerge: 03d7cc3

* commit '6673d09a8a9bae0d5240d2fdd78b70b02e5af0a2':
Remove debugging and skip InputMethod windows
387f598ef95d0fe6850cbb902300ddad6d75ff67 21-Jan-2015 Craig Mautner <cmautner@google.com> resolved conflicts for merge of a3342991 to master

Change-Id: I6a26297c6ea7c312d0d152243172fb5472444936
f1eb1cdc65376ea32ece4f7a4c750abe48c9f3c7 21-Jan-2015 Craig Mautner <cmautner@google.com> am d22c8d99: Merge "Revert "Remove debugging and skip InputMethod windows"" into lmp-mr1-dev

* commit 'd22c8d9961340ba1b7d7601d1c99e2557b6a9f0b':
Revert "Remove debugging and skip InputMethod windows"
d22c8d9961340ba1b7d7601d1c99e2557b6a9f0b 21-Jan-2015 Craig Mautner <cmautner@google.com> Merge "Revert "Remove debugging and skip InputMethod windows"" into lmp-mr1-dev
6673d09a8a9bae0d5240d2fdd78b70b02e5af0a2 20-Jan-2015 Craig Mautner <cmautner@google.com> Merge "Remove debugging and skip InputMethod windows" into lmp-mr1-dev automerge: d9a79b5
automerge: 03d7cc3

* commit '03d7cc3c24e7d89d82394c9d0cfc8e0c3423687f':
Remove debugging and skip InputMethod windows
a3342991a74ee77800b6660c5e4aadb9a5f0674a 20-Jan-2015 Craig Mautner <cmautner@google.com> am cbb286b8: Merge "Do not defer removal for empty tasks or activities" into lmp-mr1-dev
automerge: 07317da

* commit '07317da6834cc35fe8fad519bb60f15ba68bcd48':
Do not defer removal for empty tasks or activities
03d7cc3c24e7d89d82394c9d0cfc8e0c3423687f 20-Jan-2015 Craig Mautner <cmautner@google.com> Merge "Remove debugging and skip InputMethod windows" into lmp-mr1-dev
automerge: d9a79b5

* commit 'd9a79b5ba9934429289a634bdd4ad1a375484184':
Remove debugging and skip InputMethod windows
ea343e5f673e540f5d2504fe8ac17606f0bd5d94 20-Jan-2015 Craig Mautner <cmautner@google.com> Revert "Remove debugging and skip InputMethod windows"

This reverts commit 668cae1d4724cf794571f1ee2a3e896984b97db7.

Too soon. I need this for debug.

Change-Id: Ibeaec0139f511cf389049bdb7dae368a7bd8186b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d9a79b5ba9934429289a634bdd4ad1a375484184 20-Jan-2015 Craig Mautner <cmautner@google.com> Merge "Remove debugging and skip InputMethod windows" into lmp-mr1-dev
07317da6834cc35fe8fad519bb60f15ba68bcd48 20-Jan-2015 Craig Mautner <cmautner@google.com> am cbb286b8: Merge "Do not defer removal for empty tasks or activities" into lmp-mr1-dev

* commit 'cbb286b8594c56161f2765023a73d8200e426f9b':
Do not defer removal for empty tasks or activities
0c4d81cf1350101687c5090b18c7a3c5bc1f348c 20-Jan-2015 Craig Mautner <cmautner@google.com> Do not defer removal for empty tasks or activities

It is possible for empty activities to be leaked if their last
window is removed before animations finish. This change keeps tasks
and activities from having removal deferred if they have no windows.

Fixes bug 19047432

Change-Id: If6562f46bbfcac9ba987e2c834a1d55a9a8f3766
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
668cae1d4724cf794571f1ee2a3e896984b97db7 14-Jan-2015 Craig Mautner <cmautner@google.com> Remove debugging and skip InputMethod windows

1. Remove debug for bug 17721767.
2. When adding activity windows based on base layer skip over
InputMethod windows.

Change-Id: I3600e9acd997002ce87d34df2af577cc7b648480
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e08049bcd89ef261a86c0e846337e9bb78f2cf10 15-Jan-2015 Craig Mautner <cmautner@google.com> am c6267735: am f387d3c8: am c8ba2e87: Merge "Place window at top when adding by base layer" into lmp-mr1-dev

* commit 'c626773562716168ce710320ce1e36d99fd6664a':
Place window at top when adding by base layer
c00fdf5f502fae71d7c3c55184f11806e8704da4 14-Jan-2015 Craig Mautner <cmautner@google.com> Merge "Refactor moveStackWindowsLocked()"
799bc1d383ea40637e88c4a9dba8671585202d99 14-Jan-2015 Craig Mautner <cmautner@google.com> Refactor moveStackWindowsLocked()

The method had multiple inner loops and was a less efficient form of
rebuildAppWindowsLocked(). Rewritten to use rebuildAppWindowsLocked()
and small other refactors.

Item #1 of bug 18088522.

Change-Id: If93fa961922c77c9f0af719e535ae5ca5d30fe59
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
dc1274c5d0c3b340bf08cc589b46da8caebe4a23 14-Jan-2015 Fyodor Kupolov <fkupolov@google.com> am f8db59de: am 207d7bd3: Merge "Run isKeyguardSecure under system privileges" into lmp-mr1-dev automerge: 562e87b

* commit 'f8db59de22cb29f68ace8303e15e71dabf2b39e5':
Run isKeyguardSecure under system privileges
c626773562716168ce710320ce1e36d99fd6664a 14-Jan-2015 Craig Mautner <cmautner@google.com> am f387d3c8: am c8ba2e87: Merge "Place window at top when adding by base layer" into lmp-mr1-dev

* commit 'f387d3c87a1730605726c48c7b2c2355b50f4935':
Place window at top when adding by base layer
f387d3c87a1730605726c48c7b2c2355b50f4935 14-Jan-2015 Craig Mautner <cmautner@google.com> am c8ba2e87: Merge "Place window at top when adding by base layer" into lmp-mr1-dev

* commit 'c8ba2e87a40eb70ad22c62b9768e7691e3ff3bc3':
Place window at top when adding by base layer
c8ba2e87a40eb70ad22c62b9768e7691e3ff3bc3 14-Jan-2015 Craig Mautner <cmautner@google.com> Merge "Place window at top when adding by base layer" into lmp-mr1-dev
cfb13798db73849ce1cef0ae5943dbb52703b590 14-Jan-2015 Craig Mautner <cmautner@google.com> Place window at top when adding by base layer

When addAppWindowToListLocked defaults to adding based on mBaseLayer
it went from the lowest window to the highest window looking for a
window whose base layer was larger and dropping the new window below
that window.

If the Home activity is the InputMethodTarget then when the home
ActivityStack moves to the back the InputMethod will follow. This
puts the InputMethod, with it's high base layer value below most
activities. If a new activity window is added using the mBaseLayer
rule above it was placed at the bottom of the window list below the
InputMethod window. Being at the bottom it never received focus and
input to the activity timed out causing ANR.

This change starts the mBaseLayer search at the top window and works
its way down looking for the first window whose mBaseLayer is less
than or equal to the new window's mBaseLayer and inserting the new
window above that window. This causes it to be placed at the top of
all activities even if the InputMethod is near the bottom.

Fixes bug 17721767.

Change-Id: I037064de7604b670841e985479eb5857b47af1d7
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f8db59de22cb29f68ace8303e15e71dabf2b39e5 14-Jan-2015 Fyodor Kupolov <fkupolov@google.com> am 207d7bd3: Merge "Run isKeyguardSecure under system privileges" into lmp-mr1-dev
automerge: 562e87b

* commit '562e87bdd5eb58a97cce2224c36443f8915fa7d8':
Run isKeyguardSecure under system privileges
562e87bdd5eb58a97cce2224c36443f8915fa7d8 14-Jan-2015 Fyodor Kupolov <fkupolov@google.com> am 207d7bd3: Merge "Run isKeyguardSecure under system privileges" into lmp-mr1-dev

* commit '207d7bd3a4aca3478910ec740a0c810868fbeabb':
Run isKeyguardSecure under system privileges
207d7bd3a4aca3478910ec740a0c810868fbeabb 13-Jan-2015 Fyodor Kupolov <fkupolov@google.com> Merge "Run isKeyguardSecure under system privileges" into lmp-mr1-dev
6245afc811a02d5c949d06ef076fc46672875232 13-Jan-2015 Craig Mautner <cmautner@google.com> am 31ae1730: Merge "Add debug for ANR" into lmp-mr1-dev automerge: 0f6da47
automerge: 9d82182

* commit '9d82182f0c97271323d039b51e9179d2f4f2fa74':
Add debug for ANR
9d82182f0c97271323d039b51e9179d2f4f2fa74 13-Jan-2015 Craig Mautner <cmautner@google.com> am 31ae1730: Merge "Add debug for ANR" into lmp-mr1-dev
automerge: 0f6da47

* commit '0f6da477cbf3232996770a17910d3e44a0b893ac':
Add debug for ANR
0f6da477cbf3232996770a17910d3e44a0b893ac 13-Jan-2015 Craig Mautner <cmautner@google.com> am 31ae1730: Merge "Add debug for ANR" into lmp-mr1-dev

* commit '31ae17309e8c79c4b1a7b63a9c4bb43ae0849de2':
Add debug for ANR
bcb6eb9e26c923333b25074d39722a5dfa8c0320 13-Jan-2015 Craig Mautner <cmautner@google.com> Add debug for ANR

Help for bug 17721767.

Change-Id: If863f3e6536be8af2c189dcc37d503c4d6b663b4
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
c87d162815f228cda3c2bc70022c54e332bee0e5 13-Jan-2015 Fyodor Kupolov <fkupolov@google.com> Run isKeyguardSecure under system privileges

In certain cases, isKeyguardSecure calls UserManager.getProfileParent, which
requires MANAGE_USERS permission.
Now the check is done under system privileges.

Bug:18765066
Change-Id: I6b23aedee06403d36523af5fee9c7db9659284b3
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b533d116ef9972373f34e721b7d4c4507920ff9d 08-Jan-2015 Craig Mautner <cmautner@google.com> am 0e2fdb43: Merge "Remove AppWindowTokens from exiting apps with task" into lmp-mr1-dev automerge: 62a32ee automerge: 125b725

* commit '0e2fdb43122c53c3a63bc3810c93c30083d92866':
Remove AppWindowTokens from exiting apps with task
0e2fdb43122c53c3a63bc3810c93c30083d92866 08-Jan-2015 Craig Mautner <cmautner@google.com> Merge "Remove AppWindowTokens from exiting apps with task" into lmp-mr1-dev automerge: 62a32ee
automerge: 125b725

* commit '125b725f46199b7058e437bb83f5d5179e1be73e':
Remove AppWindowTokens from exiting apps with task
125b725f46199b7058e437bb83f5d5179e1be73e 08-Jan-2015 Craig Mautner <cmautner@google.com> Merge "Remove AppWindowTokens from exiting apps with task" into lmp-mr1-dev
automerge: 62a32ee

* commit '62a32ee1dfff6921fd95c92068500af6b8b3f47e':
Remove AppWindowTokens from exiting apps with task
3d7ca31c9e4a076cef5339ae58d5cafb2efbbc8f 08-Jan-2015 Craig Mautner <cmautner@google.com> Remove AppWindowTokens from exiting apps with task

When the task is removed from a task stack in window manager any
exiting activities left in the stack were orphaned. This led to a
memory leak. Removing all task activities from those that are exiting
fixes this problem.

Fixes bug 18943737.

Change-Id: I0a5ea8d2d3be89af7ccaf01385a226a2eafdf507
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2d412c369f060a914da167f0cffa2d275cfbccee 19-Dec-2014 Olawale Ogunwale <ogunwale@google.com> am 796a1773: am 4fa039df: Merge "Layout the config-changed window if it has surface"
automerge: 9079259

* commit '9079259054359e45b9616afaa799439c9171c0e2':
Layout the config-changed window if it has surface
9079259054359e45b9616afaa799439c9171c0e2 19-Dec-2014 Olawale Ogunwale <ogunwale@google.com> am 796a1773: am 4fa039df: Merge "Layout the config-changed window if it has surface"

* commit '796a1773070fd13eca07bc4919f1c7cdf2d8a8e7':
Layout the config-changed window if it has surface
f73883f69d64efda2515b8d495e49e35211c92a1 10-Dec-2014 tiger_huang <tiger_huang@htc.com> Layout the config-changed window if it has surface

This patch fixes an issue which caused the resumed app to get the
wrong frame at first.

https://code.google.com/p/android/issues/detail?id=82242

Change-Id: I4483029326afca143e7921f3b9563da4f566d2e5
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f2cc4e95b561fe93010f921b67cf3107e467e9c5 09-Dec-2014 Svetoslav <svetoslavganov@google.com> am f477aeb3: am ed068f7c: am 3a0d878a: Ensure all events from a showing window are dispatched.

* commit 'f477aeb367f05a64a03ed09efc9e0a9d6f9a6ec2':
Ensure all events from a showing window are dispatched.
f477aeb367f05a64a03ed09efc9e0a9d6f9a6ec2 08-Dec-2014 Svetoslav <svetoslavganov@google.com> am ed068f7c: am 3a0d878a: Ensure all events from a showing window are dispatched.

* commit 'ed068f7c3047b3775647a6023c6960a4fc535144':
Ensure all events from a showing window are dispatched.
ed068f7c3047b3775647a6023c6960a4fc535144 05-Dec-2014 Svetoslav <svetoslavganov@google.com> am 3a0d878a: Ensure all events from a showing window are dispatched.

* commit '3a0d878ab56475276c61d574af7651820a5cea5a':
Ensure all events from a showing window are dispatched.
3a0d878ab56475276c61d574af7651820a5cea5a 04-Dec-2014 Svetoslav <svetoslavganov@google.com> Ensure all events from a showing window are dispatched.

Accessibility services may opt-in to introspect the interactive
windows on the screen. If window introspection is enabled there
is a case where some events from a showing window are received
before the updated window state from the window manager. Now the
window manager sends over the windows before notifying the app
for the focus change.

bug:18625996

Change-Id: Ic481e01efbe12dc92f090f799feeb236672fc7b3
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
596be3acca1985adeb91436278fce208b1f44f59 03-Dec-2014 Craig Mautner <cmautner@google.com> am a34a7d21: am 418eecb6: am dad92f36: Merge "Don\'t process windows belonging to unshown users" into lmp-mr1-dev

* commit 'a34a7d21a9593eee4550527029a0eff06e884e5d':
Don't process windows belonging to unshown users
a34a7d21a9593eee4550527029a0eff06e884e5d 03-Dec-2014 Craig Mautner <cmautner@google.com> am 418eecb6: am dad92f36: Merge "Don\'t process windows belonging to unshown users" into lmp-mr1-dev

* commit '418eecb6f870e4fc4dbb5715f61afd51827fe8a5':
Don't process windows belonging to unshown users
418eecb6f870e4fc4dbb5715f61afd51827fe8a5 03-Dec-2014 Craig Mautner <cmautner@google.com> am dad92f36: Merge "Don\'t process windows belonging to unshown users" into lmp-mr1-dev

* commit 'dad92f3668c8f153b4be946bed32c338c5fb6317':
Don't process windows belonging to unshown users
6ee618509a392adb183c2e70390cd9e2031ff0d8 03-Dec-2014 Craig Mautner <cmautner@google.com> Don't process windows belonging to unshown users

Add a test for whether a window will be shown to the current user.
Otherwise we wait to process windows that are drawn but will never
be shown. Consequently we end up in a layout loop that continues
to set pendingLayoutChanges at the point where "wallpaper and
commitFinishDrawingLocked true" message is generated.

Fixes bug 18510914.

Change-Id: Ib067b41b5f26b146ee6bdb16c2f3b07d20aa2c54
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4844f939b6e84059612fa1c13cf9219104bb6365 01-Dec-2014 Craig Mautner <cmautner@google.com> am b62b1b03: am 94dab3ae: am 9dba1073: Merge "Force additional layout pass after drawing" into lmp-mr1-dev

* commit 'b62b1b03792e7c583ec1a51a3d621deb51663414':
Force additional layout pass after drawing
b62b1b03792e7c583ec1a51a3d621deb51663414 01-Dec-2014 Craig Mautner <cmautner@google.com> am 94dab3ae: am 9dba1073: Merge "Force additional layout pass after drawing" into lmp-mr1-dev

* commit '94dab3ae5468e2c6325b47aa633d08dc7727198b':
Force additional layout pass after drawing
94dab3ae5468e2c6325b47aa633d08dc7727198b 01-Dec-2014 Craig Mautner <cmautner@google.com> am 9dba1073: Merge "Force additional layout pass after drawing" into lmp-mr1-dev

* commit '9dba10732802bf162c0098d2591aa284e55b7b5e':
Force additional layout pass after drawing
9dba10732802bf162c0098d2591aa284e55b7b5e 01-Dec-2014 Craig Mautner <cmautner@google.com> Merge "Force additional layout pass after drawing" into lmp-mr1-dev
0ea8edef69620e34a280cc3ea276d6a93aa3fe35 01-Dec-2014 Wale Ogunwale <ogunwale@google.com> am ea64d0be: am e05fbd69: am 997e632f: Merge "Added unique id to display devices and their settings." into lmp-mr1-dev

* commit 'ea64d0beea59e3350bea0c6fe8d7cef807f82601':
Added unique id to display devices and their settings.
ea64d0beea59e3350bea0c6fe8d7cef807f82601 01-Dec-2014 Wale Ogunwale <ogunwale@google.com> am e05fbd69: am 997e632f: Merge "Added unique id to display devices and their settings." into lmp-mr1-dev

* commit 'e05fbd6901eb8c89ea18fe90c15d69e7c17596ae':
Added unique id to display devices and their settings.
e05fbd6901eb8c89ea18fe90c15d69e7c17596ae 01-Dec-2014 Wale Ogunwale <ogunwale@google.com> am 997e632f: Merge "Added unique id to display devices and their settings." into lmp-mr1-dev

* commit '997e632f59b070dabf71d9e807847c0643da92ac':
Added unique id to display devices and their settings.
683f37db5c7169391db91ad1fbce45e18fa930ab 01-Dec-2014 Craig Mautner <cmautner@google.com> am 1764465d: am b5981aa8: am ee7c30e1: Merge "Avoid capture all black screenshot bitmap"

* commit '1764465d81ad194d00bab372d2bfa031d75d641a':
Avoid capture all black screenshot bitmap
1764465d81ad194d00bab372d2bfa031d75d641a 01-Dec-2014 Craig Mautner <cmautner@google.com> am b5981aa8: am ee7c30e1: Merge "Avoid capture all black screenshot bitmap"

* commit 'b5981aa8d18dbd952ff74a75f962d4ec98f38807':
Avoid capture all black screenshot bitmap
e3ca04839783c8cd30fe1009f041f81615adec5d 21-Oct-2014 tingna_sung <tingna_sung@htc.com> Avoid capture all black screenshot bitmap

Captured screenshot bitmap is all black one if none of windows is
surface shown.

Change-Id: I651b2ade1865926d61f945167d60219535fa8bf8
Signed-off-by: tingna_sung <tingna_sung@htc.com>
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ef68eaa9b1d8c526da5cac48a1e71e19a7339178 27-Nov-2014 Olawale Ogunwale <ogunwale@google.com> am 21aadfcf: am f5860728: am 87c5f362: Merge "Fix bad exclude region in landscape"

* commit '21aadfcf71c87b50aa2aff20d0a4e76aebfb9c38':
Fix bad exclude region in landscape
21aadfcf71c87b50aa2aff20d0a4e76aebfb9c38 27-Nov-2014 Olawale Ogunwale <ogunwale@google.com> am f5860728: am 87c5f362: Merge "Fix bad exclude region in landscape"

* commit 'f586072861850ade660e11eafa799f96314ce475':
Fix bad exclude region in landscape
87c5f3621037eda3c4d141e5681d4acbbaa13944 27-Nov-2014 Olawale Ogunwale <ogunwale@google.com> Merge "Fix bad exclude region in landscape"
361ca21acc0831a9f8bbb259bb30218c252a2aa0 20-Nov-2014 Wale Ogunwale <ogunwale@google.com> Added unique id to display devices and their settings.

The display setting saved to disk were using a localized name for
the key. This is an issue if the user changes languages after the
display settings have been saved. We now use the non-localized
name for the display to access the settings if it is available,
else we fall back on the localized name.

Bug: 18190800
Change-Id: I837c06a8935df10727229a1aa2bb6eeb3953707f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b66b12948d94434ca5eb751e15dafb7d23e305eb 26-Nov-2014 Craig Mautner <cmautner@google.com> am dae55017: am 1c48e302: am a7a99981: Merge "Fix Presentation window is removed on stack change"

* commit 'dae55017d828b3a74f272298bc604e93e039b0d0':
Fix Presentation window is removed on stack change
a1c489fe67a810b5801a9cbebf07be67febc21d4 26-Nov-2014 Craig Mautner <cmautner@google.com> am b4488629: am f9819b01: am 17fc8574: Merge "Sync focus stack frame and layer with focus app."

* commit 'b4488629815002cdb00d7c9d5cabbe07f802fd1d':
Sync focus stack frame and layer with focus app.
bcab95524da34d0962558ffb60d391ca53bd70c0 26-Nov-2014 Craig Mautner <cmautner@google.com> am b64b1dc8: am 77f8112d: am aed35d6b: Merge "Not include fullscreen opaque window on screenshot"

* commit 'b64b1dc8a1d65d352cebe86918501b13f1c03e1e':
Not include fullscreen opaque window on screenshot
dae55017d828b3a74f272298bc604e93e039b0d0 26-Nov-2014 Craig Mautner <cmautner@google.com> am 1c48e302: am a7a99981: Merge "Fix Presentation window is removed on stack change"

* commit '1c48e3029b41efea764520fee32c9085d1162a24':
Fix Presentation window is removed on stack change
b4488629815002cdb00d7c9d5cabbe07f802fd1d 26-Nov-2014 Craig Mautner <cmautner@google.com> am f9819b01: am 17fc8574: Merge "Sync focus stack frame and layer with focus app."

* commit 'f9819b011983f974f481b83a7e80d00569968900':
Sync focus stack frame and layer with focus app.
b64b1dc8a1d65d352cebe86918501b13f1c03e1e 26-Nov-2014 Craig Mautner <cmautner@google.com> am 77f8112d: am aed35d6b: Merge "Not include fullscreen opaque window on screenshot"

* commit '77f8112d526b60ccdc099dd418c8955d47b5418d':
Not include fullscreen opaque window on screenshot
a7a999816fed3e0bdd8e65a9b90f7fad2ca5ae16 26-Nov-2014 Craig Mautner <cmautner@google.com> Merge "Fix Presentation window is removed on stack change"
7641e817e55cb88130f0d9ece7de24067c0b4d06 26-Nov-2014 Craig Mautner <cmautner@google.com> Force additional layout pass after drawing

If AppWindowToken.allDrawn is changed from true to false an
additional layout pass is required to change WindowStateAnimator.
mDrawState from READ_TO_SHOW to HAS_DRAWN.

Fixes bug 18456175

Change-Id: Iddac657e5303a4154309889417374c0c6994c4df
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
17fc8574e55d542744f22e34bf1103bcfbefbc27 26-Nov-2014 Craig Mautner <cmautner@google.com> Merge "Sync focus stack frame and layer with focus app."
0735697c9d29874246ccd14164d6cf59708e6331 14-Oct-2014 tingna_sung <tingna_sung@htc.com> Fix Presentation window is removed on stack change

If an activity show a Presentation window and this activity is moved
to bottom or top, thus this Presentation window will be removed from
its display window list, and no chance to be added back into window
container; It will cause the incorrect state that Presentation window
is lost from secondary display window list(displayContent.mWindows),
but still exist in app token's window list(appWindowToken.allAppWindows);
Moreover, once this activity resume again, Presentation window is not
shown because it's lost.

In this way, don't remove non-target display app windows due to only
target(or called default) display windows are removed temporarily and
re-sorted then added back into window list later.

Change-Id: I8960ce191f6c662455cba5a0a5e6a1ff9ef03ae1
Signed-off-by: tingna_sung <tingna_sung@htc.com>
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b31cced065070049042a45973068a00a5da95bd8 25-Oct-2014 tingna_sung <tingna_sung@htc.com> Sync focus stack frame and layer with focus app.

Update focus stack frame/layer when focus app is changed to avoid
focus stack/layer isn't updated synchronously with focus app, it's
due to performLayoutAndPlaceSurfacesLocked() is not necessarily
called on focus app change; it will cause sending mismatching
TAP_OUTSIDE_STACK message if there is effectual incoming pointer
event, hence may also result in focus stack is changed again,
therefore erroneous focus app is set by ActivityManager at final.

Change-Id: Ia0ec9a543be887b51a3b29b3e62fdd471c15edf2
Signed-off-by: tingna_sung <tingna_sung@htc.com>
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a901f57580508e46e57cb87958e70120cb15c883 21-Oct-2014 tingna_sung <tingna_sung@htc.com> Not include fullscreen opaque window on screenshot

Extend the fullscreen meaning by adding opaque drawn check on
screenshot application; if there is a fullscreen window but not
opaque, we will continue finding behind windows; otherwise ending up
including behind windows. It's able to help avoiding capturing BLACK
screenshot bitmap.

Change-Id: I1c7e8f513c366688ea8001c3d0c799f3522f0ffd
Signed-off-by: tingna_sung <tingna_sung@htc.com>
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5664546fc179630abe4de4b3259713599fb32f45 21-Oct-2014 tingna_sung <tingna_sung@htc.com> Fix bad exclude region in landscape

Update DisplayContent.mBaseDisplayRect when device orientation is
changed, it avoids to set incorrect initial value of
mTouchExcludeRegion, that will cause result of calculated
mTouchExcludeRegion becomes an incorrect strange region on
landscape orientation.

Change-Id: I993864653edc2852f91abed7891e6631b4bae15a
Signed-off-by: tingna_sung <tingna_sung@htc.com>
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
6d354163cae182edea80b9d28471749b5e882180 20-Nov-2014 Riley Andrews <riandrews@google.com> [wip] Make the window animator rely on frameTime.

The window animator is looking at cpu time difference
whilst updating animations. Using the choreographer display frame
time will be a much more consistent way of estimating
the time between frames for animation.

Change-Id: If5c4034c6e1b017749d6f4ca727d564805672c39
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
316e369c4c053125faf9c78d42855f257cfe48a2 13-Nov-2014 Craig Mautner <cmautner@google.com> am 30bd3bb7: Revert "Debug for bug 18017409"

* commit '30bd3bb77b8bd1ac70723bcf7f1017fc40ea89b2':
Revert "Debug for bug 18017409"
30bd3bb77b8bd1ac70723bcf7f1017fc40ea89b2 13-Nov-2014 Craig Mautner <cmautner@google.com> Revert "Debug for bug 18017409"

The bug has been fixed. No longer needed.

This reverts commit 5a3c231dc832c205d2bb2f7f0881925b92c9e5e2.

Change-Id: I4a0dda5321f4eeb989c4c58951c43c8d62fd3664
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3ae0d3157d5fdeee851f3e72b80f4ed57add0ff8 07-Nov-2014 Wale Ogunwale <ogunwale@google.com> Fixed constant window switching on lock screen with Swype KB.

We allow TYPE_INPUT_METHOD windows to show on the lock screen.
These windows can attached other types of windows (For this
case the Swype KB was attaching a PopupWinow which will be
of TYPE_APPLICATION). This causes the popup window app token
to be added to the list of apps to be hidden on the lock
screen, thereby preventing the lock screen from been hidden,
which then causes a layout cycle(s). Now, we remove app
tokens for non-app windows from the hidden list in case it
was added by any attached widow they migth have.

Also, when we are updating window animations, set the
hideWhenLocked flag for windows that are IME tragets so
they don't go through unneeded cycles of having their
visibility policy set to hide/show/hide/show/...

Bug: 18021493
Change-Id: I3680256d41793f62def42fda00e26db1dcc990cc
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
c08eab81f30a3120ec0929d3508b4a78d498e1ff 11-Nov-2014 Craig Mautner <cmautner@google.com> Show error dialogs over apps that dismiss keyguard

Error dialogs absorb all input to ensure that they are not missed.
This can cause the screen to lock up if they are not displayed but
are still absorbing touches. This was what was happening when there
was an error dialog up at the same time as a phone call came in as
in b/17648830.

This fix recognizes when an app is dismissing the keyguard and
forces any error dialogs to be shown over such an app.

This also removes the private flags from the input system as they
are no longer needed.

Fixes bug 17648830.

Change-Id: I5c98b8265a1448b445fdb2f745fc78892f8656a4
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
37d7a68de7e353c31a3a4736054cd86f0e002eaf 06-Nov-2014 Adrian Roos <roosa@google.com> Fix inset hinting when adding window

Windows with FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS were
getting an incorrect content inset hint, because the
hinting didn't see the adjusted systemUiVisibility.

Also adds hinting for the stable insets.

Bug: 17508238
Change-Id: If9647277feb6811b15665b801accd896c51dbd12
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
044d52934e57a337665f707aa4be1d423ee3fb29 06-Nov-2014 Winson Chung <winsonc@google.com> Adding bounce animation for affiliated tasks. (Bug 16656169)

Change-Id: I39e4a57c4e6b707d15513dacde2d40c23bb05058
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9128396982233d6af49613231100f1bc4b6c477b 05-Nov-2014 Winson Chung <winsonc@google.com> Merge "Fixing crash in recents window transition. (Bug 18246975, 18159006)" into lmp-mr1-dev
276a6eb879801e7e7988ecb0e6f29241e9a52724 05-Nov-2014 Craig Mautner <cmautner@google.com> When keyguard exits use same anim for all windows

The entering animations were only applied to the incoming windows
one time. If those windows weren't drawn yet then they never had
an animation assigned.

Furthermore if a starting window was drawn in time it would get the
animation but its main window would not get it if it weren't drawn.
Even if an animation were assigned later they wouldn't be synced
with each other.

This change creates a single animation which is shared by all
incoming windows. As windows are drawn they can then animate with
the starting window.

(Also refactorings to eliminate redundant code and unnecessary
variables.)

Fixes bug 15991916.

Change-Id: I844d102439b6eda8c912108431916e04b12f7298
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ab79fce2e71b6816b2b88b826ca723b3591f1e26 05-Nov-2014 Winson Chung <winsonc@google.com> Fixing crash in recents window transition. (Bug 18246975, 18159006)

The recents transition requires synchronizing the thumbnail header (the bar
that animates on top of the window that is being scaled/cropped) and the
application window. This change simplifies the code and removes the notion
of having another animator manage the same surface, and instead ensures that
the thumbnail animation has the same duration and that the thumbnail animation
is deferred and cleaned up one frame after the app transition is complete.

Change-Id: If8f348afccf59327187e8498eb451ba066600a41
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5e2986ef2067fd24c10f100858d166353a46caba 03-Nov-2014 Casey Burkhardt <caseyburkhardt@google.com> am 2997285f: Merge "Disable circular display mask with color inversion" into lmp-sprout-dev

* commit '2997285f362349097882d1b31eb23cb867227192':
Disable circular display mask with color inversion
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/WindowManagerService.java
159da3dba8811017c683fcee26c795be1948b0c4 30-Oct-2014 Craig Mautner <cmautner@google.com> Merge "Add enter-animation-done callback for system windows" into lmp-mr1-dev
9c79504225f60c72c947220b6aca928f11279e1c 29-Oct-2014 Craig Mautner <cmautner@google.com> Add enter-animation-done callback for system windows

Existing hidden methods allow activities to be notified when their
windows have completed animating in. This change adds that capability
to system windows using a ViewTreeObserver callback since system
windows lack an activity token.

The first subsystem to use this is the UserSwitchingDialog which was
previously using a 250 msec timeout to dismiss the dialog. That
deadline was often missed leaving the user with no dialog on the
screen during the transition.

Fixes bug 16661752.

Change-Id: I70789e0d9c07112f275e76fb82850926305f290d
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
87023b8eea5101ca918da7745bae4908c65a0884 28-Oct-2014 Casey Burkhardt <caseyburkhardt@google.com> Disable circular display mask with color inversion

Causes WindowManagerService to only add a circular display mask on
qualified devices if the accessibility display color inversion
feature is turned off. When enabled, this causes a visual artifact.

Bug:18120660
Change-Id: I0b1ac08487098942e2e0dd2794905e845a70c1bc
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
c74b5723a4a368d572952ef52c92c5754b5fd26c 28-Oct-2014 Wale Ogunwale <ogunwale@google.com> Fix issue 6455374: Bad recent image on camera launch from lockscreen.

When transitioning from the lockscreen to the camera app,
the previous activity that was running before the screen was
locked is briefly resumed and then paused. During the pause
we take a screenshot of the activity for recents which ends up
being an image of the wallpaper, because the activity was
moved behind the wallpaper while the lockscreen is up. With
this change we no longer include the wallpaper layer in the
screenshot if it is layered on top of the window we are
targeting for the screenshot.

Bug: 6455374
Change-Id: I305950a32c176f55eeeb6358266746e32e848383
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
74fe6ce72dcbc7af501022e7617528c30a0983bb 28-Oct-2014 Craig Mautner <cmautner@google.com> Merge "Do not go through a layout if visibility is GONE" into lmp-mr1-dev
fa3515bd0d62bc55153f26cd9f0b93e077631514 23-Oct-2014 Craig Mautner <cmautner@google.com> Do not go through a layout if visibility is GONE

An unnecessary layout based on dimensions changing catches up
with us later when the next layout doesn't occur.

In this case
we layed out the Settings panel because visibility changed from
visible to GONE and the requested width/height didn't match the
current window width height. When the visibility changed back
to visible the dimensions matched and another layout was not
performed.

This fix delays the layout until the window becomes visible again.

Fixes bug 17681754.

Change-Id: I0a3ff9479dca93e78c5d3a3df40faceffc10ecbd
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
bd6fabe2ae535cf5d31fc7a1952e43ad6e653e2e 24-Oct-2014 Svetoslav <svetoslavganov@google.com> Merge "APIs for an accessibility service to put interaction tracking overlays." into lmp-mr1-dev
74ff66e26a4c901922524f221414c578186f92b5 23-Oct-2014 Craig Mautner <cmautner@google.com> am 5cd68ee4: Merge "Cherry pick task movement changes from aosp" into lmp-sprout-dev

* commit '5cd68ee4dfeaf74a31a0a62e5d0a60951cddc3bc':
Cherry pick task movement changes from aosp
fb1cf36aa739da5dbebc64e61900e9ff96134e26 23-Oct-2014 Bryce Lee <brycelee@google.com> resolved conflicts for merge of f03ba4f1 to lmp-mr1-dev

Change-Id: I9e4cabd2d8a34a348ae888f096c8d3c35226e960
5cd68ee4dfeaf74a31a0a62e5d0a60951cddc3bc 22-Oct-2014 Craig Mautner <cmautner@google.com> Merge "Cherry pick task movement changes from aosp" into lmp-sprout-dev
cbd84af39a329890013b0c3b6763280ba2ad78c9 22-Oct-2014 Craig Mautner <cmautner@google.com> Cherry pick task movement changes from aosp

The following cherry picks from aosp contain code that keep windows
tracking the task movement.

https://android-review.googlesource.com/#/c/111380/
https://android-review.googlesource.com/#/c/109930

Maybe fixes bug 15729183.

Change-Id: Ida69fe365b06025d119e32b22a8d04958cdbabf3
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5a3c231dc832c205d2bb2f7f0881925b92c9e5e2 22-Oct-2014 Craig Mautner <cmautner@google.com> Debug for bug 18017409

Log adding and removing windows. Log activity state changes.

Change-Id: I544be89ff9af6b13ffde70dedec291793b46a420
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
584a44517950204a04ef01345be70b33d8ba43f9 22-Oct-2014 Bryce Lee <brycelee@google.com> [Theater Mode] framework implementation through global setting

Bug: 17684570
Change-Id: I64a9c9c0620049cdfcca0150648fa201281f7178
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bb 14-Oct-2014 Svetoslav <svetoslavganov@google.com> APIs for an accessibility service to put interaction tracking overlays.

An accessibility service may register to observe the interactive windows
on the primary display. These windows are the one that has input focus and
ones a sighted user can touch. It is sometimes beneficial for an
accessibility service to overlay a window to intercept user interaction
and based on that introspect and perform an action on the windows that
are on the screen. This is problematic as overlaying a full screen window
that is touchable prevents the accessibility service to introspect the
content under this window.

This change adds a special type of window that only an accessibility service
can place which does not affect what an accessibility service can "see" on
the screen. Hence, even putting such a window full screen the service will
be able to interact with the other interactive windows it covers.

Change-Id: I053ccc3a5c6360a98dc40bdb172b54dab35d8b31
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5f978bfa0949d58a187dec0fe9ee6b341cb97c1f 20-Oct-2014 Adrian Roos <roosa@google.com> Merge "Retire RecentApplicationsDialog" into lmp-mr1-dev
8629784bbb31e5edace15dfe025317c708723ebd 10-Oct-2014 Yohei Yukawa <yukawa@google.com> Update config when "Show input method" is changed

This is a follow up CL for I2237ded850a0d4ab43ca441d0b7df1.

Seems that we still need to update config settings every
time when "Show input method" is changed.

BUG: 17666032
Change-Id: I480aeaa038bef9c3c20e8f0b36110e92a35809db
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9a64513c7fccc2a9cf331a384906a7669b29b3f4 08-Oct-2014 Adrian Roos <roosa@google.com> Retire RecentApplicationsDialog

Bug: 5162991
Change-Id: I429da977502f33e2091496f3a075b2c507a88e1f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
030a93feb896d228317eb8dba6a89743c4d26dd7 07-Oct-2014 keunyoung <keunyoung@google.com> ignore null TaskStack and continue layout for PRIVATE_PRESENTATION window

bug: 17677973
Change-Id: I2666a1c1cf8956e60d7261912da34d1999131eba
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8d05172112436a81bed6e4a0810f8914509d8a4d 01-Oct-2014 Dianne Hackborn <hackbod@google.com> More work on issue #17656716: Unhandled exception in Window Manager

Fix Slog.wtf to not acquire the activity manager lock in its code
path, so that it can never deadlock. This was the original intention
of it, but part was missed.

Now we can put back in the code to detect when strict mode data is
getting large (a little more targeted now to the actual problem),
and use Slog.wtf to report it. And as a bonus, when this happens
we will now clear all of the collected violations, to avoid getting
in to the bad case where IPCs start failing. So this should be
good enough for L to fix the problem, with wtf reports for us to
see if the underlying issue is still happening.

Finally, switch a butch of stuff in the system process from Log.wtf
to Slog.wtf, since many of those are deadlocks waiting to happen.

Oh and fix a crash in the settings provider I noticed in APR.

Change-Id: I307d51b7a4db238fd1e5fe2f3f9bf1b9c6f1c041
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
86ef70eb08b83fc41d0c8e124315d9ee9fea0ee4 01-Oct-2014 Winson Chung <winsonc@google.com> Fixing build (Bug 17381033)

Change-Id: I95a7c8167f82a4fe982bdc9588d5fbaf5a627d0b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
c12f57457411e67adf2c8acaad21b08c934e583b 01-Oct-2014 Winson Chung <winsonc@google.com> Merge "Fixing an issue with leaking starting windows. (Bug 17657878)" into lmp-dev
c11b19caef12c3199393b68ae36931a603337c05 01-Oct-2014 Winson Chung <winsonc@google.com> Fixing an issue with leaking starting windows. (Bug 17657878)

In some cases, when starting an animation while another starting window is visible,
the starting window is never scheduled to be removed. In that case, we try and
schedule the closing app starting window to be removed when we are starting the
transition to a new activity. This also partially addresses issues related to
leaking windows in b/17381033.

Change-Id: Id26525cd71380852f109ec2f55a4a60db5086ded
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
49a2edf92ab9b02762a2c183809fdee55b0fcf40 25-Sep-2014 Craig Mautner <cmautner@google.com> Call Surface.release() for starting windows

If the window maanger received BinderDied for a starting window
before activity manager then it would null
AppWindowToken.startingWindow and not go through the
PhoneWindowManager.removeStartingWindow call later. That meant that
Surface.release() was never called from
ViewRootImpl.dispatchDetachedFromWindow(). Which in turn meant that
graphics memory was being leaked.

This change notifies the PhoneWindowManager to go through the
removeStartingWindow path when the starting window gets removed for
any reason.

This change also ensures that scheduleRemoveStartingWindow is
always called with the window manager lock held.

Fixes bug 17381033.

Change-Id: Ic6860d0e1410c9bb5053d85ae21a08b11f573b6d
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
83a76db6c588ac0ecc713a9920b5a46448e3884c 24-Sep-2014 Craig Mautner <cmautner@google.com> Merge "Force layout and animation when display changes" into lmp-dev
9b5e824da70b6446a2e1418bc0cf1efaa33bd862 24-Sep-2014 Craig Mautner <cmautner@google.com> Force layout and animation when display changes

Each time that window manager gets a notification that a display has
been added, removed or changed, run a pass through
performLayoutAndPlaceSurfaces. This ensures that
WindowAnimator.animate() runs once so that the surfaces of remote
displays can be updated with their visibility.

Fixes bug 17533991.

Change-Id: If8745527df86c74da75fbe26b8a2a6fddeb74d2a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2fb173a34be19ac6886b923865fc6fd247e3990e 23-Sep-2014 Jorim Jaggi <jjaggi@google.com> Merge "Only wait for relevant windows when turning on the screen" into lmp-dev
dc9ead4409d784620c6c65a56ca083ff7dd817f0 23-Sep-2014 Jorim Jaggi <jjaggi@google.com> Only wait for relevant windows when turning on the screen

Bug: 17536119
Change-Id: Ibe8da9fdd52a1a46eb856425b28ffc4f505b2697
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3ee549ca2404067bb8b2fcbaa741ec118c76bf3e 23-Sep-2014 Jeff Brown <jeffbrown@google.com> Fix window manager policy state when waking from doze.

Once upon a time when the world was fresh and new, the heavens
had an easy rhythm. Day and night. Night and day. In the day,
the pixel fairies would cavort and play in the bright gardens
with narry a mark of shadow or gloom. In the night, they would
rest peacefully, dreaming no dreams and knowing no fear.

Then one night a fairy dreamed the first dream. At first
the dream was peaceful, full of colors and delight, hopes and
memories. Then all at once, jarringly, it awoke in bright
daylight. The pixel fairy knew fear, for the world had changed
and it was unprepared.

Time passed and the pixel fairies grew accustomed to their
fate, day and night, night and day, sometimes dreaming, until
there came a night when a fairy did not sleep. It roamed
the land in a dreamless doze, lost and afraid amid a grim haze
of grey and darkness. The fairy despaired. It wanted no
part of this place. It pretended for a time to be awake but
the bright daylight would not come. It pretended for a time to
be dreaming but the colors and memories would not come.
That is when the fairy wished for oblivion. Then just as
suddenly, it awoke in the daylight. It fell to the ground,
stunned as if it had forgotten how to walk in the too bright
daylight.

Though the world again grew softer and kinder in time, the pixel
fairies were never the same. For the night is dark and full
of terrors.

---

It used to be easy. Screen on and screen off could explain almost
everything about the state of the device but it's different now with
ambient display. We need to be able to wait for all windows to be
drawn even in the case where the device is still nominally asleep.
In truth, the window manager policy which drives a lot of these
interactions is a thicket of outdated assumptions.

Added a new method to tell the window manager policy when the screen
is being turned off so that it can correctly account for changes
to the interactive state (wakeUp and goingToSleep) and screen state
(screenTurningOn and screenTurnedOff). Now we can independently
poke keyguard during interactive state changes and we can apply
screen on blocking during screen state changes.

Moved the code which manages screen on blocking (which is what
ensures the UI has fully drawn before revealing screen contents)
from the power manager to the display manager since the display
manager is in a better position to accurately track the state of
the screen, particularly when the screen is being turned off.

Fixed a bunch of synchronization issues. Previously some work
had been moved to a handler without considering what might
happen if it became reordered relative to other work happening
elsewhere. Documented the desired behavior in the code to
prevent this from happening again.

There's still a bunch of stuff in here that isn't quite right,
particularly the assumption that there's only one screen, but
it's good enough for now. Hopefully there aren't too many bugs.

Bug: 17605802
Change-Id: Ic7319e09948c8a3cda014d7e169c964a3ad86f14
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
6e53b7476e9a1b1ecc30488252e183cff114ad0b 20-Sep-2014 Jeff Brown <jeffbrown@google.com> Merge "Decouple turning screen on from waking up in policy." into lmp-dev
0ed82e2c21f861ac4e1e6ae3f3fa821886a55a41 20-Sep-2014 Dianne Hackborn <hackbod@google.com> Work on issue #17381033: Program icon and shortcut disappear after...

...running monkey test overnight [FACTORY ROM BLOCKER]

Add surface tracing to debug output.

Change-Id: I65f7fc90c51b0805f7e0090141c33d6b60ccb3b4
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
36c4db8bd3bd7dad4b6cb8abd9cdc1a627fe3bbc 19-Sep-2014 Jeff Brown <jeffbrown@google.com> Decouple turning screen on from waking up in policy.

This allows us to ensure windows are fully drawn before unblocking
screen on while dozing.

Bug: 17516245
Change-Id: Ibe63c212b8db855ce26a34a8169f33764b266ee6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
397157ce9cf73762170e0289f04a0788f4e50691 18-Sep-2014 Winson Chung <winsonc@google.com> Additional check to determine insets for recents animation

Bug: 17555722

Change-Id: I1474de7960dfebbdd32f159ace6677019a6b87a5
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a59e62341ceb4f27aa1dc8a664efba42d00d668c 14-Sep-2014 Michael Wright <michaelwr@google.com> Add config option for permanent dpad presence.

Since all TV devices are required to have a DPad as a form of
navigation we should suppress any configuration instances where it
claims one doesn't exist just because it isn't currently connected.

This prevents applications from going through a configuration change
and potentially an app restart when a remote disconnects to save
battery.

Bug: 17493314
Change-Id: Ice87b7056984afe02917ccba9196fdbcac9985fc
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
20d97e1ce20a4db23fb1b9799f29744878ecee22 12-Sep-2014 Craig Mautner <cmautner@google.com> Merge "Add null checks to WindowState.getStack() calls." into lmp-dev
41a7b7911eb7f1253c9037e70a6ffca9c535898d 12-Sep-2014 Craig Mautner <cmautner@google.com> Add null checks to WindowState.getStack() calls.

Fixes bug 12786011.

Change-Id: I7fed856f8c96eec47df0912cea9bce705ecf690a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2f67e237383ae6e76c44333ab79c6f0d1e3e568d 11-Sep-2014 Svetoslav <svetoslavganov@google.com> Merge "Windows for accessibility with wrong coords on rotation." into lmp-dev
b180d7707ffc2671caf494f2110b8942cedb5521 11-Sep-2014 Svetoslav <svetoslavganov@google.com> Windows for accessibility with wrong coords on rotation.

We were handling rotation changes for accessiblity in the window
manager too early, before the rotation animation completes. This
lead to wrong window positions being reported to the accessibility
layer. Now we handle rotation for accessibility when the rotation
changes, if we will not animate, or after the rotation animation
completes.

bug:17457240

Change-Id: Ia772f4886bfdbe0f9bc9003c12f36b2fbd6f45ec
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
6e2f395a86d557d2de4b52dda419a5f3eee00c84 09-Sep-2014 Craig Mautner <cmautner@google.com> Wait for animation complete before completing boot

Defer the boot process in ActivityManagerService,
WindowManagerService and PowerManagerService until the boot
animation has completed.

Fixes bug 16309312.

Change-Id: Ic5e0d627ca4ded3e211c5d2afece89da40d34642
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
0b81adcaea4acd2968947efa516321e6378dd51d 09-Sep-2014 Riley Andrews <riandrews@google.com> Merge "Use surfaceflinger for recents thumbnail rotations." into lmp-dev
8fd30e4486376b6cf7dd9af14d2e16428b22844f 09-Sep-2014 Griff Hazen <griff@google.com> Merge "Add support for a circular bitmap overlay for round android wear emulator." into lmp-dev
bb8c4834613207cf880e8491b33eb495cc268548 09-Sep-2014 Dianne Hackborn <hackbod@google.com> Merge "Add new wallpaper features for insets and offsets." into lmp-dev
7fb614664707f4c67dbbad8320e7d3cc10750df1 09-Sep-2014 Griff Hazen <griff@google.com> Add support for a circular bitmap overlay for round android wear emulator.

Android wear emulators have never had support for enabling both gpu
emulation and also having a round clip overlay present. Fix this by
supporting a drawable overlay when the ro.emulator.circular system
property is set.

Bug: 13415409

Change-Id: I6e0840ebe5c77adb786a7ba7ec6af348308ca46a
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
1d13406538b79785d2d0928689b8d5037e851ecf 22-Aug-2014 Riley Andrews <riandrews@google.com> Use surfaceflinger for recents thumbnail rotations.

+ This removes 30ms of latency on app to home transitions
on volantis.
Change-Id: Ia3747b8f8be0d41b9b3d095753edfe1df185c84d
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
b3fdbac020f767e36dc3d63887c8f64d809096a9 08-Sep-2014 Craig Mautner <cmautner@google.com> Merge "Lock down window manager while changing opacity" into lmp-dev
6f61204bcaa05ed846f67fd63769f63518e9ae85 07-Sep-2014 Craig Mautner <cmautner@google.com> Lock down window manager while changing opacity

Surfaces were being modified after destroy(). The check for mSurface
being null was not done while holding window the window manager lock.
This change adds locking to the surface modification methods.

Fixes bug 17383628.

Change-Id: I12ebbddc0f2cd7b43659370fac2c4fb053999bb5
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2e7f3bdcc9ec0b3e95b565b943ecee2210f4b937 05-Sep-2014 Winson Chung <winsonc@google.com> Removing unnecessary delays, ensuring transition thumbnail is the size of the header. (Bug. 16987565)

Change-Id: Ic104876c5fe16997eca00e0a2b3d8644c927120c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
18aa9f65fd27aa3d5322dd669b52c8cc1c4d9b5a 04-Sep-2014 Michael Wright <michaelwr@google.com> Merge "Add support for SW_CAMERA_LENS_COVER." into lmp-dev
3818c9261ceaa3a700ff984fbcd245faeede38d7 02-Sep-2014 Michael Wright <michaelwr@google.com> Add support for SW_CAMERA_LENS_COVER.

This allows for magic cover type accessories to launch the camera application.

Bug: 16034563
Change-Id: I0a46ef885737d964a1482c99f41145053d559faf
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d09def75110ea9833e3985ce33a878a471a8a0dc 02-Sep-2014 Jorim Jaggi <jjaggi@google.com> Fix outdated time when turning on screen

Force a synchronous update of the clock view when turning on the
screen. Also wait for the Keyguard window to be drawn when turning
on the screen.

Bug: 16904617
Change-Id: I38f78a38cfe35ccd067cd420d2bad626bd955ad6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b4558e7e5f33ee4964c5395b2dc017509ebf3f1a 02-Sep-2014 George Mount <mount@google.com> Merge "Update window always on convertTo/FromTranslucent" into lmp-dev
85b764e22babfe5508286fbad5d7fee12345704f 27-Aug-2014 Craig Mautner <cmautner@google.com> Update window always on convertTo/FromTranslucent

Previously we would only update the window if the activity's
translucency was changed. That meant that if the window was
opaque for a translucent activity, transitioning to translucent
would not change the window to translucent. This change forces
the window to follow the convertToTranslucent and
convertFromTranslucent calls.

Also fix for setting background on enter and exit transitions.

Partial fix for 16215650.

Change-Id: I86ea68e4bbf604d0cc60cc6e34bf8090199525d6
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4e1b6a4e59a198c3b984ff3fb4dcda2538aef795 27-Aug-2014 Craig Mautner <cmautner@google.com> Revert "Debug for 13924095."

This reverts commit 76309cd761a0f9d9e44435ba9a4bde8363ba9f7b.

Logspam no longer useful, just annoying now.

Change-Id: I826d383101077cc1bb341d4a3186ef98ed7e0c00
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a4ccb86ddc8f9f486aee25fb836f4aff97bf7679 23-Aug-2014 Winson Chung <winsonc@google.com> Multiple performance changes to speed recents invocation/app launching time. (Bug 16987565)

- Reverting changes to the existing thumbnail transition to prevent breaking applications
that currently depend on that transition. As a result, we need to create a new, hidden,
aspect-scaled thumbnail transition, and instead use that thumbnail to animate the
recents header so that we don't have to wait to do that inside the Recents activity.

In order for this to work, we also have to ensure that the thumbnail surface destruction
is synchronized with the application that is currently closing (when going down to
recents) or opening (when coming back up). The current thumbnail is destroyed when the
animation ends, but that can be at least 1 frame before the surface for the animating
window is destroyed. We change this by deferring destruction of this thumbnail window
to the animation that is being closed.

Especially on the way up, not having to wait for us to hide the header before doing the
transition up can save us the duration of that first animation (> 100ms).

- Other optimizations:
* No longer creating a new stack view on each transition to calculate the target rect
* Removing unnecessary call to get the thumbnail when transitioning up/down (the actual
window does its own animation.
* We reduced numerous system calls per task by adding a flag to ignore home-stack tasks
and caching the activity label and icon (and task description icon). These caches
follow the same eviction schemes as the thumbnail and icon cache.

- Also tweaked the touch slop for the nav bar swiping gesture to prevent conflicting with
tapping on home (Bug 17109581)

Change-Id: Ica697aad788051a9203edd9351c583e1cb038a71
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
fd6989cd025ceb4c6c2c2aafc7bd98800173bbaa 20-Aug-2014 Riley Andrews <riandrews@google.com> Use the crop function in the surfaceflinger screenshot api.

- By having surfaceflinger crop the screenshot instead of
WindowManagerService, this greatly reduces the size of
of temporary screenshot buffers that tablets have to
allocate.
- App to home, App to recents times are improved noticeably.

Change-Id: Iff889cc8c57b157778fb16993a71546fd9abfc00
Bug 17006948
Bug 16987565
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
468fef687031f0d4f050bb001392fffc6ccf2c4b 19-Aug-2014 Michael Wright <michaelwr@google.com> Merge "Persist Show IME option." into lmp-dev
7b5a96ba8364d5c180780b2f878f5a2b949cfdac 10-Aug-2014 Michael Wright <michaelwr@google.com> Persist Show IME option.

Add a new setting to persist whether to show the IME when a hard
keyboard is connected.

Bug: 14066881
Change-Id: I2237ded850a0d4ab43ca441d0b7df13e0958e630
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
665366a3055c7baa36242b8c92c5ff85b1c3394b 08-Aug-2014 Michael Wright <michaelwr@google.com> Change 'disable hardware keyboard' to 'show input method'

Previously it implied that the hardware keyboard would be disabled,
but really the toggle would just enable showing the IME even if a
hardware keyboard was present. Changed the string and swapped the
semantics to be more clear about the behavior.

Bug: 14066881
Change-Id: I9c8a7eb98b5277f1d09cc19fa7402e9b4cf51d92
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
15ed2754a308546a54ab1061b4e365d6fe9b898d 19-Aug-2014 Dianne Hackborn <hackbod@google.com> Fix path for handling system window with app token.

It is wrong to turn the token into a null appWindowToken; we
need to create a new top-level token as if they had passed in null.

Change-Id: I870d8167c6ed456ea8fd58b149809ec9e0103bce
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
7c9ee19cbd0360a62dc4322169afc1b0b9c9e022 15-Aug-2014 Craig Mautner <cmautner@google.com> Fix race condition between binder deaths

If a Binder dies there is a race between activity manager and window
manager to see who can handle the binderDied call first. If the
activity manager wins the race it will remove the activity and task
but leave the windows around. Until the WindowState.binderDied call
is made and all animation is complete the windows will try to access
the task that they were associated with.

This fix removes the windows of an activity when the activity is
removed. It also defers removal of the activity and task until
exiting windows have completed their animation.

Fixes bug 17031518.

Change-Id: Idf52f55c5feb0cad4e3664ef2eae5b7e95bbf490
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
84a3e7aacf6dbeccf4afb36a29f2f069dca7d486 13-Aug-2014 Jorim Jaggi <jjaggi@google.com> Use different unlock animation when going to full shade

Also fixes a bug that the notify flag was not reset, and fix the
transition for the phone/camera affordance (in these cases, no
animation is needed).

Bug: 15991916
Change-Id: Idbb4fa40f86bda597cd66cc38da838ef4f75514d
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
eb829f2f9fa9348e85f1ff5e856e0525c53ddff6 13-Aug-2014 Craig Mautner <cmautner@google.com> Merge "Disassociate system windows from apps" into lmp-dev
a5d29971f8f4d463348e9de0f7af7e2e92a377a0 13-Aug-2014 Craig Mautner <cmautner@google.com> Disassociate system windows from apps

If an app launches a system window remove the app token.

Fixes bug 16825063.

Change-Id: I7c7403e0958f3cd9f6dd5e2964b2e9cabc51ded7
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8de4311c51229efbe2f2d0afbf298982c5cadd96 11-Aug-2014 Jorim Jaggi <jjaggi@google.com> Lockscreen launch animations

- Get rid of ActivityManager.dismissKeyguardOnNextActivity, which was
used for two different things: Dismiss keyguard from somewhere else
(not really necessary anymore), wait to actually dismiss keyguard
after the window behind is drawn. Instead, introduce
keyguardWaitingForActivityDrawn(), and change the semantics where
necessary.
- Make wallpaper_close_enter consistent with task_open_enter and the
Keyguard launch animation.
- Close the panel even on lockscreen when launching a notification.
- Block notification shade updates during the collapsing motion so
notification don't play the disappear animation immediately after
having launched a notification.

Bug: 15991916

Change-Id: I133c177b84e926c87c1a404ba93d633593fec3ab
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
76a1623afc170a13923b68f3256057d8adeb7937 08-Aug-2014 Jorim Jaggi <jjaggi@google.com> Preparations for lockscreen launch animations

- Update unlock animations to new spec to make the consistent with
lockscreen launch animations.
- Introduce disappearing motion for security views which runs before
we actually dismiss Keyguard.
- If a window is running the un-force-hide animation, treat as it
would have the wallpaper flag set so the wallpaper stays until
the animation is completely done.
- Run an animation on the wallpaper if the wallpaper is going away.

Bug: 15991916
Bug: 16234603
Bug: 15326120
Change-Id: I063aa4f269ddcf75b9a705e90f0c3056b541b642
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9a006258b5f0221323d7a4f0672b1604375119ba 08-Aug-2014 Craig Mautner <cmautner@google.com> Debug for 13924095.

Add logging for 13924095. All logging uses TAG "BadTokenDebug".

Change-Id: I3404e98d8c221cbd183845f479cf4074266b5cb2
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
7516ff90015ce71e5b95c889a2211153be30c39c 07-Aug-2014 Craig Mautner <cmautner@google.com> Keep app focus and input focus current

Change ag/422870 mistakenly set app focus to null in the
InputDispatcher. This change restores setting app focus correctly.

In addition, there were a few places where window focus
(i.e. mCurrentFocus) could be modified without notifying the
InputDispatcher. This change fixes those locations.

Should fix 14564396.

Change-Id: Ie24f3410fdd1f5f1eefbce02759fef4149e59620
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3f145a2f958320766ae9240c7a57debc20d578aa 23-Jul-2014 Michael Wright <michaelwr@google.com> Add supported refresh rate to displays

Change-Id: I51231dd6dd231d57dd1ac499349d6335121f07d5
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a631d49e0516632110aa26b37e61a710d6e91f18 06-Aug-2014 Craig Mautner <cmautner@google.com> Don't dismiss boot messages before keyguard is ready

Or you will expose the home screen.

Fixes bug 16371571.

Change-Id: Ib38a583189c570b44910548a9544b1e81c831119
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a87863a8bddb033ca9ace11e7d78932d70d08ce3 29-Jul-2014 Sander Alewijnse <salewijnse@google.com> Fix deadlock window manager and device policy manager.

Removed all communication from wm to device policy manager.
Added initialization of cache in wm by dpms.

Change-Id: Ifa0b8bfcd625464b156d5cc0fb66d342deda1c27
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8746a478abcfb3b0d73b156232051af1e8d21ce2 25-Jul-2014 Craig Mautner <cmautner@google.com> Create end of animation callback for Activity

Activities cannot draw while their entering animations are active.
This change introduces a callback, onEnterAnimationComplete() so
that activities can know when their draws will be effective.

Fixes bug 13658460.

Change-Id: Ic48540cd4c7e37538f10cb2dc0852aa3f55d11e1
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
85d514498488e079477d0ec789abedd721d4ed6f 25-Jul-2014 Prashant Malani <pmalani@google.com> resolved conflicts for merge of bc3699b1 to lmp-dev

Change-Id: I1b219b5b48afb08ce3704a4f064a85652d2d9339
bc3699b1c3e0b2d07adb0919ef2a418546a7838c 24-Jul-2014 Prashant Malani <pmalani@google.com> am b4dcc64f: Merge "Revert "Remove circular mask"" into klp-modular-dev

* commit 'b4dcc64fe6314b139ac17aa296419bbf153df2f6':
Revert "Remove circular mask"
a04ea61db5566f05d5c783b2f62614aa03005be9 19-Jul-2014 Prashant Malani <pmalani@google.com> Revert "Remove circular mask"

This reverts commit 2e8b27e898af3af1165a79e7c5f8b59f63f20a2f.

It also makes the circularMask option configurable via overlay.
It is set to false by default.

An offset dimension entry is also provided, for displays which have
a "chin". This is set to 0 by default.

Bug: 16380982
Change-Id: I16ec3e8d8882a6683c9155055944e5c2f5cd781e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e959e4a01773a0bd1f3fb76b4333e59f03fb2f5c 22-Jul-2014 Justin Koh <justinkoh@google.com> am a63272b4: Merge "Revert "Wait for all windows to draw before turning screen on"" into klp-modular-dev

* commit 'a63272b4b5eff16f4d6fae4730b8a7087563181c':
Revert "Wait for all windows to draw before turning screen on"
d2a1eec400128f39e1b223a720a88dbd395f3e6e 09-Jul-2014 Sander Alewijnse <salewijnse@google.com> Add Device Policy API to disable screen capture.

WindowManager will set secure flag on SurfaceControl for
all windows of a flagged user to prevent screen capture.
API is consistent with the camera disable API.

Change-Id: Ib180f67f1ad827b6f4aca2af615274256cce58f4
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4eee3cb1df309e794f653f9cfa2d95a5c475c86f 23-Jul-2014 Dianne Hackborn <hackbod@google.com> Finish toast app op.

It was half-done, the window manager would check it
when the window was added, but was not monitoring for changes
to its state like it does for the system alert op.

Change-Id: I0279c4ac6160062cd219372af4bd9d7e4e687460
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
368c5adaf7a1141bfee3cf622efbc7285e370979 23-Jul-2014 Craig Mautner <cmautner@google.com> Refactor window manager screenshot

For readability, and add rotation compensation.

Fixes bug 16142514.

Change-Id: I1156ec2e0f052f6dec56457d56efe95368f60d91
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f14e5a2fad4660ecca43fac1cea08e35f2b82b4d 22-Jul-2014 Craig Mautner <cmautner@google.com> Add empty ArrayList check.

Fixes bug 15768779.

Change-Id: I3e4c48aa0fff99025e9ba1725e3d1f3523749dbd
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
af13b025e9d7dcf262e13588c8471b7360ce4070 22-Jul-2014 Geoff Mendal <mendal@google.com> Merge commit 'e959e4a0' into lmp-dev

Conflicts:
services/core/java/com/android/server/wm/WindowManagerService.java
528b4b75729443f805617f9628b352f6854978cc 22-Jul-2014 Justin Koh <justinkoh@google.com> Revert "Wait for all windows to draw before turning screen on"

This reverts commit 0a589b929e18d05d1345d97283c3025058ddca18.

Change-Id: Ia73555cd7797b5d172f33db9f46ebc211af6fc1e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
75f317403f9bf7bbd3de8ec50868cb727f17ac45 17-Jul-2014 Justin Koh <justinkoh@google.com> am 77cdac05: Merge "Wait for all windows to draw before turning screen on" into klp-modular-dev

* commit '77cdac05ba80925f6cdc4c349af0fa7567c36146':
Wait for all windows to draw before turning screen on
efc81e7d5edaa096a90ec17516549f9df49899fa 17-Jul-2014 Craig Mautner <cmautner@google.com> resolved conflicts for merge of 75f31740 to lmp-dev

Conflicts:
services/core/java/com/android/server/wm/WindowManagerService.java

Change-Id: Ifdfe253c4b3410a6000fd5a7cdcd785adc80a47b
0a589b929e18d05d1345d97283c3025058ddca18 17-Jul-2014 Craig Mautner <cmautner@google.com> Wait for all windows to draw before turning screen on

Was previously only waiting for windows on the primary display to
draw which meant that windows on ActivityViews had not yet drawn.
This fix checks redraws all outstanding Surfaces before unblanking
the screen.

Fixes bug 15092354.

Change-Id: Id550db003a5f56931eb68464085596e47d25481d
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
bb742462781a73bb25516067c8fe6311c1c8a93e 08-Jul-2014 Craig Mautner <cmautner@google.com> Launch activity behind launching task.

Use ActivityOptions.makeLaunchTaskBehindAnimation() to launch tasks
behind the current task. Includes animations for launching and
launched tasks.

Fixes bug 16157517.

Change-Id: I0a94af70b4748592e94673b958ee824cfb3d7ec0
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e34560b21989eea54a139a0586d156ba573cc2ea 10-Jul-2014 Alan Viverette <alanv@google.com> Add accessibility action to open power long-press dialog

Also fixes an infinite recursion bug in the WindowManagerService
implementation of WindowManagerInternal.

BUG: 16129909
Change-Id: I4f9d32f4e6c3ad460652c5e5271540fa5032a1f5
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
43015f241ebc6a03e36af4d300a3dbceeb078771 24-Jun-2014 Craig Mautner <cmautner@google.com> Merge "Return to recents when coming from recents"
84984faf530e525b066e28710d0f9beb32142ec5 19-Jun-2014 Craig Mautner <cmautner@google.com> Return to recents when coming from recents

If a task is launched from recents then backing all the way
out of the task will return you to recents. Entering the task
in any other way (home, another activity, nav bar) will reset
this behavior.

Fixes bug 15703876.

Change-Id: I98dc36e4dbcb238d59e2175832076de7225bfdd9
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
13f6ea78b0aa98ffea6ea644770e4320ec9a2242 23-Jun-2014 Craig Mautner <cmautner@google.com> Avoid unnecessary timeouts.

And fix a couple of other inefficiencies.

Fixes bug 15444410.

Change-Id: Idad95d4e4d70bc7d2965e1bd6ff3d3135b73dd9c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2c43c339de5aaf4fef58aa9b5ac3af48609263a8 13-Jun-2014 Jeff Brown <jeffbrown@google.com> Resolve boot time dependencies related to the power manager.

This change fixes a bug where native daemons may try to communicate
with the power manager before it was fully initialized due to a race
between publishing the binder service and completing init().

The solution was to simplify the dependencies related to the power
manager. It turns out that most services that were passed in
init are not actually needed until systemReady. What remained
was a dependency on the activity manager to check permissions for
incoming calls. So now we start activity manager first.
However, the activity manager also depends on power manager for
wakelocks. To break the cycle, we now defer initializing the activity
manager's wakelocks until after the power manager has been started.

Cleaned up a bunch of boot-time service dependencies so that we
can have better confidence that they are correctly maintained.

Bug: 13884219
Change-Id: If08e2d7ccd44e7026a72441bb6bd5afd7bb9fffe
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
40190375408034b2b7dd1aef358086da2914051b 14-Jun-2014 Craig Mautner <cmautner@google.com> am 6fe2184b: Do not treat the dummy animation as an animation

* commit '6fe2184bf10362ac53db7e8f6a0be521ea59b054':
Do not treat the dummy animation as an animation
6fe2184bf10362ac53db7e8f6a0be521ea59b054 14-Jun-2014 Craig Mautner <cmautner@google.com> Do not treat the dummy animation as an animation

The dummy animation is a place holder. When the task stack is being
removed treating it as a true animation forced us through a path
where we deferred the detachment and made a call to tmpRemoveWindows.

Also replaced call to tmpRemoveWindows with a real remove windows
call. The tmpRemoveWindows call does not clean up the Session
and this leaves a surface on the screen.

Fixes bug 15591610.

Change-Id: I05f7bc276bfed2366bbcd8443c92a4bbbc8a4491
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
bc2a6dff1f0edfb2856377fbdb6378158621bd16 14-Jun-2014 Craig Mautner <cmautner@google.com> Do not treat the dummy animation as an animation

The dummy animation is a place holder. When the task stack is being
removed treating it as a true animation forced us through a path
where we deferred the detachment and made a call to tmpRemoveWindows.

Also replaced call to tmpRemoveWindows with a real remove windows
call. The tmpRemoveWindows call does not clean up the Session
and this leaves a surface on the screen.

Fixes bug 15591610.

Change-Id: I05f7bc276bfed2366bbcd8443c92a4bbbc8a4491
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
a46ac5094e51827e40080ddead6268edcf5d3982 13-Jun-2014 Craig Mautner <cmautner@google.com> Merge "Do not display unsecure windows behind dialogs"
c9457faeb6bf22ce8fc72bc61af5109a2b567c51 06-Jun-2014 Craig Mautner <cmautner@google.com> Do not display unsecure windows behind dialogs

If a dialog activity has FLAG_SHOW_WHEN_LOCKED set it will dismiss
the keyguard. Previously this would expose any full screen unsecure
windows behind the dialog. With this fix the dialog is displayed
over the wallpaper.

Fixes bug 15006623.

Change-Id: I85a6713c7647db52211bd0f7280010e859723710
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.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/WindowManagerService.java
04fcf1cabec82b7f2e349658ca764939f5641cc3 11-Jun-2014 Yohei Yukawa <yukawa@google.com> Merge "Show IME-related system IME dialogs over windows owned by the IME"
1ee99c4627eeae1a94ada9a884a76b726cf6ca4c 10-Jun-2014 Yohei Yukawa <yukawa@google.com> Show IME-related system IME dialogs over windows owned by the IME

The IME-related system dialogs should be placed over any window
owned by the current IME. However, the framework has taken only
the main window of the current IME has been taken into account.
As a result, the system has not been able to show its IME-related
dialog properly layer when the IME is showing its own dialog.

This CL addresses the above issue.

BUG: 5809660
Change-Id: I205321c7ed42516f36a4bf29dd6a159ac34fd5ec
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
7119c0719206b9bd3ee5b9ecb329e08ba9ac8d17 10-Jun-2014 Michael Kolb <kolby@google.com> resolved conflicts for merge of 1e6706ab to master

Change-Id: Ia8e8fdf5e13acca496bf7ff9916c9950d5b13e4e
1e6706abb23cd1196a7ef9dd1cc1939220ef7169 09-Jun-2014 Michael Kolb <kolby@google.com> am 4bdc93d6: Merge "Remove circular mask" into klp-modular-dev

* commit '4bdc93d63e9edc7840a227ea1824f1f7ac93933e':
Remove circular mask
d8883df650b77dba3be38fb2ca8980594b901461 06-Jun-2014 Dianne Hackborn <hackbod@google.com> am 87bc3c25: Merge "Improvements to low power mode." into lmp-preview-dev

* commit '87bc3c258d8be516bc0fcedeb6eec34088582061':
Improvements to low power mode.
eb94fa7975b1e8742f3b00cec6bd4f9d6b329e3a 04-Jun-2014 Dianne Hackborn <hackbod@google.com> Improvements to low power mode.

Add new public API for monitoring low power mode.

BatteryService now puts device in to low power mode when
battery level is low.

Window manager now watches low power mode to turn off
animations.

Modifying the animator scale now gets propagated to all
processes.

Change-Id: I8fa566994764ddd4e1977631e28381ab9409f8ee
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2e8b27e898af3af1165a79e7c5f8b59f63f20a2f 05-Jun-2014 Michael Kolb <kolby@google.com> Remove circular mask

Change-Id: I83b1caea100d28be2fca46dc0280b05e9b78da44
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f3f8a73a57a34b405e73c83af8f4d42e9592079c 04-Jun-2014 Craig Mautner <cmautner@google.com> am 05cd6c39: Merge "Force all windows to redraw before unblanking screen" into lmp-preview-dev

* commit '05cd6c39824653e0f7e8641444a7134e8cac72f4':
Force all windows to redraw before unblanking screen
8a0da0184f6c5c95d94ab6adfee79bace4040abd 01-Jun-2014 Craig Mautner <cmautner@google.com> Force all windows to redraw before unblanking screen

The screen turning on would show windows as they were when the screen
turned off. This fix forces all showing windows to redraw first and
only then allow the screen to turn on.

Fixes bug 15092354.

Change-Id: I52c3f47438176a5ac00ba9a4d5205b56a5aa48f9
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
22af5b842869abff5418263e6fb0b4b925077629 04-Jun-2014 Craig Mautner <cmautner@google.com> am 81dfc082: Merge "Force all windows to redraw before unblanking screen" into klp-modular-dev

* commit '81dfc082d2add8463469e3eac9db94d6d93005ce':
Force all windows to redraw before unblanking screen
228742d2781c2c6b924e2c2dc0ac2a6b62e33e10 01-Jun-2014 Craig Mautner <cmautner@google.com> Force all windows to redraw before unblanking screen

The screen turning on would show windows as they were when the screen
turned off. This fix forces all showing windows to redraw first and
only then allow the screen to turn on.

Fixes bug 15092354.

Change-Id: I349995bf6446d6c462dccdc2b599bab9ab0ab2c8
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
7a184985590e25c9b4a5b534953924d0abef5ef1 29-May-2014 Craig Mautner <cmautner@google.com> am b5b37c2b: Merge "Add methods to coordinate unlock animation." into lmp-preview-dev

* commit 'b5b37c2babe744acb002ed9b8556a9d9cd2202fc':
Add methods to coordinate unlock animation.
71ac80c46a1b094ad951e59c24791d9e9ef769bf 29-May-2014 Craig Mautner <cmautner@google.com> Merge "Revert "Modify task navigation to return to recent tasks." DO NOT MERGE" into lmp-preview-dev
b9a6c8ad99c7885dccc23223068c0a551f350cd5 29-May-2014 Craig Mautner <cmautner@google.com> Revert "Modify task navigation to return to recent tasks." DO NOT MERGE

This reverts commit 1a4e211e03f1f795d935058e27356a0e8bc5df7c.

Change-Id: Ia691b93347c7eb2395933e5a5ba385ea94e08d6f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
fdaaf91f356a1dcd960c48a5f0137869d561cb23 29-May-2014 Craig Mautner <cmautner@google.com> Merge "Revert "Modify task navigation to return to recent tasks.""
719e621186adc1ba5a365bddea01cbe73bb26b02 29-May-2014 Craig Mautner <cmautner@google.com> Revert "Modify task navigation to return to recent tasks."

This reverts commit 19174878e25ebfd8806595f83df7bdea1d239c07.

Change-Id: I98db2c9aa975495c5828b3d16b8b45f515e6a5fa
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
219d7a50fb7a269fe54dd9d70587c269d217336f 29-May-2014 Craig Mautner <cmautner@google.com> Merge "Add methods to coordinate unlock animation." into lmp-preview-dev
d3a5b916b1655c9a36d531afc8420fc5ca0ccfdd 29-May-2014 Dianne Hackborn <hackbod@google.com> am c2091a1f: Merge "Add system layer for voice interaction services." into lmp-preview-dev

* commit 'c2091a1fbc463941b3e42db36e369124ac3c1013':
Add system layer for voice interaction services.
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/WindowManagerService.java
00f535845bebe4fba1de77ebd0119c7c23197a4f 28-May-2014 Dan Stoza <stoza@google.com> Merge "SurfaceFlinger: Add sourceCrop to screenshot"
0d674623facfbd3e9c520d2be4ed98977b92a1a2 21-May-2014 Jorim Jaggi <jjaggi@google.com> Add methods to coordinate unlock animation.

Introduce IWindowManager.keyguardGoingAway to notify that Keyguard
wants to dismiss it self. This method starts the state machine in
WindowAnimator which animates in the activity behind the keyguard.
Animating out the keyguard is done by the StatusBar/Keyguard
software when it receives the startKeyguardExitAnimation() callback.

Bug: 14118756

Change-Id: Id3b8f41189410bad808b4892fbec74245e59efce
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
1f74bad9acd816cd0974ca7d8a9eafe7f671ee57 23-May-2014 Craig Mautner <cmautner@google.com> Check for null DO NOT MERGE

Fixes bug 15129354.

Change-Id: I88865c021a024ab94e44dc71f09f8325a79e0775
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e67a784eb2c914c04c62ea5dfa1e3751df5582cc 21-May-2014 Craig Mautner <cmautner@google.com> Modify task navigation to return to recent tasks. DO NOT MERGE

Tasks launched from the recent task list will now return to the list
when they are finished. Also tasks that are launched from the
notification panel and services will now return to the list,
provided that the launcher is not front and center when they are
launched.

Fixes bug 14464114.

Change-Id: Ic0d3731fc7248d1eaa80e5ee399753d80e80c979
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
df6523f2703920a1d2a84c45b862b325b8cebf40 21-May-2014 Craig Mautner <cmautner@google.com> Modify task navigation to return to recent tasks.

Tasks launched from the recent task list will now return to the list
when they are finished. Also tasks that are launched from the
notification panel and services will now return to the list,
provided that the launcher is not front and center when they are
launched.

Fixes bug 14464114.

Change-Id: Ic0d3731fc7248d1eaa80e5ee399753d80e80c979
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b20f796dab61472ecbad36de053a1c6fcb5b3530 23-May-2014 Craig Mautner <cmautner@google.com> Check for null

Fixes bug 15129354.

Change-Id: I88865c021a024ab94e44dc71f09f8325a79e0775
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9890e341bf9d565309cd7db5e6c4194c66c0a1d8 23-May-2014 Dan Stoza <stoza@google.com> SurfaceFlinger: Add sourceCrop to screenshot

Adds a sourceCrop Rect parameter to screenshot commands, which allows
clients to capture only a portion of the screen instead of the whole
screen.

Bug: 15137922
Change-Id: I629447573cd34ffb96334cde7ba02490b9ea06d8
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
47a3e65acc35cd3061bf3867e8b20753870fd892 22-May-2014 Winson Chung <winsonc@google.com> Small perf tweaks.
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ae0844164959c2b1bf006d3fef26dbabc66c5873 20-May-2014 Winson Chung <winsonc@google.com> Fixing transition to/from Recents with full screen apps.

Change-Id: I2f400b6736581a37d38a75ee7194fc7cb6438460
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9aeb60739909aa2b8100c95157835e4e3db28519 19-May-2014 Winson Chung <winsonc@google.com> Merge "Enabling alternate recents on all form factors."
ea56251d92050e9a672d1f66d0d4621e4dd4136e 05-May-2014 Adrian Roos <roosa@google.com> Colorize SystemUI

Makes the color of the status and navigation bars customizable by
the app.

Bug: 14564488
Change-Id: I036edc228cfe1b659c7f11a43cdc4598ee705ff8
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
fd08622588d5a90c11216894344e58147ff6359a 14-May-2014 Winson Chung <winsonc@google.com> Enabling alternate recents on all form factors.

Change-Id: I9dec6da7646205b72f46cedf604fadfb03cab6d4
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d7d2d43b4967bb907b61180aa9d12ca51aaa15e2 09-May-2014 Kenny Root <kroot@google.com> WindowManagerService: add some defensive checks

Add checks before posting a message to the handler thread where
exceptions will crash the service.

Also make KeyguardLock fields final.

Bug: 14564617
Change-Id: I147d579d942f5fa555714d204cde52e2cd5f6154
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
67b082e02cbfb7bafe046a619e686e9a5c1abc05 25-Apr-2014 Winson Chung <winsonc@google.com> Merge "Enabling doc centric recents on phones."
83474f5b4d870c12d39cef5ae28b7e3fb6d6a765 24-Apr-2014 Michael Kolb <kolby@google.com> am 0fc5f869: am e597d5f9: Merge "Use rotation to position circular display mask" into klp-modular-dev

* commit '0fc5f86950f6089eb8b4cbc0bf9684b8be090fa3':
Use rotation to position circular display mask
0fc5f86950f6089eb8b4cbc0bf9684b8be090fa3 24-Apr-2014 Michael Kolb <kolby@google.com> am e597d5f9: Merge "Use rotation to position circular display mask" into klp-modular-dev

* commit 'e597d5f9310f760843272c728d6fb1917abf241a':
Use rotation to position circular display mask
8b275ca9d34792ba525771e0c1865b3262e569c9 24-Apr-2014 Michael Kolb <kolby@google.com> Use rotation to position circular display mask

Bug: 14231785

Change-Id: Ib6d69f3b9c2a638731539f1c1e51b56ad1698adc
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
f9f2314aa444e32b93caecd06cb4f10a71a2df39 21-Apr-2014 Winson Chung <winsonc@google.com> Enabling doc centric recents on phones.

Change-Id: If853cdcbf3fc75001060e522bce2e0d49d2ddea3
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
2820c4523cd37b4a9c5d33e558d39b798830e7e5 16-Apr-2014 Winson Chung <winsonc@google.com> Fixing the alternate recents transition on landscape views.

- This still assumes that we are taking square thumbnails.

Change-Id: I42a3d1b0505db57f815edf52cd176a3f651d5b37
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
352e108259bcb3305f034cfb042287d43a5e8f80 14-Apr-2014 Dan Sandler <dsandler@android.com> Merge "Merge remote-tracking branch 'goog/master-lockscreen-dev'"
15b0bef9250e084bfbceb388716d28ed62ca018f 12-Apr-2014 Jeff Brown <jeffbrown@google.com> am 9e2fde9c: am d912e1f6: Use the display\'s actual state in the view hierarchy.

* commit '9e2fde9c8a3557d6e8d1f3971a421ecdf5c2ce07':
Use the display's actual state in the view hierarchy.
9e2fde9c8a3557d6e8d1f3971a421ecdf5c2ce07 12-Apr-2014 Jeff Brown <jeffbrown@google.com> am d912e1f6: Use the display\'s actual state in the view hierarchy.

* commit 'd912e1f6a111fb33118d116bd72da1a328041bca':
Use the display's actual state in the view hierarchy.
d912e1f6a111fb33118d116bd72da1a328041bca 12-Apr-2014 Jeff Brown <jeffbrown@google.com> Use the display's actual state in the view hierarchy.

Previously, the view hierarchy would suppress drawing whenever the
PowerManager.isScreenOn() method returned false. However, this method
really describes the interactive state of the device rather than the
actual display state. This is especially a problem when there are
multiple displays but it also breaks drawing while in doze mode.

This change makes the view hierarchy consider the actual state of the
display instead on an individual basis.

Bug: 13133142
Change-Id: I69870b6b14a3504607a30562aa48c3452f777c1f
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
dd137a85d3e0295989b5b9d1f67ff32027be867d 10-Apr-2014 Svetoslav <svetoslavganov@google.com> resolved conflicts for merge of 6be2f952 to master-lockscreen-dev

Conflicts:
core/java/android/view/IWindowManager.aidl
tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java

Change-Id: Idcbc581294cc52b53eabefd61e5c20cbcea611db
1376d600d8e0eefdbc0aa11d398cf7517fc77129 13-Mar-2014 Svetoslav <svetoslavganov@google.com> Adding render stats APIs to UiAutomation (framework).

bug:12927198

Change-Id: Iae21481c75ae58dcdab3731bf5f1e2844e29d434
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
ae6ffcc3c74d12ebf59a26cce24d04fdd2b56f4e 02-Apr-2014 Jorim Jaggi <jjaggi@google.com> Merge "Wait for Keyguard to be drawn after boot." into master-lockscreen-dev
cff0acb6b1eea23c3f44a078a0a5e81c11faea35 31-Mar-2014 Jorim Jaggi <jjaggi@google.com> Wait for Keyguard to be drawn after boot.

The old logic with waiting for the Keyguard to be drawn assumed that
it is in an own window, and just checked for the visibility. This is
no longer possible as the Keyguard is in the status bar, and the status
bar might have been drawn without the Keyguard. So we have to wait
explicitely until Keyguard told PhoneWindowManager that it has now been
drawn and we can turn on the screen.

In addition, the starting logic of SystemUI is moved into
SystemUIApplication such the we can make sure that the status bar
already exists when the callbacks from PhoneWindowManager reach
KeyguardService. This simplifies the logic a lot.

Bug: 13635952
Change-Id: Ifd6ba795647edcf3501641e39052e4d04bc826fb
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
501f2c2cf009efee9a88ad964704e7fd4710e9c6 02-Apr-2014 Kenny Guy <kennyguy@google.com> am f4824a06: Fix issue with not allowing activities for current user.

* commit 'f4824a06884e096beef921646cba4be29d7f36fc':
Fix issue with not allowing activities for current user.
f4824a06884e096beef921646cba4be29d7f36fc 02-Apr-2014 Kenny Guy <kennyguy@google.com> Fix issue with not allowing activities for current user.

Change-Id: Ic2e30c3f4990a03aac9801ee9bf5f270a5e90ef8
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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.
1ccace916c8fdc61f1a8db6677aed518d31647e6 02-Apr-2014 Kenny Guy <kennyguy@google.com> Merge "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/WindowManagerService.java
5e9abc9507e9d2ff7e701a762c1bdbd1cdbb0971 02-Apr-2014 Michael Kolb <kolby@google.com> am 118d252e: am 4a812147: am 875eff83: Merge "Add circular anti-aliasing mask to circular display" into klp-modular-dev

* commit '118d252e7541bfe2c0453814acc3bee0b6312de1':
Add circular anti-aliasing mask to circular display
118d252e7541bfe2c0453814acc3bee0b6312de1 02-Apr-2014 Michael Kolb <kolby@google.com> am 4a812147: am 875eff83: Merge "Add circular anti-aliasing mask to circular display" into klp-modular-dev

* commit '4a8121478e5027bf61b5c711d6b1a748004edea2':
Add circular anti-aliasing mask to circular display
4a8121478e5027bf61b5c711d6b1a748004edea2 02-Apr-2014 Michael Kolb <kolby@google.com> am 875eff83: Merge "Add circular anti-aliasing mask to circular display" into klp-modular-dev

* commit '875eff832f9f496740ceba2f12de6f5423225274':
Add circular anti-aliasing mask to circular display
39a6db7cd5199dbe83da388404be3fc8f386281e 27-Mar-2014 Michael Kolb <kolby@google.com> Add circular anti-aliasing mask to circular display

Bug: 13635645

Add a 2 px wide anti-aliased circle as a Layer to WindowManagerService

Change-Id: Ic8d319ca43c222f5b2e69af896749b8f2018ce3e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
a79501cd3843149f0759bd53d310cf97d4ee1c8d 27-Mar-2014 Craig Mautner <cmautner@google.com> am af89d7e2: am bffd4d43: Merge "Check return values for null." into klp-modular-dev

* commit 'af89d7e21f5d7cbe74ff4ce014d8ab2db1a6fc27':
Check return values for null.
af89d7e21f5d7cbe74ff4ce014d8ab2db1a6fc27 27-Mar-2014 Craig Mautner <cmautner@google.com> am bffd4d43: Merge "Check return values for null." into klp-modular-dev

* commit 'bffd4d437d133164877c6a194d6a533299072fae':
Check return values for null.
d3849f54158bf1a370b9462b30ee36c15e7b02ea 27-Mar-2014 Craig Mautner <cmautner@google.com> Check return values for null.

When a Display has been removed there is a delay until all of its
windows have been removed. Therefore there is a possibility that
WindowState.getDisplayContent() returns null. Guard against that
possibility.

Fixes bug 13616765.

Change-Id: Ia2074d293b0e1bd4ca2cd14aeb4a2cc09ed9f41e
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
16744ac3f7b030f1192d298132256ac06eaff205 26-Mar-2014 Craig Mautner <cmautner@google.com> am d1e32cd3: Merge "Defer removal of activity until animation complete." into klp-modular-dev

* commit 'd1e32cd3207215e8bb63f18c6a5a4880b5344ef8':
Defer removal of activity until animation complete.
79e6578b6c7e8352f86942b99de4513133a1acdb 18-Mar-2014 Craig Mautner <cmautner@google.com> Defer removal of activity until animation complete.

Do not remove an AppWindowToken or its Task if it is running an
animation. Doing so leaves windows orphaned and bad things happen
when the system tries to retrieve the task assoicated with the
windows during layout.

Fixes the ugly output associated with bug 13440426.

Change-Id: I9d5fc50a7cb6189160d51cee3c82f7813baee715
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
452fd49369da80a460d43fcb7e71d8549268f378 24-Mar-2014 Craig Mautner <cmautner@google.com> am 5332706b: am b98ee1eb: am 103ed355: am 557a93e1: Merge "Set ScreenshotSurface secure if any secure content is shown."

* commit '5332706b87c8772b97198e30c7cb4cc4ef3b577f':
Set ScreenshotSurface secure if any secure content is shown.
b98ee1eb50389520fd06255fd38b233c7adf5814 24-Mar-2014 Craig Mautner <cmautner@google.com> am 103ed355: am 557a93e1: Merge "Set ScreenshotSurface secure if any secure content is shown."

* commit '103ed3558764f1fd41c9a5399e2030baa4110bfb':
Set ScreenshotSurface secure if any secure content is shown.
7bcdb33d859ffb70f235cc8e0f22a0598194ddf8 21-Mar-2014 Winson Chung <winsonc@google.com> Merge "Adding support for clipping window transition for alternate recents."
399f62052a88e5e7628b7312637ae54fbbaa4bec 19-Mar-2014 Winson Chung <winsonc@google.com> Adding support for clipping window transition for alternate recents.

Change-Id: Ic7df4e6c0396afc794ffc21694814c0a93f20f31
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
503fb80d0e93fd1aed64dbef36f7fa4363bdd5a2 20-Mar-2014 Svetoslav <svetoslavganov@google.com> Fix build

Change-Id: I2b27d51d8f555ee160dc99dba7e223f1cb3557e7
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8e3feb15c5aec2c72b0ef120a1da325e1e8f0dda 24-Feb-2014 Svetoslav <svetoslavganov@google.com> Added accessibility APIs for introspecting interactive windows.

1. The old introspection model was allowing querying only the active window
which is the one the user is touching or the focused one if no window is
touched. This was limiting as auto completion drop downs were not inspectable,
there was not way to know when the IME toggles, non-focusable windows were
not inspectable if the user taps them as until a screen-reader starts
introspecting the users finger is up, accessibility focus was limited to
only one window and the user couldn't use gestures to visit the whole UI,
and other things I can't remember right now.

The new APIs allow getting all interactive windows, i.e. ones that a
sighted user can interact with. This prevents an accessibility service
from interacting with content a sighter user cannot. The list of windows
can be obtained from an accessibility service or the host window from an
accessibility node info. Introspecting windows obey the same rules for
introspecting node, i.e. the service has to declare this capability
in its manifest.

When some windows change accessibility services receive a new type
of event. Initially the types of windows is very limited. We provide
the bounds in screen, layer, and some other properties which are
enough for a client to determined the spacial and hierarchical
relationship of the windows.

2. Update the documentation in AccessibilityService for newer event types.

3. LongArray was not removing elements properly.

4. Composite accessibility node ids were not properly constructed as they
are composed of two ints, each taking 32 bits. However, the values for
undefined were -1 so composing a 64 long from -1, -1 prevents from getting
back these values when unpacking.

5. Some apps were generating inconsistent AccessibilityNodeInfo tree. Added
a check that enforces such trees to be well formed on dev builds.

6. Removed an necessary code for piping the touch exploration state to
the policy as it should just use the AccessibilityManager from context.

7. When view's visibility changed it was not firing an event to notify
clients it disappeared/appeared. Also ViewGroup was sending accessibility
events for changes if the view is included for accessibility but this is
wrong as there may be a service that want all nodes, hence events from them.
The accessibility manager service takes care of delivering events from
not important for accessibility nodes only to services that want such.

8. Several places were asking for prefetching of sibling but not predecessor
nodes which resulted in prefetching of unconnected subtrees.

9. The local AccessibilityManager implementation was relying on the backing
service being ready when it is created but it can be fetched from a context
before that. If that happens the local manager was in a broken state forever.
Now it is more robust and starts working properly once the backing service
is up. Several places were lacking locking.

bug:13331285

Change-Id: Ie51166d4875d5f3def8d29d77973da4b9251f5c8
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
8c5567ee9e3d557da9729ef980a3588ce00f8240 20-Mar-2014 Jim Miller <jaggies@google.com> am bd33dc01: am 8e69abf8: am 46e63117: DO NOT MERGE - Fix memory leak caused by mismatched linkToDeath() in WindowManagerService

* commit 'bd33dc01f68ae0f4e4861568c02619e38c40af15':
DO NOT MERGE - Fix memory leak caused by mismatched linkToDeath() in WindowManagerService
bd33dc01f68ae0f4e4861568c02619e38c40af15 20-Mar-2014 Jim Miller <jaggies@google.com> am 8e69abf8: am 46e63117: DO NOT MERGE - Fix memory leak caused by mismatched linkToDeath() in WindowManagerService

* commit '8e69abf8c62452e6e9bcd254a55a2d80c8ef5b3d':
DO NOT MERGE - Fix memory leak caused by mismatched linkToDeath() in WindowManagerService
81481fc20145fdb9e4985ee106af6cb9971cde0e 18-Mar-2014 Craig Mautner <cmautner@google.com> Defer removal of activity until animation complete.

Do not remove an AppWindowToken or its Task if it is running an
animation. Doing so leaves windows orphaned and bad things happen
when the system tries to retrieve the task assoicated with the
windows during layout.

Fixes the ugly output associated with bug 13440426.

Change-Id: I9d5fc50a7cb6189160d51cee3c82f7813baee715
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.java
2e416f16745c55b4957611cb3fa5acc82f247092 04-Mar-2014 Craig Mautner <cmautner@google.com> am f716acc6: am 80b13579: am 7a93aa2f: am a0b4d0ce: Merge "Avoid duplication of AppWindowToken in created Task"

* commit 'f716acc66f2c30503f8c10f57ecba3d597107801':
Avoid duplication of AppWindowToken in created Task
80b1357909e57aa330c2624b8a5baac9f3bdce3f 04-Mar-2014 Craig Mautner <cmautner@google.com> am 7a93aa2f: am a0b4d0ce: Merge "Avoid duplication of AppWindowToken in created Task"

* commit '7a93aa2fc2555b0de41bb5f30eb0e9cce2413084':
Avoid duplication of AppWindowToken in created Task
b5abedbd5cef473574884a7453cdf4d412af26af 25-Feb-2014 Craig Mautner <cmautner@google.com> am c407ace3: am d4c819c0: am dd9ce628: Merge "Clean up activities and displays when done" into klp-modular-dev

* commit 'c407ace3019c4e542654cf17fd04d9436d3f3436':
Clean up activities and displays when done
dd9ce6287eb9ccae8d527e6750c91b0bd47834fc 25-Feb-2014 Craig Mautner <cmautner@google.com> Merge "Clean up activities and displays when done" into klp-modular-dev
95da1087ed3c7b9983b571bc5409827ae390f15f 25-Feb-2014 Craig Mautner <cmautner@google.com> Clean up activities and displays when done

More maintenance fixes.

Fix bug 13157352.

Change-Id: Ic86d39a84452a1cf1dc1762cec517b419ad0a852
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
5eb4adcbda0ff22e48716d3cf9356a9a720475b5 22-Feb-2014 Craig Mautner <cmautner@google.com> resolved conflicts for merge of d2794f5e to master

Change-Id: I24339e45e5fc697abf294286e2d6b57620ed9d1a
42bf39edbdad19f51497938d0a3469dd772f19e8 22-Feb-2014 Craig Mautner <cmautner@google.com> Reset deferred task removal when app token added.

A task is scheduled for deletion after the final activity has
been removed and has animated away. But if another activity is then
added to the task the deletion flag must be reset.

Also added improved debugging.

Fixes bug 12987986.

Change-Id: I207ea6e9592a9e036d67aa5d1465b4acc5bdd120
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
e1abfdf711ce9ff3b15ff1b4d86531f5a8dd3dec 21-Feb-2014 Craig Mautner <cmautner@google.com> am 6222a8ef: am 1648f042: am fd8a8ccb: Merge "Set the new SurfaceControl opaque flag." into klp-modular-dev

* commit '6222a8ef853609ea9c0f725c2412a2d25968d9da':
Set the new SurfaceControl opaque flag.
b88a904dfe719a8cbb0b9d73cb4637c22a1deed4 20-Feb-2014 Dan Stoza <stoza@google.com> Merge "Allow disabling layer rotation during screenshots"
71dd1b63436e9cdd5cbd2d42cd5841d497da8238 19-Feb-2014 Craig Mautner <cmautner@google.com> Set the new SurfaceControl opaque flag.

Converts surfaces from transparent to opaque and opaque to transparent
without creating a new surface. Uses the new SurfaceControl.setOpaque
method.

Fixes bug 12387406.

Change-Id: I669c064e622e211b00b1585183a488d5b3f4b778
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
16ec12ae77fdd2b09ea0ea0885ac52f11bd32c59 15-Feb-2014 Dan Stoza <stoza@google.com> Allow disabling layer rotation during screenshots

Add the ability to ignore layers' transformation matrices during
screenshot capture, which will allow the window manager to capture
unrotated images for recents during the device rotation animation.

Bug: 11805195
Change-Id: I96e65506b198d34724eb3aa84815aae6f6de4935
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3e5ce55fdeb67271d6a32042ab14cf523446cc09 13-Feb-2014 Craig Mautner <cmautner@google.com> am 4dd83975: am d14fa78d: am 0af894d2: Merge "Update DimLayer sizes on rotation." into klp-modular-dev

* commit '4dd839756ce032cb6db613f08b9a28e5cd20bbe9':
Update DimLayer sizes on rotation.
0af894d25133890e7765e6c582b3ac4829070de8 13-Feb-2014 Craig Mautner <cmautner@google.com> Merge "Update DimLayer sizes on rotation." into klp-modular-dev
b660b9d8cf6b951b85a35599d636c470795e9a1a 13-Feb-2014 Craig Mautner <cmautner@google.com> Update DimLayer sizes on rotation.

Required replumbing and updating the TaskStack bounds calculations
to match the new separation of TaskStack from DisplayContent.

Fixes bug 12780687.

Change-Id: I061c92831c06f4eb3e673ad6296e721b0c0f3202
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
1c5010a566c4d03eba714dc5d1a187b91973a549 13-Feb-2014 Craig Mautner <cmautner@google.com> am f24ee132: am d3df99c4: am 4b79f838: Merge "Add debug for 12987986." into klp-modular-dev

* commit 'f24ee13254b544b7e73ea1b28facc1996b8185ab':
Add debug for 12987986.
164683221948c13fd9b652416c5cc1621df6401b 13-Feb-2014 Craig Mautner <cmautner@google.com> Add debug for 12987986.

For bug 12987986.

Change-Id: Idc122ba369ad7566e3fee290955bf91b0f610ae1
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
4cfd54eaf0106373e1fea75a1e33ac460cf7c23d 13-Feb-2014 Craig Mautner <cmautner@google.com> am 69481d54: am 8dfda07d: am 731c30c1: Merge "Don\'t add windows from exiting app tokens twice." into klp-modular-dev

* commit '69481d54c2c6da6ec931bb7435bddf7be1aba0af':
Don't add windows from exiting app tokens twice.
ac90c19cab7e05dc8add6acbc8f74c9f854d098d 12-Feb-2014 Craig Mautner <cmautner@google.com> Don't add windows from exiting app tokens twice.

If an apptoken's removal has been delayed then it will be in both
mExitingAppTokens and the stack's tasks. When rebuilding the windows
the windows from that apptoken will get added twice. This change
skips adding those windows from apptokens that have already been
added from mExitingAppTokens.

Change-Id: I55f94b7dbef36aeacb390b91fbe82426eaac5458
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
33fa09b1ffe8d14d146de4b2632103d831ff8988 11-Feb-2014 Craig Mautner <cmautner@google.com> am 2d6b55aa: am 312ba86b: Change task removal sequence

* commit '2d6b55aaa9dd03f7d934f7a192989513b1087357':
Change task removal sequence
312ba86b476fa1d83864a7d465135cc9a4e94ad8 11-Feb-2014 Craig Mautner <cmautner@google.com> Change task removal sequence

- Remove task after removing activity. Removing the task before
removing the activity led to problems when the task was still needed.

- In WindowManager wait for activity manager to remove the task.
Previously was automatically removing the task when the last activity
was removed.

Fixes bug 12957434.

Change-Id: I7f6b1f09a2e2a845f177f337769075c9376f8bdb
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
56aa06c4249efe32c82af1dc71df9701dc8f457c 10-Feb-2014 Craig Mautner <cmautner@google.com> am 779d204a: am 9ef471f7: Don\'t remove Activities and Tasks until animation done

* commit '779d204abe6a3922b572822df5cd775ffd5d77e8':
Don't remove Activities and Tasks until animation done
9ef471f7f2f59de032d7cb9c3c7241486109979e 07-Feb-2014 Craig Mautner <cmautner@google.com> Don't remove Activities and Tasks until animation done

Just like stacks and displays, activities and tasks need to stick
around until animations have completed.

Change-Id: I54fe8f6855d60cbc3a25cbc6e762defd5ac50bf5
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.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/WindowManagerService.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/WindowManagerService.java
af04b113dcd28ae788a3ffb4a5420817cb7ed95f 06-Feb-2014 Craig Mautner <cmautner@google.com> am 14d74b82: am 1bf2b873: Defer detach until animations are complete.

* commit '14d74b82363e1a72b967590ee7118b239b276fb4':
Defer detach until animations are complete.
643ca1e9a3fba3b815534048bf4249a1f8a134b3 06-Feb-2014 Craig Mautner <cmautner@google.com> am 481b54be: am dc548483: Move activities from DisplayContent to TaskStack

* commit '481b54be1acb990bab3933b6248964e351bdcd99':
Move activities from DisplayContent to TaskStack
1bf2b873470d2ba8a4ac218da73516cc2b20aa76 06-Feb-2014 Craig Mautner <cmautner@google.com> Defer detach until animations are complete.

Allowing the detach of ActivityStack from DisplayContent to happen
immediately was causing all sorts of problems associated with not
having a Display to complete the animations.

Waiting for animations to complete before either the detach or the
display removal fixes those problems.

Change-Id: I8a5663bfac5c3c1084ff4fcc451e0e38e8080265
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
dc548483ae90ba26ad9e2e2cb79f4673140edb49 05-Feb-2014 Craig Mautner <cmautner@google.com> Move activities from DisplayContent to TaskStack

Now that activities and tasks can be detached from a display do not
keep their state within the DisplayContent class. All such state is
now moved to the TaskStack class with this change.

Change-Id: Ie6b1811e9ec3f545782bad8c3461bd4f2d336b93
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
9e4adfb358ca3680288c07201efc8811472a579d 05-Feb-2014 Craig Mautner <cmautner@google.com> resolved conflicts for merge of 32360147 to master

Change-Id: I97cc95f66df50006469f8debd286966cc21edb60
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/WindowManagerService.java
509cc13b705f8c488774e7097ab17471c3dacd2e 18-Jan-2014 Jeff Brown <jeffbrown@google.com> am e2c9cd58: Merge "Refactor display manager service to new pattern." into klp-modular-dev

* commit 'e2c9cd583f4f706b48270b8cbe84df627c69af24':
Refactor display manager service to new pattern.
4ccb823a9f62e57f9d221f83a97e82967e79a9e5 17-Jan-2014 Jeff Brown <jeffbrown@google.com> Refactor display manager service to new pattern.

Transform DisplayManagerService into a SystemService and start cleaning
up other local services that it uses from window manager and input manager.

Clean up service thread initialization.

Remove unnecessary static variables from ActivityManagerService.

It's starting to become clear that we really need a better way to manage
service dependencies. Boot phases don't quite cut it.

Change-Id: If319dbd7cbfbd4812fe55ece969e818d4b20755b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
09d30981f8e882ffaa336aa4665bfe348557895a 16-Jan-2014 Jeff Brown <jeffbrown@google.com> resolved conflicts for merge of 6f357d32 to master

Change-Id: I1979e6ed1acddbe656f5010114fd900f10865e75
6f357d3284a833cc50a990e14b39f389b8972254 16-Jan-2014 Jeff Brown <jeffbrown@google.com> Start untangling system server early bootstrapping.

Refactored SystemServer to get rid of a bunch of legacy cruft related
to how the ServerThread used to be started up.

Create system context first when system server starts. This removes
the tangled initialization order dependency that forced us to start
the activity manager service before most anything else.

Moved factory test related constants into the FactoryTest class.

Partially migrated Installer, ActivityManagerService, and
PowerManagerService to the new SystemService pattern. There's more
work to be done here, particularly around the lifecycle of the
power manager.

Bug: 12172368
Change-Id: Ia527dd56e3b3fd90f9eeb41289dbe044921230d4
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
fc8fa54f80b419966b3893a0992354a17c270333 16-Jan-2014 Craig Mautner <cmautner@google.com> am e9ddaa0b: Merge "Cleanup after ActivityView" into klp-modular-dev

* commit 'e9ddaa0b183d979be782a63970929cebd861b7c9':
Cleanup after ActivityView
34b73dfaa3a92e5a85abf62317183fb114f2ffff 13-Jan-2014 Craig Mautner <cmautner@google.com> Cleanup after ActivityView

- Release Surface and VirtualDisplay when shutting down ActivityView.
- Shut down child stacks when relaunching parent activity.

Change-Id: I60314b2b43bd2da5406cf6ec871293b5baca157c
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
3a43aa9cef79324dd149a47c5a73ce1fa8ed95b3 15-Jan-2014 Craig Mautner <cmautner@google.com> am 9cfb2e5f: Merge "Retain stacks even if they are empty." into klp-modular-dev

* commit '9cfb2e5f4c95c16d8ca531808f60486f214f9039':
Retain stacks even if they are empty.
9cfb2e5f4c95c16d8ca531808f60486f214f9039 15-Jan-2014 Craig Mautner <cmautner@google.com> Merge "Retain stacks even if they are empty." into klp-modular-dev
04a0ea60ac7e20369e63edc4f3f8cedf8425a439 13-Jan-2014 Craig Mautner <cmautner@google.com> Retain stacks even if they are empty.

Previously stacks would be removed when the last ActivityRecord was
removed. This causes problems for ActivityContainers which persist and
permit activities to be launched into an empty stack.

Change-Id: Ia79ac65d17c42eff3a7b1321980c21b29996001b
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
80a6e776e008f3a048ec568ea5a0ca63e0b6d936 13-Jan-2014 Craig Mautner <cmautner@google.com> am cf6e0d68: Merge "Add display synchronously." into klp-modular-dev

* commit 'cf6e0d686f42036992bdac4f47d37bc8c0775027':
Add display synchronously.
ad25fa36cb63f134acf636d70696bbf81548802e 13-Jan-2014 Craig Mautner <cmautner@google.com> Add display synchronously.

Adding the virtual display to window manager through a handler message
causes timing issues. Add the display directly to fix it.

Change-Id: I3ad6b16ce6dff2a48abd120a8e873e11a028e2c3
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
d4abbb964b6153ab19a9366c1168f4794b618594 10-Jan-2014 Craig Mautner <cmautner@google.com> am 93884a5b: Fix invalid stackId bug.

* commit '93884a5b35ec97a0f44795950363188d9a21137a':
Fix invalid stackId bug.
93884a5b35ec97a0f44795950363188d9a21137a 10-Jan-2014 Craig Mautner <cmautner@google.com> Fix invalid stackId bug.

Eliminate race condition by executing window manager createStack
directly from activity manager.

Change-Id: I2dda276d07d0ae09c7c958980bc5ebffe72ebd92
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
1f7488e21994d7b6e143a4540659c1fbae630634 10-Jan-2014 Craig Mautner <cmautner@google.com> resolved conflicts for merge of 4504de5d to master

Change-Id: I8d96fd2b479aebd6de913e617ca190f66c25aaa5
4504de5d5a8e1c7dfb306b16282f348856c24764 20-Dec-2013 Craig Mautner <cmautner@google.com> Implement ActivityView.

With an existing ActivityContainer a caller can now create an
ActivityView which consists of a new VirtualDisplay immediately
attached to the ActivityContainer.

Change-Id: Id70333dcbef55d524a87df8f8c92d72ca5579364
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
b859449b717b24ac6e678c303d7706d55fd184f7 08-Jan-2014 Craig Mautner <cmautner@google.com> resolved conflicts for merge of 88bfc6dd to master

Change-Id: Ib656ac0591b21ad14f2df51021729552e9373515
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/WindowManagerService.java
49782e46c0eb85a25ae2abcf80880c48dbab5aea 20-Dec-2013 Amith Yamasani <yamasani@google.com> am 9158825f: Move some system services to separate directories

* commit '9158825f9c41869689d6b1786d7c7aa8bdd524ce':
Move some system services to separate directories
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/WindowManagerService.java