Loading services/core/java/com/android/server/wm/WindowManagerService.java +16 −2 Original line number Diff line number Diff line Loading @@ -4648,7 +4648,14 @@ public class WindowManagerService extends IWindowManager.Stub void reportSystemGestureExclusionChanged(Session session, IWindow window, List<Rect> exclusionRects) { synchronized (mGlobalLock) { final WindowState win = windowForClientLocked(session, window, true); final WindowState win = windowForClientLocked(session, window, false /* throwOnError */); if (win == null) { Slog.i(TAG_WM, "reportSystemGestureExclusionChanged(): No window state for package:" + session.mPackageName); return; } if (win.setSystemGestureExclusion(exclusionRects)) { win.getDisplayContent().updateSystemGestureExclusion(); } Loading @@ -4658,7 +4665,14 @@ public class WindowManagerService extends IWindowManager.Stub void reportKeepClearAreasChanged(Session session, IWindow window, List<Rect> restricted, List<Rect> unrestricted) { synchronized (mGlobalLock) { final WindowState win = windowForClientLocked(session, window, true); final WindowState win = windowForClientLocked(session, window, false /* throwOnError */); if (win == null) { Slog.i(TAG_WM, "reportKeepClearAreasChanged(): No window state for package:" + session.mPackageName); return; } if (win.setKeepClearAreas(restricted, unrestricted)) { win.getDisplayContent().updateKeepClearAreas(); } Loading services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceTests.java +24 −0 Original line number Diff line number Diff line Loading @@ -107,6 +107,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import java.util.ArrayList; /** * Build/Install/Run: * atest WmTests:WindowManagerServiceTests Loading Loading @@ -975,6 +977,28 @@ public class WindowManagerServiceTests extends WindowTestsBase { verify(window, times(2)).requestAppKeyboardShortcuts(receiver, 0); } @Test public void testReportSystemGestureExclusionChanged_invalidWindow() { final Session session = mock(Session.class); final IWindow window = mock(IWindow.class); final IBinder binder = mock(IBinder.class); doReturn(binder).when(window).asBinder(); // No exception even if the window doesn't exist mWm.reportSystemGestureExclusionChanged(session, window, new ArrayList<>()); } @Test public void testReportKeepClearAreasChanged_invalidWindow() { final Session session = mock(Session.class); final IWindow window = mock(IWindow.class); final IBinder binder = mock(IBinder.class); doReturn(binder).when(window).asBinder(); // No exception even if the window doesn't exist mWm.reportKeepClearAreasChanged(session, window, new ArrayList<>(), new ArrayList<>()); } class TestResultReceiver implements IResultReceiver { public android.os.Bundle resultData; private final IBinder mBinder = mock(IBinder.class); Loading Loading
services/core/java/com/android/server/wm/WindowManagerService.java +16 −2 Original line number Diff line number Diff line Loading @@ -4648,7 +4648,14 @@ public class WindowManagerService extends IWindowManager.Stub void reportSystemGestureExclusionChanged(Session session, IWindow window, List<Rect> exclusionRects) { synchronized (mGlobalLock) { final WindowState win = windowForClientLocked(session, window, true); final WindowState win = windowForClientLocked(session, window, false /* throwOnError */); if (win == null) { Slog.i(TAG_WM, "reportSystemGestureExclusionChanged(): No window state for package:" + session.mPackageName); return; } if (win.setSystemGestureExclusion(exclusionRects)) { win.getDisplayContent().updateSystemGestureExclusion(); } Loading @@ -4658,7 +4665,14 @@ public class WindowManagerService extends IWindowManager.Stub void reportKeepClearAreasChanged(Session session, IWindow window, List<Rect> restricted, List<Rect> unrestricted) { synchronized (mGlobalLock) { final WindowState win = windowForClientLocked(session, window, true); final WindowState win = windowForClientLocked(session, window, false /* throwOnError */); if (win == null) { Slog.i(TAG_WM, "reportKeepClearAreasChanged(): No window state for package:" + session.mPackageName); return; } if (win.setKeepClearAreas(restricted, unrestricted)) { win.getDisplayContent().updateKeepClearAreas(); } Loading
services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceTests.java +24 −0 Original line number Diff line number Diff line Loading @@ -107,6 +107,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import java.util.ArrayList; /** * Build/Install/Run: * atest WmTests:WindowManagerServiceTests Loading Loading @@ -975,6 +977,28 @@ public class WindowManagerServiceTests extends WindowTestsBase { verify(window, times(2)).requestAppKeyboardShortcuts(receiver, 0); } @Test public void testReportSystemGestureExclusionChanged_invalidWindow() { final Session session = mock(Session.class); final IWindow window = mock(IWindow.class); final IBinder binder = mock(IBinder.class); doReturn(binder).when(window).asBinder(); // No exception even if the window doesn't exist mWm.reportSystemGestureExclusionChanged(session, window, new ArrayList<>()); } @Test public void testReportKeepClearAreasChanged_invalidWindow() { final Session session = mock(Session.class); final IWindow window = mock(IWindow.class); final IBinder binder = mock(IBinder.class); doReturn(binder).when(window).asBinder(); // No exception even if the window doesn't exist mWm.reportKeepClearAreasChanged(session, window, new ArrayList<>(), new ArrayList<>()); } class TestResultReceiver implements IResultReceiver { public android.os.Bundle resultData; private final IBinder mBinder = mock(IBinder.class); Loading