Pass the keep clear areas to PipBoundsState.
Bug: 183746978 Test: atest PipControllerTest Change-Id: Ic1cfe6e51298f172a09d3ab31dd599b7002e99b7
This commit is contained in:
@@ -89,13 +89,14 @@ import com.android.wm.shell.transition.Transitions;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* Manages the picture-in-picture (PIP) UI and states for Phones.
|
||||
*/
|
||||
public class PipController implements PipTransitionController.PipTransitionCallback,
|
||||
RemoteCallable<PipController> {
|
||||
RemoteCallable<PipController>, DisplayController.OnDisplaysChangedListener {
|
||||
private static final String TAG = "PipController";
|
||||
|
||||
private Context mContext;
|
||||
@@ -454,6 +455,14 @@ public class PipController implements PipTransitionController.PipTransitionCallb
|
||||
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) {
|
||||
mPipBoundsAlgorithm.onConfigurationChanged(mContext);
|
||||
mTouchHandler.onConfigurationChanged();
|
||||
|
||||
@@ -59,6 +59,7 @@ import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link PipController}
|
||||
@@ -209,4 +210,15 @@ public class PipControllerTest extends ShellTestCase {
|
||||
|
||||
verify(mMockPipMotionHelper, never()).movePip(any(Rect.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onKeepClearAreasChanged_updatesPipBoundsState() {
|
||||
final int displayId = 1;
|
||||
final Rect keepClearArea = new Rect(0, 0, 10, 10);
|
||||
when(mMockPipBoundsState.getDisplayId()).thenReturn(displayId);
|
||||
|
||||
mPipController.onKeepClearAreasChanged(displayId, Set.of(keepClearArea), Set.of());
|
||||
|
||||
verify(mMockPipBoundsState).setKeepClearAreas(Set.of(keepClearArea), Set.of());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user