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

Commit f609ddc0 authored by Tiger Huang's avatar Tiger Huang Committed by Automerger Merge Worker
Browse files

Merge "Stop processing if the new control equals the current one" into sc-dev am: 755cd83f

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14211076

Change-Id: If0135d40126f6143305a3eaeb10767573ffcd2d1
parents 77f44628 755cd83f
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import com.android.internal.annotations.VisibleForTesting;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Objects;
import java.util.function.Supplier;

/**
@@ -120,7 +121,11 @@ public class InsetsSourceConsumer {
            ImeTracing.getInstance().triggerClientDump("InsetsSourceConsumer#setControl",
                    mController.getHost().getInputMethodManager(), null /* icProto */);
        }
        if (mSourceControl == control) {
        if (Objects.equals(mSourceControl, control)) {
            if (mSourceControl != null && mSourceControl != control) {
                mSourceControl.release(SurfaceControl::release);
                mSourceControl = control;
            }
            return;
        }
        SurfaceControl oldLeash = mSourceControl != null ? mSourceControl.getLeash() : null;
+28 −0
Original line number Diff line number Diff line
@@ -152,6 +152,34 @@ public class InsetsSourceControl implements Parcelable {
        }
    }

    @Override
    public boolean equals(@Nullable Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        final InsetsSourceControl that = (InsetsSourceControl) o;
        final SurfaceControl thatLeash = that.mLeash;
        return mType == that.mType
                && ((mLeash == thatLeash)
                        || (mLeash != null && thatLeash != null && mLeash.isSameSurface(thatLeash)))
                && mSurfacePosition.equals(that.mSurfacePosition)
                && mInsetsHint.equals(that.mInsetsHint)
                && mSkipAnimationOnce == that.mSkipAnimationOnce;
    }

    @Override
    public int hashCode() {
        int result = mType;
        result = 31 * result + (mLeash != null ? mLeash.hashCode() : 0);
        result = 31 * result + mSurfacePosition.hashCode();
        result = 31 * result + mInsetsHint.hashCode();
        result = 31 * result + (mSkipAnimationOnce ? 1 : 0);
        return result;
    }

    public void dump(String prefix, PrintWriter pw) {
        pw.print(prefix);
        pw.print("InsetsSourceControl type="); pw.print(InsetsState.typeToString(mType));