Move IWindowContainer to WindowContainer
Since Task/Stack are merged and we're able to implement tiles
atop of Task, the IWindowContainer impl doesn't need to be in
ConfigurationContainer anymore. This removes some casting.
Also moved the Focusable interface to WC since it isn't really
needed for ConfigurationContainers.
Bug: 133381284
Test: tests still pass
Change-Id: I4adc52ca6b4e5da1cf5aaf410f066d7e2a70e6dd
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index 31b7c68..40a4564 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -3303,7 +3303,7 @@
}
}
- private int sanitizeAndApplyChange(ConfigurationContainer container,
+ private int sanitizeAndApplyChange(WindowContainer container,
WindowContainerTransaction.Change change) {
if (!(container instanceof Task || container instanceof ActivityStack)) {
throw new RuntimeException("Invalid token in task transaction");
@@ -3347,13 +3347,13 @@
}
}
- private int applyWindowContainerChange(ConfigurationContainer cc,
+ private int applyWindowContainerChange(WindowContainer wc,
WindowContainerTransaction.Change c) {
- int effects = sanitizeAndApplyChange(cc, c);
+ int effects = sanitizeAndApplyChange(wc, c);
Rect enterPipBounds = c.getEnterPipBounds();
if (enterPipBounds != null) {
- Task tr = (Task) cc;
+ Task tr = (Task) wc;
mStackSupervisor.updatePictureInPictureMode(tr,
enterPipBounds, true);
}
@@ -3378,17 +3378,14 @@
while (entries.hasNext()) {
final Map.Entry<IBinder, WindowContainerTransaction.Change> entry =
entries.next();
- final ConfigurationContainer cc =
- ConfigurationContainer.RemoteToken.fromBinder(
- entry.getKey()).getContainer();
- int containerEffect = applyWindowContainerChange(cc, entry.getValue());
+ final WindowContainer wc = WindowContainer.RemoteToken.fromBinder(
+ entry.getKey()).getContainer();
+ int containerEffect = applyWindowContainerChange(wc, entry.getValue());
effects |= containerEffect;
// Lifecycle changes will trigger ensureConfig for everything.
if ((effects & TRANSACT_EFFECTS_LIFECYCLE) == 0
&& (containerEffect & TRANSACT_EFFECTS_CLIENT_CONFIG) != 0) {
- if (cc instanceof WindowContainer) {
- haveConfigChanges.add((WindowContainer) cc);
- }
+ haveConfigChanges.add(wc);
}
}
if ((effects & TRANSACT_EFFECTS_LIFECYCLE) != 0) {
diff --git a/services/core/java/com/android/server/wm/ConfigurationContainer.java b/services/core/java/com/android/server/wm/ConfigurationContainer.java
index 7b23e2d..9bd380a 100644
--- a/services/core/java/com/android/server/wm/ConfigurationContainer.java
+++ b/services/core/java/com/android/server/wm/ConfigurationContainer.java
@@ -39,15 +39,11 @@
import android.content.res.Configuration;
import android.graphics.Point;
import android.graphics.Rect;
-import android.os.IBinder;
import android.util.proto.ProtoOutputStream;
-import android.view.IWindowContainer;
-import android.view.SurfaceControl;
import com.android.internal.annotations.VisibleForTesting;
import java.io.PrintWriter;
-import java.lang.ref.WeakReference;
import java.util.ArrayList;
/**
@@ -104,12 +100,6 @@
static final int BOUNDS_CHANGE_SIZE = 1 << 1;
/**
- * Used as a unique, cross-process identifier for this Container. It also serves a minimal
- * interface to other processes.
- */
- RemoteToken mRemoteToken = null;
-
- /**
* Returns full configuration applied to this configuration container.
* This method should be used for getting settings applied in each particular level of the
* hierarchy.
@@ -629,21 +619,6 @@
return mFullConfiguration.windowConfiguration.isAlwaysOnTop();
}
- /**
- * Returns {@code true} if this container is focusable. Generally, if a parent is not focusable,
- * this will not be focusable either.
- */
- boolean isFocusable() {
- // TODO(split): Move this to WindowContainer once Split-screen is based on a WindowContainer
- // like DisplayArea vs. TaskTiles.
- ConfigurationContainer parent = getParent();
- return parent == null || parent.isFocusable();
- }
-
- boolean setFocusable(boolean focusable) {
- return false;
- }
-
boolean hasChild() {
return getChildCount() > 0;
}
@@ -654,40 +629,4 @@
abstract protected ConfigurationContainer getParent();
- // TODO: Consider moving to WindowContainer once hierarchies and Task/Stack are merged.
- static class RemoteToken extends IWindowContainer.Stub {
- final WeakReference<ConfigurationContainer> mWeakRef;
-
- RemoteToken(ConfigurationContainer container) {
- mWeakRef = new WeakReference<>(container);
- }
-
- ConfigurationContainer getContainer() {
- return mWeakRef.get();
- }
-
- static RemoteToken fromBinder(IBinder binder) {
- return (RemoteToken) binder;
- }
-
- @Override
- public SurfaceControl getLeash() {
- throw new RuntimeException("Not implemented");
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder(128);
- sb.append("RemoteToken{");
- sb.append(Integer.toHexString(System.identityHashCode(this)));
- sb.append(' ');
- sb.append(mWeakRef.get());
- sb.append('}');
- return sb.toString();
- }
- }
-
- RemoteToken getRemoteToken() {
- return mRemoteToken;
- }
}
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 917b437..2ed16dc 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -16,7 +16,6 @@
package com.android.server.wm;
-import static android.app.ActivityTaskManager.INVALID_STACK_ID;
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.app.ActivityTaskManager.RESIZE_MODE_FORCED;
import static android.app.ActivityTaskManager.RESIZE_MODE_SYSTEM;
@@ -496,7 +495,7 @@
}
class TaskToken extends RemoteToken {
- TaskToken(ConfigurationContainer container) {
+ TaskToken(WindowContainer container) {
super(container);
}
diff --git a/services/core/java/com/android/server/wm/WindowContainer.java b/services/core/java/com/android/server/wm/WindowContainer.java
index 1c876d9..0ab5f91 100644
--- a/services/core/java/com/android/server/wm/WindowContainer.java
+++ b/services/core/java/com/android/server/wm/WindowContainer.java
@@ -61,6 +61,7 @@
import android.util.Slog;
import android.util.proto.ProtoOutputStream;
import android.view.DisplayInfo;
+import android.view.IWindowContainer;
import android.view.MagnificationSpec;
import android.view.RemoteAnimationTarget;
import android.view.SurfaceControl;
@@ -75,6 +76,7 @@
import com.android.server.wm.SurfaceAnimator.Animatable;
import java.io.PrintWriter;
+import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.LinkedList;
@@ -249,6 +251,12 @@
private boolean mIsFocusable = true;
+ /**
+ * Used as a unique, cross-process identifier for this Container. It also serves a minimal
+ * interface to other processes.
+ */
+ RemoteToken mRemoteToken = null;
+
WindowContainer(WindowManagerService wms) {
mWmService = wms;
mPendingTransaction = wms.mTransactionFactory.get();
@@ -860,13 +868,16 @@
return false;
}
- @Override
+ /**
+ * Returns {@code true} if this container is focusable. Generally, if a parent is not focusable,
+ * this will not be focusable either.
+ */
boolean isFocusable() {
- return super.isFocusable() && mIsFocusable;
+ final WindowContainer parent = getParent();
+ return (parent == null || parent.isFocusable()) && mIsFocusable;
}
/** Set whether this container or its children can be focusable */
- @Override
boolean setFocusable(boolean focusable) {
if (mIsFocusable == focusable) {
return false;
@@ -2259,4 +2270,40 @@
ActivityRecord asActivityRecord() {
return null;
}
+
+ RemoteToken getRemoteToken() {
+ return mRemoteToken;
+ }
+
+ static class RemoteToken extends IWindowContainer.Stub {
+ final WeakReference<WindowContainer> mWeakRef;
+
+ RemoteToken(WindowContainer container) {
+ mWeakRef = new WeakReference<>(container);
+ }
+
+ WindowContainer getContainer() {
+ return mWeakRef.get();
+ }
+
+ static RemoteToken fromBinder(IBinder binder) {
+ return (RemoteToken) binder;
+ }
+
+ @Override
+ public SurfaceControl getLeash() {
+ throw new RuntimeException("Not implemented");
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder(128);
+ sb.append("RemoteToken{");
+ sb.append(Integer.toHexString(System.identityHashCode(this)));
+ sb.append(' ');
+ sb.append(mWeakRef.get());
+ sb.append('}');
+ return sb.toString();
+ }
+ }
}