Skip to content

Commit ab24d7c

Browse files
author
Android Build Coastguard Worker
committed
Merge cherrypicks of ['googleplex-android-review.googlesource.com/22791220', 'googleplex-android-review.googlesource.com/22569796', 'googleplex-android-review.googlesource.com/22670803', 'googleplex-android-review.googlesource.com/22901260', 'googleplex-android-review.googlesource.com/23053887', 'googleplex-android-review.googlesource.com/23054378', 'googleplex-android-review.googlesource.com/23103421', 'googleplex-android-review.googlesource.com/23048037', 'googleplex-android-review.googlesource.com/22733606', 'googleplex-android-review.googlesource.com/22912038', 'googleplex-android-review.googlesource.com/22915981'] into sparse-10216780-L32300000960937408.
SPARSE_CHANGE: I7bc69ddf1c1742bd800eea4068ce268dfd96d0e3 SPARSE_CHANGE: Ib3240c0b5037a3a20692c83e2daa8cd858125ca7 SPARSE_CHANGE: Ibd6d9a8377e4b5327a473f8b9adf4e569e826172 SPARSE_CHANGE: Ie12843d00c5336e5a472624205e4e4b9ec881cc5 SPARSE_CHANGE: I98618477a828eb72b2173af6988e804471139e81 SPARSE_CHANGE: Ic7b1c4b40960fd04de9efbf4f6d7abee45c93025 SPARSE_CHANGE: Ib4eef40a0f59512c669b069532e55d36293f9e1c SPARSE_CHANGE: I62e829555c43136080ee4909f7dcf8c388165e9f SPARSE_CHANGE: I1c51c6f66cd6967651068de1ffc2e6e8566f5a46 SPARSE_CHANGE: I35ba4652a125c8c83e18138f0fb0a51f3ef65b73 SPARSE_CHANGE: I2bfdc7801cec1b3aaa44f841d8a821214c6cb801 Change-Id: Ieea33d3005d3bfa29c5287899a6299f6ed666a36
2 parents 3169dfc + 8618d83 commit ab24d7c

20 files changed

Lines changed: 284 additions & 147 deletions

File tree

core/res/res/values/config.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,9 @@
572572
docked if the dock is configured to enable the accelerometer. -->
573573
<bool name="config_supportAutoRotation">true</bool>
574574

575+
<!-- If true, allows rotation resolver service to help resolve screen rotation. -->
576+
<bool name="config_allowRotationResolver">true</bool>
577+
575578
<!-- If true, the screen can be rotated via the accelerometer in all 4
576579
rotations as the default behavior. -->
577580
<bool name="config_allowAllRotations">false</bool>

core/res/res/values/symbols.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,6 +1754,7 @@
17541754
<java-symbol type="bool" name="config_perDisplayFocusEnabled" />
17551755
<java-symbol type="bool" name="config_showNavigationBar" />
17561756
<java-symbol type="bool" name="config_supportAutoRotation" />
1757+
<java-symbol type="bool" name="config_allowRotationResolver" />
17571758
<java-symbol type="bool" name="config_dockedStackDividerFreeSnapMode" />
17581759
<java-symbol type="dimen" name="docked_stack_divider_thickness" />
17591760
<java-symbol type="dimen" name="docked_stack_divider_insets" />

libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitLayout.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -727,10 +727,6 @@ public void applySurfaceChanges(SurfaceControl.Transaction t, SurfaceControl lea
727727
getRefBounds2(mTempRect);
728728
t.setPosition(leash2, mTempRect.left, mTempRect.top)
729729
.setWindowCrop(leash2, mTempRect.width(), mTempRect.height());
730-
// Make right or bottom side surface always higher than left or top side to avoid weird
731-
// animation when dismiss split. e.g. App surface fling above on decor surface.
732-
t.setLayer(leash1, 1);
733-
t.setLayer(leash2, 2);
734730

735731
if (mImePositionProcessor.adjustSurfaceLayoutForIme(
736732
t, dividerLeash, leash1, leash2, dimLayer1, dimLayer2)) {

libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java

Lines changed: 19 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -468,26 +468,10 @@ public void onAnimationStart(@WindowManager.TransitionOldType int transit,
468468
RemoteAnimationTarget[] wallpapers,
469469
RemoteAnimationTarget[] nonApps,
470470
final IRemoteAnimationFinishedCallback finishedCallback) {
471-
boolean openingToSide = false;
472-
if (apps != null) {
473-
for (int i = 0; i < apps.length; ++i) {
474-
if (apps[i].mode == MODE_OPENING
475-
&& mSideStage.containsTask(apps[i].taskId)) {
476-
openingToSide = true;
477-
break;
478-
}
479-
}
480-
} else if (mSideStage.getChildCount() != 0) {
481-
// There are chances the entering app transition got canceled by performing
482-
// rotation transition. Checks if there is any child task existed in split
483-
// screen before fallback to cancel entering flow.
484-
openingToSide = true;
485-
}
486-
487-
if (isEnteringSplit && !openingToSide) {
471+
if (isEnteringSplit && mSideStage.getChildCount() == 0) {
488472
mMainExecutor.execute(() -> exitSplitScreen(
489-
mSideStage.getChildCount() == 0 ? mMainStage : mSideStage,
490-
EXIT_REASON_UNKNOWN));
473+
null /* childrenToTop */, EXIT_REASON_UNKNOWN));
474+
mSplitUnsupportedToast.show();
491475
}
492476

493477
if (finishedCallback != null) {
@@ -572,26 +556,10 @@ public void onAnimationStart(int transit, RemoteAnimationTarget[] apps,
572556
RemoteAnimationTarget[] wallpapers, RemoteAnimationTarget[] nonApps,
573557
IRemoteAnimationFinishedCallback finishedCallback,
574558
SurfaceControl.Transaction t) {
575-
boolean openingToSide = false;
576-
if (apps != null) {
577-
for (int i = 0; i < apps.length; ++i) {
578-
if (apps[i].mode == MODE_OPENING
579-
&& mSideStage.containsTask(apps[i].taskId)) {
580-
openingToSide = true;
581-
break;
582-
}
583-
}
584-
} else if (mSideStage.getChildCount() != 0) {
585-
// There are chances the entering app transition got canceled by performing
586-
// rotation transition. Checks if there is any child task existed in split
587-
// screen before fallback to cancel entering flow.
588-
openingToSide = true;
589-
}
590-
591-
if (isEnteringSplit && !openingToSide && apps != null) {
559+
if (isEnteringSplit && mSideStage.getChildCount() == 0) {
592560
mMainExecutor.execute(() -> exitSplitScreen(
593-
mSideStage.getChildCount() == 0 ? mMainStage : mSideStage,
594-
EXIT_REASON_UNKNOWN));
561+
null /* childrenToTop */, EXIT_REASON_UNKNOWN));
562+
mSplitUnsupportedToast.show();
595563
}
596564

597565
if (apps != null) {
@@ -1034,7 +1002,7 @@ private void setEnterInstanceId(InstanceId instanceId) {
10341002
private void onRemoteAnimationFinishedOrCancelled(WindowContainerTransaction evictWct) {
10351003
mIsDividerRemoteAnimating = false;
10361004
mShouldUpdateRecents = true;
1037-
mSplitRequest = null;
1005+
clearRequestIfPresented();
10381006
// If any stage has no child after animation finished, it means that split will display
10391007
// nothing, such status will happen if task and intent is same app but not support
10401008
// multi-instance, we should exit split and expand that app as full screen.
@@ -1054,7 +1022,7 @@ private void onRemoteAnimationFinishedOrCancelled(WindowContainerTransaction evi
10541022
private void onRemoteAnimationFinished(RemoteAnimationTarget[] apps) {
10551023
mIsDividerRemoteAnimating = false;
10561024
mShouldUpdateRecents = true;
1057-
mSplitRequest = null;
1025+
clearRequestIfPresented();
10581026
// If any stage has no child after finished animation, that side of the split will display
10591027
// nothing. This might happen if starting the same app on the both sides while not
10601028
// supporting multi-instance. Exit the split screen and expand that app to full screen.
@@ -1320,6 +1288,7 @@ private void applyExitSplitScreen(@Nullable StageTaskListener childrenToTop,
13201288
});
13211289
mShouldUpdateRecents = false;
13221290
mIsDividerRemoteAnimating = false;
1291+
mSplitRequest = null;
13231292

13241293
mSplitLayout.getInvisibleBounds(mTempRect1);
13251294
if (childrenToTop == null || childrenToTop.getTopVisibleChildTaskId() == INVALID_TASK_ID) {
@@ -1412,6 +1381,13 @@ protected void grantFocusToStage(@SplitPosition int stageToFocus) {
14121381
}
14131382
}
14141383

1384+
private void clearRequestIfPresented() {
1385+
if (mSideStageListener.mVisible && mSideStageListener.mHasChildren
1386+
&& mMainStageListener.mVisible && mSideStageListener.mHasChildren) {
1387+
mSplitRequest = null;
1388+
}
1389+
}
1390+
14151391
/**
14161392
* Returns whether the split pair in the recent tasks list should be broken.
14171393
*/
@@ -1776,6 +1752,7 @@ private void onStageVisibilityChanged(StageListenerImpl stageListener) {
17761752
true /* setReparentLeafTaskIfRelaunch */);
17771753
setRootForceTranslucent(true, wct);
17781754
} else {
1755+
clearRequestIfPresented();
17791756
wct.setReparentLeafTaskIfRelaunch(mRootTaskInfo.token,
17801757
false /* setReparentLeafTaskIfRelaunch */);
17811758
setRootForceTranslucent(false, wct);
@@ -1926,7 +1903,7 @@ private void onStageHasChildrenChanged(StageListenerImpl stageListener) {
19261903
}
19271904
if (mMainStageListener.mHasChildren && mSideStageListener.mHasChildren) {
19281905
mShouldUpdateRecents = true;
1929-
mSplitRequest = null;
1906+
clearRequestIfPresented();
19301907
updateRecentTasksSplitPair();
19311908

19321909
if (!mLogger.hasStartedSession()) {
@@ -2565,6 +2542,7 @@ public void prepareDismissAnimation(@StageType int toStage, @ExitReason int dism
25652542
}
25662543
});
25672544
mShouldUpdateRecents = false;
2545+
mSplitRequest = null;
25682546

25692547
// Update local states.
25702548
setSplitsVisible(false);

libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -220,20 +220,12 @@ public void onTaskInfoChanged(ActivityManager.RunningTaskInfo taskInfo) {
220220
mCallbacks.onNoLongerSupportMultiWindow();
221221
return;
222222
}
223-
if (taskInfo.topActivity == null && mChildrenTaskInfo.contains(taskInfo.taskId)
224-
&& mChildrenTaskInfo.get(taskInfo.taskId).topActivity != null) {
225-
// If top activity become null, it means the task is about to vanish, we use this
226-
// signal to remove it from children list earlier for smooth dismiss transition.
227-
mChildrenTaskInfo.remove(taskInfo.taskId);
228-
mChildrenLeashes.remove(taskInfo.taskId);
229-
} else {
230-
mChildrenTaskInfo.put(taskInfo.taskId, taskInfo);
231-
}
223+
mChildrenTaskInfo.put(taskInfo.taskId, taskInfo);
232224
mCallbacks.onChildTaskStatusChanged(taskInfo.taskId, true /* present */,
233225
taskInfo.isVisible);
234-
if (!ENABLE_SHELL_TRANSITIONS && mChildrenLeashes.contains(taskInfo.taskId)) {
235-
updateChildTaskSurface(taskInfo, mChildrenLeashes.get(taskInfo.taskId),
236-
false /* firstAppeared */);
226+
if (!ENABLE_SHELL_TRANSITIONS) {
227+
updateChildTaskSurface(
228+
taskInfo, mChildrenLeashes.get(taskInfo.taskId), false /* firstAppeared */);
237229
}
238230
} else {
239231
throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo
@@ -267,6 +259,9 @@ public void onTaskVanished(ActivityManager.RunningTaskInfo taskInfo) {
267259
return;
268260
}
269261
sendStatusChanged();
262+
} else {
263+
throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo
264+
+ "\n mRootTaskInfo: " + mRootTaskInfo);
270265
}
271266
}
272267

libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/StageTaskListenerTests.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ public void testChildTaskAppeared() {
126126
verify(mCallbacks).onStatusChanged(eq(mRootTask.isVisible), eq(true));
127127
}
128128

129+
@Test(expected = IllegalArgumentException.class)
130+
public void testUnknownTaskVanished() {
131+
final ActivityManager.RunningTaskInfo task = new TestRunningTaskInfoBuilder().build();
132+
mStageTaskListener.onTaskVanished(task);
133+
}
134+
129135
@Test
130136
public void testTaskVanished() {
131137
// With shell transitions, the transition manages status changes, so skip this test.

libs/hwui/renderthread/VulkanSurface.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,14 @@ void VulkanSurface::releaseBuffers() {
368368
}
369369
}
370370

371+
void VulkanSurface::invalidateBuffers() {
372+
for (uint32_t i = 0; i < mWindowInfo.bufferCount; i++) {
373+
VulkanSurface::NativeBufferInfo& bufferInfo = mNativeBuffers[i];
374+
bufferInfo.hasValidContents = false;
375+
bufferInfo.lastPresentedCount = 0;
376+
}
377+
}
378+
371379
VulkanSurface::NativeBufferInfo* VulkanSurface::dequeueNativeBuffer() {
372380
// Set the mCurrentBufferInfo to invalid in case of error and only reset it to the correct
373381
// value at the end of the function if everything dequeued correctly.
@@ -400,6 +408,10 @@ VulkanSurface::NativeBufferInfo* VulkanSurface::dequeueNativeBuffer() {
400408
// new NativeBufferInfo storage will be populated lazily as we dequeue each new buffer.
401409
mWindowInfo.actualSize = actualSize;
402410
releaseBuffers();
411+
} else {
412+
// A change in transform means we need to repaint the entire buffer area as the damage
413+
// rects have just moved about.
414+
invalidateBuffers();
403415
}
404416

405417
if (transformHint != mWindowInfo.transform) {

libs/hwui/renderthread/VulkanSurface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class VulkanSurface {
113113
WindowInfo* outWindowInfo);
114114
static bool UpdateWindow(ANativeWindow* window, const WindowInfo& windowInfo);
115115
void releaseBuffers();
116+
void invalidateBuffers();
116117

117118
// TODO: This number comes from ui/BufferQueueDefs. We're not pulling the
118119
// header in so that we don't need to depend on libui, but we should share

packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2843,6 +2843,7 @@ public void setHeadsUpAnimatingAway(boolean headsUpAnimatingAway) {
28432843
/** Set whether the bouncer is showing. */
28442844
public void setBouncerShowing(boolean bouncerShowing) {
28452845
mBouncerShowing = bouncerShowing;
2846+
mNotificationStackScrollLayoutController.updateShowEmptyShadeView();
28462847
updateVisibility();
28472848
}
28482849

packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,8 @@ public void updateShowEmptyShadeView() {
12401240
// Hide empty shade view when in transition to Keyguard.
12411241
// That avoids "No Notifications" to blink when transitioning to AOD.
12421242
// For more details, see: b/228790482
1243-
&& !isInTransitionToKeyguard();
1243+
&& !isInTransitionToKeyguard()
1244+
&& !mCentralSurfaces.isBouncerShowing();
12441245

12451246
mView.updateEmptyShadeView(shouldShow, mZenModeController.areNotificationsHiddenInShade());
12461247

0 commit comments

Comments
 (0)