Skip to content

Commit 877d6d0

Browse files
author
Android Build Coastguard Worker
committed
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
2 parents 3066da9 + c4a202a commit 877d6d0

6 files changed

Lines changed: 28 additions & 45 deletions

File tree

libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
import android.window.TaskSnapshot;
7474
import android.window.WindowContainerToken;
7575
import android.window.WindowContainerTransaction;
76-
import android.window.WindowContainerTransactionCallback;
7776

7877
import com.android.internal.annotations.VisibleForTesting;
7978
import com.android.internal.protolog.common.ProtoLog;
@@ -145,23 +144,6 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
145144
protected final ShellTaskOrganizer mTaskOrganizer;
146145
protected final ShellExecutor mMainExecutor;
147146

148-
// the runnable to execute after WindowContainerTransactions is applied to finish resizing pip
149-
private Runnable mPipFinishResizeWCTRunnable;
150-
151-
private final WindowContainerTransactionCallback mPipFinishResizeWCTCallback =
152-
new WindowContainerTransactionCallback() {
153-
@Override
154-
public void onTransactionReady(int id, SurfaceControl.Transaction t) {
155-
t.apply();
156-
157-
// execute the runnable if non-null after WCT is applied to finish resizing pip
158-
if (mPipFinishResizeWCTRunnable != null) {
159-
mPipFinishResizeWCTRunnable.run();
160-
mPipFinishResizeWCTRunnable = null;
161-
}
162-
}
163-
};
164-
165147
// These callbacks are called on the update thread
166148
private final PipAnimationController.PipAnimationCallback mPipAnimationCallback =
167149
new PipAnimationController.PipAnimationCallback() {
@@ -1278,23 +1260,8 @@ public void scheduleAnimateResizePip(Rect toBounds, int duration,
12781260
/**
12791261
* Animates resizing of the pinned stack given the duration and start bounds.
12801262
* This is used when the starting bounds is not the current PiP bounds.
1281-
*
1282-
* @param pipFinishResizeWCTRunnable callback to run after window updates are complete
12831263
*/
12841264
public void scheduleAnimateResizePip(Rect fromBounds, Rect toBounds, int duration,
1285-
float startingAngle, Consumer<Rect> updateBoundsCallback,
1286-
Runnable pipFinishResizeWCTRunnable) {
1287-
mPipFinishResizeWCTRunnable = pipFinishResizeWCTRunnable;
1288-
if (mPipFinishResizeWCTRunnable != null) {
1289-
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
1290-
"mPipFinishResizeWCTRunnable is set to be called once window updates");
1291-
}
1292-
1293-
scheduleAnimateResizePip(fromBounds, toBounds, duration, startingAngle,
1294-
updateBoundsCallback);
1295-
}
1296-
1297-
private void scheduleAnimateResizePip(Rect fromBounds, Rect toBounds, int duration,
12981265
float startingAngle, Consumer<Rect> updateBoundsCallback) {
12991266
if (mWaitForFixedRotation) {
13001267
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
@@ -1599,7 +1566,7 @@ public void applyFinishBoundsResize(@NonNull WindowContainerTransaction wct,
15991566
mSplitScreenOptional.ifPresent(splitScreenController ->
16001567
splitScreenController.enterSplitScreen(mTaskInfo.taskId, wasPipTopLeft, wct));
16011568
} else {
1602-
mTaskOrganizer.applySyncTransaction(wct, mPipFinishResizeWCTCallback);
1569+
mTaskOrganizer.applyTransaction(wct);
16031570
}
16041571
}
16051572

libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipResizeGestureHandler.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -580,16 +580,8 @@ private void finishResize() {
580580
final float snapFraction = mPipBoundsAlgorithm.getSnapFraction(
581581
mLastResizeBounds, movementBounds);
582582
mPipBoundsAlgorithm.applySnapFraction(mLastResizeBounds, snapFraction);
583-
584-
// disable the pinch resizing until the final bounds are updated
585-
final boolean prevEnablePinchResize = mEnablePinchResize;
586-
mEnablePinchResize = false;
587-
588583
mPipTaskOrganizer.scheduleAnimateResizePip(startBounds, mLastResizeBounds,
589-
PINCH_RESIZE_SNAP_DURATION, mAngle, mUpdateResizeBoundsCallback, () -> {
590-
// reset the pinch resizing to its default state
591-
mEnablePinchResize = prevEnablePinchResize;
592-
});
584+
PINCH_RESIZE_SNAP_DURATION, mAngle, mUpdateResizeBoundsCallback);
593585
} else {
594586
mPipTaskOrganizer.scheduleFinishResizePip(mLastResizeBounds,
595587
PipAnimationController.TRANSITION_DIRECTION_USER_RESIZE,

libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/phone/PipResizeGestureHandlerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public void twoInput_triggersPinchResize_getBigger() {
155155
mPipResizeGestureHandler.onPinchResize(upEvent);
156156

157157
verify(mPipTaskOrganizer, times(1))
158-
.scheduleAnimateResizePip(any(), any(), anyInt(), anyFloat(), any(), any());
158+
.scheduleAnimateResizePip(any(), any(), anyInt(), anyFloat(), any());
159159

160160
assertTrue("The new size should be bigger than the original PiP size.",
161161
mPipResizeGestureHandler.getLastResizeBounds().width()
@@ -194,7 +194,7 @@ public void twoInput_triggersPinchResize_getSmaller() {
194194
mPipResizeGestureHandler.onPinchResize(upEvent);
195195

196196
verify(mPipTaskOrganizer, times(1))
197-
.scheduleAnimateResizePip(any(), any(), anyInt(), anyFloat(), any(), any());
197+
.scheduleAnimateResizePip(any(), any(), anyInt(), anyFloat(), any());
198198

199199
assertTrue("The new size should be smaller than the original PiP size.",
200200
mPipResizeGestureHandler.getLastResizeBounds().width()

packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayStateController.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ public Collection<Complication> getComplications() {
182182
* Returns collection of present {@link Complication}.
183183
*/
184184
public Collection<Complication> getComplications(boolean filterByAvailability) {
185+
if (isLowLightActive()) {
186+
// Don't show complications on low light.
187+
return Collections.emptyList();
188+
}
185189
return Collections.unmodifiableCollection(filterByAvailability
186190
? mComplications
187191
.stream()

packages/SystemUI/src/com/android/systemui/touch/TouchInsetManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ private void updateTouchRegion() {
9090
final Region cumulativeRegion = Region.obtain();
9191

9292
mTrackedViews.stream().forEach(view -> {
93+
if (!view.isAttachedToWindow()) {
94+
return;
95+
}
9396
final Rect boundaries = new Rect();
9497
view.getDrawingRect(boundaries);
9598
((ViewGroup) view.getRootView()).offsetDescendantRectToMyCoords(view, boundaries);

packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayStateControllerTest.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,23 @@ public void testComplicationWithNoTypeNotFiltered() {
234234
.isTrue();
235235
}
236236

237+
@Test
238+
public void testComplicationsNotShownForLowLight() {
239+
final Complication complication = Mockito.mock(Complication.class);
240+
final DreamOverlayStateController stateController = getDreamOverlayStateController(true);
241+
242+
// Add a complication and verify it's returned in getComplications.
243+
stateController.addComplication(complication);
244+
mExecutor.runAllReady();
245+
assertThat(stateController.getComplications().contains(complication))
246+
.isTrue();
247+
248+
stateController.setLowLightActive(true);
249+
mExecutor.runAllReady();
250+
251+
assertThat(stateController.getComplications()).isEmpty();
252+
}
253+
237254
@Test
238255
public void testNotifyLowLightChanged() {
239256
final DreamOverlayStateController stateController = getDreamOverlayStateController(true);

0 commit comments

Comments
 (0)