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

Commit e52ae82e authored by Yunfan Chen's avatar Yunfan Chen
Browse files

Deprecate type name proto dump

Stop dumping type name string into proto and use the type number
instead.

For CTS purpose, exposet the toString to CTS as a test API.

Test: m cts
Test: winscope
Bug: 311548419
Change-Id: I793c1273861f60be82e780165c3ec89702cf7145
parent 5d46b5c6
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3589,6 +3589,10 @@ package android.view {
    method @Nullable public android.view.View getStatusBarBackgroundView();
  }

  public static final class WindowInsets.Type {
    method @NonNull public static String toString(int);
  }

  public interface WindowManager extends android.view.ViewManager {
    method public default int getDisplayImePolicy(int);
    method public static boolean hasWindowExtensionsEnabled();
+1 −3
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package android.view;

import static android.view.InsetsSourceProto.FRAME;
import static android.view.InsetsSourceProto.TYPE;
import static android.view.InsetsSourceProto.TYPE_NUMBER;
import static android.view.InsetsSourceProto.VISIBLE;
import static android.view.InsetsSourceProto.VISIBLE_FRAME;
@@ -353,13 +352,12 @@ public class InsetsSource implements Parcelable {
     */
    public void dumpDebug(ProtoOutputStream proto, long fieldId) {
        final long token = proto.start(fieldId);
        proto.write(TYPE, WindowInsets.Type.toString(mType));
        proto.write(TYPE_NUMBER, mType);
        mFrame.dumpDebug(proto, FRAME);
        if (mVisibleFrame != null) {
            mVisibleFrame.dumpDebug(proto, VISIBLE_FRAME);
        }
        proto.write(VISIBLE, mVisible);
        proto.write(TYPE_NUMBER, mType);
        proto.end(token);
    }

+2 −2
Original line number Diff line number Diff line
@@ -21,11 +21,11 @@ import static android.view.InsetsController.AnimationType;
import static android.view.InsetsController.DEBUG;
import static android.view.InsetsSourceConsumerProto.ANIMATION_STATE;
import static android.view.InsetsSourceConsumerProto.HAS_WINDOW_FOCUS;
import static android.view.InsetsSourceConsumerProto.INTERNAL_INSETS_TYPE;
import static android.view.InsetsSourceConsumerProto.IS_REQUESTED_VISIBLE;
import static android.view.InsetsSourceConsumerProto.PENDING_FRAME;
import static android.view.InsetsSourceConsumerProto.PENDING_VISIBLE_FRAME;
import static android.view.InsetsSourceConsumerProto.SOURCE_CONTROL;
import static android.view.InsetsSourceConsumerProto.TYPE_NUMBER;

import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE;

@@ -393,7 +393,6 @@ public class InsetsSourceConsumer {

    void dumpDebug(ProtoOutputStream proto, long fieldId) {
        final long token = proto.start(fieldId);
        proto.write(INTERNAL_INSETS_TYPE, WindowInsets.Type.toString(mType));
        proto.write(HAS_WINDOW_FOCUS, mHasWindowFocus);
        proto.write(IS_REQUESTED_VISIBLE, isShowRequested());
        if (mSourceControl != null) {
@@ -406,6 +405,7 @@ public class InsetsSourceConsumer {
            mPendingVisibleFrame.dumpDebug(proto, PENDING_VISIBLE_FRAME);
        }
        proto.write(ANIMATION_STATE, mAnimationState);
        proto.write(TYPE_NUMBER, mType);
        proto.end(token);
    }
}
+3 −3
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ import static android.graphics.PointProto.X;
import static android.graphics.PointProto.Y;
import static android.view.InsetsSourceControlProto.LEASH;
import static android.view.InsetsSourceControlProto.POSITION;
import static android.view.InsetsSourceControlProto.TYPE;
import static android.view.InsetsSourceControlProto.TYPE_NUMBER;

import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -244,8 +244,6 @@ public class InsetsSourceControl implements Parcelable {
     */
    public void dumpDebug(ProtoOutputStream proto, long fieldId) {
        final long token = proto.start(fieldId);
        proto.write(TYPE, WindowInsets.Type.toString(mType));

        final long surfaceToken = proto.start(POSITION);
        proto.write(X, mSurfacePosition.x);
        proto.write(Y, mSurfacePosition.y);
@@ -254,6 +252,8 @@ public class InsetsSourceControl implements Parcelable {
        if (mLeash != null) {
            mLeash.dumpDebug(proto, LEASH);
        }

        proto.write(TYPE_NUMBER, mType);
        proto.end(token);
    }

+5 −0
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.TestApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Intent;
import android.graphics.Insets;
@@ -1519,6 +1521,9 @@ public final class WindowInsets {
        }

        /** @hide */
        @TestApi
        @NonNull
        @SuppressLint("UnflaggedApi") // @TestApi without associated feature.
        public static String toString(@InsetsType int types) {
            StringBuilder result = new StringBuilder();
            if ((types & STATUS_BARS) != 0) {
Loading