diff options
3 files changed, 54 insertions, 73 deletions
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl index 0350f2d47569..114472b15f02 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/IOverviewProxy.aidl @@ -16,6 +16,7 @@ package com.android.systemui.shared.recents; +import android.graphics.Rect; import android.graphics.Region; import android.os.Bundle; import android.view.MotionEvent; @@ -69,4 +70,9 @@ oneway interface IOverviewProxy { * Sent when some system ui state changes. */ void onSystemUiStateChanged(int stateFlags) = 16; + + /** + * Sent when the split screen is resized + */ + void onSplitScreenSecondaryBoundsChanged(in Rect bounds, in Rect insets) = 17; } diff --git a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java index 34a9e28b943a..b272b60f3593 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java @@ -842,7 +842,26 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis Log.e(TAG_OPS, "Failed to get overview proxy for assistant visibility."); } } 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); } } diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java index db89cea385b7..8ca50cdddf71 100644 --- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java +++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java @@ -19,7 +19,6 @@ package com.android.systemui.stackdivider; import static android.view.PointerIcon.TYPE_HORIZONTAL_DOUBLE_ARROW; import static android.view.PointerIcon.TYPE_VERTICAL_DOUBLE_ARROW; import static android.view.WindowManager.DOCKED_RIGHT; -import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING; import android.animation.AnimationHandler; import android.animation.Animator; @@ -39,7 +38,6 @@ import android.os.RemoteException; import android.util.AttributeSet; import android.util.Slog; import android.view.Display; -import android.view.InsetsState; import android.view.MotionEvent; import android.view.PointerIcon; import android.view.SurfaceControl; @@ -48,10 +46,8 @@ import android.view.VelocityTracker; import android.view.View; import android.view.View.OnTouchListener; import android.view.ViewConfiguration; -import android.view.ViewRootImpl; import android.view.ViewTreeObserver.InternalInsetsInfo; import android.view.ViewTreeObserver.OnComputeInternalInsetsListener; -import android.view.WindowInsets; import android.view.WindowManager; import android.view.accessibility.AccessibilityNodeInfo; 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.SnapTarget; import com.android.internal.policy.DockedDividerUtils; +import com.android.systemui.Dependency; import com.android.systemui.Interpolators; 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 java.util.function.Consumer; @@ -120,7 +117,6 @@ public class DividerView extends FrameLayout implements OnTouchListener, private int mStartY; private int mStartPosition; private int mDockSide; - private final int[] mTempInt2 = new int[2]; private boolean mMoving; private int mTouchSlop; private boolean mBackgroundLifted; @@ -148,7 +144,6 @@ public class DividerView extends FrameLayout implements OnTouchListener, private FlingAnimationUtils mFlingAnimationUtils; private SplitDisplayLayout mSplitLayout; private DividerCallbacks mCallback; - private final Rect mStableInsets = new Rect(); private final AnimationHandler mAnimationHandler = new AnimationHandler(); private boolean mGrowRecents; @@ -336,29 +331,6 @@ public class DividerView extends FrameLayout implements OnTouchListener, } @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 protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); if (mFirstLayout) { @@ -381,6 +353,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, if (changed) { mWindowManagerProxy.setTouchRegion(new Rect(mHandle.getLeft(), mHandle.getTop(), mHandle.getRight(), mHandle.getBottom())); + notifySplitScreenBoundsChanged(); } } @@ -405,19 +378,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, } public Rect getNonMinimizedSplitScreenSecondaryBounds() { - calculateBoundsForPosition(mSnapTargetBeforeMinimized.position, - 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; - } + mOtherTaskRect.set(mSplitLayout.mSecondary); return mOtherTaskRect; } @@ -681,6 +642,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, saveSnapTargetBeforeMinimized(saveTarget); } } + notifySplitScreenBoundsChanged(); }; anim.addListener(new AnimatorListenerAdapter() { @@ -713,6 +675,25 @@ public class DividerView extends FrameLayout implements OnTouchListener, 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() { if (mCurrentAnimator != null) { mCurrentAnimator.cancel(); @@ -846,8 +827,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, mDockedStackMinimized = minimized; if (mSplitLayout.mDisplayLayout.rotation() != mDefaultDisplay.getRotation()) { // Splitscreen to minimize is about to starts after rotating landscape to seascape, - // update insets, display info and snap algorithm targets - WindowManagerWrapper.getInstance().getStableInsets(mStableInsets); + // update display info and snap algorithm targets repositionSnapTargetBeforeMinimized(); } 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 if (mDockSide == DOCKED_RIGHT) { - mDockedTaskRect.offset(Math.max(position, mStableInsets.left - mDividerSize) + mDockedTaskRect.offset(Math.max(position, -mDividerSize) - mDockedTaskRect.left + mDividerSize, 0); } 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 if (mDockSide == DOCKED_RIGHT) { - mDockedTaskRect.offset(Math.max(position, mStableInsets.left - mDividerSize) + mDockedTaskRect.offset(Math.max(position, -mDividerSize) - mDockedTaskRect.left + mDividerSize, 0); } 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 if (mDockSide == DOCKED_RIGHT) { - mDockedTaskRect.offset(position - mStableInsets.left + mDividerSize, 0); + mDockedTaskRect.offset(position + mDividerSize, 0); } resizeSplitSurfaces(t, mDockedRect, mDockedTaskRect, mOtherRect, mOtherTaskRect); } else if (taskPosition != TASK_POSITION_SAME) { @@ -1238,34 +1218,10 @@ public class DividerView extends FrameLayout implements OnTouchListener, float fraction = getSnapAlgorithm().calculateDismissingFraction(position); fraction = Math.max(0, Math.min(fraction, 1f)); fraction = DIM_INTERPOLATOR.getInterpolation(fraction); - if (hasInsetsAtDismissTarget(dismissTarget)) { - - // Less darkening with system insets. - fraction *= 0.8f; - } 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 * 0 size. */ |