diff options
| author | Wale Ogunwale <ogunwale@google.com> | 2017-09-13 05:55:07 -0700 |
|---|---|---|
| committer | Wale Ogunwale <ogunwale@google.com> | 2017-09-18 07:23:23 -0700 |
| commit | 0d5609ba8c64710dbab020d99c832f8d470c716a (patch) | |
| tree | 180056eb074ac6e61025dbea9b4cb4b449140bd1 /core/java/android/app/WindowConfiguration.java | |
| parent | a7a2a0545ad404f9af9a6de2eb175e3170250d14 (diff) | |
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
Diffstat (limited to 'core/java/android/app/WindowConfiguration.java')
| -rw-r--r-- | core/java/android/app/WindowConfiguration.java | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/core/java/android/app/WindowConfiguration.java b/core/java/android/app/WindowConfiguration.java index 5d87e1c2a157..07eb5de15d9f 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.content.res.Configuration; 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 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu /** 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 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu /** 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 class WindowConfiguration implements Parcelable, Comparable<WindowConfigu }) public @interface WindowConfig {} - /** @hide */ public WindowConfiguration() { unset(); } @@ -176,7 +170,6 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu * 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 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu 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 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu 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 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu } /** + * 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 |
