From 4fb0877a920efd2873830902b4b64786e931d181 Mon Sep 17 00:00:00 2001 From: Jerry Chang Date: Fri, 31 Jul 2020 16:55:21 +0800 Subject: [PATCH] Remove legacy callbacks between recents and split screen Removes legacy recents callbacks between recents and split screen since there's no need to interact with RecentsActivityStartingEvent and RecentGrowingEvent after deprecated legacy recents implmentaton. Bug: 161116823 Test: atest SystemUITests Test: manual check recents behavior while in split screen mode Change-Id: Iee1546d41ae2b1a8e4162cbb2fa599162a5b308f --- packages/SystemUI/res/values/config.xml | 4 -- .../com/android/systemui/recents/Recents.java | 4 -- .../systemui/stackdivider/Divider.java | 12 +---- .../stackdivider/DividerController.java | 4 +- .../systemui/stackdivider/DividerModule.java | 12 ++--- .../systemui/stackdivider/DividerState.java | 1 - .../systemui/stackdivider/DividerView.java | 45 +------------------ 7 files changed, 8 insertions(+), 74 deletions(-) diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index 2ad0cab4501ca..fa620df12b87d 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -161,10 +161,6 @@ 10000 - - true - 250 diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java index 5f37cc4520a3c..df61fd19ad456 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java +++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java @@ -65,10 +65,6 @@ public class Recents extends SystemUI implements CommandQueue.Callbacks { } } - public void growRecents() { - mImpl.growRecents(); - } - @Override public void showRecentApps(boolean triggeredFromAltTab) { // Ensure the device has been provisioned before allowing the user to interact with diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java b/packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java index 5301bbda3874b..4007abb399037 100644 --- a/packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java +++ b/packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java @@ -23,20 +23,16 @@ import android.content.Context; import android.window.WindowContainerToken; import com.android.systemui.SystemUI; -import com.android.systemui.recents.Recents; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.TaskStackChangeListener; import com.android.systemui.statusbar.policy.KeyguardStateController; import java.io.FileDescriptor; import java.io.PrintWriter; -import java.util.Optional; import java.util.function.Consumer; import javax.inject.Singleton; -import dagger.Lazy; - /** * Controls the docked stack divider. */ @@ -44,15 +40,12 @@ import dagger.Lazy; public class Divider extends SystemUI { private final KeyguardStateController mKeyguardStateController; private final DividerController mDividerController; - private final Optional> mRecentsOptionalLazy; Divider(Context context, DividerController dividerController, - KeyguardStateController keyguardStateController, - Optional> recentsOptionalLazy) { + KeyguardStateController keyguardStateController) { super(context); mDividerController = dividerController; mKeyguardStateController = keyguardStateController; - mRecentsOptionalLazy = recentsOptionalLazy; } @Override @@ -113,8 +106,7 @@ public class Divider extends SystemUI { } public void onRecentsDrawn() { - mDividerController.onRecentsDrawn(() -> mRecentsOptionalLazy.ifPresent( - recentsLazy -> recentsLazy.get().growRecents())); + mDividerController.onRecentsDrawn(); } public void onDockedFirstAnimationFrame() { diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerController.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerController.java index 14fc15746a257..81649f608581a 100644 --- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerController.java +++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerController.java @@ -391,9 +391,9 @@ public class DividerController implements DividerView.DividerCallbacks, * subscriber, or DividerView, which has been removed and prevented from resizing. Instead, * register the event handler here and proxy the event to the current DividerView. */ - public void onRecentsDrawn(DividerView.RecentDrawnCallback callback) { + public void onRecentsDrawn() { if (mView != null) { - mView.onRecentsDrawn(callback); + mView.onRecentsDrawn(); } } diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerModule.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerModule.java index cdf44d7d562eb..db0aef8a06116 100644 --- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerModule.java +++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerModule.java @@ -20,18 +20,14 @@ import android.content.Context; import android.os.Handler; import com.android.systemui.dagger.qualifiers.Main; -import com.android.systemui.recents.Recents; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.wm.shell.common.DisplayController; import com.android.wm.shell.common.DisplayImeController; import com.android.wm.shell.common.SystemWindows; import com.android.wm.shell.common.TransactionPool; -import java.util.Optional; - import javax.inject.Singleton; -import dagger.Lazy; import dagger.Module; import dagger.Provides; @@ -42,14 +38,12 @@ import dagger.Provides; public class DividerModule { @Singleton @Provides - static Divider provideDivider(Context context, Optional> recentsOptionalLazy, - DisplayController displayController, SystemWindows systemWindows, - DisplayImeController imeController, @Main Handler handler, + static Divider provideDivider(Context context, DisplayController displayController, + SystemWindows systemWindows, DisplayImeController imeController, @Main Handler handler, KeyguardStateController keyguardStateController, TransactionPool transactionPool) { // TODO(b/161116823): fetch DividerProxy from WM shell lib. DividerController dividerController = new DividerController(context, displayController, systemWindows, imeController, handler, transactionPool); - return new Divider(context, dividerController, keyguardStateController, - recentsOptionalLazy); + return new Divider(context, dividerController, keyguardStateController); } } diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerState.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerState.java index 3a5c61e6d7f0c..8e79d51ee2099 100644 --- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerState.java +++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerState.java @@ -21,6 +21,5 @@ package com.android.systemui.stackdivider; */ public class DividerState { public boolean animateAfterRecentsDrawn; - public boolean growAfterRecentsDrawn; public float mRatioPositionBeforeMinimized; } diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java index 6447c52d5b43b..e5c02d6fc4547 100644 --- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java +++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java @@ -83,10 +83,6 @@ public class DividerView extends FrameLayout implements OnTouchListener, void onDraggingEnd(); } - interface RecentDrawnCallback { - void growRecents(); - } - static final long TOUCH_ANIMATION_DURATION = 150; static final long TOUCH_RELEASE_ANIMATION_DURATION = 200; @@ -151,7 +147,6 @@ public class DividerView extends FrameLayout implements OnTouchListener, private DividerCallbacks mCallback; private final AnimationHandler mAnimationHandler = new AnimationHandler(); - private boolean mGrowRecents; private ValueAnimator mCurrentAnimator; private boolean mEntranceAnimationRunning; private boolean mExitAnimationRunning; @@ -307,7 +302,6 @@ public class DividerView extends FrameLayout implements OnTouchListener, R.dimen.docked_stack_divider_lift_elevation); mLongPressEntraceAnimDuration = getResources().getInteger( R.integer.long_press_dock_anim_duration); - mGrowRecents = getResources().getBoolean(R.bool.recents_grow_in_multiwindow); mTouchSlop = ViewConfiguration.get(mContext).getScaledTouchSlop(); mFlingAnimationUtils = new FlingAnimationUtils(getResources().getDisplayMetrics(), 0.3f); boolean landscape = getResources().getConfiguration().orientation @@ -1322,39 +1316,11 @@ public class DividerView extends FrameLayout implements OnTouchListener, mBackground.getRight(), mBackground.getBottom(), Op.UNION); } - /** - * Checks whether recents will grow when invoked. This happens in multi-window when recents is - * very small. When invoking recents, we shrink the docked stack so recents has more space. - * - * @return the position of the divider when recents grows, or - * {@link #INVALID_RECENTS_GROW_TARGET} if recents won't grow - */ - public int growsRecents() { - boolean result = mGrowRecents - && mDockSide == WindowManager.DOCKED_TOP - && getCurrentPosition() == getSnapAlgorithm().getLastSplitTarget().position; - if (result) { - return getSnapAlgorithm().getMiddleTarget().position; - } else { - return INVALID_RECENTS_GROW_TARGET; - } - } - - void onRecentsActivityStarting() { - if (mGrowRecents && mDockSide == WindowManager.DOCKED_TOP - && getSnapAlgorithm().getMiddleTarget() != getSnapAlgorithm().getLastSplitTarget() - && getCurrentPosition() == getSnapAlgorithm().getLastSplitTarget().position) { - mState.growAfterRecentsDrawn = true; - startDragging(false /* animate */, false /* touching */); - } - } - void onDockedFirstAnimationFrame() { saveSnapTargetBeforeMinimized(mSplitLayout.getSnapAlgorithm().getMiddleTarget()); } void onDockedTopTask() { - mState.growAfterRecentsDrawn = false; mState.animateAfterRecentsDrawn = true; startDragging(false /* animate */, false /* touching */); updateDockSide(); @@ -1366,7 +1332,7 @@ public class DividerView extends FrameLayout implements OnTouchListener, null /* transaction */); } - void onRecentsDrawn(RecentDrawnCallback callback) { + void onRecentsDrawn() { updateDockSide(); final int position = calculatePositionForInsetBounds(); if (mState.animateAfterRecentsDrawn) { @@ -1380,15 +1346,6 @@ public class DividerView extends FrameLayout implements OnTouchListener, 200 /* endDelay */); }); } - if (mState.growAfterRecentsDrawn) { - mState.growAfterRecentsDrawn = false; - updateDockSide(); - if (callback != null) { - callback.growRecents(); - } - stopDragging(position, getSnapAlgorithm().getMiddleTarget(), 336, - Interpolators.FAST_OUT_SLOW_IN); - } } void onUndockingTask() {