blob: e4d8279a52cdaa775c89b1ec170184d7565b711c [file] [log] [blame]
Jorim Jaggib6030952018-10-23 18:31:52 +02001/*
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
17package android.view;
18
Tiger Huang332793b2019-10-29 23:21:27 +080019import static android.view.InsetsState.ITYPE_IME;
20import static android.view.InsetsState.ITYPE_NAVIGATION_BAR;
21import static android.view.InsetsState.ITYPE_STATUS_BAR;
22import static android.view.WindowInsets.Type.statusBars;
Jorim Jaggi648e5882019-01-24 13:24:02 +010023import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
Tadashi G. Takaoka82eb7a52019-03-26 18:22:01 +090024
25import static org.junit.Assert.assertEquals;
26import static org.junit.Assert.assertFalse;
27import static org.junit.Assert.assertNull;
28import static org.junit.Assert.assertTrue;
Tarandeep Singha6f35612019-01-11 19:50:46 -080029import static org.mockito.ArgumentMatchers.any;
30import static org.mockito.ArgumentMatchers.anyInt;
31import static org.mockito.Mockito.mock;
32import static org.mockito.Mockito.never;
33import static org.mockito.Mockito.verify;
Tadashi G. Takaokab4470f22019-01-15 18:29:15 +090034
Tarandeep Singh22f2b4c2019-01-10 19:41:30 -080035import android.content.Context;
36import android.graphics.Insets;
Tarandeep Singh215929b2019-01-11 18:24:37 -080037import android.graphics.Point;
Tarandeep Singh22f2b4c2019-01-10 19:41:30 -080038import android.graphics.Rect;
Jorim Jaggib6030952018-10-23 18:31:52 +020039import android.platform.test.annotations.Presubmit;
Tarandeep Singh22f2b4c2019-01-10 19:41:30 -080040import android.view.WindowInsets.Type;
41import android.view.WindowManager.BadTokenException;
42import android.view.WindowManager.LayoutParams;
43import android.widget.TextView;
Tadashi G. Takaokab4470f22019-01-15 18:29:15 +090044
Tarandeep Singh22f2b4c2019-01-10 19:41:30 -080045import androidx.test.InstrumentationRegistry;
Tadashi G. Takaokab4470f22019-01-15 18:29:15 +090046import androidx.test.runner.AndroidJUnit4;
Jorim Jaggib6030952018-10-23 18:31:52 +020047
48import org.junit.Before;
49import org.junit.Test;
50import org.junit.runner.RunWith;
Jorim Jaggi5ed50cc2019-01-23 16:59:42 +010051import org.mockito.ArgumentCaptor;
52
53import java.util.concurrent.CountDownLatch;
Jorim Jaggib6030952018-10-23 18:31:52 +020054
Tadashi G. Takaoka82eb7a52019-03-26 18:22:01 +090055/**
56 * Tests for {@link InsetsController}.
57 *
58 * <p>Build/Install/Run:
59 * atest FrameworksCoreTests:InsetsControllerTest
60 *
61 * <p>This test class is a part of Window Manager Service tests and specified in
62 * {@link com.android.server.wm.test.filters.FrameworksTestsFilter}.
63 */
Jorim Jaggib6030952018-10-23 18:31:52 +020064@Presubmit
Jorim Jaggib6030952018-10-23 18:31:52 +020065@RunWith(AndroidJUnit4.class)
66public class InsetsControllerTest {
67
Tarandeep Singh22f2b4c2019-01-10 19:41:30 -080068 private InsetsController mController;
Jorim Jaggib6030952018-10-23 18:31:52 +020069 private SurfaceSession mSession = new SurfaceSession();
70 private SurfaceControl mLeash;
71
72 @Before
73 public void setup() {
74 mLeash = new SurfaceControl.Builder(mSession)
75 .setName("testSurface")
76 .build();
Tarandeep Singh22f2b4c2019-01-10 19:41:30 -080077 InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
78 Context context = InstrumentationRegistry.getTargetContext();
79 // cannot mock ViewRootImpl since it's final.
80 ViewRootImpl viewRootImpl = new ViewRootImpl(context, context.getDisplay());
81 try {
82 viewRootImpl.setView(new TextView(context), new LayoutParams(), null);
83 } catch (BadTokenException e) {
84 // activity isn't running, we will ignore BadTokenException.
85 }
86 mController = new InsetsController(viewRootImpl);
87 final Rect rect = new Rect(5, 5, 5, 5);
88 mController.calculateInsets(
89 false,
90 false,
91 new DisplayCutout(
92 Insets.of(10, 10, 10, 10), rect, rect, rect, rect),
Jorim Jaggi648e5882019-01-24 13:24:02 +010093 rect, rect, SOFT_INPUT_ADJUST_RESIZE);
Jorim Jaggi5ed50cc2019-01-23 16:59:42 +010094 mController.onFrameChanged(new Rect(0, 0, 100, 100));
95 mController.getState().setDisplayFrame(new Rect(0, 0, 100, 100));
Tarandeep Singh22f2b4c2019-01-10 19:41:30 -080096 });
Tarandeep Singh46d59f02019-01-29 18:09:15 -080097 InstrumentationRegistry.getInstrumentation().waitForIdleSync();
Jorim Jaggib6030952018-10-23 18:31:52 +020098 }
99
100 @Test
101 public void testControlsChanged() {
Tiger Huang332793b2019-10-29 23:21:27 +0800102 InsetsSourceControl control =
103 new InsetsSourceControl(ITYPE_STATUS_BAR, mLeash, new Point());
Jorim Jaggib6030952018-10-23 18:31:52 +0200104 mController.onControlsChanged(new InsetsSourceControl[] { control });
105 assertEquals(mLeash,
Tiger Huang332793b2019-10-29 23:21:27 +0800106 mController.getSourceConsumer(ITYPE_STATUS_BAR).getControl().getLeash());
Jorim Jaggib6030952018-10-23 18:31:52 +0200107 }
108
109 @Test
110 public void testControlsRevoked() {
Tiger Huang332793b2019-10-29 23:21:27 +0800111 InsetsSourceControl control =
112 new InsetsSourceControl(ITYPE_STATUS_BAR, mLeash, new Point());
Jorim Jaggib6030952018-10-23 18:31:52 +0200113 mController.onControlsChanged(new InsetsSourceControl[] { control });
114 mController.onControlsChanged(new InsetsSourceControl[0]);
Tiger Huang332793b2019-10-29 23:21:27 +0800115 assertNull(mController.getSourceConsumer(ITYPE_STATUS_BAR).getControl());
Jorim Jaggib6030952018-10-23 18:31:52 +0200116 }
Tarandeep Singh22f2b4c2019-01-10 19:41:30 -0800117
118 @Test
Jorim Jaggi5ed50cc2019-01-23 16:59:42 +0100119 public void testControlsRevoked_duringAnim() {
Tiger Huang332793b2019-10-29 23:21:27 +0800120 InsetsSourceControl control =
121 new InsetsSourceControl(ITYPE_STATUS_BAR, mLeash, new Point());
Jorim Jaggi5ed50cc2019-01-23 16:59:42 +0100122 mController.onControlsChanged(new InsetsSourceControl[] { control });
123
124 WindowInsetsAnimationControlListener mockListener =
125 mock(WindowInsetsAnimationControlListener.class);
Tiger Huang332793b2019-10-29 23:21:27 +0800126 mController.controlWindowInsetsAnimation(statusBars(), mockListener);
Jorim Jaggi5ed50cc2019-01-23 16:59:42 +0100127 verify(mockListener).onReady(any(), anyInt());
128 mController.onControlsChanged(new InsetsSourceControl[0]);
129 verify(mockListener).onCancelled();
130 }
131
132 @Test
Tarandeep Singha6f35612019-01-11 19:50:46 -0800133 public void testFrameDoesntMatchDisplay() {
134 mController.onFrameChanged(new Rect(0, 0, 100, 100));
135 mController.getState().setDisplayFrame(new Rect(0, 0, 200, 200));
136 WindowInsetsAnimationControlListener controlListener =
137 mock(WindowInsetsAnimationControlListener.class);
138 mController.controlWindowInsetsAnimation(0, controlListener);
139 verify(controlListener).onCancelled();
140 verify(controlListener, never()).onReady(any(), anyInt());
141 }
142
143 @Test
Tarandeep Singh22f2b4c2019-01-10 19:41:30 -0800144 public void testAnimationEndState() {
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800145 InsetsSourceControl[] controls = prepareControls();
146 InsetsSourceControl navBar = controls[0];
Tiger Huang332793b2019-10-29 23:21:27 +0800147 InsetsSourceControl statusBar = controls[1];
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800148 InsetsSourceControl ime = controls[2];
149
150 InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
Tiger Huang332793b2019-10-29 23:21:27 +0800151 mController.getSourceConsumer(ITYPE_IME).onWindowFocusGained();
Jorim Jaggi5ed50cc2019-01-23 16:59:42 +0100152 // since there is no focused view, forcefully make IME visible.
153 mController.applyImeVisibility(true /* setVisible */);
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800154 mController.show(Type.all());
155 // quickly jump to final state by cancelling it.
156 mController.cancelExistingAnimation();
157 assertTrue(mController.getSourceConsumer(navBar.getType()).isVisible());
Tiger Huang332793b2019-10-29 23:21:27 +0800158 assertTrue(mController.getSourceConsumer(statusBar.getType()).isVisible());
Jorim Jaggi5ed50cc2019-01-23 16:59:42 +0100159 assertTrue(mController.getSourceConsumer(ime.getType()).isVisible());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800160
Jorim Jaggi5ed50cc2019-01-23 16:59:42 +0100161 mController.applyImeVisibility(false /* setVisible */);
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800162 mController.hide(Type.all());
163 mController.cancelExistingAnimation();
164 assertFalse(mController.getSourceConsumer(navBar.getType()).isVisible());
Tiger Huang332793b2019-10-29 23:21:27 +0800165 assertFalse(mController.getSourceConsumer(statusBar.getType()).isVisible());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800166 assertFalse(mController.getSourceConsumer(ime.getType()).isVisible());
Tiger Huang332793b2019-10-29 23:21:27 +0800167 mController.getSourceConsumer(ITYPE_IME).onWindowFocusLost();
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800168 });
169 InstrumentationRegistry.getInstrumentation().waitForIdleSync();
170 }
171
172 @Test
173 public void testApplyImeVisibility() {
Tiger Huang332793b2019-10-29 23:21:27 +0800174 final InsetsSourceControl ime = new InsetsSourceControl(ITYPE_IME, mLeash, new Point());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800175
176 InsetsSourceControl[] controls = new InsetsSourceControl[3];
177 controls[0] = ime;
178 mController.onControlsChanged(controls);
179 InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
Tiger Huang332793b2019-10-29 23:21:27 +0800180 mController.getSourceConsumer(ITYPE_IME).onWindowFocusGained();
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800181 mController.applyImeVisibility(true);
182 mController.cancelExistingAnimation();
183 assertTrue(mController.getSourceConsumer(ime.getType()).isVisible());
184 mController.applyImeVisibility(false);
185 mController.cancelExistingAnimation();
186 assertFalse(mController.getSourceConsumer(ime.getType()).isVisible());
Tiger Huang332793b2019-10-29 23:21:27 +0800187 mController.getSourceConsumer(ITYPE_IME).onWindowFocusLost();
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800188 });
189 InstrumentationRegistry.getInstrumentation().waitForIdleSync();
190 }
191
192 @Test
193 public void testShowHideSelectively() {
194 InsetsSourceControl[] controls = prepareControls();
195 InsetsSourceControl navBar = controls[0];
Tiger Huang332793b2019-10-29 23:21:27 +0800196 InsetsSourceControl statusBar = controls[1];
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800197 InsetsSourceControl ime = controls[2];
198
199 InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
Tiger Huang332793b2019-10-29 23:21:27 +0800200 int types = Type.navigationBars() | Type.systemBars();
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800201 // test show select types.
202 mController.show(types);
203 mController.cancelExistingAnimation();
204 assertTrue(mController.getSourceConsumer(navBar.getType()).isVisible());
Tiger Huang332793b2019-10-29 23:21:27 +0800205 assertTrue(mController.getSourceConsumer(statusBar.getType()).isVisible());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800206 assertFalse(mController.getSourceConsumer(ime.getType()).isVisible());
207
208 // test hide all
209 mController.hide(types);
210 mController.cancelExistingAnimation();
211 assertFalse(mController.getSourceConsumer(navBar.getType()).isVisible());
Tiger Huang332793b2019-10-29 23:21:27 +0800212 assertFalse(mController.getSourceConsumer(statusBar.getType()).isVisible());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800213 assertFalse(mController.getSourceConsumer(ime.getType()).isVisible());
214 });
215 InstrumentationRegistry.getInstrumentation().waitForIdleSync();
216 }
217
218 @Test
219 public void testShowHideSingle() {
220 InsetsSourceControl[] controls = prepareControls();
221 InsetsSourceControl navBar = controls[0];
Tiger Huang332793b2019-10-29 23:21:27 +0800222 InsetsSourceControl statusBar = controls[1];
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800223 InsetsSourceControl ime = controls[2];
224
225 InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
Tiger Huang332793b2019-10-29 23:21:27 +0800226 int types = Type.navigationBars() | Type.systemBars();
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800227 // test show select types.
228 mController.show(types);
229 mController.cancelExistingAnimation();
230 assertTrue(mController.getSourceConsumer(navBar.getType()).isVisible());
Tiger Huang332793b2019-10-29 23:21:27 +0800231 assertTrue(mController.getSourceConsumer(statusBar.getType()).isVisible());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800232 assertFalse(mController.getSourceConsumer(ime.getType()).isVisible());
233
234 // test hide all
235 mController.hide(Type.all());
236 mController.cancelExistingAnimation();
237 assertFalse(mController.getSourceConsumer(navBar.getType()).isVisible());
Tiger Huang332793b2019-10-29 23:21:27 +0800238 assertFalse(mController.getSourceConsumer(statusBar.getType()).isVisible());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800239 assertFalse(mController.getSourceConsumer(ime.getType()).isVisible());
240
241 // test single show
Tiger Huang332793b2019-10-29 23:21:27 +0800242 mController.show(Type.navigationBars());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800243 mController.cancelExistingAnimation();
244 assertTrue(mController.getSourceConsumer(navBar.getType()).isVisible());
Tiger Huang332793b2019-10-29 23:21:27 +0800245 assertFalse(mController.getSourceConsumer(statusBar.getType()).isVisible());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800246 assertFalse(mController.getSourceConsumer(ime.getType()).isVisible());
247
248 // test single hide
Tiger Huang332793b2019-10-29 23:21:27 +0800249 mController.hide(Type.navigationBars());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800250 assertFalse(mController.getSourceConsumer(navBar.getType()).isVisible());
Tiger Huang332793b2019-10-29 23:21:27 +0800251 assertFalse(mController.getSourceConsumer(statusBar.getType()).isVisible());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800252 assertFalse(mController.getSourceConsumer(ime.getType()).isVisible());
253
254 });
255 InstrumentationRegistry.getInstrumentation().waitForIdleSync();
256 }
257
258 @Test
259 public void testShowHideMultiple() {
260 InsetsSourceControl[] controls = prepareControls();
261 InsetsSourceControl navBar = controls[0];
Tiger Huang332793b2019-10-29 23:21:27 +0800262 InsetsSourceControl statusBar = controls[1];
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800263 InsetsSourceControl ime = controls[2];
264
265 InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
266 // start two animations and see if previous is cancelled and final state is reached.
Tiger Huang332793b2019-10-29 23:21:27 +0800267 mController.show(Type.navigationBars());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800268 mController.show(Type.systemBars());
269 mController.cancelExistingAnimation();
270 assertTrue(mController.getSourceConsumer(navBar.getType()).isVisible());
Tiger Huang332793b2019-10-29 23:21:27 +0800271 assertTrue(mController.getSourceConsumer(statusBar.getType()).isVisible());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800272 assertFalse(mController.getSourceConsumer(ime.getType()).isVisible());
273
Tiger Huang332793b2019-10-29 23:21:27 +0800274 mController.hide(Type.navigationBars());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800275 mController.hide(Type.systemBars());
276 mController.cancelExistingAnimation();
277 assertFalse(mController.getSourceConsumer(navBar.getType()).isVisible());
Tiger Huang332793b2019-10-29 23:21:27 +0800278 assertFalse(mController.getSourceConsumer(statusBar.getType()).isVisible());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800279 assertFalse(mController.getSourceConsumer(ime.getType()).isVisible());
280
Tiger Huang332793b2019-10-29 23:21:27 +0800281 int types = Type.navigationBars() | Type.systemBars();
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800282 // show two at a time and hide one by one.
283 mController.show(types);
Tiger Huang332793b2019-10-29 23:21:27 +0800284 mController.hide(Type.navigationBars());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800285 mController.cancelExistingAnimation();
286 assertFalse(mController.getSourceConsumer(navBar.getType()).isVisible());
Tiger Huang332793b2019-10-29 23:21:27 +0800287 assertTrue(mController.getSourceConsumer(statusBar.getType()).isVisible());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800288 assertFalse(mController.getSourceConsumer(ime.getType()).isVisible());
289
290 mController.hide(Type.systemBars());
291 mController.cancelExistingAnimation();
292 assertFalse(mController.getSourceConsumer(navBar.getType()).isVisible());
Tiger Huang332793b2019-10-29 23:21:27 +0800293 assertFalse(mController.getSourceConsumer(statusBar.getType()).isVisible());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800294 assertFalse(mController.getSourceConsumer(ime.getType()).isVisible());
295 });
296 InstrumentationRegistry.getInstrumentation().waitForIdleSync();
297 }
298
299 @Test
300 public void testShowMultipleHideOneByOne() {
301 InsetsSourceControl[] controls = prepareControls();
302 InsetsSourceControl navBar = controls[0];
Tiger Huang332793b2019-10-29 23:21:27 +0800303 InsetsSourceControl statusBar = controls[1];
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800304 InsetsSourceControl ime = controls[2];
305
306 InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
Tiger Huang332793b2019-10-29 23:21:27 +0800307 int types = Type.navigationBars() | Type.systemBars();
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800308 // show two at a time and hide one by one.
309 mController.show(types);
Tiger Huang332793b2019-10-29 23:21:27 +0800310 mController.hide(Type.navigationBars());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800311 mController.cancelExistingAnimation();
312 assertFalse(mController.getSourceConsumer(navBar.getType()).isVisible());
Tiger Huang332793b2019-10-29 23:21:27 +0800313 assertTrue(mController.getSourceConsumer(statusBar.getType()).isVisible());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800314 assertFalse(mController.getSourceConsumer(ime.getType()).isVisible());
315
316 mController.hide(Type.systemBars());
317 mController.cancelExistingAnimation();
318 assertFalse(mController.getSourceConsumer(navBar.getType()).isVisible());
Tiger Huang332793b2019-10-29 23:21:27 +0800319 assertFalse(mController.getSourceConsumer(statusBar.getType()).isVisible());
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800320 assertFalse(mController.getSourceConsumer(ime.getType()).isVisible());
321 });
322 InstrumentationRegistry.getInstrumentation().waitForIdleSync();
323 }
324
Jorim Jaggi5ed50cc2019-01-23 16:59:42 +0100325 @Test
326 public void testAnimationEndState_controller() throws Exception {
Tiger Huang332793b2019-10-29 23:21:27 +0800327 InsetsSourceControl control =
328 new InsetsSourceControl(ITYPE_STATUS_BAR, mLeash, new Point());
Jorim Jaggi5ed50cc2019-01-23 16:59:42 +0100329 mController.onControlsChanged(new InsetsSourceControl[] { control });
330
331 InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
332 WindowInsetsAnimationControlListener mockListener =
333 mock(WindowInsetsAnimationControlListener.class);
Tiger Huang332793b2019-10-29 23:21:27 +0800334 mController.controlWindowInsetsAnimation(statusBars(), mockListener);
Jorim Jaggi5ed50cc2019-01-23 16:59:42 +0100335
336 ArgumentCaptor<WindowInsetsAnimationController> controllerCaptor =
337 ArgumentCaptor.forClass(WindowInsetsAnimationController.class);
338 verify(mockListener).onReady(controllerCaptor.capture(), anyInt());
339 controllerCaptor.getValue().finish(0 /* shownTypes */);
340 });
341 waitUntilNextFrame();
342 InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
Tiger Huang332793b2019-10-29 23:21:27 +0800343 assertFalse(mController.getSourceConsumer(ITYPE_STATUS_BAR).isVisible());
Jorim Jaggi5ed50cc2019-01-23 16:59:42 +0100344 });
345 InstrumentationRegistry.getInstrumentation().waitForIdleSync();
346 }
347
348 private void waitUntilNextFrame() throws Exception {
349 final CountDownLatch latch = new CountDownLatch(1);
350 Choreographer.getMainThreadInstance().postCallback(Choreographer.CALLBACK_COMMIT,
351 latch::countDown, null /* token */);
352 latch.await();
353 }
354
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800355 private InsetsSourceControl[] prepareControls() {
Tiger Huang332793b2019-10-29 23:21:27 +0800356 final InsetsSourceControl navBar = new InsetsSourceControl(ITYPE_NAVIGATION_BAR, mLeash,
Tarandeep Singh215929b2019-01-11 18:24:37 -0800357 new Point());
Tiger Huang332793b2019-10-29 23:21:27 +0800358 final InsetsSourceControl statusBar = new InsetsSourceControl(ITYPE_STATUS_BAR, mLeash,
Tarandeep Singh215929b2019-01-11 18:24:37 -0800359 new Point());
Tiger Huang332793b2019-10-29 23:21:27 +0800360 final InsetsSourceControl ime = new InsetsSourceControl(ITYPE_IME, mLeash, new Point());
Tarandeep Singh22f2b4c2019-01-10 19:41:30 -0800361
362 InsetsSourceControl[] controls = new InsetsSourceControl[3];
363 controls[0] = navBar;
Tiger Huang332793b2019-10-29 23:21:27 +0800364 controls[1] = statusBar;
Tarandeep Singh22f2b4c2019-01-10 19:41:30 -0800365 controls[2] = ime;
366 mController.onControlsChanged(controls);
Tarandeep Singh46d59f02019-01-29 18:09:15 -0800367 return controls;
Tarandeep Singh22f2b4c2019-01-10 19:41:30 -0800368 }
Jorim Jaggib6030952018-10-23 18:31:52 +0200369}