summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yunfan Chen <yunfanc@google.com> 2018-12-04 16:56:21 -0800
committer Yunfan Chen <yunfanc@google.com> 2018-12-04 23:00:05 -0800
commitc2ff6cf1c5ee6341f2edae97272afe734c3eff46 (patch)
tree64ef2d64c35d6ef61c7851fffea949ee142734e9
parentb53030f983b8f606a6fed7527605073613895f67 (diff)
Use WindowProcessController configuration for process
This patch is to replace the process configuration map in WindowManagerService with the map in ActivityTaskManagerService. To do so, we pass the ActivityTaskManagerService instance to WindowManaserService. Adjust test base accordingly. Test: WmTests Test: go/wm-smoke Bug: 117877476 Bug: 113253755 Change-Id: Ica93c3ad402e1cab682466fd16a8226176f9bae8
-rw-r--r--services/core/java/com/android/server/wm/ActivityTaskManagerService.java7
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerInternal.java8
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java24
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java6
-rw-r--r--services/java/com/android/server/SystemServer.java2
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRule.java6
6 files changed, 22 insertions, 31 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index 0967afda6d2d..37db6711fac0 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -863,6 +863,13 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
*/
Configuration getGlobalConfigurationForCallingPid() {
final int pid = Binder.getCallingPid();
+ return getGlobalConfigurationForPid(pid);
+ }
+
+ /**
+ * Return the global configuration used by the process corresponding to the given pid.
+ */
+ Configuration getGlobalConfigurationForPid(int pid) {
if (pid == MY_PID || pid < 0) {
return getGlobalConfiguration();
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerInternal.java b/services/core/java/com/android/server/wm/WindowManagerInternal.java
index e83b8634925e..9f1a58770611 100644
--- a/services/core/java/com/android/server/wm/WindowManagerInternal.java
+++ b/services/core/java/com/android/server/wm/WindowManagerInternal.java
@@ -19,7 +19,6 @@ package com.android.server.wm;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.ClipData;
-import android.content.res.Configuration;
import android.graphics.Rect;
import android.graphics.Region;
import android.hardware.display.DisplayManagerInternal;
@@ -449,11 +448,4 @@ public abstract class WindowManagerInternal {
* Return the display Id for given window.
*/
public abstract int getDisplayIdForWindow(IBinder windowToken);
-
- // TODO: use WindowProcessController once go/wm-unified is done.
- /**
- * Notifies the window manager that configuration of the process associated with the input pid
- * changed.
- */
- public abstract void onProcessConfigurationChanged(int pid, Configuration newConfig);
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 52b24b3e7307..002d6d409abe 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -735,6 +735,7 @@ public class WindowManagerService extends IWindowManager.Stub
final InputManagerService mInputManager;
final DisplayManagerInternal mDisplayManagerInternal;
final DisplayManager mDisplayManager;
+ final ActivityTaskManagerService mAtmService;
// Indicates whether this device supports wide color gamut / HDR rendering
private boolean mHasWideColorGamutSupport;
@@ -897,11 +898,10 @@ public class WindowManagerService extends IWindowManager.Stub
public static WindowManagerService main(final Context context, final InputManagerService im,
final boolean showBootMsgs, final boolean onlyCore, WindowManagerPolicy policy,
- final WindowManagerGlobalLock globalLock) {
+ ActivityTaskManagerService atm) {
DisplayThread.getHandler().runWithScissors(() ->
sInstance = new WindowManagerService(context, im, showBootMsgs, onlyCore, policy,
- globalLock),
- 0);
+ atm), 0);
return sInstance;
}
@@ -923,9 +923,10 @@ public class WindowManagerService extends IWindowManager.Stub
private WindowManagerService(Context context, InputManagerService inputManager,
boolean showBootMsgs, boolean onlyCore, WindowManagerPolicy policy,
- WindowManagerGlobalLock globalLock) {
+ ActivityTaskManagerService atm) {
installLock(this, INDEX_WINDOW);
- mGlobalLock = globalLock;
+ mGlobalLock = atm.getGlobalLock();
+ mAtmService = atm;
mContext = context;
mAllowBootMessages = showBootMsgs;
mOnlyCore = onlyCore;
@@ -7281,19 +7282,6 @@ public class WindowManagerService extends IWindowManager.Stub
return Display.INVALID_DISPLAY;
}
}
-
- @Override
- public void onProcessConfigurationChanged(int pid, Configuration newConfig) {
- synchronized (mGlobalLock) {
- Configuration currentConfig = mProcessConfigurations.get(pid);
- if (currentConfig == null) {
- currentConfig = new Configuration(newConfig);
- } else {
- currentConfig.setTo(newConfig);
- }
- mProcessConfigurations.put(pid, currentConfig);
- }
- }
}
void registerAppFreezeListener(AppFreezeListener listener) {
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index ef22bb84decc..8d5d433aea32 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -2268,8 +2268,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
// For child windows we want to use the pid for the parent window in case the the child
// window was added from another process.
final int pid = getParentWindow() != null ? getParentWindow().mSession.mPid : mSession.mPid;
- mTempConfiguration.setTo(mWmService.mProcessConfigurations.get(
- pid, mWmService.mRoot.getConfiguration()));
+ final Configuration processConfig =
+ mWmService.mAtmService.getGlobalConfigurationForPid(pid);
+ mTempConfiguration.setTo(processConfig == null
+ ? mWmService.mRoot.getConfiguration() : processConfig);
return mTempConfiguration;
}
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index f3704d818b30..63751fdb8294 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -925,7 +925,7 @@ public final class SystemServer {
ConcurrentUtils.waitForFutureNoInterrupt(mSensorServiceStart, START_SENSOR_SERVICE);
mSensorServiceStart = null;
wm = WindowManagerService.main(context, inputManager, !mFirstBoot, mOnlyCore,
- new PhoneWindowManager(), mWindowManagerGlobalLock);
+ new PhoneWindowManager(), mActivityManagerService.mActivityTaskManager);
ServiceManager.addService(Context.WINDOW_SERVICE, wm, /* allowIsolated= */ false,
DUMP_FLAG_PRIORITY_CRITICAL | DUMP_FLAG_PROTO);
ServiceManager.addService(Context.INPUT_SERVICE, inputManager,
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRule.java b/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRule.java
index 4a99172160f5..7ce3da4fc46d 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRule.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRule.java
@@ -30,6 +30,7 @@ import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.when;
import android.app.ActivityManagerInternal;
import android.content.Context;
@@ -125,11 +126,12 @@ public class WindowManagerServiceRule implements TestRule {
if (input != null && input.length > 1) {
doReturn(input[1]).when(ims).monitorInput(anyString(), anyInt());
}
+ ActivityTaskManagerService atms = mock(ActivityTaskManagerService.class);
+ when(atms.getGlobalLock()).thenReturn(new WindowManagerGlobalLock());
mService = WindowManagerService.main(context, ims, false, false,
mPolicy = new TestWindowManagerPolicy(
- WindowManagerServiceRule.this::getWindowManagerService),
- new WindowManagerGlobalLock());
+ WindowManagerServiceRule.this::getWindowManagerService), atms);
mService.mTransactionFactory = () -> {
final SurfaceControl.Transaction transaction = new SurfaceControl.Transaction();
mSurfaceTransactions.add(new WeakReference<>(transaction));