Skip to content
Commit c7746aa3 authored by Tiger Huang's avatar Tiger Huang
Browse files

Release leashes of insets controls if they are not needed

Previously, leashes would be only released by GC in some cases, but the
timing could be late. This CL proactively release them as long as they
are not needed. The cases were:

1. The leashes in DisplayImeController. It didn't release leashes while
   receiving a new one.

2. The leashes returned from addWindow/relayoutWindow. The leashes would
   be copied to prevent others from releasing them before writeToParcel.
   The copied leashes could be redundant after writeToParcel.

3. The leashes held by the client whose window is removed. If a window
   is removed, the server won't invoke mClient.insetsControlChanged, so
   the client would never get notified about losing control to release
   the leashes. This could happen if the window doesn't have an exiting
   animation.

Fix: 175851610
Test: Steps in the bug.
Test: Show and dismiss a dialog which doesn't have FLAG_ALT_FOCUSABLE_IM
      or any window animation. Repeat this thousands of times. And see
      if there are many insets leashes as offscreen layers in `dumpsys
      SurfaceFlinger`
Change-Id: I5eb774ac071154a8d7205dbd1ab4a5f8eca215c3
parent 9515d87d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment