1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License 15 */ 16 17 package com.android.server.wm; 18 19 import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; 20 import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY; 21 import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY; 22 import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; 23 import static org.mockito.Mockito.mock; 24 import static org.mockito.Mockito.verify; 25 import static org.mockito.Matchers.eq; 26 27 import android.platform.test.annotations.Presubmit; 28 import android.support.test.filters.SmallTest; 29 import android.support.test.runner.AndroidJUnit4; 30 31 import org.junit.Test; 32 import org.junit.runner.RunWith; 33 34 import org.mockito.Mock; 35 36 import java.util.function.Consumer; 37 38 /** 39 * Tests for {@link WindowContainer#forAllWindows} and various implementations. 40 */ 41 @SmallTest 42 @Presubmit 43 @RunWith(AndroidJUnit4.class) 44 public class WindowContainerTraversalTests extends WindowTestsBase { 45 46 @Test 47 public void testDockedDividerPosition() throws Exception { 48 final WindowState splitScreenWindow = createWindowOnStack(null, 49 WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, ACTIVITY_TYPE_STANDARD, TYPE_BASE_APPLICATION, 50 mDisplayContent, "splitScreenWindow"); 51 final WindowState splitScreenSecondaryWindow = createWindowOnStack(null, 52 WINDOWING_MODE_SPLIT_SCREEN_SECONDARY, ACTIVITY_TYPE_STANDARD, 53 TYPE_BASE_APPLICATION, mDisplayContent, "splitScreenSecondaryWindow"); 54 55 sWm.mInputMethodTarget = splitScreenWindow; 56 57 Consumer<WindowState> c = mock(Consumer.class); 58 mDisplayContent.forAllWindows(c, false); 59 60 verify(c).accept(eq(mDockedDividerWindow)); 61 verify(c).accept(eq(mImeWindow)); 62 } 63 } 64