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

Commit 18e4479a authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "InsetSourceConsumer: Ensure we release Leash when finished." into...

Merge "InsetSourceConsumer: Ensure we release Leash when finished." into rvc-dev am: 9a967db5 am: d067c05e

Change-Id: Ia17640e0020f7d667036a883241dbdfcbc15427e
parents 5cf77526 d067c05e
Loading
Loading
Loading
Loading
+18 −15
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ public class InsetsSourceConsumer {
        if (mSourceControl == control) {
            return;
        }
        final InsetsSourceControl lastControl = mSourceControl;
        mSourceControl = control;

        // We are loosing control
@@ -97,26 +98,28 @@ public class InsetsSourceConsumer {
            mState.getSource(getType()).setVisible(
                    mController.getLastDispatchedState().getSource(getType()).isVisible());
            applyLocalVisibilityOverride();
            return;
        }

        // We are gaining control, and need to run an animation since previous state didn't match
        } else {
            // We are gaining control, and need to run an animation since previous state
            // didn't match
            if (mRequestedVisible != mState.getSource(mType).isVisible()) {
                if (mRequestedVisible) {
                    showTypes[0] |= toPublicType(getType());
                } else {
                    hideTypes[0] |= toPublicType(getType());
                }
            return;
        }

        // We are gaining control, but don't need to run an animation. However make sure that the
        // leash visibility is still up to date.
            } else {
              // We are gaining control, but don't need to run an animation.
              // However make sure that the leash visibility is still up to date.
              if (applyLocalVisibilityOverride()) {
                  mController.notifyVisibilityChanged();
              }
              applyHiddenToControl();
            }
        }
        if (lastControl != null) {
            lastControl.release();
        }
    }

    @VisibleForTesting
    public InsetsSourceControl getControl() {
+6 −0
Original line number Diff line number Diff line
@@ -94,6 +94,12 @@ public class InsetsSourceControl implements Parcelable {
        dest.writeParcelable(mSurfacePosition, 0 /* flags*/);
    }

    public void release() {
        if (mLeash != null) {
            mLeash.release();
        }
    }

    public static final @android.annotation.NonNull Creator<InsetsSourceControl> CREATOR
            = new Creator<InsetsSourceControl>() {
        public InsetsSourceControl createFromParcel(Parcel in) {