Merge "Add the insets visibilities requested by the focussed window in topFocussedWindowChanged() api." into tm-dev
This commit is contained in:
@@ -18,6 +18,7 @@ package android.view;
|
|||||||
|
|
||||||
import android.view.InsetsSourceControl;
|
import android.view.InsetsSourceControl;
|
||||||
import android.view.InsetsState;
|
import android.view.InsetsState;
|
||||||
|
import android.view.InsetsVisibilities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Singular controller of insets to use when there isn't another obvious controller available.
|
* 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
|
* 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.
|
* control. Won't be called if config_remoteInsetsControllerControlsSystemBars is false.
|
||||||
* @param packageName: Passes the top package name
|
* @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
|
* @see IWindow#insetsChanged
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ import android.view.WindowInsets;
|
|||||||
import android.view.animation.Interpolator;
|
import android.view.animation.Interpolator;
|
||||||
import android.view.animation.PathInterpolator;
|
import android.view.animation.PathInterpolator;
|
||||||
|
|
||||||
import androidx.annotation.BinderThread;
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
|
||||||
import com.android.internal.view.IInputMethodManager;
|
import com.android.internal.view.IInputMethodManager;
|
||||||
@@ -325,7 +324,8 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void topFocusedWindowChanged(String packageName) {
|
public void topFocusedWindowChanged(String packageName,
|
||||||
|
InsetsVisibilities requestedVisibilities) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import android.view.IDisplayWindowInsetsController;
|
|||||||
import android.view.IWindowManager;
|
import android.view.IWindowManager;
|
||||||
import android.view.InsetsSourceControl;
|
import android.view.InsetsSourceControl;
|
||||||
import android.view.InsetsState;
|
import android.view.InsetsState;
|
||||||
|
import android.view.InsetsVisibilities;
|
||||||
|
|
||||||
import androidx.annotation.BinderThread;
|
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);
|
CopyOnWriteArrayList<OnInsetsChangedListener> listeners = mListeners.get(mDisplayId);
|
||||||
if (listeners == null) {
|
if (listeners == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (OnInsetsChangedListener listener : listeners) {
|
for (OnInsetsChangedListener listener : listeners) {
|
||||||
listener.topFocusedWindowChanged(packageName);
|
listener.topFocusedWindowChanged(packageName, requestedVisibilities);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,9 +186,10 @@ public class DisplayInsetsController implements DisplayController.OnDisplaysChan
|
|||||||
private class DisplayWindowInsetsControllerImpl
|
private class DisplayWindowInsetsControllerImpl
|
||||||
extends IDisplayWindowInsetsController.Stub {
|
extends IDisplayWindowInsetsController.Stub {
|
||||||
@Override
|
@Override
|
||||||
public void topFocusedWindowChanged(String packageName) throws RemoteException {
|
public void topFocusedWindowChanged(String packageName,
|
||||||
|
InsetsVisibilities requestedVisibilities) throws RemoteException {
|
||||||
mMainExecutor.execute(() -> {
|
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
|
* 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.
|
* 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.
|
* Called when the window insets configuration has changed.
|
||||||
|
|||||||
@@ -19,11 +19,8 @@ package com.android.wm.shell.common;
|
|||||||
import static android.view.Display.DEFAULT_DISPLAY;
|
import static android.view.Display.DEFAULT_DISPLAY;
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
import static org.mockito.ArgumentMatchers.notNull;
|
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.times;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
@@ -33,6 +30,7 @@ import android.view.IDisplayWindowInsetsController;
|
|||||||
import android.view.IWindowManager;
|
import android.view.IWindowManager;
|
||||||
import android.view.InsetsSourceControl;
|
import android.view.InsetsSourceControl;
|
||||||
import android.view.InsetsState;
|
import android.view.InsetsState;
|
||||||
|
import android.view.InsetsVisibilities;
|
||||||
|
|
||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
|
|
||||||
@@ -42,7 +40,6 @@ import org.junit.Before;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.Mockito;
|
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -99,7 +96,8 @@ public class DisplayInsetsControllerTest {
|
|||||||
mController.addInsetsChangedListener(DEFAULT_DISPLAY, defaultListener);
|
mController.addInsetsChangedListener(DEFAULT_DISPLAY, defaultListener);
|
||||||
mController.addInsetsChangedListener(SECOND_DISPLAY, secondListener);
|
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).insetsChanged(null);
|
||||||
mInsetsControllersByDisplayId.get(DEFAULT_DISPLAY).insetsControlChanged(null, null);
|
mInsetsControllersByDisplayId.get(DEFAULT_DISPLAY).insetsControlChanged(null, null);
|
||||||
mInsetsControllersByDisplayId.get(DEFAULT_DISPLAY).showInsets(0, false);
|
mInsetsControllersByDisplayId.get(DEFAULT_DISPLAY).showInsets(0, false);
|
||||||
@@ -118,7 +116,8 @@ public class DisplayInsetsControllerTest {
|
|||||||
assertTrue(secondListener.showInsetsCount == 0);
|
assertTrue(secondListener.showInsetsCount == 0);
|
||||||
assertTrue(secondListener.hideInsetsCount == 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).insetsChanged(null);
|
||||||
mInsetsControllersByDisplayId.get(SECOND_DISPLAY).insetsControlChanged(null, null);
|
mInsetsControllersByDisplayId.get(SECOND_DISPLAY).insetsControlChanged(null, null);
|
||||||
mInsetsControllersByDisplayId.get(SECOND_DISPLAY).showInsets(0, false);
|
mInsetsControllersByDisplayId.get(SECOND_DISPLAY).showInsets(0, false);
|
||||||
@@ -165,7 +164,8 @@ public class DisplayInsetsControllerTest {
|
|||||||
int hideInsetsCount = 0;
|
int hideInsetsCount = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void topFocusedWindowChanged(String packageName) {
|
public void topFocusedWindowChanged(String packageName,
|
||||||
|
InsetsVisibilities requestedVisibilities) {
|
||||||
topFocusedWindowChangedCount++;
|
topFocusedWindowChangedCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6369,10 +6369,11 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
|||||||
* Notifies the remote insets controller that the top focused window has changed.
|
* 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 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 {
|
try {
|
||||||
mRemoteInsetsController.topFocusedWindowChanged(packageName);
|
mRemoteInsetsController.topFocusedWindowChanged(packageName, requestedVisibilities);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.w(TAG, "Failed to deliver package in top focused window change", e);
|
Slog.w(TAG, "Failed to deliver package in top focused window change", e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -533,7 +533,7 @@ class InsetsPolicy {
|
|||||||
}
|
}
|
||||||
if (remoteInsetsControllerControlsSystemBars(focusedWin)) {
|
if (remoteInsetsControllerControlsSystemBars(focusedWin)) {
|
||||||
mDisplayContent.mRemoteInsetsControlTarget.topFocusedWindowChanged(
|
mDisplayContent.mRemoteInsetsControlTarget.topFocusedWindowChanged(
|
||||||
focusedWin.mAttrs.packageName);
|
focusedWin.mAttrs.packageName, focusedWin.getRequestedVisibilities());
|
||||||
return mDisplayContent.mRemoteInsetsControlTarget;
|
return mDisplayContent.mRemoteInsetsControlTarget;
|
||||||
}
|
}
|
||||||
if (mPolicy.areSystemBarsForcedShownLw()) {
|
if (mPolicy.areSystemBarsForcedShownLw()) {
|
||||||
@@ -590,7 +590,7 @@ class InsetsPolicy {
|
|||||||
}
|
}
|
||||||
if (remoteInsetsControllerControlsSystemBars(focusedWin)) {
|
if (remoteInsetsControllerControlsSystemBars(focusedWin)) {
|
||||||
mDisplayContent.mRemoteInsetsControlTarget.topFocusedWindowChanged(
|
mDisplayContent.mRemoteInsetsControlTarget.topFocusedWindowChanged(
|
||||||
focusedWin.mAttrs.packageName);
|
focusedWin.mAttrs.packageName, focusedWin.getRequestedVisibilities());
|
||||||
return mDisplayContent.mRemoteInsetsControlTarget;
|
return mDisplayContent.mRemoteInsetsControlTarget;
|
||||||
}
|
}
|
||||||
if (mPolicy.areSystemBarsForcedShownLw()) {
|
if (mPolicy.areSystemBarsForcedShownLw()) {
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ import android.view.IDisplayWindowInsetsController;
|
|||||||
import android.view.IWindow;
|
import android.view.IWindow;
|
||||||
import android.view.InsetsSourceControl;
|
import android.view.InsetsSourceControl;
|
||||||
import android.view.InsetsState;
|
import android.view.InsetsState;
|
||||||
|
import android.view.InsetsVisibilities;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
import android.view.SurfaceControl;
|
import android.view.SurfaceControl;
|
||||||
import android.view.SurfaceControl.Transaction;
|
import android.view.SurfaceControl.Transaction;
|
||||||
@@ -793,7 +794,8 @@ class WindowTestsBase extends SystemServiceTestsBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void topFocusedWindowChanged(String packageName) {
|
public void topFocusedWindowChanged(String packageName,
|
||||||
|
InsetsVisibilities requestedVisibilities) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user