History log of /frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
0e9fb13312a79985fc9aa98fd0d0968eaca33019 06-Jun-2018 chaviw <chaviw@google.com> Prevent IME from showing when AOD shown or windows not drawn.

There's always been a possibility for IME to be visible even after the
screen was turned off. This was normally harmless because the IME was
placed behind the lock screen. The lock screen was opaque so it would
cover the IME, even in the case with AOD. However, with AOD live
wallpaper, the lock screen can now be transparent. This causes the IME
to be shown in between the wallpaper and lock screen.

To prevent IME from showing, several things needed to change.
1. The flag that was sent from sysui to AM is now propagated to WM. If
AOD is showing, IME should be hidden.
2. That flag sometimes is not a guarantee because AOD could be exiting,
but still shown on screen. Instead, also rely on the
mWindowManagerDrawComplete since that's only true when the windows have
completed drawing. The IME only needs to be shown if the other windows
on screen have drawn.

Test: Open IME and allow screen to timeout. When AOD turns on with
live wallpaper, IME is hidden.
Test: Within 5 seconds after AOD is turned on, turn screen on. Screen
turns on without IME flicker.
Fixes: 79658086

Change-Id: Ife93bdfde8ba2914930497356c0e16ebd629c507
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
4163d6288dcf76aa26e288e135a85fba27b8e034 22-May-2018 Adrian Roos <roosa@google.com> WM: Prevent secondary display focus while keyguard is up

Fixes an issue where input intended for the keyguard could end up going
to a different display.

To prevent this, make sure that only the default display can get focused
when the keyguard is showing.

Change-Id: I6463c44aedca06930d2c9bda7c45ffd93141308c
Fixes: 71786287
Test: atest DisplayContentTests
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
4179c5ca2cde1a8a0382ae094371ade538ac4ad5 08-May-2018 Phil Weaver <pweaver@google.com> Merge "Revert Nav bar contrast under magnification" into pi-dev
b7f2c9cf291b1807a296f36e751d56c8c89df772 07-May-2018 Phil Weaver <pweaver@google.com> Revert Nav bar contrast under magnification

I don't have an answer for b/74464336, which is caused by a
race between the nav bar becoming opaque and the content
behind the nav bar zooming past it. The ideal solution -
to exclude the nav bar's background from magnification -
is not feasible right now because magnification is
performed on complete windows.

I think rolling back to O is the least bad thing here.

Bug: 74464336
Test: Verify that magnification works the way it did in O.
Change-Id: I3b4028ddba6a3d8541948dd89813728c347ad30f
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
62c7846bf89c170f1f41624866d3249a4e30a33a 09-Apr-2018 Matthew Ng <ngmatthew@google.com> Secondary split screen app will be next to the navigation bar (1/2)

Refactored docked position code into PhoneWindowManager to determine
which side the docked app should go based on the position of the nav bar
in landscape (as portrait will only have top). Fixed the split screen
entrance animation for quick step's overview.

Change-Id: I30f1be9d791c23f4cd197f17487609964f78fac0
Fixes: 73250406
Test: play around with splitscreen and minimized mode
Test: atest com.android.server.policy.PhoneWindowManagerTest
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
71c632367a798cdf656e6ac51daf0379ee525759 05-Apr-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "WM Tests: Use a separate WindowManager instance per test" into pi-dev
3150dbf7a57c7f0332db9c9197ad046023bd6ece 28-Mar-2018 Adrian Roos <roosa@google.com> WM Tests: Use a separate WindowManager instance per test

Fixes a bunch of flakes, where the WindowManagerService instance
was reused between tests, which caused delayed callbacks from a
previous test affecting state of a future test.

Also introduces a DexmakerShareClassLoaderRule to manage
the 'dexmaker.share_classloader' property instead of sprinkling
error prone System.setProperty() invocations all over the tests.

Change-Id: Ic9445d1b2cef594e79365c425632aabced6343a9
Fixes: 76111404
Fixes: 75991352
Fixes: 75991878
Fixes: 75992153
Test: atest services/tests/servicestests DexmakerShareClassLoaderRuleTest packages/SystemUI/tests packages/SystemUI/shared/tests
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
ef5ce1c300ab496efc3fd87d29d6790f81a6a771 21-Mar-2018 Andrii Kulian <akulian@google.com> Prefer default orientation for secondary displays

For existing use-cases secondary displays should not be influenced by
things like orientation sensors, docking mode, etc. This CL makes
WindowManagerPolicy prefer default orientation when calculating
rotation for non-default displays.

Bug: 72447212
Test: Rotate phone to landscape, start Android Auto Projected.
Change-Id: I1934085d32096aa9c1a2b8f7f62c26b7480dd13d
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
3662b155f681a44b5fc5f96122246104c981c164 16-Jan-2018 Benjamin Franz <bfranz@google.com> Disable immersive mode confirmation when device is in lock task mode

Bug: 68305547
Test: manual, with DEBUG_SHOW_EVERY_TIME
Change-Id: I42fa1ed771a8216304a0ba7330cd842ae23e8a03
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
e1bdfc82867e1ddfa8ba23ac267e4426472d6a27 15-Sep-2017 Yoshiaki Naka <yoshiaki.naka@sony.com> Support ENVELOPE (EVENT DOWNLOAD - User activity) command

The terminal shall send the ENVELOPE (EVENT DOWNLOAD - User activity)
command to the UICC when some user activity like a key-press or touch is
detected if the user activity event is a part of the current event list.
This change allows the SIM Toolkit application to support that event.
Please refer to the specification of SET UP EVENT LIST command described
in ETSI TS 102.223.

Bug: 65884891
Test: Confirmed the expected seq 1.1 of ETSI TS 102.384 TC 27.22.4.16
Change-Id: I7d3faa09cd4625db53bcfe21f90570389a4ea037
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
64543e668f3f044916363f586f27161004bf3c4b 01-Mar-2018 Matthew Ng <ngmatthew@google.com> Prevent nav bar vibrations when overview proxy is connected (1/2)

Systemui can control when to allow vibrations on virtual key vibrations
on key down when overview proxy service is connected. This prevents
vibrations from KeyButtonView when swiping up over a navigation button.
This gives more control over haptics to systemui so that in the future
launcher can send haptic feedback when quick step begins.

Bug: 73919295
Bug: 73942704
Test: swipe up from navigation bar
Change-Id: I5de2a6f199d7e08b4d146e729f4b9c89b2adcded
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
d7551607b34cb15725200a3de24cc2feb20f1b44 16-Feb-2018 Phil Weaver <pweaver@google.com> Ensure nav bar contrast under magnification

When the nav bar is transparent, the app background
provides adequate contrast with the buttons (at least,
it seems to). But magnification zooms in on the app
window but not the nav bar, which can bring a section
of the UI behind the nav bar that is the same color
as the nav bar buttons. That makes the nav bar quite
difficult to see.

This change makes PhoneWindowManager listen for
magnification updates. When magnification is zooming
in, it makes the nav bar opaque.

The callbacks happen when magnification goes from 1x to
not 1x, and from not 1x to 1x. So we only call back when
the nav bar needs to change, not for every movement made
by magnification.

Bug: 36677486
Test: Enable magnification, zoom in, and watch the nav
bar become opaque. Watch it become transparent again
when we zoom out.

Change-Id: Id9b2c57af98f6cefc81ecf3d7bdab4e49ac07474
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
11c25584b21100260715f0212891f1a10044aac7 19-Feb-2018 Adrian Roos <roosa@google.com> DisplayCutout: account for cutout in appWidth/appHeight etc.

Makes sure to take into account the area blocked by the cutout when
calculating the nonDecor / config / stable insets, widths and heights.

Fixes: 72995358
Fixes: 72444324
Test: atest PhoneWindowManagerInsetsTest
Test: go/wm-smoke
Test: Enter splitscreen, verify that both windows are same size

Change-Id: Iff58235b5bdfd0d49df259a91b05e54e3864f41c
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
f19cbe201e79410c58777dd0f431de3d5202aec3 03-Feb-2018 Bryce Lee <brycelee@google.com> Restrict DisplayContent creation.

This changelist limits DisplayContent the display
container/controller creation. All other callpoints now can only
retrieve existing DisplayContents. This removes the chances of
arbitrary calls generating a DisplayContent without the related
ActivityDisplay on the ActivityManager side.

Since display creation is now driven on the ActivityManager side,
the ActivityManagerService must be initialized and associated with
the WindowManagerService before the WindowManagerService can be fully
initialized. This is reflected in changes to SystemServer.

Fixes: 72228411
Test: go/wm-smoke-auto
Change-Id: I8dddb5fc109be4363de5ba87faff9d9885009042
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
f20bd225a21eaf3b20beba7b019b30d4919415b9 02-Feb-2018 chaviw <chaviw@google.com> Fixed Dimmer test

Updated code so Dimmer test can now run.

Change-Id: Ie6bebede752ff458732d659f63d5e16d95b5e2e7
Fixes: 72450130
Test: atest FrameworksServicesTests:com.android.server.wm.DimmerTests
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
2fb06bc31f06ac046c94e41dbcaf019623052de8 20-Jan-2018 chaviw <chaviw@google.com> Added animations to dim layers

Added animations to dim layers when dims are set for
WindowState surfaces since they're controlled by the system.

Test: Dims for dialogs now animate.
Test: DimmerTests
Fixes: 71841698
Fixes: 69553362
Fixes: 71614627
Fixes: 72333587

Change-Id: I34f6f3d7885d5c9c0075a941e40d68bc5618a016
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
dff7a73979eea381c704e9165ec62335fae1c6c7 11-Dec-2017 Winson Chung <winsonc@google.com> Fix Recents regressions

- Remove extra argument from the invocation of Recents from AM/WM, fetching
the states directly. This also fixes the issue with the docked task from
showing in Recents since the state will trigger the preloaded task stack
to be invalidated.
- Move Recents stack update to onStart() to ensure that it is updated with
the changes introduced in ag/3338461
- Fix an issue with the initial state being clobbered when entering split
screen

Bug: 70279132
Test: Long press recents button to split screen, verify task is not visible
Change-Id: If5a3ca1d86fa0025d6b1e08abf73fe80a390ef8e
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
c80c67e7bc96691b6e3700bac49e819ad52db0ae 04-Dec-2017 Lucas Dupin <dupin@google.com> Allow custom keyguard "prompt reason"

Adds the possibility of presenting a custom message on
the keyboard if you're trying to dismiss the keyguard.

This is particularly useful when you're showing the
bouncer because custom authentication (SmarLock)
failed.

Test: launch FLAG_SHOW_WHEN_LOCKED activity and
call KeyguardManager#requestDismissKeyguard
Fixes: 63940122
Change-Id: I0d88c0e59521887efa56d74874062b2b14970e4e
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
d0a66b21ae86a33c43e6f614cf2d4e6c4e9ea281 10-Jan-2018 Yohei Yukawa <yukawa@google.com> Add a test for updateLightNavigationBarLw()

As a preparation to allow IME windows to use
SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR, this CL makes
PhoneWindowManager#updateLightNavigationBarLw() testable and adds
several test cases to clarify how this method currently works.

This is a mechanical change and there should be no behavior change.

Bug: 69002467
Test: atest com.android.server.policy.PhoneWindowManagerTest
Change-Id: I2761cc037b013da52507592369a33e86a3138c14
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
35fbb312e9a185d3d6ed20697b486faae8409463 13-Dec-2017 Siarhei Vishniakou <svv@google.com> Keyguard can be on even if not showing

It is possible for keyguard to be in "restricted input" state even if
isKeyguardShowingAndNotOccluded returns false. The previous CL to
deprecate inKeyguardRestrictedInputMode has also changed the behaviour
of isKeyguardLocked. Return to the old behaviour here, but keep the API
deprecated.

Bug: 70411251
Test: 1) add Google account to phone 2) Enable google assistant and set
up active edge to trigger the assistant 3) Ensure phone is in the
always-on-display mode 4) Squeeze the phone to trigger the assistant.
Previously, the assistant would not launch. The expected behaviour is
that assistant gets launched. Without this change, display will turn on
but the assistant will not get launched.

Change-Id: Ic299f3fc223ebdc3b0f6eea97cb4a89a3142e44a
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
5f13cf0586c6edd7eaa5aa676a19df150870a81e 13-Oct-2017 Siarhei Vishniakou <svv@google.com> Deprecate inKeyguardRestrictedInputMode

The api inKeyguardRestrictedInputMode is no longer needed,
deprecate it. Redirect output to isKeyguardLocked().
Remove inKeyguardRestrictedKeyInputMode.

Test: make, flash, use system ui
Bug: 65998293
Change-Id: Ie2609758fc013aab10530a1be087c983c51d86b0
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
e99bc0501a288735d337f2ff64f8fa47f766a59b 20-Nov-2017 Adrian Roos <roosa@google.com> WM: Move WindowManagerPolicy, DisplayFrames and WindowManagerInternal into services

Splits WindowManagerPolicy into a framework and a services part, preventing concepts that are
internal to the window manager from leaking out into the framework.

Test: make droid
Change-Id: I7b6a54f55f76f6fbb5f27090981b8f1d4d8be88b
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
b1579c8d898811010b60eab4e996f3d071980155 05-Sep-2017 Robert Carr <racarr@google.com> Re-implement Z-ordering based off SurfaceControl hierarchy.

First steps in using the SurfaceControl hierarchy pervasively through
the WindowManager. For each level of the WindowContainer hierarchy
we instantiate a buffer-less SurfaceControl which is used to apply
constraints to all of it's children. For now we use full-screen surfaces
at every non-leaf level and so the only constraint we apply is Z-ordering.

Calculation of Z-ordering is done through the WindowContainer#assignLayers
pass and begins with DisplayContent. Changes are accumulated in-to a pending
transaction which is applied as part of prepareSurfaces (which now applies
to each level of the WindowContainer hierarchy rather than just windows).

Bug: 64815723
Test: Existing tests pass. go/wm-smoke. ZOrderTests.
Change-Id: Ib31bc3107c7fa398cf2ed72430fcb7596fad6fd5
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
828ff7e3ef032f3c3b149be9961fa39a979d2fd2 14-Nov-2017 Wale Ogunwale <ogunwale@google.com> Support insets on secondary displays

Indroduced DisplayFrames object to track frames used to calculate
window insets per display vs. at a global level in PhoneWindowManager.

Bug: 64148922
Change-Id: I19f166920eba0a4f933a223a77e096bcc8dab0c1
Test: bit FrameworksServicesTests:com.android.server.wm.ScreenDecorWindowTests
Test: go/wm-smoke
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
7bb06e012a33c94c68b173bc8f276f78e0d60764 13-Nov-2017 Wale Ogunwale <ogunwale@google.com> Revert "Support insets on secondary displays"

This reverts commit 9bc2692939d4dececbfde5ea67df4594a7842bd1.

Change-Id: Ia065372e9e220e653b4729a290663c3536d99307
Fixes: 69241956
Bug: 64148922
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
9bc2692939d4dececbfde5ea67df4594a7842bd1 06-Nov-2017 Wale Ogunwale <ogunwale@google.com> Support insets on secondary displays

Indroduced DisplayFrames object to track frames used to calculate
window insets per display vs. at a global level in PhoneWindowManager.

Bug: 64148922
Test: bit FrameworksServicesTests:com.android.server.wm.ScreenDecorWindowTests
Test: go/wm-smoke
Change-Id: I4a668d6c2dd0bfa666cb6acecf663cf83545ea87
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
92c9a948df438748f4ea1f39011a8a182cd2a841 10-Oct-2017 Andrii Kulian <akulian@google.com> Don't let keyguard to influence orientation when dismissing

When keyguard is being dismissed it still was overriding orientation
for the display, which caused report of wrong configuration to
activity that was becoming visible.

Bug: 66979760
Bug: 36897968
Fixes: 68131425
Test: Launch Unity 4 based game, lock and unlock screen, check UI
Test: com.android.server.wm.DisplayContentTests#testOrientationDefinedByKeyguard
Change-Id: I0a180b8e941a85ba4174a40cdec2ff0b8f3e00eb
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
c0b0f93e96a290c819b77da169fc41e789027d21 01-Nov-2017 Wale Ogunwale <ogunwale@google.com> Support for WM.LayoutParams.PRIVATE_FLAG_IS_SCREEN_DECOR.

Allow any process with the STATUS_BAR_SERVICE permission to add a
window that would be considered a screen decoration by the system
similar to the nav bar or status bar.

Test: bit FrameworksServicesTests:com.android.server.wm.ScreenDecorWindowTests
Bug: 68002203
Bug: 64148922
Change-Id: I8c78b82c10c638b54a528a77b96f5bf8dd18bf6f
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
af03df6a7a93c832e0bc77b88607ef9161f0791b 19-Jul-2017 Steven Timotius <stimo@google.com> Update WindowManager to output dumpsys in protobuf format

Implement enough functionality in protobuf dumpsys to replicate
old functionaltiy in android.server.cts.WindowManagerState

Test: cts-tradefed run commandAndExit cts-dev --module CtsWindowManagerHostTestCases
cts-tradefed run commandAndExit cts-dev --module CtsServicesHostTestCases
Change-Id: Ib527ab3f44620a08cf03b77c37c2bae883d90e13
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
e1cfcf4c4d15417bc912d36d487b4454c19b30fa 11-Jul-2017 Tarandeep Singh <tarandeep@google.com> Fix keyboard focus in VR

Consider this VirtualDisplay (VD) scenario:
HostActivity creates a VD which holds SettingsActivity. When EditText
on SettingsActivity is tapped, it gains focus.
On eventual taps, it loses focus i.e. the Window in VD loses focus and
the host activity in primary display gets the focus instead. This
happens because WM's TaskTapPointerEventListener.onPointerEvent()
is called on the default display only.

Root cause:
1. Tap detector isn't registered for non-default display.
2. Tap detector has no info on which displayId touch was received.
3. InputFlinger doesn't deliver InputMonitor events for
non-default displays (fixed in a separate CL)

Fixing above results in onPointerEvent(MotionEvent) to deliver the
Touch events successfully to VD. We restrict these changes to physical
multi-displays and VR VirtualDisplays (which uses virtual touch device).
[VrManagerService calls WMInternal.setVr2dDisplayId(int)]

In future, displayId should be part of InputEvent. Bug: 64258305

Bug: 62033391
Test: bit FrameworksServicesTests:com.android.server.wm.DisplayContentTests
Change-Id: I3626f4de5aa9bcf905da9abd39f3ab1baefc4c48
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
7c89480c0e0521977e6bb5976e2f97daa0f248cf 19-Jul-2017 Adrian Roos <roosa@google.com> AOD: Prevent animations and rotations while going to sleep

A recent change allowed animations while the screen is
turning on, but not fully turned on; this allows rotations
while the device is going to sleep though. To prevent that,
we now disallow animations if the device is going to sleep too.

In addition, we also prevent the rotation animation when the screen
is not fully on or non-interactive.

Change-Id: I9b84f68a02a07067e48b11c008bcaf4bcb7c41a0
Fixes: 63760853
Test: Turn phone to landscape on an app that can rotate. Press power button. Verify AOD shows without a rotation; go/wm-smoke
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
3a1619d68e829829848cf0c41fcf86e4671042d8 07-Jul-2017 Andrii Kulian <akulian@google.com> Position app with short aspect ratio opposite of nav bar

When an application doesn't support tall aspect ratio of the
screen where it's displayed, it should be positioned on the
opposite side from navigation bar. It's supposed to create
an effect of extended black nav bar.

Bug: 62893418
Test: go/wm-smoke
Test: ActivityRecordTests#testPositionLimitedAspectRatioNavBarBottom
Test: ActivityRecordTests#testPositionLimitedAspectRatioNavBarLeft
Test: ActivityRecordTests#testPositionLimitedAspectRatioNavBarRight
Change-Id: I2cd3d236ee8d0cc263fee4c0a436d78c755eb9b7
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
e94c15ca96830a99e03b0e60d662fff36566782b 09-May-2017 Adrian Roos <roosa@google.com> AOD: Skip window animations while dozing

Fixes: 37245619
Test: go/wm-smoke; Go to home, turn off phone, observe that during the transition to AOD the navigation bar hide animation does not play.
Change-Id: I9a2fce4295900648a680e8e7e8fee0fbb447dd3d
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.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/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
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/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
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/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
04ab3466fabb7244660adf54740a4f60874b02a1 11-Apr-2017 Bryce Lee <brycelee@google.com> Allow at most one pinned stack task.

This changelist enforces only one task may be present in the pinned
stack at a time. If a task is already persent, the existing task is
moved to the fullscreen stack.

Fixes: 36844394
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test CtsServicesHostTestCases android.server.cts.ActivityManagerPinnedStackTests#testPipMovedToFullscreenStack
Test: bit FrameworksServicesTests:com.android.server.am.ActivityStackSupervisorTests#testDisallowMultipleTasksInPinnedStack

Change-Id: Iaf0fbda6df835d93738fdf6f7f3a8c5956c2b262
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
2c93764bee6c00526fda24a26f8a472c26d908c3 03-Apr-2017 Andrii Kulian <akulian@google.com> Merge "Fix some WM unit tests" into oc-dev
a95bfff74604bbf05a66ff37947b1b2fb2fdcaa2 31-Mar-2017 Andrii Kulian <akulian@google.com> Fix some WM unit tests

WindowFrameTests#testLayoutNonfullscreenTask and
sizes because test assumed that frame for window was always
bigger than screen size. Now we calculate all frames relative
to real display size.

TestWindowManagerPolicy used in WM unit tests reported incorrect
value from rotationHasCompatibleMetricsLw(), which lead to
DisplayContent#mAltOrientation set to "true" after any rotation
and resulted in shrinked display metrics.

DisplayContentTests#testDefaultDisplayOverrideConfigUpdate was
not restoring the config applied to default display because
it was trying update values in config from non-empty to empty,
which is considered a no-diff.

Test: com.android.server.wm.WindowFrameTests
Test: #testCalculatePolicyCrop
Test: #testLayoutNonfullscreenTask
Test: com.android.server.wm.AppWindowTokenTests
Test: #testLandscapeSeascapeRotationByApp
Test: com.android.server.wm.DisplayContentTests
Test: #testDefaultDisplayOverrideConfigUpdate
Change-Id: Ia0ed46307f67f6b47859209ebcf13253b59b8002
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.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/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
192bb0bc54f6bb418f5778fe26eb2e68514290fb 09-Mar-2017 Paul Duffin <paulduffin@google.com> Refactor code incompatible with Mockito 2.7.13

(cherry picked from 76e319f015c2b43498ce3ce610a253d63e76cbf3)

Some additional internal only refactorings were done as well.

Bug: 32912773
Test: make checkbuild
Change-Id: I96e3da967fad731fc8f39bde9db95f50ab7353fb
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
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/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
17f175ca1a75d5a4864b88126f5d2a59935d52fd 08-Feb-2017 Wale Ogunwale <ogunwale@google.com> Fixed failing WM pre-submit tests

- Pre-submit wasn't really enabled so several changes were merged in
that caused test failures
- Specify that AppWindowTokenTests token fill their parent since that
is important for the orientation tests it runs
- Disable testLandscapeSeascapeRotationByPolicy() until we have time
to figure-out the problem with the test.
- Initialize ActivityManagerInternal local service mock when we
initialize the test object for window manager.
- Changed UnknownAppVisibilityControllerTest to use test
infrastructure in WindowTestsBase.
- Fixed testGetOrientation_childSpecified to check the correct expected
state.
- Allow testAssignWindowLayers_ForImeNonAppImeTarget to create an alert
window at internal system window z-order.
- Remove all non-common windows for the system after each test run.

Bug: 35034729
Test: adb shell am instrument -w -e package com.android.server.wm
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: I4726811e382b18fbef6b9d9b12a5ee56776628e4
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.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/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
9bafc7150ea41758cf40ba60eb90deb62217fc34 19-Jan-2017 Jorim Jaggi <jjaggi@google.com> Starting window tests, yay!

Test: bit FrameworksServicesTests:com.android.server.wm.AppWindowContainerControllerTests
Fixes: 34364463
Fixes: 34361417
Change-Id: Ie1b8debc894e5cad8fe517912a1991a38661dfaa
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
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/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.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/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.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/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.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/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.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/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.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/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
5b6714c2fa3cdd87642766e3fb0a1478d2422ec2 02-Nov-2016 Wale Ogunwale <ogunwale@google.com> Added support for window TYPE_PRESENTATION

Switched presentation feature to use new window TYPE_PRESENTATION
and also add its own window token to the display the presentation
is running on. This is needed as window manager no longer allows
tokens to have windows on multiple displays.

Bug: 32566372
Test: Presentation mode works.
Change-Id: I9c2998311b65640743b8e23ec4f10bf1ffbfd785
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
73294b6cf79910dc688e5b62d673082a3dec773b 27-Oct-2016 Jorim Jaggi <jjaggi@google.com> The big keyguard transition refactor (4/n)

Nuke KeyguardScrim

Test: Kill SystemUI while lockscreen is showing, make sure nothing
is visible when being killed.

Bug: 32057734
Change-Id: I9f8d1e5a0e0f968460d8170627a849623c6a7245
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.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/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.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/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.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/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
7203d62563e8877449ad40356dee0592ff6b005a 21-Sep-2016 Brian Carlstrom <bdc@google.com> Track new WindowManagerPolicy methods

Test: make checkbuild
Change-Id: Id6a0c2c0b408e356afdaa8e2e3437a515a1aa54f
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.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/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.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/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
91355d5901f51b24ac1166a3197f5f9226a92389 06-Aug-2016 Guang Zhu <guangzhu@google.com> add missing dummy implementation of new method in test code

Change-Id: I91b6da823d7e3e44f9a70f9726d45b490b6783b2
/frameworks/base/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.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/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
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/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java