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

Commit f75d161d authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Improve animation dump/logging

Bug: 74220420
Test: go/wm-smoke
Test: adb shell dumpsys window during animation
Change-Id: Ib8bddb4f38ad4fe7a80315d3bfdac0a80aea4cc8
parent f0927b07
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
@@ -16,13 +16,26 @@

package android.view;

import static android.app.RemoteAnimationTargetProto.CLIP_RECT;
import static android.app.RemoteAnimationTargetProto.CONTENT_INSETS;
import static android.app.RemoteAnimationTargetProto.IS_TRANSLUCENT;
import static android.app.RemoteAnimationTargetProto.LEASH;
import static android.app.RemoteAnimationTargetProto.MODE;
import static android.app.RemoteAnimationTargetProto.POSITION;
import static android.app.RemoteAnimationTargetProto.PREFIX_ORDER_INDEX;
import static android.app.RemoteAnimationTargetProto.SOURCE_CONTAINER_BOUNDS;
import static android.app.RemoteAnimationTargetProto.TASK_ID;
import static android.app.RemoteAnimationTargetProto.WINDOW_CONFIGURATION;

import android.annotation.IntDef;
import android.app.WindowConfiguration;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.proto.ProtoOutputStream;

import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@@ -164,6 +177,35 @@ public class RemoteAnimationTarget implements Parcelable {
        dest.writeBoolean(isNotInRecents);
    }

    public void dump(PrintWriter pw, String prefix) {
        pw.print(prefix); pw.print("mode="); pw.print(mode);
        pw.print(" taskId="); pw.print(taskId);
        pw.print(" isTranslucent="); pw.print(isTranslucent);
        pw.print(" clipRect="); clipRect.printShortString(pw);
        pw.print(" contentInsets="); contentInsets.printShortString(pw);
        pw.print(" prefixOrderIndex="); pw.print(prefixOrderIndex);
        pw.print(" position="); position.printShortString(pw);
        pw.print(" sourceContainerBounds="); sourceContainerBounds.printShortString(pw);
        pw.println();
        pw.print(prefix); pw.print("windowConfiguration="); pw.println(windowConfiguration);
        pw.print(prefix); pw.print("leash="); pw.println(leash);
    }

    public void writeToProto(ProtoOutputStream proto, long fieldId) {
        final long token = proto.start(fieldId);
        proto.write(TASK_ID, taskId);
        proto.write(MODE, mode);
        leash.writeToProto(proto, LEASH);
        proto.write(IS_TRANSLUCENT, isTranslucent);
        clipRect.writeToProto(proto, CLIP_RECT);
        contentInsets.writeToProto(proto, CONTENT_INSETS);
        proto.write(PREFIX_ORDER_INDEX, prefixOrderIndex);
        position.writeToProto(proto, POSITION);
        sourceContainerBounds.writeToProto(proto, SOURCE_CONTAINER_BOUNDS);
        windowConfiguration.writeToProto(proto, WINDOW_CONFIGURATION);
        proto.end(token);
    }

    public static final Creator<RemoteAnimationTarget> CREATOR
            = new Creator<RemoteAnimationTarget>() {
        public RemoteAnimationTarget createFromParcel(Parcel in) {
+78 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

syntax = "proto2";

import "frameworks/base/core/proto/android/graphics/point.proto";
import "frameworks/base/core/proto/android/view/remote_animation_target.proto";
import "frameworks/base/libs/incident/proto/android/privacy.proto";

package com.android.server.wm.proto;
option java_multiple_files = true;

message AnimationAdapterProto {
  option (.android.msg_privacy).dest = DEST_AUTOMATIC;

  optional LocalAnimationAdapterProto local = 1;
  optional RemoteAnimationAdapterWrapperProto remote = 2;
}

/* represents RemoteAnimationAdapterWrapper */
message RemoteAnimationAdapterWrapperProto {
  option (.android.msg_privacy).dest = DEST_AUTOMATIC;

  optional .android.view.RemoteAnimationTargetProto target = 1;
}

/* represents LocalAnimationAdapter */
message LocalAnimationAdapterProto {
  option (.android.msg_privacy).dest = DEST_AUTOMATIC;

  optional AnimationSpecProto animation_spec = 1;
}

message AnimationSpecProto {
  option (.android.msg_privacy).dest = DEST_AUTOMATIC;

  optional WindowAnimationSpecProto window = 1;
  optional MoveAnimationSpecProto move = 2;
  optional AlphaAnimationSpecProto alpha = 3;
}

/* represents WindowAnimationSpec */
message WindowAnimationSpecProto {
  option (.android.msg_privacy).dest = DEST_AUTOMATIC;

  optional string animation = 1;
}

/* represents MoveAnimationSpec*/
message MoveAnimationSpecProto {
  option (.android.msg_privacy).dest = DEST_AUTOMATIC;

  optional .android.graphics.PointProto from = 1;
  optional .android.graphics.PointProto to = 2;
  optional int64 duration = 3;
}

/* represents AlphaAnimationSpec */
message AlphaAnimationSpecProto {
  option (.android.msg_privacy).dest = DEST_AUTOMATIC;

  optional float from = 1;
  optional float to = 2;
  optional int64 duration = 3;
}
 No newline at end of file
+3 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

syntax = "proto2";

import "frameworks/base/core/proto/android/server/animationadapter.proto";
import "frameworks/base/core/proto/android/view/surfacecontrol.proto";
import "frameworks/base/libs/incident/proto/android/privacy.proto";

@@ -28,7 +29,8 @@ option java_multiple_files = true;
message SurfaceAnimatorProto {
  option (.android.msg_privacy).dest = DEST_AUTOMATIC;

  optional string animation_adapter = 1;
  reserved 1; // Was string animation_adapter = 1
  optional .android.view.SurfaceControlProto leash = 2;
  optional bool animation_start_delayed = 3;
  optional AnimationAdapterProto animation_adapter = 4;
}
 No newline at end of file
+43 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

syntax = "proto2";
option java_package = "android.app";
option java_multiple_files = true;

package android.view;

import "frameworks/base/core/proto/android/app/window_configuration.proto";
import "frameworks/base/core/proto/android/graphics/point.proto";
import "frameworks/base/core/proto/android/graphics/rect.proto";
import "frameworks/base/core/proto/android/view/surfacecontrol.proto";
import "frameworks/base/libs/incident/proto/android/privacy.proto";

/** Proto representation for RemoteAnimationTarget.java class. */
message RemoteAnimationTargetProto {
  option (android.msg_privacy).dest = DEST_AUTOMATIC;

  optional int32 task_id = 1;
  optional int32 mode = 2;
  optional .android.view.SurfaceControlProto leash = 3;
  optional bool is_translucent = 4;
  optional .android.graphics.RectProto clip_rect = 5;
  optional .android.graphics.RectProto contentInsets = 6;
  optional int32 prefix_order_index = 7;
  optional .android.graphics.PointProto position = 8;
  optional .android.graphics.RectProto source_container_bounds = 9;
  optional .android.app.WindowConfigurationProto window_configuration = 10;
}
+13 −1
Original line number Diff line number Diff line
@@ -17,13 +17,15 @@
package com.android.server.wm;

import android.annotation.ColorInt;
import android.graphics.Point;
import android.util.proto.ProtoOutputStream;
import android.view.SurfaceControl;
import android.view.SurfaceControl.Transaction;
import android.view.animation.Animation;

import com.android.server.wm.SurfaceAnimator.OnAnimationFinishedCallback;

import java.io.PrintWriter;

/**
 * Interface that describes an animation and bridges the animation start to the component
 * responsible for running the animation.
@@ -83,4 +85,14 @@ interface AnimationAdapter {
     * @return the desired start time of the status bar transition, in uptime millis
     */
    long getStatusBarTransitionsStartTime();

    void dump(PrintWriter pw, String prefix);

    default void writeToProto(ProtoOutputStream proto, long fieldId) {
        final long token = proto.start(fieldId);
        writeToProto(proto);
        proto.end(token);
    }

    void writeToProto(ProtoOutputStream proto);
}
Loading