Commit Graph

56 Commits

Author SHA1 Message Date
Taran Singh
4545703367 Deliver hideInsets when target is removed
hideInsets(IME) may not be delivered to the control target if
the window requesting hide is no longer available in WindowManager's
window map. However, it is still nicer to deliver it to the default
display's control target rather than not delivering it at all.
Fix: 159623277
Test: Manually using steps in bug.

Change-Id: I22cdf20627da2183d30af444f6dd9d0375d417c1
2020-06-30 10:02:10 -07:00
Riddle Hsu
96ed092b10 Wait for remote animation to stop freezing display
If display is rotated 180 degree, the display might not have
configuration change. And if there is remote rotation and it hasn't
done, the rotation of display is still the old one. Once there is
a path calls stop-freezing-display, the rotation animation will be
executed directly with 0 degree delta. And if the activity needs to
relaunch, there will be obvious flickering.

Fixes: 160107205
Test: atest DisplayContentTests#testRemoteRotation
Change-Id: I66a02b67f7066abafd65c2c282144222701feaae
2020-06-30 01:28:35 +08:00
Taran Singh
85661e3f9e Add Insets dumps and IME debug logs
Add more dumps and logs to better help debug IME insets better
Logging can be enabled by setting InsetsController.DEBUG to true.

Bug: 154348613
Test: manually build and flash.
      Verify showing and hiding IME shows logs.
      verify adb shell dumpsys window windows has new dumps

Change-Id: Iad0a21d81a22d6acfaaf5c5ca8b5131eec411e79
2020-05-27 15:12:07 +00:00
Ming-Shin Lu
aa9376bc4f Fix black screen during Quick switch
When quick switch a delayed task, before onTaskAppeared called,
if the user holds gesture on nav bar, TRANSIT_WALLPAPER_OPEN from closing
app happens will cancel recents animation when
WC#applyAnimationUnchecked, and that will cause the black screen if the
delayed task not yet drawn and there is no recents task snapshot on top.

Since cancelling recents animation during quick switching doesn't make
sense, to fix that, we should check the animation task target if is
still controlled by recents animation, if so, we should not cancel it.

Also, make sure if the appeared task has already been in task target list,
(i.e. task A appreared, quick switch to task B, before task B appeared,
quick switch back to task A) if so, we don't need to callback task
appeared again.

Fix: 156670249
Test: manual as issue test steps.
Change-Id: I303403d63c91c08fabcb8c5b1b1aac42c4ec65db
2020-05-25 21:20:33 +08:00
Mark Renouf
a927929d99 Scroll Capture Framework
This is an implementation of long screenshots supporting
interactive, incremental capture of scrolling content using
a cooperative API between the app process and the system.

Design goals:

 - Provide for tile based incremental screenshots of scrolling content
 - Support existing apps without developer action
 - Provide support for non View-based Apps & UI toolkits

Bug: 148131831
Test: atest \
      FrameworksCoreTests:android.view.ScrollCaptureClientTest \
      FrameworksCoreTests:android.view.ScrollCaptureTargetResolverTest \
      FrameworksCoreTests:com.android.internal.view.ViewGroupScrollCaptureTest \
      FrameworksCoreTests:android.view.ScrollViewCaptureHelperTest \
      WmTests:com.android.server.wm.DisplayContentTest

Merged-In: I6c66a623faba274c35b8fa857d3a72030a763aea
Change-Id: I6c66a623faba274c35b8fa857d3a72030a763aea
2020-04-20 15:07:59 +00:00
Wei Sheng Shih
1a46294fdb Merge "Support addWindow as other user" into rvc-dev 2020-04-10 08:33:12 +00:00
Ming-Shin Lu
1c92e1f789 Merge "Trigger onTaskAppeared when a task started from recents becomes ready." into rvc-dev 2020-04-10 05:46:13 +00:00
lumark
04bceb99f1 Trigger onTaskAppeared when a task started from recents becomes ready.
In quick switch flows, launcher will first swipe task snapshot
through recents animation, and then start new task with custom animation
options through startActivityFromRecents after gesture finish detected,
and then finish recents animation finally.

But that way user may experience flickering before the new task launch
and recents animation finish.

To improve quick switch flickering, we ignore the new task's custom
animation from recents and generate task remote animation target,
and then trigger a callback for launcher to control/animate this
task surface, more like a part of RecentsAnimation,

Also, adding removeTask method for launcher can flexibility remove the
new task animation target once no need to animate, so that launcher
can decide when to finish recents animation.

Bug: 152480470
Test: manual as below steps:
  1) Doing quick switch task.
  2) Make sure launcher can receive onTaskAppeared callback.
  3) Make sure launcher calls removeTask successfully.
  4) Make sure launcher can finish recents animation after 3).
Change-Id: I0692a280a49719229fa8871509bad37a1343a00f
2020-04-10 02:20:03 +08:00
Charles Chen
5c082c998f Merge "Fix WindowContext leak" into rvc-dev 2020-04-09 07:39:29 +00:00
Charles Chen
4bff5be1a9 Fix WindowContext leak
The root causes of this issue are:
  1. WindowTokenClient#attachContext makes WindowTokenClient has strong
     reference to WindowContext, which leads to WindowContext cannot be
     GC'd.
  2. WMS#removeWindowToken needs MANAGE_APP_TOKEN permission which
     normal apps don't hold.

This CL does following things:
  1. Use weak reference instead on WindowTokenClient#mContext.
  2. Relax WMS#removeWindowToken to check callingUid if
     MANAGE_WINDOW_TOKEN permission is not held
  3. Deliver config changes to the client side in
     WMS#addWindowTokenWithOption
  4. Some minor fixes

fixes: 150812449
Bug: 150715095
Test: atest WindowContextTest
Test: atest WindowManagerServiceTests
Test: atest WindowTokenTests
Test: atest WindowManagerPermissionTests#testMANAGE_APP_TOKENS
Test: atest
WindowManagerPermissionTests#testADD_WINDOW_TOKEN_WITH_OPTIONS

Change-Id: I9f1d73af2abb78fc9844e6d9eb25e9f0293514e7
2020-04-08 21:30:24 +08:00
wilsonshih
d0fc2ca51f Support addWindow as other user
Support addWindow with the other userId which can be different from Uid.

This can be used when client want to addView for secondary user.
Example:
1. Create context with createContextAsUser or similar method.
2. Get WindowManager with this context.
3. WindowManager#addView

Bug: 151414297
Test: atest WmTests WindowAddRemovePerfTest AddWindowAsUserTest
Change-Id: I13e58d76b1f056f3829bc984c2b61496c8f8d535
2020-04-08 15:15:01 +08:00
TreeHugger Robot
6bb03f2447 Merge "Do not remove window if IWindow#resized is failed" into rvc-dev 2020-04-06 04:15:49 +00:00
Riddle Hsu
839b5f55f9 Do not remove window if IWindow#resized is failed
Even DeadObjectException is thrown, it is not equivalent to the
window is died (transaction failed by small size data will be
DeadObjectException). Sometimes it may be caused by the binder
buffer of process is temporarily full. If the window is removed
directly but the process is still alive, the application client
and window manager are out of sync. Especially if the window is
important system window, e.g. status bar, notification shade,
navigation bar, which might need to reboot to recover. Ideally,
if the process is really dead, there should be a binderDied
callback that also removes the window.

The original purpose of the removal is to avoid display frozen
(e.g. rotation) always timeout which is caused by resetting
WindowState#mOrientationChanging in each layout traversal. Now
the window states are still updated as "resized" has reported,
so it won't block unfreeze display.

Bug: 151814107
Bug: 147448299
Test: atest WindowStateTests#testReportResizedWithRemoteException
Test: Hard code to throw RemoteException for a specified window
      and rotate the display.

Change-Id: Id295456cc99ab9af30aa5fad2eedada6afb862a2
2020-04-03 14:59:12 +00:00
Andrii Kulian
86d676c81f 3/n Refactor TaskContainers to TaskDisplayArea
Renamed TaskContainers to TaskDisplayArea and added getDisplayArea()
method to WindowContainer that finds the first display area in the
hierarchy above the node. ActivityRecord and Task override it to
return the TaskDisplayArea class.

Bug: 152116619
Test: WM CTS and unit tests
Change-Id: I4525afbcd794848e1020213cdca04d89a646dd55
2020-03-31 12:15:57 -07:00
Andrii Kulian
526ad439c3 1/n Move TaskContainers out of DisplayContent class
No changes in logic, just moving the code around.

Bug: 152116619
Test: WM CTS and unit tests
Change-Id: I4aa142e07e39950d077c685bb157b4abb2172886
2020-03-27 17:20:46 -07:00
Evan Rosky
55bddd83ea Generalize change transition into WindowContainer
Created a SurfaceFreezer class which lives in WindowContainer
and manages/will-manage per-container freezing (snapshots).
This replaces the one-off change transition code.

Change Transitions used to create its own temporary leash
on initialization and that leash would be replaced/cleaned-up
as soon as the animation leash was created.

Now, the SurfaceFreezer creates the animation leash immediately
and SurfaceAnimator can take a SurfaceFreezer instance when it
starts an animation. At this point it will take the leash that
was already created by the freezer and use that. This removes
the messy reparenting/cleanup.

To deal with this, though, leash callbacks into Animatable
needed an extra stage: onLeashAnimationStarting. This is called
when SurfaceAnimatior is actually starting to animate the leash.

Next, DC.mChangingApps was converted to list of WindowContainers
rather than ActivityRecords. Some of the existing change code was
cleaned up (ie. there was some visibility stuff that doesn't make
sense because changing apps are visible->visible) and some of the
Activity-specific functions were generalized. For now, there are
a couple things that use the top-activity for changing Tasks.

The result of this means that windowing-mode change transition can
now fully live at the Task level. This also should allow freezing
at any hierarchy level which enables app-freezes that don't freeze
the whole screen and potentially mixed seamless/snapshot-based
rotations.

Bug: 149490428
Test: existing tests pass. Manually open app in freeform and
      maximize/restore it.
Change-Id: Ib32524ebbbb084a98442d3d035897306a11ee6c2
(cherry picked from commit e55b9e0f9d)
2020-02-25 11:51:36 -08:00
Andrii Kulian
02c0e4d2ac Handle config/display changes for WindowContext
Introduce IWindowToken to report config/display changes from
server side. When config change callback is received,
it will update the resources associated with the window token.

Test: WindowContextTests
Bug: 128338354
Bug: 146820733

Change-Id: I871bd78a21dbde1286786e65c340b6259b873660
2020-02-21 16:07:32 +08:00
Linus Tufvesson
b386456680 Block TYPE_PRESENTATION windows on default display
... and any other display that isn't considered a public presentation
display, as per Display.isPublicPresentation()

Bug: 141745510
Test: atest CtsWindowManagerDeviceTestCases:PresentationTest
Change-Id: I2aaab1903dee54190338f7b6e49888aa51437108
2020-02-17 13:37:25 +00:00
Issei Suzuki
2b1f4315b0 Merge "Add animation type in SurfaceAnimator" 2020-02-03 10:04:01 +00:00
Adrian Roos
22a20a8174 WM: Introduce DisplayArea (3/n)
Introduces the concept of a DisplayArea, corresponding to an area
on a logical display within which content can be placed.

DisplayAreas can contain more DisplayAreas, WindowTokens and ActivityStacks.

A future CL will expose an API which allows leashing a DisplayArea to transform
all its content simultaneously.

DisplayAreas are managed by a DisplayAreaPolicy, which creates and places the
areas, and decides which area a container is placed in.

This CL introduces the concept, but applies a no-op policy that maintains the
current orderings and does not apply any overrides.

Future work that remains:
- Writing the feature policies
- Adjusting Display & DisplayMetrics if the area is constraining its children.
- Moving the policy into an product-adjustable component

Bug: 147406652
Test: atest WmTests
Change-Id: If6fb1bba3b65ebf7ac9fdf99408c54bf77f602c9
2020-02-01 09:07:42 +00:00
Issei Suzuki
8b995dfc3f Add animation type in SurfaceAnimator
Animation type is specified when starting a surface animation,
and is passed as an argument of a callback which is triggered
when a surface animation finishes.

Bug: 131661052
Bug: 142617871
Test: atest DimmerTests SurfaceAnimatorTest
Change-Id: I89c671cf49b049dd241b874096d8ef245deb547d
2020-01-31 17:51:01 +01:00
Tarandeep Singh
a6590189c8 Handle IME target change gracefully
App window requests IME, IME would be shown when showSoftInput() is
called from currently IME target.
This CL handles cases when IME target changes after showSoftInput was called
from the initial window and new window has received focus within same
app/task.
This CL also reports current control target on every startInput, which
sets current control target in WM.

Bug: 111084606
Test: atest CtsInputMethodTestCases
      1. Open files app
      2. Tap editor and make sure IME shows.
      3. Open bubbles app.
      4. Create a bubble and try typing in it.
      5. verify IME shows as expected.
Change-Id: I9e8984b7e5aa989a53ece9e2576393f795b9ef94
2020-01-29 17:51:36 -08:00
Vadim Caen
fc14c66439 More verbose messaging for orientation debugging
Test: N/A
Bug: 143053092
Change-Id: I05c5a9a1c61221c2966f72bb0e8479bd7130cb1b
2020-01-23 12:20:30 +01:00
Issei Suzuki
8cac70a65e Merge "Promote app transition target its ancestor if possible." 2019-12-20 12:44:09 +00:00
Issei Suzuki
0ae90d0cca Promote app transition target its ancestor if possible.
Previously we only animated ActivityRecord. When hierarchical animation
is enabled, we find the top most entity from the window hierarchy (i.e.
ActivityRecord < Task < ActivityStack) which we can animate without
user visible changes, and set app transition animation on it.

The hierarchical animation is disabled by default. To enable it,
system property "persist.wm.hierarchical_animations" must be set.

Test: atest AppTransitionControllerTest
Bug: 131661052
Change-Id: I4709fd178de09d289d72cf1833b056b4e34fc92b
2019-12-20 11:05:33 +01:00
Vadim Caen
1096f11e21 Better debbugging message for orientation
Test: N/A
Bug: N/A
Change-Id: Iefe688c3aa10857a6d7d87236a095605a62d1ff0
2019-12-19 12:47:10 +01:00
Louis Chang
677921fc25 Merge ActivityDisplay and DisplayContent into one class (77/n)
Bug: 80414790
Test: Existing tests pass
Change-Id: I1924af0d353406ad950b9758e19384a579ad1426
2019-12-13 17:51:46 +08:00
Issei Suzuki
2bcbd6809c Separate animation applying logic from commitVisibility
Test: Refactoring. Pass existing tests.
Bug: 131661052

Change-Id: Ic455bcf77d405410ed8639664b643564fb089338
2019-12-11 11:33:31 +08:00
Issei Suzuki
d4ee1cc971 Clean up visibility related flags in ActivityRecord
- Replace mClientHidden by mClientVisible

Test: Refactoring, all existing tests pass.
Bug: 80414790
Change-Id: I4c122bf5418182ab7456ee2548195dbbab79fad6
2019-11-21 15:56:53 +01:00
Issei Suzuki
f2f6c91dd3 Clean up visibility related flags in WindowToken
- Replace isHidden() and setHidden() by isVisible() and setVisible()
  in accordance with variable names.
- Move isVisible() from AppRecord to WindowToken

Test: Refactoring CL, existing tests pass.
Bug: 80414790
Change-Id: Ib39200acbedf204adf57c06a8b8bbb3d07f959d1
2019-11-21 15:56:26 +01:00
Issei Suzuki
17c36347cc Merge "Clean up visibility related flags in ActivityRecord" 2019-11-21 14:53:41 +00:00
Wale Ogunwale
7a8889a816 Remove Task#numFullscreen & ActivityRecord#sendingToBottom/remove (70/n)
- Task#numberFullscreen was only used in one location where we
needed to figure-out if the task has occluding activities.
Just use the hierarchy to figure that out vs. keeping track of
a variable that adds confusion.
- ActivityRecord#sendingToBottom was used to prevent focus and
orientation changes from activity moved to the bottom, however
since we are traversing the hierarchy from top-to-bottom we
should process activities on-top first vs the onces that have
already moved to the bottom.
- ActivityRecord#remove is no longer needed as the object won't
be connected to the hierarchy when it is removed.

Test: They pass!
Bug: 80414790
Bug: 35699615
Change-Id: I23f6501a65bf745dc0fb819c30543cd21241fa91
2019-11-19 23:37:07 +00:00
Issei Suzuki
1669ea4bc8 Clean up visibility related flags in ActivityRecord
- Replace visible and hiddenRequested flag by a single flag
  mVisibleRequested.
- Merge setVisible() into setVisiblity().

Test: Refactoring, all existing tests pass.
Bug: 80414790
Change-Id: I7bafdb86e6b8431046775d3968d24f85c3fac45a
2019-11-19 17:16:39 +01:00
Issei Suzuki
430a111553 Revert "Clean up visibility related flags in ActivityRecord"
This reverts commit f8c7ced903.

Reason for revert: broke dev test (com.roidapp.photogrid)
Fixes: 144403961
2019-11-14 16:20:52 +01:00
Issei Suzuki
7b9e257908 Revert "Clean up visibility related flags in WindowToken"
This reverts commit cf0d2ae88d.

Reason for revert: broke dev test (com.roidapp.photogrid)
Fixes: 144403961

Change-Id: I77920d16062190b4565d4c95687b06fc587f9817
2019-11-14 16:19:54 +01:00
Issei Suzuki
e63eac7a99 Revert "Clean up visibility related flags in ActivityRecord"
This reverts commit c0edbbb521.

Reason for revert: broke dev test (com.roidapp.photogrid)
Fixes: 144403961

Change-Id: I71ef435cfbdab46d2e57f2ed68af3eff04958a99
2019-11-14 16:03:02 +01:00
Issei Suzuki
c0edbbb521 Clean up visibility related flags in ActivityRecord
- Replace mClientHidden by mClientVisible

Test: Refactoring, all existing tests pass.
Bug: 80414790
Change-Id: Ica79662b7c2d85d6862b96d1e6cedfde704a2c15
2019-11-13 16:58:14 +01:00
Issei Suzuki
cf0d2ae88d Clean up visibility related flags in WindowToken
- Replace isHidden() and setHidden() by isVisible() and setVisible()
  in accordance with variable names.
- Move isVisible() from AppRecord to WindowToken

Test: Refactoring CL, existing tests pass.
Bug: 80414790
Change-Id: Ie77bf1d00336e655b1fbee15d419c6959da2e0c9
2019-11-12 18:26:12 +01:00
Issei Suzuki
f8c7ced903 Clean up visibility related flags in ActivityRecord
- Replace visible and hiddenRequested flag by a single flag
  mVisibleRequested.
- Merge setVisible() into setVisiblity().

Test: Refactoring, all existing tests pass.
Bug: 80414790
Change-Id: I2a959632430d90ef5c0f738aa791ef230c4a21f1
2019-11-12 18:14:14 +01:00
TreeHugger Robot
59cee214bf Merge "Merge Task and TaskRecord into one class (65/n)" 2019-11-12 04:11:33 +00:00
Louis Chang
cdec080895 Merge Task and TaskRecord into one class (65/n)
Merge Task and TaskRecord into a single Task class. Also Consolidate
updateTaskMovement() call points to TaskStack.onChildPositionChanged().

Bug: 80414790
Test: Existing tests pass
Change-Id: Iec0101b211bf34fab42131aae6cddfe1262e2add
2019-11-12 10:29:39 +08:00
Vadim Caen
311fef7bee Call end callback for custom rotation anim.
The onAnimationEnd callback was not called when a cutstum animation was
set (e.g: JUMPCUT) causing WindowState.mOrientationChanging to never be
reset to false and drawing being held.

Bug: 142255739
Test: atest PixelCopyTest#testWindowProducerCropTopLeft
Change-Id: If35a0bb0ad94050fba086cb81f8265c0bf0535eb
2019-11-08 11:55:54 +01:00
TreeHugger Robot
d41a725956 Merge "Generalized AppWindowThumbnail as WindowContainerThumbnail" 2019-11-06 22:16:20 +00:00
lumark
bc0032a39c Generalized AppWindowThumbnail as WindowContainerThumbnail
Also modified some miscellaneous code logics related animation.

Bug: 142617871
Bug: 131661052
Test: Refactoring, existing tests pass.
Change-Id: Ia06d500bc6b6bf247d840d14cc81d2358af2d400
2019-11-07 01:56:56 +08:00
Issei Suzuki
860fbc04ed Removed unused flag ActivityRecord.inPendingTransaction
Test: no-op change, still all tests pass
Change-Id: Ib350f75fbdabcb21930e95cc316563168b6f117d
2019-11-01 14:46:35 +01:00
lumark
19a5d2e993 Promote AppWindowToken.applyAnimationLocked() to the base class.
- Add WindowContainer#getAnimationAdapter for all window hierarchy.

- Extract logics related Remote animation / Local animation adapter
  creation from applyAnimationLocked into WC#getAnimationAdapter.

- Make RemoteAnimationRecord can accept in each window hierarchy.

Bug: 142617871
Bug: 131661052
Test: Refactoring, existing tests pass.
Change-Id: If1c39d09966d82653faf7ebd975592eaeacd7c24
2019-10-31 00:52:58 +08:00
Wale Ogunwale
c17418e0ae Clean-up ActivityRecord reparenting/adding to Task (57/n)
- Updated Configuration#onParentChanged to take params newParent and
oldParent to make logic of reparenting less complex to deal with in
classes that extend.
- Introduced WindowContainer#reparent to consolidate reparenting logic
and also allow us to only set onParentChanged once for the operation.
- Simplfied logic flow around adding/remove/reparenting activity to
task by using methods like addChild(), onChildAdded(), and such.
- Removed Task.mDeferRemoval which no longer makes sense and was leading
to task and stack leaks.

Bug: 80414790
Test: Existing tests pass
Change-Id: I4ffa79a1c731dc137213bdd3d7f04b8f013decc4
2019-10-26 21:07:44 -07:00
Adrian Roos
1148054e7c ProtoLog: Fix bug in ProtoLogImpl.isEnabled and re-enable
Test: make droid && atest RelayoutPerfTest
Change-Id: I060063354a217682c7b4ff3b5f7db1c330a8a160
2019-10-18 18:38:13 +02:00
Garfield Tan
e8d84ab020 Merge AppWindowToken into ActivityRecord
This change kept AppWindowTokenTests as it's originally based on top of
WindowTestBase, and merging that into ActivityRecordTests needs to
change the base class to ActivityTestBase, which requires additional
work and may change test behaviors. Therefore delay that to
follow-up CL.

Bug: 80414790
Test: Existing tests pass.
Change-Id: I6d73975ee77be9817c41b297f067de2d92a68499
2019-10-17 11:10:02 -07:00
Wale Ogunwale
da8b827e21 Unify Activity level of window hierarchy (50/n).
Make ActivityRecord extend AppWindowToken so we have a single object
for acitvities in the hierarchy.

Bug: 80414790
Test: Existing tests pass.
Change-Id: Ia7f52ef444cba88223f4e8a9586f6c12b1b5e4ea
2019-10-05 15:08:45 -07:00