Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 31e1a5d1 authored by Tiger Huang's avatar Tiger Huang Committed by Android (Google) Code Review
Browse files

Merge "Release leashes which won't be used" into main

parents d00e36a4 c798beca
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ public class InsetsAnimationThreadControlRunner implements InsetsAnimationContro
            Trace.asyncTraceEnd(Trace.TRACE_TAG_VIEW,
                    "InsetsAsyncAnimation: " + WindowInsets.Type.toString(runner.getTypes()),
                    runner.getTypes());
            releaseControls(mControl.getControls());
            InsetsController.releaseControls(mControl.getControls());
            mMainThreadHandler.post(() ->
                    mOuterCallbacks.notifyFinished(InsetsAnimationThreadControlRunner.this, shown));
        }
@@ -130,12 +130,6 @@ public class InsetsAnimationThreadControlRunner implements InsetsAnimationContro
        });
    }

    private void releaseControls(SparseArray<InsetsSourceControl> controls) {
        for (int i = controls.size() - 1; i >= 0; i--) {
            controls.valueAt(i).release(SurfaceControl::release);
        }
    }

    @Override
    @UiThread
    public void dumpDebug(ProtoOutputStream proto, long fieldId) {
+9 −0
Original line number Diff line number Diff line
@@ -1353,6 +1353,9 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
                });
            }

            // The leashes are copied, but they won't be used.
            releaseControls(controls);

            // The requested visibilities should be delayed as well. Otherwise, we might override
            // the insets visibility before playing animation.
            setRequestedVisibleTypes(mReportedRequestedVisibleTypes, types);
@@ -1422,6 +1425,12 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
        }
    }

    static void releaseControls(SparseArray<InsetsSourceControl> controls) {
        for (int i = controls.size() - 1; i >= 0; i--) {
            controls.valueAt(i).release(SurfaceControl::release);
        }
    }

    // TODO(b/242962223): Make this setter restrictive.
    @Override
    public void setSystemDrivenInsetsAnimationLoggingListener(