summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2020-03-17 16:35:58 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-03-17 16:35:58 +0000
commita8a123c1eac5efd372d08084e95dada5a9cf0a97 (patch)
tree63baf1ea09141b0f0342a8afe16346a718f3bbff /core/java
parentbb5769554d681f02fdde63d21656184fcc7c75fe (diff)
parentf6878a43166af16d3f6fbfcafc2dab0d41358eba (diff)
Merge "Add WCT call to set container hidden state" into rvc-dev
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/view/WindowContainerTransaction.java26
1 files changed, 25 insertions, 1 deletions
diff --git a/core/java/android/view/WindowContainerTransaction.java b/core/java/android/view/WindowContainerTransaction.java
index 9c16e1334e00..56b49515f419 100644
--- a/core/java/android/view/WindowContainerTransaction.java
+++ b/core/java/android/view/WindowContainerTransaction.java
@@ -168,6 +168,18 @@ public class WindowContainerTransaction implements Parcelable {
}
/**
+ * Sets whether a container or its children should be hidden. When {@code false}, the existing
+ * visibility of the container applies, but when {@code true} the container will be forced
+ * to be hidden.
+ */
+ public WindowContainerTransaction setHidden(IWindowContainer container, boolean hidden) {
+ Change chg = getOrCreateChange(container.asBinder());
+ chg.mHidden = hidden;
+ chg.mChangeMask |= Change.CHANGE_HIDDEN;
+ return this;
+ }
+
+ /**
* Set the smallestScreenWidth of a container.
*/
public WindowContainerTransaction setSmallestScreenWidthDp(IWindowContainer container,
@@ -250,9 +262,11 @@ public class WindowContainerTransaction implements Parcelable {
public static final int CHANGE_FOCUSABLE = 1;
public static final int CHANGE_BOUNDS_TRANSACTION = 1 << 1;
public static final int CHANGE_PIP_CALLBACK = 1 << 2;
+ public static final int CHANGE_HIDDEN = 1 << 3;
private final Configuration mConfiguration = new Configuration();
private boolean mFocusable = true;
+ private boolean mHidden = false;
private int mChangeMask = 0;
private @ActivityInfo.Config int mConfigSetMask = 0;
private @WindowConfiguration.WindowConfig int mWindowSetMask = 0;
@@ -268,6 +282,7 @@ public class WindowContainerTransaction implements Parcelable {
protected Change(Parcel in) {
mConfiguration.readFromParcel(in);
mFocusable = in.readBoolean();
+ mHidden = in.readBoolean();
mChangeMask = in.readInt();
mConfigSetMask = in.readInt();
mWindowSetMask = in.readInt();
@@ -296,7 +311,7 @@ public class WindowContainerTransaction implements Parcelable {
return mConfiguration;
}
- /** Gets the requested focusable value */
+ /** Gets the requested focusable state */
public boolean getFocusable() {
if ((mChangeMask & CHANGE_FOCUSABLE) == 0) {
throw new RuntimeException("Focusable not set. check CHANGE_FOCUSABLE first");
@@ -304,6 +319,14 @@ public class WindowContainerTransaction implements Parcelable {
return mFocusable;
}
+ /** Gets the requested hidden state */
+ public boolean getHidden() {
+ if ((mChangeMask & CHANGE_HIDDEN) == 0) {
+ throw new RuntimeException("Hidden not set. check CHANGE_HIDDEN first");
+ }
+ return mHidden;
+ }
+
public int getChangeMask() {
return mChangeMask;
}
@@ -369,6 +392,7 @@ public class WindowContainerTransaction implements Parcelable {
public void writeToParcel(Parcel dest, int flags) {
mConfiguration.writeToParcel(dest, flags);
dest.writeBoolean(mFocusable);
+ dest.writeBoolean(mHidden);
dest.writeInt(mChangeMask);
dest.writeInt(mConfigSetMask);
dest.writeInt(mWindowSetMask);