diff options
| author | 2018-11-28 21:14:32 -0800 | |
|---|---|---|
| committer | 2018-11-29 13:13:59 +0000 | |
| commit | d4ef3010915e5ed6d24a0d26e9615c365a962083 (patch) | |
| tree | a0afa5b4b0710ad54c28fac43a4da3987a751244 | |
| parent | afd7c69060debde328496d2fde4d791b8bbd9cec (diff) | |
Fix WM Tests Failures
The test ATM mWindowManager was not correctly set. This should be able
to fix the tests failures currently on master.
Test: atest WmTests FrameworksServicesTests:com.android.server.wm
Test: presubmit
Change-Id: I657e76e5b5e2f41e3141b33cf619655807062f98
| -rw-r--r-- | services/core/java/com/android/server/wm/ActivityRecord.java | 2 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index eec22d5d1ee9..b4aec35d9d6e 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -1105,6 +1105,8 @@ final class ActivityRecord extends ConfigurationContainer { } void removeWindowContainer() { + if (service.mWindowManager.mRoot == null) return; + final DisplayContent dc = service.mWindowManager.mRoot.getDisplayContent( getDisplayId()); if (dc == null) { diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java index 81e97c688e6e..ead9731782e8 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java +++ b/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java @@ -233,7 +233,9 @@ class ActivityTestsBase { aInfo /*aInfo*/, new Configuration(), null /* resultTo */, null /* resultWho */, 0 /* reqCode */, false /*componentSpecified*/, false /* rootVoiceInteraction */, mService.mStackSupervisor, null /* options */, null /* sourceRecord */); + spyOn(activity); activity.mAppWindowToken = mock(AppWindowToken.class); + doNothing().when(activity).removeWindowContainer(); if (mTaskRecord != null) { mTaskRecord.addActivityToTop(activity); @@ -245,7 +247,6 @@ class ActivityTestsBase { mock(WindowProcessListener.class)); wpc.setThread(mock(IApplicationThread.class)); activity.setProcess(wpc); - activity.service.mWindowManager.mRoot = mock(RootWindowContainer.class); return activity; } } |