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

Commit 2461e951 authored by Nataniel Borges's avatar Nataniel Borges Committed by Android (Google) Code Review
Browse files

Merge changes from topic "sync-flicker-sc-v2-dev" into sc-v2-dev

* changes:
  [DO NOT MERGE] Dump windowing mode in Winscope traces
  [DO NOT MERGE] Dump SurfaceControl's layerId to proto
  [DO NOT MERGE] Dump WindowContainer SurfaceControls to proto
  [DO NOT MERGE] Expose SurfaceControl's native mLayerId property to Java
  [DO NOT MERGE] Sync flicker from master to sc-v2
parents 0234494d 732fa80c
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;
@@ -242,6 +243,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")
@@ -357,8 +359,6 @@ public final class SurfaceControl implements Parcelable {
    @GuardedBy("mLock")
    private int mHeight;

    private int mTransformHint;

    private WeakReference<View> mLocalOwnerView;

    static GlobalTransactionWrapper sGlobalTransaction;
@@ -1541,6 +1541,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);
    }

@@ -3675,4 +3676,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
@@ -1827,6 +1827,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[] = {
@@ -2026,6 +2032,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
            (void*)nativeSetTrustedOverlay },
    {"nativeSetDropInputMode", "(JJI)V",
             (void*)nativeSetDropInputMode },
    {"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;
}
+6 −5
Original line number Diff line number Diff line
@@ -14,13 +14,14 @@
 * limitations under the License.
 */

@file:JvmName("CommonAssertions")
package com.android.wm.shell.flicker

import android.content.ComponentName
import android.graphics.Region
import android.view.Surface
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.traces.common.FlickerComponentName

fun FlickerTestParameter.appPairsDividerIsVisibleAtEnd() {
    assertLayersEnd {
@@ -72,7 +73,7 @@ fun FlickerTestParameter.dockedStackDividerNotExistsAtEnd() {

fun FlickerTestParameter.appPairsPrimaryBoundsIsVisibleAtEnd(
    rotation: Int,
    primaryComponent: ComponentName
    primaryComponent: FlickerComponentName
) {
    assertLayersEnd {
        val dividerRegion = layer(APP_PAIR_SPLIT_DIVIDER_COMPONENT).visibleRegion.region
@@ -83,7 +84,7 @@ fun FlickerTestParameter.appPairsPrimaryBoundsIsVisibleAtEnd(

fun FlickerTestParameter.dockedStackPrimaryBoundsIsVisibleAtEnd(
    rotation: Int,
    primaryComponent: ComponentName
    primaryComponent: FlickerComponentName
) {
    assertLayersEnd {
        val dividerRegion = layer(DOCKED_STACK_DIVIDER_COMPONENT).visibleRegion.region
@@ -94,7 +95,7 @@ fun FlickerTestParameter.dockedStackPrimaryBoundsIsVisibleAtEnd(

fun FlickerTestParameter.appPairsSecondaryBoundsIsVisibleAtEnd(
    rotation: Int,
    secondaryComponent: ComponentName
    secondaryComponent: FlickerComponentName
) {
    assertLayersEnd {
        val dividerRegion = layer(APP_PAIR_SPLIT_DIVIDER_COMPONENT).visibleRegion.region
@@ -105,7 +106,7 @@ fun FlickerTestParameter.appPairsSecondaryBoundsIsVisibleAtEnd(

fun FlickerTestParameter.dockedStackSecondaryBoundsIsVisibleAtEnd(
    rotation: Int,
    secondaryComponent: ComponentName
    secondaryComponent: FlickerComponentName
) {
    assertLayersEnd {
        val dividerRegion = layer(DOCKED_STACK_DIVIDER_COMPONENT).visibleRegion.region
Loading