diff options
| -rw-r--r-- | core/proto/android/graphics/point.proto | 26 | ||||
| -rw-r--r-- | core/proto/android/server/windowmanagerservice.proto | 2 | ||||
| -rw-r--r-- | graphics/java/android/graphics/Point.java | 16 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wm/WindowState.java | 4 |
4 files changed, 48 insertions, 0 deletions
diff --git a/core/proto/android/graphics/point.proto b/core/proto/android/graphics/point.proto new file mode 100644 index 000000000000..5ae17cb5df5d --- /dev/null +++ b/core/proto/android/graphics/point.proto @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2017 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"; +package android.graphics; + +option java_multiple_files = true; + +message PointProto { + optional int32 x = 1; + optional int32 y = 2; +} + diff --git a/core/proto/android/server/windowmanagerservice.proto b/core/proto/android/server/windowmanagerservice.proto index 915fe9d5ce41..ef7b6b0019f3 100644 --- a/core/proto/android/server/windowmanagerservice.proto +++ b/core/proto/android/server/windowmanagerservice.proto @@ -170,6 +170,8 @@ message WindowStateProto { optional WindowStateAnimatorProto animator = 13; optional bool animating_exit = 14; repeated WindowStateProto child_windows = 15; + optional .android.graphics.RectProto surface_position = 16; + optional .android.graphics.RectProto shown_position = 17; } message IdentifierProto { diff --git a/graphics/java/android/graphics/Point.java b/graphics/java/android/graphics/Point.java index abcccbdbc9fb..c6b6c668f03a 100644 --- a/graphics/java/android/graphics/Point.java +++ b/graphics/java/android/graphics/Point.java @@ -18,6 +18,7 @@ package android.graphics; import android.os.Parcel; import android.os.Parcelable; +import android.util.proto.ProtoOutputStream; import java.io.PrintWriter; @@ -121,6 +122,21 @@ public class Point implements Parcelable { out.writeInt(y); } + /** + * Write to a protocol buffer output stream. + * Protocol buffer message definition at {@link android.graphics.PointProto} + * + * @param protoOutputStream Stream to write the Rect object to. + * @param fieldId Field Id of the Rect as defined in the parent message + * @hide + */ + public void writeToProto(ProtoOutputStream protoOutputStream, long fieldId) { + final long token = protoOutputStream.start(fieldId); + protoOutputStream.write(PointProto.X, x); + protoOutputStream.write(PointProto.Y, y); + protoOutputStream.end(token); + } + public static final Parcelable.Creator<Point> CREATOR = new Parcelable.Creator<Point>() { /** * Return a new point from the data in the specified parcel. diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 28de1b2c9931..ddc1eace1ea2 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -118,7 +118,9 @@ import static com.android.server.wm.proto.WindowStateProto.GIVEN_CONTENT_INSETS; import static com.android.server.wm.proto.WindowStateProto.IDENTIFIER; import static com.android.server.wm.proto.WindowStateProto.PARENT_FRAME; import static com.android.server.wm.proto.WindowStateProto.STACK_ID; +import static com.android.server.wm.proto.WindowStateProto.SHOWN_POSITION; import static com.android.server.wm.proto.WindowStateProto.SURFACE_INSETS; +import static com.android.server.wm.proto.WindowStateProto.SURFACE_POSITION; import static com.android.server.wm.proto.WindowStateProto.WINDOW_CONTAINER; import android.annotation.CallSuper; @@ -3112,6 +3114,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mContentFrame.writeToProto(proto, CONTENT_FRAME); mContentInsets.writeToProto(proto, CONTENT_INSETS); mAttrs.surfaceInsets.writeToProto(proto, SURFACE_INSETS); + mSurfacePosition.writeToProto(proto, SURFACE_POSITION); + mShownPosition.writeToProto(proto, SHOWN_POSITION); mWinAnimator.writeToProto(proto, ANIMATOR); proto.write(ANIMATING_EXIT, mAnimatingExit); for (int i = 0; i < mChildren.size(); i++) { |