Added WindowConfigurationProto and friends
Also added WindowContainerProto and ConfigurationContainerProto
Will be used by cts tests in upcoming CLs that replace StackId APIs.
Test: adb shell dumpsys window --proto
Bug: 64146578
Change-Id: Id6ca2a93e3d15ac696ab54cb241870e973985967
diff --git a/api/test-current.txt b/api/test-current.txt
index 0902fc6..7256e5c 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -6226,11 +6226,28 @@
}
public class WindowConfiguration implements java.lang.Comparable android.os.Parcelable {
+ ctor public WindowConfiguration();
method public int compareTo(android.app.WindowConfiguration);
method public int describeContents();
+ method public int getActivityType();
+ method public android.graphics.Rect getAppBounds();
+ method public int getWindowingMode();
+ method public void setActivityType(int);
+ method public void setAppBounds(android.graphics.Rect);
+ method public void setTo(android.app.WindowConfiguration);
+ method public void setWindowingMode(int);
method public void writeToParcel(android.os.Parcel, int);
+ field public static final int ACTIVITY_TYPE_ASSISTANT = 4; // 0x4
field public static final int ACTIVITY_TYPE_HOME = 2; // 0x2
field public static final int ACTIVITY_TYPE_RECENTS = 3; // 0x3
+ field public static final int ACTIVITY_TYPE_STANDARD = 1; // 0x1
+ field public static final int ACTIVITY_TYPE_UNDEFINED = 0; // 0x0
+ field public static final int WINDOWING_MODE_FREEFORM = 5; // 0x5
+ field public static final int WINDOWING_MODE_FULLSCREEN = 1; // 0x1
+ field public static final int WINDOWING_MODE_PINNED = 2; // 0x2
+ field public static final int WINDOWING_MODE_SPLIT_SCREEN_PRIMARY = 3; // 0x3
+ field public static final int WINDOWING_MODE_SPLIT_SCREEN_SECONDARY = 4; // 0x4
+ field public static final int WINDOWING_MODE_UNDEFINED = 0; // 0x0
}
}
@@ -11328,6 +11345,7 @@
field public int smallestScreenWidthDp;
field public int touchscreen;
field public int uiMode;
+ field public final android.app.WindowConfiguration windowConfiguration;
}
public class ObbInfo implements android.os.Parcelable {
diff --git a/core/java/android/app/WindowConfiguration.java b/core/java/android/app/WindowConfiguration.java
index 5d87e1c..07eb5de 100644
--- a/core/java/android/app/WindowConfiguration.java
+++ b/core/java/android/app/WindowConfiguration.java
@@ -17,6 +17,9 @@
package android.app;
import static android.app.ActivityThread.isSystem;
+import static android.app.WindowConfigurationProto.ACTIVITY_TYPE;
+import static android.app.WindowConfigurationProto.APP_BOUNDS;
+import static android.app.WindowConfigurationProto.WINDOWING_MODE;
import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -25,6 +28,7 @@
import android.graphics.Rect;
import android.os.Parcel;
import android.os.Parcelable;
+import android.util.proto.ProtoOutputStream;
import android.view.DisplayInfo;
/**
@@ -48,26 +52,20 @@
/** The current windowing mode of the configuration. */
private @WindowingMode int mWindowingMode;
- /** Windowing mode is currently not defined.
- * @hide */
+ /** Windowing mode is currently not defined. */
public static final int WINDOWING_MODE_UNDEFINED = 0;
- /** Occupies the full area of the screen or the parent container.
- * @hide */
+ /** Occupies the full area of the screen or the parent container. */
public static final int WINDOWING_MODE_FULLSCREEN = 1;
- /** Always on-top (always visible). of other siblings in its parent container.
- * @hide */
+ /** Always on-top (always visible). of other siblings in its parent container. */
public static final int WINDOWING_MODE_PINNED = 2;
- /** The primary container driving the screen to be in split-screen mode.
- * @hide */
+ /** The primary container driving the screen to be in split-screen mode. */
public static final int WINDOWING_MODE_SPLIT_SCREEN_PRIMARY = 3;
/**
* The containers adjacent to the {@link #WINDOWING_MODE_SPLIT_SCREEN_PRIMARY} container in
* split-screen mode.
- * @hide
*/
public static final int WINDOWING_MODE_SPLIT_SCREEN_SECONDARY = 4;
- /** Can be freely resized within its parent container.
- * @hide */
+ /** Can be freely resized within its parent container. */
public static final int WINDOWING_MODE_FREEFORM = 5;
/** @hide */
@@ -84,18 +82,15 @@
/** The current activity type of the configuration. */
private @ActivityType int mActivityType;
- /** Activity type is currently not defined.
- * @hide */
+ /** Activity type is currently not defined. */
public static final int ACTIVITY_TYPE_UNDEFINED = 0;
- /** Standard activity type. Nothing special about the activity...
- * @hide */
+ /** Standard activity type. Nothing special about the activity... */
public static final int ACTIVITY_TYPE_STANDARD = 1;
/** Home/Launcher activity type. */
public static final int ACTIVITY_TYPE_HOME = 2;
/** Recents/Overview activity type. */
public static final int ACTIVITY_TYPE_RECENTS = 3;
- /** Assistant activity type.
- * @hide */
+ /** Assistant activity type. */
public static final int ACTIVITY_TYPE_ASSISTANT = 4;
/** @hide */
@@ -127,7 +122,6 @@
})
public @interface WindowConfig {}
- /** @hide */
public WindowConfiguration() {
unset();
}
@@ -176,7 +170,6 @@
* Set {@link #mAppBounds} to the input Rect.
* @param rect The rect value to set {@link #mAppBounds} to.
* @see #getAppBounds()
- * @hide
*/
public void setAppBounds(Rect rect) {
if (rect == null) {
@@ -200,26 +193,20 @@
mAppBounds.set(left, top, right, bottom);
}
- /**
- * @see #setAppBounds(Rect)
- * @hide
- */
+ /** @see #setAppBounds(Rect) */
public Rect getAppBounds() {
return mAppBounds;
}
- /** @hide */
public void setWindowingMode(@WindowingMode int windowingMode) {
mWindowingMode = windowingMode;
}
- /** @hide */
@WindowingMode
public int getWindowingMode() {
return mWindowingMode;
}
- /** @hide */
public void setActivityType(@ActivityType int activityType) {
if (mActivityType == activityType) {
return;
@@ -237,13 +224,11 @@
mActivityType = activityType;
}
- /** @hide */
@ActivityType
public int getActivityType() {
return mActivityType;
}
- /** @hide */
public void setTo(WindowConfiguration other) {
setAppBounds(other.mAppBounds);
setWindowingMode(other.mWindowingMode);
@@ -382,6 +367,24 @@
}
/**
+ * Write to a protocol buffer output stream.
+ * Protocol buffer message definition at {@link android.app.WindowConfigurationProto}
+ *
+ * @param protoOutputStream Stream to write the WindowConfiguration object to.
+ * @param fieldId Field Id of the WindowConfiguration as defined in the parent message
+ * @hide
+ */
+ public void writeToProto(ProtoOutputStream protoOutputStream, long fieldId) {
+ final long token = protoOutputStream.start(fieldId);
+ if (mAppBounds != null) {
+ mAppBounds.writeToProto(protoOutputStream, APP_BOUNDS);
+ }
+ protoOutputStream.write(WINDOWING_MODE, mWindowingMode);
+ protoOutputStream.write(ACTIVITY_TYPE, mActivityType);
+ protoOutputStream.end(token);
+ }
+
+ /**
* Returns true if the activities associated with this window configuration display a shadow
* around their border.
* @hide
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java
index 780e6f7..1310e30 100644
--- a/core/java/android/content/res/Configuration.java
+++ b/core/java/android/content/res/Configuration.java
@@ -16,9 +16,20 @@
package android.content.res;
+import static android.content.ConfigurationProto.DENSITY_DPI;
+import static android.content.ConfigurationProto.FONT_SCALE;
+import static android.content.ConfigurationProto.ORIENTATION;
+import static android.content.ConfigurationProto.SCREEN_HEIGHT_DP;
+import static android.content.ConfigurationProto.SCREEN_LAYOUT;
+import static android.content.ConfigurationProto.SCREEN_WIDTH_DP;
+import static android.content.ConfigurationProto.SMALLEST_SCREEN_WIDTH_DP;
+import static android.content.ConfigurationProto.UI_MODE;
+import static android.content.ConfigurationProto.WINDOW_CONFIGURATION;
+
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.TestApi;
import android.app.WindowConfiguration;
import android.content.pm.ActivityInfo;
import android.content.pm.ActivityInfo.Config;
@@ -27,6 +38,7 @@
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
+import android.util.proto.ProtoOutputStream;
import android.view.View;
import com.android.internal.util.XmlUtils;
@@ -295,11 +307,12 @@
public int screenLayout;
/**
- * @hide
* Configuration relating to the windowing state of the object associated with this
* Configuration. Contents of this field are not intended to affect resources, but need to be
* communicated and propagated at the same time as the rest of Configuration.
+ * @hide
*/
+ @TestApi
public final WindowConfiguration windowConfiguration = new WindowConfiguration();
/** @hide */
@@ -1054,6 +1067,28 @@
}
/**
+ * Write to a protocol buffer output stream.
+ * Protocol buffer message definition at {@link android.content.ConfigurationProto}
+ *
+ * @param protoOutputStream Stream to write the Configuration object to.
+ * @param fieldId Field Id of the Configuration as defined in the parent message
+ * @hide
+ */
+ public void writeToProto(ProtoOutputStream protoOutputStream, long fieldId) {
+ final long token = protoOutputStream.start(fieldId);
+ protoOutputStream.write(FONT_SCALE, fontScale);
+ protoOutputStream.write(SCREEN_LAYOUT, screenLayout);
+ protoOutputStream.write(ORIENTATION, orientation);
+ protoOutputStream.write(UI_MODE, uiMode);
+ protoOutputStream.write(SCREEN_WIDTH_DP, screenWidthDp);
+ protoOutputStream.write(SCREEN_HEIGHT_DP, screenHeightDp);
+ protoOutputStream.write(SMALLEST_SCREEN_WIDTH_DP, smallestScreenWidthDp);
+ protoOutputStream.write(DENSITY_DPI, densityDpi);
+ windowConfiguration.writeToProto(protoOutputStream, WINDOW_CONFIGURATION);
+ protoOutputStream.end(token);
+ }
+
+ /**
* Set this object to the system defaults.
*/
public void setToDefaults() {
diff --git a/core/proto/android/app/window_configuration.proto b/core/proto/android/app/window_configuration.proto
new file mode 100644
index 0000000..03910df
--- /dev/null
+++ b/core/proto/android/app/window_configuration.proto
@@ -0,0 +1,31 @@
+/*
+ * 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 = "proto3";
+
+option java_package = "android.app";
+option java_multiple_files = true;
+
+package android.app;
+
+import "frameworks/base/core/proto/android/graphics/rect.proto";
+
+/** Proto representation for WindowConfiguration.java class. */
+message WindowConfigurationProto {
+ .android.graphics.RectProto app_bounds = 1;
+ int32 windowing_mode = 2;
+ int32 activity_type = 3;
+}
diff --git a/core/proto/android/content/configuration.proto b/core/proto/android/content/configuration.proto
index f46b73a..804e0b4 100644
--- a/core/proto/android/content/configuration.proto
+++ b/core/proto/android/content/configuration.proto
@@ -21,6 +21,7 @@
package android.content;
+import "frameworks/base/core/proto/android/app/window_configuration.proto";
import "frameworks/base/core/proto/android/content/locale.proto";
/**
@@ -43,5 +44,6 @@
uint32 screen_height_dp = 14;
uint32 smallest_screen_width_dp = 15;
uint32 density_dpi = 16;
+ .android.app.WindowConfigurationProto window_configuration = 17;
}
diff --git a/core/proto/android/server/windowmanagerservice.proto b/core/proto/android/server/windowmanagerservice.proto
index ee8a6dc..d177f1c 100644
--- a/core/proto/android/server/windowmanagerservice.proto
+++ b/core/proto/android/server/windowmanagerservice.proto
@@ -16,6 +16,7 @@
syntax = "proto3";
+import "frameworks/base/core/proto/android/content/configuration.proto";
import "frameworks/base/core/proto/android/graphics/rect.proto";
import "frameworks/base/core/proto/android/view/displayinfo.proto";
import "frameworks/base/core/proto/android/view/windowlayoutparams.proto";
@@ -26,17 +27,23 @@
message WindowManagerServiceProto {
WindowManagerPolicyProto policy = 1;
- /* window manager hierarchy structure */
+ /* window hierarchy root */
+ RootWindowContainerProto root_window_container = 2;
+ IdentifierProto focused_window = 3;
+ string focused_app = 4;
+ IdentifierProto input_method_window = 5;
+ bool display_frozen = 6;
+ int32 rotation = 7;
+ int32 last_orientation = 8;
+ AppTransitionProto app_transition = 9;
+}
+
+/* represents DisplayContent */
+message RootWindowContainerProto {
+ WindowContainerProto window_container = 1;
repeated DisplayProto displays = 2;
/* window references in top down z order */
repeated IdentifierProto windows = 3;
- IdentifierProto focused_window = 4;
- string focused_app = 5;
- IdentifierProto input_method_window = 6;
- bool display_frozen = 7;
- int32 rotation = 8;
- int32 last_orientation = 9;
- AppTransitionProto app_transition = 10;
}
/* represents PhoneWindowManager */
@@ -81,18 +88,19 @@
/* represents DisplayContent */
message DisplayProto {
- int32 id = 1;
- repeated StackProto stacks = 2;
- DockedStackDividerControllerProto docked_stack_divider_controller = 3;
- PinnedStackControllerProto pinned_stack_controller = 4;
+ WindowContainerProto window_container = 1;
+ int32 id = 2;
+ repeated StackProto stacks = 3;
+ DockedStackDividerControllerProto docked_stack_divider_controller = 4;
+ PinnedStackControllerProto pinned_stack_controller = 5;
/* non app windows */
- repeated WindowTokenProto above_app_windows = 5;
- repeated WindowTokenProto below_app_windows = 6;
- repeated WindowTokenProto ime_windows = 7;
- int32 dpi = 8;
- .android.view.DisplayInfoProto display_info = 9;
- int32 rotation = 10;
- ScreenRotationAnimationProto screen_rotation_animation = 11;
+ repeated WindowTokenProto above_app_windows = 6;
+ repeated WindowTokenProto below_app_windows = 7;
+ repeated WindowTokenProto ime_windows = 8;
+ int32 dpi = 9;
+ .android.view.DisplayInfoProto display_info = 10;
+ int32 rotation = 11;
+ ScreenRotationAnimationProto screen_rotation_animation = 12;
}
@@ -109,20 +117,22 @@
/* represents TaskStack */
message StackProto {
- int32 id = 1;
- repeated TaskProto tasks = 2;
- bool fills_parent = 3;
- .android.graphics.RectProto bounds = 4;
- bool animation_background_surface_is_dimming = 5;
+ WindowContainerProto window_container = 1;
+ int32 id = 2;
+ repeated TaskProto tasks = 3;
+ bool fills_parent = 4;
+ .android.graphics.RectProto bounds = 5;
+ bool animation_background_surface_is_dimming = 6;
}
/* represents Task */
message TaskProto {
- int32 id = 1;
- repeated AppWindowTokenProto app_window_tokens = 2;
- bool fills_parent = 3;
- .android.graphics.RectProto bounds = 4;
- .android.graphics.RectProto temp_inset_bounds = 5;
+ WindowContainerProto window_container = 1;
+ int32 id = 2;
+ repeated AppWindowTokenProto app_window_tokens = 3;
+ bool fills_parent = 4;
+ .android.graphics.RectProto bounds = 5;
+ .android.graphics.RectProto temp_inset_bounds = 6;
}
/* represents AppWindowToken */
@@ -134,26 +144,28 @@
/* represents WindowToken */
message WindowTokenProto {
- int32 hash_code = 1;
- repeated WindowStateProto windows = 2;
+ WindowContainerProto window_container = 1;
+ int32 hash_code = 2;
+ repeated WindowStateProto windows = 3;
}
/* represents WindowState */
message WindowStateProto {
- IdentifierProto identifier = 1;
- int32 display_id = 2;
- int32 stack_id = 3;
- .android.view.WindowLayoutParamsProto attributes = 4;
- .android.graphics.RectProto given_content_insets = 5;
- .android.graphics.RectProto frame = 6;
- .android.graphics.RectProto containing_frame = 7;
- .android.graphics.RectProto parent_frame = 8;
- .android.graphics.RectProto content_frame = 9;
- .android.graphics.RectProto content_insets = 10;
- .android.graphics.RectProto surface_insets = 11;
- WindowStateAnimatorProto animator = 12;
- bool animating_exit = 13;
- repeated WindowStateProto child_windows = 14;
+ WindowContainerProto window_container = 1;
+ IdentifierProto identifier = 2;
+ int32 display_id = 3;
+ int32 stack_id = 4;
+ .android.view.WindowLayoutParamsProto attributes = 5;
+ .android.graphics.RectProto given_content_insets = 6;
+ .android.graphics.RectProto frame = 7;
+ .android.graphics.RectProto containing_frame = 8;
+ .android.graphics.RectProto parent_frame = 9;
+ .android.graphics.RectProto content_frame = 10;
+ .android.graphics.RectProto content_insets = 11;
+ .android.graphics.RectProto surface_insets = 12;
+ WindowStateAnimatorProto animator = 13;
+ bool animating_exit = 14;
+ repeated WindowStateProto child_windows = 15;
}
message IdentifierProto {
@@ -178,4 +190,17 @@
message ScreenRotationAnimationProto {
bool started = 1;
bool animation_running = 2;
-}
\ No newline at end of file
+}
+
+/* represents WindowContainer */
+message WindowContainerProto {
+ ConfigurationContainerProto configuration_container = 1;
+ int32 orientation = 2;
+}
+
+/* represents ConfigurationContainer */
+message ConfigurationContainerProto {
+ .android.content.ConfigurationProto override_configuration = 1;
+ .android.content.ConfigurationProto full_configuration = 2;
+ .android.content.ConfigurationProto merged_override_configuration = 3;
+}
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index ea2f305..2d1fc91 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -53,6 +53,7 @@
import static com.android.server.wm.proto.AppWindowTokenProto.NAME;
import static com.android.server.wm.proto.AppWindowTokenProto.WINDOW_TOKEN;
+import android.annotation.CallSuper;
import android.annotation.NonNull;
import android.app.Activity;
import android.content.res.Configuration;
@@ -1620,8 +1621,9 @@
}
}
+ @CallSuper
@Override
- void writeToProto(ProtoOutputStream proto, long fieldId) {
+ public void writeToProto(ProtoOutputStream proto, long fieldId) {
final long token = proto.start(fieldId);
writeNameToProto(proto, NAME);
super.writeToProto(proto, WINDOW_TOKEN);
diff --git a/services/core/java/com/android/server/wm/ConfigurationContainer.java b/services/core/java/com/android/server/wm/ConfigurationContainer.java
index 28ba9b3..1da94da 100644
--- a/services/core/java/com/android/server/wm/ConfigurationContainer.java
+++ b/services/core/java/com/android/server/wm/ConfigurationContainer.java
@@ -24,9 +24,14 @@
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
import static android.app.WindowConfiguration.activityTypeToString;
+import static com.android.server.wm.proto.ConfigurationContainerProto.FULL_CONFIGURATION;
+import static com.android.server.wm.proto.ConfigurationContainerProto.MERGED_OVERRIDE_CONFIGURATION;
+import static com.android.server.wm.proto.ConfigurationContainerProto.OVERRIDE_CONFIGURATION;
+import android.annotation.CallSuper;
import android.app.WindowConfiguration;
import android.content.res.Configuration;
+import android.util.proto.ProtoOutputStream;
import java.util.ArrayList;
@@ -252,6 +257,24 @@
}
}
+ /**
+ * Write to a protocol buffer output stream. Protocol buffer message definition is at
+ * {@link com.android.server.wm.proto.ConfigurationContainerProto}.
+ *
+ * @param protoOutputStream Stream to write the ConfigurationContainer object to.
+ * @param fieldId Field Id of the ConfigurationContainer as defined in the parent
+ * message.
+ * @hide
+ */
+ @CallSuper
+ public void writeToProto(ProtoOutputStream protoOutputStream, long fieldId) {
+ final long token = protoOutputStream.start(fieldId);
+ mOverrideConfiguration.writeToProto(protoOutputStream, OVERRIDE_CONFIGURATION);
+ mFullConfiguration.writeToProto(protoOutputStream, FULL_CONFIGURATION);
+ mMergedOverrideConfiguration.writeToProto(protoOutputStream, MERGED_OVERRIDE_CONFIGURATION);
+ protoOutputStream.end(token);
+ }
+
abstract protected int getChildCount();
abstract protected E getChildAt(int index);
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 6cf608a..817a01c 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -112,7 +112,9 @@
import static com.android.server.wm.proto.DisplayProto.ROTATION;
import static com.android.server.wm.proto.DisplayProto.SCREEN_ROTATION_ANIMATION;
import static com.android.server.wm.proto.DisplayProto.STACKS;
+import static com.android.server.wm.proto.DisplayProto.WINDOW_CONTAINER;
+import android.annotation.CallSuper;
import android.annotation.NonNull;
import android.app.ActivityManager.StackId;
import android.app.WindowConfiguration;
@@ -2119,8 +2121,11 @@
}
}
- void writeToProto(ProtoOutputStream proto, long fieldId) {
+ @CallSuper
+ @Override
+ public void writeToProto(ProtoOutputStream proto, long fieldId) {
final long token = proto.start(fieldId);
+ super.writeToProto(proto, WINDOW_CONTAINER);
proto.write(ID, mDisplayId);
for (int stackNdx = mTaskStackContainers.size() - 1; stackNdx >= 0; --stackNdx) {
final TaskStack stack = mTaskStackContainers.get(stackNdx);
diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java
index 8a74976..227e4b2 100644
--- a/services/core/java/com/android/server/wm/RootWindowContainer.java
+++ b/services/core/java/com/android/server/wm/RootWindowContainer.java
@@ -16,6 +16,7 @@
package com.android.server.wm;
+import android.annotation.CallSuper;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.hardware.power.V1_0.PowerHint;
@@ -89,8 +90,9 @@
import static com.android.server.wm.WindowSurfacePlacer.SET_UPDATE_ROTATION;
import static com.android.server.wm.WindowSurfacePlacer.SET_WALLPAPER_ACTION_PENDING;
import static com.android.server.wm.WindowSurfacePlacer.SET_WALLPAPER_MAY_CHANGE;
-import static com.android.server.wm.proto.WindowManagerServiceProto.DISPLAYS;
-import static com.android.server.wm.proto.WindowManagerServiceProto.WINDOWS;
+import static com.android.server.wm.proto.RootWindowContainerProto.DISPLAYS;
+import static com.android.server.wm.proto.RootWindowContainerProto.WINDOWS;
+import static com.android.server.wm.proto.RootWindowContainerProto.WINDOW_CONTAINER;
/** Root {@link WindowContainer} for the device. */
class RootWindowContainer extends WindowContainer<DisplayContent> {
@@ -1077,7 +1079,11 @@
}
}
- void writeToProto(ProtoOutputStream proto) {
+ @CallSuper
+ @Override
+ public void writeToProto(ProtoOutputStream proto, long fieldId) {
+ final long token = proto.start(fieldId);
+ super.writeToProto(proto, WINDOW_CONTAINER);
if (mService.mDisplayReady) {
final int count = mChildren.size();
for (int i = 0; i < count; ++i) {
@@ -1088,6 +1094,7 @@
forAllWindows((w) -> {
w.writeIdentifierToProto(proto, WINDOWS);
}, true);
+ proto.end(token);
}
@Override
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 55b6c91..7464a9b 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -34,7 +34,9 @@
import static com.android.server.wm.proto.TaskProto.FILLS_PARENT;
import static com.android.server.wm.proto.TaskProto.ID;
import static com.android.server.wm.proto.TaskProto.TEMP_INSET_BOUNDS;
+import static com.android.server.wm.proto.TaskProto.WINDOW_CONTAINER;
+import android.annotation.CallSuper;
import android.app.ActivityManager.StackId;
import android.app.ActivityManager.TaskDescription;
import android.content.pm.ActivityInfo;
@@ -735,8 +737,11 @@
return "Task=" + mTaskId;
}
- void writeToProto(ProtoOutputStream proto, long fieldId) {
+ @CallSuper
+ @Override
+ public void writeToProto(ProtoOutputStream proto, long fieldId) {
final long token = proto.start(fieldId);
+ super.writeToProto(proto, WINDOW_CONTAINER);
proto.write(ID, mTaskId);
for (int i = mChildren.size() - 1; i >= 0; i--) {
final AppWindowToken appWindowToken = mChildren.get(i);
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index 4664dcb..126d820 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -41,7 +41,9 @@
import static com.android.server.wm.proto.StackProto.FILLS_PARENT;
import static com.android.server.wm.proto.StackProto.ID;
import static com.android.server.wm.proto.StackProto.TASKS;
+import static com.android.server.wm.proto.StackProto.WINDOW_CONTAINER;
+import android.annotation.CallSuper;
import android.app.ActivityManager.StackId;
import android.content.res.Configuration;
import android.graphics.Rect;
@@ -1219,8 +1221,11 @@
return mMinimizeAmount != 0f;
}
- void writeToProto(ProtoOutputStream proto, long fieldId) {
+ @CallSuper
+ @Override
+ public void writeToProto(ProtoOutputStream proto, long fieldId) {
final long token = proto.start(fieldId);
+ super.writeToProto(proto, WINDOW_CONTAINER);
proto.write(ID, mStackId);
for (int taskNdx = mChildren.size() - 1; taskNdx >= 0; taskNdx--) {
mChildren.get(taskNdx).writeToProto(proto, TASKS);
diff --git a/services/core/java/com/android/server/wm/WindowContainer.java b/services/core/java/com/android/server/wm/WindowContainer.java
index 926719d..40923c8 100644
--- a/services/core/java/com/android/server/wm/WindowContainer.java
+++ b/services/core/java/com/android/server/wm/WindowContainer.java
@@ -19,12 +19,14 @@
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_BEHIND;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
-import static android.content.res.Configuration.EMPTY;
+import static com.android.server.wm.proto.WindowContainerProto.CONFIGURATION_CONTAINER;
+import static com.android.server.wm.proto.WindowContainerProto.ORIENTATION;
import android.annotation.CallSuper;
import android.content.res.Configuration;
import android.util.Pools;
+import android.util.proto.ProtoOutputStream;
import com.android.internal.util.ToBooleanFunction;
import java.util.Comparator;
@@ -685,6 +687,23 @@
}
}
+ /**
+ * Write to a protocol buffer output stream. Protocol buffer message definition is at
+ * {@link com.android.server.wm.proto.WindowContainerProto}.
+ *
+ * @param protoOutputStream Stream to write the WindowContainer object to.
+ * @param fieldId Field Id of the WindowContainer as defined in the parent message.
+ * @hide
+ */
+ @CallSuper
+ @Override
+ public void writeToProto(ProtoOutputStream protoOutputStream, long fieldId) {
+ final long token = protoOutputStream.start(fieldId);
+ super.writeToProto(protoOutputStream, CONFIGURATION_CONTAINER);
+ protoOutputStream.write(ORIENTATION, mOrientation);
+ protoOutputStream.end(token);
+ }
+
String getName() {
return toString();
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 32ee51c..6f79648 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -109,6 +109,7 @@
import static com.android.server.wm.proto.WindowManagerServiceProto.INPUT_METHOD_WINDOW;
import static com.android.server.wm.proto.WindowManagerServiceProto.LAST_ORIENTATION;
import static com.android.server.wm.proto.WindowManagerServiceProto.POLICY;
+import static com.android.server.wm.proto.WindowManagerServiceProto.ROOT_WINDOW_CONTAINER;
import static com.android.server.wm.proto.WindowManagerServiceProto.ROTATION;
import android.Manifest;
@@ -6505,7 +6506,7 @@
private void writeToProtoLocked(ProtoOutputStream proto) {
mPolicy.writeToProto(proto, POLICY);
- mRoot.writeToProto(proto);
+ mRoot.writeToProto(proto, ROOT_WINDOW_CONTAINER);
if (mCurrentFocus != null) {
mCurrentFocus.writeIdentifierToProto(proto, FOCUSED_WINDOW);
}
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 1b05566..8a2cb5a 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -116,7 +116,9 @@
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.SURFACE_INSETS;
+import static com.android.server.wm.proto.WindowStateProto.WINDOW_CONTAINER;
+import android.annotation.CallSuper;
import android.app.AppOpsManager;
import android.content.Context;
import android.content.res.Configuration;
@@ -3124,8 +3126,11 @@
|| (isChildWindow() && getParentWindow().isDockedResizing());
}
- void writeToProto(ProtoOutputStream proto, long fieldId) {
+ @CallSuper
+ @Override
+ public void writeToProto(ProtoOutputStream proto, long fieldId) {
final long token = proto.start(fieldId);
+ super.writeToProto(proto, WINDOW_CONTAINER);
writeIdentifierToProto(proto, IDENTIFIER);
proto.write(DISPLAY_ID, getDisplayId());
proto.write(STACK_ID, getStackId());
diff --git a/services/core/java/com/android/server/wm/WindowToken.java b/services/core/java/com/android/server/wm/WindowToken.java
index 422615b..943448e 100644
--- a/services/core/java/com/android/server/wm/WindowToken.java
+++ b/services/core/java/com/android/server/wm/WindowToken.java
@@ -16,6 +16,7 @@
package com.android.server.wm;
+import android.annotation.CallSuper;
import android.util.proto.ProtoOutputStream;
import java.util.Comparator;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
@@ -28,6 +29,7 @@
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_NORMAL;
import static com.android.server.wm.proto.WindowTokenProto.HASH_CODE;
import static com.android.server.wm.proto.WindowTokenProto.WINDOWS;
+import static com.android.server.wm.proto.WindowTokenProto.WINDOW_CONTAINER;
import android.os.Debug;
import android.os.IBinder;
@@ -263,8 +265,11 @@
super.onDisplayChanged(dc);
}
- void writeToProto(ProtoOutputStream proto, long fieldId) {
+ @CallSuper
+ @Override
+ public void writeToProto(ProtoOutputStream proto, long fieldId) {
final long token = proto.start(fieldId);
+ super.writeToProto(proto, WINDOW_CONTAINER);
proto.write(HASH_CODE, System.identityHashCode(this));
for (int i = 0; i < mChildren.size(); i++) {
final WindowState w = mChildren.get(i);