summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Evan Rosky <erosky@google.com> 2020-01-23 19:17:10 -0800
committer Evan Rosky <erosky@google.com> 2020-01-23 20:25:02 -0800
commita80f11c25a78d0f1d9f0d375ca0c656c2fa495d8 (patch)
tree72b8bdc45ce42f686bbec4a44177390cf1ea3c76
parent36f8b83e45781a5bcd41d838bfff01de312ac8ac (diff)
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
-rw-r--r--services/core/java/com/android/server/wm/ActivityTaskManagerService.java19
-rw-r--r--services/core/java/com/android/server/wm/ConfigurationContainer.java61
-rw-r--r--services/core/java/com/android/server/wm/Task.java3
-rw-r--r--services/core/java/com/android/server/wm/WindowContainer.java53
4 files changed, 59 insertions, 77 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index 31b7c688d685..40a45641ab04 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 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
}
}
- 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 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
}
}
- 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 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
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 7b23e2d383b6..9bd380a95ad0 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.app.WindowConfiguration;
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 @@ public abstract class ConfigurationContainer<E extends ConfigurationContainer> {
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 @@ public abstract class ConfigurationContainer<E extends ConfigurationContainer> {
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 @@ public abstract class ConfigurationContainer<E extends ConfigurationContainer> {
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 917b437c8244..2ed16dca5876 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 Task extends WindowContainer<WindowContainer> {
}
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 1c876d9cc02f..0ab5f91f0ce9 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.Pools;
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.protolog.common.ProtoLog;
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 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
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 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
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 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
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();
+ }
+ }
}