summaryrefslogtreecommitdiff
path: root/core/java/android/window/WindowContextController.java
diff options
context:
space:
mode:
authorCharles Chen <charlesccchen@google.com>2021-11-12 21:22:42 +0800
committerCharles Chen <charlesccchen@google.com>2021-11-23 13:10:01 +0000
commit46ffd51d0723ad18b82d1093814ed7995996c8b9 (patch)
treea3661fdec0b6f8e7e96e9983046b858370c63f6a /core/java/android/window/WindowContextController.java
parent7cd57a75ffbeeef9bcf41b78423b26e6d7c69656 (diff)
Associate SystemUiContext with DisplayContent
Before this CL, SystemUiContexts were fixed to the Display metrics when the SystemUiContexts were created. It is the same mechanism as DisplayContext but applies to SystemUiContexts unexpectedly. This CL makes SystemUiContexts associate with DisplayContent with the corresponding display ID. In this way, SystemUiContext would receive updates when there is a Display property change. Bug: 194262507 Bug: 191064581 Bug: 205859784 Test: atest InputMethodMenuControllerTest WindowContextControllerTest Test: atest NexusLauncherTests Change-Id: I64a1614f32d097785915f6105b1813a929e0fe32
Diffstat (limited to 'core/java/android/window/WindowContextController.java')
-rw-r--r--core/java/android/window/WindowContextController.java39
1 files changed, 4 insertions, 35 deletions
diff --git a/core/java/android/window/WindowContextController.java b/core/java/android/window/WindowContextController.java
index 5aa623388574..17b675f93f86 100644
--- a/core/java/android/window/WindowContextController.java
+++ b/core/java/android/window/WindowContextController.java
@@ -19,13 +19,10 @@ package android.window;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
-import android.content.res.Configuration;
import android.os.Bundle;
import android.os.IBinder;
-import android.os.RemoteException;
import android.view.IWindowManager;
import android.view.WindowManager.LayoutParams.WindowType;
-import android.view.WindowManagerGlobal;
import com.android.internal.annotations.VisibleForTesting;
@@ -38,7 +35,6 @@ import com.android.internal.annotations.VisibleForTesting;
* @hide
*/
public class WindowContextController {
- private final IWindowManager mWms;
/**
* {@code true} to indicate that the {@code mToken} is associated with a
* {@link com.android.server.wm.DisplayArea}. Note that {@code mToken} is able to attach a
@@ -56,14 +52,7 @@ public class WindowContextController {
* {@link Context#getWindowContextToken()}.
*/
public WindowContextController(@NonNull WindowTokenClient token) {
- this(token, WindowManagerGlobal.getWindowManagerService());
- }
-
- /** Used for test only. DO NOT USE it in production code. */
- @VisibleForTesting
- public WindowContextController(@NonNull WindowTokenClient token, IWindowManager mockWms) {
mToken = token;
- mWms = mockWms;
}
/**
@@ -80,19 +69,7 @@ public class WindowContextController {
throw new IllegalStateException("A Window Context can be only attached to "
+ "a DisplayArea once.");
}
- try {
- final Configuration configuration = mWms.attachWindowContextToDisplayArea(mToken, type,
- displayId, options);
- if (configuration != null) {
- mAttachedToDisplayArea = true;
- // Send the DisplayArea's configuration to WindowContext directly instead of
- // waiting for dispatching from WMS.
- mToken.onConfigurationChanged(configuration, displayId,
- false /* shouldReportConfigChange */);
- }
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
+ mAttachedToDisplayArea = mToken.attachToDisplayArea(type, displayId, options);
}
/**
@@ -120,22 +97,14 @@ public class WindowContextController {
throw new IllegalStateException("The Window Context should have been attached"
+ " to a DisplayArea.");
}
- try {
- mWms.attachWindowContextToWindowToken(mToken, windowToken);
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
+ mToken.attachToWindowToken(windowToken);
}
/** Detaches the window context from the node it's currently associated with. */
public void detachIfNeeded() {
if (mAttachedToDisplayArea) {
- try {
- mWms.detachWindowContextFromWindowContainer(mToken);
- mAttachedToDisplayArea = false;
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
+ mToken.detachFromWindowContainerIfNeeded();
+ mAttachedToDisplayArea = false;
}
}
}