summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Gaurav Bhola <gauravbhola@google.com> 2022-04-01 19:57:58 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2022-04-01 19:57:58 +0000
commitbe5abebe9f7e331cdfeb1cbbd0b893f3b11d752a (patch)
treee1ab0d217f18bd3fe2ef937740acca85db49e243
parent2a2931d93fa1873ea397665ceda971f3c02d60f6 (diff)
parent3b42bacd2926a1f29108bac21b5bfabe7e4db2a0 (diff)
Merge "Add the insets visibilities requested by the focussed window in topFocussedWindowChanged() api." into tm-dev
-rw-r--r--core/java/android/view/IDisplayWindowInsetsController.aidl4
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java4
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayInsetsController.java17
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/DisplayInsetsControllerTest.java14
-rw-r--r--services/core/java/com/android/server/wm/DisplayContent.java5
-rw-r--r--services/core/java/com/android/server/wm/InsetsPolicy.java4
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java4
7 files changed, 31 insertions, 21 deletions
diff --git a/core/java/android/view/IDisplayWindowInsetsController.aidl b/core/java/android/view/IDisplayWindowInsetsController.aidl
index a0d4a6587bcf..f4a0dfaa4432 100644
--- a/core/java/android/view/IDisplayWindowInsetsController.aidl
+++ b/core/java/android/view/IDisplayWindowInsetsController.aidl
@@ -18,6 +18,7 @@ package android.view;
import android.view.InsetsSourceControl;
import android.view.InsetsState;
+import android.view.InsetsVisibilities;
/**
* Singular controller of insets to use when there isn't another obvious controller available.
@@ -30,8 +31,9 @@ oneway interface IDisplayWindowInsetsController {
* Called when top focused window changes to determine whether or not to take over insets
* control. Won't be called if config_remoteInsetsControllerControlsSystemBars is false.
* @param packageName: Passes the top package name
+ * @param requestedVisibilities The insets visibilities requested by the focussed window.
*/
- void topFocusedWindowChanged(String packageName);
+ void topFocusedWindowChanged(String packageName, in InsetsVisibilities insetsVisibilities);
/**
* @see IWindow#insetsChanged
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java
index a7052bc49699..3b83f1586d8c 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java
@@ -40,7 +40,6 @@ import android.view.WindowInsets;
import android.view.animation.Interpolator;
import android.view.animation.PathInterpolator;
-import androidx.annotation.BinderThread;
import androidx.annotation.VisibleForTesting;
import com.android.internal.view.IInputMethodManager;
@@ -325,7 +324,8 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
}
@Override
- public void topFocusedWindowChanged(String packageName) {
+ public void topFocusedWindowChanged(String packageName,
+ InsetsVisibilities requestedVisibilities) {
// Do nothing
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayInsetsController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayInsetsController.java
index 565f1481233c..b6705446674a 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayInsetsController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayInsetsController.java
@@ -23,6 +23,7 @@ import android.view.IDisplayWindowInsetsController;
import android.view.IWindowManager;
import android.view.InsetsSourceControl;
import android.view.InsetsState;
+import android.view.InsetsVisibilities;
import androidx.annotation.BinderThread;
@@ -170,13 +171,14 @@ public class DisplayInsetsController implements DisplayController.OnDisplaysChan
}
}
- private void topFocusedWindowChanged(String packageName) {
+ private void topFocusedWindowChanged(String packageName,
+ InsetsVisibilities requestedVisibilities) {
CopyOnWriteArrayList<OnInsetsChangedListener> listeners = mListeners.get(mDisplayId);
if (listeners == null) {
return;
}
for (OnInsetsChangedListener listener : listeners) {
- listener.topFocusedWindowChanged(packageName);
+ listener.topFocusedWindowChanged(packageName, requestedVisibilities);
}
}
@@ -184,9 +186,10 @@ public class DisplayInsetsController implements DisplayController.OnDisplaysChan
private class DisplayWindowInsetsControllerImpl
extends IDisplayWindowInsetsController.Stub {
@Override
- public void topFocusedWindowChanged(String packageName) throws RemoteException {
+ public void topFocusedWindowChanged(String packageName,
+ InsetsVisibilities requestedVisibilities) throws RemoteException {
mMainExecutor.execute(() -> {
- PerDisplay.this.topFocusedWindowChanged(packageName);
+ PerDisplay.this.topFocusedWindowChanged(packageName, requestedVisibilities);
});
}
@@ -231,9 +234,11 @@ public class DisplayInsetsController implements DisplayController.OnDisplaysChan
/**
* Called when top focused window changes to determine whether or not to take over insets
* control. Won't be called if config_remoteInsetsControllerControlsSystemBars is false.
- * @param packageName: Passes the top package name
+ * @param packageName The name of the package that is open in the top focussed window.
+ * @param requestedVisibilities The insets visibilities requested by the focussed window.
*/
- default void topFocusedWindowChanged(String packageName) {}
+ default void topFocusedWindowChanged(String packageName,
+ InsetsVisibilities requestedVisibilities) {}
/**
* Called when the window insets configuration has changed.
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/DisplayInsetsControllerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/DisplayInsetsControllerTest.java
index b66c2b4aee9b..3bf06cc0ede3 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/DisplayInsetsControllerTest.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/DisplayInsetsControllerTest.java
@@ -19,11 +19,8 @@ package com.android.wm.shell.common;
import static android.view.Display.DEFAULT_DISPLAY;
import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.notNull;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -33,6 +30,7 @@ import android.view.IDisplayWindowInsetsController;
import android.view.IWindowManager;
import android.view.InsetsSourceControl;
import android.view.InsetsState;
+import android.view.InsetsVisibilities;
import androidx.test.filters.SmallTest;
@@ -42,7 +40,6 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
-import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import java.util.List;
@@ -99,7 +96,8 @@ public class DisplayInsetsControllerTest {
mController.addInsetsChangedListener(DEFAULT_DISPLAY, defaultListener);
mController.addInsetsChangedListener(SECOND_DISPLAY, secondListener);
- mInsetsControllersByDisplayId.get(DEFAULT_DISPLAY).topFocusedWindowChanged(null);
+ mInsetsControllersByDisplayId.get(DEFAULT_DISPLAY).topFocusedWindowChanged(null,
+ new InsetsVisibilities());
mInsetsControllersByDisplayId.get(DEFAULT_DISPLAY).insetsChanged(null);
mInsetsControllersByDisplayId.get(DEFAULT_DISPLAY).insetsControlChanged(null, null);
mInsetsControllersByDisplayId.get(DEFAULT_DISPLAY).showInsets(0, false);
@@ -118,7 +116,8 @@ public class DisplayInsetsControllerTest {
assertTrue(secondListener.showInsetsCount == 0);
assertTrue(secondListener.hideInsetsCount == 0);
- mInsetsControllersByDisplayId.get(SECOND_DISPLAY).topFocusedWindowChanged(null);
+ mInsetsControllersByDisplayId.get(SECOND_DISPLAY).topFocusedWindowChanged(null,
+ new InsetsVisibilities());
mInsetsControllersByDisplayId.get(SECOND_DISPLAY).insetsChanged(null);
mInsetsControllersByDisplayId.get(SECOND_DISPLAY).insetsControlChanged(null, null);
mInsetsControllersByDisplayId.get(SECOND_DISPLAY).showInsets(0, false);
@@ -165,7 +164,8 @@ public class DisplayInsetsControllerTest {
int hideInsetsCount = 0;
@Override
- public void topFocusedWindowChanged(String packageName) {
+ public void topFocusedWindowChanged(String packageName,
+ InsetsVisibilities requestedVisibilities) {
topFocusedWindowChangedCount++;
}
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index e592774ad17f..81560d4f8676 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -6369,10 +6369,11 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
* Notifies the remote insets controller that the top focused window has changed.
*
* @param packageName The name of the package that is open in the top focused window.
+ * @param requestedVisibilities The insets visibilities requested by the focussed window.
*/
- void topFocusedWindowChanged(String packageName) {
+ void topFocusedWindowChanged(String packageName, InsetsVisibilities requestedVisibilities) {
try {
- mRemoteInsetsController.topFocusedWindowChanged(packageName);
+ mRemoteInsetsController.topFocusedWindowChanged(packageName, requestedVisibilities);
} catch (RemoteException e) {
Slog.w(TAG, "Failed to deliver package in top focused window change", e);
}
diff --git a/services/core/java/com/android/server/wm/InsetsPolicy.java b/services/core/java/com/android/server/wm/InsetsPolicy.java
index 9844cb5fe8f8..a7b37281842a 100644
--- a/services/core/java/com/android/server/wm/InsetsPolicy.java
+++ b/services/core/java/com/android/server/wm/InsetsPolicy.java
@@ -533,7 +533,7 @@ class InsetsPolicy {
}
if (remoteInsetsControllerControlsSystemBars(focusedWin)) {
mDisplayContent.mRemoteInsetsControlTarget.topFocusedWindowChanged(
- focusedWin.mAttrs.packageName);
+ focusedWin.mAttrs.packageName, focusedWin.getRequestedVisibilities());
return mDisplayContent.mRemoteInsetsControlTarget;
}
if (mPolicy.areSystemBarsForcedShownLw()) {
@@ -590,7 +590,7 @@ class InsetsPolicy {
}
if (remoteInsetsControllerControlsSystemBars(focusedWin)) {
mDisplayContent.mRemoteInsetsControlTarget.topFocusedWindowChanged(
- focusedWin.mAttrs.packageName);
+ focusedWin.mAttrs.packageName, focusedWin.getRequestedVisibilities());
return mDisplayContent.mRemoteInsetsControlTarget;
}
if (mPolicy.areSystemBarsForcedShownLw()) {
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
index bcab4a5cde27..c672b9173570 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
@@ -87,6 +87,7 @@ import android.view.IDisplayWindowInsetsController;
import android.view.IWindow;
import android.view.InsetsSourceControl;
import android.view.InsetsState;
+import android.view.InsetsVisibilities;
import android.view.Surface;
import android.view.SurfaceControl;
import android.view.SurfaceControl.Transaction;
@@ -793,7 +794,8 @@ class WindowTestsBase extends SystemServiceTestsBase {
}
@Override
- public void topFocusedWindowChanged(String packageName) {
+ public void topFocusedWindowChanged(String packageName,
+ InsetsVisibilities requestedVisibilities) {
}
};
}