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

Commit 7f930ba4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "layerid-in-wm-trace"

* changes:
  Dump WindowContainer SurfaceControls to proto
  Dump SurfaceControl's layerId to proto
  Expose SurfaceControl's native mLayerId property to Java
parents 64940e93 afaa2fed
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static android.graphics.Matrix.MSKEW_Y;
import static android.graphics.Matrix.MTRANS_X;
import static android.graphics.Matrix.MTRANS_Y;
import static android.view.SurfaceControlProto.HASH_CODE;
import static android.view.SurfaceControlProto.LAYER_ID;
import static android.view.SurfaceControlProto.NAME;

import android.annotation.FloatRange;
@@ -239,6 +240,7 @@ public final class SurfaceControl implements Parcelable {
    private static native int nativeGetGPUContextPriority();
    private static native void nativeSetTransformHint(long nativeObject, int transformHint);
    private static native int nativeGetTransformHint(long nativeObject);
    private static native int nativeGetLayerId(long nativeObject);

    @Nullable
    @GuardedBy("mLock")
@@ -354,8 +356,6 @@ public final class SurfaceControl implements Parcelable {
    @GuardedBy("mLock")
    private int mHeight;

    private int mTransformHint;

    private WeakReference<View> mLocalOwnerView;

    static GlobalTransactionWrapper sGlobalTransaction;
@@ -1538,6 +1538,7 @@ public final class SurfaceControl implements Parcelable {
        final long token = proto.start(fieldId);
        proto.write(HASH_CODE, System.identityHashCode(this));
        proto.write(NAME, mName);
        proto.write(LAYER_ID, getLayerId());
        proto.end(token);
    }

@@ -3652,4 +3653,15 @@ public final class SurfaceControl implements Parcelable {
    public void setTransformHint(@Surface.Rotation int transformHint) {
        nativeSetTransformHint(mNativeObject, transformHint);
    }

    /**
     * @hide
     */
    public int getLayerId() {
        if (mNativeObject != 0) {
            return nativeGetLayerId(mNativeObject);
        }

        return -1;
    }
}
+8 −0
Original line number Diff line number Diff line
@@ -1815,6 +1815,12 @@ static jint nativeGetTransformHint(JNIEnv* env, jclass clazz, jlong nativeSurfac
    return toRotationInt(ui::Transform::toRotation((transformHintRotationFlags)));
}

static jint nativeGetLayerId(JNIEnv* env, jclass clazz, jlong nativeSurfaceControl) {
    sp<SurfaceControl> surface(reinterpret_cast<SurfaceControl*>(nativeSurfaceControl));

    return surface->getLayerId();
}

// ----------------------------------------------------------------------------

static const JNINativeMethod sSurfaceControlMethods[] = {
@@ -2010,6 +2016,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
            (void*)nativeGetTransformHint },
    {"nativeSetTrustedOverlay", "(JJZ)V",
            (void*)nativeSetTrustedOverlay },
    {"nativeGetLayerId", "(J)I",
            (void*)nativeGetLayerId },
        // clang-format on
};

+1 −0
Original line number Diff line number Diff line
@@ -480,6 +480,7 @@ message WindowContainerProto {
    optional SurfaceAnimatorProto surface_animator = 4;
    repeated WindowContainerChildProto children = 5;
    optional IdentifierProto identifier = 6;
    optional .android.view.SurfaceControlProto surface_control = 7;
}

/* represents a generic child of a WindowContainer */
+1 −0
Original line number Diff line number Diff line
@@ -29,4 +29,5 @@ message SurfaceControlProto {

    optional int32 hash_code = 1;
    optional string name = 2 [ (android.privacy).dest = DEST_EXPLICIT ];
    optional int32 layerId = 3;
}
+4 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import static com.android.server.wm.WindowContainerProto.CONFIGURATION_CONTAINER
import static com.android.server.wm.WindowContainerProto.IDENTIFIER;
import static com.android.server.wm.WindowContainerProto.ORIENTATION;
import static com.android.server.wm.WindowContainerProto.SURFACE_ANIMATOR;
import static com.android.server.wm.WindowContainerProto.SURFACE_CONTROL;
import static com.android.server.wm.WindowContainerProto.VISIBLE;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ANIM;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
@@ -2397,6 +2398,9 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
        if (mSurfaceAnimator.isAnimating()) {
            mSurfaceAnimator.dumpDebug(proto, SURFACE_ANIMATOR);
        }
        if (mSurfaceControl != null) {
            mSurfaceControl.dumpDebug(proto, SURFACE_CONTROL);
        }

        // add children to proto
        for (int i = 0; i < getChildCount(); i++) {