Merge "Pass the keep clear areas through proper implementation. The PipController is not registered as DisplayWindowListener, but this inner implementation is." into tm-dev

This commit is contained in:
Mateusz Cicheński
2022-03-24 19:36:53 +00:00
committed by Android (Google) Code Review
2 changed files with 11 additions and 10 deletions

View File

@@ -96,7 +96,7 @@ import java.util.function.Consumer;
* Manages the picture-in-picture (PIP) UI and states for Phones. * Manages the picture-in-picture (PIP) UI and states for Phones.
*/ */
public class PipController implements PipTransitionController.PipTransitionCallback, public class PipController implements PipTransitionController.PipTransitionCallback,
RemoteCallable<PipController>, DisplayController.OnDisplaysChangedListener { RemoteCallable<PipController> {
private static final String TAG = "PipController"; private static final String TAG = "PipController";
private Context mContext; private Context mContext;
@@ -234,6 +234,14 @@ public class PipController implements PipTransitionController.PipTransitionCallb
onDisplayChanged(mDisplayController.getDisplayLayout(displayId), onDisplayChanged(mDisplayController.getDisplayLayout(displayId),
true /* saveRestoreSnapFraction */); true /* saveRestoreSnapFraction */);
} }
@Override
public void onKeepClearAreasChanged(int displayId, Set<Rect> restricted,
Set<Rect> unrestricted) {
if (mPipBoundsState.getDisplayId() == displayId) {
mPipBoundsState.setKeepClearAreas(restricted, unrestricted);
}
}
}; };
/** /**
@@ -463,14 +471,6 @@ public class PipController implements PipTransitionController.PipTransitionCallb
return mMainExecutor; return mMainExecutor;
} }
@Override
public void onKeepClearAreasChanged(int displayId, Set<Rect> restricted,
Set<Rect> unrestricted) {
if (mPipBoundsState.getDisplayId() == displayId) {
mPipBoundsState.setKeepClearAreas(restricted, unrestricted);
}
}
private void onConfigurationChanged(Configuration newConfig) { private void onConfigurationChanged(Configuration newConfig) {
mPipBoundsAlgorithm.onConfigurationChanged(mContext); mPipBoundsAlgorithm.onConfigurationChanged(mContext);
mTouchHandler.onConfigurationChanged(); mTouchHandler.onConfigurationChanged();

View File

@@ -217,7 +217,8 @@ public class PipControllerTest extends ShellTestCase {
final Rect keepClearArea = new Rect(0, 0, 10, 10); final Rect keepClearArea = new Rect(0, 0, 10, 10);
when(mMockPipBoundsState.getDisplayId()).thenReturn(displayId); when(mMockPipBoundsState.getDisplayId()).thenReturn(displayId);
mPipController.onKeepClearAreasChanged(displayId, Set.of(keepClearArea), Set.of()); mPipController.mDisplaysChangedListener.onKeepClearAreasChanged(
displayId, Set.of(keepClearArea), Set.of());
verify(mMockPipBoundsState).setKeepClearAreas(Set.of(keepClearArea), Set.of()); verify(mMockPipBoundsState).setKeepClearAreas(Set.of(keepClearArea), Set.of());
} }