summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-04-14 01:03:33 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-04-14 01:03:33 +0000
commit877d6d061b806bc8e5524725eac91e8a5fa45bc1 (patch)
tree20e298e647afad4a33ead01e24958c1c46a62e8b
parent3066da9e84e201193277995adea7292afd887f8e (diff)
parentc4a202ae995daffc672ffa90a79e7f903c2c7922 (diff)
downloadbase-877d6d061b806bc8e5524725eac91e8a5fa45bc1.tar.gz
Merge cherrypicks of ['googleplex-android-review.googlesource.com/22608608', 'googleplex-android-review.googlesource.com/22595180', 'googleplex-android-review.googlesource.com/22599030'] into tm-qpr3-release.
Change-Id: Ie69fe4e0537aa520501e43976143f1c339454384
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java35
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipResizeGestureHandler.java10
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipResizeGestureHandlerTest.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayStateController.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/touch/TouchInsetManager.java3
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayStateControllerTest.java17
6 files changed, 28 insertions, 45 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java
index c4b5470f461a..7da750211b7e 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java
@@ -73,7 +73,6 @@ import android.window.TaskOrganizer;
import android.window.TaskSnapshot;
import android.window.WindowContainerToken;
import android.window.WindowContainerTransaction;
-import android.window.WindowContainerTransactionCallback;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.protolog.common.ProtoLog;
@@ -145,23 +144,6 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
protected final ShellTaskOrganizer mTaskOrganizer;
protected final ShellExecutor mMainExecutor;
- // the runnable to execute after WindowContainerTransactions is applied to finish resizing pip
- private Runnable mPipFinishResizeWCTRunnable;
-
- private final WindowContainerTransactionCallback mPipFinishResizeWCTCallback =
- new WindowContainerTransactionCallback() {
- @Override
- public void onTransactionReady(int id, SurfaceControl.Transaction t) {
- t.apply();
-
- // execute the runnable if non-null after WCT is applied to finish resizing pip
- if (mPipFinishResizeWCTRunnable != null) {
- mPipFinishResizeWCTRunnable.run();
- mPipFinishResizeWCTRunnable = null;
- }
- }
- };
-
// These callbacks are called on the update thread
private final PipAnimationController.PipAnimationCallback mPipAnimationCallback =
new PipAnimationController.PipAnimationCallback() {
@@ -1278,23 +1260,8 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
/**
* Animates resizing of the pinned stack given the duration and start bounds.
* This is used when the starting bounds is not the current PiP bounds.
- *
- * @param pipFinishResizeWCTRunnable callback to run after window updates are complete
*/
public void scheduleAnimateResizePip(Rect fromBounds, Rect toBounds, int duration,
- float startingAngle, Consumer<Rect> updateBoundsCallback,
- Runnable pipFinishResizeWCTRunnable) {
- mPipFinishResizeWCTRunnable = pipFinishResizeWCTRunnable;
- if (mPipFinishResizeWCTRunnable != null) {
- ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
- "mPipFinishResizeWCTRunnable is set to be called once window updates");
- }
-
- scheduleAnimateResizePip(fromBounds, toBounds, duration, startingAngle,
- updateBoundsCallback);
- }
-
- private void scheduleAnimateResizePip(Rect fromBounds, Rect toBounds, int duration,
float startingAngle, Consumer<Rect> updateBoundsCallback) {
if (mWaitForFixedRotation) {
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
@@ -1599,7 +1566,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
mSplitScreenOptional.ifPresent(splitScreenController ->
splitScreenController.enterSplitScreen(mTaskInfo.taskId, wasPipTopLeft, wct));
} else {
- mTaskOrganizer.applySyncTransaction(wct, mPipFinishResizeWCTCallback);
+ mTaskOrganizer.applyTransaction(wct);
}
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipResizeGestureHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipResizeGestureHandler.java
index 3e83c5fcf9a0..41ff0b35a035 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipResizeGestureHandler.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipResizeGestureHandler.java
@@ -580,16 +580,8 @@ public class PipResizeGestureHandler {
final float snapFraction = mPipBoundsAlgorithm.getSnapFraction(
mLastResizeBounds, movementBounds);
mPipBoundsAlgorithm.applySnapFraction(mLastResizeBounds, snapFraction);
-
- // disable the pinch resizing until the final bounds are updated
- final boolean prevEnablePinchResize = mEnablePinchResize;
- mEnablePinchResize = false;
-
mPipTaskOrganizer.scheduleAnimateResizePip(startBounds, mLastResizeBounds,
- PINCH_RESIZE_SNAP_DURATION, mAngle, mUpdateResizeBoundsCallback, () -> {
- // reset the pinch resizing to its default state
- mEnablePinchResize = prevEnablePinchResize;
- });
+ PINCH_RESIZE_SNAP_DURATION, mAngle, mUpdateResizeBoundsCallback);
} else {
mPipTaskOrganizer.scheduleFinishResizePip(mLastResizeBounds,
PipAnimationController.TRANSITION_DIRECTION_USER_RESIZE,
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipResizeGestureHandlerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipResizeGestureHandlerTest.java
index 5f356c93d0a4..c7b9eb3d1074 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipResizeGestureHandlerTest.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipResizeGestureHandlerTest.java
@@ -155,7 +155,7 @@ public class PipResizeGestureHandlerTest extends ShellTestCase {
mPipResizeGestureHandler.onPinchResize(upEvent);
verify(mPipTaskOrganizer, times(1))
- .scheduleAnimateResizePip(any(), any(), anyInt(), anyFloat(), any(), any());
+ .scheduleAnimateResizePip(any(), any(), anyInt(), anyFloat(), any());
assertTrue("The new size should be bigger than the original PiP size.",
mPipResizeGestureHandler.getLastResizeBounds().width()
@@ -194,7 +194,7 @@ public class PipResizeGestureHandlerTest extends ShellTestCase {
mPipResizeGestureHandler.onPinchResize(upEvent);
verify(mPipTaskOrganizer, times(1))
- .scheduleAnimateResizePip(any(), any(), anyInt(), anyFloat(), any(), any());
+ .scheduleAnimateResizePip(any(), any(), anyInt(), anyFloat(), any());
assertTrue("The new size should be smaller than the original PiP size.",
mPipResizeGestureHandler.getLastResizeBounds().width()
diff --git a/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayStateController.java b/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayStateController.java
index a47565390d6b..b575f9a0ab8b 100644
--- a/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayStateController.java
+++ b/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayStateController.java
@@ -182,6 +182,10 @@ public class DreamOverlayStateController implements
* Returns collection of present {@link Complication}.
*/
public Collection<Complication> getComplications(boolean filterByAvailability) {
+ if (isLowLightActive()) {
+ // Don't show complications on low light.
+ return Collections.emptyList();
+ }
return Collections.unmodifiableCollection(filterByAvailability
? mComplications
.stream()
diff --git a/packages/SystemUI/src/com/android/systemui/touch/TouchInsetManager.java b/packages/SystemUI/src/com/android/systemui/touch/TouchInsetManager.java
index a4f1ef4fa756..ef0fa012d56d 100644
--- a/packages/SystemUI/src/com/android/systemui/touch/TouchInsetManager.java
+++ b/packages/SystemUI/src/com/android/systemui/touch/TouchInsetManager.java
@@ -90,6 +90,9 @@ public class TouchInsetManager {
final Region cumulativeRegion = Region.obtain();
mTrackedViews.stream().forEach(view -> {
+ if (!view.isAttachedToWindow()) {
+ return;
+ }
final Rect boundaries = new Rect();
view.getDrawingRect(boundaries);
((ViewGroup) view.getRootView()).offsetDescendantRectToMyCoords(view, boundaries);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayStateControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayStateControllerTest.java
index 34fa76fd5d46..55f0a8cd3f08 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayStateControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayStateControllerTest.java
@@ -235,6 +235,23 @@ public class DreamOverlayStateControllerTest extends SysuiTestCase {
}
@Test
+ public void testComplicationsNotShownForLowLight() {
+ final Complication complication = Mockito.mock(Complication.class);
+ final DreamOverlayStateController stateController = getDreamOverlayStateController(true);
+
+ // Add a complication and verify it's returned in getComplications.
+ stateController.addComplication(complication);
+ mExecutor.runAllReady();
+ assertThat(stateController.getComplications().contains(complication))
+ .isTrue();
+
+ stateController.setLowLightActive(true);
+ mExecutor.runAllReady();
+
+ assertThat(stateController.getComplications()).isEmpty();
+ }
+
+ @Test
public void testNotifyLowLightChanged() {
final DreamOverlayStateController stateController = getDreamOverlayStateController(true);