Merge "Sending split screen stack change to Launcher whenever it changes, instead of Launcher pulling it" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2fed0a734e
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.systemui.shared.recents;
|
package com.android.systemui.shared.recents;
|
||||||
|
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.graphics.Region;
|
import android.graphics.Region;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
@@ -69,4 +70,9 @@ oneway interface IOverviewProxy {
|
|||||||
* Sent when some system ui state changes.
|
* Sent when some system ui state changes.
|
||||||
*/
|
*/
|
||||||
void onSystemUiStateChanged(int stateFlags) = 16;
|
void onSystemUiStateChanged(int stateFlags) = 16;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sent when the split screen is resized
|
||||||
|
*/
|
||||||
|
void onSplitScreenSecondaryBoundsChanged(in Rect bounds, in Rect insets) = 17;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -842,7 +842,26 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
|
|||||||
Log.e(TAG_OPS, "Failed to get overview proxy for assistant visibility.");
|
Log.e(TAG_OPS, "Failed to get overview proxy for assistant visibility.");
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(TAG_OPS, "Failed to call onAssistantVisibilityChanged()", e);
|
Log.e(TAG_OPS, "Failed to call notifyAssistantVisibilityChanged()", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies the Launcher of split screen size changes
|
||||||
|
* @param secondaryWindowBounds Bounds of the secondary window including the insets
|
||||||
|
* @param secondaryWindowInsets stable insets received by the secondary window
|
||||||
|
*/
|
||||||
|
public void notifySplitScreenBoundsChanged(
|
||||||
|
Rect secondaryWindowBounds, Rect secondaryWindowInsets) {
|
||||||
|
try {
|
||||||
|
if (mOverviewProxy != null) {
|
||||||
|
mOverviewProxy.onSplitScreenSecondaryBoundsChanged(
|
||||||
|
secondaryWindowBounds, secondaryWindowInsets);
|
||||||
|
} else {
|
||||||
|
Log.e(TAG_OPS, "Failed to get overview proxy for split screen bounds.");
|
||||||
|
}
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.e(TAG_OPS, "Failed to call onSplitScreenSecondaryBoundsChanged()", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ package com.android.systemui.stackdivider;
|
|||||||
import static android.view.PointerIcon.TYPE_HORIZONTAL_DOUBLE_ARROW;
|
import static android.view.PointerIcon.TYPE_HORIZONTAL_DOUBLE_ARROW;
|
||||||
import static android.view.PointerIcon.TYPE_VERTICAL_DOUBLE_ARROW;
|
import static android.view.PointerIcon.TYPE_VERTICAL_DOUBLE_ARROW;
|
||||||
import static android.view.WindowManager.DOCKED_RIGHT;
|
import static android.view.WindowManager.DOCKED_RIGHT;
|
||||||
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
|
|
||||||
|
|
||||||
import android.animation.AnimationHandler;
|
import android.animation.AnimationHandler;
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
@@ -39,7 +38,6 @@ import android.os.RemoteException;
|
|||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
import android.view.InsetsState;
|
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.PointerIcon;
|
import android.view.PointerIcon;
|
||||||
import android.view.SurfaceControl;
|
import android.view.SurfaceControl;
|
||||||
@@ -48,10 +46,8 @@ import android.view.VelocityTracker;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnTouchListener;
|
import android.view.View.OnTouchListener;
|
||||||
import android.view.ViewConfiguration;
|
import android.view.ViewConfiguration;
|
||||||
import android.view.ViewRootImpl;
|
|
||||||
import android.view.ViewTreeObserver.InternalInsetsInfo;
|
import android.view.ViewTreeObserver.InternalInsetsInfo;
|
||||||
import android.view.ViewTreeObserver.OnComputeInternalInsetsListener;
|
import android.view.ViewTreeObserver.OnComputeInternalInsetsListener;
|
||||||
import android.view.WindowInsets;
|
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.accessibility.AccessibilityNodeInfo;
|
import android.view.accessibility.AccessibilityNodeInfo;
|
||||||
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
|
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
|
||||||
@@ -65,9 +61,10 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
|||||||
import com.android.internal.policy.DividerSnapAlgorithm;
|
import com.android.internal.policy.DividerSnapAlgorithm;
|
||||||
import com.android.internal.policy.DividerSnapAlgorithm.SnapTarget;
|
import com.android.internal.policy.DividerSnapAlgorithm.SnapTarget;
|
||||||
import com.android.internal.policy.DockedDividerUtils;
|
import com.android.internal.policy.DockedDividerUtils;
|
||||||
|
import com.android.systemui.Dependency;
|
||||||
import com.android.systemui.Interpolators;
|
import com.android.systemui.Interpolators;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.shared.system.WindowManagerWrapper;
|
import com.android.systemui.recents.OverviewProxyService;
|
||||||
import com.android.systemui.statusbar.FlingAnimationUtils;
|
import com.android.systemui.statusbar.FlingAnimationUtils;
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
@@ -120,7 +117,6 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
private int mStartY;
|
private int mStartY;
|
||||||
private int mStartPosition;
|
private int mStartPosition;
|
||||||
private int mDockSide;
|
private int mDockSide;
|
||||||
private final int[] mTempInt2 = new int[2];
|
|
||||||
private boolean mMoving;
|
private boolean mMoving;
|
||||||
private int mTouchSlop;
|
private int mTouchSlop;
|
||||||
private boolean mBackgroundLifted;
|
private boolean mBackgroundLifted;
|
||||||
@@ -148,7 +144,6 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
private FlingAnimationUtils mFlingAnimationUtils;
|
private FlingAnimationUtils mFlingAnimationUtils;
|
||||||
private SplitDisplayLayout mSplitLayout;
|
private SplitDisplayLayout mSplitLayout;
|
||||||
private DividerCallbacks mCallback;
|
private DividerCallbacks mCallback;
|
||||||
private final Rect mStableInsets = new Rect();
|
|
||||||
private final AnimationHandler mAnimationHandler = new AnimationHandler();
|
private final AnimationHandler mAnimationHandler = new AnimationHandler();
|
||||||
|
|
||||||
private boolean mGrowRecents;
|
private boolean mGrowRecents;
|
||||||
@@ -335,29 +330,6 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
mCallback = null;
|
mCallback = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
|
|
||||||
if (isAttachedToWindow()
|
|
||||||
&& ViewRootImpl.sNewInsetsMode == ViewRootImpl.NEW_INSETS_MODE_FULL) {
|
|
||||||
// Our window doesn't cover entire display, so we use the display frame to re-calculate
|
|
||||||
// the insets.
|
|
||||||
final InsetsState state = getWindowInsetsController().getState();
|
|
||||||
insets = state.calculateInsets(state.getDisplayFrame(),
|
|
||||||
null /* ignoringVisibilityState */, insets.isRound(),
|
|
||||||
insets.shouldAlwaysConsumeSystemBars(), insets.getDisplayCutout(),
|
|
||||||
0 /* legacySystemUiFlags */,
|
|
||||||
SOFT_INPUT_ADJUST_NOTHING, null /* typeSideMap */);
|
|
||||||
}
|
|
||||||
if (mStableInsets.left != insets.getStableInsetLeft()
|
|
||||||
|| mStableInsets.top != insets.getStableInsetTop()
|
|
||||||
|| mStableInsets.right != insets.getStableInsetRight()
|
|
||||||
|| mStableInsets.bottom != insets.getStableInsetBottom()) {
|
|
||||||
mStableInsets.set(insets.getStableInsetLeft(), insets.getStableInsetTop(),
|
|
||||||
insets.getStableInsetRight(), insets.getStableInsetBottom());
|
|
||||||
}
|
|
||||||
return super.onApplyWindowInsets(insets);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||||
super.onLayout(changed, left, top, right, bottom);
|
super.onLayout(changed, left, top, right, bottom);
|
||||||
@@ -381,6 +353,7 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
if (changed) {
|
if (changed) {
|
||||||
mWindowManagerProxy.setTouchRegion(new Rect(mHandle.getLeft(), mHandle.getTop(),
|
mWindowManagerProxy.setTouchRegion(new Rect(mHandle.getLeft(), mHandle.getTop(),
|
||||||
mHandle.getRight(), mHandle.getBottom()));
|
mHandle.getRight(), mHandle.getBottom()));
|
||||||
|
notifySplitScreenBoundsChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -405,19 +378,7 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Rect getNonMinimizedSplitScreenSecondaryBounds() {
|
public Rect getNonMinimizedSplitScreenSecondaryBounds() {
|
||||||
calculateBoundsForPosition(mSnapTargetBeforeMinimized.position,
|
mOtherTaskRect.set(mSplitLayout.mSecondary);
|
||||||
DockedDividerUtils.invertDockSide(mDockSide), mOtherTaskRect);
|
|
||||||
mOtherTaskRect.bottom -= mStableInsets.bottom;
|
|
||||||
switch (mDockSide) {
|
|
||||||
case WindowManager.DOCKED_LEFT:
|
|
||||||
mOtherTaskRect.top += mStableInsets.top;
|
|
||||||
mOtherTaskRect.right -= mStableInsets.right;
|
|
||||||
break;
|
|
||||||
case WindowManager.DOCKED_RIGHT:
|
|
||||||
mOtherTaskRect.top += mStableInsets.top;
|
|
||||||
mOtherTaskRect.left += mStableInsets.left;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return mOtherTaskRect;
|
return mOtherTaskRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -681,6 +642,7 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
saveSnapTargetBeforeMinimized(saveTarget);
|
saveSnapTargetBeforeMinimized(saveTarget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
notifySplitScreenBoundsChanged();
|
||||||
};
|
};
|
||||||
anim.addListener(new AnimatorListenerAdapter() {
|
anim.addListener(new AnimatorListenerAdapter() {
|
||||||
|
|
||||||
@@ -713,6 +675,25 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
return anim;
|
return anim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void notifySplitScreenBoundsChanged() {
|
||||||
|
mOtherTaskRect.set(mSplitLayout.mSecondary);
|
||||||
|
|
||||||
|
mTmpRect.set(mSplitLayout.mDisplayLayout.stableInsets());
|
||||||
|
switch (mSplitLayout.getPrimarySplitSide()) {
|
||||||
|
case WindowManager.DOCKED_LEFT:
|
||||||
|
mTmpRect.left = 0;
|
||||||
|
break;
|
||||||
|
case WindowManager.DOCKED_RIGHT:
|
||||||
|
mTmpRect.right = 0;
|
||||||
|
break;
|
||||||
|
case WindowManager.DOCKED_TOP:
|
||||||
|
mTmpRect.top = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Dependency.get(OverviewProxyService.class)
|
||||||
|
.notifySplitScreenBoundsChanged(mOtherTaskRect, mTmpRect);
|
||||||
|
}
|
||||||
|
|
||||||
private void cancelFlingAnimation() {
|
private void cancelFlingAnimation() {
|
||||||
if (mCurrentAnimator != null) {
|
if (mCurrentAnimator != null) {
|
||||||
mCurrentAnimator.cancel();
|
mCurrentAnimator.cancel();
|
||||||
@@ -846,8 +827,7 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
mDockedStackMinimized = minimized;
|
mDockedStackMinimized = minimized;
|
||||||
if (mSplitLayout.mDisplayLayout.rotation() != mDefaultDisplay.getRotation()) {
|
if (mSplitLayout.mDisplayLayout.rotation() != mDefaultDisplay.getRotation()) {
|
||||||
// Splitscreen to minimize is about to starts after rotating landscape to seascape,
|
// Splitscreen to minimize is about to starts after rotating landscape to seascape,
|
||||||
// update insets, display info and snap algorithm targets
|
// update display info and snap algorithm targets
|
||||||
WindowManagerWrapper.getInstance().getStableInsets(mStableInsets);
|
|
||||||
repositionSnapTargetBeforeMinimized();
|
repositionSnapTargetBeforeMinimized();
|
||||||
}
|
}
|
||||||
if (mIsInMinimizeInteraction != minimized || mCurrentAnimator != null) {
|
if (mIsInMinimizeInteraction != minimized || mCurrentAnimator != null) {
|
||||||
@@ -1149,7 +1129,7 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
|
|
||||||
// Move a right-docked-app to line up with the divider while dragging it
|
// Move a right-docked-app to line up with the divider while dragging it
|
||||||
if (mDockSide == DOCKED_RIGHT) {
|
if (mDockSide == DOCKED_RIGHT) {
|
||||||
mDockedTaskRect.offset(Math.max(position, mStableInsets.left - mDividerSize)
|
mDockedTaskRect.offset(Math.max(position, -mDividerSize)
|
||||||
- mDockedTaskRect.left + mDividerSize, 0);
|
- mDockedTaskRect.left + mDividerSize, 0);
|
||||||
}
|
}
|
||||||
resizeSplitSurfaces(t, mDockedRect, mDockedTaskRect, mOtherRect,
|
resizeSplitSurfaces(t, mDockedRect, mDockedTaskRect, mOtherRect,
|
||||||
@@ -1164,7 +1144,7 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
|
|
||||||
// Move a docked app if from the right in position with the divider up to insets
|
// Move a docked app if from the right in position with the divider up to insets
|
||||||
if (mDockSide == DOCKED_RIGHT) {
|
if (mDockSide == DOCKED_RIGHT) {
|
||||||
mDockedTaskRect.offset(Math.max(position, mStableInsets.left - mDividerSize)
|
mDockedTaskRect.offset(Math.max(position, -mDividerSize)
|
||||||
- mDockedTaskRect.left + mDividerSize, 0);
|
- mDockedTaskRect.left + mDividerSize, 0);
|
||||||
}
|
}
|
||||||
calculateBoundsForPosition(taskPosition, DockedDividerUtils.invertDockSide(mDockSide),
|
calculateBoundsForPosition(taskPosition, DockedDividerUtils.invertDockSide(mDockSide),
|
||||||
@@ -1180,7 +1160,7 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
|
|
||||||
// Move a right-docked-app to line up with the divider while dragging it
|
// Move a right-docked-app to line up with the divider while dragging it
|
||||||
if (mDockSide == DOCKED_RIGHT) {
|
if (mDockSide == DOCKED_RIGHT) {
|
||||||
mDockedTaskRect.offset(position - mStableInsets.left + mDividerSize, 0);
|
mDockedTaskRect.offset(position + mDividerSize, 0);
|
||||||
}
|
}
|
||||||
resizeSplitSurfaces(t, mDockedRect, mDockedTaskRect, mOtherRect, mOtherTaskRect);
|
resizeSplitSurfaces(t, mDockedRect, mDockedTaskRect, mOtherRect, mOtherTaskRect);
|
||||||
} else if (taskPosition != TASK_POSITION_SAME) {
|
} else if (taskPosition != TASK_POSITION_SAME) {
|
||||||
@@ -1238,33 +1218,9 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
float fraction = getSnapAlgorithm().calculateDismissingFraction(position);
|
float fraction = getSnapAlgorithm().calculateDismissingFraction(position);
|
||||||
fraction = Math.max(0, Math.min(fraction, 1f));
|
fraction = Math.max(0, Math.min(fraction, 1f));
|
||||||
fraction = DIM_INTERPOLATOR.getInterpolation(fraction);
|
fraction = DIM_INTERPOLATOR.getInterpolation(fraction);
|
||||||
if (hasInsetsAtDismissTarget(dismissTarget)) {
|
|
||||||
|
|
||||||
// Less darkening with system insets.
|
|
||||||
fraction *= 0.8f;
|
|
||||||
}
|
|
||||||
return fraction;
|
return fraction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return true if and only if there are system insets at the location of the dismiss target
|
|
||||||
*/
|
|
||||||
private boolean hasInsetsAtDismissTarget(SnapTarget dismissTarget) {
|
|
||||||
if (isHorizontalDivision()) {
|
|
||||||
if (dismissTarget == getSnapAlgorithm().getDismissStartTarget()) {
|
|
||||||
return mStableInsets.top != 0;
|
|
||||||
} else {
|
|
||||||
return mStableInsets.bottom != 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (dismissTarget == getSnapAlgorithm().getDismissStartTarget()) {
|
|
||||||
return mStableInsets.left != 0;
|
|
||||||
} else {
|
|
||||||
return mStableInsets.right != 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the snap target is dismissing one side, make sure that the dismissing side doesn't get
|
* When the snap target is dismissing one side, make sure that the dismissing side doesn't get
|
||||||
* 0 size.
|
* 0 size.
|
||||||
|
|||||||
Reference in New Issue
Block a user